-
Notifications
You must be signed in to change notification settings - Fork 1.3k
audio: fix audiod_open with midi interfaces #3383
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
Conversation
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.
Pull request overview
This PR enhances the audiod_open function in audio_device.c to properly differentiate between Audio and MIDI device interfaces, preventing the audio driver from incorrectly accepting MIDI devices. The fix adds validation logic to verify that the interface following an Audio Control interface is Audio Streaming (subclass 2) rather than MIDI Streaming (subclass 3).
Key changes:
- Added explicit return value
0to all TU_VERIFY and TU_ASSERT macro calls for consistent error handling - Implemented new validation block (lines 861-883) to check the second interface descriptor's subclass before accepting the device
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
This fix tested and worked for my problem in discussion: #3382 |
Signed-off-by: Zixun LI <[email protected]>
|
|
@hathach could you pick this before 0.20.1 tag? |
|
There's a video here of me using this fix, along with MIDI And Vendor connections. |
Size Difference ReportBecause TinyUSB code size varies by port and configuration, the metrics below represent the averaged totals across all example builds. Note: If there is no change, only one value is shown. Changes >1% in size
Changes <1% in sizeNo entries. No changes
|
hathach
left a comment
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.
perfect, thank you.



This pull request improves the robustness of the audio device interface validation logic in
audio_device.cby adding extra checks to differentiate between Audio and MIDI interfaces.