oreilly.comSafari Books Online.Conferences.


Making the Palm/Linux Connection

by Chris Halsall

Also in Linux and Your PDA:

A Palm Introduction - The gizmo that's taken the handheld marketplace by storm

All Linux PDA: Fact or Fiction? - Have you heard about the Yopy?

Linux and Unix users are often pleasantly surprised by how much software is available to support PalmOS devices. In addition to the traditional graphical "Palm Desktop" environment programs like J-Pilot, there exists a large quantity of low-level and specialized tools for communicating with, managing, and even emulating the Palm.

Practical Pilot-Link

Included with most modern Linux distributions now is a package called "pilot-link," written by Kenneth Albanowski. This suite of tools and libraries enables communications between a Unix environment and a Palm though the serial port, and is used by many other programs to take care of the messy details. Language bindings exist for C, C++, Python, Tcl, and Perl. If you find you don't have pilot-link installed, or want to upgrade, download locations can be found at FileWatcher).

A few Pilot-Link tricks

There's a little bit of configuration needed to allow pilot-link to establish a connection with a PalmOS device, specifically dealing with the serial port the Palm is connected to. It's a good idea to set up a symbolic link from /dev/pilot to the proper serial port. For example, if your Palm Pilot's cradle is connected to the second serial port, execute the command ln -s /dev/ttyS1 /dev/pilot as root. To make sure every program can access the port, execute the command chmod 666 /dev/ttyS0 (again, as root).

The default communications speed used by pilot-link is a miserable 9600 baud. The environmental variable "PILOTRATE" can be set to the desired baud rate, such as 19200, 38400, or even 57600. Don't set this too high though, or communications errors will slow things down even worse. It's also possible to override the serial port used by setting the environmental variable "PILOTPORT." Since some other programs don't look at this variable though, I recommend having the sym-link set up as above as well.

The tools included in the pilot-link package over many different services, all command-line oriented. Be aware that some of them are experimental, so it's a really good idea to back up your Palm before using them. man pilot-link to see a list of all the included commands, what they do, and their stability status. Several of the commands also have man pages of their own.

If your Palm has never been used before, you will need to set the UserName on the device before any other communications can be done. This is done using the "install-user" command, and need only be done once. Unlike the other pilot-link components, the serial port must be explicitly passed, so install-user /dev/pilot yourname 500 would set the username to "yourname" and the UserID to 500. The UserID parameter is optional, but I like to set mine to be the same as my Unix user ID.

The Handy Pilot-xfer

The most useful tool included is probably "pilot-xfer," which has its own man page, and is able to do most of the data exchange needed day-to-day. To back up your Palm, for example, simply execute the command pilot-xfer -b BACKUP_DIRECTORY, place your Palm in its cradle, and press the hot-sync button. Every program (.prc) and database (.pdb) file on the Palm will be transferred and stored in the directory. To synchronize all the files, execute the pilot-xfer -s BACKUP_DIRECTORY command. To completely restore instead (for example, after a hard-crash), use pilot-xfer -r BACKUP_DIRECTORY.

It's also possible to install a new program or database file on a Palm by running pilot-xfer -i FILE. To see a list of all the files in a Palm's memory, execute pilot-xfer -l. Note that the list doesn't include the ".prc" or ".pdb" suffix, so when you fetch a file back with pilot-xfer -f FILE, FILE should not include the suffix. In fact, if it's given, the transfer will fail with "unable to locate database" message.

We have only really scratched the surface of what is possible using the tools inside the pilot-link package. As shown here, the package allows full, if only command-line, support of a Palm's file system. I encourage you to look at the pilot-link, pilot-xfer, and related man pages for additional tools and abilities. And if you're writing a user-space Palm-enabled application, you would likely save yourself a lot of development time by leveraging on the included libraries.

Pages: 1, 2, 3

Next Pagearrow

Linux Online Certification

Linux/Unix System Administration Certificate Series
Linux/Unix System Administration Certificate Series — This course series targets both beginning and intermediate Linux/Unix users who want to acquire advanced system administration skills, and to back those skills up with a Certificate from the University of Illinois Office of Continuing Education.

Enroll today!

Linux Resources
  • Linux Online
  • The Linux FAQ
  • Linux Kernel Archives
  • Kernel Traffic

  • Sponsored by: