CANDY-LINE / node-red-contrib-generic-ble

A Node-RED node set for providing access to generic BLE peripheral GATT characteristics.
Apache License 2.0
24 stars 22 forks source link

BLE IN node keeps on unpairing and deleting BLE devices - help needed! #58

Open habakuk1979 opened 2 years ago

habakuk1979 commented 2 years ago

Hello!

I am working on Bluez 5.53 on Kernel 5.13 Ubuntu 18.04

since months I am trying to get this package reliably working now, but I cannot overcome the issue that

the BLE in node

aggressively keeps on unpairing and even removing fomerly absolutely correctly paired devices. (btmon):


@ MGMT Command: Stop Discovery (0x0024) plen 1 {0x0001} [hci0] 97.862810 Address type: 0x07 BR/EDR LE Public LE Random < HCI Command: Inquiry Cancel (0x01|0x0002) plen 0 #259 [hci0] 97.862918

HCI Event: Command Complete (0x0e) plen 4 #260 [hci0] 97.866692 Inquiry Cancel (0x01|0x0002) ncmd 1 Status: Success (0x00) < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2 #261 [hci0] 97.866760 Scanning: Disabled (0x00) Filter duplicates: Disabled (0x00) HCI Event: Command Complete (0x0e) plen 4 #262 [hci0] 97.887693 LE Set Scan Enable (0x08|0x000c) ncmd 1 Status: Success (0x00) @ MGMT Event: Command Complete (0x0001) plen 4 {0x0001} [hci0] 97.887811 Stop Discovery (0x0024) plen 1 Status: Success (0x00) Address type: 0x07 BR/EDR LE Public LE Random @ MGMT Event: Discovering (0x0013) plen 2 {0x0001} [hci0] 97.887833 Address type: 0x07 BR/EDR LE Public LE Random Discovery: Disabled (0x00) @ MGMT Event: Discovering (0x0013) plen 2 {0x0002} [hci0] 97.887833 Address type: 0x07 BR/EDR LE Public LE Random Discovery: Disabled (0x00) @ MGMT Command: Remove Device (0x0034) plen 7 {0x0001} [hci0] 97.916065 BR/EDR Address: C0:E4:80:CA:A3:F0 (OUI C0-E4-80) @ MGMT Event: Device Removed (0x001b) plen 7 {0x0002} [hci0] 97.916174 BR/EDR Address: C0:E4:80:CA:A3:F0 (OUI C0-E4-80) @ MGMT Event: Command Complete (0x0001) plen 10 {0x0001} [hci0] 97.916184 Remove Device (0x0034) plen 7 Status: Success (0x00) BR/EDR Address: C0:E4:80:CA:A3:F0 (OUI C0-E4-80) < HCI Command: Write Scan Enable (0x03|0x001a) plen 1 #263 [hci0] 97.916229 Scan enable: No Scans (0x00) @ MGMT Command: Unpair Device (0x001b) plen 8 {0x0001} [hci0] 97.916435 LE Address: C0:E4:80:CA:A3:F0 (Static) Disconnect: Enabled (0x01) @ MGMT Event: Command Complete (0x0001) plen 10 {0x0001} [hci0] 97.916455 Unpair Device (0x001b) plen 7 Status: Success (0x00) LE Address: C0:E4:80:CA:A3:F0 (Static) @ MGMT Event: Device Unpaired (0x0016) plen 7 {0x0002} [hci0] 97.916460 LE Address: C0:E4:80:CA:A3:F0 (Static) HCI Event: Command Complete (0x0e) plen 4 #264 [hci0] 97.917702 Write Scan Enable (0x03|0x001a) ncmd 1 Status: Success (0x00)

However this dramatically results in deleted

var/lib/bluetooth/"adapter"/"peripheral-device"/info - file (which holds all the pairing key information)!

Exactly the same happens when you try to connect to a paired device via your BLE IN node and the connection becomes rejected or breaks whatr happens ofcours every once in a while: (btmon)


@ MGMT Event: Device Connected (0x000b) plen 36 {0x0001} [hci0] 65.298536 LE Address: C0:E4:80:CA:A3:F0 (Static) Flags: 0x00000000 Data length: 23 Flags: 0x02 LE General Discoverable Mode 16-bit Service UUIDs (partial): 1 entry GoPro, Inc. (0xfea6) Company: GoPro, Inc. (754) Data: 0103133f00f0a3ca80e4c00f @ MGMT Event: Device Connected (0x000b) plen 36 {0x0002} [hci0] 65.298536 LE Address: C0:E4:80:CA:A3:F0 (Static) Flags: 0x00000000 Data length: 23 Flags: 0x02 LE General Discoverable Mode 16-bit Service UUIDs (partial): 1 entry GoPro, Inc. (0xfea6) Company: GoPro, Inc. (754) Data: 0103133f00f0a3ca80e4c00f < HCI Command: LE Read Remote Use.. (0x08|0x0016) plen 2 #237 [hci0] 65.298733 Handle: 70

HCI Event: Command Status (0x0f) plen 4 #238 [hci0] 65.302521 LE Read Remote Used Features (0x08|0x0016) ncmd 0 Status: Success (0x00) @ MGMT Command: Start Service Disc.. (0x003a) plen 4 {0x0001} [hci0] 65.499034 Address type: 0x07 BR/EDR LE Public LE Random RSSI: invalid (0x7f) UUIDs: 0 HCI Event: Disconnect Complete (0x05) plen 4 #239 [hci0] 65.594510 Status: Success (0x00) Handle: 70 Reason: Connection Failed to be Established (0x3e) @ MGMT Event: Device Disconnected (0x000c) plen 8 {0x0001} [hci0] 65.594557 LE Address: C0:E4:80:CA:A3:F0 (Static) Reason: Unspecified (0x00) @ MGMT Event: Device Disconnected (0x000c) plen 8 {0x0002} [hci0] 65.594557 LE Address: C0:E4:80:CA:A3:F0 (Static) Reason: Unspecified (0x00) HCI Event: LE Meta Event (0x3e) plen 12 #240 [hci0] 65.596521 LE Read Remote Used Features (0x04) Status: Unknown Connection Identifier (0x02) Handle: 70 Features: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 HCI Event: Command Status (0x0f) plen 4 #241 [hci0] 65.597513 NOP (0x00|0x0000) ncmd 1 Status: Success (0x00) < HCI Command: LE Set Random Addr.. (0x08|0x0005) plen 6 #242 [hci0] 65.643039 Address: 15:F4:3C:8F:A5:0A (Non-Resolvable) HCI Event: Command Complete (0x0e) plen 4 #243 [hci0] 65.644538 LE Set Random Address (0x08|0x0005) ncmd 1 Status: Success (0x00) < HCI Command: LE Set Scan Parame.. (0x08|0x000b) plen 7 #244 [hci0] 65.644689 Type: Active (0x01) Interval: 22.500 msec (0x0024) Window: 11.250 msec (0x0012) Own address type: Random (0x01) Filter policy: Accept all advertisement (0x00) HCI Event: Command Complete (0x0e) plen 4 #245 [hci0] 65.646525 LE Set Scan Parameters (0x08|0x000b) ncmd 1 Status: Success (0x00) < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2 #246 [hci0] 65.646657 Scanning: Enabled (0x01) Filter duplicates: Enabled (0x01) HCI Event: Command Complete (0x0e) plen 4 #247 [hci0] 65.648526 LE Set Scan Enable (0x08|0x000c) ncmd 1 Status: Success (0x00) @ MGMT Event: Command Complete (0x0001) plen 4 {0x0001} [hci0] 65.648675 Start Service Discovery (0x003a) plen 1 Status: Success (0x00) Address type: 0x07 BR/EDR LE Public LE Random @ MGMT Event: Discovering (0x0013) plen 2 {0x0001} [hci0] 65.648694 Address type: 0x07 BR/EDR LE Public LE Random Discovery: Enabled (0x01) @ MGMT Event: Discovering (0x0013) plen 2 {0x0002} [hci0] 65.648694 Address type: 0x07 BR/EDR LE Public LE Random Discovery: Enabled (0x01) @ MGMT Command: Remove Device (0x0034) plen 7 {0x0001} [hci0] 65.648872 BR/EDR Address: C0:E4:80:CA:A3:F0 (OUI C0-E4-80) @ MGMT Event: Device Removed (0x001b) plen 7 {0x0002} [hci0] 65.648908 BR/EDR Address: C0:E4:80:CA:A3:F0 (OUI C0-E4-80) @ MGMT Event: Command Complete (0x0001) plen 10 {0x0001} [hci0] 65.648916 Remove Device (0x0034) plen 7 Status: Success (0x00) BR/EDR Address: C0:E4:80:CA:A3:F0 (OUI C0-E4-80) < HCI Command: Write Scan Enable (0x03|0x001a) plen 1 #248 [hci0] 65.648955 Scan enable: No Scans (0x00) @ MGMT Command: Unpair Device (0x001b) plen 8 {0x0001} [hci0] 65.649017 LE Address: C0:E4:80:CA:A3:F0 (Static) Disconnect: Enabled (0x01) @ MGMT Event: Command Complete (0x0001) plen 10 {0x0001} [hci0] 65.649031 Unpair Device (0x001b) plen 7 Status: Success (0x00) LE Address: C0:E4:80:CA:A3:F0 (Static) @ MGMT Event: Device Unpaired (0x0016) plen 7 {0x0002} [hci0] 65.649034 LE Address: C0:E4:80:CA:A3:F0 (Static) HCI Event: Command Complete (0x0e) plen 4 #249 [hci0] 65.653515 Write Scan Enable (0x03|0x001a) ncmd 1 Status: Success (0x00)

Therefore one has to redo the whole pairing process over and over again. This is untolerable and there's no workaround for this.

Unfortunately there isnt any output on this node available, what makes it even "more fun".

how ever we need help on this pleaseeather way with an bug fix or main.conf or /sys/kernel/debug/bluetooth/hci0 - settings please. availaible are: 6lowpan force_sc_support random_address adv_channel_map force_static_address rpa_timeout auto_accept_delay hci_revision sc_only_mode blacklist hci_version sniff_max_interval conn_info_max_age identity sniff_min_interval conn_info_min_age identity_resolving_keys ssp_debug_mode conn_max_interval idle_timeout static_address conn_min_interval inquiry_cache uuids dev_class le_auto_conn voice_setting discov_interleaved_timeout link_keys white_list dut_mode long_term_keys white_list_size features manufacturer

I appreciate your help.

with kind regards

habakuk