From: Andries Brouwer <aebr@win.tue.nl>
To: Sasa Stevanovic <mg94c18@alas.matf.bg.ac.yu>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Possible bug in keyboard.c (2.6.10)
Date: Thu, 27 Jan 2005 13:56:37 +0100 [thread overview]
Message-ID: <20050127125637.GA6010@pclin040.win.tue.nl> (raw)
In-Reply-To: <Pine.LNX.4.61.0501270318290.4545@82.117.197.34>
On Thu, Jan 27, 2005 at 04:16:14AM +0100, Sasa Stevanovic wrote:
> I had some problems with my laptop's onetouch keys and it eventually led me
> to keyboard.c file from 2.6.10 kernel (Vojtech Pavlik and others). There
> may be a bug in the file, please read below.
>
> Well, actually, when all omnibook/messages/setkeycodes/hotkeys/xev/showkey
> etc stuff is stripped off, what remains is that x86_keycodes array has only
> first 240 members initialized, while remaining 16 are set to 0 due to [256]:
>
> static unsigned short x86_keycodes[256] = { <only 240 here> };
>
> (For my scenario, workaround was possible.)
>
> I am not sure if this is a bug or not; it worked in 2.4.18 without
> workaround. Might be that someone wanted to prevent reading invalid memory.
> There are many versions of the file/array definition found on the web, none
> of which has a comment about this.
You only express surprise at the initialization but do not
give details about what goes wrong for you.
If you want to test what scancodes your keyboard produces,
it is better to boot 2.4. From 2.6 one gets some peculiar
synthetic "raw" mode where keys have been translated back
and forth a few times via non-invertible mappings.
What happens today can be read in input/keyboard/atkbd.c:
First the scancode sent by the keyboard is "untranslated"
using the array atkbd_unxlate_table[]. For example, the
Home key produces e0 1c and is untranslated to 128+90.
Then the untranslated value is found in atkbd_set2_keycode[]
and we find atkbd_set2_keycode[128+90] = 96.
In raw mode this 96 must be converted back, and that is
done in keyboard.c:emulate_raw() where x86_keycodes[96] = 284
and 284 = 256 + 28, and we produce e0 1c.
(Most numbers in decimal, scancodes in hex.)
So x86_keycodes[] only needs values at indices 240-255
when these occur as keycodes, and they don't, I think.
(There is a 255 at indices 128+18 and 128+89, corresponding to
scancodes e0 2a / e0 36 - fake LShift / fake RShift.
In "raw" mode these just vanish into thin air.)
On the other hand, the array atkbd_set2_keycode[] can be set
by the user, and then x86_keycodes[] just produces garbage.
In short - raw mode in 2.6 is badly broken.
Andries
(For usb, see usb_kbd_keycode[] in usbkbd.c)
next prev parent reply other threads:[~2005-01-27 12:59 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-27 3:16 Sasa Stevanovic
2005-01-27 4:50 ` Dmitry Torokhov
2005-01-27 10:16 ` Sasa Stevanovic
2005-01-27 12:56 ` Andries Brouwer [this message]
2005-01-28 0:39 ` Roman Zippel
2005-01-28 10:59 ` Vojtech Pavlik
2005-01-29 4:50 ` Al Viro
2005-01-29 11:25 ` Vojtech Pavlik
2005-01-29 23:35 ` Dmitry Torokhov
2005-01-31 9:01 ` Vojtech Pavlik
2005-01-30 8:41 ` Al Viro
2005-01-30 23:21 ` Dmitry Torokhov
2005-01-30 23:29 ` Dmitry Torokhov
2005-02-03 6:54 ` Dmitry Torokhov
2005-01-29 12:11 ` Roman Zippel
2005-01-29 14:04 ` Vojtech Pavlik
2005-01-30 20:13 ` Roman Zippel
2005-01-28 11:10 ` Vojtech Pavlik
2005-01-28 21:59 ` Andries Brouwer
2005-01-29 11:12 ` Vojtech Pavlik
2005-01-29 23:30 ` Dmitry Torokhov
2005-01-30 23:16 ` Pavel Machek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050127125637.GA6010@pclin040.win.tue.nl \
--to=aebr@win.tue.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=mg94c18@alas.matf.bg.ac.yu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®