Skip to content

Linux + iPhone Continuity / iMessage / SMS

feat: initial airpod support

Zack Bartel8e4092dbac48
diff --git a/docs/BLUETOOTH.md b/docs/BLUETOOTH.md
index caa3c9a..d3707aa 100644
--- a/docs/BLUETOOTH.md
+++ b/docs/BLUETOOTH.md
@@ -10,6 +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 |
The Tether iOS app is unrelated to these features and just keeps handling clipboard sync and file transfer over TCP + mTLS.
@@ -476,10 +477,70 @@ the narrower check; it rules out the `*`/`#` supplementary-service codes deliber
the PBAP address book by number. A network that refuses caller ID sends the literal
`withheld`, which is shown as unknown and never offered to redial.
+## 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.
+
+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
+uses. `src/core/src/bluetooth/airpods.cpp` opens it directly and is the only raw
+Bluetooth socket in the tree; the kernel's L2CAP constants and address struct are
+declared there rather than pulled in from bluez-libs, which the rest of the build does
+not need. No root and no capabilities: PSM `0x1001` is above the privileged range.
+
+BlueZ is still what says *which* device to open: `Device1.Modalias` starting
+`bluetooth:v004c` plus an A2DP sink UUID, falling back to a name containing "airpod"
+because Modalias is absent until SDP has been read once. The name alone is not enough —
+AirPods can be renamed to anything — and the vendor id alone is not either, since an
+iPhone is the same vendor.
+
+### The wire protocol
+
+Three packets on connect, in order, then read. All three are required: without
+set-features, or with anything but the five-`FF` request, no notification ever arrives.
+
+```
+handshake 00000400010002000000000000000000
+set-features 040004004d00d700000000000000
+request-notifications 040004000f00ffffffffff
+```
+
+A battery notification is `04 00 04 00 04 00 [count]` followed by `count` five-byte
+entries, `[component] 01 [level] [status] 01`. Components are Right `0x02`, Left `0x04`,
+Case `0x08`. Status `0x04` means the component is not reporting — a bud in the case, a
+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.
+
+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.
+
+### The channel takes one client
+
+This is the failure worth knowing about. A second client on PSM `0x1001` — and an
+established channel that has silently died — makes `connect()` block **indefinitely and
+report nothing**. There is no error to log and no timeout of its own, so the naive
+symptom is a connected device whose battery never arrives and a daemon that looks idle.
+
+So the socket is non-blocking and every wait has a deadline: 8s to open the channel, 8s
+for the first notification, then 5 minutes of silence before the channel is recycled.
+Three attempts in a row that reach a deadline having delivered nothing are reported as
+`busy` rather than retried quietly, because the remedy is to stop the other program and
+nothing in the log would otherwise say so.
+
+Anything else on the machine speaking AAP is such a program: LibrePods, AirPods Center,
+a status-bar widget that reads battery itself. Only one of them can hold the channel.
+
## Conflicts
The iPhone serves one MAP session at a time. Any other program on any machine holding it will block Tether.
+Only one program per machine can hold an AirPods AAP channel. See "AirPods" above.
+
## Known limits
These are properties of what iOS exposes:
@@ -533,6 +594,8 @@ checks the daemon does not make.
| The link reads down forever with `br-connection-unknown`, while messages, contacts and notifications all work | This computer offers the iPhone no BR/EDR profile to connect to, and BlueZ only reports a link up while some local profile is connected | Nothing. Tether no longer waits on that link -- see 2026-08-23 below. Call support does not change this: BlueZ's hands-free profile is not one of the local profiles BlueZ counts |
| 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 |
+| 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 |
| Configured PipeWire for call audio and the machine is not in the iPhone's audio picker | `a2dp_sink` is missing from `bluez5.roles`. iOS only speaks hands-free to a machine it considers an audio destination | Add `a2dp_sink`, and accept that the phone's music comes here too -- see "Getting the call audio onto the desktop instead" |
diff --git a/docs/PROTOCOL.md b/docs/PROTOCOL.md
index abd3b8a..dd93be9 100644
--- a/docs/PROTOCOL.md
+++ b/docs/PROTOCOL.md
@@ -333,6 +333,36 @@ The two `*_reason` strings are written for display (permission is off or a trans
`map_error` and `pbap_error` name the classification: `forbidden` means the toggle on the phone is off,
`busy` means another computer holds the phone's single MAP session.
+### AirPods
+
+Battery does not come from BlueZ. It arrives over Apple's AAP protocol on an L2CAP
+channel the daemon opens itself, so it is reported separately from `bt_devices` — whose
+entries only gain an `airpods` boolean saying which device the battery belongs to.
+
+#### `bt_airpods` (Client -> Daemon, answered directly; also Daemon -> Clients)
+**Payload**: `{"command": "bt_airpods"}`
+
+```json
+{
+ "command": "bt_airpods",
+ "address": "AA:BB:CC:DD:EE:FF",
+ "name": "AirPods Pro",
+ "left": 82,
+ "right": 79,
+ "case": 45,
+ "status": "live",
+ "reason": ""
+}
+```
+
+Broadcast when the published state changes, not on a timer. A level of `-1` means the
+component is not reporting — a bud in the case, or a shut case — and is not the same as
+a flat battery. An empty `address` means no AirPods are connected.
+
+`status` is `idle`, `connecting`, `live`, `busy` or `failed`. `busy` means another
+program holds the channel, which allows only one client at a time; `reason` carries the
+sentence to show.
+
### Messages
#### `bt_list_threads` (Client -> Daemon, answered directly)
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 909bfed..2eeeb4c 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,4 +1,5 @@
src/cli/main.cpp
+src/core/src/bluetooth/airpods.cpp
src/core/src/bluetooth/bearer_supervisor.cpp
src/core/src/bluetooth/connection.cpp
src/core/src/bluetooth/groups.cpp
diff --git a/po/cs.po b/po/cs.po
index 8d96af8..ec557db 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-07 17:37-0700\n"
+"POT-Creation-Date: 2026-09-08 15:00-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Czech\n"
@@ -87,6 +87,10 @@ msgstr "Vypsat Bluetooth zařízení známá BlueZ."
msgid "Show Bluetooth link and profile connection state."
msgstr "Zobrazit stav Bluetooth spojení a profilů."
+#: src/cli/main.cpp
+msgid "Show AirPods and case battery."
+msgstr "Zobrazit baterii AirPods a pouzdra."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "Vypsat konverzace zpráv z iPhonu."
@@ -432,6 +436,27 @@ msgstr "Nepodařilo se načíst Bluetooth zařízení od démona.\n"
msgid "No Bluetooth devices known to BlueZ.\n"
msgstr "BlueZ nezná žádná Bluetooth zařízení.\n"
+#: src/cli/main.cpp
+msgid "Could not read the AirPods battery from the daemon.\n"
+msgstr "Nepodařilo se načíst baterii AirPods z démona.\n"
+
+#: src/cli/main.cpp
+msgid "No AirPods connected.\n"
+msgstr "Nejsou připojena žádná AirPods.\n"
+
+#: src/cli/main.cpp
+msgid "Left"
+msgstr "Levé"
+
+#: src/cli/main.cpp
+msgid "Right"
+msgstr "Pravé"
+
+#. TRANSLATORS: The AirPods charging case, on the device row beside the two earbuds.
+#: src/cli/main.cpp src/gtk/devices_view.cpp
+msgid "Case"
+msgstr "Pouzdro"
+
#: src/cli/main.cpp
msgid "Could not reach the daemon.\n"
msgstr "Nepodařilo se spojit s démonem.\n"
@@ -781,6 +806,18 @@ msgstr "Výběr adaptéru je automatický: první zapnutý.\n"
msgid "Using controller {}."
msgstr "Používá se adaptér {}."
+#: src/core/src/bluetooth/airpods.cpp
+msgid "The AirPods address could not be read."
+msgstr "Adresu AirPods se nepodařilo přečíst."
+
+#: src/core/src/bluetooth/airpods.cpp
+msgid "Bluetooth sockets are unavailable on this system."
+msgstr "Sokety Bluetooth nejsou v tomto systému dostupné."
+
+#: src/core/src/bluetooth/airpods.cpp
+msgid "Another program is using the AirPods channel."
+msgstr "Kanál AirPods používá jiný program."
+
#: src/core/src/bluetooth/bearer_supervisor.cpp
msgid ""
"Messages and contacts are connected. BlueZ reports the Bluetooth link down "
@@ -813,7 +850,9 @@ msgid ""
"come up within a minute. Nothing on the iPhone changes this and re-pairing "
"will not either."
msgstr ""
-"Tento počítač připnul párování na BR/EDR, což odmítá spojení LE, které iPhone otevírá pro přenos oznámení. Nyní se to ruší; LE by se mělo navázat do minuty. Nic na iPhonu to nezmění a opětovné spárování také ne."
+"Tento počítač připnul párování na BR/EDR, což odmítá spojení LE, které "
+"iPhone otevírá pro přenos oznámení. Nyní se to ruší; LE by se mělo navázat "
+"do minuty. Nic na iPhonu to nezmění a opětovné spárování také ne."
#: src/core/src/bluetooth/bearer_supervisor.cpp
msgid ""
@@ -1378,6 +1417,20 @@ msgstr "Démon Tether neběží."
msgid "Daemon Online"
msgstr "Démon je online"
+#. TRANSLATORS: Left earbud, abbreviated to fit the device row. One or two letters.
+#: src/gtk/devices_view.cpp
+msgid "L"
+msgstr "L"
+
+#. TRANSLATORS: Right earbud, abbreviated to fit the device row. One or two letters.
+#: src/gtk/devices_view.cpp
+msgid "R"
+msgstr "P"
+
+#: src/gtk/devices_view.cpp
+msgid "Reading battery…"
+msgstr "Načítání baterie…"
+
#: src/gtk/devices_view.cpp
msgid "Connected."
msgstr "Připojeno."
diff --git a/po/de.po b/po/de.po
index 1d65fce..3bb05dc 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-07 17:37-0700\n"
+"POT-Creation-Date: 2026-09-08 15:00-0700\n"
"PO-Revision-Date: 2026-08-22\n"
"Last-Translator: Tether project\n"
"Language-Team: German\n"
@@ -87,6 +87,10 @@ msgstr "Die BlueZ bekannten Bluetooth-Geräte auflisten."
msgid "Show Bluetooth link and profile connection state."
msgstr "Zustand von Bluetooth-Verbindung und Profilen anzeigen."
+#: src/cli/main.cpp
+msgid "Show AirPods and case battery."
+msgstr "Akkustand der AirPods und des Ladecase anzeigen."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "Nachrichtenunterhaltungen des iPhones auflisten."
@@ -430,6 +434,27 @@ msgstr "Die Bluetooth-Geräte konnten nicht vom Daemon gelesen werden.\n"
msgid "No Bluetooth devices known to BlueZ.\n"
msgstr "BlueZ sind keine Bluetooth-Geräte bekannt.\n"
+#: src/cli/main.cpp
+msgid "Could not read the AirPods battery from the daemon.\n"
+msgstr "Der Akkustand der AirPods konnte nicht vom Daemon gelesen werden.\n"
+
+#: src/cli/main.cpp
+msgid "No AirPods connected.\n"
+msgstr "Keine AirPods verbunden.\n"
+
+#: src/cli/main.cpp
+msgid "Left"
+msgstr "Links"
+
+#: src/cli/main.cpp
+msgid "Right"
+msgstr "Rechts"
+
+#. TRANSLATORS: The AirPods charging case, on the device row beside the two earbuds.
+#: src/cli/main.cpp src/gtk/devices_view.cpp
+msgid "Case"
+msgstr "Case"
+
#: src/cli/main.cpp
msgid "Could not reach the daemon.\n"
msgstr "Der Daemon war nicht erreichbar.\n"
@@ -789,6 +814,18 @@ msgstr "Die Adapterauswahl ist automatisch: der erste eingeschaltete.\n"
msgid "Using controller {}."
msgstr "Adapter {} wird verwendet."
+#: src/core/src/bluetooth/airpods.cpp
+msgid "The AirPods address could not be read."
+msgstr "Die AirPods-Adresse konnte nicht gelesen werden."
+
+#: src/core/src/bluetooth/airpods.cpp
+msgid "Bluetooth sockets are unavailable on this system."
+msgstr "Bluetooth-Sockets sind auf diesem System nicht verfügbar."
+
+#: src/core/src/bluetooth/airpods.cpp
+msgid "Another program is using the AirPods channel."
+msgstr "Ein anderes Programm verwendet den AirPods-Kanal."
+
#: src/core/src/bluetooth/bearer_supervisor.cpp
msgid ""
"Messages and contacts are connected. BlueZ reports the Bluetooth link down "
@@ -821,7 +858,10 @@ msgid ""
"come up within a minute. Nothing on the iPhone changes this and re-pairing "
"will not either."
msgstr ""
-"Dieser Computer hatte die Kopplung auf BR/EDR festgelegt, wodurch die LE-Verbindung abgelehnt wird, die das iPhone für Benachrichtigungen öffnet. Das wird gerade rückgängig gemacht; LE sollte innerhalb einer Minute zustande kommen. Daran ändert weder etwas am iPhone noch ein erneutes Koppeln etwas."
+"Dieser Computer hatte die Kopplung auf BR/EDR festgelegt, wodurch die LE-"
+"Verbindung abgelehnt wird, die das iPhone für Benachrichtigungen öffnet. Das "
+"wird gerade rückgängig gemacht; LE sollte innerhalb einer Minute zustande "
+"kommen. Daran ändert weder etwas am iPhone noch ein erneutes Koppeln etwas."
#: src/core/src/bluetooth/bearer_supervisor.cpp
msgid ""
@@ -1407,6 +1447,20 @@ msgstr "Der Tether-Daemon läuft nicht."
msgid "Daemon Online"
msgstr "Daemon online"
+#. TRANSLATORS: Left earbud, abbreviated to fit the device row. One or two letters.
+#: src/gtk/devices_view.cpp
+msgid "L"
+msgstr "L"
+
+#. TRANSLATORS: Right earbud, abbreviated to fit the device row. One or two letters.
+#: src/gtk/devices_view.cpp
+msgid "R"
+msgstr "R"
+
+#: src/gtk/devices_view.cpp
+msgid "Reading battery…"
+msgstr "Akkustand wird gelesen…"
+
#: src/gtk/devices_view.cpp
msgid "Connected."
msgstr "Verbunden."
diff --git a/po/es.po b/po/es.po
index 6bdbed7..ef983bb 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-07 17:37-0700\n"
+"POT-Creation-Date: 2026-09-08 15:00-0700\n"
"PO-Revision-Date: 2026-08-22\n"
"Last-Translator: Tether project\n"
"Language-Team: Spanish\n"
@@ -88,6 +88,10 @@ msgstr "Listar los dispositivos Bluetooth conocidos por BlueZ."
msgid "Show Bluetooth link and profile connection state."
msgstr "Mostrar el estado del enlace y de los perfiles Bluetooth."
+#: src/cli/main.cpp
+msgid "Show AirPods and case battery."
+msgstr "Mostrar la batería de los AirPods y del estuche."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "Listar las conversaciones de mensajes del iPhone."
@@ -432,6 +436,27 @@ msgstr "No se pudieron leer los dispositivos Bluetooth del daemon.\n"
msgid "No Bluetooth devices known to BlueZ.\n"
msgstr "BlueZ no conoce ningún dispositivo Bluetooth.\n"
+#: src/cli/main.cpp
+msgid "Could not read the AirPods battery from the daemon.\n"
+msgstr "No se pudo leer la batería de los AirPods desde el demonio.\n"
+
+#: src/cli/main.cpp
+msgid "No AirPods connected.\n"
+msgstr "No hay AirPods conectados.\n"
+
+#: src/cli/main.cpp
+msgid "Left"
+msgstr "Izq."
+
+#: src/cli/main.cpp
+msgid "Right"
+msgstr "Der."
+
+#. TRANSLATORS: The AirPods charging case, on the device row beside the two earbuds.
+#: src/cli/main.cpp src/gtk/devices_view.cpp
+msgid "Case"
+msgstr "Estuche"
+
#: src/cli/main.cpp
msgid "Could not reach the daemon.\n"
msgstr "No se pudo contactar con el daemon.\n"
@@ -786,6 +811,18 @@ msgstr "La selección de adaptador es automática: el primero encendido.\n"
msgid "Using controller {}."
msgstr "Usando el adaptador {}."
+#: src/core/src/bluetooth/airpods.cpp
+msgid "The AirPods address could not be read."
+msgstr "No se pudo leer la dirección de los AirPods."
+
+#: src/core/src/bluetooth/airpods.cpp
+msgid "Bluetooth sockets are unavailable on this system."
+msgstr "Los sockets Bluetooth no están disponibles en este sistema."
+
+#: src/core/src/bluetooth/airpods.cpp
+msgid "Another program is using the AirPods channel."
+msgstr "Otro programa está usando el canal de los AirPods."
+
#: src/core/src/bluetooth/bearer_supervisor.cpp
msgid ""
"Messages and contacts are connected. BlueZ reports the Bluetooth link down "
@@ -818,7 +855,10 @@ msgid ""
"come up within a minute. Nothing on the iPhone changes this and re-pairing "
"will not either."
msgstr ""
-"Este equipo había fijado el emparejamiento en BR/EDR, lo que rechaza el enlace LE que el iPhone abre para transportar las notificaciones. Se está deshaciendo ahora; LE debería establecerse en menos de un minuto. Nada en el iPhone cambia esto, y volver a emparejar tampoco."
+"Este equipo había fijado el emparejamiento en BR/EDR, lo que rechaza el "
+"enlace LE que el iPhone abre para transportar las notificaciones. Se está "
+"deshaciendo ahora; LE debería establecerse en menos de un minuto. Nada en el "
+"iPhone cambia esto, y volver a emparejar tampoco."
#: src/core/src/bluetooth/bearer_supervisor.cpp
msgid ""
@@ -1398,6 +1438,20 @@ msgstr "El daemon de Tether no se está ejecutando."
msgid "Daemon Online"
msgstr "Daemon conectado"
+#. TRANSLATORS: Left earbud, abbreviated to fit the device row. One or two letters.
+#: src/gtk/devices_view.cpp
+msgid "L"
+msgstr "I"
+
+#. TRANSLATORS: Right earbud, abbreviated to fit the device row. One or two letters.
+#: src/gtk/devices_view.cpp
+msgid "R"
+msgstr "D"
+
+#: src/gtk/devices_view.cpp
+msgid "Reading battery…"
+msgstr "Leyendo la batería…"
+
#: src/gtk/devices_view.cpp
msgid "Connected."
msgstr "Conectado."
diff --git a/po/fr.po b/po/fr.po
index 273fc0a..951b7fa 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-07 17:37-0700\n"
+"POT-Creation-Date: 2026-09-08 15:00-0700\n"
"PO-Revision-Date: 2026-08-22\n"
"Last-Translator: Tether project\n"
"Language-Team: French\n"
@@ -89,6 +89,10 @@ msgstr "Lister les appareils Bluetooth connus de BlueZ."
msgid "Show Bluetooth link and profile connection state."
msgstr "Afficher l'état du lien et des profils Bluetooth."
+#: src/cli/main.cpp
+msgid "Show AirPods and case battery."
+msgstr "Afficher la batterie des AirPods et du boîtier."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "Lister les conversations de l'iPhone."
@@ -436,6 +440,27 @@ msgstr "Impossible de lire les appareils Bluetooth depuis le démon.\n"
msgid "No Bluetooth devices known to BlueZ.\n"
msgstr "Aucun appareil Bluetooth connu de BlueZ.\n"
+#: src/cli/main.cpp
+msgid "Could not read the AirPods battery from the daemon.\n"
+msgstr "Impossible de lire la batterie des AirPods depuis le démon.\n"
+
+#: src/cli/main.cpp
+msgid "No AirPods connected.\n"
+msgstr "Aucun AirPods connecté.\n"
+
+#: src/cli/main.cpp
+msgid "Left"
+msgstr "Gauche"
+
+#: src/cli/main.cpp
+msgid "Right"
+msgstr "Droite"
+
+#. TRANSLATORS: The AirPods charging case, on the device row beside the two earbuds.
+#: src/cli/main.cpp src/gtk/devices_view.cpp
+msgid "Case"
+msgstr "Boîtier"
+
#: src/cli/main.cpp
msgid "Could not reach the daemon.\n"
msgstr "Impossible de joindre le démon.\n"
@@ -791,6 +816,18 @@ msgstr "La sélection de l'adaptateur est automatique : le premier allumé.\n"
msgid "Using controller {}."
msgstr "Utilisation de l'adaptateur {}."
+#: src/core/src/bluetooth/airpods.cpp
+msgid "The AirPods address could not be read."
+msgstr "Impossible de lire l'adresse des AirPods."
+
+#: src/core/src/bluetooth/airpods.cpp
+msgid "Bluetooth sockets are unavailable on this system."
+msgstr "Les sockets Bluetooth ne sont pas disponibles sur ce système."
+
+#: src/core/src/bluetooth/airpods.cpp
+msgid "Another program is using the AirPods channel."
+msgstr "Un autre programme utilise le canal des AirPods."
+
#: src/core/src/bluetooth/bearer_supervisor.cpp
msgid ""
"Messages and contacts are connected. BlueZ reports the Bluetooth link down "
@@ -823,7 +860,10 @@ msgid ""
"come up within a minute. Nothing on the iPhone changes this and re-pairing "
"will not either."
msgstr ""
-"Cet ordinateur avait épinglé l'appairage sur BR/EDR, ce qui refuse le lien LE que l'iPhone ouvre pour transporter les notifications. C'est en train d'être corrigé ; le LE devrait s'établir en moins d'une minute. Rien sur l'iPhone n'y change quoi que ce soit, et refaire l'appairage non plus."
+"Cet ordinateur avait épinglé l'appairage sur BR/EDR, ce qui refuse le lien "
+"LE que l'iPhone ouvre pour transporter les notifications. C'est en train "
+"d'être corrigé ; le LE devrait s'établir en moins d'une minute. Rien sur "
+"l'iPhone n'y change quoi que ce soit, et refaire l'appairage non plus."
#: src/core/src/bluetooth/bearer_supervisor.cpp
msgid ""
@@ -1406,6 +1446,20 @@ msgstr "Le démon Tether n'est pas lancé."
msgid "Daemon Online"
msgstr "Démon en ligne"
+#. TRANSLATORS: Left earbud, abbreviated to fit the device row. One or two letters.
+#: src/gtk/devices_view.cpp
+msgid "L"
+msgstr "G"
+
+#. TRANSLATORS: Right earbud, abbreviated to fit the device row. One or two letters.
+#: src/gtk/devices_view.cpp
+msgid "R"
+msgstr "D"
+
+#: src/gtk/devices_view.cpp
+msgid "Reading battery…"
+msgstr "Lecture de la batterie…"
+
#: src/gtk/devices_view.cpp
msgid "Connected."
msgstr "Connecté."
diff --git a/po/it.po b/po/it.po
index b09f314..3ee9c69 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-07 17:37-0700\n"
+"POT-Creation-Date: 2026-09-08 15:00-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Italian\n"
@@ -89,6 +89,10 @@ msgstr "Elenca i dispositivi Bluetooth noti a BlueZ."
msgid "Show Bluetooth link and profile connection state."
msgstr "Mostra lo stato del collegamento Bluetooth e dei profili."
+#: src/cli/main.cpp
+msgid "Show AirPods and case battery."
+msgstr "Mostra la batteria degli AirPods e della custodia."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "Elenca le conversazioni di messaggi dell'iPhone."
@@ -432,6 +436,27 @@ msgstr "Impossibile leggere i dispositivi Bluetooth dal daemon.\n"
msgid "No Bluetooth devices known to BlueZ.\n"
msgstr "Nessun dispositivo Bluetooth noto a BlueZ.\n"
+#: src/cli/main.cpp
+msgid "Could not read the AirPods battery from the daemon.\n"
+msgstr "Impossibile leggere la batteria degli AirPods dal demone.\n"
+
+#: src/cli/main.cpp
+msgid "No AirPods connected.\n"
+msgstr "Nessun AirPods connesso.\n"
+
+#: src/cli/main.cpp
+msgid "Left"
+msgstr "Sinistro"
+
+#: src/cli/main.cpp
+msgid "Right"
+msgstr "Destro"
+
+#. TRANSLATORS: The AirPods charging case, on the device row beside the two earbuds.
+#: src/cli/main.cpp src/gtk/devices_view.cpp
+msgid "Case"
+msgstr "Custodia"
+
#: src/cli/main.cpp
msgid "Could not reach the daemon.\n"
msgstr "Impossibile raggiungere il daemon.\n"
@@ -786,6 +811,18 @@ msgstr "La selezione dell'adattatore è automatica: il primo acceso.\n"
msgid "Using controller {}."
msgstr "Uso dell'adattatore {}."
+#: src/core/src/bluetooth/airpods.cpp
+msgid "The AirPods address could not be read."
+msgstr "Impossibile leggere l'indirizzo degli AirPods."
+
+#: src/core/src/bluetooth/airpods.cpp
+msgid "Bluetooth sockets are unavailable on this system."
+msgstr "I socket Bluetooth non sono disponibili su questo sistema."
+
+#: src/core/src/bluetooth/airpods.cpp
+msgid "Another program is using the AirPods channel."
+msgstr "Un altro programma sta usando il canale degli AirPods."
+
#: src/core/src/bluetooth/bearer_supervisor.cpp
msgid ""
"Messages and contacts are connected. BlueZ reports the Bluetooth link down "
@@ -818,7 +855,10 @@ msgid ""
"come up within a minute. Nothing on the iPhone changes this and re-pairing "
"will not either."
msgstr ""
-"Questo computer aveva bloccato l'associazione su BR/EDR, il che rifiuta il collegamento LE che l'iPhone apre per trasportare le notifiche. Ora viene annullato; LE dovrebbe attivarsi entro un minuto. Nulla sull'iPhone cambia questo, e nemmeno rifare l'associazione."
+"Questo computer aveva bloccato l'associazione su BR/EDR, il che rifiuta il "
+"collegamento LE che l'iPhone apre per trasportare le notifiche. Ora viene "
+"annullato; LE dovrebbe attivarsi entro un minuto. Nulla sull'iPhone cambia "
+"questo, e nemmeno rifare l'associazione."
#: src/core/src/bluetooth/bearer_supervisor.cpp
msgid ""
@@ -1397,6 +1437,20 @@ msgstr "Il daemon di Tether non è in esecuzione."
msgid "Daemon Online"
msgstr "Daemon online"
+#. TRANSLATORS: Left earbud, abbreviated to fit the device row. One or two letters.
+#: src/gtk/devices_view.cpp
+msgid "L"
+msgstr "S"
+
+#. TRANSLATORS: Right earbud, abbreviated to fit the device row. One or two letters.
+#: src/gtk/devices_view.cpp
+msgid "R"
+msgstr "D"
+
+#: src/gtk/devices_view.cpp
+msgid "Reading battery…"
+msgstr "Lettura della batteria…"
+
#: src/gtk/devices_view.cpp
msgid "Connected."
msgstr "Connesso."
diff --git a/po/ja.po b/po/ja.po
index 4a4c34a..b64c185 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-07 17:37-0700\n"
+"POT-Creation-Date: 2026-09-08 15:00-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Japanese\n"
@@ -87,6 +87,10 @@ msgstr "BlueZ が認識している Bluetooth デバイスを一覧表示しま
msgid "Show Bluetooth link and profile connection state."
msgstr "Bluetooth リンクとプロファイルの接続状態を表示します。"
+#: src/cli/main.cpp
+msgid "Show AirPods and case battery."
+msgstr "AirPods とケースのバッテリーを表示します。"
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "iPhone のメッセージの会話を一覧表示します。"
@@ -422,6 +426,27 @@ msgstr "デーモンから Bluetooth デバイスを読み取れませんでし
msgid "No Bluetooth devices known to BlueZ.\n"
msgstr "BlueZ が認識している Bluetooth デバイスはありません。\n"
+#: src/cli/main.cpp
+msgid "Could not read the AirPods battery from the daemon.\n"
+msgstr "デーモンから AirPods のバッテリーを読み取れませんでした。\n"
+
+#: src/cli/main.cpp
+msgid "No AirPods connected.\n"
+msgstr "AirPods は接続されていません。\n"
+
+#: src/cli/main.cpp
+msgid "Left"
+msgstr "左"
+
+#: src/cli/main.cpp
+msgid "Right"
+msgstr "右"
+
+#. TRANSLATORS: The AirPods charging case, on the device row beside the two earbuds.
+#: src/cli/main.cpp src/gtk/devices_view.cpp
+msgid "Case"
+msgstr "ケース"
+
#: src/cli/main.cpp
msgid "Could not reach the daemon.\n"
msgstr "デーモンに接続できませんでした。\n"
@@ -770,6 +795,18 @@ msgstr ""
msgid "Using controller {}."
msgstr "アダプタ {} を使用します。"
+#: src/core/src/bluetooth/airpods.cpp
+msgid "The AirPods address could not be read."
+msgstr "AirPods のアドレスを読み取れませんでした。"
+
+#: src/core/src/bluetooth/airpods.cpp
+msgid "Bluetooth sockets are unavailable on this system."
+msgstr "このシステムでは Bluetooth ソケットを利用できません。"
+
+#: src/core/src/bluetooth/airpods.cpp
+msgid "Another program is using the AirPods channel."
+msgstr "別のプログラムが AirPods のチャンネルを使用しています。"
+
#: src/core/src/bluetooth/bearer_supervisor.cpp
msgid ""
"Messages and contacts are connected. BlueZ reports the Bluetooth link down "
@@ -802,7 +839,10 @@ msgid ""
"come up within a minute. Nothing on the iPhone changes this and re-pairing "
"will not either."
msgstr ""
-"このコンピュータがペアリングを BR/EDR に固定していたため、iPhone が通知を運ぶために開く LE リンクが拒否されています。現在それを解除しています。LE は 1 分以内に接続するはずです。iPhone 側で変えられることはなく、ペアリングし直しても変わりません。"
+"このコンピュータがペアリングを BR/EDR に固定していたため、iPhone が通知を運ぶ"
+"ために開く LE リンクが拒否されています。現在それを解除しています。LE は 1 分"
+"以内に接続するはずです。iPhone 側で変えられることはなく、ペアリングし直しても"
+"変わりません。"
#: src/core/src/bluetooth/bearer_supervisor.cpp
msgid ""
@@ -1369,6 +1409,20 @@ msgstr "Tether デーモンが動作していません。"
msgid "Daemon Online"
msgstr "デーモンはオンライン"
+#. TRANSLATORS: Left earbud, abbreviated to fit the device row. One or two letters.
+#: src/gtk/devices_view.cpp
+msgid "L"
+msgstr "左"
+
+#. TRANSLATORS: Right earbud, abbreviated to fit the device row. One or two letters.
+#: src/gtk/devices_view.cpp
+msgid "R"
+msgstr "右"
+
+#: src/gtk/devices_view.cpp
+msgid "Reading battery…"
+msgstr "バッテリーを読み取り中…"
+
#: src/gtk/devices_view.cpp
msgid "Connected."
msgstr "接続しました。"
diff --git a/po/ko.po b/po/ko.po
index 7818e87..6010c39 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-07 17:37-0700\n"
+"POT-Creation-Date: 2026-09-08 15:00-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Korean\n"
@@ -86,6 +86,10 @@ msgstr "BlueZ가 알고 있는 Bluetooth 기기를 나열합니다."
msgid "Show Bluetooth link and profile connection state."
msgstr "Bluetooth 링크와 프로파일의 연결 상태를 표시합니다."
+#: src/cli/main.cpp
+msgid "Show AirPods and case battery."
+msgstr "AirPods 및 케이스 배터리를 표시합니다."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "iPhone의 메시지 대화를 나열합니다."
@@ -420,6 +424,27 @@ msgstr "데몬에서 Bluetooth 기기를 읽지 못했습니다.\n"
msgid "No Bluetooth devices known to BlueZ.\n"
msgstr "BlueZ가 알고 있는 Bluetooth 기기가 없습니다.\n"
+#: src/cli/main.cpp
+msgid "Could not read the AirPods battery from the daemon.\n"
+msgstr "데몬에서 AirPods 배터리를 읽을 수 없습니다.\n"
+
+#: src/cli/main.cpp
+msgid "No AirPods connected.\n"
+msgstr "연결된 AirPods가 없습니다.\n"
+
+#: src/cli/main.cpp
+msgid "Left"
+msgstr "왼쪽"
+
+#: src/cli/main.cpp
+msgid "Right"
+msgstr "오른쪽"
+
+#. TRANSLATORS: The AirPods charging case, on the device row beside the two earbuds.
+#: src/cli/main.cpp src/gtk/devices_view.cpp
+msgid "Case"
+msgstr "케이스"
+
#: src/cli/main.cpp
msgid "Could not reach the daemon.\n"
msgstr "데몬에 연결하지 못했습니다.\n"
@@ -763,6 +788,18 @@ msgstr "어댑터 선택은 자동입니다. 전원이 켜진 첫 번째 어댑
msgid "Using controller {}."
msgstr "어댑터 {}을(를) 사용합니다."
+#: src/core/src/bluetooth/airpods.cpp
+msgid "The AirPods address could not be read."
+msgstr "AirPods 주소를 읽을 수 없습니다."
+
+#: src/core/src/bluetooth/airpods.cpp
+msgid "Bluetooth sockets are unavailable on this system."
+msgstr "이 시스템에서는 Bluetooth 소켓을 사용할 수 없습니다."
+
+#: src/core/src/bluetooth/airpods.cpp
+msgid "Another program is using the AirPods channel."
+msgstr "다른 프로그램이 AirPods 채널을 사용 중입니다."
+
#: src/core/src/bluetooth/bearer_supervisor.cpp
msgid ""
"Messages and contacts are connected. BlueZ reports the Bluetooth link down "
@@ -794,7 +831,9 @@ msgid ""
"come up within a minute. Nothing on the iPhone changes this and re-pairing "
"will not either."
msgstr ""
-"이 컴퓨터가 페어링을 BR/EDR로 고정해 두어, iPhone이 알림을 전달하려고 여는 LE 링크가 거부되고 있습니다. 지금 되돌리는 중이며, LE는 1분 이내에 연결될 것입니다. iPhone에서 바꿀 수 있는 것은 없으며, 다시 페어링해도 마찬가지입니다."
+"이 컴퓨터가 페어링을 BR/EDR로 고정해 두어, iPhone이 알림을 전달하려고 여는 "
+"LE 링크가 거부되고 있습니다. 지금 되돌리는 중이며, LE는 1분 이내에 연결될 것"
+"입니다. iPhone에서 바꿀 수 있는 것은 없으며, 다시 페어링해도 마찬가지입니다."
#: src/core/src/bluetooth/bearer_supervisor.cpp
msgid ""
@@ -1353,6 +1392,20 @@ msgstr "Tether 데몬이 실행 중이 아닙니다."
msgid "Daemon Online"
msgstr "데몬 온라인"
+#. TRANSLATORS: Left earbud, abbreviated to fit the device row. One or two letters.
+#: src/gtk/devices_view.cpp
+msgid "L"
+msgstr "좌"
+
+#. TRANSLATORS: Right earbud, abbreviated to fit the device row. One or two letters.
+#: src/gtk/devices_view.cpp
+msgid "R"
+msgstr "우"
+
+#: src/gtk/devices_view.cpp
+msgid "Reading battery…"
+msgstr "배터리를 읽는 중…"
+
#: src/gtk/devices_view.cpp
msgid "Connected."
msgstr "연결되었습니다."
diff --git a/po/nl.po b/po/nl.po
index f45a67e..35bed36 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-07 17:37-0700\n"
+"POT-Creation-Date: 2026-09-08 15:00-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Dutch\n"
@@ -87,6 +87,10 @@ msgstr "Bluetooth-apparaten tonen die BlueZ kent."
msgid "Show Bluetooth link and profile connection state."
msgstr "Status van de Bluetooth-verbinding en van de profielen tonen."
+#: src/cli/main.cpp
+msgid "Show AirPods and case battery."
+msgstr "Accu van de AirPods en de case tonen."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "Berichtgesprekken van de iPhone tonen."
@@ -430,6 +434,27 @@ msgstr "Kon de Bluetooth-apparaten niet van de daemon lezen.\n"
msgid "No Bluetooth devices known to BlueZ.\n"
msgstr "BlueZ kent geen Bluetooth-apparaten.\n"
+#: src/cli/main.cpp
+msgid "Could not read the AirPods battery from the daemon.\n"
+msgstr "Kon de accu van de AirPods niet uitlezen via de daemon.\n"
+
+#: src/cli/main.cpp
+msgid "No AirPods connected.\n"
+msgstr "Geen AirPods verbonden.\n"
+
+#: src/cli/main.cpp
+msgid "Left"
+msgstr "Links"
+
+#: src/cli/main.cpp
+msgid "Right"
+msgstr "Rechts"
+
+#. TRANSLATORS: The AirPods charging case, on the device row beside the two earbuds.
+#: src/cli/main.cpp src/gtk/devices_view.cpp
+msgid "Case"
+msgstr "Case"
+
#: src/cli/main.cpp
msgid "Could not reach the daemon.\n"
msgstr "Kon de daemon niet bereiken.\n"
@@ -779,6 +804,18 @@ msgstr "Adapterkeuze is automatisch: de eerste ingeschakelde.\n"
msgid "Using controller {}."
msgstr "Adapter {} wordt gebruikt."
+#: src/core/src/bluetooth/airpods.cpp
+msgid "The AirPods address could not be read."
+msgstr "Het adres van de AirPods kon niet worden gelezen."
+
+#: src/core/src/bluetooth/airpods.cpp
+msgid "Bluetooth sockets are unavailable on this system."
+msgstr "Bluetooth-sockets zijn niet beschikbaar op dit systeem."
+
+#: src/core/src/bluetooth/airpods.cpp
+msgid "Another program is using the AirPods channel."
+msgstr "Een ander programma gebruikt het AirPods-kanaal."
+
#: src/core/src/bluetooth/bearer_supervisor.cpp
msgid ""
"Messages and contacts are connected. BlueZ reports the Bluetooth link down "
@@ -811,7 +848,10 @@ msgid ""
"come up within a minute. Nothing on the iPhone changes this and re-pairing "
"will not either."
msgstr ""
-"Deze computer had de koppeling vastgezet op BR/EDR, waardoor de LE-verbinding die de iPhone opent voor meldingen wordt geweigerd. Dat wordt nu ongedaan gemaakt; LE zou binnen een minuut tot stand moeten komen. Niets op de iPhone verandert dit, en opnieuw koppelen ook niet."
+"Deze computer had de koppeling vastgezet op BR/EDR, waardoor de LE-"
+"verbinding die de iPhone opent voor meldingen wordt geweigerd. Dat wordt nu "
+"ongedaan gemaakt; LE zou binnen een minuut tot stand moeten komen. Niets op "
+"de iPhone verandert dit, en opnieuw koppelen ook niet."
#: src/core/src/bluetooth/bearer_supervisor.cpp
msgid ""
@@ -1389,6 +1429,20 @@ msgstr "De Tether-daemon draait niet."
msgid "Daemon Online"
msgstr "Daemon online"
+#. TRANSLATORS: Left earbud, abbreviated to fit the device row. One or two letters.
+#: src/gtk/devices_view.cpp
+msgid "L"
+msgstr "L"
+
+#. TRANSLATORS: Right earbud, abbreviated to fit the device row. One or two letters.
+#: src/gtk/devices_view.cpp
+msgid "R"
+msgstr "R"
+
+#: src/gtk/devices_view.cpp
+msgid "Reading battery…"
+msgstr "Accu uitlezen…"
+
#: src/gtk/devices_view.cpp
msgid "Connected."
msgstr "Verbonden."
diff --git a/po/pl.po b/po/pl.po
index ed0d6ff..87a3644 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-07 17:37-0700\n"
+"POT-Creation-Date: 2026-09-08 15:00-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Polish\n"
@@ -88,6 +88,10 @@ msgstr "Wypisz urządzenia Bluetooth znane BlueZ."
msgid "Show Bluetooth link and profile connection state."
msgstr "Pokaż stan połączenia Bluetooth i profili."
+#: src/cli/main.cpp
+msgid "Show AirPods and case battery."
+msgstr "Pokaż poziom baterii AirPods i etui."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "Wypisz rozmowy z wiadomościami z iPhone'a."
@@ -435,6 +439,27 @@ msgstr "Nie udało się odczytać urządzeń Bluetooth od demona.\n"
msgid "No Bluetooth devices known to BlueZ.\n"
msgstr "BlueZ nie zna żadnych urządzeń Bluetooth.\n"
+#: src/cli/main.cpp
+msgid "Could not read the AirPods battery from the daemon.\n"
+msgstr "Nie można odczytać poziomu baterii AirPods z demona.\n"
+
+#: src/cli/main.cpp
+msgid "No AirPods connected.\n"
+msgstr "Nie podłączono żadnych AirPods.\n"
+
+#: src/cli/main.cpp
+msgid "Left"
+msgstr "Lewa"
+
+#: src/cli/main.cpp
+msgid "Right"
+msgstr "Prawa"
+
+#. TRANSLATORS: The AirPods charging case, on the device row beside the two earbuds.
+#: src/cli/main.cpp src/gtk/devices_view.cpp
+msgid "Case"
+msgstr "Etui"
+
#: src/cli/main.cpp
msgid "Could not reach the daemon.\n"
msgstr "Nie udało się połączyć z demonem.\n"
@@ -785,6 +810,18 @@ msgstr "Wybór adaptera jest automatyczny: pierwszy włączony.\n"
msgid "Using controller {}."
msgstr "Używany adapter: {}."
+#: src/core/src/bluetooth/airpods.cpp
+msgid "The AirPods address could not be read."
+msgstr "Nie można odczytać adresu AirPods."
+
+#: src/core/src/bluetooth/airpods.cpp
+msgid "Bluetooth sockets are unavailable on this system."
+msgstr "Gniazda Bluetooth są niedostępne w tym systemie."
+
+#: src/core/src/bluetooth/airpods.cpp
+msgid "Another program is using the AirPods channel."
+msgstr "Inny program używa kanału AirPods."
+
#: src/core/src/bluetooth/bearer_supervisor.cpp
msgid ""
"Messages and contacts are connected. BlueZ reports the Bluetooth link down "
@@ -817,7 +854,10 @@ msgid ""
"come up within a minute. Nothing on the iPhone changes this and re-pairing "
"will not either."
msgstr ""
-"Ten komputer przypiął powiązanie do BR/EDR, co odrzuca połączenie LE otwierane przez iPhone'a do przesyłania powiadomień. Właśnie jest to cofane; LE powinno pojawić się w ciągu minuty. Nic w iPhonie tego nie zmieni, ponowne parowanie również nie."
+"Ten komputer przypiął powiązanie do BR/EDR, co odrzuca połączenie LE "
+"otwierane przez iPhone'a do przesyłania powiadomień. Właśnie jest to cofane; "
+"LE powinno pojawić się w ciągu minuty. Nic w iPhonie tego nie zmieni, "
+"ponowne parowanie również nie."
#: src/core/src/bluetooth/bearer_supervisor.cpp
msgid ""
@@ -1391,6 +1431,20 @@ msgstr "Demon Tether nie działa."
msgid "Daemon Online"
msgstr "Demon online"
+#. TRANSLATORS: Left earbud, abbreviated to fit the device row. One or two letters.
+#: src/gtk/devices_view.cpp
+msgid "L"
+msgstr "L"
+
+#. TRANSLATORS: Right earbud, abbreviated to fit the device row. One or two letters.
+#: src/gtk/devices_view.cpp
+msgid "R"
+msgstr "P"
+
+#: src/gtk/devices_view.cpp
+msgid "Reading battery…"
+msgstr "Odczytywanie baterii…"
+
#: src/gtk/devices_view.cpp
msgid "Connected."
msgstr "Połączono."
diff --git a/po/pt_BR.po b/po/pt_BR.po
index ac99334..bb736b1 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-07 17:37-0700\n"
+"POT-Creation-Date: 2026-09-08 15:00-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Brazilian Portuguese\n"
@@ -88,6 +88,10 @@ msgstr "Listar os dispositivos Bluetooth conhecidos pelo BlueZ."
msgid "Show Bluetooth link and profile connection state."
msgstr "Mostrar o estado do enlace Bluetooth e dos perfis."
+#: src/cli/main.cpp
+msgid "Show AirPods and case battery."
+msgstr "Mostrar a bateria dos AirPods e do estojo."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "Listar as conversas de mensagens do iPhone."
@@ -430,6 +434,27 @@ msgstr "Não foi possível ler os dispositivos Bluetooth no daemon.\n"
msgid "No Bluetooth devices known to BlueZ.\n"
msgstr "Nenhum dispositivo Bluetooth conhecido pelo BlueZ.\n"
+#: src/cli/main.cpp
+msgid "Could not read the AirPods battery from the daemon.\n"
+msgstr "Não foi possível ler a bateria dos AirPods do daemon.\n"
+
+#: src/cli/main.cpp
+msgid "No AirPods connected.\n"
+msgstr "Nenhum AirPods conectado.\n"
+
+#: src/cli/main.cpp
+msgid "Left"
+msgstr "Esq."
+
+#: src/cli/main.cpp
+msgid "Right"
+msgstr "Dir."
+
+#. TRANSLATORS: The AirPods charging case, on the device row beside the two earbuds.
+#: src/cli/main.cpp src/gtk/devices_view.cpp
+msgid "Case"
+msgstr "Estojo"
+
#: src/cli/main.cpp
msgid "Could not reach the daemon.\n"
msgstr "Não foi possível alcançar o daemon.\n"
@@ -782,6 +807,18 @@ msgstr "A seleção de adaptador é automática: o primeiro ligado.\n"
msgid "Using controller {}."
msgstr "Usando o adaptador {}."
+#: src/core/src/bluetooth/airpods.cpp
+msgid "The AirPods address could not be read."
+msgstr "Não foi possível ler o endereço dos AirPods."
+
+#: src/core/src/bluetooth/airpods.cpp
+msgid "Bluetooth sockets are unavailable on this system."
+msgstr "Os sockets Bluetooth não estão disponíveis neste sistema."
+
+#: src/core/src/bluetooth/airpods.cpp
+msgid "Another program is using the AirPods channel."
+msgstr "Outro programa está usando o canal dos AirPods."
+
#: src/core/src/bluetooth/bearer_supervisor.cpp
msgid ""
"Messages and contacts are connected. BlueZ reports the Bluetooth link down "
@@ -814,7 +851,10 @@ msgid ""
"come up within a minute. Nothing on the iPhone changes this and re-pairing "
"will not either."
msgstr ""
-"Este computador havia fixado o pareamento em BR/EDR, o que recusa o enlace LE que o iPhone abre para transportar as notificações. Isso está sendo desfeito agora; o LE deve subir em menos de um minuto. Nada no iPhone muda isso, e parear novamente também não."
+"Este computador havia fixado o pareamento em BR/EDR, o que recusa o enlace "
+"LE que o iPhone abre para transportar as notificações. Isso está sendo "
+"desfeito agora; o LE deve subir em menos de um minuto. Nada no iPhone muda "
+"isso, e parear novamente também não."
#: src/core/src/bluetooth/bearer_supervisor.cpp
msgid ""
@@ -1392,6 +1432,20 @@ msgstr "O daemon do Tether não está em execução."
msgid "Daemon Online"
msgstr "Daemon online"
+#. TRANSLATORS: Left earbud, abbreviated to fit the device row. One or two letters.
+#: src/gtk/devices_view.cpp
+msgid "L"
+msgstr "E"
+
+#. TRANSLATORS: Right earbud, abbreviated to fit the device row. One or two letters.
+#: src/gtk/devices_view.cpp
+msgid "R"
+msgstr "D"
+
+#: src/gtk/devices_view.cpp
+msgid "Reading battery…"
+msgstr "Lendo a bateria…"
+
#: src/gtk/devices_view.cpp
msgid "Connected."
msgstr "Conectado."
diff --git a/po/ru.po b/po/ru.po
index 3d7c63e..e969868 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-07 17:37-0700\n"
+"POT-Creation-Date: 2026-09-08 15:00-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Russian\n"
@@ -88,6 +88,10 @@ msgstr "Показать устройства Bluetooth, известные Blue
msgid "Show Bluetooth link and profile connection state."
msgstr "Показать состояние соединения Bluetooth и профилей."
+#: src/cli/main.cpp
+msgid "Show AirPods and case battery."
+msgstr "Показать заряд AirPods и футляра."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "Показать переписки с сообщениями на iPhone."
@@ -435,6 +439,27 @@ msgstr "Не удалось прочитать устройства Bluetooth у
msgid "No Bluetooth devices known to BlueZ.\n"
msgstr "BlueZ не знает ни одного устройства Bluetooth.\n"
+#: src/cli/main.cpp
+msgid "Could not read the AirPods battery from the daemon.\n"
+msgstr "Не удалось получить заряд AirPods от службы.\n"
+
+#: src/cli/main.cpp
+msgid "No AirPods connected.\n"
+msgstr "AirPods не подключены.\n"
+
+#: src/cli/main.cpp
+msgid "Left"
+msgstr "Левый"
+
+#: src/cli/main.cpp
+msgid "Right"
+msgstr "Правый"
+
+#. TRANSLATORS: The AirPods charging case, on the device row beside the two earbuds.
+#: src/cli/main.cpp src/gtk/devices_view.cpp
+msgid "Case"
+msgstr "Футляр"
+
#: src/cli/main.cpp
msgid "Could not reach the daemon.\n"
msgstr "Не удалось связаться с демоном.\n"
@@ -787,6 +812,18 @@ msgstr "Выбор адаптера автоматический: первый
msgid "Using controller {}."
msgstr "Используется адаптер {}."
+#: src/core/src/bluetooth/airpods.cpp
+msgid "The AirPods address could not be read."
+msgstr "Не удалось прочитать адрес AirPods."
+
+#: src/core/src/bluetooth/airpods.cpp
+msgid "Bluetooth sockets are unavailable on this system."
+msgstr "Сокеты Bluetooth недоступны в этой системе."
+
+#: src/core/src/bluetooth/airpods.cpp
+msgid "Another program is using the AirPods channel."
+msgstr "Канал AirPods занят другой программой."
+
#: src/core/src/bluetooth/bearer_supervisor.cpp
msgid ""
"Messages and contacts are connected. BlueZ reports the Bluetooth link down "
@@ -819,7 +856,10 @@ msgid ""
"come up within a minute. Nothing on the iPhone changes this and re-pairing "
"will not either."
msgstr ""
-"Этот компьютер закрепил сопряжение за BR/EDR, из-за чего отклоняется LE-соединение, которое iPhone открывает для передачи уведомлений. Сейчас это отменяется; LE должно установиться в течение минуты. Ничто на iPhone этого не изменит, повторное сопряжение тоже."
+"Этот компьютер закрепил сопряжение за BR/EDR, из-за чего отклоняется LE-"
+"соединение, которое iPhone открывает для передачи уведомлений. Сейчас это "
+"отменяется; LE должно установиться в течение минуты. Ничто на iPhone этого "
+"не изменит, повторное сопряжение тоже."
#: src/core/src/bluetooth/bearer_supervisor.cpp
msgid ""
@@ -1389,6 +1429,20 @@ msgstr "Демон Tether не запущен."
msgid "Daemon Online"
msgstr "Демон в сети"
+#. TRANSLATORS: Left earbud, abbreviated to fit the device row. One or two letters.
+#: src/gtk/devices_view.cpp
+msgid "L"
+msgstr "Л"
+
+#. TRANSLATORS: Right earbud, abbreviated to fit the device row. One or two letters.
+#: src/gtk/devices_view.cpp
+msgid "R"
+msgstr "П"
+
+#: src/gtk/devices_view.cpp
+msgid "Reading battery…"
+msgstr "Чтение заряда…"
+
#: src/gtk/devices_view.cpp
msgid "Connected."
msgstr "Подключено."
diff --git a/po/sv.po b/po/sv.po
index 2470db3..3b46a08 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-07 17:37-0700\n"
+"POT-Creation-Date: 2026-09-08 15:00-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Swedish\n"
@@ -88,6 +88,10 @@ msgstr "Lista de Bluetooth-enheter som BlueZ känner till."
msgid "Show Bluetooth link and profile connection state."
msgstr "Visa status för Bluetooth-länken och profilerna."
+#: src/cli/main.cpp
+msgid "Show AirPods and case battery."
+msgstr "Visa batterinivå för AirPods och etui."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "Lista iPhonens meddelandekonversationer."
@@ -428,6 +432,27 @@ msgstr "Kunde inte läsa Bluetooth-enheterna från demonen.\n"
msgid "No Bluetooth devices known to BlueZ.\n"
msgstr "BlueZ känner inte till några Bluetooth-enheter.\n"
+#: src/cli/main.cpp
+msgid "Could not read the AirPods battery from the daemon.\n"
+msgstr "Kunde inte läsa AirPods batterinivå från demonen.\n"
+
+#: src/cli/main.cpp
+msgid "No AirPods connected.\n"
+msgstr "Inga AirPods anslutna.\n"
+
+#: src/cli/main.cpp
+msgid "Left"
+msgstr "Vänster"
+
+#: src/cli/main.cpp
+msgid "Right"
+msgstr "Höger"
+
+#. TRANSLATORS: The AirPods charging case, on the device row beside the two earbuds.
+#: src/cli/main.cpp src/gtk/devices_view.cpp
+msgid "Case"
+msgstr "Etui"
+
#: src/cli/main.cpp
msgid "Could not reach the daemon.\n"
msgstr "Kunde inte nå demonen.\n"
@@ -778,6 +803,18 @@ msgstr "Adaptervalet är automatiskt: den första påslagna.\n"
msgid "Using controller {}."
msgstr "Använder adapter {}."
+#: src/core/src/bluetooth/airpods.cpp
+msgid "The AirPods address could not be read."
+msgstr "Kunde inte läsa AirPods-adressen."
+
+#: src/core/src/bluetooth/airpods.cpp
+msgid "Bluetooth sockets are unavailable on this system."
+msgstr "Bluetooth-socketar är inte tillgängliga på det här systemet."
+
+#: src/core/src/bluetooth/airpods.cpp
+msgid "Another program is using the AirPods channel."
+msgstr "Ett annat program använder AirPods-kanalen."
+
#: src/core/src/bluetooth/bearer_supervisor.cpp
msgid ""
"Messages and contacts are connected. BlueZ reports the Bluetooth link down "
@@ -810,7 +847,10 @@ msgid ""
"come up within a minute. Nothing on the iPhone changes this and re-pairing "
"will not either."
msgstr ""
-"Den här datorn hade låst kopplingen till BR/EDR, vilket avvisar den LE-länk som iPhone öppnar för att bära aviseringar. Det håller på att ångras nu; LE bör komma upp inom en minut. Inget på iPhone ändrar detta, och att koppla om gör det inte heller."
+"Den här datorn hade låst kopplingen till BR/EDR, vilket avvisar den LE-länk "
+"som iPhone öppnar för att bära aviseringar. Det håller på att ångras nu; LE "
+"bör komma upp inom en minut. Inget på iPhone ändrar detta, och att koppla om "
+"gör det inte heller."
#: src/core/src/bluetooth/bearer_supervisor.cpp
msgid ""
@@ -1373,6 +1413,20 @@ msgstr "Tether-demonen körs inte."
msgid "Daemon Online"
msgstr "Demonen är online"
+#. TRANSLATORS: Left earbud, abbreviated to fit the device row. One or two letters.
+#: src/gtk/devices_view.cpp
+msgid "L"
+msgstr "V"
+
+#. TRANSLATORS: Right earbud, abbreviated to fit the device row. One or two letters.
+#: src/gtk/devices_view.cpp
+msgid "R"
+msgstr "H"
+
+#: src/gtk/devices_view.cpp
+msgid "Reading battery…"
+msgstr "Läser batterinivå…"
+
#: src/gtk/devices_view.cpp
msgid "Connected."
msgstr "Ansluten."
diff --git a/po/tether.pot b/po/tether.pot
index 97ea5eb..840ed4f 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-07 17:37-0700\n"
+"POT-Creation-Date: 2026-09-08 15:00-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"
@@ -86,6 +86,10 @@ msgstr ""
msgid "Show Bluetooth link and profile connection state."
msgstr ""
+#: src/cli/main.cpp
+msgid "Show AirPods and case battery."
+msgstr ""
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr ""
@@ -389,6 +393,28 @@ msgstr ""
msgid "No Bluetooth devices known to BlueZ.\n"
msgstr ""
+#: src/cli/main.cpp
+msgid "Could not read the AirPods battery from the daemon.\n"
+msgstr ""
+
+#: src/cli/main.cpp
+#, c-format
+msgid "No AirPods connected.\n"
+msgstr ""
+
+#: src/cli/main.cpp
+msgid "Left"
+msgstr ""
+
+#: src/cli/main.cpp
+msgid "Right"
+msgstr ""
+
+#. TRANSLATORS: The AirPods charging case, on the device row beside the two earbuds.
+#: src/cli/main.cpp src/gtk/devices_view.cpp
+msgid "Case"
+msgstr ""
+
#: src/cli/main.cpp
msgid "Could not reach the daemon.\n"
msgstr ""
@@ -721,6 +747,18 @@ msgstr ""
msgid "Using controller {}."
msgstr ""
+#: src/core/src/bluetooth/airpods.cpp
+msgid "The AirPods address could not be read."
+msgstr ""
+
+#: src/core/src/bluetooth/airpods.cpp
+msgid "Bluetooth sockets are unavailable on this system."
+msgstr ""
+
+#: src/core/src/bluetooth/airpods.cpp
+msgid "Another program is using the AirPods channel."
+msgstr ""
+
#: src/core/src/bluetooth/bearer_supervisor.cpp
msgid ""
"Messages and contacts are connected. BlueZ reports the Bluetooth link down "
@@ -1247,6 +1285,20 @@ msgstr ""
msgid "Daemon Online"
msgstr ""
+#. TRANSLATORS: Left earbud, abbreviated to fit the device row. One or two letters.
+#: src/gtk/devices_view.cpp
+msgid "L"
+msgstr ""
+
+#. TRANSLATORS: Right earbud, abbreviated to fit the device row. One or two letters.
+#: src/gtk/devices_view.cpp
+msgid "R"
+msgstr ""
+
+#: src/gtk/devices_view.cpp
+msgid "Reading battery…"
+msgstr ""
+
#: src/gtk/devices_view.cpp
msgid "Connected."
msgstr ""
diff --git a/po/tr.po b/po/tr.po
index 3abc9fe..6b8660b 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-07 17:37-0700\n"
+"POT-Creation-Date: 2026-09-08 15:00-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Turkish\n"
@@ -86,6 +86,10 @@ msgstr "BlueZ'in bildiği Bluetooth aygıtlarını listele."
msgid "Show Bluetooth link and profile connection state."
msgstr "Bluetooth bağlantısının ve profillerin durumunu göster."
+#: src/cli/main.cpp
+msgid "Show AirPods and case battery."
+msgstr "AirPods ve kutu pil durumunu göster."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "iPhone'daki mesaj konuşmalarını listele."
@@ -429,6 +433,27 @@ msgstr "Bluetooth aygıtları arka plan hizmetinden okunamadı.\n"
msgid "No Bluetooth devices known to BlueZ.\n"
msgstr "BlueZ'in bildiği hiçbir Bluetooth aygıtı yok.\n"
+#: src/cli/main.cpp
+msgid "Could not read the AirPods battery from the daemon.\n"
+msgstr "AirPods pil durumu arka plan hizmetinden okunamadı.\n"
+
+#: src/cli/main.cpp
+msgid "No AirPods connected.\n"
+msgstr "Bağlı AirPods yok.\n"
+
+#: src/cli/main.cpp
+msgid "Left"
+msgstr "Sol"
+
+#: src/cli/main.cpp
+msgid "Right"
+msgstr "Sağ"
+
+#. TRANSLATORS: The AirPods charging case, on the device row beside the two earbuds.
+#: src/cli/main.cpp src/gtk/devices_view.cpp
+msgid "Case"
+msgstr "Kutu"
+
#: src/cli/main.cpp
msgid "Could not reach the daemon.\n"
msgstr "Arka plan hizmetine ulaşılamadı.\n"
@@ -779,6 +804,18 @@ msgstr "Bağdaştırıcı seçimi otomatik: açık olan ilk bağdaştırıcı.\n
msgid "Using controller {}."
msgstr "{} bağdaştırıcısı kullanılıyor."
+#: src/core/src/bluetooth/airpods.cpp
+msgid "The AirPods address could not be read."
+msgstr "AirPods adresi okunamadı."
+
+#: src/core/src/bluetooth/airpods.cpp
+msgid "Bluetooth sockets are unavailable on this system."
+msgstr "Bu sistemde Bluetooth soketleri kullanılamıyor."
+
+#: src/core/src/bluetooth/airpods.cpp
+msgid "Another program is using the AirPods channel."
+msgstr "AirPods kanalını başka bir program kullanıyor."
+
#: src/core/src/bluetooth/bearer_supervisor.cpp
msgid ""
"Messages and contacts are connected. BlueZ reports the Bluetooth link down "
@@ -811,7 +848,10 @@ msgid ""
"come up within a minute. Nothing on the iPhone changes this and re-pairing "
"will not either."
msgstr ""
-"Bu bilgisayar eşleşmeyi BR/EDR'ye sabitlemişti; bu da iPhone'un bildirimleri taşımak için açtığı LE bağlantısını reddediyor. Bu şimdi geri alınıyor; LE bir dakika içinde kurulmalı. iPhone'da hiçbir şey bunu değiştirmez, yeniden eşleştirmek de değiştirmez."
+"Bu bilgisayar eşleşmeyi BR/EDR'ye sabitlemişti; bu da iPhone'un bildirimleri "
+"taşımak için açtığı LE bağlantısını reddediyor. Bu şimdi geri alınıyor; LE "
+"bir dakika içinde kurulmalı. iPhone'da hiçbir şey bunu değiştirmez, yeniden "
+"eşleştirmek de değiştirmez."
#: src/core/src/bluetooth/bearer_supervisor.cpp
msgid ""
@@ -1373,6 +1413,20 @@ msgstr "Tether arka plan hizmeti çalışmıyor."
msgid "Daemon Online"
msgstr "Arka plan hizmeti çevrimiçi"
+#. TRANSLATORS: Left earbud, abbreviated to fit the device row. One or two letters.
+#: src/gtk/devices_view.cpp
+msgid "L"
+msgstr "L"
+
+#. TRANSLATORS: Right earbud, abbreviated to fit the device row. One or two letters.
+#: src/gtk/devices_view.cpp
+msgid "R"
+msgstr "R"
+
+#: src/gtk/devices_view.cpp
+msgid "Reading battery…"
+msgstr "Pil durumu okunuyor…"
+
#: src/gtk/devices_view.cpp
msgid "Connected."
msgstr "Bağlandı."
diff --git a/po/uk.po b/po/uk.po
index 94550bd..b1f616e 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-07 17:37-0700\n"
+"POT-Creation-Date: 2026-09-08 15:00-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Ukrainian\n"
@@ -89,6 +89,10 @@ msgstr "Показати пристрої Bluetooth, відомі BlueZ."
msgid "Show Bluetooth link and profile connection state."
msgstr "Показати стан з'єднання Bluetooth і профілів."
+#: src/cli/main.cpp
+msgid "Show AirPods and case battery."
+msgstr "Показати заряд AirPods і футляра."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "Показати розмови з повідомленнями на iPhone."
@@ -435,6 +439,27 @@ msgstr "Не вдалося прочитати пристрої Bluetooth у д
msgid "No Bluetooth devices known to BlueZ.\n"
msgstr "BlueZ не знає жодного пристрою Bluetooth.\n"
+#: src/cli/main.cpp
+msgid "Could not read the AirPods battery from the daemon.\n"
+msgstr "Не вдалося отримати заряд AirPods від служби.\n"
+
+#: src/cli/main.cpp
+msgid "No AirPods connected.\n"
+msgstr "AirPods не під'єднано.\n"
+
+#: src/cli/main.cpp
+msgid "Left"
+msgstr "Лівий"
+
+#: src/cli/main.cpp
+msgid "Right"
+msgstr "Правий"
+
+#. TRANSLATORS: The AirPods charging case, on the device row beside the two earbuds.
+#: src/cli/main.cpp src/gtk/devices_view.cpp
+msgid "Case"
+msgstr "Футляр"
+
#: src/cli/main.cpp
msgid "Could not reach the daemon.\n"
msgstr "Не вдалося зв'язатися з демоном.\n"
@@ -787,6 +812,18 @@ msgstr "Вибір адаптера автоматичний: перший ув
msgid "Using controller {}."
msgstr "Використовується адаптер {}."
+#: src/core/src/bluetooth/airpods.cpp
+msgid "The AirPods address could not be read."
+msgstr "Не вдалося прочитати адресу AirPods."
+
+#: src/core/src/bluetooth/airpods.cpp
+msgid "Bluetooth sockets are unavailable on this system."
+msgstr "Сокети Bluetooth недоступні в цій системі."
+
+#: src/core/src/bluetooth/airpods.cpp
+msgid "Another program is using the AirPods channel."
+msgstr "Канал AirPods використовує інша програма."
+
#: src/core/src/bluetooth/bearer_supervisor.cpp
msgid ""
"Messages and contacts are connected. BlueZ reports the Bluetooth link down "
@@ -819,7 +856,10 @@ msgid ""
"come up within a minute. Nothing on the iPhone changes this and re-pairing "
"will not either."
msgstr ""
-"Цей комп'ютер закріпив спарювання за BR/EDR, через що відхиляється LE-з'єднання, яке iPhone відкриває для передавання сповіщень. Зараз це скасовується; LE має встановитися протягом хвилини. Ніщо на iPhone цього не змінить, повторне спарювання також."
+"Цей комп'ютер закріпив спарювання за BR/EDR, через що відхиляється LE-"
+"з'єднання, яке iPhone відкриває для передавання сповіщень. Зараз це "
+"скасовується; LE має встановитися протягом хвилини. Ніщо на iPhone цього не "
+"змінить, повторне спарювання також."
#: src/core/src/bluetooth/bearer_supervisor.cpp
msgid ""
@@ -1387,6 +1427,20 @@ msgstr "Демон Tether не запущено."
msgid "Daemon Online"
msgstr "Демон у мережі"
+#. TRANSLATORS: Left earbud, abbreviated to fit the device row. One or two letters.
+#: src/gtk/devices_view.cpp
+msgid "L"
+msgstr "Л"
+
+#. TRANSLATORS: Right earbud, abbreviated to fit the device row. One or two letters.
+#: src/gtk/devices_view.cpp
+msgid "R"
+msgstr "П"
+
+#: src/gtk/devices_view.cpp
+msgid "Reading battery…"
+msgstr "Читання заряду…"
+
#: src/gtk/devices_view.cpp
msgid "Connected."
msgstr "Під'єднано."
diff --git a/po/zh_CN.po b/po/zh_CN.po
index 6d2f017..54a74c9 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-07 17:37-0700\n"
+"POT-Creation-Date: 2026-09-08 15:00-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Simplified Chinese\n"
@@ -86,6 +86,10 @@ msgstr "列出 BlueZ 已知的蓝牙设备。"
msgid "Show Bluetooth link and profile connection state."
msgstr "显示蓝牙链路和配置文件的连接状态。"
+#: src/cli/main.cpp
+msgid "Show AirPods and case battery."
+msgstr "显示 AirPods 和充电盒电量。"
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "列出 iPhone 的信息会话。"
@@ -412,6 +416,27 @@ msgstr "无法从守护进程读取蓝牙设备。\n"
msgid "No Bluetooth devices known to BlueZ.\n"
msgstr "BlueZ 没有已知的蓝牙设备。\n"
+#: src/cli/main.cpp
+msgid "Could not read the AirPods battery from the daemon.\n"
+msgstr "无法从守护进程读取 AirPods 电量。\n"
+
+#: src/cli/main.cpp
+msgid "No AirPods connected.\n"
+msgstr "未连接 AirPods。\n"
+
+#: src/cli/main.cpp
+msgid "Left"
+msgstr "左"
+
+#: src/cli/main.cpp
+msgid "Right"
+msgstr "右"
+
+#. TRANSLATORS: The AirPods charging case, on the device row beside the two earbuds.
+#: src/cli/main.cpp src/gtk/devices_view.cpp
+msgid "Case"
+msgstr "充电盒"
+
#: src/cli/main.cpp
msgid "Could not reach the daemon.\n"
msgstr "无法连接到守护进程。\n"
@@ -752,6 +777,18 @@ msgstr "适配器选择为自动:第一个已开启的适配器。\n"
msgid "Using controller {}."
msgstr "正在使用适配器 {}。"
+#: src/core/src/bluetooth/airpods.cpp
+msgid "The AirPods address could not be read."
+msgstr "无法读取 AirPods 地址。"
+
+#: src/core/src/bluetooth/airpods.cpp
+msgid "Bluetooth sockets are unavailable on this system."
+msgstr "此系统不支持 Bluetooth 套接字。"
+
+#: src/core/src/bluetooth/airpods.cpp
+msgid "Another program is using the AirPods channel."
+msgstr "另一个程序正在使用 AirPods 通道。"
+
#: src/core/src/bluetooth/bearer_supervisor.cpp
msgid ""
"Messages and contacts are connected. BlueZ reports the Bluetooth link down "
@@ -781,7 +818,9 @@ msgid ""
"come up within a minute. Nothing on the iPhone changes this and re-pairing "
"will not either."
msgstr ""
-"这台电脑此前把配对固定在了 BR/EDR,因而拒绝了 iPhone 为传送通知而打开的 LE 链路。现在正在撤销;LE 应在一分钟内建立。在 iPhone 上做任何操作都改变不了这一点,重新配对也不行。"
+"这台电脑此前把配对固定在了 BR/EDR,因而拒绝了 iPhone 为传送通知而打开的 LE 链"
+"路。现在正在撤销;LE 应在一分钟内建立。在 iPhone 上做任何操作都改变不了这一"
+"点,重新配对也不行。"
#: src/core/src/bluetooth/bearer_supervisor.cpp
msgid ""
@@ -1320,6 +1359,20 @@ msgstr "Tether 守护进程未在运行。"
msgid "Daemon Online"
msgstr "守护进程在线"
+#. TRANSLATORS: Left earbud, abbreviated to fit the device row. One or two letters.
+#: src/gtk/devices_view.cpp
+msgid "L"
+msgstr "左"
+
+#. TRANSLATORS: Right earbud, abbreviated to fit the device row. One or two letters.
+#: src/gtk/devices_view.cpp
+msgid "R"
+msgstr "右"
+
+#: src/gtk/devices_view.cpp
+msgid "Reading battery…"
+msgstr "正在读取电量…"
+
#: src/gtk/devices_view.cpp
msgid "Connected."
msgstr "已连接。"
diff --git a/src/cli/main.cpp b/src/cli/main.cpp
index 4a380b5..d1a14ee 100644
--- a/src/cli/main.cpp
+++ b/src/cli/main.cpp
@@ -190,6 +190,7 @@ static const Opt kOptions[] = {
{"--bt-status", N_("Show Bluetooth adapter capability and delivery mode.")},
{"--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-threads", N_("List iPhone message conversations.")},
{"--bt-messages <thread>", N_("Show messages in one conversation.")},
{"--bt-send <thread> <text>", N_("Reply in one conversation.")},
@@ -484,6 +485,8 @@ static int print_bt_devices(tether::Client& client) {
add("pbap");
if (d.value("ancs", false))
add("ancs");
+ if (d.value("airpods", false))
+ add("airpods");
if (d.value("preferred_bearer", std::string()) == "bredr" && !d.value("le_connected", false))
add("pinned-bredr");
@@ -497,6 +500,39 @@ static int print_bt_devices(tether::Client& client) {
return 0;
}
+static int print_bt_airpods(tether::Client& client) {
+ nlohmann::json resp;
+ try {
+ resp = nlohmann::json::parse(client.send_and_wait("{\"command\":\"bt_airpods\"}\n"));
+ } catch (const std::exception&) {
+ debug::log(ERR, _("Could not read the AirPods battery from the daemon.\n"));
+ return 1;
+ }
+
+ if (resp.value("address", "").empty()) {
+ fprintf(stdout, _("No AirPods connected.\n"));
+ return 0;
+ }
+
+ fprintf(stdout, "%s (%s)\n", resp.value("name", "").c_str(), resp.value("address", "").c_str());
+
+ const auto level = [&](const char* label, const char* key) {
+ const int percent = resp.value(key, -1);
+ if (percent >= 0)
+ fprintf(stdout, " %-6s %d%%\n", label, percent);
+ else
+ fprintf(stdout, " %-6s --\n", label);
+ };
+ level(_("Left"), "left");
+ level(_("Right"), "right");
+ level(_("Case"), "case");
+
+ const std::string reason = resp.value("reason", "");
+ if (!reason.empty())
+ fprintf(stdout, " %s\n", reason.c_str());
+ return 0;
+}
+
// 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,
@@ -944,6 +980,8 @@ int main(int argc, char* argv[]) {
action = "bt_devices";
} else if (arg == "--bt-connection") {
action = "bt_connection";
+ } else if (arg == "--bt-airpods") {
+ action = "bt_airpods";
} else if (arg == "--bt-diagnostics") {
action = "bt_diagnostics";
} else if (arg == "--bt-threads") {
@@ -1179,6 +1217,8 @@ int main(int argc, char* argv[]) {
return print_bt_devices(client);
} else if (action == "bt_connection") {
return print_bt_connection(client);
+ } else if (action == "bt_airpods") {
+ return print_bt_airpods(client);
} else if (action == "bt_diagnostics") {
return print_bt_diagnostics(client);
} else if (action == "bt_threads") {
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 9153bdb..662f97d 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -35,6 +35,7 @@ add_library(tether STATIC
src/bluetooth/groups.cpp
src/bluetooth/telephony.cpp
src/bluetooth/telephony_pipewire.cpp
+ src/bluetooth/airpods.cpp
src/bluetooth/connection.cpp
src/bluetooth/diagnostics.cpp
src/wayland.cpp
diff --git a/src/core/include/tether/bluetooth/airpods.hpp b/src/core/include/tether/bluetooth/airpods.hpp
new file mode 100644
index 0000000..b37da60
--- /dev/null
+++ b/src/core/include/tether/bluetooth/airpods.hpp
@@ -0,0 +1,104 @@
+#pragma once
+
+#include "tether/bluetooth/objects.hpp"
+
+#include <cstdint>
+#include <functional>
+#include <memory>
+#include <nlohmann/json.hpp>
+#include <optional>
+#include <string>
+
+namespace tether::bluetooth {
+
+ // Apple's Accessory Protocol, the same channel an iPhone uses.
+ inline constexpr uint16_t AAP_PSM = 0x1001;
+
+ // Components in a battery notification.
+ inline constexpr uint8_t AAP_COMPONENT_RIGHT = 0x02;
+ inline constexpr uint8_t AAP_COMPONENT_LEFT = 0x04;
+ inline constexpr uint8_t AAP_COMPONENT_CASE = 0x08;
+ // 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;
+
+ struct AirPodsBattery {
+ // -1 when unknown.
+ int left = -1;
+ int right = -1;
+ int case_ = -1;
+
+ bool any() const { return left >= 0 || right >= 0 || case_ >= 0; }
+
+ bool operator==(const AirPodsBattery&) const = default;
+ };
+
+ // One notification has only the components that changed.
+ struct BatteryUpdate {
+ AirPodsBattery levels;
+ bool has_left = false;
+ bool has_right = false;
+ bool has_case = false;
+
+ bool operator==(const BatteryUpdate&) const = default;
+ };
+
+ enum class AirPodsStatus {
+ // No AirPods connected to this machine.
+ Idle,
+ // The channel is opening, or open with no battery packet yet.
+ Connecting,
+ Live,
+ // The channel is single-client and something else holds it.
+ Busy,
+ Failed,
+ };
+
+ const char* to_string(AirPodsStatus status);
+
+ struct AirPodsState {
+ std::string address;
+ std::string name;
+ AirPodsBattery battery;
+ AirPodsStatus status = AirPodsStatus::Idle;
+ // Written for display, shown verbatim.
+ std::string reason;
+
+ bool operator==(const AirPodsState&) const = default;
+ };
+
+ nlohmann::json to_json(const AirPodsState& state);
+
+ // Decodes an AAP battery notification:
+ // 04 00 04 00 04 00 [count] ([component] 01 [level] [status] 01) * count
+ // Returns no value for anything that is not one, including a truncated packet.
+ std::optional<BatteryUpdate> parse_battery(const uint8_t* data, size_t len);
+
+ void merge_battery(AirPodsBattery& into, const BatteryUpdate& update);
+
+ // 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);
+
+ // Keeps an AAP channel open to one set of AirPods and publishes their battery.
+ class AirPodsWatcher {
+ public:
+ explicit AirPodsWatcher(std::function<void(const AirPodsState&)> on_change);
+ ~AirPodsWatcher();
+
+ AirPodsWatcher(const AirPodsWatcher&) = delete;
+ AirPodsWatcher& operator=(const AirPodsWatcher&) = delete;
+
+ // Points the watcher at a connected device, or stops it when `address` is
+ // 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);
+
+ AirPodsState state() const;
+
+ private:
+ struct Impl;
+ std::unique_ptr<Impl> impl_;
+ };
+
+ extern AirPodsWatcher* g_airpods;
+
+} // namespace tether::bluetooth
diff --git a/src/core/include/tether/bluetooth/objects.hpp b/src/core/include/tether/bluetooth/objects.hpp
index c788eb8..552bed5 100644
--- a/src/core/include/tether/bluetooth/objects.hpp
+++ b/src/core/include/tether/bluetooth/objects.hpp
@@ -17,6 +17,10 @@ namespace tether::bluetooth {
inline constexpr const char* UUID_MAP_MNS = "00001133-0000-1000-8000-00805f9b34fb";
inline constexpr const char* UUID_PBAP_PSE = "0000112f-0000-1000-8000-00805f9b34fb";
inline constexpr const char* UUID_ANCS = "7905f431-b5ce-4e99-a40f-4b1e122d00d0";
+ inline constexpr const char* UUID_A2DP_SINK = "0000110b-0000-1000-8000-00805f9b34fb";
+
+ // Modalias prefix for Apple's Bluetooth vendor id, shared by every Apple device.
+ inline constexpr const char* MODALIAS_APPLE = "bluetooth:v004c";
inline constexpr uint32_t COD_TARGET = 0x0408;
inline constexpr uint32_t COD_MASK = 0x1fff;
@@ -54,6 +58,8 @@ namespace tether::bluetooth {
bool trusted = false;
bool connected = false;
std::vector<std::string> uuids;
+ // Device1.Modalias, e.g. "bluetooth:v004Cp200Ed0100". Names the remote's vendor.
+ std::string modalias;
bool ancs_notifying = false;
@@ -82,6 +88,8 @@ namespace tether::bluetooth {
bool supports_pbap() const { return has_uuid(UUID_PBAP_PSE); }
bool supports_ancs() const { return has_uuid(UUID_ANCS); }
bool looks_like_iphone() const;
+ // Apple audio gear rather than a phone: AAP battery is worth trying on it.
+ bool looks_like_airpods() const;
bool operator==(const Device&) const = default;
};
diff --git a/src/core/include/tether/net.hpp b/src/core/include/tether/net.hpp
index 81b438e..d7a187b 100644
--- a/src/core/include/tether/net.hpp
+++ b/src/core/include/tether/net.hpp
@@ -41,6 +41,7 @@ namespace tether {
// Bluetooth state, read from the BluezMonitor snapshot.
nlohmann::json build_bt_status();
nlohmann::json build_bt_devices();
+ nlohmann::json build_bt_airpods();
// How many contacts a bt_list_contacts answers with when the caller does not say.
inline constexpr size_t BT_CONTACTS_DEFAULT_LIMIT = 100;
diff --git a/src/core/src/bluetooth/airpods.cpp b/src/core/src/bluetooth/airpods.cpp
new file mode 100644
index 0000000..5f8077d
--- /dev/null
+++ b/src/core/src/bluetooth/airpods.cpp
@@ -0,0 +1,447 @@
+#include "tether/bluetooth/airpods.hpp"
+
+#include <tether/i18n.hpp>
+#include <tether/log.hpp>
+
+#include <algorithm>
+#include <array>
+#include <cerrno>
+#include <cstdlib>
+#include <cstring>
+#include <mutex>
+#include <poll.h>
+#include <sys/eventfd.h>
+#include <sys/socket.h>
+#include <thread>
+#include <unistd.h>
+
+// The kernel's L2CAP ABI, declared here rather than pulled in from bluez-libs.
+// glibc already defines some of them.
+#ifndef AF_BLUETOOTH
+#define AF_BLUETOOTH 31
+#endif
+#ifndef SOL_BLUETOOTH
+#define SOL_BLUETOOTH 274
+#endif
+#ifndef BTPROTO_L2CAP
+#define BTPROTO_L2CAP 0
+#endif
+#ifndef BT_SECURITY
+#define BT_SECURITY 4
+#endif
+#ifndef BT_SECURITY_MEDIUM
+#define BT_SECURITY_MEDIUM 2
+#endif
+#ifndef BDADDR_BREDR
+#define BDADDR_BREDR 0
+#endif
+
+namespace {
+
+ struct sockaddr_l2 {
+ sa_family_t l2_family;
+ uint16_t l2_psm;
+ uint8_t l2_bdaddr[6];
+ uint16_t l2_cid;
+ uint8_t l2_bdaddr_type;
+ };
+
+ struct bt_security {
+ uint8_t level;
+ uint8_t key_size;
+ };
+
+} // namespace
+
+namespace tether::bluetooth {
+
+ AirPodsWatcher* g_airpods = nullptr;
+
+ namespace {
+
+ // AAP control packets,
+ constexpr uint8_t HANDSHAKE[] = {
+ 0x00, 0x00, 0x04, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+ constexpr uint8_t SET_FEATURES[] = {
+ 0x04, 0x00, 0x04, 0x00, 0x4d, 0x00, 0xd7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+ constexpr uint8_t REQUEST_NOTIFICATIONS[] = {0x04, 0x00, 0x04, 0x00, 0x0f, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff};
+
+ constexpr uint8_t BATTERY_PREFIX[] = {0x04, 0x00, 0x04, 0x00, 0x04, 0x00};
+ constexpr size_t BATTERY_ENTRY_BYTES = 5;
+
+ constexpr int CONNECT_TIMEOUT_MS = 8000;
+ constexpr int FIRST_PACKET_TIMEOUT_MS = 8000;
+ // A channel that has gone quiet this long is recycled.
+ constexpr int IDLE_TIMEOUT_MS = 300000;
+ constexpr int BACKOFF_START_MS = 1000;
+ constexpr int BACKOFF_MAX_MS = 30000;
+ // A contended channel blocks with no error.
+ constexpr int BUSY_AFTER_ATTEMPTS = 3;
+
+ // "AA:BB:CC:DD:EE:FF" into the kernel's little-endian order.
+ bool parse_address(const std::string& text, uint8_t out[6]) {
+ if (text.size() != 17)
+ return false;
+ for (int i = 0; i < 6; ++i) {
+ const size_t at = static_cast<size_t>(i) * 3;
+ if (i < 5 && text[at + 2] != ':')
+ return false;
+ char* end = nullptr;
+ const long byte = std::strtol(text.substr(at, 2).c_str(), &end, 16);
+ if (end == nullptr || *end != '\0' || byte < 0 || byte > 0xff)
+ return false;
+ out[5 - i] = static_cast<uint8_t>(byte);
+ }
+ return true;
+ }
+
+ // Waits for `fd` or the wake eventfd. Returns 1 for fd, 0 for a wake, -1 on
+ // error or timeout. A negative timeout waits forever.
+ int wait_for(int fd, int wake_fd, short events, int timeout_ms) {
+ pollfd fds[2]{};
+ nfds_t count = 0;
+ int socket_slot = -1;
+ if (fd >= 0) {
+ socket_slot = static_cast<int>(count);
+ fds[count++] = {fd, events, 0};
+ }
+ const int wake_slot = static_cast<int>(count);
+ fds[count++] = {wake_fd, POLLIN, 0};
+
+ if (::poll(fds, count, timeout_ms) <= 0)
+ return -1;
+ if (socket_slot >= 0 && fds[socket_slot].revents != 0)
+ return 1;
+ return fds[wake_slot].revents != 0 ? 0 : -1;
+ }
+
+ bool write_all(int fd, const uint8_t* data, size_t len) {
+ return ::send(fd, data, len, MSG_NOSIGNAL) == static_cast<ssize_t>(len);
+ }
+
+ } // namespace
+
+ const char* to_string(AirPodsStatus status) {
+ switch (status) {
+ case AirPodsStatus::Idle:
+ return "idle";
+ case AirPodsStatus::Connecting:
+ return "connecting";
+ case AirPodsStatus::Live:
+ return "live";
+ case AirPodsStatus::Busy:
+ return "busy";
+ case AirPodsStatus::Failed:
+ return "failed";
+ }
+ return "idle";
+ }
+
+ nlohmann::json to_json(const AirPodsState& s) {
+ return {
+ {"command", "bt_airpods"},
+ {"address", s.address},
+ {"name", s.name},
+ {"left", s.battery.left},
+ {"right", s.battery.right},
+ {"case", s.battery.case_},
+ {"status", to_string(s.status)},
+ {"reason", s.reason},
+ };
+ }
+
+ std::optional<BatteryUpdate> parse_battery(const uint8_t* data, size_t len) {
+ if (data == nullptr || len < sizeof(BATTERY_PREFIX) + 1)
+ return std::nullopt;
+ if (std::memcmp(data, BATTERY_PREFIX, sizeof(BATTERY_PREFIX)) != 0)
+ return std::nullopt;
+
+ const size_t count = data[sizeof(BATTERY_PREFIX)];
+ size_t offset = sizeof(BATTERY_PREFIX) + 1;
+ if (count == 0 || offset + count * BATTERY_ENTRY_BYTES > len)
+ return std::nullopt;
+
+ BatteryUpdate update;
+ for (size_t i = 0; i < count; ++i, offset += BATTERY_ENTRY_BYTES) {
+ const uint8_t component = data[offset];
+ const uint8_t level = data[offset + 2];
+ const uint8_t status = data[offset + 3];
+ const int percent = (status == AAP_STATUS_DISCONNECTED || level > 100) ? -1 : static_cast<int>(level);
+ switch (component) {
+ case AAP_COMPONENT_LEFT:
+ update.levels.left = percent;
+ update.has_left = true;
+ break;
+ case AAP_COMPONENT_RIGHT:
+ update.levels.right = percent;
+ update.has_right = true;
+ break;
+ case AAP_COMPONENT_CASE:
+ update.levels.case_ = percent;
+ update.has_case = true;
+ break;
+ default:
+ break;
+ }
+ }
+ if (!update.has_left && !update.has_right && !update.has_case)
+ return std::nullopt;
+ return update;
+ }
+
+ const Device* find_airpods(const BluezObjects& objects) {
+ for (const auto& device : objects.devices)
+ if (device.connected && device.looks_like_airpods())
+ return &device;
+ return nullptr;
+ }
+
+ void merge_battery(AirPodsBattery& into, const BatteryUpdate& update) {
+ if (update.has_left)
+ into.left = update.levels.left;
+ if (update.has_right)
+ into.right = update.levels.right;
+ if (update.has_case)
+ into.case_ = update.levels.case_;
+ }
+
+ struct AirPodsWatcher::Impl {
+ explicit Impl(std::function<void(const AirPodsState&)> cb) : on_change(std::move(cb)) {}
+
+ std::function<void(const AirPodsState&)> on_change;
+
+ mutable std::mutex mutex;
+ AirPodsState state;
+ AirPodsState published;
+ std::string target_address;
+ std::string target_name;
+ bool stopping = false;
+
+ int wake_fd = -1;
+ std::thread worker;
+
+ void wake() {
+ const uint64_t one = 1;
+ [[maybe_unused]] const ssize_t written = ::write(wake_fd, &one, sizeof(one));
+ }
+
+ void drain_wake() {
+ uint64_t value = 0;
+ [[maybe_unused]] const ssize_t got = ::read(wake_fd, &value, sizeof(value));
+ }
+
+ // Publishes only when the state actually changed, as the connection status does.
+ void publish(AirPodsStatus status, const std::string& reason) {
+ AirPodsState copy;
+ {
+ std::lock_guard<std::mutex> lock(mutex);
+ state.status = status;
+ state.reason = reason;
+ if (state == published)
+ return;
+ published = state;
+ copy = state;
+ }
+ if (on_change)
+ on_change(copy);
+ }
+
+ bool retargeted(const std::string& address) const {
+ std::lock_guard<std::mutex> lock(mutex);
+ return stopping || target_address != address;
+ }
+
+ // Sleeps, returning early if the target changed or the watcher is stopping.
+ void backoff(int ms) {
+ if (wait_for(-1, wake_fd, 0, ms) == 0)
+ drain_wake();
+ }
+
+ // 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.
+ void session(const std::string& address, bool& delivered) {
+ uint8_t addr[6] = {};
+ if (!parse_address(address, addr)) {
+ publish(AirPodsStatus::Failed, _("The AirPods address could not be read."));
+ return;
+ }
+
+ const int fd = ::socket(AF_BLUETOOTH, SOCK_SEQPACKET | SOCK_NONBLOCK | SOCK_CLOEXEC, BTPROTO_L2CAP);
+ if (fd < 0) {
+ debug::log(DEBUG, "airpods: socket failed: {}", std::strerror(errno));
+ publish(AirPodsStatus::Failed, _("Bluetooth sockets are unavailable on this system."));
+ return;
+ }
+
+ sockaddr_l2 sa{};
+ sa.l2_family = AF_BLUETOOTH;
+ sa.l2_psm = AAP_PSM;
+ sa.l2_bdaddr_type = BDADDR_BREDR;
+ std::memcpy(sa.l2_bdaddr, addr, sizeof(addr));
+
+ int rc = ::connect(fd, reinterpret_cast<sockaddr*>(&sa), sizeof(sa));
+ if (rc < 0 && (errno == EACCES || errno == EPERM)) {
+ // Some controllers refuse an unauthenticated channel.
+ bt_security sec{BT_SECURITY_MEDIUM, 0};
+ ::setsockopt(fd, SOL_BLUETOOTH, BT_SECURITY, &sec, sizeof(sec));
+ rc = ::connect(fd, reinterpret_cast<sockaddr*>(&sa), sizeof(sa));
+ }
+ if (rc < 0 && errno != EINPROGRESS) {
+ debug::log(DEBUG, "airpods: connect failed: {}", std::strerror(errno));
+ ::close(fd);
+ return;
+ }
+ if (rc < 0) {
+ if (wait_for(fd, wake_fd, POLLOUT, CONNECT_TIMEOUT_MS) != 1) {
+ debug::log(DEBUG, "airpods: channel did not open within {}ms", CONNECT_TIMEOUT_MS);
+ ::close(fd);
+ return;
+ }
+ int error = 0;
+ socklen_t size = sizeof(error);
+ if (::getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &size) < 0 || error != 0) {
+ debug::log(DEBUG, "airpods: connect failed: {}", std::strerror(error));
+ ::close(fd);
+ return;
+ }
+ }
+
+ if (!write_all(fd, HANDSHAKE, sizeof(HANDSHAKE)) || !write_all(fd, SET_FEATURES, sizeof(SET_FEATURES)) ||
+ !write_all(fd, REQUEST_NOTIFICATIONS, sizeof(REQUEST_NOTIFICATIONS))) {
+ debug::log(DEBUG, "airpods: handshake failed: {}", std::strerror(errno));
+ ::close(fd);
+ return;
+ }
+
+ std::array<uint8_t, 1024> buffer{};
+ while (!retargeted(address)) {
+ const int timeout = delivered ? IDLE_TIMEOUT_MS : FIRST_PACKET_TIMEOUT_MS;
+ const int ready = wait_for(fd, wake_fd, POLLIN, timeout);
+ if (ready == 0) {
+ drain_wake();
+ continue;
+ }
+ if (ready < 0)
+ break;
+
+ const ssize_t got = ::recv(fd, buffer.data(), buffer.size(), 0);
+ if (got <= 0)
+ break;
+
+ auto update = parse_battery(buffer.data(), static_cast<size_t>(got));
+ if (!update)
+ continue;
+
+ delivered = true;
+ {
+ std::lock_guard<std::mutex> lock(mutex);
+ merge_battery(state.battery, *update);
+ }
+ publish(AirPodsStatus::Live, "");
+ }
+
+ ::close(fd);
+ }
+
+ void run() {
+ int backoff_ms = BACKOFF_START_MS;
+ int quiet_attempts = 0;
+
+ while (true) {
+ std::string address;
+ std::string name;
+ {
+ std::lock_guard<std::mutex> lock(mutex);
+ if (stopping)
+ return;
+ address = target_address;
+ name = target_name;
+ }
+
+ if (address.empty()) {
+ {
+ std::lock_guard<std::mutex> lock(mutex);
+ state.address.clear();
+ state.name.clear();
+ state.battery = {};
+ }
+ publish(AirPodsStatus::Idle, "");
+ backoff_ms = BACKOFF_START_MS;
+ quiet_attempts = 0;
+ if (wait_for(-1, wake_fd, 0, -1) == 0)
+ drain_wake();
+ continue;
+ }
+
+ {
+ std::lock_guard<std::mutex> lock(mutex);
+ if (state.address != address) {
+ state.address = address;
+ state.battery = {};
+ }
+ state.name = name;
+ }
+ if (quiet_attempts < BUSY_AFTER_ATTEMPTS)
+ publish(AirPodsStatus::Connecting, "");
+
+ bool delivered = false;
+ session(address, delivered);
+
+ if (retargeted(address))
+ continue;
+
+ if (delivered) {
+ quiet_attempts = 0;
+ backoff_ms = BACKOFF_START_MS;
+ } else if (++quiet_attempts == BUSY_AFTER_ATTEMPTS) {
+ debug::log(INFO, "airpods: the AAP channel is not answering; another program probably holds it");
+ publish(AirPodsStatus::Busy, _("Another program is using the AirPods channel."));
+ }
+
+ backoff(backoff_ms);
+ backoff_ms = std::min(backoff_ms * 2, BACKOFF_MAX_MS);
+ }
+ }
+ };
+
+ AirPodsWatcher::AirPodsWatcher(std::function<void(const AirPodsState&)> on_change)
+ : impl_(std::make_unique<Impl>(std::move(on_change))) {
+ impl_->wake_fd = ::eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);
+ if (impl_->wake_fd < 0) {
+ debug::log(WARN, "airpods: eventfd failed: {}", std::strerror(errno));
+ return;
+ }
+ impl_->worker = std::thread([this] { impl_->run(); });
+ }
+
+ AirPodsWatcher::~AirPodsWatcher() {
+ if (impl_->worker.joinable()) {
+ {
+ std::lock_guard<std::mutex> lock(impl_->mutex);
+ impl_->stopping = true;
+ }
+ impl_->wake();
+ impl_->worker.join();
+ }
+ if (impl_->wake_fd >= 0)
+ ::close(impl_->wake_fd);
+ }
+
+ void AirPodsWatcher::set_device(const std::string& address, const std::string& name) {
+ {
+ std::lock_guard<std::mutex> lock(impl_->mutex);
+ if (impl_->target_address == address && impl_->target_name == name)
+ return;
+ impl_->target_address = address;
+ impl_->target_name = name;
+ }
+ impl_->wake();
+ }
+
+ AirPodsState AirPodsWatcher::state() const {
+ std::lock_guard<std::mutex> lock(impl_->mutex);
+ return impl_->state;
+ }
+
+} // namespace tether::bluetooth
diff --git a/src/core/src/bluetooth/objects.cpp b/src/core/src/bluetooth/objects.cpp
index a830742..c2e81b9 100644
--- a/src/core/src/bluetooth/objects.cpp
+++ b/src/core/src/bluetooth/objects.cpp
@@ -211,6 +211,7 @@ namespace tether::bluetooth {
d.trusted = get_bool(props, "Trusted");
d.connected = get_bool(props, "Connected");
d.uuids = get_strv(props, "UUIDs");
+ d.modalias = get_string(props, "Modalias");
d.preferred_bearer = get_string(props, "PreferredBearer");
d.services_resolved = get_bool(props, "ServicesResolved");
g_variant_unref(props);
@@ -251,6 +252,24 @@ namespace tether::bluetooth {
bool Device::looks_like_iphone() const { return supports_ancs() || (supports_map() && supports_pbap()); }
+ bool Device::looks_like_airpods() const {
+ // An iPhone carries the same vendor id, so the audio profile is what separates them.
+ if (looks_like_iphone() || !has_uuid(UUID_A2DP_SINK))
+ return false;
+ std::string lowered = modalias;
+ std::transform(lowered.begin(), lowered.end(), lowered.begin(), [](unsigned char c) {
+ return static_cast<char>(std::tolower(c));
+ });
+ if (lowered.rfind(MODALIAS_APPLE, 0) == 0)
+ return true;
+ // Modalias is absent until SDP has been read at least once.
+ lowered = name;
+ std::transform(lowered.begin(), lowered.end(), lowered.begin(), [](unsigned char c) {
+ return static_cast<char>(std::tolower(c));
+ });
+ return lowered.find("airpod") != std::string::npos;
+ }
+
const Adapter* BluezObjects::find_adapter(const std::string& path) const {
auto it = std::find_if(adapters.begin(), adapters.end(), [&](const Adapter& a) { return a.path == path; });
return it == adapters.end() ? nullptr : &*it;
@@ -581,6 +600,7 @@ namespace tether::bluetooth {
{"ancs_notifying", d.ancs_notifying},
{"services_resolved", d.services_resolved},
{"iphone", d.looks_like_iphone()},
+ {"airpods", d.looks_like_airpods()},
};
}
diff --git a/src/core/src/net.cpp b/src/core/src/net.cpp
index 972b61f..dfcebca 100644
--- a/src/core/src/net.cpp
+++ b/src/core/src/net.cpp
@@ -15,6 +15,7 @@
#include <sys/wait.h>
#include <unistd.h>
+#include "tether/bluetooth/airpods.hpp"
#include "tether/bluetooth/config.hpp"
#include "tether/bluetooth/connection.hpp"
#include "tether/bluetooth/contacts.hpp"
@@ -669,6 +670,12 @@ namespace tether {
return result;
}
+ nlohmann::json build_bt_airpods() {
+ if (!bluetooth::g_airpods)
+ return bluetooth::to_json(bluetooth::AirPodsState{});
+ return bluetooth::to_json(bluetooth::g_airpods->state());
+ }
+
static nlohmann::json build_local_state_snapshot() {
nlohmann::json snapshot;
snapshot["command"] = "state_snapshot";
@@ -947,6 +954,10 @@ namespace tether {
continue;
} else if (j.contains("command") && j["command"] == "bt_scan") {
std::thread(run_bt_scan).detach();
+ } else if (j.contains("command") && j["command"] == "bt_airpods") {
+ std::string payload = build_bt_airpods().dump() + "\n";
+ write_plain_packet(client_fd, payload);
+ 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/daemon/main.cpp b/src/daemon/main.cpp
index 8b56fdf..69b208e 100644
--- a/src/daemon/main.cpp
+++ b/src/daemon/main.cpp
@@ -5,6 +5,7 @@
#include <mutex>
#include <nlohmann/json.hpp>
#include <sys/timerfd.h>
+#include <tether/bluetooth/airpods.hpp>
#include <tether/bluetooth/config.hpp>
#include <tether/bluetooth/connection.hpp>
#include <tether/bluetooth/contacts.hpp>
@@ -245,12 +246,27 @@ int main(int argc, char** argv) {
// Pick the controller before the first capability, a second adapter never comes up bound to the wrong one.
bluez.set_preferred_adapter(bt_config.adapter);
+
+ // AirPods battery arrives on its own L2CAP channel, not through BlueZ.
+ tether::bluetooth::AirPodsWatcher airpods([](const tether::bluetooth::AirPodsState& state) {
+ tether::broadcast_local_event(tether::bluetooth::to_json(state).dump());
+ });
+ const auto follow_airpods = [&bluez, &airpods]() {
+ const auto snapshot = bluez.snapshot();
+ const auto* device = tether::bluetooth::find_airpods(snapshot);
+ airpods.set_device(device ? device->address : std::string{}, device ? device->name : std::string{});
+ };
+
if (bluez.start()) {
tether::bluetooth::g_bluez = &bluez;
- loop.addFd(bluez.event_fd(), [&bluez](int) {
+ tether::bluetooth::g_airpods = &airpods;
+ loop.addFd(bluez.event_fd(), [&bluez, &follow_airpods](int) {
bluez.drain();
+ tether::broadcast_local_event(tether::build_bt_devices().dump());
tether::broadcast_local_event(tether::build_bt_status().dump());
+ follow_airpods();
});
+ follow_airpods();
auto cap = bluez.capability();
debug::log(INFO, "Bluetooth: {} mode", tether::bluetooth::to_string(cap.mode));
for (const auto& reason : cap.reasons)
diff --git a/src/gtk/daemon_client.cpp b/src/gtk/daemon_client.cpp
index a0db8e5..0a41474 100644
--- a/src/gtk/daemon_client.cpp
+++ b/src/gtk/daemon_client.cpp
@@ -157,6 +157,7 @@ namespace tether::ui {
daemon_send({{"command", "bt_connection"}});
daemon_send({{"command", "bt_status"}});
daemon_send({{"command", "bt_list_devices"}});
+ daemon_send({{"command", "bt_airpods"}});
// primes the tray unread count
daemon_send({{"command", "bt_list_threads"}});
set_status_main(_("Daemon Online"));
diff --git a/src/gtk/devices_view.cpp b/src/gtk/devices_view.cpp
index af7966b..c27a4a8 100644
--- a/src/gtk/devices_view.cpp
+++ b/src/gtk/devices_view.cpp
@@ -32,6 +32,8 @@ namespace tether::ui {
// The Bluetooth route
std::vector<nlohmann::json> bt_devices;
+ // An object, not null: bt_devices can arrive before the first bt_airpods.
+ nlohmann::json bt_airpods = nlohmann::json::object();
nlohmann::json bt_status = nlohmann::json::object();
nlohmann::json bt_connection = nlohmann::json::object();
@@ -119,6 +121,32 @@ namespace tether::ui {
return nullptr;
}
+ // "L 82% R 79% Case 45%", omitting whatever is not reporting. An empty
+ // result means nothing is known yet.
+ std::string airpods_battery_text(const nlohmann::json& airpods) {
+ std::string text;
+ const auto append = [&](const char* label, int level) {
+ if (level < 0)
+ return;
+ if (!text.empty())
+ text += " ";
+ text += label + (" " + std::to_string(level) + "%");
+ };
+ // TRANSLATORS: Left earbud, abbreviated to fit the device row. One or two letters.
+ append(_("L"), airpods.value("left", -1));
+ // TRANSLATORS: Right earbud, abbreviated to fit the device row. One or two letters.
+ append(_("R"), airpods.value("right", -1));
+ // TRANSLATORS: The AirPods charging case, on the device row beside the two earbuds.
+ append(_("Case"), airpods.value("case", -1));
+ if (!text.empty())
+ return text;
+
+ const std::string status = airpods.value("status", "");
+ if (status == "busy" || status == "failed")
+ return airpods.value("reason", "");
+ return _("Reading battery\u2026");
+ }
+
// The daemon supervises one iPhone at a time, so the live profile status
// describes whichever Bluetooth device is bonded, not the one merely
// selected in the list.
@@ -749,6 +777,7 @@ namespace tether::ui {
const std::string name = device.value("name", "").empty() ? address : device.value("name", "");
const bool paired = device.value("paired", false);
const bool connected = device.value("connected", false);
+ const bool airpods = device.value("airpods", false);
const bool route_ready =
is_supervised_bt_device(address) && (g_devices.bt_connection.value("map_open", false) ||
g_devices.bt_connection.value("ancs_ready", false));
@@ -760,8 +789,10 @@ namespace tether::ui {
GtkWidget* box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
gtk_container_set_border_width(GTK_CONTAINER(box), 12);
- GtkWidget* icon = gtk_image_new_from_icon_name(
- connected ? "bluetooth-active-symbolic" : "bluetooth-symbolic", GTK_ICON_SIZE_LARGE_TOOLBAR);
+ const char* icon_name = airpods ? "audio-headphones-symbolic"
+ : connected ? "bluetooth-active-symbolic"
+ : "bluetooth-symbolic";
+ GtkWidget* icon = gtk_image_new_from_icon_name(icon_name, GTK_ICON_SIZE_LARGE_TOOLBAR);
gtk_box_pack_start(GTK_BOX(box), icon, FALSE, FALSE, 0);
GtkWidget* labels = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);
@@ -770,15 +801,29 @@ namespace tether::ui {
gtk_label_set_xalign(GTK_LABEL(title), 0.0);
gtk_box_pack_start(GTK_BOX(labels), title, FALSE, FALSE, 0);
- const char* subtitle_text = route_ready ? _("Connected")
- : connected ? _("Partially connected")
- : paired ? _("Paired")
- : _("Nearby (Tap to Pair)");
+ // "Partially connected" is about the iPhone's message and notification
+ // routes, which say nothing about a pair of earbuds.
+ const char* subtitle_text = (route_ready || (airpods && connected)) ? _("Connected")
+ : connected ? _("Partially connected")
+ : paired ? _("Paired")
+ : _("Nearby (Tap to Pair)");
GtkWidget* subtitle = gtk_label_new(subtitle_text);
gtk_label_set_xalign(GTK_LABEL(subtitle), 0.0);
gtk_style_context_add_class(gtk_widget_get_style_context(subtitle), "muted");
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");
+ if (g_devices.bt_airpods.value("address", "") == address)
+ gtk_label_set_text(GTK_LABEL(battery), airpods_battery_text(g_devices.bt_airpods).c_str());
+ g_object_set_data(G_OBJECT(row), "bt_battery", battery);
+ gtk_box_pack_start(GTK_BOX(labels), battery, FALSE, FALSE, 0);
+ }
+
gtk_box_pack_start(GTK_BOX(box), labels, TRUE, TRUE, 0);
gtk_container_add(GTK_CONTAINER(row), box);
return row;
@@ -871,7 +916,8 @@ namespace tether::ui {
std::vector<GtkWidget*> bt_rows;
for (const auto& device : g_devices.bt_devices) {
- if (!device.value("iphone", false) && !is_supervised_bt_device(device.value("address", "")))
+ if (!device.value("iphone", false) && !device.value("airpods", false) &&
+ !is_supervised_bt_device(device.value("address", "")))
continue;
bt_rows.push_back(create_bt_row(device));
}
@@ -1098,6 +1144,23 @@ namespace tether::ui {
update_right_pane();
return true;
}
+ if (command == "bt_airpods") {
+ g_devices.bt_airpods = event;
+ // Battery arrives whenever the buds feel like sending it
+ const std::string address = event.value("address", "");
+ const std::string text = address.empty() ? "" : airpods_battery_text(event);
+ GList* rows = gtk_container_get_children(GTK_CONTAINER(g_devices.list_devices));
+ for (GList* item = rows; item; item = item->next) {
+ auto* row = GTK_WIDGET(item->data);
+ const char* row_address = (const char*)g_object_get_data(G_OBJECT(row), "bt_address");
+ auto* battery = GTK_WIDGET(g_object_get_data(G_OBJECT(row), "bt_battery"));
+ if (!battery || !row_address || (!address.empty() && address != row_address))
+ continue;
+ gtk_label_set_text(GTK_LABEL(battery), text.c_str());
+ }
+ g_list_free(rows);
+ return true;
+ }
if (command == "bt_connection_changed") {
g_devices.bt_connection = event;
const bool connected = event.value("map_open", false) || event.value("ancs_ready", false);
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 204572b..3e127e8 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -1,5 +1,6 @@
add_executable(tether_test
test_base64.cpp
+ test_airpods.cpp
test_bluetooth_objects.cpp
test_bluetooth_monitor.cpp
test_bluetooth_pairing.cpp
diff --git a/test/test_airpods.cpp b/test/test_airpods.cpp
new file mode 100644
index 0000000..2bae5a6
--- /dev/null
+++ b/test/test_airpods.cpp
@@ -0,0 +1,97 @@
+#include <gtest/gtest.h>
+#include <tether/bluetooth/airpods.hpp>
+
+using namespace tether::bluetooth;
+
+namespace {
+
+ std::optional<BatteryUpdate> parse(const std::vector<uint8_t>& packet) {
+ return parse_battery(packet.data(), packet.size());
+ }
+
+ // 04 00 04 00 04 00 [count] ([component] 01 [level] [status] 01) * count
+ const std::vector<uint8_t> ALL_THREE = {0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x03, 0x04, 0x01, 0x52, 0x01,
+ 0x01, 0x02, 0x01, 0x4f, 0x01, 0x01, 0x08, 0x01, 0x2d, 0x01, 0x01};
+
+ const std::vector<uint8_t> RIGHT_ONLY = {0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x02, 0x01, 0x50, 0x01, 0x01};
+
+ // A bud back in the case: present in the packet, reporting nothing.
+ const std::vector<uint8_t> LEFT_DISCONNECTED = {
+ 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x04, 0x01, 0x00, 0x04, 0x01};
+
+} // namespace
+
+TEST(AirPods, ParsesEveryComponent) {
+ auto update = parse(ALL_THREE);
+ ASSERT_TRUE(update.has_value());
+ EXPECT_TRUE(update->has_left);
+ EXPECT_TRUE(update->has_right);
+ EXPECT_TRUE(update->has_case);
+ EXPECT_EQ(update->levels.left, 82);
+ EXPECT_EQ(update->levels.right, 79);
+ EXPECT_EQ(update->levels.case_, 45);
+}
+
+// A component the packet leaves out must keep whatever it had. Reporting it as 0
+// or unknown would make one bud's update blank the other.
+TEST(AirPods, PartialUpdateLeavesOtherComponentsAlone) {
+ AirPodsBattery battery;
+ merge_battery(battery, *parse(ALL_THREE));
+ merge_battery(battery, *parse(RIGHT_ONLY));
+
+ EXPECT_EQ(battery.left, 82);
+ EXPECT_EQ(battery.right, 80);
+ EXPECT_EQ(battery.case_, 45);
+}
+
+// Status 0x04 is a bud in the case or a shut case, not a flat battery.
+TEST(AirPods, DisconnectedComponentReadsUnknownNotZero) {
+ auto update = parse(LEFT_DISCONNECTED);
+ ASSERT_TRUE(update.has_value());
+ EXPECT_TRUE(update->has_left);
+ EXPECT_EQ(update->levels.left, -1);
+
+ AirPodsBattery battery;
+ merge_battery(battery, *parse(ALL_THREE));
+ merge_battery(battery, *update);
+ EXPECT_EQ(battery.left, -1);
+ EXPECT_EQ(battery.right, 79);
+}
+
+TEST(AirPods, RejectsMalformedPackets) {
+ // Count says two entries, only one follows.
+ EXPECT_FALSE(parse({0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x02, 0x04, 0x01, 0x52, 0x01, 0x01}).has_value());
+ // Some other AAP notification on the same channel.
+ EXPECT_FALSE(parse({0x04, 0x00, 0x04, 0x00, 0x0f, 0x00, 0x01, 0x04, 0x01, 0x52, 0x01, 0x01}).has_value());
+ EXPECT_FALSE(parse({0x04, 0x00, 0x04}).has_value());
+ EXPECT_FALSE(parse({}).has_value());
+ // Well-formed but carrying only components we have no field for.
+ EXPECT_FALSE(parse({0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x01, 0x01, 0x52, 0x01, 0x01}).has_value());
+}
+
+TEST(AirPods, DistinguishesAirPodsFromAnIPhone) {
+ Device buds;
+ buds.name = "ZBZ AirPros";
+ buds.modalias = "bluetooth:v004Cp200Ed0100";
+ buds.uuids = {UUID_A2DP_SINK};
+ EXPECT_TRUE(buds.looks_like_airpods());
+ EXPECT_FALSE(buds.looks_like_iphone());
+
+ // An iPhone is the same vendor and can carry the same audio profile.
+ Device phone;
+ phone.name = "iPhone";
+ phone.modalias = "bluetooth:v004Cp700Ed0100";
+ phone.uuids = {UUID_A2DP_SINK, UUID_MAP_MAS, UUID_PBAP_PSE};
+ EXPECT_FALSE(phone.looks_like_airpods());
+
+ // Modalias is absent until SDP has been read, so the name still has to work.
+ Device unread;
+ unread.name = "AirPods Pro";
+ unread.uuids = {UUID_A2DP_SINK};
+ EXPECT_TRUE(unread.looks_like_airpods());
+
+ Device speaker;
+ speaker.name = "Kitchen Speaker";
+ speaker.uuids = {UUID_A2DP_SINK};
+ EXPECT_FALSE(speaker.looks_like_airpods());
+}