[ltp] Showkeys -s

Tod Harter linux-thinkpad@www.bm-soft.com
Tue, 18 Jun 2002 13:22:05 -0400


On Tuesday 18 June 2002 12:11, Eric Jorgensen wrote:

To give people a little bit of background on the PC keyboard architecture...

First of all you have the keyboard itself. The keyboard is essentially a 
matrix of switches such that when a key is depressed 2 bits are set in a 
register in a controller on the keyboard itself, one representing the row and 
the other the column of the key pressed. The keyboard's controller forwards 
these "scan codes" via a serial interface to an 8080 based microcontroller on 
the mainboard which translates them into "raw keycodes", adds them to a fifo, 
and generates an interrupt to the system. The code for doing all this is in 
the so-called "keyboard bios", which on older desktops was its own chip, as 
many may recall. These events represent both presses and releases of keys.

In DOS at least the system bios contains a keyboard driver which handles the 
keyboard interrupt, reads the raw keycodes, and uses a "keymap" to translate 
them into the familiar keycodes most programmers are familiar with. This 
mechanism allows one to substitute different translations for various types 
of keyboard. In Linux (or other modern OS) there is a similar keyboard driver 
built in to do the same sort of thing. After that you get into X's 
translation of keyboard input codes from the driver into X windows events, 
etc.

Now, if a key is integrated into this mechanism, then in theory at least it 
should be possible to use the keyboard driver to sense the pressing and 
releasing of that key. However there is nothing to say that a button attached 
to your computer is integrated as part of the keyboard.... In point of fact 
its unlikely that the "grey buttons" work that way at all. Only IBM seemingly 
knows WHAT they do, and they aren't telling...

As for the thinkpad key, its hard to say why you get a shiftrelease event 
when you use it with the leftshift key, but there could be a number of 
reasons, such as the keyboard controller chip is getting some sort of 
interrupt from the keyboard when its pressed, but its not propagated as a 
keycode, yet thats enough to make it think you released the shift key.

The situation with the Fn key is that it is most likely showing up as a 
"modifier" of some sort. Its really up to the keyboard controller to decide 
how to handle that, and one assumes the keyboard bios does SOMETHING with it, 
we just don't know what...

> On Tue, 18 Jun 2002 11:30:24 +0200 (MEST)
>
> ZeiMoT <zeimot@astrakan.hig.se> wrote:
> > Running
> > showkey -s
> > and then pressing and releasing the left shift button
> > gives:
> > 0x2a 0xaa
> >
> > Holdning the left shift a little longer before releasing gives a lot of
> > 0x2a ended with a 0xaa
> >
> > Well, I tried to Press the Thinkpad, the Volume- Volume+ and the Mute
> > buttons, as expected, they gave no response.
> >
> > Holding the shift key down and then pressing the thinkpad button gave the
> > same result as pressing and releasing the shift key. The same goes with
> > the Volume- Volume+ and Mute buttons.
> >
> > Oh, so those keys interfere with the keyboard presses, thus, one might
> > think that they are really keys that affects the keyboard scancodes but
> > not in a way that we know how to read, right?
> >
> > But why does the pressing-left-shift and thinkpad button produce a
> > leftshiftpress and a leftshiftrelease? and then when I release the
> > leftshiftkey it produces a leftshiftkeyrelease scancode: 0xaa . ?
> >
> > Is it possible that IBM has made a new set of Double scancodes that is
> > not take in to count by the kernel? Are there any scancode values that
> > are not read by the kernel?
>
> 	No, the situation is that on many thinkpads (such as the X21 i'm using at
> the moment) the special keys are on or near the thinkpad but they don't
> return a scan code at all. I suspect that their functions are autonomously
> handled by the embedded controller.
>
>  - Eric
>
> ----- The Linux ThinkPad mailing list -----
> The linux-thinkpad mailing list home page is at:
> http://www.bm-soft.com/~bm/tp_mailing.html

----- The Linux ThinkPad mailing list -----
The linux-thinkpad mailing list home page is at:
http://www.bm-soft.com/~bm/tp_mailing.html