Skip to content

add basic support for SCO packets over USB#896

Draft
barbibulle wants to merge 3 commits into
mainfrom
gbg/usb-hci-sco
Draft

add basic support for SCO packets over USB#896
barbibulle wants to merge 3 commits into
mainfrom
gbg/usb-hci-sco

Conversation

@barbibulle
Copy link
Copy Markdown
Collaborator

Still WIP

@barbibulle barbibulle marked this pull request as draft March 3, 2026 18:32
@zxzxwu
Copy link
Copy Markdown
Collaborator

zxzxwu commented May 22, 2026

@barbibulle This PR doesn't work with Intel controllers - but I asked Gemini to fix it #930, and now I can receive SCO but only with CVSD, but I guess transparent packets may work.

It seems the major difference is that alt setting must be set dynamically? And also input packets must be properly segmented.

@barbibulle
Copy link
Copy Markdown
Collaborator Author

@zxzxwu Would it be possible to rebase #930 on this commit, so that I could easily see what the gemini fix does? (maybe there's a way to do that easily from the GitHub interface, but I don't see it)

@zxzxwu
Copy link
Copy Markdown
Collaborator

zxzxwu commented May 22, 2026

Sure, I rebased it and pushed to #930.

@barbibulle
Copy link
Copy Markdown
Collaborator Author

Sure, I rebased it and pushed to #930.

Thanks.
I took a quick look at the gemini fix. It's interesting. There's one good element in there, but also some funny mistakes :-) In fact, it works by accident, because of a bug that it created but that ends up calling something with a value that works. Here's what's going on (based on a quick experiment with an Intel controller, I need to do some more experiementation with it). With my Intel controller, Alt Setting 6 does not work. When specifying +sco=0, the usb transport will auto-select the setting with the larget packet size, which is this one. The reason it works with the gemini change is that it created a set_sco_config to change the alt setting. It created that function with the alternate setting as the second parameter. But then it gets confused, having another function async def set_sco_config(self, active: bool, air_mode: int) which uses air_mode as its second parameter. In the end, it ends up using neither, because in the body of set_sco_config, it will set the alternate setting obtained from earlier from self.sco_alt_setting =sco_interface.getAlternateSetting()...
So, skipping all that spaghetti, all you need for the Intel controller to return SCO packets is select an alternate setting that's not 6. I tried it, using usb:0+sco=1 instead of usb:0+sco=0, and I get SCO packets.
Gemini did the right thing in adding some code to split the buffers into smaller packets, and using multi-packet transactions. That part I will incorporate in my PR.
The audio sending look in the sample app is good too, I had not had a chance to do that yet. So that's cool.

@zxzxwu
Copy link
Copy Markdown
Collaborator

zxzxwu commented May 25, 2026

Checking on BE200, CVSD is also support. mSBC codec is not supported (despite claimed in supported codec command), but transparent is supported, so we can encode and decode them in host.

Copy link
Copy Markdown
Collaborator

@zxzxwu zxzxwu left a comment

Choose a reason for hiding this comment

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

@barbibulle Thanks! What's your plan for this PR? We would like to use BE200 for some purposes especially on SCO and ISO.

Comment thread bumble/transport/usb.py
sink.start()

# Create a thread to process events
self.event_thread = threading.Thread(target=self.run)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can this be a daemon?

@barbibulle
Copy link
Copy Markdown
Collaborator Author

I was thinking of just adding the outgoing packet splitting and then try to merge it, then add the multi-packet input parsing as a second PR (this will address an issue reported earlier). For Intel controllers, we can either document that some alternate settings may not work, and that users should select a setting other than 6 manually, or we can make the auto-selection skip config 6, but that may not be ideal, since it might not be broken on all controllers, and since it has a larger packet size, may be more efficient. What do you think?

@zxzxwu
Copy link
Copy Markdown
Collaborator

zxzxwu commented May 27, 2026

Maybe we can allow passing a spec to select alt settings with a filter? For example:

  • sco=0 : For auto selection
  • sco=N : For fixed selection
  • sco=N,M : For auto selection from either N or M
  • sco=N-M : For auto selection from N to M

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