Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev Done something half sensible if a USB console keyboa...



details:   https://anonhg.NetBSD.org/src/rev/f2cd521cc79b
branches:  trunk
changeset: 479018:f2cd521cc79b
user:      augustss <augustss%NetBSD.org@localhost>
date:      Wed Dec 01 23:22:57 1999 +0000

description:
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.

diffstat:

 sys/dev/usb/ukbd.c                |  11 ++++++++---
 sys/dev/wscons/wscons_callbacks.h |   3 ++-
 sys/dev/wscons/wsdisplay.c        |  11 +++++++++--
 sys/dev/wscons/wskbd.c            |  22 +++++++++++++++++++---
 sys/dev/wscons/wskbdvar.h         |   3 ++-
 5 files changed, 40 insertions(+), 10 deletions(-)

diffs (162 lines):

diff -r f5de55999b82 -r f2cd521cc79b sys/dev/usb/ukbd.c
--- a/sys/dev/usb/ukbd.c        Wed Dec 01 23:19:11 1999 +0000
+++ b/sys/dev/usb/ukbd.c        Wed Dec 01 23:22:57 1999 +0000
@@ -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 @@
        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 @@
                 * 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 @@
        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 @@
        *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
diff -r f5de55999b82 -r f2cd521cc79b sys/dev/wscons/wscons_callbacks.h
--- a/sys/dev/wscons/wscons_callbacks.h Wed Dec 01 23:19:11 1999 +0000
+++ b/sys/dev/wscons/wscons_callbacks.h Wed Dec 01 23:22:57 1999 +0000
@@ -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_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.
diff -r f5de55999b82 -r f2cd521cc79b sys/dev/wscons/wsdisplay.c
--- a/sys/dev/wscons/wsdisplay.c        Wed Dec 01 23:19:11 1999 +0000
+++ b/sys/dev/wscons/wsdisplay.c        Wed Dec 01 23:22:57 1999 +0000
@@ -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_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.
  */
diff -r f5de55999b82 -r f2cd521cc79b sys/dev/wscons/wskbd.c
--- a/sys/dev/wscons/wskbd.c    Wed Dec 01 23:19:11 1999 +0000
+++ b/sys/dev/wscons/wskbd.c    Wed Dec 01 23:22:57 1999 +0000
@@ -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 @@
        void *conscookie;
        const struct wskbd_mapdata *mapdata;
 {
-
        KASSERT(!wskbd_console_initted);
 
        wskbd_console_data.t_keymap = mapdata;
@@ -422,6 +421,23 @@
        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)
diff -r f5de55999b82 -r f2cd521cc79b sys/dev/wscons/wskbdvar.h
--- a/sys/dev/wscons/wskbdvar.h Wed Dec 01 23:19:11 1999 +0000
+++ b/sys/dev/wscons/wskbdvar.h Wed Dec 01 23:22:57 1999 +0000
@@ -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 @@
  */
 void   wskbd_cnattach __P((const struct wskbd_consops *, void *,
                            const struct wskbd_mapdata *));
+void   wskbd_cndetach __P((void));
 int    wskbddevprint __P((void *, const char *));
 
 /*



Home | Main Index | Thread Index | Old Index