BLE: node unreachable on Linux after pairing — bluez auto-reconnect holds the single connection

Offen Anfängerfreundlich
#972 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
82/100
Issue-Typ
Dokumentation
Klarheit
Klar beschrieben
Aktivitätsstatus
Ruhig
Tech-Stack
linux, python
Bereich
cli, documentation

Rechercherichtung

Finde den Fehlerbehandlungsblock DEVICE_NOT_FOUND der CLI und die vorhandenen Hinweise zur Bluetooth-Fehlerbehebung; src/nimble/NimbleBluetooth.cpp bietet Hintergrund zum Verhalten bei einer einzigen Verbindung, muss aber nicht zwingend geändert werden. Füge unter Linux/bluez einen Aufzählungspunkt hinzu, der die automatische Wiederverbindung mit gekoppelten Geräten erklärt, und nenne die Problemumgehung mit bluetoothctl disconnect und ReconnectMode=none. Fertig bedeutet, dass der CLI-Fehler den Fall der automatischen Wiederverbindung eindeutig identifiziert und eine umsetzbare Lösung bietet.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Environment: Ubuntu Linux with bluez, Meshtastic T3S3 on firmware 2.7.26, meshtastic CLI 2.7.8 from pip.
Repro
Step one. Pair and trust the node from the host, entering the PIN shown on the device screen:
bluetoothctl pair AA:BB:CC:DD:EE:FF
bluetoothctl trust AA:BB:CC:DD:EE:FF
Step two. Disconnect cleanly and reboot the machine, or let the node go to sleep.
Step three. Run the CLI:
meshtastic --ble name_or_address --info
The CLI reports "No Meshtastic BLE peripheral with identifier or address '...' found" (also seen as "Timed out waiting for connection completion"), and --ble-scan comes back empty. Meanwhile bluetoothctl info AA:BB:CC:DD:EE:FF shows "Connected: yes".
What I think is going on
This is the one-slot trap, not an adapter problem. Meshtastic nodes allow a single BLE connection and stop advertising while connected (single connectable advertising instance in src/nimble/NimbleBluetooth.cpp). bluez defaults to ReconnectMode=global, which silently reconnects bonded devices after a reboot or power event and never lets the slot go. Result: the node is connected-but-invisible. The CLI scan only sees advertising nodes, and this one isn't advertising.
Even published Linux guides run into it. This write-up (https://dustinrue.com/2025/12/connecting-to-a-meshtastic-node-using-bluetooth-from-linux/) hits the same behavior ("bluetoothctl staying connected to the node when it shouldn't have") and its advice is to reboot the machine, which works but masks the cause. As far as I can tell nobody has written down the mechanism, so it keeps catching people.
Workaround (verified)
In /etc/bluetooth/main.conf, under the General section, add:
ReconnectMode=none
then run:
systemctl restart bluetooth
The node stays free ("Connected: no") until a client actually connects, and the CLI connects normally.
Suggestion
The CLI already prints helpful hints for "BLE device not found", in the DEVICE_NOT_FOUND error handling block: Bluetooth disabled / deep sleep / out of range. A Linux-specific bonded auto-reconnect bullet would have saved me an afternoon. If a hint like that would be useful, I'm happy to open a small PR — a "Device is bonded and Bluetooth auto-reconnected (Linux/bluez)" bullet plus a bluetoothctl disconnect / ReconnectMode=none tip.

Vorherrschende Sprache
Python
Sterne
855
Forks
355
Ø Merge
3 T. 3 Std.
Gemergte PRs (30 T.)
12

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus meshtastic/python

Alle Issues in meshtastic/python

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.