Skip to content
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

Update bth for IAD support #1182

Merged
merged 2 commits into from
Nov 5, 2021
Merged

Conversation

kasjer
Copy link
Collaborator

@kasjer kasjer commented Nov 5, 2021

Describe the PR
IAD was missing from BT interface descriptor macro.
This in itself did not matter much but it is in the specification so descriptor is updated now.

With missing IAD BT driver handled open separately for both interfaces.
For some time now BT is assumed to have 2 associated interfaces even when IAD is missing.
This inferred association resulted in only one call to btd_open() and second interface was no
handled at all.
This in turn resulted in assertion failure in process_set_config().

Now single call to btd_open() checks for presence of both interfaces as expected by
process_set_config().

This only changes conditions and how itf_desc is modified in the middle of btd_open(),
rest is just indentation change due to if () removal

Two interfaces that are required by Bluetooth Primary Controller
do not have IAD according to Bluetooth specification.
Those two interfaces were opened separately in process_set_config().

Later interface association was inferred for BTH (along with other
drivers), since then only one call to open() is place for BTH driver
that should prepare both interfaces at once.

To make it work again btd_open() parses two interfaces at once.
Bluetooth's specification defines IAD for primary controller.
While it seems that Windows and Linux can leave without this,
there is no reason TinyUSB should not provide it.
Copy link
Owner

@hathach hathach left a comment

Choose a reason for hiding this comment

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

Thank you, I notice this as well and put the TODO note for this 👍 . IAD in general is preferred since it allow device to be *composite and able to add more class such as DFU runtime etc ...

@@ -806,6 +806,8 @@ TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb
// Interface number, string index, attributes, event endpoint, event endpoint size, interval, data in, data out, data endpoint size, iso endpoint sizes
// TODO BTH should also use IAD like CDC for composite device
Copy link
Owner

Choose a reason for hiding this comment

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

I did put a TODO for IAD here as well 😄

@hathach hathach merged commit a9ce2db into hathach:master Nov 5, 2021
@kasjer kasjer deleted the kasjer/update-bth-iad branch November 5, 2021 14:00
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