OBEX for dummies

Submitted by dag on Tue, 2007/11/13 - 16:36

On Linux it was never that easy to access your phone's memory, especially not using bluetooth. For a few years I had been using obexftp for this, but pushing files one by one was far from simple.

As a result if I needed a picture from my phone's memory, I either send it from the phone to my CentOS. This works fine for a single file, but is tiresome for a collection. Or (and this is the default at my place) let Brenda's thinkpad synchronize the new photos from my cellphone.

This is very convenient, because Brenda takes care of the photo-collection housekeeping anyway ! (thanks hon)

Still, yesterday I did not want to mess with Windows to get a picture or two so I renewed my knowledge of Obex, especially I reinvestigated obexfs.

Obexfs is a fuse-based filesystem that uses obexftp to connect to the phone and while I had been messing with it in the past, lo and behold it worked almost immediately with the newer obexfs.

On CentOS you only need to install the dkms-fuse and obexfs packages to get it going by: yum install dkms-fuse fuse-obexfs and start bluetooth: service bluetooth start

Then just get the device id from the hcitool scan output, then get the OBEX File Transfer channel from the sdptool browse 00:CA:FE:BA:BE:00 output and when you have both, simply do obexfs -b 00-CA-FE-BA-BE-00 -B 10 /mnt/obex

And then you can access the content:

[dag@rhun ~]$ obexfs -b 00-CA-FE-BA-BE-00 -B 10 /mnt/obex/
[dag@rhun ~]$ ls -l /mnt/obex/
total 4
drwxr-xr-x 1 dag dag 0 Jan 1 1970 Graphics
drwxr-xr-x 1 dag dag 0 Jan 1 1970 Images
drwxr-xr-x 1 dag dag 0 Jan 1 1970 Memory
drwxr-xr-x 1 dag dag 0 Jan 1 1970 Music files
drwxr-xr-x 1 dag dag 0 Jan 1 1970 Recordings
drwxr-xr-x 1 dag dag 0 Jan 1 1970 Themes
drwxr-xr-x 1 dag dag 0 Jan 1 1970 Tones
drwxr-xr-x 1 dag dag 0 Jan 1 1970 Video clips

Nothing more to it, really.

PS It is also possible to make it work with autofs and use obexautofs to automatically scan for any device. However, I could not make it work because it failed to accept more than one option in the config-files (because it does not accept the spaces and none of the workaround seem to work either). So for the time being I will have to use the commandline.

Update: I tried again with obexfs v0.12 and now it works fine. I noticed obexfs automatically detects the channel id for OBEX communication, so you no longer need to use -B option ! This is fantastic as it is much more convenient to use...

Using Spaces

Have you tried using the \0 character rather than a space?

I did.

And it failed too. But since obexfs v0.11 it autodetects the channel, so it is much more convenient and it now works from autofs as well as fstab (and the Gnome Disk Mounter applet) as expected.


Thank you

Thank you Thank you THANK YOU!!!

I've been trying for the past day and a half to get my mobile connected to Linux in a meaningful way.

After trying all manner of blind alleys, your elegant solution took no more than 5 minutes to install and implement.

When my phone's file system suddenly appeared in Dolphin, I very nearly fell off my chair - I was preparing myself for yet another disappointment.

Given that there seem to be hundreds of people wringing their collective hands over this (especially since the obex KIO stopped working in KDE4), I can't believe this information is not all over the forums.

I am just about to make at least some effort to rectify that situation.

Thank you again.

Thanks! I'm something of a

Thanks! I'm something of a Linux newbie and a total neophyte when it comes to Bluetooth. Once I got obexfs built, this worked like a charm!

Though I hadn't realized that Bluetooth would be so s-l-o-w for file transfers.


Great tip!

Many thanks for this! Kde 4.4.2 still doesn't seem to have an adequate handle for obex, but this works great. It's curios that no one is looking after bluetooth integration for kde.