"Disable Trackpad while typing" on Notebooks withh a PS/2 Trackpad
Quoted 6 lines · Hans-Georg Thien
The short story
---------------
The trackpad on the MacIntosh iBook Notebooks have a feature that prevents unintended trackpad input while typing on the keyboard. There are no mouse-moves or mouse-taps for a short period of time after each keystroke.
Very nice. In fact I wanted something like this for my ibook for a long time.
But it won't work on an ibook of course because it doesn't use the pc_keyb driver. Instead it uses the Input layer for the adb device. In fact in 2.5 there is only the input layer for everything including PC keyboards. It should be probably moved there too.
One suggestion: don't make it a CONFIG_*. Recompiling a kernel to change things like that is not good. Make it an ioctl that can be configured at runtime.
Another one: the disable_trackpad_timer_while_typing variable is not really needed. You can manage all state by checking the timer with timer_pending()
-Andi
Quoted 6 lines · Hans-Georg Thien
The short story
---------------
Apple MacIntosh iBook Notebooks computers have a nice feature that prevents unintended trackpad input while typing on the keyboard. There are no mouse-moves or mouse-taps for a short period of time after each keystroke. I wanted to have this feature on my i386 notebook ...
I have eliminated the use of a timer. The patch has been simple before, and now it is even more simple :)
usr/src/linux/Documentation/Configure.help renamed from usr/src/linux-2.4.20/Documentation/Configure.help +10 -0
@@ -17752,6 +17752,16 @@ <ftp://gnu.systemy.it/pub/gpm/>) solves this problem, or you can get the "mconv2" utility from <ftp://ibiblio.org/pub/Linux/system/mouse/>. +Disable trackpad while typing +CONFIG_DISABLE_TRACKPAD_WHILE_TYPING + For people with a notebook that have a build in PS/2 trackpad. + + It prevents unintended mouse moves and mouse taps while typing on + the notebook keyboard. + + The majority of notebooks on the market have a PS/2 trackpad. + So you will probably say "Y" if you have a notebook with a trackpad. + C&T 82C710 mouse port support (as on TI Travelmate) CONFIG_82C710_MOUSE This is a certain kind of PS/2 mouse used on the TI Travelmate. If
usr/src/linux/drivers/char/Config.in renamed from usr/src/linux-2.4.20/drivers/char/Config.in +7 -0
@@ -170,6 +170,13 @@ tristate 'Mouse Support (not serial and bus mice)' CONFIG_MOUSE if [ "$CONFIG_MOUSE" != "n" ]; then bool ' PS/2 mouse (aka "auxiliary device") support' CONFIG_PSMOUSE + + if [ "$CONFIG_PSMOUSE" = "y" ] + then + bool ' Disable Trackpad while typing on Notebooks' CONFIG_DISABLE_TRACKPAD_WHILE_TYPING + fi + + tristate ' C&T 82C710 mouse port support (as on TI Travelmate)'
CONFIG_82C710_MOUSE
tristate ' PC110 digitizer pad support' CONFIG_PC110_PAD tristate ' MK712 touch screen support' CONFIG_MK712_MOUSE
usr/src/linux/drivers/char/pc_keyb.c renamed from usr/src/linux-2.4.20/drivers/char/pc_keyb.c +22 -0
@@ -13,6 +13,11 @@* Code fixes to handle mouse ACKs properly. * C. Scott Ananian <[email protected]> 1999-01-29. * +* Implemented the "disable trackpad while typing" feature. This prevents +* unintended mouse moves and mouse taps while typing on the keyboard on +* notebooks with a PS/2 trackpad. +* Hans-Georg Thien <[email protected]> 2003-04-30. +* */ #include <linux/config.h>
@@ -67,6 +72,11 @@static void aux_write_ack (int val);static void __aux_write_ack (int val);static int aux_reconnect =0 ; + +#ifdef CONFIG_DISABLE_TRACKPAD_WHILE_TYPING +static int last_kbd_event =0 ;/* used to hold timestamp of last kbd event */ +#endif +#endif #ifndef kbd_controller_present
@@ -430,6 +440,7 @@ } +static inline void handle_mouse_event (unsigned char scancode) {#ifdef CONFIG_PSMOUSE
@@ -449,6 +460,11 @@return ; } +#ifdef CONFIG_DISABLE_TRACKPAD_WHILE_TYPING +/* do nothing if time since last kbd event is less then 1Sec */ +if (abs (jiffies - last_kbd_event) <HZ )return ; +#endif + prev_code = scancode;add_mouse_randomness (scancode);if (aux_count) {
@@ -467,8 +483,14 @@static unsigned char kbd_exists =1 ; +static inline void handle_keyboard_event (unsigned char scancode) { + +#ifdef CONFIG_DISABLE_TRACKPAD_WHILE_TYPING + last_kbd_event = jiffies; +#endif +#ifdef CONFIG_VT kbd_exists =1 ;if (do_acknowledge (scancode))
Quoted 2 lines
I have eliminated the use of a timer. The patch has been simple before, and now it is even more simple :)
It's pretty good, but I disagree with gratious whitespaces like these:
Review line 446
Quoted 8 lines
(quoted diff) +1
-0@@ -430,6 +440,7 @@ } + static inline void handle_mouse_event(unsigned char scancode) { #ifdef CONFIG_PSMOUSE
-- Pete
Hans-Georg Thien, Tue, May 06, 2003 00:48:13 +0200:
Quoted 13 lines
Quoted 6 lines · Hans-Georg Thien
The short story
---------------
Apple MacIntosh iBook Notebooks computers have a nice feature that prevents unintended trackpad input while typing on the keyboard. There are no mouse-moves or mouse-taps for a short period of time after each keystroke. I wanted to have this feature on my i386 notebook ...I have eliminated the use of a timer. The patch has been simple before, and now it is even more simple :)
Quoted 7 lines
diff -urN -X
/tmp/dontdiff/usr/src/linux-2.4.20/Documentation/Configure.help/usr/src/linux/Documentation/Configure.help
---/usr/src/linux-2.4.20/Documentation/Configure.helpFri Nov 29
00:53:08 2002
+++/usr/src/linux/Documentation/Configure.helpThu May 1 02:12:04
2003
Very needed thing, thanks a lot.
But could you please be more careful with these line wraps? One have to apply your patch per hand.