[Tfug] remapping keys
Jeremy D Rogers
jdrogers at optics.arizona.edu
Sun Apr 15 06:25:14 MST 2007
> > > man showkey?
That's pretty cool. I've wondered (many years ago) about doing this,
but gave up. t looks like it's easier now... (skip to the end)
> > doesn't help. When I run it, and press caps lock or scroll lock nothing
> > happens. I
> > tried pressing some other buttons to confirm that it works, and it does.
> >
>
> Weird... it shows me the key press of my scroll lock, and of my caps lock.
>
> showkey -k
> keycode 70 press
> keycode 70 release
> keycode 58 press
> keycode 58 release
That's strange for a couple reasons.. I also get data from caps or
scrlk, but it's completely different:
showkey
0x9c <- this is always there when I start showkey
0x3a 0xba <- this is the press and release of caps
0x46 0xc6 <- this is the press and release of scrlk
The 0x3a is 58 decimal and the 0x46 is 70 decimal, so I guess those
are the keycodes, but the release is completely different. Odd. For
kicks, here is the xev.. as you can see, it's a completely different
set of keycodes:
KeyPress event, serial 30, synthetic NO, window 0x1200001,
root 0x75, subw 0x0, time 4115249072, (169,81), root:(821,627),
state 0x2, keycode 66 (keysym 0xffe5, Caps_Lock), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 30, synthetic NO, window 0x1200001,
root 0x75, subw 0x0, time 4115249168, (169,81), root:(821,627),
state 0x2, keycode 66 (keysym 0xffe5, Caps_Lock), same_screen YES,
XLookupString gives 0 bytes:
KeyPress event, serial 30, synthetic NO, window 0x1200001,
root 0x75, subw 0x0, time 4115250880, (169,81), root:(821,627),
state 0x0, keycode 78 (keysym 0xff14, Scroll_Lock), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 30, synthetic NO, window 0x1200001,
root 0x75, subw 0x0, time 4116651136, (177,86), root:(830,622),
state 0x2, keycode 78 (keysym 0xff14, Scroll_Lock), same_screen YES,
XLookupString gives 0 bytes:
> > > There aren't really events, you know?
> > no. Could you expand on this?
>
> I mean that certain keys may not run through the keyboard controller
> (for example the little "radio" button on my laptop), and those may
> show up as an X event depending on how things are geting read.
>
> > Should I attach a copy of kbdcontrol -d?
> >
> I guess it wouldn't hurt, but if you aren't seeing them, then I am
> assuming it is something more BSD-ish than I know.
So this is for BSD? I don't know if it will work if showkey isn't
seeing any keypress, but on my debian system, there is a file (part of
console-tools):
$ cat /etc/console-tools/remap
# This sed script is run across the dumpkeys output to remap keys
on the console
# This turns caps lock into control
#s/keycode 58 = Caps_Lock/keycode 58 = Control/;
That sounds like what you want. Also "console-tools" seems to have
lots of other tools for dealing with console keycodes.
Cheers,
JDR
More information about the tfug
mailing list