gh-132429: Fix support of Bluetooth sockets on NetBSD and DragonFly BSD#132431
gh-132429: Fix support of Bluetooth sockets on NetBSD and DragonFly BSD#132431serhiy-storchaka merged 2 commits intopython:mainfrom
Conversation
…nFly BSD Also add support for cid and bdaddr_type in the BTPROTO_L2CAP address on FreeBSD. Return cid getsockname() for BTPROTO_L2CAP if it is not zero.
|
LGTM. Tests passed successfully on real hardware running NetBSD 10.1. $ ./python -m test test_socket -m BasicBluetoothTest -v
== CPython 3.14.0a7+ (heads/NetBSD-bluetooth:54b13525942, Apr 12 2025, 23:07:59) [GCC 10.5.0]
== NetBSD-10.1-amd64-x86_64-64bit-ELF little-endian
== Python build: debug
== cwd: /home/blue/cpython-serhiy/build/test_python_worker_21373æ
== CPU count: 4
== encodings: locale=UTF-8 FS=utf-8
== resources: all test resources are disabled, use -u option to unskip tests
Using random seed: 1425819303
0:00:00 load avg: 0.54 Run 1 test sequentially in a single process
0:00:00 load avg: 0.54 [1/1] test_socket
testBadHciAddr (test.test_socket.BasicBluetoothTest.testBadHciAddr) ... ok
testBadL2capAddr (test.test_socket.BasicBluetoothTest.testBadL2capAddr) ... ok
testBadRfcommAddr (test.test_socket.BasicBluetoothTest.testBadRfcommAddr) ... ok
testBadScoAddr (test.test_socket.BasicBluetoothTest.testBadScoAddr) ... ok
testBindBrEdrL2capSocket (test.test_socket.BasicBluetoothTest.testBindBrEdrL2capSocket) ... ok
testBindHciSocket (test.test_socket.BasicBluetoothTest.testBindHciSocket) ... ok
testBindLeAttL2capSocket (test.test_socket.BasicBluetoothTest.testBindLeAttL2capSocket) ... skipped "object <module 'socket' from '/home/blue/cpython-serhiy/Lib/socket.py'> has no attribute 'BDADDR_LE_PUBLIC'"
testBindLePsmL2capSocket (test.test_socket.BasicBluetoothTest.testBindLePsmL2capSocket) ... skipped "object <module 'socket' from '/home/blue/cpython-serhiy/Lib/socket.py'> has no attribute 'BDADDR_LE_RANDOM'"
testBindRfcommSocket (test.test_socket.BasicBluetoothTest.testBindRfcommSocket) ... ok
testBindScoSocket (test.test_socket.BasicBluetoothTest.testBindScoSocket) ... ok
testBluetoothConstants (test.test_socket.BasicBluetoothTest.testBluetoothConstants) ... ok
testCreateHciSocket (test.test_socket.BasicBluetoothTest.testCreateHciSocket) ... ok
testCreateL2capSocket (test.test_socket.BasicBluetoothTest.testCreateL2capSocket) ... ok
testCreateRfcommSocket (test.test_socket.BasicBluetoothTest.testCreateRfcommSocket) ... ok
testCreateScoSocket (test.test_socket.BasicBluetoothTest.testCreateScoSocket) ... ok
----------------------------------------------------------------------
Ran 15 tests in 0.010s
OK (skipped=2)
0:00:00 load avg: 0.54 [1/1] test_socket passed
== Tests result: SUCCESS ==
1 test OK.
Total duration: 357 ms
Total tests: run=15 (filtered) skipped=2
Total test files: run=1/1 (filtered)
Result: SUCCESSHardware verification: $ dmesg | grep -i bt 1 ↵
[ 3.478088] ubt0 at uhub3 port 1
[ 3.478088] ubt0: vendor 13d3 (0x13d3) product 3304 (0x3304), rev 1.10/0.01, addr 3
$ sudo usbdevs -v
Controller /dev/usb0:
addr 1: high speed, self powered, config 1, EHCI root hub(0x0000), NetBSD(0x0000), rev 1.00(0x0100)
port 1 addr 2: high speed, self powered, config 1, Rate Matching Hub(0x0024), Intel(0x8087), rev 0.00(0x0000)
port 1 addr 3: full speed, self powered, config 1, product 3304(0x3304), AzureWave(0x13d3), rev 0.01(0x0001)
port 2 addr 4: high speed, power 500 mA, config 1, ASUS USB2.0 WebCam(0xa014), 04G6200086K0AN13E0001E5(0x058f), rev 0.01(0x0001)
port 3 powered
port 4 addr 5: high speed, power 500 mA, config 1, USB2.0-CRW(0x0139), Generic(0x0bda), rev 39.60(0x3960), serial 20100201396000000
port 5 powered
port 6 powered
port 2 powered
Controller /dev/usb1:
addr 1: high speed, self powered, config 1, EHCI root hub(0x0000), NetBSD(0x0000), rev 1.00(0x0100)
port 1 addr 2: high speed, self powered, config 1, Rate Matching Hub(0x0024), Intel(0x8087), rev 0.00(0x0000)
port 1 powered
port 2 powered
port 3 powered
port 4 powered
port 5 powered
port 6 powered
port 2 powered
$ btconfig -v
ubt0: bdaddr 00:00:00:00:00:00 flags 0
num_cmd = 0
num_acl = 0 (max 0), acl_mtu = 0
num_sco = 0 (max 0), sco_mtu = 0 |
|
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
|
Sorry, @serhiy-storchaka, I could not cleanly backport this to |
|
|
…d DragonFly BSD (pythonGH-132431) * Also add support for cid and bdaddr_type in the BTPROTO_L2CAP address on FreeBSD. * Return cid in getsockname() for BTPROTO_L2CAP if it is not zero. * Fix a compiler warning on FreeBSD. (cherry picked from commit f2f86d3) Co-authored-by: Serhiy Storchaka <[email protected]>
|
…d DragonFly BSD (pythonGH-132431) Also fix a compiler warning on FreeBSD. (cherry picked from commit f2f86d3) Co-authored-by: Serhiy Storchaka <[email protected]>
|
|
…d DragonFly BSD (pythonGH-132431) Also fix a compiler warning on FreeBSD. (cherry picked from commit f2f86d3) Co-authored-by: Serhiy Storchaka <[email protected]>
|
|
|
|
|
|
|
|
LOL okay I guess Anyone else: feel free to roll this PR back before that happens if the broken bots are blocking you. |
|
Also add support for cid and bdaddr_type in the BTPROTO_L2CAP address on FreeBSD. Return cid getsockname() for BTPROTO_L2CAP if it is not zero.