Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
diff -ur -x .config kernel-source-2.2.16.orig/drivers/char/Config.in kernel-source-2.2.16/drivers/char/Config.in --- kernel-source-2.2.16.orig/drivers/char/Config.in Thu Jul 20 13:27:04 2000 +++ kernel-source-2.2.16/drivers/char/Config.in Thu Jul 20 15:00:11 2000 @@ -121,6 +121,14 @@ bool 'Tadpole ANA H8 Support' CONFIG_H8 fi +if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then + bool 'Keyboard Chattering Reduction(EXPERIMENTAL)' CONFIG_CHATTERING_REDUCTION + if [ "$CONFIG_CHATTERING_REDUCTION" = "y" ]; then + int ' First chattering interval(usec)' CONFIG_CHATTERING_INTERVAL 30000 + bool ' Write chattering info into syslog' CONFIG_CHATTERING_REDUCTION_LOG + fi +fi + mainmenu_option next_comment comment 'Video For Linux' diff -ur -x .config kernel-source-2.2.16.orig/drivers/char/keyboard.c kernel-source-2.2.16/drivers/char/keyboard.c --- kernel-source-2.2.16.orig/drivers/char/keyboard.c Thu Jul 20 13:27:04 2000 +++ kernel-source-2.2.16/drivers/char/keyboard.c Thu Jul 20 14:59:31 2000 @@ -21,6 +21,7 @@ * * 27-05-97: Added support for the Magic SysRq Key (Martin Mares) * 30-07-98: Dead keys redone, aeb@cwi.nl. + * 16-02-00: Added keyboard chattering reduction (Tatsuhiro Nishioka) */ #include @@ -194,11 +195,80 @@ return kbd_getkeycode(scancode); } +#ifdef CONFIG_CHATTERING_REDUCTION +/* + * old version of description + * get time interval between 2 key events to reduce + * annoying keyboard chattering + * CONFIG_CHATTERING_INTERVAL gives the max delay(usec) to decide + * if the key is unexpectedly down + * + * new version of description + * Some TOSHIBA laptops such as SS3380 has keyboard + * chattering problem. + * The debug output of this function says several key down + * signals are is unexpectedly sent by the keyboards. + * There's no key-up signals sent while key chattering. + * So I bet that cutting off these continuous key-signals + * that has same scancode and up/down state. + */ +int chattering_filter(unsigned char scancode, int down) +{ + static unsigned char chatter_code=0; + static unsigned char prev_code=0; + static int prev_down=-1; + static struct timeval prev_time={0,0}; + struct timeval cur_time; + long interval=0; + + do_gettimeofday(&cur_time); + interval = ((cur_time.tv_sec * 1000000 + cur_time.tv_usec) - + (prev_time.tv_sec * 1000000 + prev_time.tv_usec)); + + if (chatter_code == scancode && prev_down == down) { +#ifdef CONFIG_CHATTERING_REDUCTION_LOG + unsigned char keycode = 0; + kbd_translate(scancode, &keycode, 0); + printk(KERN_INFO "KEYBOARD chattering ocurred." + " key_code=%02x, down=%d, interval=%lu (usec)\n", + keycode, down, interval); +#endif + prev_time = cur_time; + return 0; + } + + if (prev_code == scancode && interval <= CONFIG_CHATTERING_INTERVAL) { +#ifdef CONFIG_CHATTERING_REDUCTION_LOG + unsigned char keycode = 0; + kbd_translate(scancode, &keycode, 0); + printk(KERN_INFO "keyboard chattering ocurred." + " key_code=%02x, down=%d, interval=%lu (usec)\n", + keycode, down, interval); +#endif + prev_time = cur_time; + chatter_code = scancode; + prev_down = down; + return 0; + } + + chatter_code = 0; + prev_time = cur_time; + prev_code = scancode; + prev_down = down; + return 1; +} +#endif + void handle_scancode(unsigned char scancode, int down) { unsigned char keycode; char up_flag = down ? 0 : 0200; char raw_mode; + +#ifdef CONFIG_CHATTERING_REDUCTION + if (!chattering_filter(scancode, down)) + return; +#endif do_poke_blanked_console = 1; mark_bh(CONSOLE_BH);