Messages in this thread Patch in this message |  | | | Date | Wed, 29 Mar 2000 15:50:14 -0500 | | From | Brent Verner <> | | Subject | [PATCH] drivers/char/pc_keyb.c 2.2.14 |
| |
hi,
patch for drivers/char/pc_keyb.c to allow the mouse to function (noramlly) after unplugging it and plugging it back in (or using a KVM switch). Basically all it does is check if scancode==170 for the mouse port. If it is, it resets the mouse data buffer, then sends the mouse a reENABLE signal that effectively resets mouse. I've searched for documentation on the ps2 protocol to no avail, so the scancode==170 might not work for _all_ ps2 mice, but I've tested with 2 different logitech and one MS mouse. FWIW, the keyboard I have sends the same signal on reconnect. If this patch won't work for you (or if it is completely braindead:), please let me know.
cheers. brent ================================================================== --- 2.2.14/drivers/char/pc_keyb.c Mon Aug 9 15:04:39 1999 +++ linux/drivers/char/pc_keyb.c Wed Mar 29 15:29:47 2000 @@ -56,6 +56,7 @@ static void kbd_write_command_w(int data); static void kbd_write_output_w(int data); +static void aux_write_ack(int val); spinlock_t kbd_controller_lock = SPIN_LOCK_UNLOCKED; static unsigned char handle_kbd_event(void); @@ -73,6 +74,8 @@ static int __init psaux_init(void); +#define AUX_RECONNECT 170 /* scancode when ps2 device is plugged (back) in */ + static struct aux_queue *queue; /* Mouse data buffer. */ static int aux_count = 0; /* used when we send commands to the mouse that expect an ACK. */ @@ -392,6 +395,11 @@ return; } mouse_reply_expected = 0; + } + else if(scancode == AUX_RECONNECT){ + queue->head = queue->tail = 0; /* Flush input queue */ + aux_write_ack(AUX_ENABLE_DEV); /* ping the mouse :) */ + return; } add_mouse_randomness(scancode); - 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/
|  |