Accessing Obex Mobile Device with KDE4 file manager
How to force KDE4 file managers to access mobile device via bluetooth using Obex protocol
In KDE 3.5 we had a great feature which was letting us easily access the mobile phone file system and browse and copy any file to it and from it using Bluetooth and Obex protocol. Unfortunately this feature is not available for kbluetooth standard KDE4 bluetooth access tool, mostly because the kioslaves for obex are not available for KDE4 file managers. As kbluetooth is still in heavy development I'm sure sooner or later this feature will be added, unfortunately I need it now. The simplest way to solve this problem would be install part of GNOME environment including nautilus file manager which has this support. I don't like GNOME and I don't want half of it on my computer just to perform such a trivial task. I found a better solution and I will try to share it here.
My solution requires you to install obex userspace filesystem utility. All the instructions, here were tested and performed by me on my Gentoo Linux system, but they should be applicable to any Linux distribution. All you need to change is use your distribution specific install command instead of Gentoo Linux emerge. I didn't have any problems accessing my mobile devices this way but I can not guarantee your mobile devices will work the same, so if you are following me remember you are doing this on your own risk. I assume you have bluetooth services and device properly configured on your Linux if not visit a bluetooth how to for your distribution. I hope you will find belows information useful.
First thing we need to do is to install obex userspace filesystem support. If you don't have userspace filesystem utilities (it's hard to believe you don't have it) they will be pulled as dependencies. In Gentoo Linux we would install them these way:
emerge -av sys-fs/obexfs
Those utilities will let you mount any bluetooth device filesystem with simple command. Instead of calling the command by hand we will write a simple script witch will do the job for us. I named the script obex_mount.sh
#!/bin/sh MOUNTPOINT="/tmp/${USER}-${1}" #Create mount directory mkdir ${MOUNTPOINT} #Mount the device obexfs -b ${1} ${MOUNTPOINT} sleep 5 /usr/bin/krusader --left ${HOME} --right ${MOUNTPOINT} #/usr/bin/dolphin ${MOUNTPOINT} #Unmount the device fusermount -u ${MOUNTPOINT} sleep 5 #Remove mount directory rmdir ${MOUNTPOINT}
As you can see the script is quite simple. You should save the script somewhere from where you will be able to easily call it. I copied the script to /usr/local/bin. You need to make sure that script is executable, you can do it like these:
chmod +x /usr/local/bin/obex_mount.sh
The script is accepting one parameter which is bluetooth device address. Here you can see example of usage:
./obex_mount.sh 1C:DC:EA:43:C1:41
When you will call the script the script will create a mount directory with the name cobined of your user name and bluetooth device address. Next it will mount the device using obexfs command. As you can see I'm using sleep command to make sure the mount process will finish. Then the script is calling krusader twin panel file manager which should opened your home catalog in left panel and device mount directory in right one. If you don't have krusader installed and you don't want to use it you can comment this line and uncoment the line calling dolphin instead. In fact you can create your own file manager command if you like to. When you will finish working with the device and you close the file manager, the script will unmout the device wait a moment to make sure the unmounting process will finish and in the end it will delete the mount catalog.
We can call the script when we like from the command line but I found a better way to do it. Why because checking and passing the bluetooth device hardware address to script is quite painful. Instead of using the script directly I use a simple bluetooth GUI manager called Blueman. It's a GTK application but fortunately not highly depended on GNOME graphical desktop environment. At the moment this application is offering better features then the kbluetooth application. If you don't have blueman in your system you should installed it. In Gentoo we would do this this way:
echo net-wireless/blueman >> /etc/portage/package.keywords emerge -av net-wireless/blueman
When you will start up the blueman in your system you should see it's icon in the system tray, right click it and choose Local Services. Consult the belows screenshot:
![Blueman Local Services](uploads/images/blog/bluman01.png)
When the Local Services Settings window will open expand the Advanced in Transfer Settings and provide call to our script in the text field like this:
/usr/local/bin/obex_mount.sh %d
Make sure you will save the settings before leaving the window, if you are unsure consult the belows screenshot:
![Blueman Local Services](uploads/images/blog/bluman02.png)
Now you should be able to browse your mobile device filesystem in your favorite filemanager just by right clicking on it's icon in Blueman device browser utility. Now the access is easy isn't it. You can take a look at belows screenshot to see the prove that this is working.
![Blueman Device Manager](uploads/images/blog/bluman03.png)
As a last thing I will add a warning don't try to open the files (photos, movies or sound files) directly from your mobile. I would recommend you to copy them to your computer before opening. This should prevent problems. Remember not all bluetooth connections are fast enough to let you view your files directly.
Script I use is also available on my svn server, you can access it by following this link.
GNU Free Documentation License or Creative Commons Share Alike
If you have found something wrong with the information provided above or maybe you just want to speak your mind about it, feel free to leave a comment.
All comments will show up on page after being approved. Sorry for such policy but I want to make sure that my site will be free of abusive or vulgar content. I don't mind being criticized just do it using right words.
Processing a comment.