Linux + iPhone Continuity / iMessage / SMS
fix: bredr latching forever when we should retry
Zack Bartel18ac43348d17
diff --git a/docs/BLUETOOTH.md b/docs/BLUETOOTH.mdindex fa2b5d6..b8fedb8 100644--- a/docs/BLUETOOTH.md+++ b/docs/BLUETOOTH.md@@ -513,6 +513,7 @@ checks the daemon does not make.| The phone shows two entries for this computer | A failed pairing left both a Classic and an LE record | Delete both on the phone before retrying || LE never connects and the log repeats `org.bluez.Error.InProgress` | BlueZ is holding an auto-connect registration that never completed | `sudo systemctl restart bluetooth` -- nothing short of that clears it, see 2026-08-19 below. With `tether-btclass@hci0` enabled the class survives the restart || The log says `could not re-arm the ANCS solicitation` | BlueZ refused to register the advertisement, so nothing is on air for the iPhone to answer | `sudo systemctl restart bluetooth`. Nothing else brings it back, and the LE link cannot form without it |+| The log repeats `RegisterAdvertisement failed: ... AlreadyExists` for minutes after one timeout | A registration whose call timed out is still held by BlueZ, and the local flag said otherwise so nothing released it | Fixed. A timed-out registration is now released and an `AlreadyExists` is adopted rather than discarded -- see 2026-09-07 below || Pairing warns `RegisterAdvertisement ... doesn't exist` on `org.bluez.LEAdvertisingManager1` | BlueZ exported no advertising manager on this adapter at all, because the controller reports no LE advertising support. Distinct from the row above, where the interface exists and the call is refused | Restarting `bluetooth.service` changes nothing. Confirm with `./scripts/bt-probe.sh`; the only route to ANCS is a controller that can advertise, selected with `tether --bt-adapter <hciN>` -- see 2026-09-03 below || LE never connects and the log repeats `le-connection-abort-by-local` | Something on this side is cancelling the connection. Tether's own cause was a `PreferredBearer` write racing the async connect, fixed; anything else writing that property during a connect will do the same | Check no other Bluetooth tool is driving the same device. The phone is not the cause: `abort-by-local` means the local host cancelled || Messages stopped after turning notification mirroring off | Fixed. The toggle used to restart supervision, which abandoned the MAP and PBAP sessions at obexd instead of removing them, and the iPhone serves one MAP session at a time | Nothing. Mirroring is switched in place now, and a dropped profile supervisor releases its sessions. On an older build, restart `tetherd` |@@ -521,7 +522,8 @@ checks the daemon does not make.| Walked back into range and nothing reconnected for minutes | Fixed. The ANCS advert was gated on the Classic link, and the Classic backoff had no event that ended the absence | Nothing. The advert stays on air whenever LE is down, and an LE link coming up clears the Classic backoff -- see 2026-08-22 || Startup logs `StartNotify not ready yet (InProgress)` for up to a minute | GATT discovery is still running on the new LE link | Nothing. It subscribes on its own. Only treat it as the 2026-08-19 hang if the LE link never comes up || `tether --bt-connection` reports LE and messages up but `Notifications: no`, for hours | Fixed. The LE link was opened by the dial and carries no ANCS. A connected link used to take the solicitation off air, so the phone was never asked for the service | Nothing. The advert goes back on air over a link that has stayed up without ANCS -- see 2026-08-23. To clear it by hand on an older build, `tether --bt-solicit`; do not re-pair, and do not cycle the phone's Bluetooth |-| LE never comes up on a `BR/EDR + LE` bond, the advert is on air, and cycling the phone's Bluetooth changes nothing | The bond is pinned to `PreferredBearer=bredr`, so the inbound LE link the iPhone opens is never accepted | Fixed for new bonds, which are handed back to `le` after pairing. An older bond stays pinned: re-pair it, or set the property by hand with `busctl set-property org.bluez /org/bluez/hci0/dev_<ADDR> org.bluez.Device1 PreferredBearer s le` -- see 2026-08-25 below |+| LE never comes up on a `BR/EDR + LE` bond, the advert is on air, and cycling the phone's Bluetooth changes nothing | The bond is pinned to `PreferredBearer=bredr`, so the inbound LE link the iPhone opens is never accepted | Fixed. The supervisor hands the preference back to `le` once the Classic link has settled, on every bond including older ones. **Re-pairing was never the fix** -- the Classic fallback re-pinned it on the next drop -- see 2026-09-07 below. `tether --bt-diagnostics` reports `preferred_bearer`; by hand it is `busctl set-property org.bluez /org/bluez/hci0/dev_<ADDR> org.bluez.Device1 PreferredBearer s le` |+| `tether --bt-connection` says `LE: yes` and `Notifications: yes`, but nothing arrives, and only toggling Bluetooth on the iPhone fixes it | The LE bearer dropped while Classic stayed up, and BlueZ left `Notifying` set on the ANCS characteristics, so the daemon read the dead link as live and stopped trying to recover it | Fixed. `le_link_up()` now requires `ServicesResolved` alongside `Notifying` -- see 2026-09-07 below. On an older build, toggling the phone's Bluetooth is the only remedy, which is why it was the only one that ever worked || The status says the iPhone is not answering on LE, and its permission is on | The phone's Bluetooth stack is wedged, which the granted permission does not prevent | Turn Bluetooth off and back on **on the iPhone**. Re-pairing and re-toggling the permission do not clear this || The status says this computer is not putting the notification request on air | The adapter reports LE advertising support and BlueZ is holding no advertising instance for it, so the iPhone is never asked for the service | Nothing on the iPhone, and re-pairing will not help. Check `controller` in `tether --bt-diagnostics` and try another with `tether --bt-adapter <hciN>` -- see 2026-09-04 below || Everything connects but `ancs_ready` stays false | Compatibility mode, or iOS has not authorized notification content yet | Check `Mode:` in `tether --bt-status`. In full mode the daemon retries, the first request returns `NotPermitted` until the prompt on the phone is approved |@@ -857,6 +859,11 @@ way a cached attribute does, and it was true throughout the working sessionabove. That is what `Device::le_link_up()` reads, and what anything tearing thebearer down refuses to act against.+**Corrected 2026-09-07: `Notifying` does outlive the link.** When only the LE+bearer drops under a device that is still Classic-connected, BlueZ leaves it set+indefinitely -- measured, see that entry below. `le_link_up()` now pairs it with+`ServicesResolved`.+### 2026-08-19 - The solicitation advert was a one-shotSame hardware. `LEAdvertisingManager1.ActiveInstances` sat at `0` on a machine@@ -2350,3 +2357,174 @@ and PBAP sessions on that bearer. It is one cycle per outage: the drop it causesback through `reset()`, so the spent flag survives `reset()` and clears only when atelephony object is actually seen. A phone that never offers hands-free -- the PipeWirecase above -- is therefore asked exactly once and then left alone.++### 2026-09-07 - The bond re-pinned itself to BR/EDR, and re-pairing could not clear it++| | |+|---|---|+| Controllers | MediaTek, manufacturer 2279, HCI version 13 (Core 5.4); Realtek RTL8852BE, `usb:v0BDApB85C`, manufacturer 93, HCI version 11 (Core 5.2) |+| BlueZ | 5.87 on both |+| Phones | iPhone 17 / iOS 26.6.1; iPhone, iOS 26 |+| Tether | 0.2.24 and 0.2.26 |++[#128](https://github.com/zackb/tether/issues/128), two reporters, one symptom: a+`BR/EDR + LE` bond with `bond_has_le: true`, MAP and PBAP both open, the solicitation+confirmed on air (`advertising_active_instances: 1`), and `LE: no` indefinitely. Both were+shown `LE_PHONE_SILENT_ADVICE` and cycled the iPhone's Bluetooth -- "countless times", one+of them -- and both re-paired repeatedly. Neither was on a dongle. One of the two has two+other machines on which the same phone works.++**The controller is not the variable.** MediaTek and Realtek, two Core versions apart, two+distributions, identical failure. No known-bad-controller list is warranted by this, and the+2026-09-04 decision not to keep one stands.++The variable was `PreferredBearer`, and this side wrote it. `connect_classic()` pinned the+bond so the ACL would come up first:++```cpp+if (!device->le_link_up())+ set_preferred_bearer("bredr");+```++The 2026-08-25 entry fixed the pairing path -- it hands the preference back to `"le"` after+`CLASSIC_SETTLE_SECONDS` -- and named this exact remaining hole: "`connection.cpp` can re-pin+`bredr` on the Classic `Device1.Connect` fallback... it can undo the fix later in a session."+Nothing ever wrote it back. That makes the pin self-reinforcing:++1. Pair. The preference goes back to `"le"` and LE works.+2. Classic drops, for any reason at all.+3. The supervisor retries, LE is down, so the fallback re-pins `"bredr"`.+4. A bond pinned to `bredr` does not accept the inbound LE link the iPhone opens in answer to+ the solicitation, measured as an A/B on 2026-08-25 (`bredr`: down for 180s across twelve+ polls; `le`: up in 12s). LE never comes up.+5. LE being down is the condition in step 3. Every later attempt re-pins.++Which is why re-pairing did nothing for either reporter, and why the troubleshooting row that+told them to re-pair was wrong. One reporter's log is the whole cycle in forty minutes:+`11:35:42 already_paired` -> `settling` -> `soliciting`, first Classic failure at `11:36:52`+(`br-connection-aborted-by-local`), and LE never up again, across a daemon restart.++Fixed in `BearerSupervisor::tick()` rather than in the fallback, because the fallback's reason+for pinning is sound and only the hand-back was missing. It reuses the settle gate that already+guards the outbound LE dial, and takes both guards the earlier entries paid for: never over a+dial in flight (2026-08-19: that write is what produced `le-connection-abort-by-local`, an error+that appears in this reporter's log too), and once per Classic session rather than once per poll.+Older bonds are cleared without a re-pair, which the previous troubleshooting row said was+impossible.++**Two failures of reporting made this cost far more than it should have.**++`PreferredBearer` appeared nowhere -- not in `--bt-connection`, not in `--bt-diagnostics`, not in+`bt-probe.sh`. Two reporters produced about 25KB of logs, a full diagnostics dump and a clean+probe between them, and the one property that decided the outcome was in none of it. It is now+parsed onto `Device`, emitted as `preferred_bearer`, and checked per bonded device by the probe,+which names the `busctl` one-liner when it reads `bredr` with LE down.++`LE_PHONE_SILENT_ADVICE` sent both of them at the phone. Its selection is sound as far as it goes+-- `solicited_since_le_down_` correctly rules out our own advertisement -- but "not us" was then+read as "the phone", and there was a third possibility sitting in a property we were writing+ourselves. A pinned bond now gets its own advice, ahead of that one. This is the second time+(2026-09-04 was the first) that a reason string confidently blamed something the daemon had not+actually checked.++One incidental, from the same log and not the cause of any of the above:++```+[11:47:50] RegisterAdvertisement failed: Le délai d'attente est dépassé+[11:48:11] RegisterAdvertisement failed: GDBus.Error:org.bluez.Error.AlreadyExists+ ... every 30s until 11:50:12+```++`register_with_bluez` leaves `registered_with_bluez` false on any error, and+`unregister_with_bluez` is gated on that flag, so a call that timed out left BlueZ holding a+registration nothing would ever release. It cleared only when the advert's own 180s `Timeout`+expired -- three minutes with nothing on air. A timed-out registration is now released (harmless+if it never took), and an `AlreadyExists` is adopted as the registration it is rather than+discarded. Not raised: the 10s D-Bus timeout on that call. A controller that stalls past ten+seconds is the problem; a longer timeout only stalls the poll loop with it.++### 2026-09-07 - A notify flag outlived its link, and the daemon stopped trying++| | |+|---|---|+| Controller | MediaTek `usb:v0E8Dp0717`, HCI version 13 |+| BlueZ | 5.87 with `--experimental` |+| Phone | iPhone 15 Pro, iOS 26 |++Set up to test the `PreferredBearer` hand-back from the entry above: pin a healthy+bond to `bredr`, drop the LE bearer, watch the supervisor put it right. It did+nothing for 90 seconds. The hand-back never logged, no solicitation went on air,+and `tether --bt-connection` reported `LE: yes` and `Notifications: yes` the+whole time -- on a link that was measurably down.++The two views disagreed completely:++| | Daemon | Bus |+|---|---|---|+| LE | `le_connected: true` | `Bearer.LE1.Connected: false` |+| ANCS | `ancs_ready: true` | `ServicesResolved: false` |++`Device::le_link_up()` is `le_connected || ancs_notifying`, and `ancs_notifying`+is read from the ANCS Notification Source characteristic's `Notifying` property+with nothing else consulted. The 2026-08-19 entry chose that property on the+reasoning that "a notify session needs a live ATT link to exist, so it cannot+outlive the link the way a cached attribute does." **That is not true when only+the LE bearer drops.** `Bearer.LE1.Disconnect` under a device still connected on+BR/EDR leaves everything standing:++| Signal | LE up | LE down |+|---|---|---|+| `Device1.Connected` | true | true |+| `Bearer.LE1.Connected` | true | false |+| `Bearer.BREDR1.Connected` | true | true |+| GATT characteristics under the device | 23 | 23 |+| ANCS notify sources with `Notifying` | 2 | **2** |+| ANCS UUID in `Device1.UUIDs` | present | present |+| **`Device1.ServicesResolved`** | **true** | **false** |++Watched to 38s and again to 90s in a separate run; nothing cleared. So+`le_link_up()` latched true on a dead link, and everything that recovers LE lives+behind `!le_connected` in `BearerSupervisor::tick()` -- the outbound dial, the+ANCS solicitation, and the bearer hand-back. All three were unreachable.+`ancs_soliciting` read false throughout: nothing was on air, and nothing was+asking.++This is the shape of the long-standing "LE drops and two times in three I have to+toggle Bluetooth on the iPhone" complaint on this machine. The daemon was not+failing to recover the link; it did not believe anything was wrong. A phone-side+toggle is the only thing that tears the GATT tree down and clears `Notifying`,+which is exactly why it was the only remedy that ever worked, and why waiting+never did.++`ServicesResolved` is the one property that tracks the ATT link, so it is now+required alongside the notify flag:++```cpp+bool le_link_up() const { return le_connected || (ancs_notifying && services_resolved); }+```++The `ancs_notifying` half stays, because `Bearer.LE1.Connected` still reads false+on a link the phone opened inbound (2026-08-19), and the cached-GATT trap that+sent the original reading there is unchanged -- a cached tree has no notify+session. `ServicesResolved` alone would not do either: 2026-08-23 caught it false+on a live `Bearer.LE1` link, but with no GATT objects at all, so the notify half+is false there and the pair still reads down correctly.++Re-running the same test with both fixes installed:++```+18:02:38 pinned to bredr, Bearer.LE1.Disconnect+18:02:41 bond was pinned to BR/EDR; preference handed back to LE+18:02:43 soliciting ANCS for 180s+ LE, ServicesResolved and PreferredBearer all back inside 5s+```++Against 90 seconds of nothing on the same hardware minutes earlier. That is the+first end-to-end confirmation of the hand-back as well: it could not fire before,+because the branch it lives in was unreachable.++Not settled: `ServicesResolved` on a live *inbound* LE link, where+`Bearer.LE1.Connected` reads false. The unit fixture asserts true on the mechanism+argument that a delivering notify session means discovery completed on that link.+It has not been captured. Anyone who catches that state should read the property+and record it here.diff --git a/po/cs.po b/po/cs.poindex 6bf1119..8d96af8 100644--- a/po/cs.po+++ b/po/cs.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-09-06 13:50-0700\n"+"POT-Creation-Date: 2026-09-07 17:37-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Czech\n"@@ -806,6 +806,15 @@ msgstr """Zkontrolujte řadič pomocí tether --bt-status; jiný lze vybrat pomocí tether ""--bt-adapter."+#: src/core/src/bluetooth/bearer_supervisor.cpp+msgid ""+"This computer had pinned the bond to BR/EDR, which refuses the LE link the "+"iPhone opens to carry notifications. That is being undone now; LE should "+"come up within a minute. Nothing on the iPhone changes this and re-pairing "+"will not either."+msgstr ""+"Tento počítač připnul párování na BR/EDR, což odmítá spojení LE, které iPhone otevírá pro přenos oznámení. Nyní se to ruší; LE by se mělo navázat do minuty. Nic na iPhonu to nezmění a opětovné spárování také ne."+#: src/core/src/bluetooth/bearer_supervisor.cppmsgid """The iPhone is not answering on LE. Its Bluetooth is wedged on its own side: "diff --git a/po/de.po b/po/de.poindex 7672de1..1d65fce 100644--- a/po/de.po+++ b/po/de.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-09-06 13:50-0700\n"+"POT-Creation-Date: 2026-09-07 17:37-0700\n""PO-Revision-Date: 2026-08-22\n""Last-Translator: Tether project\n""Language-Team: German\n"@@ -814,6 +814,15 @@ msgstr """noch ein erneutes Koppeln etwas. Prüfen Sie den Controller mit tether --bt-""status; ein anderer lässt sich mit tether --bt-adapter auswählen."+#: src/core/src/bluetooth/bearer_supervisor.cpp+msgid ""+"This computer had pinned the bond to BR/EDR, which refuses the LE link the "+"iPhone opens to carry notifications. That is being undone now; LE should "+"come up within a minute. Nothing on the iPhone changes this and re-pairing "+"will not either."+msgstr ""+"Dieser Computer hatte die Kopplung auf BR/EDR festgelegt, wodurch die LE-Verbindung abgelehnt wird, die das iPhone für Benachrichtigungen öffnet. Das wird gerade rückgängig gemacht; LE sollte innerhalb einer Minute zustande kommen. Daran ändert weder etwas am iPhone noch ein erneutes Koppeln etwas."+#: src/core/src/bluetooth/bearer_supervisor.cppmsgid """The iPhone is not answering on LE. Its Bluetooth is wedged on its own side: "diff --git a/po/es.po b/po/es.poindex 818bfa0..6bdbed7 100644--- a/po/es.po+++ b/po/es.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-09-06 13:50-0700\n"+"POT-Creation-Date: 2026-09-07 17:37-0700\n""PO-Revision-Date: 2026-08-22\n""Last-Translator: Tether project\n""Language-Team: Spanish\n"@@ -811,6 +811,15 @@ msgstr """emparejar tampoco. Compruebe la controladora con tether --bt-status; se ""puede elegir otra con tether --bt-adapter."+#: src/core/src/bluetooth/bearer_supervisor.cpp+msgid ""+"This computer had pinned the bond to BR/EDR, which refuses the LE link the "+"iPhone opens to carry notifications. That is being undone now; LE should "+"come up within a minute. Nothing on the iPhone changes this and re-pairing "+"will not either."+msgstr ""+"Este equipo había fijado el emparejamiento en BR/EDR, lo que rechaza el enlace LE que el iPhone abre para transportar las notificaciones. Se está deshaciendo ahora; LE debería establecerse en menos de un minuto. Nada en el iPhone cambia esto, y volver a emparejar tampoco."+#: src/core/src/bluetooth/bearer_supervisor.cppmsgid """The iPhone is not answering on LE. Its Bluetooth is wedged on its own side: "diff --git a/po/fr.po b/po/fr.poindex 025d620..273fc0a 100644--- a/po/fr.po+++ b/po/fr.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-09-06 13:50-0700\n"+"POT-Creation-Date: 2026-09-07 17:37-0700\n""PO-Revision-Date: 2026-08-22\n""Last-Translator: Tether project\n""Language-Team: French\n"@@ -816,6 +816,15 @@ msgstr """soit, et refaire l'appairage non plus. Vérifiez le contrôleur avec tether --""bt-status ; on peut en choisir un autre avec tether --bt-adapter."+#: src/core/src/bluetooth/bearer_supervisor.cpp+msgid ""+"This computer had pinned the bond to BR/EDR, which refuses the LE link the "+"iPhone opens to carry notifications. That is being undone now; LE should "+"come up within a minute. Nothing on the iPhone changes this and re-pairing "+"will not either."+msgstr ""+"Cet ordinateur avait épinglé l'appairage sur BR/EDR, ce qui refuse le lien LE que l'iPhone ouvre pour transporter les notifications. C'est en train d'être corrigé ; le LE devrait s'établir en moins d'une minute. Rien sur l'iPhone n'y change quoi que ce soit, et refaire l'appairage non plus."+#: src/core/src/bluetooth/bearer_supervisor.cppmsgid """The iPhone is not answering on LE. Its Bluetooth is wedged on its own side: "diff --git a/po/it.po b/po/it.poindex 57640ee..b09f314 100644--- a/po/it.po+++ b/po/it.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-09-06 13:50-0700\n"+"POT-Creation-Date: 2026-09-07 17:37-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Italian\n"@@ -811,6 +811,15 @@ msgstr """nemmeno rifare l'associazione. Controlla il controller con tether --bt-""status; se ne può scegliere un altro con tether --bt-adapter."+#: src/core/src/bluetooth/bearer_supervisor.cpp+msgid ""+"This computer had pinned the bond to BR/EDR, which refuses the LE link the "+"iPhone opens to carry notifications. That is being undone now; LE should "+"come up within a minute. Nothing on the iPhone changes this and re-pairing "+"will not either."+msgstr ""+"Questo computer aveva bloccato l'associazione su BR/EDR, il che rifiuta il collegamento LE che l'iPhone apre per trasportare le notifiche. Ora viene annullato; LE dovrebbe attivarsi entro un minuto. Nulla sull'iPhone cambia questo, e nemmeno rifare l'associazione."+#: src/core/src/bluetooth/bearer_supervisor.cppmsgid """The iPhone is not answering on LE. Its Bluetooth is wedged on its own side: "diff --git a/po/ja.po b/po/ja.poindex 7c0a262..4a4c34a 100644--- a/po/ja.po+++ b/po/ja.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-09-06 13:50-0700\n"+"POT-Creation-Date: 2026-09-07 17:37-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Japanese\n"@@ -795,6 +795,15 @@ msgstr """わりません。tether --bt-status でコントローラーを確認してください。別のもの""は tether --bt-adapter で選べます。"+#: src/core/src/bluetooth/bearer_supervisor.cpp+msgid ""+"This computer had pinned the bond to BR/EDR, which refuses the LE link the "+"iPhone opens to carry notifications. That is being undone now; LE should "+"come up within a minute. Nothing on the iPhone changes this and re-pairing "+"will not either."+msgstr ""+"このコンピュータがペアリングを BR/EDR に固定していたため、iPhone が通知を運ぶために開く LE リンクが拒否されています。現在それを解除しています。LE は 1 分以内に接続するはずです。iPhone 側で変えられることはなく、ペアリングし直しても変わりません。"+#: src/core/src/bluetooth/bearer_supervisor.cppmsgid """The iPhone is not answering on LE. Its Bluetooth is wedged on its own side: "diff --git a/po/ko.po b/po/ko.poindex 7ac7f5d..7818e87 100644--- a/po/ko.po+++ b/po/ko.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-09-06 13:50-0700\n"+"POT-Creation-Date: 2026-09-07 17:37-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Korean\n"@@ -787,6 +787,15 @@ msgstr """--bt-status로 컨트롤러를 확인하고, tether --bt-adapter로 다른 것을 선택할 수 ""있습니다."+#: src/core/src/bluetooth/bearer_supervisor.cpp+msgid ""+"This computer had pinned the bond to BR/EDR, which refuses the LE link the "+"iPhone opens to carry notifications. That is being undone now; LE should "+"come up within a minute. Nothing on the iPhone changes this and re-pairing "+"will not either."+msgstr ""+"이 컴퓨터가 페어링을 BR/EDR로 고정해 두어, iPhone이 알림을 전달하려고 여는 LE 링크가 거부되고 있습니다. 지금 되돌리는 중이며, LE는 1분 이내에 연결될 것입니다. iPhone에서 바꿀 수 있는 것은 없으며, 다시 페어링해도 마찬가지입니다."+#: src/core/src/bluetooth/bearer_supervisor.cppmsgid """The iPhone is not answering on LE. Its Bluetooth is wedged on its own side: "diff --git a/po/nl.po b/po/nl.poindex 0cf8b98..f45a67e 100644--- a/po/nl.po+++ b/po/nl.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-09-06 13:50-0700\n"+"POT-Creation-Date: 2026-09-07 17:37-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Dutch\n"@@ -804,6 +804,15 @@ msgstr """koppelen ook niet. Controleer de controller met tether --bt-status; een ""andere kies je met tether --bt-adapter."+#: src/core/src/bluetooth/bearer_supervisor.cpp+msgid ""+"This computer had pinned the bond to BR/EDR, which refuses the LE link the "+"iPhone opens to carry notifications. That is being undone now; LE should "+"come up within a minute. Nothing on the iPhone changes this and re-pairing "+"will not either."+msgstr ""+"Deze computer had de koppeling vastgezet op BR/EDR, waardoor de LE-verbinding die de iPhone opent voor meldingen wordt geweigerd. Dat wordt nu ongedaan gemaakt; LE zou binnen een minuut tot stand moeten komen. Niets op de iPhone verandert dit, en opnieuw koppelen ook niet."+#: src/core/src/bluetooth/bearer_supervisor.cppmsgid """The iPhone is not answering on LE. Its Bluetooth is wedged on its own side: "diff --git a/po/pl.po b/po/pl.poindex 4ae0187..ed0d6ff 100644--- a/po/pl.po+++ b/po/pl.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-09-06 13:50-0700\n"+"POT-Creation-Date: 2026-09-07 17:37-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Polish\n"@@ -810,6 +810,15 @@ msgstr """parowanie także nie. Sprawdź kontroler poleceniem tether --bt-status; inny ""można wybrać poleceniem tether --bt-adapter."+#: src/core/src/bluetooth/bearer_supervisor.cpp+msgid ""+"This computer had pinned the bond to BR/EDR, which refuses the LE link the "+"iPhone opens to carry notifications. That is being undone now; LE should "+"come up within a minute. Nothing on the iPhone changes this and re-pairing "+"will not either."+msgstr ""+"Ten komputer przypiął powiązanie do BR/EDR, co odrzuca połączenie LE otwierane przez iPhone'a do przesyłania powiadomień. Właśnie jest to cofane; LE powinno pojawić się w ciągu minuty. Nic w iPhonie tego nie zmieni, ponowne parowanie również nie."+#: src/core/src/bluetooth/bearer_supervisor.cppmsgid """The iPhone is not answering on LE. Its Bluetooth is wedged on its own side: "diff --git a/po/pt_BR.po b/po/pt_BR.poindex 0adb5cf..ac99334 100644--- a/po/pt_BR.po+++ b/po/pt_BR.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-09-06 13:50-0700\n"+"POT-Creation-Date: 2026-09-07 17:37-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Brazilian Portuguese\n"@@ -807,6 +807,15 @@ msgstr """pareamento também não. Verifique a controladora com tether --bt-status; ""outra pode ser escolhida com tether --bt-adapter."+#: src/core/src/bluetooth/bearer_supervisor.cpp+msgid ""+"This computer had pinned the bond to BR/EDR, which refuses the LE link the "+"iPhone opens to carry notifications. That is being undone now; LE should "+"come up within a minute. Nothing on the iPhone changes this and re-pairing "+"will not either."+msgstr ""+"Este computador havia fixado o pareamento em BR/EDR, o que recusa o enlace LE que o iPhone abre para transportar as notificações. Isso está sendo desfeito agora; o LE deve subir em menos de um minuto. Nada no iPhone muda isso, e parear novamente também não."+#: src/core/src/bluetooth/bearer_supervisor.cppmsgid """The iPhone is not answering on LE. Its Bluetooth is wedged on its own side: "diff --git a/po/ru.po b/po/ru.poindex ebfde64..3d7c63e 100644--- a/po/ru.po+++ b/po/ru.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-09-06 13:50-0700\n"+"POT-Creation-Date: 2026-09-07 17:37-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Russian\n"@@ -812,6 +812,15 @@ msgstr """сопряжение тоже. Проверьте контроллер командой tether --bt-status; другой ""можно выбрать командой tether --bt-adapter."+#: src/core/src/bluetooth/bearer_supervisor.cpp+msgid ""+"This computer had pinned the bond to BR/EDR, which refuses the LE link the "+"iPhone opens to carry notifications. That is being undone now; LE should "+"come up within a minute. Nothing on the iPhone changes this and re-pairing "+"will not either."+msgstr ""+"Этот компьютер закрепил сопряжение за BR/EDR, из-за чего отклоняется LE-соединение, которое iPhone открывает для передачи уведомлений. Сейчас это отменяется; LE должно установиться в течение минуты. Ничто на iPhone этого не изменит, повторное сопряжение тоже."+#: src/core/src/bluetooth/bearer_supervisor.cppmsgid """The iPhone is not answering on LE. Its Bluetooth is wedged on its own side: "diff --git a/po/sv.po b/po/sv.poindex fa7ce58..2470db3 100644--- a/po/sv.po+++ b/po/sv.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-09-06 13:50-0700\n"+"POT-Creation-Date: 2026-09-07 17:37-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Swedish\n"@@ -803,6 +803,15 @@ msgstr """nytt gör det inte heller. Kontrollera styrkretsen med tether --bt-status; en ""annan kan väljas med tether --bt-adapter."+#: src/core/src/bluetooth/bearer_supervisor.cpp+msgid ""+"This computer had pinned the bond to BR/EDR, which refuses the LE link the "+"iPhone opens to carry notifications. That is being undone now; LE should "+"come up within a minute. Nothing on the iPhone changes this and re-pairing "+"will not either."+msgstr ""+"Den här datorn hade låst kopplingen till BR/EDR, vilket avvisar den LE-länk som iPhone öppnar för att bära aviseringar. Det håller på att ångras nu; LE bör komma upp inom en minut. Inget på iPhone ändrar detta, och att koppla om gör det inte heller."+#: src/core/src/bluetooth/bearer_supervisor.cppmsgid """The iPhone is not answering on LE. Its Bluetooth is wedged on its own side: "diff --git a/po/tether.pot b/po/tether.potindex 59d15dd..97ea5eb 100644--- a/po/tether.pot+++ b/po/tether.pot@@ -6,9 +6,9 @@#, fuzzymsgid ""msgstr ""-"Project-Id-Version: tether 0.2.26\n"+"Project-Id-Version: tether 0.2.27\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-09-06 13:50-0700\n"+"POT-Creation-Date: 2026-09-07 17:37-0700\n""PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n""Last-Translator: FULL NAME <EMAIL@ADDRESS>\n""Language-Team: LANGUAGE <[email protected]>\n"@@ -737,6 +737,14 @@ msgid """another one can be selected with tether --bt-adapter."msgstr ""+#: src/core/src/bluetooth/bearer_supervisor.cpp+msgid ""+"This computer had pinned the bond to BR/EDR, which refuses the LE link the "+"iPhone opens to carry notifications. That is being undone now; LE should "+"come up within a minute. Nothing on the iPhone changes this and re-pairing "+"will not either."+msgstr ""+#: src/core/src/bluetooth/bearer_supervisor.cppmsgid """The iPhone is not answering on LE. Its Bluetooth is wedged on its own side: "diff --git a/po/tr.po b/po/tr.poindex 1de7b2f..3abc9fe 100644--- a/po/tr.po+++ b/po/tr.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-09-06 13:50-0700\n"+"POT-Creation-Date: 2026-09-07 17:37-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Turkish\n"@@ -804,6 +804,15 @@ msgstr """yeniden eşleştirme de değiştirmez. Denetleyiciyi tether --bt-status ile ""denetleyin; başka biri tether --bt-adapter ile seçilebilir."+#: src/core/src/bluetooth/bearer_supervisor.cpp+msgid ""+"This computer had pinned the bond to BR/EDR, which refuses the LE link the "+"iPhone opens to carry notifications. That is being undone now; LE should "+"come up within a minute. Nothing on the iPhone changes this and re-pairing "+"will not either."+msgstr ""+"Bu bilgisayar eşleşmeyi BR/EDR'ye sabitlemişti; bu da iPhone'un bildirimleri taşımak için açtığı LE bağlantısını reddediyor. Bu şimdi geri alınıyor; LE bir dakika içinde kurulmalı. iPhone'da hiçbir şey bunu değiştirmez, yeniden eşleştirmek de değiştirmez."+#: src/core/src/bluetooth/bearer_supervisor.cppmsgid """The iPhone is not answering on LE. Its Bluetooth is wedged on its own side: "diff --git a/po/uk.po b/po/uk.poindex e4d7c88..94550bd 100644--- a/po/uk.po+++ b/po/uk.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-09-06 13:50-0700\n"+"POT-Creation-Date: 2026-09-07 17:37-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Ukrainian\n"@@ -812,6 +812,15 @@ msgstr """теж. Перевірте контролер командою tether --bt-status; інший можна вибрати ""командою tether --bt-adapter."+#: src/core/src/bluetooth/bearer_supervisor.cpp+msgid ""+"This computer had pinned the bond to BR/EDR, which refuses the LE link the "+"iPhone opens to carry notifications. That is being undone now; LE should "+"come up within a minute. Nothing on the iPhone changes this and re-pairing "+"will not either."+msgstr ""+"Цей комп'ютер закріпив спарювання за BR/EDR, через що відхиляється LE-з'єднання, яке iPhone відкриває для передавання сповіщень. Зараз це скасовується; LE має встановитися протягом хвилини. Ніщо на iPhone цього не змінить, повторне спарювання також."+#: src/core/src/bluetooth/bearer_supervisor.cppmsgid """The iPhone is not answering on LE. Its Bluetooth is wedged on its own side: "diff --git a/po/zh_CN.po b/po/zh_CN.poindex 200515b..6d2f017 100644--- a/po/zh_CN.po+++ b/po/zh_CN.po@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: tether\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-09-06 13:50-0700\n"+"POT-Creation-Date: 2026-09-07 17:37-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Simplified Chinese\n"@@ -774,6 +774,15 @@ msgstr """上做任何操作都无法改变这一点,重新配对也不行。用 tether --bt-status 检查控制""器;可以用 tether --bt-adapter 选择另一个。"+#: src/core/src/bluetooth/bearer_supervisor.cpp+msgid ""+"This computer had pinned the bond to BR/EDR, which refuses the LE link the "+"iPhone opens to carry notifications. That is being undone now; LE should "+"come up within a minute. Nothing on the iPhone changes this and re-pairing "+"will not either."+msgstr ""+"这台电脑此前把配对固定在了 BR/EDR,因而拒绝了 iPhone 为传送通知而打开的 LE 链路。现在正在撤销;LE 应在一分钟内建立。在 iPhone 上做任何操作都改变不了这一点,重新配对也不行。"+#: src/core/src/bluetooth/bearer_supervisor.cppmsgid """The iPhone is not answering on LE. Its Bluetooth is wedged on its own side: "diff --git a/scripts/bt-probe.sh b/scripts/bt-probe.shindex 4acabb3..02f60b9 100755--- a/scripts/bt-probe.sh+++ b/scripts/bt-probe.sh@@ -226,6 +226,41 @@ elsefifi+# --- bonded devices ------------------------------------------------------+# A bond pinned to PreferredBearer=bredr refuses the inbound LE link the iPhone+# opens in answer to the ANCS solicitation, so notifications never arrive while+# messages and contacts look perfect.+echo+echo "Bonded devices"++dev_paths=$(busctl --system tree org.bluez 2>/dev/null |+ grep -o "$ADAPTER_PATH/dev_[0-9A-F_]*$" | sort -u)++if [[ -z $dev_paths ]]; then+ note "none bonded on $ADAPTER"+else+ while read -r dev; do+ [[ -n $dev ]] || continue+ devprop() {+ busctl --system get-property org.bluez "$dev" "$1" "$2" 2>/dev/null |+ awk '{ $1=""; sub(/^ /,""); gsub(/"/,""); print }'+ }+ [[ $(devprop org.bluez.Device1 Paired) == true ]] || continue+ alias=$(devprop org.bluez.Device1 Alias)+ bearer=$(devprop org.bluez.Device1 PreferredBearer)+ le_conn=$(devprop org.bluez.Bearer.LE1 Connected)++ if [[ -z $bearer ]]; then+ note "$alias — PreferredBearer not exposed by this BlueZ"+ elif [[ $bearer == bredr && $le_conn != true ]]; then+ warn "$alias — PreferredBearer=bredr with LE down; the bond is refusing the LE link"+ note "Clear it: busctl set-property org.bluez $dev org.bluez.Device1 PreferredBearer s le"+ else+ ok "$alias — PreferredBearer=$bearer"+ fi+ done <<<"$dev_paths"+fi+# --- conflicts -----------------------------------------------------------# The iPhone serves exactly one MAP session at a time. Any other local process# holding it makes Tether's MAP connect fail with "Connection refused (111)",diff --git a/src/cli/main.cpp b/src/cli/main.cppindex e505fb5..4a380b5 100644--- a/src/cli/main.cpp+++ b/src/cli/main.cpp@@ -484,6 +484,8 @@ static int print_bt_devices(tether::Client& client) {add("pbap");if (d.value("ancs", false))add("ancs");+ if (d.value("preferred_bearer", std::string()) == "bredr" && !d.value("le_connected", false))+ add("pinned-bredr");fprintf(stdout," %-18s %-24s %s%s\n",diff --git a/src/core/include/tether/bluetooth/bearer_supervisor.hpp b/src/core/include/tether/bluetooth/bearer_supervisor.hppindex 98028f2..e264a8a 100644--- a/src/core/include/tether/bluetooth/bearer_supervisor.hpp+++ b/src/core/include/tether/bluetooth/bearer_supervisor.hpp@@ -54,6 +54,11 @@ namespace tether::bluetooth {virtual bool classic_connected() const = 0;virtual bool le_bearer_available() const = 0;virtual bool le_connected() const = 0;+ // Device1.PreferredBearer, or empty when BlueZ does not expose it.+ virtual std::string preferred_bearer() const = 0;+ // Writes Device1.PreferredBearer. Never while a connect is in flight:+ // that cancels it as le-connection-abort-by-local.+ virtual void set_preferred_bearer(const std::string& bearer) = 0;virtual ConnectResult connect_classic(std::string& err) = 0;// Must not block: BlueZ keeps working on a connect after a synchronous@@ -131,6 +136,8 @@ namespace tether::bluetooth {int64_t le_down_since_ = -1;// Whether the solicitation has been observed on air since LE went down.bool solicited_since_le_down_ = false;+ // Whether the bearer preference has been handed back to LE this Classic session.+ bool bearer_handed_back_ = false;int64_t next_classic_attempt_ = 0;};diff --git a/src/core/include/tether/bluetooth/objects.hpp b/src/core/include/tether/bluetooth/objects.hppindex d39102a..c788eb8 100644--- a/src/core/include/tether/bluetooth/objects.hpp+++ b/src/core/include/tether/bluetooth/objects.hpp@@ -57,6 +57,12 @@ namespace tether::bluetooth {bool ancs_notifying = false;+ // Device1.ServicesResolved+ bool services_resolved = false;++ // Device1.PreferredBearer: "le", "bredr" or "last-seen".+ std::string preferred_bearer;+bool has_le_bearer = false;bool le_paired = false;bool le_bonded = false;@@ -69,7 +75,7 @@ namespace tether::bluetooth {bool classic_state_known = false;bool classic_link_up() const { return classic_state_known ? classic_connected : connected; }- bool le_link_up() const { return le_connected || ancs_notifying; }+ bool le_link_up() const { return le_connected || (ancs_notifying && services_resolved); }bool has_uuid(const std::string& uuid) const;bool supports_map() const { return has_uuid(UUID_MAP_MAS); }diff --git a/src/core/src/bluetooth/advert.cpp b/src/core/src/bluetooth/advert.cppindex 0b78913..0ed7ddd 100644--- a/src/core/src/bluetooth/advert.cpp+++ b/src/core/src/bluetooth/advert.cpp@@ -166,10 +166,25 @@ namespace tether::bluetooth {&error);if (!reply) {const std::string message = error && error->message ? error->message : "unknown error";+ const bool already = message.find("AlreadyExists") != std::string::npos;+ const bool timed_out = g_error_matches(error, G_IO_ERROR, G_IO_ERROR_TIMED_OUT);+ g_clear_error(&error);++ if (already) {+ state_->registered_with_bluez = true;+ debug::log(INFO, "bluetooth: ANCS solicitation was already registered; adopted it");+ return true;+ }+debug::log(ERR, "bluetooth: RegisterAdvertisement failed: {}", message);if (failure)*failure = message;- g_clear_error(&error);++ // A call that timed out has an unknown outcome.+ if (timed_out) {+ state_->registered_with_bluez = true;+ unregister_with_bluez();+ }return false;}g_variant_unref(reply);diff --git a/src/core/src/bluetooth/bearer_supervisor.cpp b/src/core/src/bluetooth/bearer_supervisor.cppindex fb446f8..c985fd9 100644--- a/src/core/src/bluetooth/bearer_supervisor.cpp+++ b/src/core/src/bluetooth/bearer_supervisor.cpp@@ -67,6 +67,11 @@ namespace tether::bluetooth {"the service. Nothing on the iPhone changes this and re-pairing will not either. Check the ""controller with tether --bt-status; another one can be selected with tether --bt-adapter.");+ constexpr const char* LE_BOND_PINNED_ADVICE =+ N_("This computer had pinned the bond to BR/EDR, which refuses the LE link the iPhone opens to carry "+ "notifications. That is being undone now; LE should come up within a minute. Nothing on the iPhone "+ "changes this and re-pairing will not either.");+constexpr const char* LE_PHONE_SILENT_ADVICE =N_("The iPhone is not answering on LE. Its Bluetooth is wedged on its own side: turn Bluetooth off ""and back on on the iPhone, which clears this even when Share System Notifications is already on. "@@ -87,6 +92,7 @@ namespace tether::bluetooth {le_down_since_ = -1;solicited_since_le_down_ = false;classic_connected_since_ = -1;+ bearer_handed_back_ = false;next_classic_attempt_ = 0;status_.classic_backoff = 0;status_.le_dialling = ops_.le_connect_outstanding();@@ -141,6 +147,7 @@ namespace tether::bluetooth {// rides LE alone, so calling it down here would switch notification// mirroring off for a phone that is still delivering notifications.classic_connected_since_ = -1;+ bearer_handed_back_ = false;const int ceiling = status_.le_connected ? LE_UP_CLASSIC_BACKOFF_MAX_SECONDS : BEARER_BACKOFF_MAX_SECONDS;@@ -221,6 +228,13 @@ namespace tether::bluetooth {const bool settled =classic_connected_since_ >= 0 && now - classic_connected_since_ >= BEARER_SETTLE_SECONDS;+ const bool pinned = ops_.preferred_bearer() == "bredr";+ if (pinned && settled && !bearer_handed_back_ && !ops_.le_connect_outstanding()) {+ ops_.set_preferred_bearer("le");+ bearer_handed_back_ = true;+ debug::log(INFO, "bluetooth: bond was pinned to BR/EDR; preference handed back to LE");+ }+if (!le_dial_spent_ && settled && !ops_.le_connect_outstanding()) {std::string err;const ConnectResult result = classify(ops_.connect_le(err), err);@@ -235,6 +249,7 @@ namespace tether::bluetooth {const bool le_silent = le_down_since_ >= 0 && now - le_down_since_ >= LE_SILENT_SECONDS;status_.reason = le_silent && !solicited_since_le_down_ ? _(LE_NEVER_SOLICITED_ADVICE)+ : le_silent && pinned ? _(LE_BOND_PINNED_ADVICE): le_silent ? _(LE_PHONE_SILENT_ADVICE): _("Connected. Waiting for the iPhone to open the LE link that carries ""notifications. If it does not, open Settings > Bluetooth > (i) on the "diff --git a/src/core/src/bluetooth/connection.cpp b/src/core/src/bluetooth/connection.cppindex adc879c..d2542b1 100644--- a/src/core/src/bluetooth/connection.cpp+++ b/src/core/src/bluetooth/connection.cpp@@ -317,7 +317,12 @@ namespace tether::bluetooth {return device && device->le_link_up();}- void set_preferred_bearer(const std::string& bearer) {+ std::string preferred_bearer() const override {+ auto device = lookup();+ return device ? device->preferred_bearer : std::string();+ }++ void set_preferred_bearer(const std::string& bearer) override {auto device = lookup();if (!device)return;diff --git a/src/core/src/bluetooth/diagnostics.cpp b/src/core/src/bluetooth/diagnostics.cppindex 2a35d74..e80c3d3 100644--- a/src/core/src/bluetooth/diagnostics.cpp+++ b/src/core/src/bluetooth/diagnostics.cpp@@ -10,6 +10,7 @@#include <algorithm>#include <chrono>#include <cstdlib>+#include <cstring>#include <deque>#include <functional>#include <glib.h>@@ -278,6 +279,14 @@ namespace tether::bluetooth {report["group_messages_enabled"] = config.group_messages_enabled;report["enabled"] = config.enabled;report["ancs_soliciting"] = ancs_solicitation_active();+ // Device1.PreferredBearer for the selected bond. A "bredr" here with LE+ // down is the problem.+ report["preferred_bearer"] = "";+ if (g_bluez && !config.device_address.empty()) {+ for (const auto& device : g_bluez->snapshot().devices)+ if (strcasecmp(device.address.c_str(), config.device_address.c_str()) == 0)+ report["preferred_bearer"] = device.preferred_bearer;+ }report["retention"] = to_string(config.retention);report["retention_ready"] = secret::have_key();report["status"] = redactor.value(status);diff --git a/src/core/src/bluetooth/objects.cpp b/src/core/src/bluetooth/objects.cppindex c73aea9..a830742 100644--- a/src/core/src/bluetooth/objects.cpp+++ b/src/core/src/bluetooth/objects.cpp@@ -211,6 +211,8 @@ namespace tether::bluetooth {d.trusted = get_bool(props, "Trusted");d.connected = get_bool(props, "Connected");d.uuids = get_strv(props, "UUIDs");+ d.preferred_bearer = get_string(props, "PreferredBearer");+ d.services_resolved = get_bool(props, "ServicesResolved");g_variant_unref(props);if (GVariant* le = g_variant_lookup_value(ifaces, IFACE_BEARER_LE, G_VARIANT_TYPE("a{sv}"))) {@@ -572,10 +574,12 @@ namespace tether::bluetooth {{"le_bearer", d.has_le_bearer},{"le_bonded", d.le_bonded},{"le_connected", d.le_connected},+ {"preferred_bearer", d.preferred_bearer},{"map", d.supports_map()},{"pbap", d.supports_pbap()},{"ancs", d.supports_ancs()},{"ancs_notifying", d.ancs_notifying},+ {"services_resolved", d.services_resolved},{"iphone", d.looks_like_iphone()},};}diff --git a/test/test_bluetooth_objects.cpp b/test/test_bluetooth_objects.cppindex a4ebe38..a8094f6 100644--- a/test/test_bluetooth_objects.cpp+++ b/test/test_bluetooth_objects.cpp@@ -417,7 +417,8 @@ TEST(Capability, ClassicOnlyBondOnANonPhoneIsNotReported) {TEST(DeviceParsing, AnAncsNotifySessionProvesTheLeLinkIsUp) {Payload p(join(ADAPTER_FULL, R"({'/org/bluez/hci0/dev_60_57_C8_30_6A_F7': {- 'org.bluez.Device1': { 'Paired': <true>, 'Bonded': <true>, 'Connected': <true> },+ 'org.bluez.Device1': { 'Paired': <true>, 'Bonded': <true>, 'Connected': <true>,+ 'ServicesResolved': <true> },'org.bluez.Bearer.LE1': { 'Paired': <true>, 'Bonded': <true>, 'Connected': <false> }},'/org/bluez/hci0/dev_60_57_C8_30_6A_F7/service004f/char0050': {@@ -433,6 +434,34 @@ TEST(DeviceParsing, AnAncsNotifySessionProvesTheLeLinkIsUp) {EXPECT_TRUE(objects.devices[0].le_link_up()) << "a live ANCS session was reported as no LE link";}+// Measured on this hardware: Bearer.LE1.Disconnect under a device still Classic+// connected leaves the whole GATT tree in place -- 23 characteristics, both ANCS+// notify sources still Notifying, the ANCS UUID still on Device1 -- for as long as+// it was watched. Only ServicesResolved goes with the ATT link. Reading Notifying+// alone latched le_link_up() true on a dead link, which took the supervisor's LE+// recovery, the solicitation and the outbound dial all off the table.+TEST(DeviceParsing, ANotifyFlagLeftOverADeadLeBearerIsNotALink) {+ Payload p(join(ADAPTER_FULL, R"({+ '/org/bluez/hci0/dev_60_57_C8_30_6A_F7': {+ 'org.bluez.Device1': { 'Paired': <true>, 'Bonded': <true>, 'Connected': <true>,+ 'ServicesResolved': <false> },+ 'org.bluez.Bearer.LE1': { 'Paired': <true>, 'Bonded': <true>, 'Connected': <false> },+ 'org.bluez.Bearer.BREDR1': { 'Connected': <true> }+ },+ '/org/bluez/hci0/dev_60_57_C8_30_6A_F7/service004f/char0050': {+ 'org.bluez.GattCharacteristic1': { 'UUID': <'9FBF120D-6301-42D9-8C58-25E699A21DBD'>, 'Notifying': <true> }+ }+ })")+ .c_str());+ auto objects = parse_managed_objects(p.v);++ ASSERT_EQ(objects.devices.size(), 1u);+ EXPECT_TRUE(objects.devices[0].ancs_notifying) << "the fixture is not reproducing the stale flag";+ EXPECT_FALSE(objects.devices[0].services_resolved);+ EXPECT_FALSE(objects.devices[0].le_link_up()) << "a stale notify flag was read as a live LE link";+ EXPECT_TRUE(objects.devices[0].classic_link_up()) << "Classic is up throughout; only LE dropped";+}+// The characteristic has to belong to this device. A sibling device's GATT tree// saying nothing about ours is the whole reason the paths are matched.TEST(DeviceParsing, AnAncsNotifySessionBelongsToOneDeviceOnly) {diff --git a/test/test_bluetooth_supervisor.cpp b/test/test_bluetooth_supervisor.cppindex 9fa959a..0b71c50 100644--- a/test/test_bluetooth_supervisor.cpp+++ b/test/test_bluetooth_supervisor.cpp@@ -28,6 +28,16 @@ namespace {bool le_bearer_available() const override { return le_available; }bool le_connected() const override { return le; }+ // BlueZ's default is "last-seen"; only the pin the Classic fallback+ // writes matters here.+ std::string bearer_pref = "last-seen";+ std::vector<std::string> bearer_writes;+ std::string preferred_bearer() const override { return bearer_pref; }+ void set_preferred_bearer(const std::string& bearer) override {+ bearer_pref = bearer;+ bearer_writes.push_back(bearer);+ }+std::string classic_error = "br/edr refused";std::string le_error = "le refused";@@ -347,6 +357,71 @@ TEST(BearerSupervisor, BlamesTheAdapterWhenNothingWasEverSolicited) {EXPECT_EQ(sup.status().reason.find("turn Bluetooth off"), std::string::npos) << "blames the phone";}+// #128: the Classic fallback pins the bond to bredr, and a bond left pinned+// refuses the inbound LE link the iPhone opens. Nothing used to hand it back, so+// the pin outlived every re-pair and LE stayed down for good.+TEST(BearerSupervisor, HandsTheBearerPreferenceBackToLeOnceClassicSettles) {+ FakeBearer ops;+ ops.le_succeeds = false;+ ops.bearer_pref = "bredr";+ BearerSupervisor sup(ops, true);++ int64_t now = 0;+ sup.tick(now);+ sup.tick(++now);+ EXPECT_TRUE(ops.bearer_writes.empty()) << "wrote before the Classic link settled";++ now += BEARER_SETTLE_SECONDS;+ sup.tick(now);+ EXPECT_EQ(ops.bearer_writes, std::vector<std::string>{"le"});++ // One write per Classic session, not one per poll.+ sup.tick(++now);+ sup.tick(++now);+ EXPECT_EQ(ops.bearer_writes.size(), 1u);+}++// Writing the property under a dial in flight is what cancelled the connect as+// le-connection-abort-by-local.+TEST(BearerSupervisor, DoesNotWriteTheBearerPreferenceOverADialInFlight) {+ FakeBearer ops;+ ops.le_succeeds = false;+ ops.bearer_pref = "bredr";+ ops.outstanding = true;+ BearerSupervisor sup(ops, true);++ int64_t now = 0;+ sup.tick(now);+ sup.tick(++now);+ now += BEARER_SETTLE_SECONDS;+ sup.tick(now);+ EXPECT_TRUE(ops.bearer_writes.empty()) << "wrote over an outstanding connect";++ ops.outstanding = false;+ sup.tick(++now);+ EXPECT_EQ(ops.bearer_writes, std::vector<std::string>{"le"});+}++// A bond still reading bredr after the silence is this computer's doing. Sending+// that user to cycle Bluetooth on the iPhone is the other #128 dead end.+TEST(BearerSupervisor, BlamesThePinnedBondRatherThanThePhone) {+ FakeBearer ops;+ ops.le_succeeds = false;+ ops.bearer_pref = "bredr";+ BearerSupervisor sup(ops, true);++ int64_t now = 0;+ sup.tick(now);+ sup.tick(++now);+ now += BEARER_SETTLE_SECONDS;+ sup.tick(now);+ ops.bearer_pref = "bredr"; // the write has not taken effect on the bus yet++ sup.tick(now + LE_SILENT_SECONDS);+ EXPECT_NE(sup.status().reason.find("pinned the bond to BR/EDR"), std::string::npos);+ EXPECT_EQ(sup.status().reason.find("turn Bluetooth off"), std::string::npos) << "blames the phone";+}+// The advert is legitimately off air while a dial owns the radio. One tick of// that must not turn into "your adapter is broken".TEST(BearerSupervisor, OneMomentOffAirDoesNotBlameTheAdapter) {