Communicate with Your Linux Box Using Your Palm Pilot as a Terminal

My tendency to be absentminded and careless got me into an annoying

situation recently. I made several changes to my system at once. I

swapped my network card, rebuilt the kernel to try out different USB

drivers, and made a few other changes. But I forgot to make changes to

the file /etc/modules, which would tell the system to load the

appropriate modules for my USB driver, keyboard, mouse, and new network

card.

When I rebooted the system, I couldn't operate the machine. Linux

ignored my USB keyboard and mouse and I couldn't contact the computer

over the network using ssh (secure shell) because it didn't load

support for the new network card.

There are several very simple ways of dealing with this situation. For

example, I could hunt down a keyboard with a PS/2 connector and plug it

in, or I could reboot the system with a previous kernel version. Being

lazy by nature, I didn't want to look for a keyboard. Being impatient

by nature, I didn't want to wait for the system to reboot. I especially

dislike reboots. My system seems to take forever to initialize the IDE

drives and controllers, the Intel Ethernet Express Pro management BIOS,

and the Adaptec SCSI BIOS at boot time.

Fortunately, I anticipated such an event and left myself one more

option. I set up Linux so that I could access it using my Palm Pilot as

a VT100 terminal connected to the serial port. I logged in via the Palm

Pilot, loaded the USB driver and modules for my keyboard, and was back

in business in a wink.

There are other ways a Palm Pilot terminal can help you work or get you

out of a jam. I imagine it could really come in handy as a debugging

tool, especially if you're building a full-screen graphical

application. You can redirect various types of error or debugging

messages to your Palm terminal while you develop your application. Your

Palm instantly takes on the role of a second monitor.

Here's how to set up your Linux system to work that way: First, make

sure your Linux kernel supports the serial ports on your machine, and

also supports the console on the serial port. Your kernel may already

support these options, but if not, you can build a new kernel yourself.

If you use make menuconfig as your kernel configuration tool, select

the Character Devices section and mark these two options in the screen

that comes up:

<*> Standard/generic (8250/16550 and compatible UARTs) serial

support

[*] Support for console on serial port

You also need the program getty or one like it installed on your system

(alternatives include agetty). Next, edit your /etc/inittab file to

include a line like the following:

T0:23:respawn:/sbin/getty -h -L ttyS0 9600 vt100

In the above example, getty is looking for the Palm Pilot on the first

serial port, which PC users tend to think of as COM1. In Linux that's

currently called ttyS0. If you want to use COM2, change that to ttyS1.

This line also assumes that you'll be talking to the Palm at 9600 bps.

The defaults for the connection are 8 bits, 1 stop bit, and no parity,

which is something you need to remember when setting up your Palm Pilot

terminal program.

Once you have decided how to configure this line in /etc/inittab, run

the following command to tell your system to reread the /etc/inittab

file. (Remember, this isn't Windows -- you don't need to reboot to make

your system recognize changes to just about anything except the kernel

itself, and there are even exceptions to that rule.)

telinit q

There is one catch to setting yourself up this way. You may not be able

to synchronize data on your Palm Pilot using your favorite personal

information manager after you've set this up. It depends on your

version of getty and other factors. If you have this problem, I

recommend that you use mgetty instead. Set up your mgetty configuration

file by adding something like this to it for the serial port you're

using (ttyS0 in this example):

port ttyS0

direct y

speed 19200

data-only y

debug 3

toggle-dtr n

Then use this line in your /etc/inittab file instead of the one cited

above:

T0:23:respawn:/sbin/mgetty -b ttyS0

The -b switch tells mgetty to use a type of locking that allows you to

synchronize your Palm Pilot on the same serial port that you are using

to connect your Pilot as a terminal (not at the same time, of course).

Now all you need is a terminal program for your Palm Pilot. I use both

AccessIt! and VT100, which are free. AccessIt! is buggy on my Pilot,

but it has readable fonts for farsighted folks like me. VT100 is more

stable but has incredibly tiny fonts. It may be worthwhile to pay for a

terminal program if you use it a lot.

You'll need to install the Palm Pilot terminal program, which you can

do easily on Linux. First, make sure you have Pilot-Link on your

system. Then try the following command, substituting your program name

for the sample name ptelnet.prc, and the appropriate serial port

for /dev/pilot. Generally, it is a good idea to have a symbolic link

such as /dev/pilot pointing to the correct serial port, so you may be

able to use /dev/pilot on your system.

pilot-schlep /dev/pilot -i < ptelnet.prc

Now just make sure that your Palm Pilot communication settings are the

same as you specified in /etc/inittab. In the above example, you would

need 9600 bps, 8 bits, 1 stop bit, no parity. Once these settings

match, you should be in business and ready to communicate with your

Linux box using your Palm Pilot as a terminal.

Insider: How the basic tech behind the Internet works
Join the discussion
Be the first to comment on this article. Our Commenting Policies