Getting files from a bluetooth phone

I recently worked out how to get photographs taken on my mobile phone off it, using a bluetooth ‘dongle’, onto my Linux box. I'd given up on this shortly after I bought the phone, because I just couldn't get the drivers for this dongle to work in Windows, but it turns out that on Linux it ‘just works’.

Well, some of it does. After lots of trying I still can't accept connections initiated from the phone. This means I can't just tell the phone to send a photo to a bluetooth device and have the file saved on the computer. There are various tools to do this but the phone never seemed to be able to find the dongle.

What does work is accessing the phone's file system using commands on the Linux machine. I found a program called obexftp (I'm using the one from the package of the same name in Debian unstable) which can, for example, list all the files which exist in a folder (or directory, or whatever they're called on phones):

obexftp -b -l Images

The file listing is given as an XML file on stdout. It's fairly simple though, so you can see what's gonig on. The -b option means to use bluetooth, and you can give a long sequence of hex digits after it to specify which device it should connect to. By default it scans for a device, which takes a little longer.

You can download files into the current directory like this:

obexftp -b -c Images -g Image00{0,1,2}.jpg

That gets you three images from the Images directory. If you use the -G option instead of -g then it will delete them after they're downloaded.

There are various other options I haven't tried yet for moving files around and so on.

Bluetooth download script

I wrote a little Perl program to automate downloading the images from (at least) my particular camera phone into a new directory. I'm sure there are fancy GUI programs which would do a better job of this, but sometimes it is quicker to reinvent the wheel. This is sufficient for my needs, but you should probably look for something better before using this. Still, here it is if you're interested:

bluetooth-images-download.pl

This has only been tested on a Nokia 6230i, and would probably have to be tweaked to work with significantly different phones.

It just runs the obexftp program to get a listing of the available images. It assumes they're in the Images folder, which isn't necessarily true. It then creates a new directory and downloads all the files there (with a single command so you don't have to keep accepting lots of connections on the phone). It also sets the modification time of each file to whatever was reported from the phone in the directory listing. Really this is something obexftp should do. I thought it was worthwhile because the images don't have any EXIF tags, so this is the only record of when the picture was taken.

< Frosty roof tiles | Salvo Caffe Restaurant >

Miniblog

(nuggets of inanity)

Tuesday Apr 24th 2007, 16:54 »
Just took the annual web design survey that AListApart do. I don't realy consider myself to be a web designer, but I have been doing a lot of HTML and CSS lately.
Monday Apr 23rd 2007, 18:23 »
Strange, there appears to be a bare-knuckle boxing match going on in the field outside my flat. Wish they wouldn't make so much noise about it.
Thursday Mar 1st 2007, 18:47 »
“In its written form, Hebrew has no vowels, making it the ideal language for texting.”
—Said in jest on some Radio 4 programme just now.

Archive: 2007 · 2006 · 2005 · 2004
Feed