Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add decoding of HID report descriptors #207

Merged
merged 1 commit into from
Oct 31, 2024

Conversation

martinling
Copy link
Member

Adds decoding of HID report descriptors using the hidreport parser.

I've spent some time coming up with a human-readable summary format, which makes it clear which data can be found in which bits of each report, whilst omitting extraneous detail.

These summaries are shown in the detail pane when a HID report descriptor request is selected.

Since the test suite does not generate and check detailed summaries, a separate test is added, with a selection of test cases taken from various devices I've captured.

Keyboard example:

○ Input report (8 bytes):
├── Keyboard LeftControl: byte 0 bit 0
├── Keyboard LeftShift: byte 0 bit 1
├── Keyboard LeftAlt: byte 0 bit 2
├── Keyboard Left GUI: byte 0 bit 3 
├── Keyboard RightControl: byte 0 bit 4
├── Keyboard RightShift: byte 0 bit 5
├── Keyboard RightAlt: byte 0 bit 6
├── Keyboard Right GUI: byte 0 bit 7
├── Padding: byte 1
└── Array of 6 buttons: bytes 2-7 [Keyboard/Keypad usage 0x00 — Keyboard/Keypad usage 0xFF]

○ Output report (1 byte):
├── Num Lock: byte 0 bit 0
├── Caps Lock: byte 0 bit 1
├── Scroll Lock: byte 0 bit 2
├── Compose: byte 0 bit 3
├── Kana: byte 0 bit 4
└── Padding: byte 0 bits 5-7

Mouse example:

○ Input report #1 (7 bytes):
├── Button 1: byte 1 bit 0
├── Button 2: byte 1 bit 1
├── Button 3: byte 1 bit 2
├── Button 4: byte 1 bit 3
├── Button 5: byte 1 bit 4
├── Padding: byte 1 bits 5-7
├── X: byte 2 bit 0 — byte 3 bit 3 (values -2047 to 2047)
├── Y: byte 3 bit 4 — byte 4 bit 7 (values -2047 to 2047)
├── Wheel: byte 5 (values -127 to 127)
└── AC Pan: byte 6 (values -127 to 127)

@miek miek merged commit 83331c6 into greatscottgadgets:main Oct 31, 2024
10 checks passed
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