x86: Handles some bad keyboard data
authorBarret Rhoden <brho@cs.berkeley.edu>
Wed, 2 Apr 2014 00:16:20 +0000 (17:16 -0700)
committerBarret Rhoden <brho@cs.berkeley.edu>
Wed, 2 Apr 2014 00:16:20 +0000 (17:16 -0700)
Some of our boards return 0xff when polling the KB, which isn't a proper scan
code (AFAIK).  Ideally, we'd check that the keyboard being released is a valid
scan code.

kern/arch/x86/console.c

index 31d7aa8..7bb10bf 100644 (file)
@@ -534,6 +534,9 @@ kbd_proc_data(void)
                shift |= E0ESC;
                return 0;
        } else if (data & 0x80) {
+               /* TODO: need a better check for bad key releases */
+               if (data == 0xff)
+                       return -1;
                // Key released
                data = (shift & E0ESC ? data : data & 0x7F);
                shift &= ~(shiftcode[data] | E0ESC);