Re: [gtk-vnc-devel] [PATCH][RFC] Support for ExtendedKeyEvent client message



Anthony Liguori <anthony codemonkey ws> writes:

> Markus Armbruster wrote:
[...]
>> If I understand you correctly, we both want an encoding for *physical*
>> keys.  These get transferred through RFB to the remote peer, which
>> then maps them to key events according to its own keymapping.
>>
>> I believe that Linux input layer key codes encode physical keys.
>> Quote showkey(1):
>>
>>     Keycodes are numbers assigned by the kernel to each individual
>>     physical key.  Every key has always only one associated keycode
>>     number, whether the keyboard sends single or multiple scan codes
>>     when pressing it.
>>
>> You can easily check that the keycodes shown by showkey are exactly
>> the KEY_* codes from linux/input.h.
>>
>> Consider the key labelled Y on US keyboards.  That key is identified
>> by input layer key code 21 (KEY_Y), no matter what keymapping or
>> actual keyboard I use.  The kernel's default translation tables map it
>> to y, Y, Ctrl-Y and so forth.  If I load German translation tables, it
>> gets mapped to z, Z, Ctrl-Z and so forth, but the key code is still
>> 21.
>>
>> PC key codes are an encoding for the physical keys of one particular
>> kind of keyboard.
>>   
>
> Not really.  PC key codes are well defined for one type of keyboard,
> but are used by every keyboard.  I guess there's a 1-1 mapping of
> Linux keycodes to PC keycodes.  I don't believe Linux keycodes are
> richer than PC key codes though because PC key codes are what are
> being generated from the actual keyboard.  By definition, there has to
> be a PC key code for any given key while this isn't necessarily true
> for Linux keycodes.

There has to be a PC key code for every physical key on a PC keyboard.

However, not every keyboard is a PC keyboard, and some of them have
keys that that don't exist on PC keyboards.

What's PC key code the code for a power key?  The Linux key code is
KEY_POWER, easily looked up in linux/input.h.  If I read
atkbd2_set2_keycode[] correctly, the PC key code is 0xB7, but I'm not
sure.  I can't see KEY_LINEFEED, KEY_AGAIN, KEY_PROPS, KEY_UNDO,
KEY_FRONT and many more in that table.  If there are PC key codes for
these keys, I don't know how to find them.

> So I guess it really comes down to, what benefit would we get by using
> Linux key codes?

None, if PC key codes are at least as rich (which I doubt) and at
least as well-defined (which I doubt too).

> Regards,
>
> Anthony Liguori
>
>> Linux input layer key codes are an encoding for the physical keys of
>> any keyboard supported by Linux.
>>
>> It's easy to map from PC key codes to Linux input layer key codes and
>> back.  The map doesn't depend on what keymap the user configured,
>> because both encodings identify physical keys.  But Linux input layer
>> key codes are a richer encoding.  What's the PC key code for
>> KEY_POWER?
>>
>> Again, please excuse me if I talk nonsense, and try to use simple,
>> short sentences in your reply %-}
>>   




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]