-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Labels
wontfixThis will not be worked onThis will not be worked on
Description
Related discussions:
hbldh/bleak#701
bluez/bluez#511
Here how it looks like:
$ ble-serial -vv -d 98:DA:E0:01:9C:46 -s 0000ffe0-0000-1000-8000-00805f9b34fb -r 0000ffe1-0000-1000-8000-00805f9b34fb -w 0000ffe2-0000-1000-8000-00805f9b34fb
20:29:43.328 | DEBUG | main.py: Running: Namespace(verbose=2, timeout=5.0, adapter='hci0', mtu=20, device='98:DA:E0:01:9C:46', addr_type='public', service_uuid='0000ffe0-0000-1000-8000-00805f9b34fb', write_uuid='0000ffe2-0000-1000-8000-00805f9b34fb', read_uuid='0000ffe1-0000-1000-8000-00805f9b34fb', mode='rw', filename=None, binlog=False, port='/tmp/ttyBLE', tcp_host='127.0.0.1', tcp_port=None)
20:29:43.329 | DEBUG | selector_events.py: Using selector: EpollSelector
20:29:43.329 | INFO | linux_pty.py: Port endpoint created on /tmp/ttyBLE -> /dev/pts/8
20:29:43.329 | INFO | ble_interface.py: Receiver set up
20:29:43.361 | DEBUG | manager.py: initial properties: {'/org/bluez': {'org.freedesktop.DBus.Introspectable': {}, 'org.bluez.AgentManager1': {}, 'org.bluez.ProfileManager1': {}}, '/org/bluez/hci0': {'org.freedesktop.DBus.Introspectable': {}, 'org.bluez.Adapter1': {'Address': '00:21:6B:E8:4F:5D', 'AddressType': 'public', 'Name': 'it0', 'Alias': 'it0', 'Class': 8126732, 'Powered': True, 'Discoverable': False, 'DiscoverableTimeout': 180, 'Pairable': True, 'PairableTimeout': 0, 'Discovering': False, 'UUIDs': ['00001133-0000-1000-8000-00805f9b34fb', '0000110e-0000-1000-8000-00805f9b34fb', '00001105-0000-1000-8000-00805f9b34fb', '00001132-0000-1000-8000-00805f9b34fb', '00001200-0000-1000-8000-00805f9b34fb', '00001104-0000-1000-8000-00805f9b34fb', '00005005-0000-1000-8000-0002ee000001', '00001108-0000-1000-8000-00805f9b34fb', '0000110c-0000-1000-8000-00805f9b34fb', '00001801-0000-1000-8000-00805f9b34fb', '0000112f-0000-1000-8000-00805f9b34fb', '0000180a-0000-1000-8000-00805f9b34fb', '0000110b-0000-1000-8000-00805f9b34fb', '00001800-0000-1000-8000-00805f9b34fb', '0000111f-0000-1000-8000-00805f9b34fb', '0000110a-0000-1000-8000-00805f9b34fb', '00001106-0000-1000-8000-00805f9b34fb'], 'Modalias': 'usb:v1D6Bp0246d0540', 'Roles': ['central', 'peripheral']}, 'org.freedesktop.DBus.Properties': {}, 'org.bluez.GattManager1': {}, 'org.bluez.Media1': {}, 'org.bluez.NetworkServer1': {}, 'org.bluez.LEAdvertisingManager1': {'ActiveInstances': 0, 'SupportedInstances': 5, 'SupportedIncludes': ['appearance', 'local-name']}}, '/org/bluez/hci0/dev_98_DA_E0_01_9C_46': {'org.freedesktop.DBus.Introspectable': {}, 'org.bluez.Device1': {'Address': '98:DA:E0:01:9C:46', 'AddressType': 'public', 'Name': 'ANT-DISPLAY', 'Alias': 'ANT-DISPLAY', 'Appearance': 2, 'Icon': 'unknown', 'Paired': False, 'Trusted': False, 'Blocked': False, 'LegacyPairing': False, 'Connected': False, 'UUIDs': ['00001101-0000-1000-8000-00805f9b34fb', '00001800-0000-1000-8000-00805f9b34fb', '00001801-0000-1000-8000-00805f9b34fb', '0000180a-0000-1000-8000-00805f9b34fb', '0000ffe0-0000-1000-8000-00805f9b34fb'], 'Modalias': 'bluetooth:v000Ep3412d6701', 'Adapter': '/org/bluez/hci0', 'ManufacturerData': {0: bytearray(b'\x98\xda\xe0\x01\x9cF')}, 'ServicesResolved': False}, 'org.freedesktop.DBus.Properties': {}}}
20:29:43.483 | DEBUG | manager.py: received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0): ['org.bluez.Adapter1', {'Discovering': <dbus_fast.signature.Variant ('b', True)>}, []]
20:29:43.506 | DEBUG | manager.py: received D-Bus signal: org.freedesktop.DBus.ObjectManager.InterfacesAdded (/): ['/org/bluez/hci0/dev_65_56_10_1E_F6_BE', {'org.freedesktop.DBus.Introspectable': {}, 'org.bluez.Device1': {'Address': <dbus_fast.signature.Variant ('s', 65:56:10:1E:F6:BE)>, 'AddressType': <dbus_fast.signature.Variant ('s', public)>, 'Name': <dbus_fast.signature.Variant ('s', ANT-BMS-BLE)>, 'Alias': <dbus_fast.signature.Variant ('s', ANT-BMS-BLE)>, 'Paired': <dbus_fast.signature.Variant ('b', False)>, 'Trusted': <dbus_fast.signature.Variant ('b', False)>, 'Blocked': <dbus_fast.signature.Variant ('b', False)>, 'LegacyPairing': <dbus_fast.signature.Variant ('b', False)>, 'RSSI': <dbus_fast.signature.Variant ('n', -41)>, 'Connected': <dbus_fast.signature.Variant ('b', False)>, 'UUIDs': <dbus_fast.signature.Variant ('as', ['0000ffe0-0000-1000-8000-00805f9b34fb', '0000fee7-0000-1000-8000-00805f9b34fb'])>, 'Adapter': <dbus_fast.signature.Variant ('o', /org/bluez/hci0)>, 'ManufacturerData': <dbus_fast.signature.Variant ('a{qv}', {54702: <dbus_fast.signature.Variant ('ay', bytearray(b'\x88\xa0eV\x10\x1d\xf6\xbe'))>})>, 'ServicesResolved': <dbus_fast.signature.Variant ('b', False)>}, 'org.freedesktop.DBus.Properties': {}}]
20:29:43.562 | DEBUG | manager.py: received D-Bus signal: org.freedesktop.DBus.ObjectManager.InterfacesAdded (/): ['/org/bluez/hci0/dev_98_DA_E0_01_9C_46', {'org.freedesktop.DBus.Introspectable': {}, 'org.bluez.Device1': {'Address': <dbus_fast.signature.Variant ('s', 98:DA:E0:01:9C:46)>, 'AddressType': <dbus_fast.signature.Variant ('s', public)>, 'Name': <dbus_fast.signature.Variant ('s', ANT-DISPLAY)>, 'Alias': <dbus_fast.signature.Variant ('s', ANT-DISPLAY)>, 'Paired': <dbus_fast.signature.Variant ('b', False)>, 'Trusted': <dbus_fast.signature.Variant ('b', False)>, 'Blocked': <dbus_fast.signature.Variant ('b', False)>, 'LegacyPairing': <dbus_fast.signature.Variant ('b', False)>, 'RSSI': <dbus_fast.signature.Variant ('n', -61)>, 'Connected': <dbus_fast.signature.Variant ('b', False)>, 'UUIDs': <dbus_fast.signature.Variant ('as', ['0000ffe0-0000-1000-8000-00805f9b34fb'])>, 'Adapter': <dbus_fast.signature.Variant ('o', /org/bluez/hci0)>, 'ManufacturerData': <dbus_fast.signature.Variant ('a{qv}', {0: <dbus_fast.signature.Variant ('ay', bytearray(b'\x98\xda\xe0\x01\x9cF'))>})>, 'ServicesResolved': <dbus_fast.signature.Variant ('b', False)>}, 'org.freedesktop.DBus.Properties': {}}]
20:29:43.576 | DEBUG | manager.py: received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_98_DA_E0_01_9C_46): ['org.bluez.Device1', {}, ['RSSI']]
20:29:43.577 | DEBUG | manager.py: received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_65_56_10_1E_F6_BE): ['org.bluez.Device1', {}, ['RSSI']]
20:29:43.577 | DEBUG | manager.py: received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0): ['org.bluez.Adapter1', {'Discovering': <dbus_fast.signature.Variant ('b', False)>}, []]
20:29:43.578 | INFO | ble_interface.py: Trying to connect with 98:DA:E0:01:9C:46: ANT-DISPLAY
20:29:43.579 | DEBUG | client.py: Connecting to device @ 98:DA:E0:01:9C:46
20:29:43.583 | DEBUG | client.py: Connecting to BlueZ path /org/bluez/hci0/dev_98_DA_E0_01_9C_46
20:29:46.487 | DEBUG | manager.py: received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_98_DA_E0_01_9C_46): ['org.bluez.Device1', {'Connected': <dbus_fast.signature.Variant ('b', True)>}, []]
20:29:46.555 | DEBUG | manager.py: received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_98_DA_E0_01_9C_46): ['org.bluez.Device1', {'UUIDs': <dbus_fast.signature.Variant ('as', ['00001101-0000-1000-8000-00805f9b34fb'])>, 'ServicesResolved': <dbus_fast.signature.Variant ('b', True)>}, []]
20:29:47.465 | DEBUG | manager.py: received D-Bus signal: org.freedesktop.DBus.ObjectManager.InterfacesAdded (/): ['/org/bluez/agent', {'org.freedesktop.DBus.Introspectable': {}, 'org.bluez.Agent1': {}}]
20:29:47.467 | DEBUG | manager.py: received D-Bus signal: org.freedesktop.DBus.ObjectManager.InterfacesRemoved (/): ['/org/bluez/agent', ['org.freedesktop.DBus.Introspectable', 'org.bluez.Agent1']]
20:29:49.443 | DEBUG | manager.py: received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_98_DA_E0_01_9C_46): ['org.bluez.Device1', {'ServicesResolved': <dbus_fast.signature.Variant ('b', False)>}, []]
20:29:49.444 | DEBUG | client.py: _cleanup_all(/org/bluez/hci0/dev_98_DA_E0_01_9C_46)
20:29:49.444 | ERROR | main.py: Bluetooth connection failed: [org.bluez.Error.NotAvailable] br-connection-profile-unavailable
20:29:49.444 | WARNING | main.py: Shutdown initiated
20:29:49.444 | INFO | linux_pty.py: Serial reader and symlink removed
20:29:49.444 | INFO | main.py: Shutdown complete.
I tried to inspect and understand this library code and Bleak's code too and this output too.
So, the code searches BLE ADDR and fount it, as it should, but then it connects to the device using BR/EDR transport, and eventually fails as it could find "0000ffe0-..." UUID.
Instead it shows UUID "00001101-0000-1000-8000-00805f9b34fb" which is well knows SPP for the Classic BT.
I watched by btmon tool what happens, and it's clear it uses BR/EDR to connect after discovering the device by BLE:
....
@ MGMT Event: Discovering (0x0013) plen 2 {0x0001} [hci0] 6.921850
Address type: 0x06
LE Public
LE Random
Discovery: Disabled (0x00)
< HCI Command: Create Connection (0x01|0x0005) plen 13 #13 [hci0] 6.931115
Address: 98:DA:E0:01:9C:46 (OUI 98-DA-E0)
Packet type: 0xcc18
DM1 may be used
DH1 may be used
DM3 may be used
DH3 may be used
DM5 may be used
DH5 may be used
Page scan repetition mode: R2 (0x02)
Page scan mode: Mandatory (0x00)
Clock offset: 0x0000
Role switch: Allow peripheral (0x01)
@ MGMT Command: Add Device (0x0033) plen 8 {0x0001} [hci0] 6.931186
BR/EDR Address: 98:DA:E0:01:9C:46 (OUI 98-DA-E0)
Action: Allow incoming connection (0x01)
@ MGMT Event: Device Flags Changed (0x002a) plen 15 {0x0001} [hci0] 6.931194
BR/EDR Address: 98:DA:E0:01:9C:46 (OUI 98-DA-E0)
Supported Flags: 0x00000001
Remote Wakeup
Current Flags: 0x00000000
@ MGMT Event: Command Complete (0x0001) plen 10 {0x0001} [hci0] 6.931198
Add Device (0x0033) plen 7
Status: Success (0x00)
BR/EDR Address: 98:DA:E0:01:9C:46 (OUI 98-DA-E0)
> HCI Event: Command Status (0x0f) plen 4 #14 [hci0] 6.931669
Create Connection (0x01|0x0005) ncmd 1
Status: Success (0x00)
< HCI Command: Write Scan Enable (0x03|0x001a) plen 1 #15 [hci0] 6.931680
Scan enable: Page Scan (0x02)
> HCI Event: Command Complete (0x0e) plen 4 #16 [hci0] 6.932666
Write Scan Enable (0x03|0x001a) ncmd 2
Status: Success (0x00)
> HCI Event: Connect Complete (0x03) plen 11 #17 [hci0] 7.316751
Status: Success (0x00)
Handle: 256
Address: 98:DA:E0:01:9C:46 (OUI 98-DA-E0)
Link type: ACL (0x01)
Encryption: Disabled (0x00)
< HCI Command: Read Remote Supported Features (0x01|0x001b) plen 2
...
I'm not sure what to do here, just raising this discussion here to possibly find some solution.
Metadata
Metadata
Assignees
Labels
wontfixThis will not be worked onThis will not be worked on