[comp.unix.aux] A keyboard patch for A/UX

km@mathcs.emory.edu (Ken Mandelberg) (06/30/89)

I've worked out a binary patch for the A/UX keyboard driver to make a
small change in the ascii encoding. The goal was to make the large
"delete" key generate an ascii "BACKSPACE" (control-h) and make the
smaller "del" key generate an ascii "DELETE".

The point of this is that many of us prefer to set our erase character
to backspace, and our intr charcter to delete, rather than the DEC
standard Apple expects. Keeping this setting constant means that there
are no surprises if you rlogin/tip  to A/UX from another machine, or
use the MacII to rlogin/tip to another Unix host.

The adb patch is very short and is applied with the following shell
script. You must reboot to have it take effect.

#! /bin/sh
adb -k -w /unix /dev/kmem <<eof
key_map1+0x74?w 0xb53f   #send del key mapping to key_map6+7
key_map4?w 0x0820        #remap delete to control-h
key_map6+6?w 0x767f      #steal ansi keypad 7 byte for del
eof


There are several limitations in this patch:

1) The keyboard driver does not have a uniform translation table (like
a MacOS keymap), so only certain changes are possible in a binary
patch. I found that to remap the del key I needed to find a byte to
sacrifice in a certain range.  This patch sacrifices the keypad "7" key
when it is in ANSI mode. That key ordinarily generates the sequence
"ESC O w" in ANSI mode, now it will generate an "ESC O delete" in ANSI
mode. I know of no A/UX software puts the keypad in ANSI mode.

2) This kernel patch only effects the mapping when the keyboard is in
ASCII mode. Certain software put the keyboard into raw mode and uses
its own mapping. An example of this is X11. You can get the same effect
in X11 by adding the following to your
.x11start

xmodmap -e "keysym Delete = BackSpace" 
xmodmap -e "keycode 125 = 0xffff" 
stty erase "^h" intr "^?"

In fact, if you live exclusively in X11 you need not bother with the
kernel keyboard patch.

If you use the Grasshopper Mac NeWS, you need to do something similar in
your user.ps file. Perhaps a NeWS expert can volunteer the details.

3) Although the information for the kernel patch comes from the A/UX
1.0 driver source, we have verified that it works on A/UX 1.1.  Apple
sells the driver source relatively inexpensively through ADPA in case
you want to make more general changes.

4) It would be tempting to change the "?"s to "/"s in the adb patch to
make the kernel change on the fly without effecting /unix (say in the
rc script). I recommend against this. For unknown reasons this causes
some corruption to /unix after a while.

-- 
Ken Mandelberg      | km@mathcs.emory.edu          PREFERRED
Emory University    | {decvax,gatech}!emory!km     UUCP 
Dept of Math and CS | km@emory.bitnet              NON-DOMAIN BITNET  
Atlanta, GA 30322   | Phone: (404) 727-7963