Re: keyboard problem, again

Andrei Pitis (pink@roedu.net)
Sat, 4 Dec 1999 07:44:14 +0200 (EET)


On Thu, 2 December 1999, Pavel Machek wrote:
> That is bug. It is hardware problem common accross toshiba notebooks.
> Linus: it would be nice to have this workaround to common toshiba
> bug.
I have done some more tests today and got to the conclusion that the
kbd delay for this kbd varies from 210 to 250 ms (when set to 250ms).
I also noticed that I double some keys some time, even with my 200ms
fix. Well, IMHO this is due to the fact that I am too accustomed with
_normal_ 250ms kbd delays - that I sometimes rest my fingers on a key
for a time close to 250ms - therefore getting another interrupt.

I see you changed the delay from 200 ms to 100 ms. Well, I was just
about to propose to change the delay, too, but to 250ms rather than to
100 ms :-)

For arrow keys: they are sending two MAKEs and the corresponding two
BREAKs, but these are all different - this patch does not interfere.

This patch might break smth only if there is an imaginable
scancode-sequence in which two consecutive occurences have the same
scancode and are closer than 250ms. I cannot think of such a case,
but I can only think in terms of PC hardware, I don't know about
others...

So the patch might look like:

--- clean/drivers/char/keyboard.c Mon Nov 15 22:12:40 1999
+++ linux/drivers/char/keyboard.c Thu Dec 2 11:17:27 1999
@@ -204,6 +210,33 @@
char up_flag = down ? 0 : 0200;
char raw_mode;

+ /*
+ * Begin patch for Toshiba Satellite 2595XDVD. Under some
+ * circumstances, its keyboards behaves like ignoring the
+ * kbd repeat delay. This happens in conjunction with shift
+ * keys (ctrl, alt, shift) and leads to undesirable repeat
+ * of a key even if pressed briefly. Fix it by ignoring any
+ * subsequent occurence of the second identical scancode for
+ * 250 ms. IMO, this doesn't break anything on a good keyboard.
+ *
+ * Andrei Pitis <pink@roedu.net>, Nov 1999
+ */
+ static int prev_scancode = 0;
+ static int stop_jiffies = 0;
+
+ /* new scancode, trigger delay */
+ if (scancode != prev_scancode)
+ stop_jiffies = jiffies;
+
+ /* same scancode, accept only after the delay */
+ else if (jiffies - stop_jiffies >= 25)
+ stop_jiffies = 0;
+
+ /* glitch! bail out... */
+ else
+ return;
+
+ prev_scancode = scancode;
+ /* End Toshiba patch. */
+
acpi_access(acpi_kbd);

do_poke_blanked_console = 1;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/