On Wed, May 30, 2007 at 04:25:03PM -0400, Dmitry Torokhov wrote:

> Consider ejecting a CD tray. You have a laptop with a key that maked
> eject CD. Because it is a new laptop there are no proper mapping yet
> so some adjustments are needed. With your scenario the kernel emits
> KEY_PROG26. User has first to adjust X keymap to map KEY_PROG26 to
> EjectCD event (simplifying). Then he goes into text console only to
> find out that his curses-based CD player does not recognize that key
> and also needs to be adjusted. And so on. Finally all applications are
> made aware of KEY_PROG26 amd user is happy. Couple of weeks later he
> goes and buys an external keyboard and it turns out that eject CD
> there is actually KEY_PROG21 so he need to go through second round of
> mapping for all applications. Not only that but button with volume
> increase happens to generate KEY_PROG26. Now what?
> 
> Now consider in-kernel remapping to functional scancdes that I
> propose: user says that that key should generate KEY_EJECTCD and it
> starts working in all appliations recognizing that event. Adding the
> second keyboard into mix does not mess up the first one.

That makes absolute sense when a key has a defined function, but in the
case we're discussing it doesn't. So, we have two choices:

1) Map it to a specific function system-wide (so a default of 
KEY_UNKNOWN is fine)
2) Map it to a specific function at the user level

If the key doesn't have anything printed on it, there is no correct 
system-wide default. It's intrinsically a per-user preference. But for 
the user to be able to decide what the key does, it has to generate a 
keycode. Once it does that they can use one of the existing X 
applications to bind that to an X keysym and then everyone is happy.

But for this to be possible a keycode has to be generated. We can either 
set this at boot time or in the kernel. The only argument for doing it 
at boot time is that userspace might have a better idea what the key 
should map to. However, in the case of a blank key, how is userspace 
going to have any more idea than the kernel does? The only sane default 
is something like KEY_PROG1.

-- 
Matthew Garrett | [EMAIL PROTECTED]

Reply via email to