Re: Capturing all keys on more-than-102-keys keyboards

From: Helge Hafting (helgehaf@idb.hist.no)
Date: Thu Feb 10 2000 - 05:35:28 EST


> > You can find more and more keyboards with extra keys, such as media
> > players control keys (Start, Stop, Pause, etc.), sleep and so on.
> >
> > The problem is: the scancodes won't even show on a showkey -s!
> > The question is: what to change and where? I'd like the kernel to at
> > least tell "Unknown scancode: <the_scancode>", but how can I do that?
>
> Roughly speaking (that is, apart from some `protocol' scancodes)
> showkey -s will show you everything the keyboard produces.
> So, when showkey -s doesnt show anything that is because the
> keyboard does not produce anything, and no kernel patch
> will change that.

Some keyboards communicate extra keys by using "protocol oddities".
Such keys either don't show up with showkey, or they alias to some
other existing key.

The simple way of capture these (for development purposes) is to
edit the keyboard device driver. There is a single place where
it reads bytes from an io-port, when handling the
keyboard interrupt. The byte read is looked up in
tables an turned into keypress/key-release codes that showkey will
show. "Protocol oddities" are removed at this stage.

If you want to see everything, put a "printk" at the line after
reading the io-port. Compile and run this kernel, but not for long.
The console will print a line each time you press or release a key, and
this will also be recored in your logfiles. It is very annoying
for normal work.

Look at what codes (or sequences of codes) your unusal key produce
when pressed and released. And see if it repeats when held down.

Reboot into a normal kernel before analyzing the logfiles.
You *will* get your keys this way, if they use the normal interface
at all. You may then modify the keyboard driver. This could be as
simple
as adding a table entry for a key with normal behaviour but unusual
code,
or as complex as adding extra logic for keys that transmit strange
sequences of codes when pressed.

The only problem you might run into are keyboards who need to be told
to "turn on" nonstandard keys. (Done because a certain os *crash* if
it gets unusual keycodes) Another problem is keys that use a separate
interface (some other io-port etc.). Use a different driver for those.

Finally, note that Vojtech Pavlik rewrote the keyboard/mouse input
system a long time ago making such modifications simpler. His
work is unfortunately postponed for 2.5 though.

Helge Hafting

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Feb 15 2000 - 21:00:17 EST