It's actually impossible to use a USB keyboard to enter ddb(8) on most
of the G3/G4 that come with such keyboard since they have a bluetooth
HID device that attaches as the console keyboard.

I assume this is also the case on various x86 Apple laptops, but I don't
have any hardware to test.

Diff below work around that and let me use my keyboard in DDB. 

ok?

Index: ukbd.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/ukbd.c,v
retrieving revision 1.65
diff -u -p -r1.65 ukbd.c
--- ukbd.c      24 Apr 2014 09:40:28 -0000      1.65
+++ ukbd.c      26 Apr 2014 14:10:09 -0000
@@ -212,6 +212,7 @@ ukbd_attach(struct device *parent, struc
        struct usb_hid_descriptor *hid;
        u_int32_t qflags;
        int dlen, repid;
+       int console = 1;
        void *desc;
        kbd_t layout = (kbd_t)-1;
 
@@ -226,8 +227,16 @@ ukbd_attach(struct device *parent, struc
        sc->sc_hdev.sc_osize = hid_report_size(desc, dlen, hid_output, repid);
        sc->sc_hdev.sc_fsize = hid_report_size(desc, dlen, hid_feature, repid);
 
+        /*
+         * Since the HID-Proxy is always detected before any
+         * real keyboard, do not let it grab the console.
+         */
+       if (uha->uaa->vendor == USB_VENDOR_APPLE &&
+           uha->uaa->product == USB_PRODUCT_APPLE_BLUETOOTH_HCI)
+               console = 0;
+
        qflags = usbd_get_quirks(sc->sc_hdev.sc_udev)->uq_flags;
-       if (hidkbd_attach(self, kbd, 1, qflags, repid, desc, dlen) != 0)
+       if (hidkbd_attach(self, kbd, console, qflags, repid, desc, dlen) != 0)
                return;
 
        if (uha->uaa->vendor == USB_VENDOR_APPLE) {

Reply via email to