lkml.org 
[lkml]   [1999]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectToshiba kbd patch

Hi Linus,

Here is my latest version of the patch for fixing bad Toshiba notebook
keyboards - making sure the PC keyboard delay is at least 250ms, which
seems to be a good thing for others with broken keyboards.

Please include it in the kernel, if possible. I will work further to
improve it (add logging, test it, etc) - I will keep you posted, but I
would like to have it in the dev kernel so others can test it as well.

Thanks,
Andrei Pitis


--- linux-2.3.39/drivers/char/pc_keyb.c Tue Dec 7 01:10:31 1999
+++ pc_keyb.c Tue Dec 7 01:12:46 1999
@@ -413,6 +413,58 @@
}

/*
+ * Made initially 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. Fixed it by ignoring any
+ * subsequent occurence of the second identical scancode for
+ * 250 ms. Takes into account keys with 0xE0, doesn't care about
+ * the Break key. IMO, this doesn't break anything on a good keyboard,
+ * only enforces the kbd delay to be 250ms.
+ * Andrei Pitis <pink@roedu.net> Dec 1999
+ */
+static void handle_delay(unsigned char scancode)
+{
+ static int E0_detected = 0;
+ static int prev_scancode = 0;
+ static int stop_jiffies = 0;
+
+ /* Silently ignore the E0 prefix, will take care
+ of it in the next call. */
+ if (scancode == 0xE0)
+ {
+ E0_detected = 1;
+ return;
+ }
+
+ /* New scancode, trigger delay and update prev_scancode. */
+ if (scancode != prev_scancode)
+ {
+ prev_scancode = scancode;
+ stop_jiffies = jiffies;
+ }
+ /* Same scancode, reject if within delay, reset E0 detection. */
+ else if (jiffies - stop_jiffies < 25)
+ {
+ E0_detected = 0;
+ return;
+ }
+
+ /* Handle the scancode if different from the previous one, or
+ if the same, but after the delay passed. Don't forget
+ the E0 prefix, if it was detected. */
+ if (E0_detected)
+ {
+ handle_scancode(0xE0, 0);
+ E0_detected = 0;
+ }
+
+ handle_scancode(scancode, !(scancode & 0x80));
+}
+
+
+/*
* This reads the keyboard status port, and does the
* appropriate action.
*
@@ -433,7 +485,7 @@
} else {
#ifdef CONFIG_VT
if (do_acknowledge(scancode))
- handle_scancode(scancode, !(scancode & 0x80));
+ handle_delay(scancode);
#endif
mark_bh(KEYBOARD_BH);
}

-
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/

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