Keyboards HOWTO

$Id: keyboards.html,v 1.18 2003/02/21 19:48:52 jamey Exp $

This section describes how to use add-on keyboards such as the Stowaway or the Compaq Microkbd with the iPAQ.

Background

A variety of small keyboards are available. Most keyboards plug into the serial port at the bottom of the iPAQ (there is one keyboard that uses the IrDA port).

Preparing to use the Keyboard

In order to use one of these keyboards, both kernel and userspace have to be ready. There are four steps to making the keyboard work:

  1. Load the correct kernel module.

  2. Shut off everything that is currently using the serial port.

  3. Tell the system to start using the keyboard.

  4. (optional) Load key map tables to access "special" keyboard keys.

Loading the Keyboard Kernel Module

First, a kernel module has to be loaded that contains a line discipline that uses the serial port and reads keyboard events from the serial port. Most keyboards use the h3600_microkbd kernel module; for historical reasons the Targus Stowaway keyboard uses the h3600_stowaway module. To load the module one uses the modprobe command. For example::

	  sh# modprobe h3600_microkbd
	

The following command will add h3600_microkbd to /etc/modules so that it will be loaded automatically at boot time:

	  sh# echo h3600_microkbd >> /etc/modules 
	

Make sure kernel console is not on the serial port

The following command will direct the kernel not to use the serial port for kernel console messages:

	  sh# echo 'set linuxargs "noinitrd root=/dev/mtdblock1 init=/linuxrc"' > /boot/params
	

The contents of /boot/params should now look like:

	  set linuxargs "noinitrd root=/dev/mtdblock1 init=/linuxrc"
	

After rebooting, the bootldr will read and execute the commands in the ASCII file /boot/params. This will update linuxargs, which are the commandline args passed to the kernel. Because linuxargs no longer contains console=ttySA0, the kernel will not open the serial port.

Preparing the Serial Port

In the normal Familiar Linux installation, the serial port in the iPAQ's cradle connector is available as a console login. This is under control of init, the initial procecess, as configured in /etc/inittab.

In runlevels 2 and 3, init grabs the serial port for use by serial logins. In other runlevels, it is released. The following command will switch to runlevel 4:

	  sh# telinit 4
	  INIT: Switching to runlevel: 4
	  INIT: Sending processes the TERM signal
	  INIT: no more processes left in this runlevel
	

At this point, the serial port is released. The serial login can be reactivated by switching back to runlevel 2:

	  sh# telinit 2
	

If X was terminated when switching to runlevel 4, then copy the runlevel 2 entries to runlevel 4 and reboot:

	  sh# cp /etc/rc2.d/* /etc/rc4.d
	  sh# reboot
	

Using the keyboard

Now that the iPAQ is prepared, attach the keyboard. To activate the keyboard kernel module, you need to open the keyboard device file: /dev/microkbd/compaq -- the following command will do this:

	sh# cat /dev/microkbd/compaq
      

This command will produce no output, but as long as it holds the keyboard device open the keyboard will be operational. Any command that opens the keyboard device file open is sufficient. Once the device is closed, the serial port will be released and the keyboard will not longer work.

Mapping the Keys under X

The key mapping presented by the keyboard is nonstandard, so X will have to be notified of the new mapping:

	  sh# xmodmap /etc/microkbd/compaq.dk
	

Some applications, such as dillo, seem not to use the X keyboard support properly, so not all of the keys will work.

Also, xstroke seems not to work properly once the keyboard has been remapped in this way.

Mapping the Keys for Linux Console Applications

The following command will install a keyboard mapping for use by any application that reads from /dev/fb[0-63]:

	  sh# loadkeys /etc/microkbd/compaq.map
	

Mapping the Keys under QPE/Qtopia/Opie

It is not currently possible to make all the keys work with QPE/Qtopia/Opie because Qt assumes that all keyboards use the same key mapping.

All of the following keyboards except the Stowaway require installing the microkbd-modules ipkg.

Table 1. Supported keyboards

HP Microkeyboard

HP Microkeyboard

ipkg:compaq-microkbd
device:/dev/microkbd/compaq
xmodmap:/etc/microkbd/compaq.dk
loadkeys:/etc/microkbd/compaq.map

HP Foldable keyboard

HP Foldable Keyboard

ipkg:foldable-microkbd
device:/dev/microkbd/foldable
xmodmap:/etc/microkbd/foldable.dk
loadkeys:/etc/microkbd/foldable.map

Targus Stowaway

HP Stowaway: a rebranded Targus Stowaway folding keyboard.

ipkg:stowaway-modules-2.4.XX-rmkXX
device:/dev/stowaway
xmodmap:not needed
loadkeys:not needed

For historical reasons the Targus Stowaway keyboard driver is in a separate kernel module. This will probably change in the future.

Snap 'N Type keyboard

Snap'n'type Microkbd

ipkg:snapntype-microkbd
device:/dev/microkbd/snapntype
xmodmap:/etc/microkbd/snapntype.dk
loadkeys:/etc/microkbd/snapntype.map

iConcepts

iConcepts Microkbd

ipkg:iconcepts-microkbd
device:/dev/microkbd/iconcepts
xmodmap:/etc/microkbd/iconcepts.dk
loadkeys:/etc/microkbd/iconcepts.map

Adesso EagleTouch

Adesso Eagle-Touch Portable PDA keyboard (manufacturer model PKB-140).

ipkg:eagletouch-microkbd
device:/dev/microkbd/eagletouch
xmodmap:/etc/microkbd/eagletouch.dk
loadkeys:/etc/microkbd/eagletouch.map

Yes, I know that the picture doesn't show an iPAQ.

Micro Innovations

Micro Innovations Wireless IR Keyboard. Also sold as Pocketop keyboard.

ipkg:microinnovations-microkbd
device:/dev/microkbd/microinnovations
xmodmap:/etc/microkbd/microinnovations.dk
loadkeys:/etc/microkbd/microinnovations.map

The Micro Innovations keyboard sends data to your iPAQ IrDA port, not to the serial port. Hence you do not need to redirect the console messages or remove the getty entry from the inittab file. However, it will not work simultaneously with either the standard Linux IRDA modules or LIRC modules.

Grandtek PocketVIK

Grandtek PocketVIK flexable keyboard

ipkg:pocketvik-microkbd
device:/dev/microkbd/pocketvik
xmodmap:/etc/microkbd/pocketvik.dk
loadkeys:/etc/microkbd/pocketvik.map

Flexis FX100

Flexis FX100 flexable keyboard

ipkg:flexis-fx100-microkbd
device:/dev/microkbd/flexis
xmodmap:/etc/microkbd/flexis-fx100.dk
loadkeys:/etc/microkbd/flexis-fx100.map