btleplug icon indicating copy to clipboard operation
btleplug copied to clipboard

Linux central to Mac connection problems

Open Frank-Buss opened this issue 6 months ago • 0 comments

Describe the bug When using this test application: ble-chat.zip and running it on Mac with "cargo run -- peripheral" and on Linux Debian with "cargo run -- central", I get this output on Linux:

[2025-06-26T17:38:08Z INFO  ble_chat::central] Starting BLE Chat Central, looking for device: 'BLE_Chat_Device'
[2025-06-26T17:38:08Z INFO  ble_chat::central] ✅ Using adapter: hci0 (usb:v1D6Bp0246d0552)
[2025-06-26T17:38:08Z INFO  ble_chat::central] 🔍 Scanning for device with service UUID...
[2025-06-26T17:38:09Z INFO  ble_chat::central] 🎯 Found device with our service: '(unknown)' (14:98:77:76:2C:E8)
[2025-06-26T17:38:09Z INFO  ble_chat::central] 🔗 Connecting to peripheral...
Error: Connection failed: Timeout waiting for reply

I have to connect manually first to the peripheral with this command:

sudo hcitool lecc 14:98:77:76:2C:E8

and then the Rust program can connect to it as well.

Also after starting the Rust program a few times, sometimes I get this message:

Error: Bluetooth operation failed: Failed to register advertisement

This persists then for any subsequent start, until I restart the bluetooth service:

sudo systemctl restart bluetooth

Then the Rust program works again.

Expected behavior I expect that I don't need to use the hcitool program or restart the bluetooth service.

Actual behavior I need to use the hcitool program and sometimes restart the bluetooth service.

Frank-Buss avatar Jun 26 '25 18:06 Frank-Buss