lkml.org 
[lkml]   [2003]   [Jul]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Subjectkeyboard.c fix in 2.4.21 breaks my (buggy?) keyboard
From
Hello linux-kernel,

patch-2.4.21 contains the following patch to keyboard.c:

diff -urN linux-2.4.20/drivers/char/keyboard.c linux-2.4.21/drivers/char/keyboard.c
--- linux-2.4.20/drivers/char/keyboard.c 2002-08-02 17:39:43.000000000 -0700
+++ linux-2.4.21/drivers/char/keyboard.c 2003-06-13 07:51:33.000000000 -0700
@@ -213,7 +215,17 @@
}
kbd = kbd_table + fg_console;
if ((raw_mode = (kbd->kbdmode == VC_RAW))) {
- put_queue(scancode | up_flag);
+ /*
+ * The following is a workaround for hardware
+ * which sometimes send the key release event twice
+ */
+ unsigned char next_scancode = scancode|up_flag;
+ if (up_flag && next_scancode==prev_scancode) {
+ /* unexpected 2nd release event */
+ } else {
+ prev_scancode=next_scancode;
+ put_queue(next_scancode);
+ }
/* we do not return yet, because we want to maintain
the key_down array, so that we have the correct
values when finishing RAW mode or when changing VT's */

But apparently, there is not only hardware that sends the key release
event twice, but also hardware that sends the key press event twice
in certain circumstances.

I've got a keyboard ("Unikey model KWD-205"), which, for the left
control key (and apparently only for this key) sends the key down
event twice, followed by two key up events. For certain applications
using VC_RAW (most important XFree86), this means that the ctrl
key gets "stuck" once it's been pressed.


I don't know an "appropriate" fix to this problem. Obviously, the
patch got inserted in 2.4.21 because it fixes broken keyboards
owned by many people. As I didn't find any reports about my
problem with google, it seems that keyboards like my one are
quite rare. One possible solution would be to ignore any events
where next_scancode==prev_scancode, regardless of up_flag - but
this breaks autorepeat, which then would maybe need to be
emulated.

Another possible fix would be to only ignore multiple identical
"up" events for non-modifier keys, but this would require
keyboard.c to have a list of key symbols of keys like "control",
"shift" etc.


So, are there other people having the same problem? Is it worth
to find a "good" fix for the linux kernel, or should I just
remove this patch by hand every time I compile a new kernel,
until my keyboard dies and I get a non-broken one? ;-)

--
Andreas Trottmann
Ideen Werft22 GmbH
Tel +41 (0)56 210 91 37
Fax +41 (0)56 210 91 34
Mobile +41 (0)79 229 88 55
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:46    [W:1.236 / U:0.876 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site