Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
Bug report
- The format accepted by BTPROTO_HCI protocol is incorrectly documented.
- it accepts a bytes object
bdaddr, not a tuple. bdaddris a bytes object, not a string.
- it accepts a bytes object
- Some protocols accept
bdaddras a string, others accept it as a bytes object.getsockname()returns it as a string or a bytes object, and this is not always consistent with the accepted type. getsockname()not always return an address in the acceptable format. It returnsdevice_idwhen the acceptable format is a tuple(device_id,), can return a string when the acceptable format is a bytes object.
First problem should be solved by updating the documentation.
For second problem, I propose to make both string and bytes be accepted as a Bluetooth address. Also, if a 1-tuple is accepted, then its element should be accepted, and ifbdaddr is accepted, then a 1-tuple(bdaddr,) should be accepted.
The third problem cannot be resolved in backward compatible way. The solution for the second problem formally fixes incompatibility between input and output formats, but formats are still inconsistent between protocols. And after adding support forhci_channel (see#70145), the type of thegetsockname() result will depend on thehci_channel value.
Linked PRs
- gh-132099: Fix documentation for the BTPROTO_HCI protocol #132118
- [3.13] gh-132099: Fix documentation for the BTPROTO_HCI protocol (GH-132118) #132482
- gh-132099: Harmonize Bluetooth address handling #132486
- [3.13] gh-132099: Harmonize Bluetooth address handling (GH-132486) #132497
- gh-132099: Accept an integer as the address for BTPROTO_HCI on Linux #132525
Metadata
Metadata
Assignees
Projects
Status
Todo