Repository navigation
Conversation
HIDInterface.protocol held both the bInterfaceProtocol descriptor value and the runtime boot/report protocol mode. desc_cfg() resets it to 1 at the end, and Device.config() calls desc_cfg() twice (once to measure the length, once to write), so every boot interface was described as a keyboard. MouseInterface was announced as protocol 1 instead of 2. Store the descriptor value in a separate interface_protocol attribute. Fixes issue micropython#1176. Signed-off-by: Duhan Günsel <gnsl.duhan.07@gmail.com>
Author
|
Tested on real firmware, with a test build that logs every HID request:
|
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
MouseInterfacewas enumerated with bInterfaceProtocol 1 (keyboard) instead of 2 (mouse), becauseHIDInterface.protocolheld both the descriptor value and the runtime protocol mode, andDevice.config()builds the descriptor in two passes. This stores the descriptor value in a separateinterface_protocolattribute. The constructor argument is unchanged.Fixes #1176.
Testing
ESP32-S3 (ESP32_GENERIC_S3, 2 MB PSRAM), MicroPython v1.29.0, macOS host:
ioregand by building the descriptor on the board.Generative AI
I used generative AI tools when creating this PR, but I checked the code and I am responsible for the code and the description above.