From: Chris Heath <chris@heathens.co.nz>
To: Ralf.Hildebrandt@charite.de
Cc: linux-kernel@vger.kernel.org
Subject: Re: 2.6.0-test1-ac2 issues / Toshiba Laptop keyboard
Date: Sat, 19 Jul 2003 09:18:28 -0400 [thread overview]
Message-ID: <20030719090538.9EC5.CHRIS@heathens.co.nz> (raw)
In-Reply-To: <20030718064444.GF6429@charite.de>
> The patch that fixed the issue with the key release events was this -
> I submitted it to Alan who then put it into ac and then it went into
> 2.4.x...
>
> Details: http://www.informatik.uni-freiburg.de/~leibl/lol/
>
> Patch excerpt:
>
> + /* The following 'if' 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);
> + }
>
> I haven't checked if 2.6.0 already has this!
This patch went into 2.4.21, and we immediately got a bug report!
See http://www.ussg.iu.edu/hypermail/linux/kernel/0306.1/1871.html
I wrote another patch (better, I hope), which is now in 2.4.22-pre6-ac1.
It is included below. I would appreciate it if it got some testing on
both Toshiba laptops and other machines.
I am also interested in helping fix it in 2.6, but let's see if the fix
for 2.4 works first.
Chris
--- a/drivers/char/keyboard.c 2003-07-07 21:03:44.000000000 -0400
+++ b/drivers/char/keyboard.c 2003-07-08 23:07:47.000000000 -0400
@@ -198,6 +198,7 @@
unsigned char keycode;
char up_flag = down ? 0 : 0200;
char raw_mode;
+ char have_keycode;
pm_access(pm_kbd);
add_keyboard_randomness(scancode | up_flag);
@@ -214,16 +215,30 @@
tty = NULL;
}
kbd = kbd_table + fg_console;
- if ((raw_mode = (kbd->kbdmode == VC_RAW))) {
+ /*
+ * Convert scancode to keycode
+ */
+ raw_mode = (kbd->kbdmode == VC_RAW);
+ have_keycode = kbd_translate(scancode, &keycode, raw_mode);
+ if (raw_mode) {
/*
* 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) {
+ if (have_keycode && up_flag && next_scancode==prev_scancode) {
/* unexpected 2nd release event */
} else {
- prev_scancode=next_scancode;
+ /*
+ * Only save previous scancode if it was a key-up
+ * and had a single-byte scancode.
+ */
+ if (!have_keycode)
+ prev_scancode = 1;
+ else if (!up_flag || prev_scancode == 1)
+ prev_scancode = 0;
+ else
+ prev_scancode = next_scancode;
put_queue(next_scancode);
}
/* we do not return yet, because we want to maintain
@@ -231,10 +246,7 @@
values when finishing RAW mode or when changing VT's */
}
- /*
- * Convert scancode to keycode
- */
- if (!kbd_translate(scancode, &keycode, raw_mode))
+ if (!have_keycode)
goto out;
/*
next prev parent reply other threads:[~2003-07-19 13:03 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-17 14:18 2.6.0-test1-ac2 issues / Toshiba Laptop keyboard Ralf Hildebrandt
2003-07-17 14:33 ` Michael Kristensen
2003-07-17 14:36 ` Ralf Hildebrandt
2003-07-17 14:38 ` Alan Cox
2003-07-17 14:45 ` Ralf Hildebrandt
2003-07-17 18:24 ` Alvaro Lopes
2003-07-17 20:09 ` Ralf Hildebrandt
2003-07-17 18:15 ` James H. Cloos Jr.
2003-07-17 20:10 ` Ralf Hildebrandt
2003-07-17 20:40 ` Dumitru Ciobarcianu
2003-07-18 6:36 ` Ralf Hildebrandt
2003-07-18 12:45 ` Alvaro Lopes
2003-07-18 13:49 ` Ralf Hildebrandt
2003-07-17 21:18 ` James H. Cloos Jr.
2003-07-18 6:44 ` Ralf Hildebrandt
2003-07-19 13:18 ` Chris Heath [this message]
2003-07-17 20:55 Grover, Andrew
2003-07-18 12:43 ` Alvaro Lopes
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=20030719090538.9EC5.CHRIS@heathens.co.nz \
--to=chris@heathens.co.nz \
--cc=Ralf.Hildebrandt@charite.de \
--cc=linux-kernel@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).