Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a mechanism in UsbPacketSource to defer ACL packets by a polling interval, mirroring the behavior of Linux's btusb.c driver to preserve correct packet ordering. It also adds special handling for the disconnection complete event to flush pending ACL packets first, and includes unit tests to verify these behaviors. There are no review comments, so I have no feedback to provide.
…tSource Defer incoming USB Bulk IN ACL packets by one USB interrupt polling interval (default 4ms, matching Linux btusb.c force_poll_sync) and flush deferred ACL packets immediately after queueing incoming USB Interrupt IN HCI events. This prevents Bulk IN ACL packets (such as SMP Identity Information) from racing ahead of concurrent Interrupt IN HCI events (such as HCI_Encryption_Change) on controllers like Intel BE200. Special handling: - For HCI_Disconnection_Complete (0x05), flush deferred ACL packets before queueing the disconnection event so ACL payloads transmitted by the peer prior to disconnect are delivered while the connection state is still active. - Cancel any pending ACL flush timer and clear deferred ACL packets in close() and on_transport_lost().
uier
force-pushed
the
usb-packet-source-poll-sync
branch
from
October 16, 2026 08:35
8b8b4e8 to
5481049
Compare
Collaborator
|
Thanks for tackling this, the event/ACL race on Intel BE200 is real and deferring Bulk IN ACL until the next Interrupt IN poll is a sensible approach. A few concerns before merging:
|
This branch has not been deployed
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.
As mentioned in #935 (comment), we have a patch in transport/usb.py implementing the mechanism in Intel's btusb driver, and it works for me:
Defer incoming USB Bulk IN ACL packets by one USB interrupt polling interval (default 4ms, matching Linux btusb.c force_poll_sync) and flush deferred ACL packets immediately after queueing incoming USB Interrupt IN HCI events. This prevents Bulk IN ACL packets (such as SMP Identity Information) from racing ahead of concurrent Interrupt IN HCI events (such as HCI_Encryption_Change) on controllers like Intel BE200.
Special handling:
Additional verification: