patch-2.3.44 linux/drivers/char/pc_keyb.c

Next file: linux/drivers/net/3c505.c
Previous file: linux/drivers/char/mem.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.43/linux/drivers/char/pc_keyb.c linux/drivers/char/pc_keyb.c
@@ -413,9 +413,12 @@
 #endif
 }
 
+static unsigned char kbd_exists = 1;
+
 static inline void handle_keyboard_event(unsigned char scancode)
 {
 #ifdef CONFIG_VT
+	kbd_exists = 1;
 	if (do_acknowledge(scancode))
 		handle_scancode(scancode, !(scancode & 0x80));
 #endif				
@@ -512,8 +515,10 @@
 
 void pckbd_leds(unsigned char leds)
 {
-	if (!send_data(KBD_CMD_SET_LEDS) || !send_data(leds))
-	    send_data(KBD_CMD_ENABLE);	/* re-enable kbd if any errors */
+	if (kbd_exists && (!send_data(KBD_CMD_SET_LEDS) || !send_data(leds))) {
+		send_data(KBD_CMD_ENABLE);	/* re-enable kbd if any errors */
+		kbd_exists = 0;
+	}
 }
 
 /*

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