Skip to content

Linux + iPhone Continuity / iMessage / SMS

feat: airpods listening mode

Zack Bartel72b81867efbd
diff --git a/docs/BLUETOOTH.md b/docs/BLUETOOTH.md
index d3707aa..0402e65 100644
--- a/docs/BLUETOOTH.md
+++ b/docs/BLUETOOTH.md
@@ -10,7 +10,7 @@ Bluetooth accessory. No iOS-side code is involved.
| Contacts, for sender names | **PBAP** (Phonebook Access Profile) via `obexd` | BR/EDR | OBEX client |
| Notifications from any app | **ANCS** (Apple Notification Center Service) | BLE / GATT | GATT central |
| Phone calls, place + answer | **HFP** (Hands-Free Profile) via BlueZ | BR/EDR | Hands-free unit |
-| AirPods battery, buds + case | **AAP** (Apple Accessory Protocol) | BR/EDR / L2CAP | L2CAP client |
+| AirPods battery + listening mode | **AAP** (Apple Accessory Protocol) | BR/EDR / L2CAP | L2CAP client |
The Tether iOS app is unrelated to these features and just keeps handling clipboard sync and file transfer over TCP + mTLS.
@@ -479,8 +479,8 @@ the narrower check; it rules out the `*`/`#` supplementary-service codes deliber
## AirPods
-Battery for the buds and the case, in the Devices list and from `tether --bt-airpods`.
-Read-only: no ANC, ear detection or stem control yet.
+Battery for the buds and the case, and the listening mode, in the Devices list and from
+`tether --bt-airpods`. No ear detection or stem control yet.
It is the one feature here that does not go through BlueZ. AirPods report battery over
Apple's Accessory Protocol on an L2CAP channel, PSM `0x1001`, the same source an iPhone
@@ -512,12 +512,38 @@ Case `0x08`. Status `0x04` means the component is not reporting — a bud in the
shut case — which is shown as unknown, never as 0%. A notification carries only what
changed, so anything it leaves out keeps its previous level.
+### Listening mode
+
+Off, Transparency, Adaptive and Noise Cancellation, set from the AirPods page in the GTK
+app or with `tether --bt-airpods-mode <off|anc|transparency|adaptive>`.
+
+Sent and received on the same 11-byte shape, `04 00 04 00 09 00 0D [mode] 00 00 00`, with
+the mode at offset 7. The wire values are one above the order the modes are usually listed
+in: `01` Off, `02` Noise Cancellation, `03` Transparency, `04` Adaptive.
+
+**A mode the buds decline is simply not applied, and they say nothing about it.** Measured
+2026-09-08 on AirPods Pro: `off` was sent three times and the buds stayed in the previous
+mode, while `anc`, `transparency` and `adaptive` all took effect within a second. Apple
+leaves Off out of the noise-control rotation by default on Pro models, and there is no
+error and no refusal packet -- the only evidence is that the mode notification never
+changes.
+
+So nothing here assumes a write succeeded. The published mode only ever comes from the
+buds' own notification, which they send unprompted on every change including the ones the
+desktop asked for. The GTK buttons snap back to the real mode when a write does not take,
+and a model with no listening mode at all reports none and the buttons stay disabled.
+
+Writes are queued for the reader thread rather than sent from the caller's, because the
+socket belongs to the session and closing it out from under a write is the one race worth
+not having. A queued change does not outlive the channel it was meant for.
+
The constants come from librepods `linux/airpods_packets.h`. The prose
`docs/AAP Definitions.md` in the same repository disagrees with the header and is wrong.
`DeviceID = bluetooth:004C:0000:0000` in `/etc/bluetooth/main.conf` is **not** needed for
-this. It is what makes the machine present itself to the buds as Apple hardware, and
-reading battery does not require that.
+any of this. It is what makes the machine present itself to the buds as Apple hardware.
+Reading battery does not require it, and neither does setting the listening mode --
+confirmed 2026-09-08 with the setting absent from `main.conf` on the test machine.
### The channel takes one client
@@ -595,6 +621,7 @@ checks the daemon does not make.
| The iPhone's audio moves to the computer when Tether connects | The machine advertises itself as a Bluetooth speaker/headset, and iOS routes to it. Not caused by Tether beyond bringing the link up | See "Keeping the phone's audio on the phone" below |
| `tether --bt-calls` reports call control off | PipeWire took the profile *and* its telephony D-Bus service is off, the iPhone reconnected on its own and never opened hands-free, or `bluetoothd` is running without `--experimental` | Either give BlueZ the profile by dropping `hfp_hf` from `bluez5.roles`, or set `bluez5.telephony-dbus-service = true` and let Tether drive PipeWire's gateway -- see "Calls". The daemon cycles the BR/EDR bearer once per outage for the second cause; confirm with `busctl --system tree org.bluez \| grep telephony` and `busctl --user tree org.pipewire.Telephony` |
| AirPods are listed but the battery stays blank, and the row says another program is using the channel | The AAP channel takes one client, and something else has it | Stop the other AirPods program (LibrePods, AirPods Center, a status-bar widget that reads battery). Nothing else releases it |
+| Setting the AirPods listening mode to `off` does nothing, while the other three work | The buds declined it. Apple leaves Off out of the noise-control rotation by default on Pro models, and there is no refusal to report | Add Off to the rotation on the phone, under Settings > Bluetooth > (i) > Noise Control. Tether keeps showing the mode the buds are actually in |
| AirPods do not appear in the Devices list at all | They are not connected, or BlueZ has never read their SDP record so there is no Modalias and the name does not contain "airpod" | Connect them, then `tether --bt-devices` -- the row carries an `airpods` flag when Tether recognizes them |
| Calls work but the audio is on the iPhone | Working as designed. BlueZ signals the call and never opens the voice link, so there is nothing to route here | Nothing. `./scripts/bt-probe.sh --calls` during a call shows the evidence; "Getting the call audio onto the desktop instead" is the trade if you want it |
| The Calls page is empty after configuring PipeWire for call audio | PipeWire's telephony D-Bus service is off, so neither stack exports anything Tether can read | Set `bluez5.telephony-dbus-service = true` and reconnect. With it on, Tether drives PipeWire's gateway directly and the Calls page works, minus carrier and signal |
diff --git a/docs/PROTOCOL.md b/docs/PROTOCOL.md
index dd93be9..7e62897 100644
--- a/docs/PROTOCOL.md
+++ b/docs/PROTOCOL.md
@@ -350,6 +350,7 @@ entries only gain an `airpods` boolean saying which device the battery belongs t
"left": 82,
"right": 79,
"case": 45,
+ "anc": "transparency",
"status": "live",
"reason": ""
}
@@ -363,6 +364,22 @@ a flat battery. An empty `address` means no AirPods are connected.
program holds the channel, which allows only one client at a time; `reason` carries the
sentence to show.
+`anc` is the listening mode: `off`, `anc`, `transparency`, `adaptive`, or null on a model
+that does not report one. It always reflects what the buds say they are doing, never what
+was last requested.
+
+#### `bt_airpods_mode` (Client -> Daemon, answered directly)
+**Payload**: `{"command": "bt_airpods_mode", "mode": "transparency"}`
+**Response**: `{"command": "bt_airpods_mode_result", "success": true}`, or `success` false
+with a `message`.
+
+Note the name: `bt_set_ancs` elsewhere in this file is Apple Notification Center Service,
+an unrelated feature.
+
+Success means the request reached the buds, not that they applied it. They decline a mode
+they are not configured for and report nothing, so the confirmation is the next
+`bt_airpods` broadcast carrying the mode that is actually in effect.
+
### Messages
#### `bt_list_threads` (Client -> Daemon, answered directly)
diff --git a/docs/man/man1/tether.1.in b/docs/man/man1/tether.1.in
index 41c089f..41432d8 100644
--- a/docs/man/man1/tether.1.in
+++ b/docs/man/man1/tether.1.in
@@ -87,6 +87,13 @@ List Bluetooth devices known to BlueZ.
\fB\-\-bt-connection\fR
Show Bluetooth link and profile connection state.
.TP
+\fB\-\-bt-airpods\fR
+Show AirPods battery, for each bud and the case, and the current listening mode.
+.TP
+\fB\-\-bt-airpods-mode\fR \fIoff\fR|\fIanc\fR|\fItransparency\fR|\fIadaptive\fR
+Set the AirPods listening mode. The buds decline a mode they are not configured for
+without reporting an error, so check the result with \fB\-\-bt-airpods\fR.
+.TP
\fB\-\-bt-pair\fR \fIADDRESS\fR
Pair with an iPhone over Bluetooth.
.TP
diff --git a/po/cs.po b/po/cs.po
index 557c7bb..6e90429 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-08 16:08-0700\n"
+"POT-Creation-Date: 2026-09-08 16:30-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Czech\n"
@@ -91,6 +91,10 @@ msgstr "Zobrazit stav Bluetooth spojení a profilů."
msgid "Show AirPods and case battery."
msgstr "Zobrazit baterii AirPods a pouzdra."
+#: src/cli/main.cpp
+msgid "Set the AirPods listening mode: off, anc, transparency, adaptive."
+msgstr "Nastavit režim poslechu AirPods: off, anc, transparency, adaptive."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "Vypsat konverzace zpráv z iPhonu."
@@ -462,6 +466,15 @@ msgstr "Pouzdro"
msgid "Could not reach the daemon.\n"
msgstr "Nepodařilo se spojit s démonem.\n"
+#: src/cli/main.cpp
+#, c-format
+msgid "Listening mode set to %s.\n"
+msgstr "Režim poslechu nastaven na %s.\n"
+
+#: src/cli/main.cpp
+msgid "The listening mode could not be set."
+msgstr "Režim poslechu se nepodařilo nastavit."
+
#: src/cli/main.cpp
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "Démon uzavřel spojení dříve, než operace skončila.\n"
@@ -1234,6 +1247,14 @@ msgstr "Neznámá akce hovoru."
msgid "Not a DTMF sequence."
msgstr "Není to sekvence DTMF."
+#: src/core/src/net.cpp
+msgid "Unknown listening mode."
+msgstr "Neznámý režim poslechu."
+
+#: src/core/src/net.cpp src/gtk/devices_view.cpp
+msgid "No AirPods are connected."
+msgstr "Nejsou připojena žádná AirPods."
+
#: src/core/src/net.cpp
msgid "Notification mirroring is already active; nothing to do."
msgstr "Zrcadlení oznámení je již aktivní, není co dělat."
@@ -1448,6 +1469,26 @@ msgstr "Bluetooth není na tomto stroji dostupné."
msgid "Scanning for nearby devices..."
msgstr "Hledání zařízení v okolí..."
+#: src/gtk/devices_view.cpp
+msgid "Off"
+msgstr "Vypnuto"
+
+#: src/gtk/devices_view.cpp
+msgid "Transparency"
+msgstr "Propustnost"
+
+#: src/gtk/devices_view.cpp
+msgid "Adaptive"
+msgstr "Adaptivní"
+
+#: src/gtk/devices_view.cpp
+msgid "Noise Cancellation"
+msgstr "Potlačení hluku"
+
+#: src/gtk/devices_view.cpp
+msgid "These AirPods do not report a listening mode."
+msgstr "Tato AirPods nehlásí režim poslechu."
+
#: src/gtk/devices_view.cpp
msgid "Full mode — messages, contacts, and notifications."
msgstr "Plný režim — zprávy, kontakty a oznámení."
@@ -1738,6 +1779,10 @@ msgstr ""
msgid "Scan for devices"
msgstr "Hledat zařízení"
+#: src/gtk/devices_view.cpp
+msgid "Listening mode"
+msgstr "Režim poslechu"
+
#: src/gtk/devices_view.cpp
msgid "Bluetooth needs one-time system setup"
msgstr "Bluetooth vyžaduje jednorázové nastavení systému"
diff --git a/po/de.po b/po/de.po
index 9310f2d..590c81f 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-08 16:08-0700\n"
+"POT-Creation-Date: 2026-09-08 16:30-0700\n"
"PO-Revision-Date: 2026-08-22\n"
"Last-Translator: Tether project\n"
"Language-Team: German\n"
@@ -91,6 +91,10 @@ msgstr "Zustand von Bluetooth-Verbindung und Profilen anzeigen."
msgid "Show AirPods and case battery."
msgstr "Akkustand der AirPods und des Ladecase anzeigen."
+#: src/cli/main.cpp
+msgid "Set the AirPods listening mode: off, anc, transparency, adaptive."
+msgstr "AirPods-Hörmodus setzen: off, anc, transparency, adaptive."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "Nachrichtenunterhaltungen des iPhones auflisten."
@@ -460,6 +464,15 @@ msgstr "Case"
msgid "Could not reach the daemon.\n"
msgstr "Der Daemon war nicht erreichbar.\n"
+#: src/cli/main.cpp
+#, c-format
+msgid "Listening mode set to %s.\n"
+msgstr "Hörmodus auf %s gesetzt.\n"
+
+#: src/cli/main.cpp
+msgid "The listening mode could not be set."
+msgstr "Der Hörmodus konnte nicht gesetzt werden."
+
#: src/cli/main.cpp
msgid "Daemon closed the connection before the operation finished.\n"
msgstr ""
@@ -1263,6 +1276,14 @@ msgstr "Unbekannte Anrufaktion."
msgid "Not a DTMF sequence."
msgstr "Keine DTMF-Folge."
+#: src/core/src/net.cpp
+msgid "Unknown listening mode."
+msgstr "Unbekannter Hörmodus."
+
+#: src/core/src/net.cpp src/gtk/devices_view.cpp
+msgid "No AirPods are connected."
+msgstr "Es sind keine AirPods verbunden."
+
#: src/core/src/net.cpp
msgid "Notification mirroring is already active; nothing to do."
msgstr "Die Spiegelung von Mitteilungen ist bereits aktiv, nichts zu tun."
@@ -1478,6 +1499,26 @@ msgstr "Bluetooth ist auf diesem Rechner nicht verfügbar."
msgid "Scanning for nearby devices..."
msgstr "Suche nach Geräten in der Nähe..."
+#: src/gtk/devices_view.cpp
+msgid "Off"
+msgstr "Aus"
+
+#: src/gtk/devices_view.cpp
+msgid "Transparency"
+msgstr "Transparenzmodus"
+
+#: src/gtk/devices_view.cpp
+msgid "Adaptive"
+msgstr "Adaptiv"
+
+#: src/gtk/devices_view.cpp
+msgid "Noise Cancellation"
+msgstr "Geräuschunterdrückung"
+
+#: src/gtk/devices_view.cpp
+msgid "These AirPods do not report a listening mode."
+msgstr "Diese AirPods melden keinen Hörmodus."
+
#: src/gtk/devices_view.cpp
msgid "Full mode — messages, contacts, and notifications."
msgstr "Vollmodus — Nachrichten, Kontakte und Mitteilungen."
@@ -1773,6 +1814,10 @@ msgstr ""
msgid "Scan for devices"
msgstr "Nach Geräten suchen"
+#: src/gtk/devices_view.cpp
+msgid "Listening mode"
+msgstr "Hörmodus"
+
#: src/gtk/devices_view.cpp
msgid "Bluetooth needs one-time system setup"
msgstr "Bluetooth braucht eine einmalige Systemeinrichtung"
diff --git a/po/es.po b/po/es.po
index 9ca03e6..9a65d0b 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-08 16:08-0700\n"
+"POT-Creation-Date: 2026-09-08 16:30-0700\n"
"PO-Revision-Date: 2026-08-22\n"
"Last-Translator: Tether project\n"
"Language-Team: Spanish\n"
@@ -92,6 +92,12 @@ msgstr "Mostrar el estado del enlace y de los perfiles Bluetooth."
msgid "Show AirPods and case battery."
msgstr "Mostrar la batería de los AirPods y del estuche."
+#: src/cli/main.cpp
+msgid "Set the AirPods listening mode: off, anc, transparency, adaptive."
+msgstr ""
+"Establecer el modo de escucha de los AirPods: off, anc, transparency, "
+"adaptive."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "Listar las conversaciones de mensajes del iPhone."
@@ -462,6 +468,15 @@ msgstr "Estuche"
msgid "Could not reach the daemon.\n"
msgstr "No se pudo contactar con el daemon.\n"
+#: src/cli/main.cpp
+#, c-format
+msgid "Listening mode set to %s.\n"
+msgstr "Modo de escucha establecido en %s.\n"
+
+#: src/cli/main.cpp
+msgid "The listening mode could not be set."
+msgstr "No se pudo establecer el modo de escucha."
+
#: src/cli/main.cpp
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "El daemon cerró la conexión antes de terminar la operación.\n"
@@ -1252,6 +1267,14 @@ msgstr "Acción de llamada desconocida."
msgid "Not a DTMF sequence."
msgstr "No es una secuencia DTMF."
+#: src/core/src/net.cpp
+msgid "Unknown listening mode."
+msgstr "Modo de escucha desconocido."
+
+#: src/core/src/net.cpp src/gtk/devices_view.cpp
+msgid "No AirPods are connected."
+msgstr "No hay AirPods conectados."
+
#: src/core/src/net.cpp
msgid "Notification mirroring is already active; nothing to do."
msgstr ""
@@ -1469,6 +1492,26 @@ msgstr "Bluetooth no está disponible en este equipo."
msgid "Scanning for nearby devices..."
msgstr "Buscando dispositivos cercanos..."
+#: src/gtk/devices_view.cpp
+msgid "Off"
+msgstr "Desactivado"
+
+#: src/gtk/devices_view.cpp
+msgid "Transparency"
+msgstr "Transparencia"
+
+#: src/gtk/devices_view.cpp
+msgid "Adaptive"
+msgstr "Adaptativo"
+
+#: src/gtk/devices_view.cpp
+msgid "Noise Cancellation"
+msgstr "Cancelación de ruido"
+
+#: src/gtk/devices_view.cpp
+msgid "These AirPods do not report a listening mode."
+msgstr "Estos AirPods no informan de un modo de escucha."
+
#: src/gtk/devices_view.cpp
msgid "Full mode — messages, contacts, and notifications."
msgstr "Modo completo — mensajes, contactos y notificaciones."
@@ -1763,6 +1806,10 @@ msgstr ""
msgid "Scan for devices"
msgstr "Buscar dispositivos"
+#: src/gtk/devices_view.cpp
+msgid "Listening mode"
+msgstr "Modo de escucha"
+
#: src/gtk/devices_view.cpp
msgid "Bluetooth needs one-time system setup"
msgstr "Bluetooth necesita una configuración inicial del sistema"
diff --git a/po/fr.po b/po/fr.po
index 91d1d48..ab00b1f 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-08 16:08-0700\n"
+"POT-Creation-Date: 2026-09-08 16:30-0700\n"
"PO-Revision-Date: 2026-08-22\n"
"Last-Translator: Tether project\n"
"Language-Team: French\n"
@@ -93,6 +93,11 @@ msgstr "Afficher l'état du lien et des profils Bluetooth."
msgid "Show AirPods and case battery."
msgstr "Afficher la batterie des AirPods et du boîtier."
+#: src/cli/main.cpp
+msgid "Set the AirPods listening mode: off, anc, transparency, adaptive."
+msgstr ""
+"Définir le mode d'écoute des AirPods : off, anc, transparency, adaptive."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "Lister les conversations de l'iPhone."
@@ -466,6 +471,15 @@ msgstr "Boîtier"
msgid "Could not reach the daemon.\n"
msgstr "Impossible de joindre le démon.\n"
+#: src/cli/main.cpp
+#, c-format
+msgid "Listening mode set to %s.\n"
+msgstr "Mode d'écoute réglé sur %s.\n"
+
+#: src/cli/main.cpp
+msgid "The listening mode could not be set."
+msgstr "Impossible de régler le mode d'écoute."
+
#: src/cli/main.cpp
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"
@@ -1260,6 +1274,14 @@ msgstr "Action inconnue."
msgid "Not a DTMF sequence."
msgstr "Séquence DTMF invalide."
+#: src/core/src/net.cpp
+msgid "Unknown listening mode."
+msgstr "Mode d'écoute inconnu."
+
+#: src/core/src/net.cpp src/gtk/devices_view.cpp
+msgid "No AirPods are connected."
+msgstr "Aucun AirPods connecté."
+
#: src/core/src/net.cpp
msgid "Notification mirroring is already active; nothing to do."
msgstr "La duplication des notifications est déjà active, rien à faire."
@@ -1477,6 +1499,26 @@ msgstr "Bluetooth est indisponible sur cette machine."
msgid "Scanning for nearby devices..."
msgstr "Recherche d'appareils à proximité..."
+#: src/gtk/devices_view.cpp
+msgid "Off"
+msgstr "Désactivé"
+
+#: src/gtk/devices_view.cpp
+msgid "Transparency"
+msgstr "Transparence"
+
+#: src/gtk/devices_view.cpp
+msgid "Adaptive"
+msgstr "Adaptatif"
+
+#: src/gtk/devices_view.cpp
+msgid "Noise Cancellation"
+msgstr "Réduction de bruit"
+
+#: src/gtk/devices_view.cpp
+msgid "These AirPods do not report a listening mode."
+msgstr "Ces AirPods ne signalent pas de mode d'écoute."
+
#: src/gtk/devices_view.cpp
msgid "Full mode — messages, contacts, and notifications."
msgstr "Mode complet — messages, contacts et notifications."
@@ -1771,6 +1813,10 @@ msgstr ""
msgid "Scan for devices"
msgstr "Rechercher des appareils"
+#: src/gtk/devices_view.cpp
+msgid "Listening mode"
+msgstr "Mode d'écoute"
+
#: src/gtk/devices_view.cpp
msgid "Bluetooth needs one-time system setup"
msgstr "Bluetooth requiert une configuration système ponctuelle"
diff --git a/po/it.po b/po/it.po
index c695b73..90cccb0 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-08 16:08-0700\n"
+"POT-Creation-Date: 2026-09-08 16:30-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Italian\n"
@@ -93,6 +93,12 @@ msgstr "Mostra lo stato del collegamento Bluetooth e dei profili."
msgid "Show AirPods and case battery."
msgstr "Mostra la batteria degli AirPods e della custodia."
+#: src/cli/main.cpp
+msgid "Set the AirPods listening mode: off, anc, transparency, adaptive."
+msgstr ""
+"Imposta la modalità di ascolto degli AirPods: off, anc, transparency, "
+"adaptive."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "Elenca le conversazioni di messaggi dell'iPhone."
@@ -462,6 +468,15 @@ msgstr "Custodia"
msgid "Could not reach the daemon.\n"
msgstr "Impossibile raggiungere il daemon.\n"
+#: src/cli/main.cpp
+#, c-format
+msgid "Listening mode set to %s.\n"
+msgstr "Modalità di ascolto impostata su %s.\n"
+
+#: src/cli/main.cpp
+msgid "The listening mode could not be set."
+msgstr "Impossibile impostare la modalità di ascolto."
+
#: src/cli/main.cpp
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "Il daemon ha chiuso la connessione prima che l'operazione finisse.\n"
@@ -1253,6 +1268,14 @@ msgstr "Azione di chiamata sconosciuta."
msgid "Not a DTMF sequence."
msgstr "Non è una sequenza DTMF."
+#: src/core/src/net.cpp
+msgid "Unknown listening mode."
+msgstr "Modalità di ascolto sconosciuta."
+
+#: src/core/src/net.cpp src/gtk/devices_view.cpp
+msgid "No AirPods are connected."
+msgstr "Nessun AirPods connesso."
+
#: src/core/src/net.cpp
msgid "Notification mirroring is already active; nothing to do."
msgstr "Il mirroring delle notifiche è già attivo, non c'è nulla da fare."
@@ -1468,6 +1491,26 @@ msgstr "Bluetooth non è disponibile su questa macchina."
msgid "Scanning for nearby devices..."
msgstr "Ricerca di dispositivi nelle vicinanze..."
+#: src/gtk/devices_view.cpp
+msgid "Off"
+msgstr "Disattivata"
+
+#: src/gtk/devices_view.cpp
+msgid "Transparency"
+msgstr "Trasparenza"
+
+#: src/gtk/devices_view.cpp
+msgid "Adaptive"
+msgstr "Adattiva"
+
+#: src/gtk/devices_view.cpp
+msgid "Noise Cancellation"
+msgstr "Cancellazione del rumore"
+
+#: src/gtk/devices_view.cpp
+msgid "These AirPods do not report a listening mode."
+msgstr "Questi AirPods non segnalano una modalità di ascolto."
+
#: src/gtk/devices_view.cpp
msgid "Full mode — messages, contacts, and notifications."
msgstr "Modalità completa — messaggi, contatti e notifiche."
@@ -1763,6 +1806,10 @@ msgstr ""
msgid "Scan for devices"
msgstr "Cerca dispositivi"
+#: src/gtk/devices_view.cpp
+msgid "Listening mode"
+msgstr "Modalità di ascolto"
+
#: src/gtk/devices_view.cpp
msgid "Bluetooth needs one-time system setup"
msgstr "Bluetooth richiede una configurazione di sistema una tantum"
diff --git a/po/ja.po b/po/ja.po
index bc2ef8b..328840e 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-08 16:08-0700\n"
+"POT-Creation-Date: 2026-09-08 16:30-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Japanese\n"
@@ -91,6 +91,11 @@ msgstr "Bluetooth リンクとプロファイルの接続状態を表示しま
msgid "Show AirPods and case battery."
msgstr "AirPods とケースのバッテリーを表示します。"
+#: src/cli/main.cpp
+msgid "Set the AirPods listening mode: off, anc, transparency, adaptive."
+msgstr ""
+"AirPods のリスニングモードを設定します: off, anc, transparency, adaptive。"
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "iPhone のメッセージの会話を一覧表示します。"
@@ -452,6 +457,15 @@ msgstr "ケース"
msgid "Could not reach the daemon.\n"
msgstr "デーモンに接続できませんでした。\n"
+#: src/cli/main.cpp
+#, c-format
+msgid "Listening mode set to %s.\n"
+msgstr "リスニングモードを %s に設定しました。\n"
+
+#: src/cli/main.cpp
+msgid "The listening mode could not be set."
+msgstr "リスニングモードを設定できませんでした。"
+
#: src/cli/main.cpp
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "操作が完了する前にデーモンが接続を閉じました。\n"
@@ -1226,6 +1240,14 @@ msgstr "不明な通話操作です。"
msgid "Not a DTMF sequence."
msgstr "DTMF シーケンスではありません。"
+#: src/core/src/net.cpp
+msgid "Unknown listening mode."
+msgstr "不明なリスニングモードです。"
+
+#: src/core/src/net.cpp src/gtk/devices_view.cpp
+msgid "No AirPods are connected."
+msgstr "AirPods が接続されていません。"
+
#: src/core/src/net.cpp
msgid "Notification mirroring is already active; nothing to do."
msgstr "通知のミラーリングはすでに有効です。操作は不要です。"
@@ -1440,6 +1462,26 @@ msgstr "このマシンでは Bluetooth を利用できません。"
msgid "Scanning for nearby devices..."
msgstr "近くのデバイスを検索しています..."
+#: src/gtk/devices_view.cpp
+msgid "Off"
+msgstr "オフ"
+
+#: src/gtk/devices_view.cpp
+msgid "Transparency"
+msgstr "外部音取り込み"
+
+#: src/gtk/devices_view.cpp
+msgid "Adaptive"
+msgstr "アダプティブ"
+
+#: src/gtk/devices_view.cpp
+msgid "Noise Cancellation"
+msgstr "ノイズキャンセリング"
+
+#: src/gtk/devices_view.cpp
+msgid "These AirPods do not report a listening mode."
+msgstr "この AirPods はリスニングモードを報告しません。"
+
#: src/gtk/devices_view.cpp
msgid "Full mode — messages, contacts, and notifications."
msgstr "フルモード — メッセージ、連絡先、通知。"
@@ -1730,6 +1772,10 @@ msgstr ""
msgid "Scan for devices"
msgstr "デバイスを検索"
+#: src/gtk/devices_view.cpp
+msgid "Listening mode"
+msgstr "リスニングモード"
+
#: src/gtk/devices_view.cpp
msgid "Bluetooth needs one-time system setup"
msgstr "Bluetooth には一度きりのシステム設定が必要です"
diff --git a/po/ko.po b/po/ko.po
index 699fba1..abaff75 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-08 16:08-0700\n"
+"POT-Creation-Date: 2026-09-08 16:30-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Korean\n"
@@ -90,6 +90,10 @@ msgstr "Bluetooth 링크와 프로파일의 연결 상태를 표시합니다."
msgid "Show AirPods and case battery."
msgstr "AirPods 및 케이스 배터리를 표시합니다."
+#: src/cli/main.cpp
+msgid "Set the AirPods listening mode: off, anc, transparency, adaptive."
+msgstr "AirPods 청취 모드를 설정합니다: off, anc, transparency, adaptive."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "iPhone의 메시지 대화를 나열합니다."
@@ -450,6 +454,15 @@ msgstr "케이스"
msgid "Could not reach the daemon.\n"
msgstr "데몬에 연결하지 못했습니다.\n"
+#: src/cli/main.cpp
+#, c-format
+msgid "Listening mode set to %s.\n"
+msgstr "청취 모드를 %s(으)로 설정했습니다.\n"
+
+#: src/cli/main.cpp
+msgid "The listening mode could not be set."
+msgstr "청취 모드를 설정할 수 없습니다."
+
#: src/cli/main.cpp
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "작업이 끝나기 전에 데몬이 연결을 닫았습니다.\n"
@@ -1212,6 +1225,14 @@ msgstr "알 수 없는 통화 동작입니다."
msgid "Not a DTMF sequence."
msgstr "DTMF 시퀀스가 아닙니다."
+#: src/core/src/net.cpp
+msgid "Unknown listening mode."
+msgstr "알 수 없는 청취 모드입니다."
+
+#: src/core/src/net.cpp src/gtk/devices_view.cpp
+msgid "No AirPods are connected."
+msgstr "연결된 AirPods가 없습니다."
+
#: src/core/src/net.cpp
msgid "Notification mirroring is already active; nothing to do."
msgstr "알림 미러링이 이미 활성 상태입니다. 할 일이 없습니다."
@@ -1423,6 +1444,26 @@ msgstr "이 컴퓨터에서는 Bluetooth를 사용할 수 없습니다."
msgid "Scanning for nearby devices..."
msgstr "근처 기기를 검색하는 중..."
+#: src/gtk/devices_view.cpp
+msgid "Off"
+msgstr "끔"
+
+#: src/gtk/devices_view.cpp
+msgid "Transparency"
+msgstr "주변음 허용"
+
+#: src/gtk/devices_view.cpp
+msgid "Adaptive"
+msgstr "적응형"
+
+#: src/gtk/devices_view.cpp
+msgid "Noise Cancellation"
+msgstr "노이즈 캔슬링"
+
+#: src/gtk/devices_view.cpp
+msgid "These AirPods do not report a listening mode."
+msgstr "이 AirPods는 청취 모드를 보고하지 않습니다."
+
#: src/gtk/devices_view.cpp
msgid "Full mode — messages, contacts, and notifications."
msgstr "전체 모드 — 메시지, 연락처, 알림."
@@ -1709,6 +1750,10 @@ msgstr ""
msgid "Scan for devices"
msgstr "기기 검색"
+#: src/gtk/devices_view.cpp
+msgid "Listening mode"
+msgstr "청취 모드"
+
#: src/gtk/devices_view.cpp
msgid "Bluetooth needs one-time system setup"
msgstr "Bluetooth에는 일회성 시스템 설정이 필요합니다"
diff --git a/po/nl.po b/po/nl.po
index 9450cd9..9415a3b 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-08 16:08-0700\n"
+"POT-Creation-Date: 2026-09-08 16:30-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Dutch\n"
@@ -91,6 +91,11 @@ msgstr "Status van de Bluetooth-verbinding en van de profielen tonen."
msgid "Show AirPods and case battery."
msgstr "Accu van de AirPods en de case tonen."
+#: src/cli/main.cpp
+msgid "Set the AirPods listening mode: off, anc, transparency, adaptive."
+msgstr ""
+"De luistermodus van de AirPods instellen: off, anc, transparency, adaptive."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "Berichtgesprekken van de iPhone tonen."
@@ -460,6 +465,15 @@ msgstr "Case"
msgid "Could not reach the daemon.\n"
msgstr "Kon de daemon niet bereiken.\n"
+#: src/cli/main.cpp
+#, c-format
+msgid "Listening mode set to %s.\n"
+msgstr "Luistermodus ingesteld op %s.\n"
+
+#: src/cli/main.cpp
+msgid "The listening mode could not be set."
+msgstr "De luistermodus kon niet worden ingesteld."
+
#: src/cli/main.cpp
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "De daemon sloot de verbinding voordat de bewerking klaar was.\n"
@@ -1244,6 +1258,14 @@ msgstr "Onbekende oproepactie."
msgid "Not a DTMF sequence."
msgstr "Geen DTMF-reeks."
+#: src/core/src/net.cpp
+msgid "Unknown listening mode."
+msgstr "Onbekende luistermodus."
+
+#: src/core/src/net.cpp src/gtk/devices_view.cpp
+msgid "No AirPods are connected."
+msgstr "Er zijn geen AirPods verbonden."
+
#: src/core/src/net.cpp
msgid "Notification mirroring is already active; nothing to do."
msgstr "Het spiegelen van meldingen is al actief, niets te doen."
@@ -1460,6 +1482,26 @@ msgstr "Bluetooth is niet beschikbaar op deze machine."
msgid "Scanning for nearby devices..."
msgstr "Zoeken naar apparaten in de buurt..."
+#: src/gtk/devices_view.cpp
+msgid "Off"
+msgstr "Uit"
+
+#: src/gtk/devices_view.cpp
+msgid "Transparency"
+msgstr "Transparantie"
+
+#: src/gtk/devices_view.cpp
+msgid "Adaptive"
+msgstr "Adaptief"
+
+#: src/gtk/devices_view.cpp
+msgid "Noise Cancellation"
+msgstr "Ruisonderdrukking"
+
+#: src/gtk/devices_view.cpp
+msgid "These AirPods do not report a listening mode."
+msgstr "Deze AirPods melden geen luistermodus."
+
#: src/gtk/devices_view.cpp
msgid "Full mode — messages, contacts, and notifications."
msgstr "Volledige modus — berichten, contacten en meldingen."
@@ -1752,6 +1794,10 @@ msgstr ""
msgid "Scan for devices"
msgstr "Zoek apparaten"
+#: src/gtk/devices_view.cpp
+msgid "Listening mode"
+msgstr "Luistermodus"
+
#: src/gtk/devices_view.cpp
msgid "Bluetooth needs one-time system setup"
msgstr "Bluetooth vereist een eenmalige systeeminstelling"
diff --git a/po/pl.po b/po/pl.po
index b0d98b3..4e6be78 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-08 16:08-0700\n"
+"POT-Creation-Date: 2026-09-08 16:30-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Polish\n"
@@ -92,6 +92,10 @@ msgstr "Pokaż stan połączenia Bluetooth i profili."
msgid "Show AirPods and case battery."
msgstr "Pokaż poziom baterii AirPods i etui."
+#: src/cli/main.cpp
+msgid "Set the AirPods listening mode: off, anc, transparency, adaptive."
+msgstr "Ustaw tryb słuchania AirPods: off, anc, transparency, adaptive."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "Wypisz rozmowy z wiadomościami z iPhone'a."
@@ -465,6 +469,15 @@ msgstr "Etui"
msgid "Could not reach the daemon.\n"
msgstr "Nie udało się połączyć z demonem.\n"
+#: src/cli/main.cpp
+#, c-format
+msgid "Listening mode set to %s.\n"
+msgstr "Tryb słuchania ustawiony na %s.\n"
+
+#: src/cli/main.cpp
+msgid "The listening mode could not be set."
+msgstr "Nie można ustawić trybu słuchania."
+
#: src/cli/main.cpp
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "Demon zamknął połączenie, zanim operacja się zakończyła.\n"
@@ -1247,6 +1260,14 @@ msgstr "Nieznana akcja połączenia."
msgid "Not a DTMF sequence."
msgstr "To nie jest sekwencja DTMF."
+#: src/core/src/net.cpp
+msgid "Unknown listening mode."
+msgstr "Nieznany tryb słuchania."
+
+#: src/core/src/net.cpp src/gtk/devices_view.cpp
+msgid "No AirPods are connected."
+msgstr "Nie podłączono żadnych AirPods."
+
#: src/core/src/net.cpp
msgid "Notification mirroring is already active; nothing to do."
msgstr "Kopiowanie powiadomień jest już aktywne, nie ma nic do zrobienia."
@@ -1462,6 +1483,26 @@ msgstr "Bluetooth jest niedostępny na tej maszynie."
msgid "Scanning for nearby devices..."
msgstr "Wyszukiwanie urządzeń w pobliżu..."
+#: src/gtk/devices_view.cpp
+msgid "Off"
+msgstr "Wyłączony"
+
+#: src/gtk/devices_view.cpp
+msgid "Transparency"
+msgstr "Przepuszczanie dźwięku"
+
+#: src/gtk/devices_view.cpp
+msgid "Adaptive"
+msgstr "Adaptacyjny"
+
+#: src/gtk/devices_view.cpp
+msgid "Noise Cancellation"
+msgstr "Redukcja szumów"
+
+#: src/gtk/devices_view.cpp
+msgid "These AirPods do not report a listening mode."
+msgstr "Te AirPods nie zgłaszają trybu słuchania."
+
#: src/gtk/devices_view.cpp
msgid "Full mode — messages, contacts, and notifications."
msgstr "Tryb pełny — wiadomości, kontakty i powiadomienia."
@@ -1753,6 +1794,10 @@ msgstr ""
msgid "Scan for devices"
msgstr "Szukaj urządzeń"
+#: src/gtk/devices_view.cpp
+msgid "Listening mode"
+msgstr "Tryb słuchania"
+
#: src/gtk/devices_view.cpp
msgid "Bluetooth needs one-time system setup"
msgstr "Bluetooth wymaga jednorazowej konfiguracji systemu"
diff --git a/po/pt_BR.po b/po/pt_BR.po
index 7172e1e..670a7fa 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-08 16:08-0700\n"
+"POT-Creation-Date: 2026-09-08 16:30-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Brazilian Portuguese\n"
@@ -92,6 +92,11 @@ msgstr "Mostrar o estado do enlace Bluetooth e dos perfis."
msgid "Show AirPods and case battery."
msgstr "Mostrar a bateria dos AirPods e do estojo."
+#: src/cli/main.cpp
+msgid "Set the AirPods listening mode: off, anc, transparency, adaptive."
+msgstr ""
+"Definir o modo de escuta dos AirPods: off, anc, transparency, adaptive."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "Listar as conversas de mensagens do iPhone."
@@ -460,6 +465,15 @@ msgstr "Estojo"
msgid "Could not reach the daemon.\n"
msgstr "Não foi possível alcançar o daemon.\n"
+#: src/cli/main.cpp
+#, c-format
+msgid "Listening mode set to %s.\n"
+msgstr "Modo de escuta definido como %s.\n"
+
+#: src/cli/main.cpp
+msgid "The listening mode could not be set."
+msgstr "Não foi possível definir o modo de escuta."
+
#: src/cli/main.cpp
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "O daemon fechou a conexão antes de a operação terminar.\n"
@@ -1248,6 +1262,14 @@ msgstr "Ação de chamada desconhecida."
msgid "Not a DTMF sequence."
msgstr "Não é uma sequência DTMF."
+#: src/core/src/net.cpp
+msgid "Unknown listening mode."
+msgstr "Modo de escuta desconhecido."
+
+#: src/core/src/net.cpp src/gtk/devices_view.cpp
+msgid "No AirPods are connected."
+msgstr "Nenhum AirPods conectado."
+
#: src/core/src/net.cpp
msgid "Notification mirroring is already active; nothing to do."
msgstr "O espelhamento de notificações já está ativo; nada a fazer."
@@ -1463,6 +1485,26 @@ msgstr "O Bluetooth está indisponível nesta máquina."
msgid "Scanning for nearby devices..."
msgstr "Procurando dispositivos por perto..."
+#: src/gtk/devices_view.cpp
+msgid "Off"
+msgstr "Desativado"
+
+#: src/gtk/devices_view.cpp
+msgid "Transparency"
+msgstr "Transparência"
+
+#: src/gtk/devices_view.cpp
+msgid "Adaptive"
+msgstr "Adaptativo"
+
+#: src/gtk/devices_view.cpp
+msgid "Noise Cancellation"
+msgstr "Cancelamento de ruído"
+
+#: src/gtk/devices_view.cpp
+msgid "These AirPods do not report a listening mode."
+msgstr "Estes AirPods não informam um modo de escuta."
+
#: src/gtk/devices_view.cpp
msgid "Full mode — messages, contacts, and notifications."
msgstr "Modo completo — mensagens, contatos e notificações."
@@ -1755,6 +1797,10 @@ msgstr ""
msgid "Scan for devices"
msgstr "Procurar dispositivos"
+#: src/gtk/devices_view.cpp
+msgid "Listening mode"
+msgstr "Modo de escuta"
+
#: src/gtk/devices_view.cpp
msgid "Bluetooth needs one-time system setup"
msgstr "O Bluetooth precisa de uma configuração única do sistema"
diff --git a/po/ru.po b/po/ru.po
index fca0770..b72cefd 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-08 16:08-0700\n"
+"POT-Creation-Date: 2026-09-08 16:30-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Russian\n"
@@ -92,6 +92,10 @@ msgstr "Показать состояние соединения Bluetooth и п
msgid "Show AirPods and case battery."
msgstr "Показать заряд AirPods и футляра."
+#: src/cli/main.cpp
+msgid "Set the AirPods listening mode: off, anc, transparency, adaptive."
+msgstr "Задать режим прослушивания AirPods: off, anc, transparency, adaptive."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "Показать переписки с сообщениями на iPhone."
@@ -465,6 +469,15 @@ msgstr "Футляр"
msgid "Could not reach the daemon.\n"
msgstr "Не удалось связаться с демоном.\n"
+#: src/cli/main.cpp
+#, c-format
+msgid "Listening mode set to %s.\n"
+msgstr "Режим прослушивания установлен на %s.\n"
+
+#: src/cli/main.cpp
+msgid "The listening mode could not be set."
+msgstr "Не удалось задать режим прослушивания."
+
#: src/cli/main.cpp
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "Демон закрыл соединение до завершения операции.\n"
@@ -1245,6 +1258,14 @@ msgstr "Неизвестное действие с вызовом."
msgid "Not a DTMF sequence."
msgstr "Это не последовательность DTMF."
+#: src/core/src/net.cpp
+msgid "Unknown listening mode."
+msgstr "Неизвестный режим прослушивания."
+
+#: src/core/src/net.cpp src/gtk/devices_view.cpp
+msgid "No AirPods are connected."
+msgstr "AirPods не подключены."
+
#: src/core/src/net.cpp
msgid "Notification mirroring is already active; nothing to do."
msgstr "Дублирование уведомлений уже активно, делать ничего не нужно."
@@ -1460,6 +1481,26 @@ msgstr "Bluetooth недоступен на этой машине."
msgid "Scanning for nearby devices..."
msgstr "Поиск устройств поблизости..."
+#: src/gtk/devices_view.cpp
+msgid "Off"
+msgstr "Выключено"
+
+#: src/gtk/devices_view.cpp
+msgid "Transparency"
+msgstr "Прозрачность"
+
+#: src/gtk/devices_view.cpp
+msgid "Adaptive"
+msgstr "Адаптивный"
+
+#: src/gtk/devices_view.cpp
+msgid "Noise Cancellation"
+msgstr "Шумоподавление"
+
+#: src/gtk/devices_view.cpp
+msgid "These AirPods do not report a listening mode."
+msgstr "Эти AirPods не сообщают режим прослушивания."
+
#: src/gtk/devices_view.cpp
msgid "Full mode — messages, contacts, and notifications."
msgstr "Полный режим — сообщения, контакты и уведомления."
@@ -1754,6 +1795,10 @@ msgstr ""
msgid "Scan for devices"
msgstr "Искать устройства"
+#: src/gtk/devices_view.cpp
+msgid "Listening mode"
+msgstr "Режим прослушивания"
+
#: src/gtk/devices_view.cpp
msgid "Bluetooth needs one-time system setup"
msgstr "Bluetooth требует разовой настройки системы"
diff --git a/po/sv.po b/po/sv.po
index 369c185..5383e6f 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-08 16:08-0700\n"
+"POT-Creation-Date: 2026-09-08 16:30-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Swedish\n"
@@ -92,6 +92,10 @@ msgstr "Visa status för Bluetooth-länken och profilerna."
msgid "Show AirPods and case battery."
msgstr "Visa batterinivå för AirPods och etui."
+#: src/cli/main.cpp
+msgid "Set the AirPods listening mode: off, anc, transparency, adaptive."
+msgstr "Ställ in AirPods lyssningsläge: off, anc, transparency, adaptive."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "Lista iPhonens meddelandekonversationer."
@@ -458,6 +462,15 @@ msgstr "Etui"
msgid "Could not reach the daemon.\n"
msgstr "Kunde inte nå demonen.\n"
+#: src/cli/main.cpp
+#, c-format
+msgid "Listening mode set to %s.\n"
+msgstr "Lyssningsläget är inställt på %s.\n"
+
+#: src/cli/main.cpp
+msgid "The listening mode could not be set."
+msgstr "Lyssningsläget kunde inte ställas in."
+
#: src/cli/main.cpp
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "Demonen stängde anslutningen innan åtgärden var klar.\n"
@@ -1232,6 +1245,14 @@ msgstr "Okänd samtalsåtgärd."
msgid "Not a DTMF sequence."
msgstr "Inte en DTMF-sekvens."
+#: src/core/src/net.cpp
+msgid "Unknown listening mode."
+msgstr "Okänt lyssningsläge."
+
+#: src/core/src/net.cpp src/gtk/devices_view.cpp
+msgid "No AirPods are connected."
+msgstr "Inga AirPods anslutna."
+
#: src/core/src/net.cpp
msgid "Notification mirroring is already active; nothing to do."
msgstr "Spegling av aviseringar är redan aktiv, inget att göra."
@@ -1444,6 +1465,26 @@ msgstr "Bluetooth är otillgängligt på den här maskinen."
msgid "Scanning for nearby devices..."
msgstr "Söker efter enheter i närheten..."
+#: src/gtk/devices_view.cpp
+msgid "Off"
+msgstr "Av"
+
+#: src/gtk/devices_view.cpp
+msgid "Transparency"
+msgstr "Genomsläpp"
+
+#: src/gtk/devices_view.cpp
+msgid "Adaptive"
+msgstr "Adaptivt"
+
+#: src/gtk/devices_view.cpp
+msgid "Noise Cancellation"
+msgstr "Brusreducering"
+
+#: src/gtk/devices_view.cpp
+msgid "These AirPods do not report a listening mode."
+msgstr "De här AirPods rapporterar inget lyssningsläge."
+
#: src/gtk/devices_view.cpp
msgid "Full mode — messages, contacts, and notifications."
msgstr "Fullt läge — meddelanden, kontakter och aviseringar."
@@ -1735,6 +1776,10 @@ msgstr ""
msgid "Scan for devices"
msgstr "Sök efter enheter"
+#: src/gtk/devices_view.cpp
+msgid "Listening mode"
+msgstr "Lyssningsläge"
+
#: src/gtk/devices_view.cpp
msgid "Bluetooth needs one-time system setup"
msgstr "Bluetooth kräver en engångsinställning av systemet"
diff --git a/po/tether.pot b/po/tether.pot
index ebde9d7..11b369b 100644
--- a/po/tether.pot
+++ b/po/tether.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether 0.2.27\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-09-08 16:08-0700\n"
+"POT-Creation-Date: 2026-09-08 16:30-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"
@@ -90,6 +90,10 @@ msgstr ""
msgid "Show AirPods and case battery."
msgstr ""
+#: src/cli/main.cpp
+msgid "Set the AirPods listening mode: off, anc, transparency, adaptive."
+msgstr ""
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr ""
@@ -419,6 +423,15 @@ msgstr ""
msgid "Could not reach the daemon.\n"
msgstr ""
+#: src/cli/main.cpp
+#, c-format
+msgid "Listening mode set to %s.\n"
+msgstr ""
+
+#: src/cli/main.cpp
+msgid "The listening mode could not be set."
+msgstr ""
+
#: src/cli/main.cpp
msgid "Daemon closed the connection before the operation finished.\n"
msgstr ""
@@ -1110,6 +1123,14 @@ msgstr ""
msgid "Not a DTMF sequence."
msgstr ""
+#: src/core/src/net.cpp
+msgid "Unknown listening mode."
+msgstr ""
+
+#: src/core/src/net.cpp src/gtk/devices_view.cpp
+msgid "No AirPods are connected."
+msgstr ""
+
#: src/core/src/net.cpp
msgid "Notification mirroring is already active; nothing to do."
msgstr ""
@@ -1315,6 +1336,26 @@ msgstr ""
msgid "Scanning for nearby devices..."
msgstr ""
+#: src/gtk/devices_view.cpp
+msgid "Off"
+msgstr ""
+
+#: src/gtk/devices_view.cpp
+msgid "Transparency"
+msgstr ""
+
+#: src/gtk/devices_view.cpp
+msgid "Adaptive"
+msgstr ""
+
+#: src/gtk/devices_view.cpp
+msgid "Noise Cancellation"
+msgstr ""
+
+#: src/gtk/devices_view.cpp
+msgid "These AirPods do not report a listening mode."
+msgstr ""
+
#: src/gtk/devices_view.cpp
msgid "Full mode — messages, contacts, and notifications."
msgstr ""
@@ -1577,6 +1618,10 @@ msgstr ""
msgid "Scan for devices"
msgstr ""
+#: src/gtk/devices_view.cpp
+msgid "Listening mode"
+msgstr ""
+
#: src/gtk/devices_view.cpp
msgid "Bluetooth needs one-time system setup"
msgstr ""
diff --git a/po/tr.po b/po/tr.po
index 345999b..e9260c2 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-08 16:08-0700\n"
+"POT-Creation-Date: 2026-09-08 16:30-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Turkish\n"
@@ -90,6 +90,10 @@ msgstr "Bluetooth bağlantısının ve profillerin durumunu göster."
msgid "Show AirPods and case battery."
msgstr "AirPods ve kutu pil durumunu göster."
+#: src/cli/main.cpp
+msgid "Set the AirPods listening mode: off, anc, transparency, adaptive."
+msgstr "AirPods dinleme modunu ayarla: off, anc, transparency, adaptive."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "iPhone'daki mesaj konuşmalarını listele."
@@ -459,6 +463,15 @@ msgstr "Kutu"
msgid "Could not reach the daemon.\n"
msgstr "Arka plan hizmetine ulaşılamadı.\n"
+#: src/cli/main.cpp
+#, c-format
+msgid "Listening mode set to %s.\n"
+msgstr "Dinleme modu %s olarak ayarlandı.\n"
+
+#: src/cli/main.cpp
+msgid "The listening mode could not be set."
+msgstr "Dinleme modu ayarlanamadı."
+
#: src/cli/main.cpp
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "Arka plan hizmeti, işlem bitmeden bağlantıyı kapattı.\n"
@@ -1232,6 +1245,14 @@ msgstr "Bilinmeyen çağrı işlemi."
msgid "Not a DTMF sequence."
msgstr "DTMF dizisi değil."
+#: src/core/src/net.cpp
+msgid "Unknown listening mode."
+msgstr "Bilinmeyen dinleme modu."
+
+#: src/core/src/net.cpp src/gtk/devices_view.cpp
+msgid "No AirPods are connected."
+msgstr "Bağlı AirPods yok."
+
#: src/core/src/net.cpp
msgid "Notification mirroring is already active; nothing to do."
msgstr "Bildirim yansıtma zaten etkin, yapılacak bir şey yok."
@@ -1444,6 +1465,26 @@ msgstr "Bu makinede Bluetooth kullanılamıyor."
msgid "Scanning for nearby devices..."
msgstr "Yakındaki aygıtlar taranıyor..."
+#: src/gtk/devices_view.cpp
+msgid "Off"
+msgstr "Kapalı"
+
+#: src/gtk/devices_view.cpp
+msgid "Transparency"
+msgstr "Şeffaflık"
+
+#: src/gtk/devices_view.cpp
+msgid "Adaptive"
+msgstr "Uyarlanabilir"
+
+#: src/gtk/devices_view.cpp
+msgid "Noise Cancellation"
+msgstr "Gürültü Engelleme"
+
+#: src/gtk/devices_view.cpp
+msgid "These AirPods do not report a listening mode."
+msgstr "Bu AirPods bir dinleme modu bildirmiyor."
+
#: src/gtk/devices_view.cpp
msgid "Full mode — messages, contacts, and notifications."
msgstr "Tam kip — mesajlar, kişiler ve bildirimler."
@@ -1731,6 +1772,10 @@ msgstr ""
msgid "Scan for devices"
msgstr "Aygıtları tara"
+#: src/gtk/devices_view.cpp
+msgid "Listening mode"
+msgstr "Dinleme modu"
+
#: src/gtk/devices_view.cpp
msgid "Bluetooth needs one-time system setup"
msgstr "Bluetooth tek seferlik sistem kurulumu gerektiriyor"
diff --git a/po/uk.po b/po/uk.po
index 11e3d37..79b401a 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-08 16:08-0700\n"
+"POT-Creation-Date: 2026-09-08 16:30-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Ukrainian\n"
@@ -93,6 +93,11 @@ msgstr "Показати стан з'єднання Bluetooth і профілі
msgid "Show AirPods and case battery."
msgstr "Показати заряд AirPods і футляра."
+#: src/cli/main.cpp
+msgid "Set the AirPods listening mode: off, anc, transparency, adaptive."
+msgstr ""
+"Задати режим прослуховування AirPods: off, anc, transparency, adaptive."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "Показати розмови з повідомленнями на iPhone."
@@ -465,6 +470,15 @@ msgstr "Футляр"
msgid "Could not reach the daemon.\n"
msgstr "Не вдалося зв'язатися з демоном.\n"
+#: src/cli/main.cpp
+#, c-format
+msgid "Listening mode set to %s.\n"
+msgstr "Режим прослуховування встановлено на %s.\n"
+
+#: src/cli/main.cpp
+msgid "The listening mode could not be set."
+msgstr "Не вдалося задати режим прослуховування."
+
#: src/cli/main.cpp
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "Демон закрив з'єднання до завершення операції.\n"
@@ -1243,6 +1257,14 @@ msgstr "Невідома дія з викликом."
msgid "Not a DTMF sequence."
msgstr "Це не послідовність DTMF."
+#: src/core/src/net.cpp
+msgid "Unknown listening mode."
+msgstr "Невідомий режим прослуховування."
+
+#: src/core/src/net.cpp src/gtk/devices_view.cpp
+msgid "No AirPods are connected."
+msgstr "AirPods не під'єднано."
+
#: src/core/src/net.cpp
msgid "Notification mirroring is already active; nothing to do."
msgstr "Дублювання сповіщень уже активне, робити нічого не потрібно."
@@ -1458,6 +1480,26 @@ msgstr "Bluetooth недоступний на цій машині."
msgid "Scanning for nearby devices..."
msgstr "Пошук пристроїв поблизу..."
+#: src/gtk/devices_view.cpp
+msgid "Off"
+msgstr "Вимкнено"
+
+#: src/gtk/devices_view.cpp
+msgid "Transparency"
+msgstr "Прозорість"
+
+#: src/gtk/devices_view.cpp
+msgid "Adaptive"
+msgstr "Адаптивний"
+
+#: src/gtk/devices_view.cpp
+msgid "Noise Cancellation"
+msgstr "Шумозаглушення"
+
+#: src/gtk/devices_view.cpp
+msgid "These AirPods do not report a listening mode."
+msgstr "Ці AirPods не повідомляють режим прослуховування."
+
#: src/gtk/devices_view.cpp
msgid "Full mode — messages, contacts, and notifications."
msgstr "Повний режим — повідомлення, контакти та сповіщення."
@@ -1751,6 +1793,10 @@ msgstr ""
msgid "Scan for devices"
msgstr "Шукати пристрої"
+#: src/gtk/devices_view.cpp
+msgid "Listening mode"
+msgstr "Режим прослуховування"
+
#: src/gtk/devices_view.cpp
msgid "Bluetooth needs one-time system setup"
msgstr "Bluetooth потребує одноразового налаштування системи"
diff --git a/po/zh_CN.po b/po/zh_CN.po
index 55e951d..2529978 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-08 16:08-0700\n"
+"POT-Creation-Date: 2026-09-08 16:30-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Simplified Chinese\n"
@@ -90,6 +90,10 @@ msgstr "显示蓝牙链路和配置文件的连接状态。"
msgid "Show AirPods and case battery."
msgstr "显示 AirPods 和充电盒电量。"
+#: src/cli/main.cpp
+msgid "Set the AirPods listening mode: off, anc, transparency, adaptive."
+msgstr "设置 AirPods 聆听模式:off、anc、transparency、adaptive。"
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "列出 iPhone 的信息会话。"
@@ -442,6 +446,15 @@ msgstr "充电盒"
msgid "Could not reach the daemon.\n"
msgstr "无法连接到守护进程。\n"
+#: src/cli/main.cpp
+#, c-format
+msgid "Listening mode set to %s.\n"
+msgstr "聆听模式已设为 %s。\n"
+
+#: src/cli/main.cpp
+msgid "The listening mode could not be set."
+msgstr "无法设置聆听模式。"
+
#: src/cli/main.cpp
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "操作完成前守护进程已关闭连接。\n"
@@ -1180,6 +1193,14 @@ msgstr "未知的通话操作。"
msgid "Not a DTMF sequence."
msgstr "不是 DTMF 序列。"
+#: src/core/src/net.cpp
+msgid "Unknown listening mode."
+msgstr "未知的聆听模式。"
+
+#: src/core/src/net.cpp src/gtk/devices_view.cpp
+msgid "No AirPods are connected."
+msgstr "未连接 AirPods。"
+
#: src/core/src/net.cpp
msgid "Notification mirroring is already active; nothing to do."
msgstr "通知镜像已在运行,无需操作。"
@@ -1390,6 +1411,26 @@ msgstr "这台机器上蓝牙不可用。"
msgid "Scanning for nearby devices..."
msgstr "正在搜索附近的设备……"
+#: src/gtk/devices_view.cpp
+msgid "Off"
+msgstr "关闭"
+
+#: src/gtk/devices_view.cpp
+msgid "Transparency"
+msgstr "通透模式"
+
+#: src/gtk/devices_view.cpp
+msgid "Adaptive"
+msgstr "自适应"
+
+#: src/gtk/devices_view.cpp
+msgid "Noise Cancellation"
+msgstr "降噪"
+
+#: src/gtk/devices_view.cpp
+msgid "These AirPods do not report a listening mode."
+msgstr "此 AirPods 不报告聆听模式。"
+
#: src/gtk/devices_view.cpp
msgid "Full mode — messages, contacts, and notifications."
msgstr "完整模式 —— 信息、通讯录和通知。"
@@ -1671,6 +1712,10 @@ msgstr ""
msgid "Scan for devices"
msgstr "搜索设备"
+#: src/gtk/devices_view.cpp
+msgid "Listening mode"
+msgstr "聆听模式"
+
#: src/gtk/devices_view.cpp
msgid "Bluetooth needs one-time system setup"
msgstr "蓝牙需要一次性的系统设置"
diff --git a/src/cli/main.cpp b/src/cli/main.cpp
index d1a14ee..fa5d037 100644
--- a/src/cli/main.cpp
+++ b/src/cli/main.cpp
@@ -191,6 +191,7 @@ static const Opt kOptions[] = {
{"--bt-devices", N_("List Bluetooth devices known to BlueZ.")},
{"--bt-connection", N_("Show Bluetooth link and profile connection state.")},
{"--bt-airpods", N_("Show AirPods and case battery.")},
+ {"--bt-airpods-mode", N_("Set the AirPods listening mode: off, anc, transparency, adaptive.")},
{"--bt-threads", N_("List iPhone message conversations.")},
{"--bt-messages <thread>", N_("Show messages in one conversation.")},
{"--bt-send <thread> <text>", N_("Reply in one conversation.")},
@@ -527,12 +528,34 @@ static int print_bt_airpods(tether::Client& client) {
level(_("Right"), "right");
level(_("Case"), "case");
+ if (resp.contains("anc") && resp["anc"].is_string())
+ fprintf(stdout, " %-6s %s\n", _("Mode"), resp["anc"].get<std::string>().c_str());
+
const std::string reason = resp.value("reason", "");
if (!reason.empty())
fprintf(stdout, " %s\n", reason.c_str());
return 0;
}
+static int set_bt_airpods_mode(tether::Client& client, const std::string& mode) {
+ nlohmann::json request;
+ request["command"] = "bt_airpods_mode";
+ request["mode"] = mode;
+ nlohmann::json resp;
+ try {
+ resp = nlohmann::json::parse(client.send_and_wait(request.dump() + "\n"));
+ } catch (const std::exception&) {
+ debug::log(ERR, _("Could not reach the daemon.\n"));
+ return 1;
+ }
+ if (resp.value("success", false)) {
+ fprintf(stdout, _("Listening mode set to %s.\n"), mode.c_str());
+ return 0;
+ }
+ debug::log(ERR, "{}\n", resp.value("message", std::string(_("The listening mode could not be set."))));
+ return 1;
+}
+
// Pairing takes tens of seconds and reports progress as it goes, so this
// subscribes and streams events until the terminal result arrives.
static int run_bt_transaction(tether::Client& client,
@@ -982,6 +1005,10 @@ int main(int argc, char* argv[]) {
action = "bt_connection";
} else if (arg == "--bt-airpods") {
action = "bt_airpods";
+ } else if (arg == "--bt-airpods-mode") {
+ action = "bt_airpods_mode";
+ if (i + 1 < argc && argv[i + 1][0] != '-')
+ arg_val = argv[++i];
} else if (arg == "--bt-diagnostics") {
action = "bt_diagnostics";
} else if (arg == "--bt-threads") {
@@ -1219,6 +1246,8 @@ int main(int argc, char* argv[]) {
return print_bt_connection(client);
} else if (action == "bt_airpods") {
return print_bt_airpods(client);
+ } else if (action == "bt_airpods_mode") {
+ return set_bt_airpods_mode(client, arg_val);
} else if (action == "bt_diagnostics") {
return print_bt_diagnostics(client);
} else if (action == "bt_threads") {
diff --git a/src/core/include/tether/bluetooth/airpods.hpp b/src/core/include/tether/bluetooth/airpods.hpp
index b37da60..d8abfe9 100644
--- a/src/core/include/tether/bluetooth/airpods.hpp
+++ b/src/core/include/tether/bluetooth/airpods.hpp
@@ -21,6 +21,18 @@ namespace tether::bluetooth {
// Status byte for a component that is not reporting: a bud in the case, or a shut case.
inline constexpr uint8_t AAP_STATUS_DISCONNECTED = 0x04;
+ // Listening mode. The values are the wire bytes, which are one above the
+ // order Apple's own UI lists them in.
+ enum class AncMode : uint8_t {
+ Off = 0x01,
+ NoiseCancellation = 0x02,
+ Transparency = 0x03,
+ Adaptive = 0x04,
+ };
+
+ const char* to_string(AncMode mode);
+ std::optional<AncMode> anc_mode_from_string(const std::string& name);
+
struct AirPodsBattery {
// -1 when unknown.
int left = -1;
@@ -59,6 +71,8 @@ namespace tether::bluetooth {
std::string address;
std::string name;
AirPodsBattery battery;
+ // Unset until the buds report one. Not every model has the feature.
+ std::optional<AncMode> anc;
AirPodsStatus status = AirPodsStatus::Idle;
// Written for display, shown verbatim.
std::string reason;
@@ -75,6 +89,10 @@ namespace tether::bluetooth {
void merge_battery(AirPodsBattery& into, const BatteryUpdate& update);
+ // Decodes a listening-mode notification, 11 bytes carrying the mode at offset 7.
+ // Returns no value for anything else, including an out-of-range mode.
+ std::optional<AncMode> parse_anc(const uint8_t* data, size_t len);
+
// The connected AirPods worth opening a channel to, or null. Only one is
// returned: the channel is single-client and so is the watcher.
const Device* find_airpods(const BluezObjects& objects);
@@ -92,6 +110,11 @@ namespace tether::bluetooth {
// empty. Cheap to call on every BlueZ snapshot: an unchanged target is a no-op.
void set_device(const std::string& address, const std::string& name);
+ // Asks the buds to switch listening mode. Sent on the open channel, and
+ // dropped if the channel closes before it goes out; the buds answer with a
+ // notification, which is what actually updates the published state.
+ void set_anc(AncMode mode);
+
AirPodsState state() const;
private:
diff --git a/src/core/src/bluetooth/airpods.cpp b/src/core/src/bluetooth/airpods.cpp
index 5f8077d..7bbe507 100644
--- a/src/core/src/bluetooth/airpods.cpp
+++ b/src/core/src/bluetooth/airpods.cpp
@@ -69,6 +69,12 @@ namespace tether::bluetooth {
constexpr uint8_t BATTERY_PREFIX[] = {0x04, 0x00, 0x04, 0x00, 0x04, 0x00};
constexpr size_t BATTERY_ENTRY_BYTES = 5;
+ // Listening mode, sent and received on the same 11-byte:
+ // 04 00 04 00 09 00 0D [mode] 00 00 00
+ constexpr uint8_t ANC_PREFIX[] = {0x04, 0x00, 0x04, 0x00, 0x09, 0x00, 0x0d};
+ constexpr size_t ANC_PACKET_BYTES = 11;
+ constexpr size_t ANC_MODE_OFFSET = 7;
+
constexpr int CONNECT_TIMEOUT_MS = 8000;
constexpr int FIRST_PACKET_TIMEOUT_MS = 8000;
// A channel that has gone quiet this long is recycled.
@@ -145,11 +151,44 @@ namespace tether::bluetooth {
{"left", s.battery.left},
{"right", s.battery.right},
{"case", s.battery.case_},
+ {"anc", s.anc ? nlohmann::json(to_string(*s.anc)) : nlohmann::json()},
{"status", to_string(s.status)},
{"reason", s.reason},
};
}
+ const char* to_string(AncMode mode) {
+ switch (mode) {
+ case AncMode::Off:
+ return "off";
+ case AncMode::NoiseCancellation:
+ return "anc";
+ case AncMode::Transparency:
+ return "transparency";
+ case AncMode::Adaptive:
+ return "adaptive";
+ }
+ return "off";
+ }
+
+ std::optional<AncMode> anc_mode_from_string(const std::string& name) {
+ for (AncMode mode : {AncMode::Off, AncMode::NoiseCancellation, AncMode::Transparency, AncMode::Adaptive})
+ if (name == to_string(mode))
+ return mode;
+ return std::nullopt;
+ }
+
+ std::optional<AncMode> parse_anc(const uint8_t* data, size_t len) {
+ if (data == nullptr || len != ANC_PACKET_BYTES)
+ return std::nullopt;
+ if (std::memcmp(data, ANC_PREFIX, sizeof(ANC_PREFIX)) != 0)
+ return std::nullopt;
+ const uint8_t mode = data[ANC_MODE_OFFSET];
+ if (mode < static_cast<uint8_t>(AncMode::Off) || mode > static_cast<uint8_t>(AncMode::Adaptive))
+ return std::nullopt;
+ return static_cast<AncMode>(mode);
+ }
+
std::optional<BatteryUpdate> parse_battery(const uint8_t* data, size_t len) {
if (data == nullptr || len < sizeof(BATTERY_PREFIX) + 1)
return std::nullopt;
@@ -215,6 +254,10 @@ namespace tether::bluetooth {
AirPodsState published;
std::string target_address;
std::string target_name;
+ // Handed to the worker rather than written from the caller's thread: the
+ // socket belongs to the session and closing it out from under a write is
+ // the one race worth not having.
+ std::optional<AncMode> pending_anc;
bool stopping = false;
int wake_fd = -1;
@@ -257,6 +300,25 @@ namespace tether::bluetooth {
drain_wake();
}
+ // Sends whatever the caller queued, on the worker thread. False means the
+ // write failed and the session is over.
+ bool send_pending(int fd) {
+ std::optional<AncMode> mode;
+ {
+ std::lock_guard<std::mutex> lock(mutex);
+ std::swap(mode, pending_anc);
+ }
+ if (!mode)
+ return true;
+ const uint8_t packet[] = {
+ 0x04, 0x00, 0x04, 0x00, 0x09, 0x00, 0x0d, static_cast<uint8_t>(*mode), 0x00, 0x00, 0x00};
+ static_assert(sizeof(packet) == ANC_PACKET_BYTES);
+ if (write_all(fd, packet, sizeof(packet)))
+ return true;
+ debug::log(DEBUG, "airpods: listening mode write failed: {}", std::strerror(errno));
+ return false;
+ }
+
// Runs one channel from connect to close. Sets `delivered` when at least one
// battery packet arrived, which is what separates a contended channel from a
// healthy but quiet one.
@@ -320,6 +382,8 @@ namespace tether::bluetooth {
const int ready = wait_for(fd, wake_fd, POLLIN, timeout);
if (ready == 0) {
drain_wake();
+ if (!send_pending(fd))
+ break;
continue;
}
if (ready < 0)
@@ -329,7 +393,17 @@ namespace tether::bluetooth {
if (got <= 0)
break;
- auto update = parse_battery(buffer.data(), static_cast<size_t>(got));
+ const size_t size = static_cast<size_t>(got);
+ if (auto mode = parse_anc(buffer.data(), size)) {
+ {
+ std::lock_guard<std::mutex> lock(mutex);
+ state.anc = *mode;
+ }
+ publish(delivered ? AirPodsStatus::Live : AirPodsStatus::Connecting, "");
+ continue;
+ }
+
+ auto update = parse_battery(buffer.data(), size);
if (!update)
continue;
@@ -341,6 +415,11 @@ namespace tether::bluetooth {
publish(AirPodsStatus::Live, "");
}
+ {
+ // A queued mode change does not outlive the channel it was meant for.
+ std::lock_guard<std::mutex> lock(mutex);
+ pending_anc.reset();
+ }
::close(fd);
}
@@ -365,6 +444,7 @@ namespace tether::bluetooth {
state.address.clear();
state.name.clear();
state.battery = {};
+ state.anc.reset();
}
publish(AirPodsStatus::Idle, "");
backoff_ms = BACKOFF_START_MS;
@@ -379,6 +459,7 @@ namespace tether::bluetooth {
if (state.address != address) {
state.address = address;
state.battery = {};
+ state.anc.reset();
}
state.name = name;
}
@@ -439,6 +520,14 @@ namespace tether::bluetooth {
impl_->wake();
}
+ void AirPodsWatcher::set_anc(AncMode mode) {
+ {
+ std::lock_guard<std::mutex> lock(impl_->mutex);
+ impl_->pending_anc = mode;
+ }
+ impl_->wake();
+ }
+
AirPodsState AirPodsWatcher::state() const {
std::lock_guard<std::mutex> lock(impl_->mutex);
return impl_->state;
diff --git a/src/core/src/net.cpp b/src/core/src/net.cpp
index dfcebca..81d609e 100644
--- a/src/core/src/net.cpp
+++ b/src/core/src/net.cpp
@@ -958,6 +958,22 @@ namespace tether {
std::string payload = build_bt_airpods().dump() + "\n";
write_plain_packet(client_fd, payload);
continue;
+ } else if (j.contains("command") && j["command"] == "bt_airpods_mode" && j.contains("mode")) {
+ const auto mode = bluetooth::anc_mode_from_string(j.value("mode", ""));
+ nlohmann::json reply;
+ reply["command"] = "bt_airpods_mode_result";
+ if (!mode) {
+ reply["success"] = false;
+ reply["message"] = _("Unknown listening mode.");
+ } else if (!bluetooth::g_airpods || bluetooth::g_airpods->state().address.empty()) {
+ reply["success"] = false;
+ reply["message"] = _("No AirPods are connected.");
+ } else {
+ bluetooth::g_airpods->set_anc(*mode);
+ reply["success"] = true;
+ }
+ write_plain_packet(client_fd, reply.dump() + "\n");
+ continue;
} else if (j.contains("command") && j["command"] == "bt_list_devices") {
std::string payload = build_bt_devices().dump() + "\n";
write_plain_packet(client_fd, payload);
diff --git a/src/gtk/devices_view.cpp b/src/gtk/devices_view.cpp
index 41f347e..fef2416 100644
--- a/src/gtk/devices_view.cpp
+++ b/src/gtk/devices_view.cpp
@@ -59,6 +59,12 @@ namespace tether::ui {
std::string selected_bt_address;
std::string selected_bt_name;
+ GtkWidget* lbl_airpods_name = nullptr;
+ GtkWidget* lbl_airpods_battery = nullptr;
+ GtkWidget* lbl_airpods_reason = nullptr;
+ GtkWidget* airpods_mode_buttons[4] = {nullptr, nullptr, nullptr, nullptr};
+ bool airpods_syncing = false;
+
GtkWidget* lbl_bt_name = nullptr;
GtkWidget* bt_setup_box = nullptr;
GtkWidget* lbl_bt_setup_what = nullptr;
@@ -211,6 +217,49 @@ namespace tether::ui {
daemon_send({{"command", "bt_scan"}});
}
+ // Wire names as the daemon uses them
+ struct AirPodsMode {
+ const char* wire;
+ const char* label;
+ };
+ const AirPodsMode AIRPODS_MODES[4] = {
+ {"off", N_("Off")},
+ {"transparency", N_("Transparency")},
+ {"adaptive", N_("Adaptive")},
+ {"anc", N_("Noise Cancellation")},
+ };
+
+ void on_airpods_mode_toggled(GtkWidget* button, gpointer data) {
+ if (g_devices.airpods_syncing || !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)))
+ return;
+ daemon_send({{"command", "bt_airpods_mode"}, {"mode", AIRPODS_MODES[GPOINTER_TO_INT(data)].wire}});
+ }
+
+ void update_airpods_pane() {
+ const nlohmann::json& airpods = g_devices.bt_airpods;
+ set_markup(g_devices.lbl_airpods_name,
+ "<b>" + escape_markup(airpods.value("name", g_devices.selected_bt_name)) + "</b>");
+
+ const std::string levels = airpods_status_text(airpods);
+ set_text(g_devices.lbl_airpods_battery, levels.empty() ? _("Reading battery\u2026") : levels);
+
+ const std::string current = airpods.value("anc", "");
+ g_devices.airpods_syncing = true;
+ for (int i = 0; i < 4; ++i) {
+ GtkWidget* button = g_devices.airpods_mode_buttons[i];
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), current == AIRPODS_MODES[i].wire);
+ gtk_widget_set_sensitive(button, !current.empty());
+ }
+ g_devices.airpods_syncing = false;
+
+ // Reuses the daemon's own sentence rather than inventing a second one.
+ const char* reason = !current.empty() ? ""
+ : airpods.value("address", "").empty()
+ ? _("No AirPods are connected.")
+ : _("These AirPods do not report a listening mode.");
+ set_text(g_devices.lbl_airpods_reason, reason);
+ }
+
void update_bt_pane() {
const std::string address = g_devices.selected_bt_address;
const nlohmann::json* device = find_bt_device(address);
@@ -345,6 +394,12 @@ namespace tether::ui {
void update_right_pane() {
if (!g_devices.selected_bt_address.empty()) {
+ const nlohmann::json* device = find_bt_device(g_devices.selected_bt_address);
+ if (device && device->value("airpods", false)) {
+ gtk_stack_set_visible_child_name(GTK_STACK(g_devices.right_pane_stack), "airpods");
+ update_airpods_pane();
+ return;
+ }
gtk_stack_set_visible_child_name(GTK_STACK(g_devices.right_pane_stack), "bluetooth");
update_bt_pane();
return;
@@ -821,8 +876,6 @@ namespace tether::ui {
gtk_box_pack_start(GTK_BOX(labels), subtitle, FALSE, FALSE, 0);
if (airpods) {
- gtk_list_box_row_set_selectable(GTK_LIST_BOX_ROW(row), FALSE);
-
GtkWidget* battery = gtk_label_new(nullptr);
gtk_label_set_xalign(GTK_LABEL(battery), 0.0);
gtk_style_context_add_class(gtk_widget_get_style_context(battery), "muted");
@@ -1168,6 +1221,9 @@ namespace tether::ui {
gtk_label_set_text(GTK_LABEL(battery), text.c_str());
}
g_list_free(rows);
+ // The pane repaints from the same event, but only when it is showing.
+ if (gtk_stack_get_visible_child_name(GTK_STACK(g_devices.right_pane_stack)) == std::string("airpods"))
+ update_airpods_pane();
return true;
}
if (command == "bt_connection_changed") {
@@ -1338,6 +1394,48 @@ namespace tether::ui {
gtk_box_pack_start(GTK_BOX(placeholder), welcome_scan, FALSE, FALSE, 0);
gtk_stack_add_named(GTK_STACK(g_devices.right_pane_stack), placeholder, "placeholder");
+ // AirPods: battery and the listening mode, which is all the buds expose.
+ GtkWidget* airpods_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 16);
+ gtk_container_set_border_width(GTK_CONTAINER(airpods_box), 32);
+ gtk_widget_set_valign(airpods_box, GTK_ALIGN_CENTER);
+
+ g_devices.lbl_airpods_name = gtk_label_new(nullptr);
+ gtk_label_set_xalign(GTK_LABEL(g_devices.lbl_airpods_name), 0.0);
+ gtk_box_pack_start(GTK_BOX(airpods_box), g_devices.lbl_airpods_name, FALSE, FALSE, 0);
+
+ g_devices.lbl_airpods_battery = gtk_label_new(nullptr);
+ gtk_label_set_xalign(GTK_LABEL(g_devices.lbl_airpods_battery), 0.0);
+ gtk_style_context_add_class(gtk_widget_get_style_context(g_devices.lbl_airpods_battery), "muted");
+ gtk_box_pack_start(GTK_BOX(airpods_box), g_devices.lbl_airpods_battery, FALSE, FALSE, 0);
+
+ GtkWidget* lbl_mode_title = gtk_label_new(nullptr);
+ gtk_label_set_xalign(GTK_LABEL(lbl_mode_title), 0.0);
+ set_markup(lbl_mode_title, "<b>" + escape_markup(_("Listening mode")) + "</b>");
+ gtk_box_pack_start(GTK_BOX(airpods_box), lbl_mode_title, FALSE, FALSE, 0);
+
+ GtkWidget* modes = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
+ gtk_style_context_add_class(gtk_widget_get_style_context(modes), "linked");
+ GtkWidget* group = nullptr;
+ for (int i = 0; i < 4; ++i) {
+ GtkWidget* button =
+ gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(group), _(AIRPODS_MODES[i].label));
+ gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(button), FALSE);
+ if (!group)
+ group = button;
+ g_signal_connect(button, "toggled", G_CALLBACK(on_airpods_mode_toggled), GINT_TO_POINTER(i));
+ g_devices.airpods_mode_buttons[i] = button;
+ gtk_box_pack_start(GTK_BOX(modes), button, TRUE, TRUE, 0);
+ }
+ gtk_box_pack_start(GTK_BOX(airpods_box), modes, FALSE, FALSE, 0);
+
+ g_devices.lbl_airpods_reason = gtk_label_new(nullptr);
+ gtk_label_set_xalign(GTK_LABEL(g_devices.lbl_airpods_reason), 0.0);
+ gtk_label_set_line_wrap(GTK_LABEL(g_devices.lbl_airpods_reason), TRUE);
+ gtk_style_context_add_class(gtk_widget_get_style_context(g_devices.lbl_airpods_reason), "muted");
+ gtk_box_pack_start(GTK_BOX(airpods_box), g_devices.lbl_airpods_reason, FALSE, FALSE, 0);
+
+ gtk_stack_add_named(GTK_STACK(g_devices.right_pane_stack), airpods_box, "airpods");
+
// Bluetooth
GtkWidget* bt_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 16);
gtk_container_set_border_width(GTK_CONTAINER(bt_box), 32);
diff --git a/test/test_airpods.cpp b/test/test_airpods.cpp
index 2bae5a6..cb16b35 100644
--- a/test/test_airpods.cpp
+++ b/test/test_airpods.cpp
@@ -69,6 +69,41 @@ TEST(AirPods, RejectsMalformedPackets) {
EXPECT_FALSE(parse({0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x01, 0x01, 0x52, 0x01, 0x01}).has_value());
}
+TEST(AirPods, ParsesEveryListeningMode) {
+ const std::pair<uint8_t, AncMode> cases[] = {
+ {0x01, AncMode::Off},
+ {0x02, AncMode::NoiseCancellation},
+ {0x03, AncMode::Transparency},
+ {0x04, AncMode::Adaptive},
+ };
+ for (const auto& [wire, expected] : cases) {
+ std::vector<uint8_t> packet = {0x04, 0x00, 0x04, 0x00, 0x09, 0x00, 0x0d, wire, 0x00, 0x00, 0x00};
+ auto mode = parse_anc(packet.data(), packet.size());
+ ASSERT_TRUE(mode.has_value()) << "wire value " << int(wire);
+ EXPECT_EQ(*mode, expected);
+ // Round trip through the names the IPC and CLI use.
+ EXPECT_EQ(anc_mode_from_string(to_string(*mode)), expected);
+ }
+}
+
+TEST(AirPods, RejectsMalformedListeningModes) {
+ const auto packet = [](std::initializer_list<uint8_t> bytes) {
+ std::vector<uint8_t> v(bytes);
+ return parse_anc(v.data(), v.size());
+ };
+ // Mode 0 and 5 are outside the range; the wire values start at 1.
+ EXPECT_FALSE(packet({0x04, 0x00, 0x04, 0x00, 0x09, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00}).has_value());
+ EXPECT_FALSE(packet({0x04, 0x00, 0x04, 0x00, 0x09, 0x00, 0x0d, 0x05, 0x00, 0x00, 0x00}).has_value());
+ // Right prefix, wrong length.
+ EXPECT_FALSE(packet({0x04, 0x00, 0x04, 0x00, 0x09, 0x00, 0x0d, 0x02}).has_value());
+ // A battery notification must not be read as a listening mode.
+ EXPECT_FALSE(packet({0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x02, 0x01, 0x50, 0x01}).has_value());
+ EXPECT_FALSE(parse_anc(nullptr, 0).has_value());
+
+ EXPECT_FALSE(anc_mode_from_string("").has_value());
+ EXPECT_FALSE(anc_mode_from_string("ancs").has_value());
+}
+
TEST(AirPods, DistinguishesAirPodsFromAnIPhone) {
Device buds;
buds.name = "ZBZ AirPros";