hid: fix report_id extraction for interrupt OUT transfers#3683
Open
moxybaba wants to merge 1 commit into
Open
Conversation
When receiving output reports via interrupt OUT endpoint, the report_id was hardcoded to 0. Per HID spec section 8.2, when report IDs are used, the first byte of an interrupt OUT transfer is the report ID. Extract report_id from the first byte of the output buffer when non-zero and buffer length > 1, consistent with how SET_REPORT control transfers handle report IDs in hidd_control_xfer_cb(). Fixes hathach#2929
Collaborator
|
Hi, I think you pushed a wrong commit. |
Owner
|
how you know if the report has report-id in it, some does not use report-id at all (single report). |
Author
|
@hathach You're right, there's no reliable way to detect this from the transfer alone without knowing the descriptor. |
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.
Problem
In
hidd_xfer_cb(), when an output report is received via interruptOUT endpoint,
tud_hid_set_report_cb()is always called withreport_id=0.Per HID spec section 8.2, when a device uses report IDs, the first
byte of an interrupt OUT transfer is the report ID followed by the
report data. This is already handled correctly in the SET_REPORT
control path but was missing for interrupt OUT transfers.
Fix
Extract report_id from the first byte of the output buffer when
non-zero and buffer length > 1, consistent with how the control
path handles report IDs.
Testing
Built hid_composite example for stm32f411blackpill successfully.
Fixes #2929