Done something half sensible if a USB console keyboard is unplugged instead

of panic()ing.
XXX Untested.  I will test it the next time I can borrow an iMac.
This commit is contained in:
augustss 1999-12-01 23:22:57 +00:00
parent b687c3c859
commit 02faf8d588
5 changed files with 40 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ukbd.c,v 1.49 1999/11/26 01:39:27 augustss Exp $ */
/* $NetBSD: ukbd.c,v 1.50 1999/12/01 23:22:57 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -420,6 +420,7 @@ USB_DETACH(ukbd)
DPRINTF(("ukbd_detach: sc=%p flags=%d\n", sc, flags));
if (sc->sc_console_keyboard) {
#if 0
/*
* XXX Should probably disconnect our consops,
* XXX and either notify some other keyboard that
@ -429,6 +430,10 @@ USB_DETACH(ukbd)
* XXX to the system will get it.
*/
panic("ukbd_detach: console keyboard");
#else
wskbd_cndetach();
ukbd_is_console = 1;
#endif
}
/* No need to do reference counting of ukbd, wskbd has all the goo. */
if (sc->sc_wskbddev != NULL)
@ -646,7 +651,7 @@ ukbd_cngetc(v, type, data)
int s;
int c;
DPRINTFN(-1,("ukbd_cngetc: enter\n"));
DPRINTFN(0,("ukbd_cngetc: enter\n"));
s = splusb();
sc->sc_polling = 1;
while(sc->sc_npollchar <= 0)
@ -659,7 +664,7 @@ ukbd_cngetc(v, type, data)
*type = c & RELEASE ? WSCONS_EVENT_KEY_UP : WSCONS_EVENT_KEY_DOWN;
*data = c & CODEMASK;
splx(s);
DPRINTFN(-1,("ukbd_cngetc: return 0x%02x\n", c));
DPRINTFN(0,("ukbd_cngetc: return 0x%02x\n", c));
}
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: wscons_callbacks.h,v 1.10 1999/07/29 18:20:02 augustss Exp $ */
/* $NetBSD: wscons_callbacks.h,v 1.11 1999/12/01 23:22:59 augustss Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@ -49,6 +49,7 @@ void wsdisplay_kbdholdscreen __P((struct device *v, int));
void wsdisplay_set_cons_kbd __P((int (*get)(dev_t),
void (*poll)(dev_t, int)));
void wsdisplay_unset_cons_kbd __P((void));
/*
* Calls to the keyboard interface from the glue code.

View File

@ -1,4 +1,4 @@
/* $NetBSD: wsdisplay.c,v 1.31 1999/10/19 00:03:18 mycroft Exp $ */
/* $NetBSD: wsdisplay.c,v 1.32 1999/12/01 23:22:59 augustss Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@ -33,7 +33,7 @@
static const char _copyright[] __attribute__ ((unused)) =
"Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.";
static const char _rcsid[] __attribute__ ((unused)) =
"$NetBSD: wsdisplay.c,v 1.31 1999/10/19 00:03:18 mycroft Exp $";
"$NetBSD: wsdisplay.c,v 1.32 1999/12/01 23:22:59 augustss Exp $";
#include <sys/param.h>
#include <sys/conf.h>
@ -1712,6 +1712,13 @@ wsdisplay_set_cons_kbd(get, poll)
wsdisplay_cons.cn_pollc = poll;
}
void
wsdisplay_unset_cons_kbd()
{
wsdisplay_cons.cn_getc = wsdisplay_getc_dummy;
wsdisplay_cons.cn_pollc = wsdisplay_pollc_dummy;
}
/*
* Switch the console display to it's first screen.
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: wskbd.c,v 1.32 1999/12/01 11:41:46 augustss Exp $ */
/* $NetBSD: wskbd.c,v 1.33 1999/12/01 23:22:59 augustss Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@ -36,7 +36,7 @@
static const char _copyright[] __attribute__ ((unused)) =
"Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.";
static const char _rcsid[] __attribute__ ((unused)) =
"$NetBSD: wskbd.c,v 1.32 1999/12/01 11:41:46 augustss Exp $";
"$NetBSD: wskbd.c,v 1.33 1999/12/01 23:22:59 augustss Exp $";
/*
* Copyright (c) 1992, 1993
@ -407,7 +407,6 @@ wskbd_cnattach(consops, conscookie, mapdata)
void *conscookie;
const struct wskbd_mapdata *mapdata;
{
KASSERT(!wskbd_console_initted);
wskbd_console_data.t_keymap = mapdata;
@ -422,6 +421,23 @@ wskbd_cnattach(consops, conscookie, mapdata)
wskbd_console_initted = 1;
}
void
wskbd_cndetach()
{
KASSERT(wskbd_console_initted);
wskbd_console_data.t_keymap = 0;
wskbd_console_data.t_consops = 0;
wskbd_console_data.t_consaccesscookie = 0;
#if NWSDISPLAY > 0
wsdisplay_unset_cons_kbd();
#endif
wskbd_console_initted = 0;
}
#if NWSDISPLAY > 0
static void
wskbd_repeat(v)

View File

@ -1,4 +1,4 @@
/* $NetBSD: wskbdvar.h,v 1.7 1999/07/29 18:20:03 augustss Exp $ */
/* $NetBSD: wskbdvar.h,v 1.8 1999/12/01 23:22:59 augustss Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@ -82,6 +82,7 @@ struct wskbddev_attach_args {
*/
void wskbd_cnattach __P((const struct wskbd_consops *, void *,
const struct wskbd_mapdata *));
void wskbd_cndetach __P((void));
int wskbddevprint __P((void *, const char *));
/*