How to download photos from phone over bluetooth with ubuntu

I have a samsung sync phone. It is about two years old now. It isn’t fancy, but it has a camera and a bluetooth device.

I wrote a python script to copy photos from my phone to my laptop. Any time I take a bunch of pictures, I just run
and if my phone is anywhere nearby, my computer will pull all the photos off my phone.

Bluetooth is a great little tool and I’m surprised it hasn’t caught on more with people like us. I’ve been able to access my phone from my laptop when I’m on the second floor and the phone is across the house and downstairs, still in my work bag. And bluetooth USB dongles are cheap (like around $9). There’s no need for carrying around USB keys or plugging in iPods. Everything should use bluetooth.

The script requires that the phone and the laptop have already been bonded with each other. That’s not much work. Put your phone in to discoverable mode, then search for devices with your computer. When you find your phone, punch the same 4-digit PIN into the phone and your computer.

Anyway, here’s the script. I hope it helps somebody out.
#! /usr/bin/env python

# W. Matthew Wilson wrote this script and he released
# it into the public domain.

# vim: set expandtab ts=4 sw=4 filetype=python:

Pull all the images off my phone.

import commands, logging, os

from xml.etree import ElementTree
from xml.parsers.expat import ExpatError


def get_list_of_pictures():

Yield a list of strings, where each string is the file name of a

# You'll need to change the 00:1D... stuff to your phone's
# MAC address.
# You might need to change /Graphics/ to where your phone
# stores its photos.
status, output = commands.getstatusoutput(
"obexftp -b 00:1D:F6:55:7E:D9 -l /Graphics/")

logging.debug("status of obexftp: %s" % status)"Finished running obexftp...")

# Unfortunately, the output from obexftp includes some goofy status
# crap and then some XML data. So I parse each line separately,
# and skip the lines where parsing fails.

for line in output.split('\n'):

logging.debug("About to parse line %s." % line.strip())

x = ElementTree.XML(line)
# Skip lines without a name attribute.
if 'name' not in x.keys(): continue

# Extract and yield the name
photofilename = x.get('name')

logging.debug("About to yield %s." % photofilename)

yield photofilename

logging.debug("Finished yielding %s." % photofilename)

except ExpatError:

logging.debug("This line is not valid XML: %s."
% line.strip())

def grab_pic(photofilename):

Pull the photo named photofilename and save it locally.

# You probably want to change this.

status, output = commands.getstatusoutput(
"obexftp -b 00:1D:F6:55:7E:D9 -g /Graphics/%s" % photofilename)"Finished storing %s locally." % photofilename)

if __name__ == "__main__":"Starting...")

for photo in get_list_of_pictures():
grab_pic(photo)"All done!")

Why write me a response back at all?

I wrote this email to Samsung technical support a few days ago:

SUBJECT: Need Hayes commands (AT commands) for phone

Hi —

I own a Samsung A707 phone with AT&T service.

I can make a serial port connection to my phone via bluetooth. However, it seems like my phone doesn’t understand most AT commands.

Is there a list anywhere with all the AT commands that this phone supports?

Thanks for the help.


And here’s the reply I got back:

Dear Matthew,

Thank you for your inquiry. We suggest searching the internet for Hayes AT commands.

Do you have more questions regarding your Samsung Mobile Phone? For 24 hour information and assistance, we offer a new FAQ/ARS System (Automated Response System) at It’s like having your very own personal Samsung Technician at your fingertips.

Thank you for your continued interest in Samsung products.

Technical Support

WOW. Is Renee a chatbot or did a real human being actually spend time writing this response? I especially like that they link to the tech support section of the website. This is where I sent the email in.

Fortunately for me, the people on the gnokii mailing list are helping me out.