Skip to content

Conversation

@RetiredWizard
Copy link

This is one of two library changes (Adafruit_USB_Host_Descriptors and Adafruit_CircuitPython_USB_Host_Mouse) that provides a framework to support combination keyboard/trackpad USB devices. A PR adafruit/Adafruit_Learning_System_Guides#3169 to the Fruit Jam PyPaint application has also been submitted which shows the use of these changes from an application perspective

This change generalizes the _find_boot_endpoint so it can locate boot or non-boot (report) endpoints. These changes are backwards compatible as the original public helper functions names haven't been changed and perform the original functions. There is a new helper function find_report_mouse_endpoint which an application can call (if no boot mice are found for example) to locate non-boot HID devices.

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

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

One small thing. Thanks!


INTERFACE_HID = 0x03
SUBCLASS_BOOT = 0x01
SUBCLASS_REPORT = None
Copy link
Member

Choose a reason for hiding this comment

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

I don't like obscuring the use of None here. Instead, just use bare none below.

Copy link
Author

Choose a reason for hiding this comment

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

I was being a bit lazy when I used None, I didn't know if there was a subclass ID for REPORT devices or if there were any other subclass IDs. Assuming google AI can be trusted, it looks like 0x00 might be the correct choice.

No, there is not a specific constant for
SUBCLASS_REPORT. The HID class defines only one optional subclass: the Boot Interface Subclass (0x01).
If a device does not support the boot interface subclass, its subclass field in the interface descriptor is set to 0x00, which signifies that it operates using the standard Report Protocol. The value 0x00 effectively represents the "Report" subclass, but it is typically referred to as the "No Subclass" or "Reserved" value in the USB specifications, with the absence of the boot code indicating the use of the full report descriptor method.
In summary, the relevant subclass constants are:

0x01: Boot Interface Subclass
0x00: (No specific name, implies use of the Report Protocol) 

It's easy enough to pull the constant and just pass None as you suggested but what do you think of using 0x00 instead?

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