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

gh-129288: Add optional l2_cid and l2_bdaddr_type in BTPROTO_L2CAP socket address tuple #129293

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

themadinventor
Copy link

@themadinventor themadinventor commented Jan 25, 2025

To be able to connect L2CAP sockets to Bluetooth LE devices, the l2_bdaddr_type field in sockaddr_l2 must be set to BDADDR_LE_PUBLIC or BDADDR_LE_RANDOM.
Likewise, when opening a raw LE L2CAP socket to the ATT service, l2_cid must be set instead of l2_psm.

This change adds support for providing l2_cid and l2_bdaddr_type as optional, traliing elements in the address tuple passed to connect()

…ress tuple

To be able to connect L2CAP sockets to Bluetooth LE devices, the l2_bdaddr_type must be set to BDADDR_LE_PUBLIC or BDADDR_LE_RANDOM.
This change adds support for providing the l2_bdaddr_type as an optional, traliing element in the address tuple passed to connect()
Copy link

cpython-cla-bot bot commented Jan 25, 2025

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-app
Copy link

bedevere-app bot commented Jan 25, 2025

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

… socket.BDADDR_RANDOM only if defined for target

Add check that BDADDR_BREDR is defined as Windows build may set USE_BLUETOOTH but not BDADDR_*
@bedevere-app
Copy link

bedevere-app bot commented Jan 25, 2025

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

…ss tuple

This change adds support for the CID field in the socket address tuple. This allows e.g raw LE ATT connections.
@bedevere-app
Copy link

bedevere-app bot commented Jan 26, 2025

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@themadinventor themadinventor changed the title gh-129288: Add optional l2_bdaddr_type in BTPROTO_L2CAP socket address tuple gh-129288: Add optional l2_cid and l2_bdaddr_type in BTPROTO_L2CAP socket address tuple Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant