Using a PDA with Linux, Part 2: Cards and Conversions

In part 1 of this series, A.Lizard explained how to get your PDA in sync with your Linux Palm desktop. Now he'll tell you how to work with an external memory card, and walk you through conversion applications that make it possible to read your PDA's documents and images on your Palm.

Like this article? We recommend

Like this article? We recommend

File Transfer to/from Expansion Cards

If you followed the procedures in part 1 of this series, your Linux Palm desktop
and your PDA are finally speaking to each other via Linux USB serial protocols.
Now you’ll want to be able to transfer documents back and forth.

Working with the expansion card uses USB mass storage connection methods.
There are three ways to transfer files to/from the expansion card:

Use an external card reader.

Use a Palm file manager, such as FileZ.

Use Card Export II to make the external card emulate a USB mass storage
device.

With an external card reader, you can add/change/delete files you want on
your Palm by using the card from your workstation. This method is convenient
if you already have an external card reader, but with time I think that you’ll
find this approach to be an increasing nuisance.

Using Card Export II

Card Export II, shown in Figure
1, turns your Palm external memory into a
mountable drive, making the external card emulate a USB mass storage device.
Install it to your Palm and then push the "connect to desktop" button.
If your distribution doesn’t automatically mount it and put it on your
desktop as an icon, you can mount it as you would a camera or thumb drive.
Card Export II is a proprietary app and costs $14.95, but it’s the best
way I’ve found to get easy access to an external card from Linux. If
you don’t want to spend the money, I recommend downloading the software
anyway and using it as a time-limited demo; it’s a lot easier to create
new directories and move files around via point-and-click with a Linux GUI
file manager than by using a Palm file manager such as FileZ.

With a Linux file manager, you can deal with files in groups; for example,
you can highlight, copy, and paste a stack of files. Card Export II provides
direct access to your hard drive, so you can work with your Linux file managers
by using your workstation display, keyboard, and mouse to manipulate files.

Plug the Palm USB cable into the computer, with the Palm connected to the
other end.

Open Card Export II on the Palm and push the Connect to Desktop button.

If a desktop icon for the drive appears, see whether you can access the
directories by double-clicking the icon to open them, including reading files
and putting files into the directories. If the drive is mounted automatically,
you don’t need to create the scripts described in the next section.
However, check to make sure that everything works before deciding whether
automatic mounting is a good idea or not.

The Palm should unmount automatically when you hit Disconnect on Card Export
II, but check for directory corruption if you do it that way. I had to reformat
the card from the Palm several times while I was trying to work all of this
out.

What if the desktop doesn’t automatically mount your expansion card
as a drive? You need to add some script files so you can easily mount and unmount
the "drive." The following section provides the scripts you’ll
need.

Scripts for Connecting and Disconnecting an External Card

Open a terminal window and log in as root:

su – root

Open a text editor as root from the command line. Copy the following lines
from this page and paste them into the text editor:

If Card Export II isn’t turned on and in connect mode when the open
script is run, it won’t work. If Card Export II isn’t disconnected
before shutdown, it’s likely to make a total mess of the expansion
card directory structure, for which the best solution is reformatting. That’s
why sleep is used for time delay in the scripts. If five seconds isn’t
long enough, change the 5 in each line of the scripts to whatever
measurement you need. That’s also a good reason to start backing up
your external card as soon as you have a significant amount of content on
it; create a directory and copy the external card files into it.

Working with the Palm Expansion Card

Since you’ll probably need to create directories on your memory card
once you have access to it, knowing what you should create is helpful, particularly
since this isn’t necessarily the same on all Palm PDAs. My recommendations
in the rest of this article are based on my Palm Zire 31; your directory setup
might be different. Let’s find out for sure with the Card Directories
Palm program.

Open Card Directories on your Palm PDA by choosing Preferences > Card
Directories (it’s at the bottom of the Preferences screen under Other).
You’ll find a list of file types versus directories like the one shown
in Figure 2. These directories may not exist on your PDA’s external
card; if not, you need to create them.

Write down the directory names and file associations for at least the MP3,
AVI, PRC, and JPG file types. Then close Card Directories.

Open Card Export II on the Palm and hit the Connect to Desktop button.

Run the following command:

# sh palmopen.sh

This command opens the expansion card.

NOTE

The Connect to Desktop button in Card Export II toggles to Disconnect when
the drive emulation is active; in other words, if you see Disconnect on the
button, the Palm external card is a drive mountable from Linux.

Choose Start > System Tools > More System Tools > Superuser
File Manager to open the Superuser File Manager. Point/click your way to /mnt/palm.

Create these directories if they don’t already exist in /mnt/palm:

dcim
audio

NOTE

Don’t be concerned when Card Directories shows uppercase where the
Linux file manager doesn’t. Go ahead and create them in the Linux Superuser
File Manager as lowercase. DCIM and AUDIO can apparently
be created only from the Palm’s point of view as uppercase, regardless
of what the Linux box shows.

Change to the /mnt/palm/palm directory.

Create a Programs directory if it doesn’t already exist.
Create any other directories that Card Directories showed but you don’t
have on the expansion card.

NOTE

Card Directories told you the default directory locations for an expansion
card for common file types. If it tells you to put them in directories other
than the ones listed here (including directories you have to create), follow
what Card Directories shows instead of the instructions here, and create
the directories.

Once you’re done, exit the Palm directory tree.

Copy the files from the computer that you were planning to put on the expansion
card and put them where Card Directories said they were supposed to go. Put
MP3s and other audio files in audio; put images/video in dcim.

Run the following command to disconnect Card Export II:

# sh palmclose.sh

NOTE

Whether you use J-Pilot or a script to access your Palm PDA, remember to
unplug the Palm before you shut down the computer. Do not turn off
Card Export II until you’re ready to unmount the Palm from your workstation.

Unplug the USB cable from the PDA.

Limited Card Access via pilot-link

Before the very latest version, pilot-link simply didn’t see external
memory cards. pilot-link-0.12.0-pre4 has limited support for external
cards. The limitation is that you can install and probably delete files as
you please, but you can’t add/remove directories working from within
the Palm PDA, or get a real-time view of what’s on the card. You can
supplement this lack by using the FileZ file manager running on the Palm PDA,
and do any of these operations.

The -D command allows specifying a file on the Palm card. Here’s
how the command works, in general form:

pilot-xfer -p /dev/pilot -i File.prc -D /Palm/Launcher

Here’s an example of how it works in practice (everything after –I is
program output):

What if you put the file in the wrong place? Remember that Card Export II
only provides access to the external memory card. You’ll need something
else to deal with files within the Palm itself, especially if you don’t
realize that you have a problem until after you’re away from your computer.

Use FileZ as you would any file manager. Note that the most important file
formats you’ll work with are files with the .prc extension(applications)
and .pdb extension (documents).