Skip to content

Linux + iPhone Continuity / iMessage / SMS

fix(cli): confirmation dialog would not show in some cases

Zack Bartelcc6ed7573fab
diff --git a/docs/BLUETOOTH.md b/docs/BLUETOOTH.md
index 95e4793..a31fce3 100644
--- a/docs/BLUETOOTH.md
+++ b/docs/BLUETOOTH.md
@@ -155,6 +155,7 @@ checks the daemon does not make.
| The phone never offers notifications / Sync Contacts | The class is wrong, or the ANCS advertisement is not running | Check for `class=ok` in `tether --bt-status`, can take minutes |
| MAP or PBAP reports `forbidden` | The matching toggle on the phone is off | Turn it on. This is not a pairing failure |
| Pairing never starts, and the only log line is a profile connect refused with `Connection refused (111)` | `Device1.Connect()` induces pairing only as a side effect of a profile connect, and this phone refuses that profile from an unbonded device | Nothing. Tether retries the transaction as an explicit `Device1.Pair()` on its own. To go straight there, `tether --bt-pair <addr> --explicit-pair` |
+| The phone shows a pairing code, then "Pairing Unsuccessful" a moment later, and the daemon reports the transaction failed about 90s after `confirm` | `tetherd` has no display, so the confirmation dialog could not be shown, and an unshowable dialog used to count as a refusal | Fixed. The comparison now goes to whichever client started the pairing -- the CLI prompts on the terminal, the GTK app opens its own dialog. On an older build, start `tetherd` from a graphical session so it inherits `DISPLAY` or `WAYLAND_DISPLAY` |
| MAP reports `busy`, or the transport says `Connection refused (111)` on an already-paired phone | Another computer holds the iPhone's single MAP session | Stop the other client |
| Pairing fails with `br-connection-key-missing` | A stale bond on one side, or the adapter is not `Pairable` | Delete the computer's entry on the phone (Forget This Device) and `tether --bt-unpair <addr>` locally, then pair again |
| 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 |
@@ -1238,3 +1239,56 @@ One incidental: `StartDiscovery` began failing with `org.bluez.Error.InProgress`
`bluetoothd` restart cleared it, matching the auto-connect wedge already in the troubleshooting
table. `tether-btclass@hci0` restored the class across that restart without intervention, after
the adapter briefly came back `Powered: no` with `Class: 0x00000000`.
+
+### 2026-08-26 - A confirmation nobody could see counted as a refusal
+
+| | |
+|---|---|
+| Controller | Reported on Realtek `0bda:a728`; mechanism captured on MediaTek MT7925 (RZ717) |
+| BlueZ | 5.87 with `--experimental` |
+| Phone | iPhone SE, iOS 27.0 beta (reporter); mechanism is phone-independent |
+
+Issue #49, after the explicit-pair fallback shipped. Pairing now reached the numeric comparison
+and the iPhone displayed a code, but the bond never completed. The reporter's timeline:
+
+```
+ 519 ms pairing <phone>
+ 1258 ms confirm 085363
+ 91715 ms bt_pair_result (fail)
+```
+
+91715 - 90000 (`PAIR_TIMEOUT_SECONDS`) = 1715. `Device1.Pair()` returned an error roughly 450 ms
+after the agent asked for confirmation. That is a dialog dying, not a person deciding. Two
+consecutive `confirm` steps 468 ms apart with different passkeys are the phone restarting SSP
+after the rejection, not the passkey "regenerating".
+
+Captured locally, no phone involved:
+
+```
+$ env -i HOME=$HOME tether-dialog --title t --body b --accept ok --reject no --timeout 3
+Gtk-WARNING **: cannot open display:
+exit=1
+```
+
+`gtk_init` failed and GTK exited 1. `confirm_with_dialog()` treated every non-zero exit as a
+refusal, so the agent answered BlueZ `RequestConfirmation` with "Rejected by the user" within
+milliseconds. **A `tetherd` with no display auto-declined every pairing.** It also explains the
+attempts that went to "Pairing Unsuccessful" without ever offering Pair: the rejection landed
+before iOS finished drawing the prompt.
+
+The correlation to #49 is inferred from that arithmetic; the mechanism is captured.
+
+Three things were wrong, and all three are fixed:
+
+- `tether-dialog` now uses `gtk_init_check()` and exits 3 -- the code already reserved for a
+ display failure -- instead of exiting 1, which is indistinguishable from the reject button.
+- "Could not ask" is no longer "the user said no". It does not set `user_rejected`, it does not
+ suppress the connect-first retry by pretending to be a refusal, and it does not silently
+ accept either: bonding without the comparison is exactly what the comparison exists to prevent.
+- The question is routed to the client that started the transaction. The daemon broadcasts
+ `bt_pair_confirm_request` with the code and blocks up to 60s for a `bt_pair_confirm` answer.
+ `tether --bt-pair` prompts on the terminal; the GTK app opens a dialog. A daemon that can show
+ its own dialog still does, so nothing changes for a `tetherd` started from a desktop session.
+
+If neither a dialog nor a client can be reached, the result now says so and names the fix,
+rather than reporting a rejection that never happened.
diff --git a/po/cs.po b/po/cs.po
index 5c6e367..7e944f0 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-08-25 22:13-0700\n"
+"POT-Creation-Date: 2026-08-26 14:40-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Czech\n"
@@ -285,6 +285,26 @@ msgstr "Nepodařilo se spojit s démonem.\n"
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "Démon uzavřel spojení dříve, než operace skončila.\n"
+#: src/cli/main.cpp
+#, c-format
+msgid ""
+"\n"
+" The iPhone should be showing this code: %s\n"
+" Does it match? [y/N] "
+msgstr ""
+"\n"
+" iPhone by měl zobrazovat tento kód: %s\n"
+" Souhlasí? [y/N] "
+
+#: src/cli/main.cpp
+#, c-format
+msgid ""
+"\n"
+" Cannot confirm the pairing code: input is not a terminal.\n"
+msgstr ""
+"\n"
+" Kód párování nelze potvrdit: vstup není terminál.\n"
+
#: src/cli/main.cpp
msgid "Could not read Bluetooth connection state from the daemon.\n"
msgstr "Nepodařilo se načíst stav Bluetooth spojení od démona.\n"
@@ -1050,6 +1070,17 @@ msgstr ""
"Nenalezen žádný iPhone. Odemkněte telefon a otevřete Nastavení > Bluetooth, "
"aby se ohlašoval, a hledejte znovu."
+#: src/gtk/devices_view.cpp
+#, c-format
+msgid ""
+"Does the iPhone show this code?\n"
+"\n"
+"%s"
+msgstr ""
+"Zobrazuje iPhone tento kód?\n"
+"\n"
+"%s"
+
#: src/gtk/devices_view.cpp
msgid "Connect your iPhone"
msgstr "Připojte svůj iPhone"
diff --git a/po/de.po b/po/de.po
index 7fc83ff..948dad6 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-08-25 22:13-0700\n"
+"POT-Creation-Date: 2026-08-26 14:40-0700\n"
"PO-Revision-Date: 2026-08-22\n"
"Last-Translator: Tether project\n"
"Language-Team: German\n"
@@ -281,6 +281,26 @@ msgid "Daemon closed the connection before the operation finished.\n"
msgstr ""
"Der Daemon hat die Verbindung geschlossen, bevor der Vorgang fertig war.\n"
+#: src/cli/main.cpp
+#, c-format
+msgid ""
+"\n"
+" The iPhone should be showing this code: %s\n"
+" Does it match? [y/N] "
+msgstr ""
+"\n"
+" Das iPhone sollte diesen Code anzeigen: %s\n"
+" Stimmt er überein? [y/N] "
+
+#: src/cli/main.cpp
+#, c-format
+msgid ""
+"\n"
+" Cannot confirm the pairing code: input is not a terminal.\n"
+msgstr ""
+"\n"
+" Der Kopplungscode kann nicht bestätigt werden: Eingabe ist kein Terminal.\n"
+
#: src/cli/main.cpp
msgid "Could not read Bluetooth connection state from the daemon.\n"
msgstr ""
@@ -1073,6 +1093,17 @@ msgstr ""
"Kein iPhone gefunden. Entsperren Sie das Telefon und öffnen Sie "
"Einstellungen > Bluetooth, damit es wirbt, und suchen Sie erneut."
+#: src/gtk/devices_view.cpp
+#, c-format
+msgid ""
+"Does the iPhone show this code?\n"
+"\n"
+"%s"
+msgstr ""
+"Zeigt das iPhone diesen Code an?\n"
+"\n"
+"%s"
+
#: src/gtk/devices_view.cpp
msgid "Connect your iPhone"
msgstr "Verbinden Sie Ihr iPhone"
diff --git a/po/es.po b/po/es.po
index 8d7731f..9596d6d 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-08-25 22:13-0700\n"
+"POT-Creation-Date: 2026-08-26 14:40-0700\n"
"PO-Revision-Date: 2026-08-22\n"
"Last-Translator: Tether project\n"
"Language-Team: Spanish\n"
@@ -282,6 +282,26 @@ msgstr "No se pudo contactar con el daemon.\n"
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "El daemon cerró la conexión antes de terminar la operación.\n"
+#: src/cli/main.cpp
+#, c-format
+msgid ""
+"\n"
+" The iPhone should be showing this code: %s\n"
+" Does it match? [y/N] "
+msgstr ""
+"\n"
+" El iPhone debería mostrar este código: %s\n"
+" ¿Coincide? [y/N] "
+
+#: src/cli/main.cpp
+#, c-format
+msgid ""
+"\n"
+" Cannot confirm the pairing code: input is not a terminal.\n"
+msgstr ""
+"\n"
+" No se puede confirmar el código de emparejamiento: la entrada no es un terminal.\n"
+
#: src/cli/main.cpp
msgid "Could not read Bluetooth connection state from the daemon.\n"
msgstr "No se pudo leer el estado de la conexión Bluetooth del daemon.\n"
@@ -1063,6 +1083,17 @@ msgstr ""
"No se encontró ningún iPhone. Desbloquee el teléfono y abra Ajustes > "
"Bluetooth para que se anuncie, y vuelva a buscar."
+#: src/gtk/devices_view.cpp
+#, c-format
+msgid ""
+"Does the iPhone show this code?\n"
+"\n"
+"%s"
+msgstr ""
+"¿El iPhone muestra este código?\n"
+"\n"
+"%s"
+
#: src/gtk/devices_view.cpp
msgid "Connect your iPhone"
msgstr "Conecte su iPhone"
diff --git a/po/fr.po b/po/fr.po
index 53722d4..a4796f3 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-08-25 22:13-0700\n"
+"POT-Creation-Date: 2026-08-26 14:40-0700\n"
"PO-Revision-Date: 2026-08-22\n"
"Last-Translator: Tether project\n"
"Language-Team: French\n"
@@ -284,6 +284,26 @@ msgstr "Impossible de joindre le démon.\n"
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "Le démon a fermé la connexion avant la fin de l'opération.\n"
+#: src/cli/main.cpp
+#, c-format
+msgid ""
+"\n"
+" The iPhone should be showing this code: %s\n"
+" Does it match? [y/N] "
+msgstr ""
+"\n"
+" L’iPhone devrait afficher ce code : %s\n"
+" Correspond-il ? [y/N] "
+
+#: src/cli/main.cpp
+#, c-format
+msgid ""
+"\n"
+" Cannot confirm the pairing code: input is not a terminal.\n"
+msgstr ""
+"\n"
+" Impossible de confirmer le code d’association : l’entrée n’est pas un terminal.\n"
+
#: src/cli/main.cpp
msgid "Could not read Bluetooth connection state from the daemon.\n"
msgstr "Impossible de lire l'état de la connexion Bluetooth depuis le démon.\n"
@@ -1067,6 +1087,17 @@ msgstr ""
"Aucun iPhone trouvé. Déverrouillez le téléphone et ouvrez Réglages > "
"Bluetooth pour qu'il s'annonce, puis relancez la recherche."
+#: src/gtk/devices_view.cpp
+#, c-format
+msgid ""
+"Does the iPhone show this code?\n"
+"\n"
+"%s"
+msgstr ""
+"L’iPhone affiche-t-il ce code ?\n"
+"\n"
+"%s"
+
#: src/gtk/devices_view.cpp
msgid "Connect your iPhone"
msgstr "Connectez votre iPhone"
diff --git a/po/it.po b/po/it.po
index 8cbd494..92328d0 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-08-25 22:13-0700\n"
+"POT-Creation-Date: 2026-08-26 14:40-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Italian\n"
@@ -282,6 +282,26 @@ msgstr "Impossibile raggiungere il daemon.\n"
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "Il daemon ha chiuso la connessione prima che l'operazione finisse.\n"
+#: src/cli/main.cpp
+#, c-format
+msgid ""
+"\n"
+" The iPhone should be showing this code: %s\n"
+" Does it match? [y/N] "
+msgstr ""
+"\n"
+" L’iPhone dovrebbe mostrare questo codice: %s\n"
+" Corrisponde? [y/N] "
+
+#: src/cli/main.cpp
+#, c-format
+msgid ""
+"\n"
+" Cannot confirm the pairing code: input is not a terminal.\n"
+msgstr ""
+"\n"
+" Impossibile confermare il codice di accoppiamento: l’input non è un terminale.\n"
+
#: src/cli/main.cpp
msgid "Could not read Bluetooth connection state from the daemon.\n"
msgstr "Impossibile leggere lo stato della connessione Bluetooth dal daemon.\n"
@@ -1060,6 +1080,17 @@ msgstr ""
"Nessun iPhone trovato. Sblocca il telefono e apri Impostazioni > Bluetooth "
"in modo che si annunci, poi ripeti la ricerca."
+#: src/gtk/devices_view.cpp
+#, c-format
+msgid ""
+"Does the iPhone show this code?\n"
+"\n"
+"%s"
+msgstr ""
+"L’iPhone mostra questo codice?\n"
+"\n"
+"%s"
+
#: src/gtk/devices_view.cpp
msgid "Connect your iPhone"
msgstr "Connetti il tuo iPhone"
diff --git a/po/ja.po b/po/ja.po
index f97eb1a..23770d7 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-08-25 22:13-0700\n"
+"POT-Creation-Date: 2026-08-26 14:40-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Japanese\n"
@@ -273,6 +273,26 @@ msgstr "デーモンに接続できませんでした。\n"
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "操作が完了する前にデーモンが接続を閉じました。\n"
+#: src/cli/main.cpp
+#, c-format
+msgid ""
+"\n"
+" The iPhone should be showing this code: %s\n"
+" Does it match? [y/N] "
+msgstr ""
+"\n"
+" iPhone にこのコードが表示されているはずです: %s\n"
+" 一致しますか? [y/N] "
+
+#: src/cli/main.cpp
+#, c-format
+msgid ""
+"\n"
+" Cannot confirm the pairing code: input is not a terminal.\n"
+msgstr ""
+"\n"
+" ペアリングコードを確認できません: 入力が端末ではありません。\n"
+
#: src/cli/main.cpp
msgid "Could not read Bluetooth connection state from the daemon.\n"
msgstr "デーモンから Bluetooth の接続状態を読み取れませんでした。\n"
@@ -1031,6 +1051,17 @@ msgstr ""
"iPhone が見つかりません。iPhone のロックを解除し、設定 > Bluetooth を開いてア"
"ドバタイズさせてから、もう一度検索してください。"
+#: src/gtk/devices_view.cpp
+#, c-format
+msgid ""
+"Does the iPhone show this code?\n"
+"\n"
+"%s"
+msgstr ""
+"iPhone にこのコードが表示されていますか?\n"
+"\n"
+"%s"
+
#: src/gtk/devices_view.cpp
msgid "Connect your iPhone"
msgstr "iPhone を接続"
diff --git a/po/ko.po b/po/ko.po
index 4016b24..c49bb47 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-08-25 22:13-0700\n"
+"POT-Creation-Date: 2026-08-26 14:40-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Korean\n"
@@ -272,6 +272,26 @@ msgstr "데몬에 연결하지 못했습니다.\n"
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "작업이 끝나기 전에 데몬이 연결을 닫았습니다.\n"
+#: src/cli/main.cpp
+#, c-format
+msgid ""
+"\n"
+" The iPhone should be showing this code: %s\n"
+" Does it match? [y/N] "
+msgstr ""
+"\n"
+" iPhone에 이 코드가 표시되어야 합니다: %s\n"
+" 일치합니까? [y/N] "
+
+#: src/cli/main.cpp
+#, c-format
+msgid ""
+"\n"
+" Cannot confirm the pairing code: input is not a terminal.\n"
+msgstr ""
+"\n"
+" 페어링 코드를 확인할 수 없습니다: 입력이 터미널이 아닙니다.\n"
+
#: src/cli/main.cpp
msgid "Could not read Bluetooth connection state from the daemon.\n"
msgstr "데몬에서 Bluetooth 연결 상태를 읽지 못했습니다.\n"
@@ -1022,6 +1042,17 @@ msgstr ""
"iPhone을 찾지 못했습니다. iPhone의 잠금을 해제하고 설정 > Bluetooth를 열어 광"
"고하도록 한 뒤 다시 검색하십시오."
+#: src/gtk/devices_view.cpp
+#, c-format
+msgid ""
+"Does the iPhone show this code?\n"
+"\n"
+"%s"
+msgstr ""
+"iPhone에 이 코드가 표시됩니까?\n"
+"\n"
+"%s"
+
#: src/gtk/devices_view.cpp
msgid "Connect your iPhone"
msgstr "iPhone 연결하기"
diff --git a/po/nl.po b/po/nl.po
index 48a2883..cc8a842 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-08-25 22:13-0700\n"
+"POT-Creation-Date: 2026-08-26 14:40-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Dutch\n"
@@ -281,6 +281,26 @@ msgstr "Kon de daemon niet bereiken.\n"
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "De daemon sloot de verbinding voordat de bewerking klaar was.\n"
+#: src/cli/main.cpp
+#, c-format
+msgid ""
+"\n"
+" The iPhone should be showing this code: %s\n"
+" Does it match? [y/N] "
+msgstr ""
+"\n"
+" De iPhone zou deze code moeten tonen: %s\n"
+" Komt hij overeen? [y/N] "
+
+#: src/cli/main.cpp
+#, c-format
+msgid ""
+"\n"
+" Cannot confirm the pairing code: input is not a terminal.\n"
+msgstr ""
+"\n"
+" Kan de koppelingscode niet bevestigen: invoer is geen terminal.\n"
+
#: src/cli/main.cpp
msgid "Could not read Bluetooth connection state from the daemon.\n"
msgstr "Kon de Bluetooth-verbindingsstatus niet van de daemon lezen.\n"
@@ -1057,6 +1077,17 @@ msgstr ""
"Geen iPhone gevonden. Ontgrendel de telefoon en open Instellingen > "
"Bluetooth zodat hij adverteert, en zoek dan opnieuw."
+#: src/gtk/devices_view.cpp
+#, c-format
+msgid ""
+"Does the iPhone show this code?\n"
+"\n"
+"%s"
+msgstr ""
+"Toont de iPhone deze code?\n"
+"\n"
+"%s"
+
#: src/gtk/devices_view.cpp
msgid "Connect your iPhone"
msgstr "Verbind je iPhone"
diff --git a/po/pl.po b/po/pl.po
index 83dc1a5..d7ff33b 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-08-25 22:13-0700\n"
+"POT-Creation-Date: 2026-08-26 14:40-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Polish\n"
@@ -286,6 +286,26 @@ msgstr "Nie udało się połączyć z demonem.\n"
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "Demon zamknął połączenie, zanim operacja się zakończyła.\n"
+#: src/cli/main.cpp
+#, c-format
+msgid ""
+"\n"
+" The iPhone should be showing this code: %s\n"
+" Does it match? [y/N] "
+msgstr ""
+"\n"
+" iPhone powinien pokazywać ten kod: %s\n"
+" Czy się zgadza? [y/N] "
+
+#: src/cli/main.cpp
+#, c-format
+msgid ""
+"\n"
+" Cannot confirm the pairing code: input is not a terminal.\n"
+msgstr ""
+"\n"
+" Nie można potwierdzić kodu parowania: wejście nie jest terminalem.\n"
+
#: src/cli/main.cpp
msgid "Could not read Bluetooth connection state from the daemon.\n"
msgstr "Nie udało się odczytać stanu połączenia Bluetooth od demona.\n"
@@ -1061,6 +1081,17 @@ msgstr ""
"Nie znaleziono iPhone'a. Odblokuj telefon i otwórz Ustawienia > Bluetooth, "
"aby się rozgłaszał, a potem wyszukaj ponownie."
+#: src/gtk/devices_view.cpp
+#, c-format
+msgid ""
+"Does the iPhone show this code?\n"
+"\n"
+"%s"
+msgstr ""
+"Czy iPhone pokazuje ten kod?\n"
+"\n"
+"%s"
+
#: src/gtk/devices_view.cpp
msgid "Connect your iPhone"
msgstr "Połącz swojego iPhone'a"
diff --git a/po/pt_BR.po b/po/pt_BR.po
index 8dbe0b7..a01fc44 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-08-25 22:13-0700\n"
+"POT-Creation-Date: 2026-08-26 14:40-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Brazilian Portuguese\n"
@@ -280,6 +280,26 @@ msgstr "Não foi possível alcançar o daemon.\n"
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "O daemon fechou a conexão antes de a operação terminar.\n"
+#: src/cli/main.cpp
+#, c-format
+msgid ""
+"\n"
+" The iPhone should be showing this code: %s\n"
+" Does it match? [y/N] "
+msgstr ""
+"\n"
+" O iPhone deve estar mostrando este código: %s\n"
+" Ele confere? [y/N] "
+
+#: src/cli/main.cpp
+#, c-format
+msgid ""
+"\n"
+" Cannot confirm the pairing code: input is not a terminal.\n"
+msgstr ""
+"\n"
+" Não é possível confirmar o código de pareamento: a entrada não é um terminal.\n"
+
#: src/cli/main.cpp
msgid "Could not read Bluetooth connection state from the daemon.\n"
msgstr "Não foi possível ler o estado da conexão Bluetooth no daemon.\n"
@@ -1053,6 +1073,17 @@ msgstr ""
"Nenhum iPhone encontrado. Desbloqueie o telefone e abra Ajustes > Bluetooth "
"para que ele se anuncie, depois procure de novo."
+#: src/gtk/devices_view.cpp
+#, c-format
+msgid ""
+"Does the iPhone show this code?\n"
+"\n"
+"%s"
+msgstr ""
+"O iPhone mostra este código?\n"
+"\n"
+"%s"
+
#: src/gtk/devices_view.cpp
msgid "Connect your iPhone"
msgstr "Conecte seu iPhone"
diff --git a/po/ru.po b/po/ru.po
index 23acdec..1b5de31 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-08-25 22:13-0700\n"
+"POT-Creation-Date: 2026-08-26 14:40-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Russian\n"
@@ -286,6 +286,26 @@ msgstr "Не удалось связаться с демоном.\n"
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "Демон закрыл соединение до завершения операции.\n"
+#: src/cli/main.cpp
+#, c-format
+msgid ""
+"\n"
+" The iPhone should be showing this code: %s\n"
+" Does it match? [y/N] "
+msgstr ""
+"\n"
+" На iPhone должен отображаться этот код: %s\n"
+" Он совпадает? [y/N] "
+
+#: src/cli/main.cpp
+#, c-format
+msgid ""
+"\n"
+" Cannot confirm the pairing code: input is not a terminal.\n"
+msgstr ""
+"\n"
+" Не удалось подтвердить код сопряжения: ввод не является терминалом.\n"
+
#: src/cli/main.cpp
msgid "Could not read Bluetooth connection state from the daemon.\n"
msgstr "Не удалось прочитать состояние соединения Bluetooth у демона.\n"
@@ -1062,6 +1082,17 @@ msgstr ""
"iPhone не найден. Разблокируйте телефон и откройте Настройки > Bluetooth, "
"чтобы он начал объявлять о себе, затем повторите поиск."
+#: src/gtk/devices_view.cpp
+#, c-format
+msgid ""
+"Does the iPhone show this code?\n"
+"\n"
+"%s"
+msgstr ""
+"iPhone показывает этот код?\n"
+"\n"
+"%s"
+
#: src/gtk/devices_view.cpp
msgid "Connect your iPhone"
msgstr "Подключите свой iPhone"
diff --git a/po/sv.po b/po/sv.po
index 0c1dfe1..8ac7a38 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-08-25 22:13-0700\n"
+"POT-Creation-Date: 2026-08-26 14:40-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Swedish\n"
@@ -280,6 +280,26 @@ msgstr "Kunde inte nå demonen.\n"
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "Demonen stängde anslutningen innan åtgärden var klar.\n"
+#: src/cli/main.cpp
+#, c-format
+msgid ""
+"\n"
+" The iPhone should be showing this code: %s\n"
+" Does it match? [y/N] "
+msgstr ""
+"\n"
+" iPhone bör visa den här koden: %s\n"
+" Stämmer den? [y/N] "
+
+#: src/cli/main.cpp
+#, c-format
+msgid ""
+"\n"
+" Cannot confirm the pairing code: input is not a terminal.\n"
+msgstr ""
+"\n"
+" Kan inte bekräfta parkopplingskoden: indata är inte en terminal.\n"
+
#: src/cli/main.cpp
msgid "Could not read Bluetooth connection state from the daemon.\n"
msgstr "Kunde inte läsa Bluetooth-anslutningens status från demonen.\n"
@@ -1043,6 +1063,17 @@ msgstr ""
"Ingen iPhone hittades. Lås upp telefonen och öppna Inställningar > Bluetooth "
"så att den annonserar, och sök sedan igen."
+#: src/gtk/devices_view.cpp
+#, c-format
+msgid ""
+"Does the iPhone show this code?\n"
+"\n"
+"%s"
+msgstr ""
+"Visar iPhone den här koden?\n"
+"\n"
+"%s"
+
#: src/gtk/devices_view.cpp
msgid "Connect your iPhone"
msgstr "Anslut din iPhone"
diff --git a/po/tether.pot b/po/tether.pot
index 6790bb6..251ea2f 100644
--- a/po/tether.pot
+++ b/po/tether.pot
@@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
-"Project-Id-Version: tether 0.2.12\n"
+"Project-Id-Version: tether 0.2.13\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-08-25 22:13-0700\n"
+"POT-Creation-Date: 2026-08-26 14:40-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"
@@ -264,6 +264,21 @@ msgstr ""
msgid "Daemon closed the connection before the operation finished.\n"
msgstr ""
+#: src/cli/main.cpp
+#, c-format
+msgid ""
+"\n"
+" The iPhone should be showing this code: %s\n"
+" Does it match? [y/N] "
+msgstr ""
+
+#: src/cli/main.cpp
+#, c-format
+msgid ""
+"\n"
+" Cannot confirm the pairing code: input is not a terminal.\n"
+msgstr ""
+
#: src/cli/main.cpp
msgid "Could not read Bluetooth connection state from the daemon.\n"
msgstr ""
@@ -958,6 +973,14 @@ msgid ""
"advertises, then scan again."
msgstr ""
+#: src/gtk/devices_view.cpp
+#, c-format
+msgid ""
+"Does the iPhone show this code?\n"
+"\n"
+"%s"
+msgstr ""
+
#: src/gtk/devices_view.cpp
msgid "Connect your iPhone"
msgstr ""
diff --git a/po/tr.po b/po/tr.po
index c2293d2..8941b7b 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-08-25 22:13-0700\n"
+"POT-Creation-Date: 2026-08-26 14:40-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Turkish\n"
@@ -279,6 +279,26 @@ msgstr "Arka plan hizmetine ulaşılamadı.\n"
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "Arka plan hizmeti, işlem bitmeden bağlantıyı kapattı.\n"
+#: src/cli/main.cpp
+#, c-format
+msgid ""
+"\n"
+" The iPhone should be showing this code: %s\n"
+" Does it match? [y/N] "
+msgstr ""
+"\n"
+" iPhone bu kodu gösteriyor olmalı: %s\n"
+" Eşleşiyor mu? [y/N] "
+
+#: src/cli/main.cpp
+#, c-format
+msgid ""
+"\n"
+" Cannot confirm the pairing code: input is not a terminal.\n"
+msgstr ""
+"\n"
+" Eşleştirme kodu doğrulanamıyor: giriş bir terminal değil.\n"
+
#: src/cli/main.cpp
msgid "Could not read Bluetooth connection state from the daemon.\n"
msgstr "Bluetooth bağlantı durumu arka plan hizmetinden okunamadı.\n"
@@ -1041,6 +1061,17 @@ msgstr ""
"iPhone bulunamadı. Telefonun kilidini açın ve duyuru yapması için Ayarlar > "
"Bluetooth bölümünü açın, sonra yeniden tarayın."
+#: src/gtk/devices_view.cpp
+#, c-format
+msgid ""
+"Does the iPhone show this code?\n"
+"\n"
+"%s"
+msgstr ""
+"iPhone bu kodu gösteriyor mu?\n"
+"\n"
+"%s"
+
#: src/gtk/devices_view.cpp
msgid "Connect your iPhone"
msgstr "iPhone'unuzu bağlayın"
diff --git a/po/uk.po b/po/uk.po
index 3e245ab..c88399b 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-08-25 22:13-0700\n"
+"POT-Creation-Date: 2026-08-26 14:40-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Ukrainian\n"
@@ -287,6 +287,26 @@ msgstr "Не вдалося зв'язатися з демоном.\n"
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "Демон закрив з'єднання до завершення операції.\n"
+#: src/cli/main.cpp
+#, c-format
+msgid ""
+"\n"
+" The iPhone should be showing this code: %s\n"
+" Does it match? [y/N] "
+msgstr ""
+"\n"
+" На iPhone має відображатися цей код: %s\n"
+" Він збігається? [y/N] "
+
+#: src/cli/main.cpp
+#, c-format
+msgid ""
+"\n"
+" Cannot confirm the pairing code: input is not a terminal.\n"
+msgstr ""
+"\n"
+" Не вдалося підтвердити код сполучення: ввід не є терміналом.\n"
+
#: src/cli/main.cpp
msgid "Could not read Bluetooth connection state from the daemon.\n"
msgstr "Не вдалося прочитати стан з'єднання Bluetooth у демона.\n"
@@ -1058,6 +1078,17 @@ msgstr ""
"iPhone не знайдено. Розблокуйте телефон і відкрийте Параметри > Bluetooth, "
"щоб він оголошував про себе, потім повторіть пошук."
+#: src/gtk/devices_view.cpp
+#, c-format
+msgid ""
+"Does the iPhone show this code?\n"
+"\n"
+"%s"
+msgstr ""
+"iPhone показує цей код?\n"
+"\n"
+"%s"
+
#: src/gtk/devices_view.cpp
msgid "Connect your iPhone"
msgstr "Під'єднайте свій iPhone"
diff --git a/po/zh_CN.po b/po/zh_CN.po
index 2aec391..9ddbf51 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-08-25 22:13-0700\n"
+"POT-Creation-Date: 2026-08-26 14:40-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Simplified Chinese\n"
@@ -270,6 +270,26 @@ msgstr "无法连接到守护进程。\n"
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "操作完成前守护进程已关闭连接。\n"
+#: src/cli/main.cpp
+#, c-format
+msgid ""
+"\n"
+" The iPhone should be showing this code: %s\n"
+" Does it match? [y/N] "
+msgstr ""
+"\n"
+" iPhone 上应显示此代码:%s\n"
+" 是否一致?[y/N] "
+
+#: src/cli/main.cpp
+#, c-format
+msgid ""
+"\n"
+" Cannot confirm the pairing code: input is not a terminal.\n"
+msgstr ""
+"\n"
+" 无法确认配对代码:输入不是终端。\n"
+
#: src/cli/main.cpp
msgid "Could not read Bluetooth connection state from the daemon.\n"
msgstr "无法从守护进程读取蓝牙连接状态。\n"
@@ -999,6 +1019,17 @@ msgid ""
msgstr ""
"未找到 iPhone。请解锁 iPhone 并打开 设置 > 蓝牙 使其开始广播,然后重新搜索。"
+#: src/gtk/devices_view.cpp
+#, c-format
+msgid ""
+"Does the iPhone show this code?\n"
+"\n"
+"%s"
+msgstr ""
+"iPhone 上显示的是此代码吗?\n"
+"\n"
+"%s"
+
#: src/gtk/devices_view.cpp
msgid "Connect your iPhone"
msgstr "连接你的 iPhone"
diff --git a/src/cli/main.cpp b/src/cli/main.cpp
index 013ed96..8c4d620 100644
--- a/src/cli/main.cpp
+++ b/src/cli/main.cpp
@@ -412,6 +412,22 @@ static int run_bt_transaction(tether::Client& client,
if (cmd == "bt_pair_progress") {
fprintf(stdout, " %-12s %s\n", event.value("step", "").c_str(), event.value("detail", "").c_str());
fflush(stdout);
+ } else if (cmd == "bt_pair_confirm_request") {
+ const std::string code = event.value("code", "");
+ bool accept = false;
+ if (isatty(STDIN_FILENO)) {
+ fprintf(stdout,
+ _("\n The iPhone should be showing this code: %s\n Does it match? [y/N] "),
+ code.c_str());
+ fflush(stdout);
+ char answer[16] = {0};
+ if (fgets(answer, sizeof(answer), stdin))
+ accept = answer[0] == 'y' || answer[0] == 'Y';
+ } else {
+ fprintf(stdout, _("\n Cannot confirm the pairing code: input is not a terminal.\n"));
+ fflush(stdout);
+ }
+ client.send(nlohmann::json({{"command", "bt_pair_confirm"}, {"accept", accept}}).dump() + "\n");
} else if (cmd == result_command) {
fprintf(stdout, "\n%s\n", event.value("message", "").c_str());
return event.value("success", false) ? 0 : 1;
diff --git a/src/core/include/tether/bluetooth/pairing.hpp b/src/core/include/tether/bluetooth/pairing.hpp
index 8daf150..e26ffdf 100644
--- a/src/core/include/tether/bluetooth/pairing.hpp
+++ b/src/core/include/tether/bluetooth/pairing.hpp
@@ -29,7 +29,7 @@ namespace tether::bluetooth {
// Device1.Pair(). Connect-first induces authentication only as a side effect of
// a profile connect, so a phone that refuses the profile never starts pairing
// at all. Device1.Pair() involves no profile.
- bool should_fall_back(AuthStrategy tried, bool paired, bool user_rejected);
+ bool should_fall_back(AuthStrategy tried, bool paired, bool confirmation_failed);
// Reports progress steps so the CLI and GTK app can show what is happening
// during a transaction that legitimately takes tens of seconds.
@@ -73,6 +73,6 @@ namespace tether::bluetooth {
nlohmann::json to_json(const PairResult& result);
- bool confirm_with_dialog(const std::string& device_name, const std::string& code);
+ bool confirm_with_dialog(const std::string& device_name, const std::string& code, bool& unavailable);
} // namespace tether::bluetooth
diff --git a/src/core/src/bluetooth/pairing.cpp b/src/core/src/bluetooth/pairing.cpp
index a4d86f1..ea66ed0 100644
--- a/src/core/src/bluetooth/pairing.cpp
+++ b/src/core/src/bluetooth/pairing.cpp
@@ -404,7 +404,7 @@ namespace tether::bluetooth {
debug::log(WARN, "bluetooth: could not re-arm the ANCS solicitation ({})", err);
}
- bool confirm_with_dialog(const std::string& device_name, const std::string& code) {
+ bool confirm_with_dialog(const std::string& device_name, const std::string& code, bool& unavailable) {
// Translated before the fork: gettext takes a lock, and calling it in the
// child of a threaded process can deadlock if another thread held it.
// TRANSLATORS: {0} is the device name, {1} is the numeric pairing code.
@@ -417,6 +417,7 @@ namespace tether::bluetooth {
pid_t pid = fork();
if (pid < 0) {
debug::log(ERR, "bluetooth: fork() for confirmation dialog failed");
+ unavailable = true;
return false;
}
@@ -459,10 +460,13 @@ namespace tether::bluetooth {
}
int status = 0;
- if (waitpid(pid, &status, 0) < 0)
+ if (waitpid(pid, &status, 0) < 0) {
+ unavailable = true;
return false;
- // Exit 0 is the only acceptance. A dialog that could not be shown exits 3,
- // which must reject rather than silently bond.
+ }
+ // Exit 0 is the only acceptance. A dialog that could not be shown at all exits 3
+ if (!WIFEXITED(status) || WEXITSTATUS(status) == 3)
+ unavailable = true;
return WIFEXITED(status) && WEXITSTATUS(status) == 0;
}
@@ -478,8 +482,8 @@ namespace tether::bluetooth {
};
}
- bool should_fall_back(AuthStrategy tried, bool paired, bool user_rejected) {
- return tried == AuthStrategy::ConnectFirst && !paired && !user_rejected;
+ bool should_fall_back(AuthStrategy tried, bool paired, bool confirmation_failed) {
+ return tried == AuthStrategy::ConnectFirst && !paired && !confirmation_failed;
}
PairResult pair_device(BluezMonitor& monitor,
@@ -541,12 +545,23 @@ namespace tether::bluetooth {
// The agent's callback lands on the monitor's GLib thread.
std::atomic<bool> auth_seen{false};
std::atomic<bool> user_rejected{false};
+ std::atomic<bool> confirm_unavailable{false};
PairingAgent agent(conn, device.path, [&](const std::string& code) {
auth_seen = true;
notify(progress, "confirm", code);
- const bool accepted = confirm ? confirm(code) : confirm_with_dialog(display_name, code);
- if (!accepted)
+
+ bool unavailable = false;
+ bool accepted = confirm_with_dialog(display_name, code, unavailable);
+
+ if (unavailable && confirm) {
+ accepted = confirm(code);
+ unavailable = false;
+ }
+
+ if (unavailable)
+ confirm_unavailable = true;
+ else if (!accepted)
user_rejected = true;
return accepted;
});
@@ -600,13 +615,13 @@ namespace tether::bluetooth {
// Connect-first is the only transaction that yields the LE half of the
// bond, and the iPhone's refusal of it can be transient, so it is worth
// a second attempt before trading notifications away.
- if (should_fall_back(strategy, paired, user_rejected)) {
+ if (should_fall_back(strategy, paired, user_rejected || confirm_unavailable)) {
notify(progress, "retrying", "the iPhone refused the connection; trying once more");
clear_attempt_in_flight();
paired = attempt(AuthStrategy::ConnectFirst);
}
- if (should_fall_back(strategy, paired, user_rejected)) {
+ if (should_fall_back(strategy, paired, user_rejected || confirm_unavailable)) {
notify(progress,
"retrying",
"the iPhone will not start pairing over the connection; requesting authentication directly. "
@@ -620,9 +635,15 @@ namespace tether::bluetooth {
monitor.invoke_sync([&] { agent.unexport_object(); });
if (!paired) {
- if (user_rejected) {
+ if (confirm_unavailable) {
+ result.status = "error";
+ result.message = "The pairing code could not be shown for confirmation: this computer has no "
+ "display, and whatever started the pairing did not answer either. Run tether "
+ "--bt-pair " +
+ result.device_address + " from a terminal and confirm the code there.";
+ } else if (user_rejected) {
result.status = "rejected";
- result.message = "Pairing was declined on this computer.";
+ result.message = "Pairing was not confirmed on this computer.";
} else if (err.find("Rejected") != std::string::npos) {
result.status = "rejected";
result.message = "The iPhone declined the pairing request.";
diff --git a/src/core/src/net.cpp b/src/core/src/net.cpp
index 8d8e7ac..fca8dd8 100644
--- a/src/core/src/net.cpp
+++ b/src/core/src/net.cpp
@@ -24,6 +24,8 @@
#include "tether/otp.hpp"
#include "tether/wayland.hpp"
#include <atomic>
+#include <chrono>
+#include <condition_variable>
#include <cstring>
#include <filesystem>
#include <fstream>
@@ -301,6 +303,11 @@ namespace tether {
// advertisement object paths.
static std::atomic<bool> g_bt_pair_busy{false};
+ constexpr int BT_CONFIRM_TIMEOUT_SECONDS = 60;
+ static std::mutex g_bt_confirm_mutex;
+ static std::condition_variable g_bt_confirm_cv;
+ static int g_bt_confirm_answer = -1; // -1 pending, 0 declined, 1 accepted
+
// A second StartDiscovery while one is running just gets stopped early by the
// first one's StopDiscovery.
static std::atomic<bool> g_bt_scan_busy{false};
@@ -333,6 +340,24 @@ namespace tether {
broadcast_local_event(event.dump());
}
+ // Runs on the BlueZ monitor's GLib thread, same as the local dialog it replaces.
+ static bool ask_client_to_confirm(const std::string& code) {
+ {
+ std::lock_guard<std::mutex> lock(g_bt_confirm_mutex);
+ g_bt_confirm_answer = -1;
+ }
+
+ nlohmann::json event;
+ event["command"] = "bt_pair_confirm_request";
+ event["code"] = code;
+ broadcast_local_event(event.dump());
+
+ std::unique_lock<std::mutex> lock(g_bt_confirm_mutex);
+ g_bt_confirm_cv.wait_for(
+ lock, std::chrono::seconds(BT_CONFIRM_TIMEOUT_SECONDS), [] { return g_bt_confirm_answer >= 0; });
+ return g_bt_confirm_answer == 1;
+ }
+
static void run_bt_pair(const std::string& address, std::optional<bluetooth::AuthStrategy> strategy) {
if (!bluetooth::g_bluez) {
nlohmann::json event;
@@ -366,7 +391,7 @@ namespace tether {
event["detail"] = detail;
broadcast_local_event(event.dump());
},
- nullptr);
+ ask_client_to_confirm);
if (result.success) {
config.device_address = result.device_address;
@@ -761,6 +786,12 @@ namespace tether {
if (j.contains("strategy"))
strategy = bluetooth::auth_strategy_from_string(j["strategy"]);
std::thread([address, strategy]() { run_bt_pair(address, strategy); }).detach();
+ } else if (j.contains("command") && j["command"] == "bt_pair_confirm") {
+ {
+ std::lock_guard<std::mutex> lock(g_bt_confirm_mutex);
+ g_bt_confirm_answer = j.value("accept", false) ? 1 : 0;
+ }
+ g_bt_confirm_cv.notify_all();
} else if (j.contains("command") && j["command"] == "bt_unpair" && j.contains("address")) {
std::string address = j["address"];
std::thread([address]() { run_bt_unpair(address); }).detach();
diff --git a/src/dialog/main.cpp b/src/dialog/main.cpp
index 29dcf7b..bad8dc6 100644
--- a/src/dialog/main.cpp
+++ b/src/dialog/main.cpp
@@ -131,7 +131,10 @@ int main(int argc, char** argv) {
return 3;
}
- gtk_init(&argc, &argv);
+ if (!gtk_init_check(&argc, &argv)) {
+ debug::log(ERR, "Error: no display available.\n");
+ return 3;
+ }
// Apply CSS
GtkCssProvider* css_provider = gtk_css_provider_new();
diff --git a/src/gtk/devices_view.cpp b/src/gtk/devices_view.cpp
index 4f3d3a9..9667a99 100644
--- a/src/gtk/devices_view.cpp
+++ b/src/gtk/devices_view.cpp
@@ -972,6 +972,18 @@ namespace tether::ui {
set_text(g_devices.lbl_bt_progress, event.value("message", ""));
return false;
}
+ if (command == "bt_pair_confirm_request") {
+ GtkWidget* dialog = gtk_message_dialog_new(GTK_WINDOW(main_window()),
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_OK_CANCEL,
+ _("Does the iPhone show this code?\n\n%s"),
+ event.value("code", "").c_str());
+ const bool confirmed = gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK;
+ gtk_widget_destroy(dialog);
+ daemon_send({{"command", "bt_pair_confirm"}, {"accept", confirmed}});
+ return true;
+ }
if (command == "bt_pair_progress") {
set_text(g_devices.lbl_bt_progress, event.value("step", "") + " " + event.value("detail", ""));
return true;