diff options
author | yokota <yokota@FreeBSD.org> | 1999-01-14 03:17:32 +0000 |
---|---|---|
committer | yokota <yokota@FreeBSD.org> | 1999-01-14 03:17:32 +0000 |
commit | ae17a9c668b2bf0a5b4603d66dccae88d98df959 (patch) | |
tree | 2214d069a9a077396d394d65c4f45676f20fc62e /sys/i386/isa | |
parent | 1f25259af5cdfd3db005fa20e7bac96dcc9b4154 (diff) | |
download | FreeBSD-src-ae17a9c668b2bf0a5b4603d66dccae88d98df959.zip FreeBSD-src-ae17a9c668b2bf0a5b4603d66dccae88d98df959.tar.gz |
Fix various breakage after the recent keyboard driver change.
- Don't try to set typematic rate if there is not a keyboard.
- Fix wrong test on error code.
- Don't try to claim the keyboard twice. The second call will fail.
Diffstat (limited to 'sys/i386/isa')
-rw-r--r-- | sys/i386/isa/pcvt/pcvt_drv.c | 24 | ||||
-rw-r--r-- | sys/i386/isa/pcvt/pcvt_kbd.c | 5 |
2 files changed, 15 insertions, 14 deletions
diff --git a/sys/i386/isa/pcvt/pcvt_drv.c b/sys/i386/isa/pcvt/pcvt_drv.c index c4ed5a1..cb557e1 100644 --- a/sys/i386/isa/pcvt/pcvt_drv.c +++ b/sys/i386/isa/pcvt/pcvt_drv.c @@ -169,13 +169,12 @@ pcprobe(struct isa_device *dev) #ifdef _DEV_KBD_KBDREG_H_ int i; - kbd = NULL; - kbd_configure(KB_CONF_PROBE_ONLY); - i = kbd_allocate("*", -1, (void *)&kbd, pcevent, (void *)dev->id_unit); - if ((i < 0) || ((kbd = kbd_get_keyboard(i)) == NULL)) - { + if (kbd == NULL) { reset_keyboard = 0; - return (-1); + kbd_configure(KB_CONF_PROBE_ONLY); + i = kbd_allocate("*", -1, (void *)&kbd, pcevent, (void *)dev->id_unit); + if ((i < 0) || ((kbd = kbd_get_keyboard(i)) == NULL)) + return (-1); } reset_keyboard = 1; /* it's now safe to do kbd reset */ #endif /* _DEV_KBD_KBDREG_H_ */ @@ -898,6 +897,7 @@ pcevent(keyboard_t *thiskbd, int event, void *arg) pcrint(unit); return 0; case KBDIO_UNLOADING: + reset_keyboard = 0; kbd = NULL; kbd_release(thiskbd, (void *)&kbd); timeout(detect_kbd, (void *)unit, hz*4); @@ -1182,17 +1182,17 @@ pccnprobe(struct consdev *cp) } #ifdef _DEV_KBD_KBDREG_H_ - kbd = NULL; - kbd_configure(KB_CONF_PROBE_ONLY); - i = kbd_allocate("*", -1, (void *)&kbd, pcevent, (void *)dvp->id_unit); - if (i >= 0) - kbd = kbd_get_keyboard(i); - /* * Don't reset the keyboard via `kbdio' just yet. * The system clock has not been calibrated... */ reset_keyboard = 0; + if (kbd == NULL) { + kbd_configure(KB_CONF_PROBE_ONLY); + i = kbd_allocate("*", -1, (void *)&kbd, pcevent, (void *)dvp->id_unit); + if (i >= 0) + kbd = kbd_get_keyboard(i); + } #if PCVT_SCANSET == 2 /* diff --git a/sys/i386/isa/pcvt/pcvt_kbd.c b/sys/i386/isa/pcvt/pcvt_kbd.c index c7a2cfc..50457dc 100644 --- a/sys/i386/isa/pcvt/pcvt_kbd.c +++ b/sys/i386/isa/pcvt/pcvt_kbd.c @@ -346,9 +346,10 @@ settpmrate(int rate) else if(kbd_cmd(tpmrate) != 0) printf("Keyboard TYPEMATIC data timeout\n"); #else + if (kbd == NULL) + return; tpmrate = rate & 0x7f; - if ((*kbdsw[kbd->kb_index]->ioctl)(kbd, KDSETRAD, - (caddr_t)&tpmrate) == 0) + if ((*kbdsw[kbd->kb_index]->ioctl)(kbd, KDSETRAD, (caddr_t)&tpmrate)) printf("pcvt: failed to set keyboard TYPEMATIC.\n"); #endif /* !_DEV_KBD_KBDREG_H_ */ } |