-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
HID class driver fixes #2253
Merged
Merged
HID class driver fixes #2253
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
11fba84
Error handling on transfer
Rocky04 81e63ed
Fixing warning
Rocky04 4af67dd
Simplify transfer failure cb.
HiFiPhile 268cc19
Merge remote-tracking branch 'remotes/tinyusb/master' into pr/2253
HiFiPhile 24339db
Code format.
HiFiPhile File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay, is this callback actually needed for your application ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now the app would not be informed if there was an issue due to the fasle positives. Any data received for a dedicated OUT endpoint would wrongly flagged as INVALID even there wasn't a communication issue.
Due to this the behavior between a dedicated OUT endpoint and if there is none, so that the data is transferred over the control endpoint, is different which isn't good in my opinion.
The callback is basically only there to pass the result state and so to may provide additional info to the app when an issue occurred. If there is no interest in that
tud_hid_set_report_cb
withHID_REPORT_TYPE_INVALID
as a parameter would be fine.I don't think there is actually a differentiation done between failed, stalled, a timeout or invalid. But depending on the app this is maybe interesting to know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree seeing INVALID is confusing, better rename into UNUSED.With a dedicated EP we don't know the
Report type
so better to useUNUSED
instead ofOUTPUT
.I prefer to keep it simple for the moment, we can add the callback when there is really need. (anyway transfer failed is not implement by dcd so it won't be called)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The data a dedicated OUT endpoint receives is from the type
HID_REPORT_TYPE_OUTPUT
per definition. It's not invalid nor unused!Having a dedicated OUT endpoint or let it handled via the control endpoint only depends how you want to configure the device. I don't think it's good that TinyUSB handles received data for an interface differently only because the way it's done is different. After all the purpose is the same, a specific interface receives data and so the implementation should not care which endpoint was used.
If there is no interest in the new callback, the call for that should be replaced by:
tud_hid_set_report_cb(instance, 0, HID_REPORT_TYPE_INVALID, p_hid->epout_buf, (uint16_t) xferred_bytes);
In that case the app will at least be informed about an issue even it has no chance figuring out why it failed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new callback should also allow tracking issues for IN endpoints. Without that this not possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True.
I've simplified
xfer_result_t result
as failure reasons are only used by hcd.