Summary: | USB keyboard with full N-key rollover not working | ||||||
---|---|---|---|---|---|---|---|
Product: | Base System | Reporter: | Andrey Zholos <aaz> | ||||
Component: | usb | Assignee: | freebsd-usb (Nobody) <usb> | ||||
Status: | Closed FIXED | ||||||
Severity: | Affects Only Me | CC: | gonzo, p.mousavizadeh | ||||
Priority: | Normal | ||||||
Version: | 10.0-CURRENT | ||||||
Hardware: | Any | ||||||
OS: | Any | ||||||
See Also: | https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=248365 | ||||||
Attachments: |
|
Description
Andrey Zholos
2013-08-20 12:10:00 UTC
Hi, Have you looked into the USB HID specification from USB.org regarding this? I think USB keyboard stuff is explicitly defined. You are right that we don't support more than a few simultaneously pressed keys, and that would reguire a bit more changes in ukbd driver. Instead of applying a quirk, maybe ukbd.c could switch to boot-proto automatically when HIO_VARIABLE is set? It is simply a so-called USB control request. I'm not sure if it is better to use uhidd or ukbd for the purpose you want to use the keyboard. Thank you for your investigation! --HPS > > Ideally I would like to get this keyboard to work in normal protocol > with full rollover for perfectionist reasons, but I guess that would > require too many changes to ukbd.c and introduce overhead for the > majority of keyboards. > > > > > --- sys/dev/usb/input/ukbd.c (revision 254515) > +++ sys/dev/usb/input/ukbd.c (working copy) > @@ -1130,8 +1130,12 @@ > HID_USAGE2(HUP_KEYBOARD, 0x00), > hid_input, 0, &sc->sc_loc_events, &flags, > &sc->sc_id_events)) { > - sc->sc_flags |= UKBD_FLAG_EVENTS; > - DPRINTFN(1, "Found keyboard events\n"); > + if (flags & HIO_VARIABLE) > + DPRINTFN(1, "Ignoring key bitmap\n"); > + else { > + sc->sc_flags |= UKBD_FLAG_EVENTS; > + DPRINTFN(1, "Found keyboard events\n"); > + } > } > > /* figure out leds on keyboard */ > > Have you looked into the USB HID specification from USB.org regarding > this? I think USB keyboard stuff is explicitly defined. You are right > that we don't support more than a few simultaneously pressed keys, and > that would reguire a bit more changes in ukbd driver. Yes, I looked, it was interesting. I was kind of disappointed afterwards when I realized that the drivers (not just the kernel but uhidd and Linux) supported just a specific subset of the possible descriptors. > Instead of applying a quirk, maybe ukbd.c could switch to boot-proto > automatically when HIO_VARIABLE is set? It is simply a so-called USB > control request. Exactly! That's the point of the patch. The descriptor parser currently assumes that if a keyboard usage range starts at 0, then it must be an array of bytes. It should also make sure that flags doesn't have HIO_VARIABLE (check added by this patch), and maybe that sc_loc_events.size == 8. The actual switch to boot protocol happens at ukbd.c:1241 - not because of a quirk, but be because now, with this additional check, !(sc->sc_flags & UKBD_FLAG_EVENTS). > I'm not sure if it is better to use uhidd or ukbd for the purpose you > want to use the keyboard. Probably uhidd is the best place for full rollover support. It's needed anyway to support the multimedia keys. But currently it makes the same assumptions as ukbd about the events buffer and so doesn't work. Of course, ukbd has to work with the keyboard at least in boot protocol, otherwise you need to use a different keyboard to install uhidd. Author: hselasky Date: Tue Aug 20 16:21:05 2013 New Revision: 254572 URL: http://svnweb.freebsd.org/changeset/base/254572 Log: Force keyboards which don't have the required HID fields to use the USB BOOT protocol for now. PR: usb/181425 Submitted by: Andrey Zholos <aaz@q-fu.com> MFC after: 4 weeks Modified: head/sys/dev/usb/input/ukbd.c Modified: head/sys/dev/usb/input/ukbd.c ============================================================================== --- head/sys/dev/usb/input/ukbd.c Tue Aug 20 14:59:31 2013 (r254571) +++ head/sys/dev/usb/input/ukbd.c Tue Aug 20 16:21:05 2013 (r254572) @@ -1130,8 +1130,12 @@ ukbd_parse_hid(struct ukbd_softc *sc, co HID_USAGE2(HUP_KEYBOARD, 0x00), hid_input, 0, &sc->sc_loc_events, &flags, &sc->sc_id_events)) { - sc->sc_flags |= UKBD_FLAG_EVENTS; - DPRINTFN(1, "Found keyboard events\n"); + if (flags & HIO_VARIABLE) { + DPRINTFN(1, "Ignoring keyboard event control\n"); + } else { + sc->sc_flags |= UKBD_FLAG_EVENTS; + DPRINTFN(1, "Found keyboard event array\n"); + } } /* figure out leds on keyboard */ _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" Author: hselasky Date: Tue Sep 17 12:53:09 2013 New Revision: 255631 URL: http://svnweb.freebsd.org/changeset/base/255631 Log: MFC r254572: Force keyboards which don't have the required HID fields to use the USB BOOT protocol for now. PR: usb/181425 Modified: stable/9/sys/dev/usb/input/ukbd.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/usb/input/ukbd.c ============================================================================== --- stable/9/sys/dev/usb/input/ukbd.c Tue Sep 17 12:50:57 2013 (r255630) +++ stable/9/sys/dev/usb/input/ukbd.c Tue Sep 17 12:53:09 2013 (r255631) @@ -1126,8 +1126,12 @@ ukbd_parse_hid(struct ukbd_softc *sc, co HID_USAGE2(HUP_KEYBOARD, 0x00), hid_input, 0, &sc->sc_loc_events, &flags, &sc->sc_id_events)) { - sc->sc_flags |= UKBD_FLAG_EVENTS; - DPRINTFN(1, "Found keyboard events\n"); + if (flags & HIO_VARIABLE) { + DPRINTFN(1, "Ignoring keyboard event control\n"); + } else { + sc->sc_flags |= UKBD_FLAG_EVENTS; + DPRINTFN(1, "Found keyboard event array\n"); + } } /* figure out leds on keyboard */ _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" Author: hselasky Date: Tue Sep 17 12:58:17 2013 New Revision: 255633 URL: http://svnweb.freebsd.org/changeset/base/255633 Log: MFC r254572: Force keyboards which don't have the required HID fields to use the USB BOOT protocol for now. PR: usb/181425 Modified: stable/8/sys/dev/usb/input/ukbd.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/usb/ (props changed) Modified: stable/8/sys/dev/usb/input/ukbd.c ============================================================================== --- stable/8/sys/dev/usb/input/ukbd.c Tue Sep 17 12:56:37 2013 (r255632) +++ stable/8/sys/dev/usb/input/ukbd.c Tue Sep 17 12:58:17 2013 (r255633) @@ -1118,8 +1118,12 @@ ukbd_parse_hid(struct ukbd_softc *sc, co HID_USAGE2(HUP_KEYBOARD, 0x00), hid_input, 0, &sc->sc_loc_events, &flags, &sc->sc_id_events)) { - sc->sc_flags |= UKBD_FLAG_EVENTS; - DPRINTFN(1, "Found keyboard events\n"); + if (flags & HIO_VARIABLE) { + DPRINTFN(1, "Ignoring keyboard event control\n"); + } else { + sc->sc_flags |= UKBD_FLAG_EVENTS; + DPRINTFN(1, "Found keyboard event array\n"); + } } /* figure out leds on keyboard */ _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" For bugs matching the following criteria: Status: In Progress Changed: (is less than) 2014-06-01 Reset to default assignee and clear in-progress tags. Mail being skipped There is a commit referencing this PR, but it's still not closed and has been inactive for some time. Closing the PR as fixed but feel free to re-open it if the issue hasn't been completely resolved. Thanks I have the same issue on Keychron Q3 and I have to run the command below in order to get it to work: # usbconfig -d X.Y add_quirk UQ_KBD_BOOTPROTO and unplugging and plugging the keyboard back in fixes it. |