Re: Lost keypresses [was Re: GGI and cli/sti in X]

Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
Thu, 2 Apr 1998 15:54:36 +0200 (CEST)


On Thu, 2 Apr 1998, Guest section DW wrote:
> About the difference between scancodes and keycodes:
> When you press a key the keyboard hardware generates a stream
> of between zero and six (on a PC) scancodes. An application

I know.

> just wants to see what key you pressed, so has to assemble
> these scancodes into the keycode, some arbitrary number
> attached to the keys. If the application does not use VC_RAW
> but VC_MEDIUMRAW then the kernel will do the assembling -
> that is better, this way the application does not need knowledge
> about the scancodes generated by various keyboards.

Right.

> Linux uses the arbitrary numbering 1, 2, ... and reserves 0
> for special purposes. The authors of the non-Intel keyboard
> drivers have not understood that keycodes are completely
> arbitrary and also produce keycode 0 (for scancode 0).
> *That is a bug.*

Hmmm... The only place I found keycode 0 is used is to test the validity of the
arguments of KDSKBENT. Is that really necessary to forbid us using 0?

> > Is there a good reason for keeping the scancode system?
>
> On a kernel list this is a meaningless question.
> The hardware produces scancodes so the kernel has to deal
> with them. It is up to the application to request either
> scancodes or keycodes, so the above question is appropriate
> only on an X list.

Of course the kernel has to know. But the application? I can't have _one_ X
server binary for Linux/PPC because the application has to know whether an ADB
(without prefixes) or a PS/2 (with prefixes) keyboard is connected. Or I have
to use a command line option or a config file option. Autoprobing is difficult
because 0xe0 and 0xe1 may be real keycodes instead of prefixes on some
keyboards.

> > 16 bit keycodes?
>
> We will probably need them sooner or later, but not sooner,
> so for the time being we might as well forget this idea.
> People do not have keyboards with 128 keys or more.

Wrong. I know someone who has.

> The disadvantage of 16-bit keycodes is that keymaps become
> sparse tables, both in the kernel and in the applications
> that do their own decoding. That is definitely inconvenient,
> and there is nothing we win.

Yep. That's a disadvantage.

> Andries - who used to maintain the keyboard/console driver
> before the concept of maintainer was invented, and until 1.3.1 -
> typing from the keyboard of dwguest.
>
> PS - I do not read linux-kernel, that is, only on April 1st.

Oh, this is an April the 1st joke, and I'm so stupid to reply :-)

Greetings,

Geert

--
Geert Uytterhoeven                     Geert.Uytterhoeven@cs.kuleuven.ac.be
Wavelets, Linux/{m68k~Amiga,PPC~CHRP}  http://www.cs.kuleuven.ac.be/~geert/
Department of Computer Science -- Katholieke Universiteit Leuven -- Belgium

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu