How to download photos and movies from the Palm Centro to a Linux desktop

Posted by Tom Moertel Fri, 02 Nov 2007 19:32:00 GMT

I recently got a Palm Centro smartphone, and so far I love it. Like most modern cell phones, it has a built-in camera and takes decent snapshots and even records short movies. It’s great for spur-of-the-moment shots when I don’t have my real camera. The trick – and there’s always a trick when it comes to cell phones – is getting the photos off the camera and onto my computer.

To get at my pictures, Sprint would prefer that I sign up for their ludicrously expensive “PictureMail” service. Leave it to weasely telecom execs to come up with another way to squeeze money from teenagers: charge them $5 each month for the “privilege” of sharing their pictures with friends. This fee, of course, is in addition to the fee for “unlimited” mobile Internet use. I guess picture bits are somehow more expensive to move over the air than other kinds of bits.

In any case, my next goal after getting my Centro to hotsync with my Linux workstation was to figure out how to download my photos and movies.

After a bit of hacking, I figured out that the Centro stores images in a typical digital-camera-image (DCIM) hierarchy. For example, I have a 4-GB microSD card installed in my Centro, and I store my photos in the “Palm” album on it. This album ends up stored in the /DCIM/Palm directory on the card.

Using the pilot-xfer program from the pilot-link project, I was able to find the directory and its contents. The trick was to use the sparsely documented –D flag to work with the Centro’s virtual filesystem. Here, for example, is how I list the contents of the Palm album:

$ pilot-xfer -p usb: -D /DCIM/Palm -l

   Listening for incoming connection on usb:... connected!

   Directory of /DCIM/Palm...
        652 Fri Nov  2 08:17:06 2007  Album.db
     292053 Fri Nov  2 09:04:20 2007  Photo_110207_001.jpg
      78493 Fri Nov  2 08:17:06 2007  Video_110207_001.3g2
         20 Wed Oct 31 12:09:20 2007  Thumbnail.db

   Thank you for using pilot-link.

Here, you can see that I have one photo and one movie in the album. (Movies are stored in .3g2 files that contain MPEG4 video.)

To download the files, I again turned to pilot-xfer, this time using the –f (fetch) flag to fetch a list of files. Here, for example, I’ll fetch the image from the listing above:

$ pilot-xfer -p usb: -D /DCIM/Palm -f Photo_110207_001.jpg

   Listening for incoming connection on usb:... connected!

   Fetching '/DCIM/Palm' ... (292053 bytes)   285 KiB total.

   Thank you for using pilot-link.

So that’s the process. It’s kind of clunky, so I wrote a small Python program to automate it. (I’m learning Python. If you’re a Pythonista, please consider critiquing my code. I would be especially thankful if you could point out any helpful idioms that I may have overlooked.)

Here’s how to use the program:

$ get-pilot-photos.py --help
Usage: get-pilot-photos.py [options]

Options:
  -h, --help            show this help message and exit
  -s SRCDIR, --srcdir=SRCDIR
                        VFS dir on Palm device from which to fetch images
  -d DESTDIR, --destdir=DESTDIR
                        Where to save the images on your computer

Both the —srcdir and —dstdir options are optional. If you omit the first, the program will download photos and movies from the /DCIM/Palm album. If you omit the second, the program will save the downloads to a new, timestamped directory within your home directory.

That’s it. The code is below.

Read more...

Posted in
Tags , , , , , ,
10 comments
no trackbacks
Reddit Delicious

How to hotsync the Palm Centro with a Fedora 7 Linux desktop via USB

Posted by Tom Moertel Wed, 31 Oct 2007 04:35:00 GMT

I just got a Palm Centro smartphone, and I love it. Getting it to sync with my Linux workstation, however, was tricky, so I’m posting this recipe in hopes that it might save you some time.

The “visor” kernel driver is supposed to make compatible Palm handhelds look like serial devices when attached via a USB cable. For me, it didn’t work. Instead, I had to blacklist the driver and then use libusb to talk to the Centro. Here’s the recipe:

First, blacklist the “visor” kernel driver:

# echo blacklist visor >> /etc/modprobe.conf
# modprobe -qr visor

Second, make sure libusb is installed:

# yum install libusb

Third, edit the system’s udev rules to make sure your user account can access the device files used to talk to the Centro. On my Fedora 7 setup, I found the right rule in /etc/udev/rules.d/50-udev.rules:

ACTION=="add", SUBSYSTEM=="usb_endpoint", \
ATTR{bEndpointAddress}=="?*", ATTRS{devnum}=="?*", ATTRS{busnum}=="?*", \
NAME="bus/usb/$attr{busnum}/$attr{devnum}_ep/$attr{bEndpointAddress}", \
MODE="0644", SYMLINK+="%k" 

I edited the last line of the rule, changing the mode to 0664 and adding a GROUP key to assign the Centro devices to my exclusive user group:

MODE="0664", SYMLINK+="%k", GROUP="thor" 

This change lets my account talk to the Centro without having to take on root privileges. (For bonus points you could set up a more-specific rule to match just your Centro. The rule above, as is, will actually match other devices, too.)

Fourth, tell udev to reload the rules:

# udevcontrol reload_rules

Finally, set up a Palm-device connection via gnome-pilot. Be sure to select USB for the Type and “usb:” from the Device drop-down list.

That’s it. If you’re lucky like me, you should now be ready to hotsync your Palm Centro!

Update: Even better, this handy HOWTO shows you to sync via Bluetooth, which is more convenient than hooking up a USB cable. I’m now using this method.

Update 2: If you want to use USB to hotsync your Centro, there is a method that’s more convenient than setting up udev rules. Just create a perms file for pam_console_apply that tells it to give the console user permission to access your Centro. To do so, create a file /etc/security/console.perms.d/60-libpisock.perms and put the following in it:

<libpisock>=/dev/usbdev* /dev/bus/usb/[0-9]*/[0-9]*
<console> 0644 <libpisock> 0644 root

That’s it. (You’ll still need to use libusb.)

Posted in
Tags , , , , ,
5 comments
no trackbacks
Reddit Delicious