Skip to content

ukbd: fix SET_REPORT wValue always using report ID 0 for LED output#2210

Open
MegaManSec wants to merge 1 commit into
freebsd:mainfrom
MegaManSec:ukbd-led-fix-only
Open

ukbd: fix SET_REPORT wValue always using report ID 0 for LED output#2210
MegaManSec wants to merge 1 commit into
freebsd:mainfrom
MegaManSec:ukbd-led-fix-only

Conversation

@MegaManSec
Copy link
Copy Markdown
Contributor

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.

This fixes https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=279690.

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>
@aokblast aokblast requested review from aokblast and wulf7 May 19, 2026 07:04
Copy link
Copy Markdown
Contributor

@aokblast aokblast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! But I would like to wait @wulf7 for further comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants