Xubuntu Hardy 8.04.1 and moving files between mobile phone using bluetooth

By cutec

Ever had problems trying to get a file from mobile phone to your laptop via bluetooth, or vice versa? Me too. Annoying? Oh yes indeed.

This started to bug me, well, too much so I decided to grab the issue by it’s horns and see who’s who.

First of all, the bluetooth-applet that you probably have already, has that nice little “send files” and “browse device” as you’ve noticed. You’ve also noticed that in Xubuntu, the “browse device” selection is ‘grayed out’ or not working. This, I assume, is because Xubuntu by default lacks gvfs-fuse.

Having the “send files” as an available option, you’ve of course tried it. No luck? Same here. Next, you’d prolly tried command line tool called bluetooth-sendto. No luck either? Same here. Starting to get frustrated? Me too.

Short browsing in the wonderful world of internet and using aptitude search command, I found obexftp and obextool, which is a frontend for obexftp.

To install obexftp and obextool:
$ sudo aptitude install obexftp obextool

To use obexftp, you need to use command line. No panic, command and it’s options are pretty easy. First you just need to find out your phone’s mac address (or you can just use the name you have set to the phone). To find it out:
$ hcitool scan

then copy the xx:xx:xx:xx:xx:xx part and type:
$ obexftp -b xx:xx:xx:xx:xx:xx -l

Output should list the drive/folder/etc info from the phone’s root level. Next you need to cd to the correct folder and just in case lisst the content of it to be sure you are where you should be:
$ obexftp -b xx:xx:xx:xx:xx:xx -c C: -l

That command lists the content of drive C:, so sending a file to, for example, the root of C:\ named test.txt, the command would be:
$ obexftp -b xx:xx:xx:xx:xx:xx -c C: -p /path/to/local/test.txt

And to get the file:
$ obexftp -b xx:xx:xx:xx:xx:xx -g C:/test.txt

To delete the file from your mobile phone:
$ obexftp -b xx:xx:xx:xx:xx:xx -k C:/test.txt

If you want to use obextool, simply open terminal and type obextool. If, however, there are other bluetooth devices around at the same time, you need to place environment variable to tell which phone to use. Here’s the command (substitute yourphonesname with the name of the phone, or with the mac address of the phone):
$ export OBEXCMD="obexftp -b yourphonesname"

Now launch obextool again.

If you want the environment variable OBEXCMD to be permanent, you need to place it to the .profile file in your home folder (if it does not exist, create it):
$ mcedit .profile

Add following at the end of the file:
# Environment variable to tell obextool to use MYPHONEMAC as device to connect
export OBEXCMD="obexftp -b MYPHONEMAC"

The reason why I'm telling you to use your phone's mac address in the permanent environment variable is that when you hide your phone from bluetooth scans (hide bluetooth visibility to other devices), you are still able to connect to your phone with obextool as the environment variable has the mac address, not the name.


Tags: , ,

Leave a Reply