hid_report: fall back to boot extractor when NKRO extraction fails#338
Open
ibrahim1416 wants to merge 1 commit into
Open
hid_report: fall back to boot extractor when NKRO extraction fails#338ibrahim1416 wants to merge 1 commit into
ibrahim1416 wants to merge 1 commit into
Conversation
Some wireless dongles (e.g. Lemokey Link, VID 0x362d PID 0xd030) advertise an NKRO collection in their HID descriptor but actually transmit standard boot-style keyboard reports: a 1-byte report ID followed by 8 bytes of [modifier, reserved, 6 keycodes]. The descriptor's NKRO bitmap dimensions do not match the actual report layout, so _extract_kbd_nkro() returns -1. Previously, extract_kbd_data() did not check the return value and the caller proceeded with a zeroed report — so the keyboard appeared to be working at the USB level but no keys were ever forwarded. This change makes extract_kbd_data() fall through to the boot extractor when NKRO extraction fails. The "8 bytes optionally prefixed with a report ID" branch also drops the !iface->uses_report_id condition so it can catch report-ID'd boot-style reports (len == 9). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Some wireless dongles (observed on a Lemokey Link, VID
0x362dPID0xd030) advertise an NKRO collection in their HID report descriptor but actually transmit standard boot-style keyboard reports — a 1-byte report ID followed by[modifier, reserved, 6 keycodes](total 9 bytes).Because the descriptor's parsed NKRO bitmap dimensions don't match the actual report layout,
_extract_kbd_nkro()returns-1.extract_kbd_data()was not checking this return value, soprocess_keyboard_report()continued with a zeroed report. The result: the keyboard interface enumerates fine, reports arrive at the host every keystroke, but no keys are ever forwarded.Changes
extract_kbd_data()now falls through to the next extractor when_extract_kbd_nkro()returns-1, clearing the partially-filled report first.!iface->uses_report_idguard so it can catch report-ID-prefixed boot reports (len == 9).Test plan
is_nkrois false.🤖 Generated with Claude Code