Skip to content

usb-device-hid: Fix boot protocol config in descriptor, default protocol mode, and protocol mode recover. #1036

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

hyx0329
Copy link

@hyx0329 hyx0329 commented Jul 30, 2025

Set the subclass value of the HID interface descriptor according to the supported interface protocol specified. Therefore BIOS will enumerate the keyboard.

The default interface protocol is set to report protocol according to the specification.

Since BIOS doesn't depend on the HID report descriptor, reset the device to report protocol when the report descriptor is read.

This is tested with a laptop and a RP2040 board with mpy 1.25.0 official release.

I use this to implement a NKRO keyboard with boot protocol support.


My understanding of 2 protocols:

  • Boot protocol: device acts like a predefined HID device, regardless of the report descriptor.
  • Report protocol: device acts just like what its report descriptor says.

hyx0329 added 2 commits July 30, 2025 23:31
Subclass in HID interface descriptor is a flag of boot protocol support.
Set it according to the interface protocol settings.

HID devices should come up in non-boot mode according to Device Class
Definition for Human Interface Devices (HID) v1.11 Appendix F.5. Set the
initial state of interface protocol to report protocol.

Signed-off-by: Hyx <hyx0329@outlook.com>
So HID device will exit boot protocol mode when entering normal OS.

Signed-off-by: Hyx <hyx0329@outlook.com>
@hyx0329 hyx0329 force-pushed the usb-hid-boot-protocol branch from e89d0d9 to 7f8899d Compare July 30, 2025 15:33
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.

1 participant