Subject: Z50: X11 and arrow keys question
To: None <port-hpcmips@netbsd.org>
From: billy ball <bball@tux.org>
List: port-hpcmips
Date: 08/22/2001 10:08:43
hi... first, thanks to greg hughes for his hpcmips kernel with Z50
TrackPoint support... using the hpcmips NetBSD on the Z50 is a joy...

i recently overcame one slight, but annoying obstacle, but i do have a
couple questions, probably not kernel related:

- i found that, by default, the arrow keys do not work and are not
recognized by xterm or rxvt when using X, despite the TERM definition...  
i can remap the arrow key functions to unused function keys on the z50,
but i'd rather use the actual keys... xmodmap chokes when presented the
actual keycodes for the arrow keys (as returned by xev) and the values
seem to be 'out of range,' but the function keys are within range and
recognized...

- xev displays the following keycode values when pressing the Up, Left,
Down, and Right arrow keys:

Up 208
Down 216
Left 211
Right 213

- in order to get the cursor keys working during an X session (they work
fine at the console), i copied /usr/X11R6/lib/xkb/xkeymap/xfree86, then
used part of its contents to create a file named .mykeymap containing:

default xkb_keymap "us" {
    xkb_keycodes { include "xfree86"  };
    xkb_types { include "default"  };
    xkb_compatibility { include "default"  };
    xkb_symbols { include "us(pc105)"  };
    xkb_geometry { include "pc"  };
}; 

i then saved this new file in my home directory.

- i then edited /usr/X11R6/lib/xkb/keycodes/xfree86 and changed:

	maximum= 8;
to 
	maximum= 217;

and also:

    <UP> = 98;
    <LEFT> = 100;
    <DOWN> = 104;
    <RGHT> = 102;

to:

    <UP> = 208;
    <LEFT> = 211;
    <DOWN> = 216;
    <RGHT> = 213;

and saved the file... finally, i inserted this line:

xkbcomp -R/usr/X11R6/lib/X11/xkb/ $HOME/.mykeymap :0

into my .xinitrc (right before the line launching the window manager; in
this case tvtwm, using a virtual desktop of 1280x960)... when i launch X
using:

startx -- -dev /dev/ttyE0

the new map is zapped into the server before the window manager launches, 
and i can then use the arrow keys while using X (rxvt/xterm) on the Z50!

my questions are:

- is this the right approach? and why is the default xfree86 keymap
limited to 142 values?... the 1997/08/02 version of the xfree86 keymap
file on other systems (such as Linux) defines 254 keys, not the 142
maximum defined in the version of the xfree86 keymap file included with X
distributed for hpcmips 1.5.1!

- any tips on rebuilding the default keymap to include the arrow keys?

- any tips on getting keyboard repeat out of my approach? (i have to
repeatedly press the arrow key to scroll)... i fear the getting the keys
to do double-duty as pgup and pgdown, home, end will never be accomplished
because the keycodes returned are the same, even if Alt is pressed...

many thanks, and keep up the great work on hpcmips! i really like how the
LED is used for a drive-access indicator! and i look forward to more
improvements... my wishlist:

- LCD suspend (the CPU, drive suspend seems to work just fine)
- three-button emulation for the trackpoint...

regards,

billy ball