I have been trying to get more and more of my home directory into a version control system. The simple reason behind this is that I use a few different computers and remembering what is where problem is really quite annoying. Following this quest, I wanted to be able to put my most important home files onto my phone in a git controlled manner so that I would have a copy there should I need it. Since all the machines I'm working on have bluetooth. Having a bluetooth technique to do the file transferring seems like an ideal solution.

But I wanted a little more than just file transfer I wanted to actually be able to do the file transferring and updating of my files using git. So what I really wanted was to be able to mount my phones sd card over bluetooth. This as it turns out can be accomplished with a little help from openobex (obexfs) (spoiler: this mounting does not actually give you a regular file system mount, but rather a mount with some file transfer (ftp) abilities, but not enough to support git).

To start you need to have an application on your phone that is operating an obex ftp service. I installed Bluetooth File Transfer on my HTC Desire Z running Cyanogenmod 7 that said I think this app would work for any android phone running a reasonably recent android system. This application will start up an obex ftp service running on port/channel 30 that you can connect to. The application has little documentation that I could find but, in my experience I just needed to start the application. To verify that you're obex ftp service is running you can go to Menu->More->Settings->Sharing Service(FTP) and verify that it is enabled and configure the folder that is being shared. I can not recommend enabling the Security prompt as that caused problems for me later in the process.

Okay, so now the phone is ready and listening time to connect to it using the Debian GNU/Linux machine. If you're just going to send a file or two and you I would recommend sticking with Bluetooth-Applet, it is pretty easy to use and in my experience works easily for sending. I didn't manage to get browsing the device working, but that's probably just me.

If you wanted as I did to actually mount the sdcard over bluetooth, you need to hit the command line. Unfortunately, apparently pretty much all the documentation that is out there on the internet was documenting the way to do things with the bluetooth stack pre version 4, and version 4 changes how a lot of things are done, it was confusing, although at times entertaining.

Now then, here's the howto. You need to have obexfs installed.

First thing is to verify that the debian system is paired with the phone. I did this using the bluetooth-applet (looks that up elsewhere if need be) Then make the phone discoverable and run ~$ hcitool scan

Which should return your mac address and the name of the device. Keep the mac address you're doing to need that. Mac Address is of the form XX:XX:XX:XX:XX:XX, but all Xs are replaced with numbers of characters.

Then run sdptool browse XX:XX:XX:XX:XX:XX Somewhere in the output you should see a listing that say "Service Name: OBEX FTP" If you don't make sure that the Bluetooth File transfer Application is running on the phone and try again. Note the Channel number, in my case it is 30.

Okay now we're ready to attempt to mount the sdcard over bluetooth.

You'll need an empty directory to do the mounting so ~$ mkdir bluetooth then ~$ sudo obexfs -bXX:XX:XX:XX:XX:XX -B30 bluetooth Now, the good news, you've mounted the phone!
~$ sudo ls bluetooth should show you the contents of the mounted folder. And you can copy things in and delete them. it works very well. Now the bad news. You need to be root (or sudo) to do these things. This could likely be remedied by making this an entry in /etc/fstab that allows users to do the mounting. But I never made it that far. Now the really bad news (for me) when I went to git clone my repository into the mounted folder (even as root) the process only manager to pass the folder structure across before it died. Likely because it was trying to do a file operation that isn't supported by obexfs.

Which brings me to my conclusion, that at the end of the day, we still really have an ftp service here. And that brings with it a bunch of restrictions, rsync isn't going to work here, just like it doesn't work for any ftp service, bluetooth or otherwise. And not knowing the working of git perhaps I could have known from the start that it wouldn't work here either but alas I did not. I feel a bit like a man trying to walk to the moon at this point, but perhaps my journey will help someone else make their more reasonable journey.

PS: If you need to do some debugging I would recommend installing obexftp which had some more useful output for me.