patch-2.3.99-pre6 linux/drivers/char/pc_keyb.c

Next file: linux/drivers/char/planb.c
Previous file: linux/drivers/char/nvram.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.99-pre5/linux/drivers/char/pc_keyb.c linux/drivers/char/pc_keyb.c
@@ -59,6 +59,9 @@
 
 static void kbd_write_command_w(int data);
 static void kbd_write_output_w(int data);
+#ifdef CONFIG_PSMOUSE
+static void aux_write_ack(int val);
+#endif
 
 spinlock_t kbd_controller_lock = SPIN_LOCK_UNLOCKED;
 static unsigned char handle_kbd_event(void);
@@ -76,6 +79,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. */
@@ -396,6 +401,11 @@
 		}
 		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);
 	if (aux_count) {
@@ -964,6 +974,7 @@
 	return retval;
 }
 
+/* No kernel lock held - fine */
 static unsigned int aux_poll(struct file *file, poll_table * wait)
 {
 	poll_wait(file, &queue->proc_list, wait);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)