summaryrefslogtreecommitdiffstats
path: root/sys/dev/adb/adb_kbd.c
diff options
context:
space:
mode:
authornwhitehorn <nwhitehorn@FreeBSD.org>2008-12-06 23:26:02 +0000
committernwhitehorn <nwhitehorn@FreeBSD.org>2008-12-06 23:26:02 +0000
commite6bc656165feaa55eb1bb3b7ba07f1e02c7e307b (patch)
treec72b76b735b5bc154e27235b50a32c00ae045050 /sys/dev/adb/adb_kbd.c
parenta689f483835ae8389214b38c9fce209311c1a019 (diff)
downloadFreeBSD-src-e6bc656165feaa55eb1bb3b7ba07f1e02c7e307b.zip
FreeBSD-src-e6bc656165feaa55eb1bb3b7ba07f1e02c7e307b.tar.gz
Fix some nasty race conditions in the VIA-CUDA driver that ended up preventing
my right mouse button and keyboard LEDs from working due to mangled configuration packets. Fixed several other races and associated problems in the main ADB stack that were exposed while fixing this.
Diffstat (limited to 'sys/dev/adb/adb_kbd.c')
-rw-r--r--sys/dev/adb/adb_kbd.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/sys/dev/adb/adb_kbd.c b/sys/dev/adb/adb_kbd.c
index db95cfe..115b35d 100644
--- a/sys/dev/adb/adb_kbd.c
+++ b/sys/dev/adb/adb_kbd.c
@@ -271,11 +271,12 @@ adb_kbd_attach(device_t dev)
}
#endif
- adb_set_autopoll(dev,1);
-
- /* Check (asynchronously) if we can read out the LED state from
+ /* Check if we can read out the LED state from
this keyboard by reading the key state register */
- adb_send_packet(dev,ADB_COMMAND_TALK,2,0,NULL);
+ if (adb_read_register(dev, 2, NULL) == 2)
+ sc->have_led_control = 1;
+
+ adb_set_autopoll(dev,1);
return (0);
}
@@ -323,11 +324,6 @@ adb_kbd_receive_packet(device_t dev, u_char status,
if (command != ADB_COMMAND_TALK)
return 0;
- if (reg == 2 && len == 2) {
- sc->have_led_control = 1;
- return 0;
- }
-
if (reg != 0 || len != 2)
return (0);
OpenPOWER on IntegriCloud