summaryrefslogtreecommitdiffstats
path: root/sys/dev/atkbdc
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2006-10-25 13:35:42 +0000
committerru <ru@FreeBSD.org>2006-10-25 13:35:42 +0000
commitc772b06e557b616874e790cea6ab7d4535465dd1 (patch)
tree296a2115ccf9e018098a24e5f2dd673d14359843 /sys/dev/atkbdc
parent430a6e6576cc4abbcefaee329020a14292da5b35 (diff)
downloadFreeBSD-src-c772b06e557b616874e790cea6ab7d4535465dd1.zip
FreeBSD-src-c772b06e557b616874e790cea6ab7d4535465dd1.tar.gz
Fix LEDs not working when atkbd is an active keyboard and the physical
keyboard is attached only after the system has already booted. If USB keyboard is also present, and there's no kbdmux(4), the problem has been hiding itself because as soon as we get to multi-user, the USB keyboard becomes an active keyboard (see devd.conf), thus marking atkbd inactive and letting the old code initialize the keyboard. With kbdmux(4), or if there's no USB keyboard, the atkbd keyboard is always active, whether it's physically attached or not, thus it never initialized itself properly on a physical attach. To fix this, move block that initialized the keyboard on attach upper so it doesn't depend on the (KBD_IS_ACTIVE(kbd) && KBD_IS_BUSY(kbd)) condition. Also move KBD_FOUND_DEVICE() a few lines upper so that KDSETLED and KDSETREPEAT that follow it propagate to the controller. MFC after: 3 days
Diffstat (limited to 'sys/dev/atkbdc')
-rw-r--r--sys/dev/atkbdc/atkbd.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/sys/dev/atkbdc/atkbd.c b/sys/dev/atkbdc/atkbd.c
index 76f2184..778515e 100644
--- a/sys/dev/atkbdc/atkbd.c
+++ b/sys/dev/atkbdc/atkbd.c
@@ -480,6 +480,22 @@ atkbd_intr(keyboard_t *kbd, void *arg)
int delay[2];
int c;
+ if (!KBD_HAS_DEVICE(kbd)) {
+ /*
+ * The keyboard was not detected before;
+ * it must have been reconnected!
+ */
+ state = (atkbd_state_t *)kbd->kb_data;
+ init_keyboard(state->kbdc, &kbd->kb_type,
+ kbd->kb_config);
+ KBD_FOUND_DEVICE(kbd);
+ atkbd_ioctl(kbd, KDSETLED, (caddr_t)&state->ks_state);
+ get_typematic(kbd);
+ delay[0] = kbd->kb_delay1;
+ delay[1] = kbd->kb_delay2;
+ atkbd_ioctl(kbd, KDSETREPEAT, (caddr_t)delay);
+ }
+
if (KBD_IS_ACTIVE(kbd) && KBD_IS_BUSY(kbd)) {
/* let the callback function to process the input */
(*kbd->kb_callback.kc_func)(kbd, KBDIO_KEYINPUT,
@@ -489,22 +505,6 @@ atkbd_intr(keyboard_t *kbd, void *arg)
do {
c = atkbd_read_char(kbd, FALSE);
} while (c != NOKEY);
-
- if (!KBD_HAS_DEVICE(kbd)) {
- /*
- * The keyboard was not detected before;
- * it must have been reconnected!
- */
- state = (atkbd_state_t *)kbd->kb_data;
- init_keyboard(state->kbdc, &kbd->kb_type,
- kbd->kb_config);
- atkbd_ioctl(kbd, KDSETLED, (caddr_t)&state->ks_state);
- get_typematic(kbd);
- delay[0] = kbd->kb_delay1;
- delay[1] = kbd->kb_delay2;
- atkbd_ioctl(kbd, KDSETREPEAT, (caddr_t)delay);
- KBD_FOUND_DEVICE(kbd);
- }
}
return 0;
}
OpenPOWER on IntegriCloud