mirror of
https://git.FreeBSD.org/src.git
synced 2026-06-02 11:24:32 +00:00
ukbd: fix SET_REPORT wValue always using report ID 0 for LED output
ukbd_set_leds_callback() built the SET_REPORT control request with USETW2(req.wValue, UHID_OUTPUT_REPORT, 0) before the loop that determines the actual HID report ID from sc_id_numlock, sc_id_scrolllock, or sc_id_capslock. The data payload was already correctly prefixed with the real report ID when id != 0, but the control request's wValue told the device to set report ID 0, which does not exist on devices that use non-zero report IDs for LED output. Apple Internal Keyboard / Trackpad (0x05ac:0x0274) uses report ID 1 for LED output. The mismatch caused the device to STALL every SET_REPORT request, so the capslock LED could never be updated. Move the USETW2 call to after the LED-detection loop so that wValue carries the correct report ID. Signed-off-by: Joshua Rogers <Joshua@Joshua.Hu> Reviewed by: wulf MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/2210
This commit is contained in:
committed by
Vladimir Kondratyev
parent
b53eab3229
commit
8809ea46f1
@@ -957,13 +957,6 @@ ukbd_set_leds_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
break;
|
||||
sc->sc_flags &= ~UKBD_FLAG_SET_LEDS;
|
||||
|
||||
req.bmRequestType = UT_WRITE_CLASS_INTERFACE;
|
||||
req.bRequest = UR_SET_REPORT;
|
||||
USETW2(req.wValue, UHID_OUTPUT_REPORT, 0);
|
||||
req.wIndex[0] = sc->sc_iface_no;
|
||||
req.wIndex[1] = 0;
|
||||
req.wLength[1] = 0;
|
||||
|
||||
memset(sc->sc_buffer, 0, UKBD_BUFFER_SIZE);
|
||||
|
||||
id = 0;
|
||||
@@ -1017,11 +1010,18 @@ ukbd_set_leds_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
} else {
|
||||
usbd_copy_in(pc, 0, sc->sc_buffer + 1, len);
|
||||
}
|
||||
req.wLength[0] = len;
|
||||
usbd_xfer_set_frame_len(xfer, 1, len);
|
||||
|
||||
DPRINTF("len=%d, id=%d\n", len, id);
|
||||
|
||||
req.bmRequestType = UT_WRITE_CLASS_INTERFACE;
|
||||
req.bRequest = UR_SET_REPORT;
|
||||
USETW2(req.wValue, UHID_OUTPUT_REPORT, id);
|
||||
req.wIndex[0] = sc->sc_iface_no;
|
||||
req.wIndex[1] = 0;
|
||||
req.wLength[0] = len;
|
||||
req.wLength[1] = 0;
|
||||
|
||||
/* setup control request last */
|
||||
pc = usbd_xfer_get_frame(xfer, 0);
|
||||
usbd_copy_in(pc, 0, &req, sizeof(req));
|
||||
|
||||
Reference in New Issue
Block a user