$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.
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).
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:
Load the correct kernel module.
Shut off everything that is currently using the serial port.
Tell the system to start using the keyboard.
(optional) Load key map tables to access "special" keyboard keys.
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 |
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.
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 |
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.
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.
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 |
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