Automatically reconnect single ADB head unit

This commit is contained in:
2026-07-31 19:25:32 +02:00
parent 3e3e0010d6
commit 0a0dae144c
12 changed files with 103 additions and 29 deletions
+11 -6
View File
@@ -151,15 +151,19 @@ Important values:
- `UPDATE_STATUS_PATH`: update state shared with the systemd update unit
- `VERSION_FILE`: revision metadata for the active atomic release
- `ADB_ENABLED`: enables the read-only head-unit collector; defaults to `false`
- `ADB_SERIAL`: exact device serial used for every ADB command when enabled
- `ADB_SERIAL`: optional exact serial; when empty, discovery requires exactly one attached device
- `ADB_PATH` and `ADB_TIMEOUT_MS`: executable path and per-command timeout
### Read-only ADB setup
ADB integration is optional and disabled by default. Every command is pinned to one
configured serial, uses a fixed server-side argument list, and has a timeout and 16 KiB
output limit. It currently reads connection state, selected `getprop` identity fields,
and `wm size`/`wm density` only.
ADB integration is optional and disabled by default. It starts the ADB server when the
companion service boots. With no configured serial it automatically selects exactly one
attached device and refuses ambiguous multi-device connections; after selection every
command is serial-pinned. Commands use fixed server-side argument lists with a timeout
and 16 KiB output limit. The ADB authorization key persists in the companion data
directory, so an already-authorized car reconnects after Pi reboot or USB reattachment.
The collector currently reads connection state, selected `getprop` identity fields, and
`wm size`/`wm density` only.
On a deployed Pi, rerun `install.sh` once so `android-tools-adb` is present and the
service account receives the standard `plugdev` device-access group. Connect the head
@@ -174,7 +178,8 @@ Accept the authorization prompt on the parked infotainment screen. Set these val
```text
ADB_ENABLED=true
ADB_SERIAL=<exact serial shown by adb devices>
# Optional when only the MG4 is attached:
ADB_SERIAL=
```
If the device is disconnected, offline, unauthorized, partially readable, or ADB is