2006-03-03 18:14:58

by Ian E. Morgan

[permalink] [raw]
Subject: Setkeycodes w/ keycode >= 0x100 ?

Since my HP notebook has some unrecognized keys, I have to use setkeycodes to
make the kernel recognise them. However, many of the basic (<=255) KEY's from
input.h are not suitable, but newer ones (>=0x100) woule be perfect.

Any idea how to map scancodes to keycodes >=0x100 when setkeycodes won't
accept hex input nor anything greater than 255?

Regards,
Ian Morgan

--
-------------------------------------------------------------------
Ian E. Morgan Vice President & C.O.O. Webcon, Inc.
imorgan at webcon dot ca PGP: #2DA40D07 http://www.webcon.ca
* Customized Linux Network Solutions for your Business *
-------------------------------------------------------------------


2006-03-03 18:39:45

by linux-os (Dick Johnson)

[permalink] [raw]
Subject: Re: Setkeycodes w/ keycode >= 0x100 ?


On Fri, 3 Mar 2006, Ian E. Morgan wrote:

> Since my HP notebook has some unrecognized keys, I have to use setkeycodes to
> make the kernel recognise them. However, many of the basic (<=255) KEY's from
> input.h are not suitable, but newer ones (>=0x100) woule be perfect.
>
> Any idea how to map scancodes to keycodes >=0x100 when setkeycodes won't
> accept hex input nor anything greater than 255?
>
> Regards,
> Ian Morgan

The keyboard controller generates scan-codes from 0 to 255.
It reads the scan-code information from a byte-wide port
(so-called PORT_A in the PC/AT), so it can't be any larger
than a byte. The controller provides a code when the key
is pressed and another code when the key is released. The
only difference between these codes is a single bit.
This limits the number of possible different scan codes
to 127.

The scan-codes are translated, based upon the Caps Lock, the
Ctrl key, the Alt key, and the Shift key so, in principle,
you could have almost 4 times as many keyboard symbols as
scan-codes. However, you would have to rewrite a lot of
keyboard code to take advantage of this.

>
> --
> -------------------------------------------------------------------
> Ian E. Morgan Vice President & C.O.O. Webcon, Inc.
> imorgan at webcon dot ca PGP: #2DA40D07 http://www.webcon.ca
> * Customized Linux Network Solutions for your Business *
> -------------------------------------------------------------------

Cheers,
Dick Johnson
Penguin : Linux version 2.6.15.4 on an i686 machine (5589.54 BogoMips).
Warning : 98.36% of all statistics are fiction, book release in April.
_


****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to [email protected] - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.

2006-03-03 18:58:43

by Ian E. Morgan

[permalink] [raw]
Subject: Re: Setkeycodes w/ keycode >= 0x100 ?

On Fri, 3 Mar 2006, linux-os (Dick Johnson) wrote:

>
> On Fri, 3 Mar 2006, Ian E. Morgan wrote:
>
> > Since my HP notebook has some unrecognized keys, I have to use setkeycodes to
> > make the kernel recognise them. However, many of the basic (<=255) KEY's from
> > input.h are not suitable, but newer ones (>=0x100) woule be perfect.
> >
> > Any idea how to map scancodes to keycodes >=0x100 when setkeycodes won't
> > accept hex input nor anything greater than 255?
> >
> > Regards,
> > Ian Morgan
>
> The keyboard controller generates scan-codes from 0 to 255. It reads the
> scan-code information from a byte-wide port (so-called PORT_A in the
> PC/AT), so it can't be any larger than a byte. The controller provides a
> code when the key is pressed and another code when the key is released.
> The only difference between these codes is a single bit. This limits the
> number of possible different scan codes to 127.
>
> The scan-codes are translated, based upon the Caps Lock, the Ctrl key, the
> Alt key, and the Shift key so, in principle, you could have almost 4 times
> as many keyboard symbols as scan-codes. However, you would have to rewrite
> a lot of keyboard code to take advantage of this.

Perhaps my question was unclear. Here is an example of what I do now:

#KEY_COFFEE
setkeycodes e00a 152

This works, but is an illogical arbitrary assignment. I want to do this:

#KEY_POWER2
setkeycodes e00a 356

(or some other such thing with a keycode >256). But it fails with:

KDSETKEYCODE: Invalid argument
failed to set scancode 8a to keycode 356

In drivers/char/keyboard.c, there are three cases in which it can return
-EINVAL, but I can't see obviously which one is being hit.

Is the answer simply that we cannot bind scancodes to keycodes greater than
256? If so, then why are there newer KEY's defined in input.h >256, and how does
one ever use them?

Regards,
Ian Morgan

--
-------------------------------------------------------------------
Ian E. Morgan Vice President & C.O.O. Webcon, Inc.
imorgan at webcon dot ca PGP: #2DA40D07 http://www.webcon.ca
* Customized Linux Network Solutions for your Business *
-------------------------------------------------------------------

2006-03-03 19:23:08

by linux-os (Dick Johnson)

[permalink] [raw]
Subject: Re: Setkeycodes w/ keycode >= 0x100 ?


On Fri, 3 Mar 2006, Ian E. Morgan wrote:

> On Fri, 3 Mar 2006, linux-os (Dick Johnson) wrote:
>
>>
>> On Fri, 3 Mar 2006, Ian E. Morgan wrote:
>>
>>> Since my HP notebook has some unrecognized keys, I have to use setkeycodes to
>>> make the kernel recognise them. However, many of the basic (<=255) KEY's from
>>> input.h are not suitable, but newer ones (>=0x100) woule be perfect.
>>>
>>> Any idea how to map scancodes to keycodes >=0x100 when setkeycodes won't
>>> accept hex input nor anything greater than 255?
>>>
>>> Regards,
>>> Ian Morgan
>>
>> The keyboard controller generates scan-codes from 0 to 255. It reads the
>> scan-code information from a byte-wide port (so-called PORT_A in the
>> PC/AT), so it can't be any larger than a byte. The controller provides a
>> code when the key is pressed and another code when the key is released.
>> The only difference between these codes is a single bit. This limits the
>> number of possible different scan codes to 127.
>>
>> The scan-codes are translated, based upon the Caps Lock, the Ctrl key, the
>> Alt key, and the Shift key so, in principle, you could have almost 4 times
>> as many keyboard symbols as scan-codes. However, you would have to rewrite
>> a lot of keyboard code to take advantage of this.
>
> Perhaps my question was unclear. Here is an example of what I do now:
>
> #KEY_COFFEE
> setkeycodes e00a 152
>
> This works, but is an illogical arbitrary assignment. I want to do this:
>
> #KEY_POWER2
> setkeycodes e00a 356
>
> (or some other such thing with a keycode >256). But it fails with:
>
> KDSETKEYCODE: Invalid argument
> failed to set scancode 8a to keycode 356
>
> In drivers/char/keyboard.c, there are three cases in which it can return
> -EINVAL, but I can't see obviously which one is being hit.
>
> Is the answer simply that we cannot bind scancodes to keycodes greater than
> 256? If so, then why are there newer KEY's defined in input.h >256, and how does
> one ever use them?
>
> Regards,
> Ian Morgan
>
> --
> -------------------------------------------------------------------
> Ian E. Morgan Vice President & C.O.O. Webcon, Inc.
> imorgan at webcon dot ca PGP: #2DA40D07 http://www.webcon.ca
> * Customized Linux Network Solutions for your Business *
> -------------------------------------------------------------------
>

Well the input.h in the distribution I use, has the highest key-code
as KEY_UNKNOWN and that is number 200. Perhaps you are trying to
use BTN_0 through BTN_N as key codes? Or perhaps there is some
unfinished business in your version of headers?

Cheers,
Dick Johnson
Penguin : Linux version 2.6.15.4 on an i686 machine (5589.47 BogoMips).
Warning : 98.36% of all statistics are fiction, book release in April.
_


****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to [email protected] - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.

2006-03-03 19:52:36

by Ian E. Morgan

[permalink] [raw]
Subject: Re: Setkeycodes w/ keycode >= 0x100 ?

On Fri, 3 Mar 2006, linux-os (Dick Johnson) wrote:

> Well the input.h in the distribution I use, has the highest key-code
> as KEY_UNKNOWN and that is number 200. Perhaps you are trying to
> use BTN_0 through BTN_N as key codes? Or perhaps there is some
> unfinished business in your version of headers?

Irrespective of distro, recent kernel (2.6.15.5) headers have KEY_MAX as
0x1ff (511). Incidentally, my glibc headers have the same thing.

You must have very old headers, as here KEY_PLAYCD=200, KEY_UNKNOWN=240, and
KEY_MAX=0x1ff.

Regards,
Ian Morgan

--
-------------------------------------------------------------------
Ian E. Morgan Vice President & C.O.O. Webcon, Inc.
imorgan at webcon dot ca PGP: #2DA40D07 http://www.webcon.ca
* Customized Linux Network Solutions for your Business *
-------------------------------------------------------------------