From 518bdde47d0f3ad591573c9e494926d45de7dd4c Mon Sep 17 00:00:00 2001 From: Derek Ross Date: Tue, 3 Nov 2026 16:00:19 -0500 Subject: [PATCH] omamobile-modem-sit 0.3.30, device-cheetah 0.1.44: call audio on a fresh Pixel 7 Pro install The packaged /etc/omamobile/modem-sit.conf and the built-in default both said [audio] card = none, so a phone installed from the image connected calls with no audio at all. The reference phone had audio only because its config was edited by hand (card = auto, 2026-11-03), and pacman keeps an edited backup= file, so the release notes' "calls work" held for that phone alone. The default can't simply become "auto": the same package runs on the Pixel 9a and the Pixel 6 Pro, whose call routes aren't verified (on the 9a, #367's experimental speakerphone route is opt-in through this key). So the default now comes from the device package: - modem-sit reads /usr/lib/omamobile/modem-sit.conf.d/*.conf after its built-in defaults and before /etc (a value set in /etc still wins; OMAMOBILE_SIT_DEFAULTS for the tests). The built-in default stays none. - The packaged /etc file leaves card commented out, so the device's default applies on a fresh install. - device-cheetah ships 50-cheetah.conf with card = auto: each call in the protection service's earpiece mode, clean by ear on VoLTE calls on 2026-11-03 (NOTES). A phone whose modem-sit.conf was edited (the Mobile network page writes it) keeps its explicit "card = none" line; the upgrade message says to delete it. Nothing else changes for the 9a or the 6 Pro: without a device file they stay at none. device-cheetah's boot files are unchanged (only src/ is hashed), so no restaging is needed. Co-Authored-By: Claude Opus 5.5 --- device/cheetah/MODEM-CLIENT.md | 5 +- device/cheetah/MODEM-PLAN.md | 3 +- device/cheetah/NOTES.md | 5 +- docs/ROADMAP.md | 2 +- docs/release-notes/2026.11.03.md | 2 +- packages/omamobile-device-cheetah/README.md | 1 + packages/omamobile-device-cheetah/test/all | 7 +++ .../modem-sit.conf.d/50-cheetah.conf | 9 ++++ packages/omamobile-device-cheetah/version | 2 +- .../etc/omamobile/modem-sit.conf | 8 ++- packages/omamobile-modem-sit/lib/paths.py | 20 +++++++ .../omamobile-modem-sit/lib/voice_audio.py | 14 ++--- .../omamobile-modem-sit.install | 7 +++ packages/omamobile-modem-sit/test/env.py | 1 + .../test/test_voice_audio.py | 53 +++++++++++++++++-- packages/omamobile-modem-sit/version | 2 +- 16 files changed, 121 insertions(+), 20 deletions(-) create mode 100644 packages/omamobile-device-cheetah/vendor/omamobile/modem-sit.conf.d/50-cheetah.conf diff --git a/device/cheetah/MODEM-CLIENT.md b/device/cheetah/MODEM-CLIENT.md index 64e15f6da..8561bb114 100644 --- a/device/cheetah/MODEM-CLIENT.md +++ b/device/cheetah/MODEM-CLIENT.md @@ -61,7 +61,8 @@ Units (`systemd/`), none enabled by the package: Config: `/etc/omamobile/modem-sit.conf` (`[network] apn` is required; `ims`, `ims_apn`, `ims_required` (default no: an IMS failure keeps data, 0.3.2), `nr`, timeouts including `ims_timeout`; `[control] group`; `[audio] card` -(default `none` since 0.3.3: calls route no audio until M5), +(built-in default `none`; from 0.3.30 a device package's `[audio]` defaults in +`/usr/lib/omamobile/modem-sit.conf.d/*.conf` come first and `/etc` wins over them), `mic_boost_db`). Tests: `packages/omamobile-modem-sit/test/all` (about 10 s): 53 unit tests @@ -138,7 +139,7 @@ registration indication), unless `ims_required = yes`. | Gap | Effect | |---|---| -| Call audio | Off by default (`[audio] card = none`, 0.3.3): calls connect silent. TDM 0 feeds both amplifiers and the top one is the earpiece; until an earpiece mode exists (TELEPHONY-APPS-PLAN T4, MODEM-PLAN M5) a configured card is refused unless speaker protection runs at stage media or c8, the top amplifier is at analog 6 or less (AUDIO-PLAN section 4) and both are within the media stage | +| Call audio | On by default on the Pixel 7 Pro from `omamobile-modem-sit` 0.3.30 with `omamobile-device-cheetah` 0.1.44 (its `/usr/lib/omamobile/modem-sit.conf.d/50-cheetah.conf` sets `card = auto`), each call in the protection service's earpiece mode and refused without it (the call goes on silent); `none` on phones whose device package sets nothing (from 0.3.3 to 0.3.29 the default was `none` everywhere) | | Speakerphone | Not routed; calls use the stock voice path (EP5 to TDM 0) | | Call waiting, conference, emergency and short codes, MMS download | Refused or not implemented (emergency numbers are refused by the dialer check: **this phone cannot call emergency services under Linux**) | | Signal strength | Reported as 0 | diff --git a/device/cheetah/MODEM-PLAN.md b/device/cheetah/MODEM-PLAN.md index a5fc61f6f..0b9f05962 100644 --- a/device/cheetah/MODEM-PLAN.md +++ b/device/cheetah/MODEM-PLAN.md @@ -8,7 +8,8 @@ both ways through Phone and Messages (omatel-agent through in stock's order (IMS first on CID 2, the internet on CID 3; #384) and no carrier manifest, the APNs and the bearer order chosen from the SIM (`omamobile-modem-sit` 0.3.29, #373), the earpiece at every speaker stage -(`omamobile-audio` 0.5.13, #402), and `omamobile-modem-boot.target` on by +(`omamobile-audio` 0.5.13, #402) and on by default on a fresh install +(`omamobile-modem-sit` 0.3.30, `omamobile-device-cheetah` 0.1.44), and `omamobile-modem-boot.target` on by default from `omamobile-device-cheetah` 0.1.43 (M4.6b, B6-B9b passed, #398). Kernel `7.3.0-rc6-omamobile-g2219cc6cda77`, the release kernel. Open: suspend with the modem up (section 6.3; the stack holds a sleep diff --git a/device/cheetah/NOTES.md b/device/cheetah/NOTES.md index 21c4f00d1..0861b2479 100644 --- a/device/cheetah/NOTES.md +++ b/device/cheetah/NOTES.md @@ -22,7 +22,10 @@ the same Verizon-network SIM as the entry below. The runbook: read the SIM once, chose Verizon's values from its overrides (APN VZWINTERNET, attach none, IMS first on CID 2, the internet on CID 3, profiles 0/2/3/4) and registered IMS and data, with nothing typed into - `modem-sit.conf`. + `modem-sit.conf`. Call audio ran on one hand edit there, `[audio] card = + auto`: a fresh install had `card = none` (calls connect silent) until + `omamobile-modem-sit` 0.3.30 with `omamobile-device-cheetah` 0.1.44, whose + defaults file sets `auto` on this phone. - **The earpiece at the loud stage** [V]: stage `c9` with the boost converter on (657/6 through ASP, the bottom amplifier muted, `omamobile-earpiece@on.service`) was clean by ear on a VoLTE call, so diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index c4df6fcdd..0cc10afac 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -87,7 +87,7 @@ M2.5, M3.1, M3.3-B, M3.4 CP ONLINE, M4.1 SIT IPC and clean reboots (passed) ─> | IMS (VoLTE) registration | Part of M4.2's start-up; its values are proven on one network only (a T-Mobile-network MVNO). Since 0.3.2 a failure keeps data | The SIM test; another network may need its own IMS values | | Front end | Done offline: `omamobile-mmd` serves ModemManager's API and passed on the phone without a SIM (T1, 2026-10-14) | T2: GNOME Calls, Chatty, omaphone and omamessages against the real modem (runbook S11) | | Calls and messages UI | omatel (Phone, Messages, their agent) and the shell's call card and lock-screen calls are built and tested offline | After T2; MMS is T3 | -| M5: calls with audio | 14-25 days (TELEPHONY-APPS-PLAN T4): the earpiece mode under speaker protection, a Voice Call UCM verb, speakerphone, Bluetooth | Design only; until then calls connect silent (`[audio] card = none`) | +| M5: calls with audio | 14-25 days (TELEPHONY-APPS-PLAN T4): the earpiece mode under speaker protection, a Voice Call UCM verb, speakerphone, Bluetooth | The earpiece is done on the Pixel 7 Pro and on by default (#402, `omamobile-modem-sit` 0.3.30 with `omamobile-device-cheetah` 0.1.44); speakerphone and Bluetooth are open | | M6: suspend with the modem online | after S8 and M4 | Design only | The modem's NV is never written from Linux: the chroot works on checksum-verified RAM copies. diff --git a/docs/release-notes/2026.11.03.md b/docs/release-notes/2026.11.03.md index 73d69406e..6b2024665 100644 --- a/docs/release-notes/2026.11.03.md +++ b/docs/release-notes/2026.11.03.md @@ -51,7 +51,7 @@ From [docs/DEVICES.md](../DEVICES.md) on the release day: ## Known issues -- **Calls, texts and mobile data work on the tested network.** Tested on the reference phone with one Verizon-network SIM (Tracfone): VoLTE calls both ways, texts over IMS, and mobile data as a fallback route behind Wi-Fi ([DEVICES](../DEVICES.md)). Other networks are untested. The SIM's APNs and bearer order come from its carrier, read once from the SIM at boot ([#373](https://github.com/derekross/omarchy-mobile/pull/373)): a Verizon-network SIM is the one proven end to end; other carriers take the carrier database's APNs, and the Mobile network page under Setup shows and corrects them. Call audio through the earpiece works at every speaker stage (`omamobile-audio` 0.5.13). With the modem up the phone never sleeps (the stack holds a sleep inhibitor, because suspend with the modem up isn't qualified), and each restart with the modem up costs one recovered storage error-handler pass. After a hang or a forced reset with the modem up, the next boot leaves the modem off once (the Mobile data tile says "Off after a hang or reset"; `journalctl -b -1 -u omamobile-modem` has that boot's line) and the boot after starts it again; if that boot ends the same way, the modem stays off (the tile adds "(held)") until the markers are cleared by hand (`sudo rm -f /var/lib/omamobile/modem-up /var/lib/omamobile/modem-up.refused-*`, then restart the phone), and a clean reboot in between resets the count. `sudo touch /etc/omamobile/modem-hold` holds it from the first time. To keep the whole stack off: `sudo systemctl mask omamobile-modem-boot.target` (`disable` doesn't remove the package's link, and `systemctl is-enabled` reads "disabled" either way). +- **Calls, texts and mobile data work on the tested network.** Tested on the reference phone with one Verizon-network SIM (Tracfone): VoLTE calls both ways, texts over IMS, and mobile data as a fallback route behind Wi-Fi ([DEVICES](../DEVICES.md)). Other networks are untested. The SIM's APNs and bearer order come from its carrier, read once from the SIM at boot ([#373](https://github.com/derekross/omarchy-mobile/pull/373)): a Verizon-network SIM is the one proven end to end; other carriers take the carrier database's APNs, and the Mobile network page under Setup shows and corrects them. Call audio through the earpiece works at every speaker stage (`omamobile-audio` 0.5.13), on by default (`omamobile-modem-sit` 0.3.30 with `omamobile-device-cheetah` 0.1.44). A development install whose `/etc/omamobile/modem-sit.conf` was edited (the Mobile network page writes it) keeps its `card = none` line: delete it for call audio. With the modem up the phone never sleeps (the stack holds a sleep inhibitor, because suspend with the modem up isn't qualified), and each restart with the modem up costs one recovered storage error-handler pass. After a hang or a forced reset with the modem up, the next boot leaves the modem off once (the Mobile data tile says "Off after a hang or reset"; `journalctl -b -1 -u omamobile-modem` has that boot's line) and the boot after starts it again; if that boot ends the same way, the modem stays off (the tile adds "(held)") until the markers are cleared by hand (`sudo rm -f /var/lib/omamobile/modem-up /var/lib/omamobile/modem-up.refused-*`, then restart the phone), and a clean reboot in between resets the count. `sudo touch /etc/omamobile/modem-hold` holds it from the first time. To keep the whole stack off: `sudo systemctl mask omamobile-modem-boot.target` (`disable` doesn't remove the package's link, and `systemctl is-enabled` reads "disabled" either way). - **Suspend: works when asked for, auto-sleep off by default.** `systemctl suspend` sleeps and wakes reliably (on a key or the RTC), Wi-Fi stays connected across it, and standby lasts about 16 hours, well short of stock's. Auto-sleep after the screen goes off ships **off**; it can be turned on with `omarchy-toggle omamobile-sleep on`, but it hasn't finished a day-long test. With the modem up the phone doesn't sleep at all (above). Wi-Fi traffic and a USB plug can't wake the phone. - **Cameras:** basic image quality (no Google ISP or tuning); the telephoto doesn't focus. - **Bluetooth:** headset calls (HFP) don't work yet. diff --git a/packages/omamobile-device-cheetah/README.md b/packages/omamobile-device-cheetah/README.md index cfcf95df8..96c5a7243 100644 --- a/packages/omamobile-device-cheetah/README.md +++ b/packages/omamobile-device-cheetah/README.md @@ -11,6 +11,7 @@ Omarchy Mobile's system support for the Google Pixel 7 Pro (codename cheetah, Te | `src/reboot-to.c` | `/usr/bin/reboot-to` | Reboot with a reason the bootloader understands. One source, inside this package, also linked into every initramfs | | `bin/omamobile-setup-system` | `/usr/bin` | System setup: UTF-8 locale, timezone, NTP (Omarchy lifecycle `setup-system`) | | `vendor/udev/rules.d/10-omamobile-storage.rules` | `/usr/lib/udev/rules.d` | Continues the initramfs storage guard: Android partitions stay hidden and the whole-disk node unusable | +| `vendor/omamobile/modem-sit.conf.d/50-cheetah.conf` | `/usr/lib/omamobile/modem-sit.conf.d` | omamobile-modem-sit's defaults for this phone: call audio through the AoC card in the protection service's earpiece mode (`card = auto`); a value in `/etc/omamobile/modem-sit.conf` wins | | `vendor/systemd/network/20-usb-gadget.network` | `/usr/lib/systemd/network` | USB networking to a host (172.16.42.1) | | `vendor/NetworkManager/conf.d/10-omamobile-usb.conf` | `/usr/lib/NetworkManager/conf.d` | Keeps NetworkManager off the USB link | | `vendor/systemd/logind.conf.d/10-omamobile-power-key.conf` | `/usr/lib/systemd/logind.conf.d` | A short power press opens the system menu instead of powering off | diff --git a/packages/omamobile-device-cheetah/test/all b/packages/omamobile-device-cheetah/test/all index ef235acaf..fba7eb760 100755 --- a/packages/omamobile-device-cheetah/test/all +++ b/packages/omamobile-device-cheetah/test/all @@ -169,6 +169,13 @@ grep -q '^\[Unit\]' "$d" && ! grep -q '^\[Service\]' "$d" || fail "the sit-data for n in omamobile-modem.service omamobile-modem-inhibit.service omamobile-sitd.service omamobile-sit-data.service omamobile-mmd.service; do [[ -z $(find "$tmp/root/usr/lib/systemd" -name "$n" -path '*.wants/*' -o -name "$n" -path '*.requires/*') ]] || fail "no wants link for $n is shipped (the target is the switch)" done +# Call audio (0.1.44): the 7 Pro's defaults for omamobile-modem-sit route +# calls through the AoC card in the earpiece mode; modem-sit's packaged +# /etc file leaves the card unset, so this is what a fresh install gets. +d=$tmp/root/usr/lib/omamobile/modem-sit.conf.d/50-cheetah.conf +[[ -f $d ]] || fail "the modem-sit defaults are staged" +python3 -I -c 'import configparser,sys; p=configparser.ConfigParser(interpolation=None); p.read(sys.argv[1]); sys.exit(p.get("audio","card")!="auto")' "$d" \ + || fail "the 7 Pro's call audio default is card = auto" if [[ -f ../omamobile-modem/systemd/omamobile-modem-boot.target ]]; then grep -qx 'WantedBy=multi-user.target' ../omamobile-modem/systemd/omamobile-modem-boot.target || fail "the link matches the target's own [Install]" grep -qx 'ConditionPathExists=/usr/lib/omamobile-vendor/modem/root' ../omamobile-modem/systemd/omamobile-modem.service \ diff --git a/packages/omamobile-device-cheetah/vendor/omamobile/modem-sit.conf.d/50-cheetah.conf b/packages/omamobile-device-cheetah/vendor/omamobile/modem-sit.conf.d/50-cheetah.conf new file mode 100644 index 000000000..2664e5b2e --- /dev/null +++ b/packages/omamobile-device-cheetah/vendor/omamobile/modem-sit.conf.d/50-cheetah.conf @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: MIT +# The Pixel 7 Pro's defaults for omamobile-modem-sit, read before +# /etc/omamobile/modem-sit.conf (a value set there wins). +[audio] +# Call audio through the AoC card, each call in the protection service's +# earpiece mode (the top amplifier alone at 657/6, the bottom muted; +# AOC-PLAN.md C9k), clean by ear on VoLTE calls on 2026-11-03 +# (device/cheetah/NOTES.md, 2026-11-03). +card = auto diff --git a/packages/omamobile-device-cheetah/version b/packages/omamobile-device-cheetah/version index 278cbc8db..6871b9e7a 100644 --- a/packages/omamobile-device-cheetah/version +++ b/packages/omamobile-device-cheetah/version @@ -1 +1 @@ -0.1.43 +0.1.44 diff --git a/packages/omamobile-modem-sit/etc/omamobile/modem-sit.conf b/packages/omamobile-modem-sit/etc/omamobile/modem-sit.conf index eaf47b35e..669526205 100644 --- a/packages/omamobile-modem-sit/etc/omamobile/modem-sit.conf +++ b/packages/omamobile-modem-sit/etc/omamobile/modem-sit.conf @@ -127,14 +127,18 @@ group = wheel [audio] # The AoC sound card for call audio: "none" connects calls without routing -# any audio; "auto" finds the AoC card in /proc/asound/cards. With a card +# any audio; "auto" (or an empty value) finds the AoC card in +# /proc/asound/cards. Commented out, the phone's device package decides +# (/usr/lib/omamobile/modem-sit.conf.d): "auto" on the Pixel 7 Pro, whose +# earpiece route is verified; "none" elsewhere until a phone's route is. +# A value here always wins. With a card # and earpiece = yes, each call runs in the protection service's earpiece # mode (omamobile-speaker-protection earpiece on: the top amplifier alone # at 657/6, the bottom muted) and audio is refused unless the service # reports that mode; with earpiece = no, refused unless the service runs at # stage media or c8 with the top amplifier at analog 6 or less and both # within the media stage's ceilings (digital 737, analog 10). -card = none +#card = none earpiece = yes # Microphone gain above stock's 130 cB during calls: 6 (default, judged # louder and clean in calls on this phone) or 0 (stock). diff --git a/packages/omamobile-modem-sit/lib/paths.py b/packages/omamobile-modem-sit/lib/paths.py index 5b4c96eb0..a5f5db50a 100644 --- a/packages/omamobile-modem-sit/lib/paths.py +++ b/packages/omamobile-modem-sit/lib/paths.py @@ -19,6 +19,14 @@ STATE = Path(os.environ.get('OMAMOBILE_SIT_STATE', '/var/lib/omamobile-sit')) INBOX = STATE / 'inbox' CONFIG = Path(os.environ.get('OMAMOBILE_SIT_CONFIG', '/etc/omamobile/modem-sit.conf')) +# A device package's defaults (*.conf, read in name order before CONFIG, so +# a value set in CONFIG wins): the settings that hold only on that phone, +# such as the call audio route its owner has verified ([audio] card = auto +# from omamobile-device-cheetah). Without one, DEFAULTS hold. Only their +# [audio] section is read: omamobile-mmd and the shell read [network] and +# [data] from CONFIG themselves and would never see a device default there. +# A file that can't be read or parsed is skipped (the safe side: no route). +DEVICE_DEFAULTS = Path(os.environ.get('OMAMOBILE_SIT_DEFAULTS', '/usr/lib/omamobile/modem-sit.conf.d')) # CPIF's character devices. "unix:PATH" is a SOCK_SEQPACKET socket (the # simulator); "none" for BOOT means "no CP state ioctl: assume ONLINE". @@ -43,6 +51,18 @@ def config(path=None): parser = configparser.ConfigParser(interpolation=None) parser.read_dict(DEFAULTS) + try: + files = sorted(f for f in DEVICE_DEFAULTS.glob('*.conf') if f.is_file()) + except OSError: + files = [] + for f in files: + device = configparser.ConfigParser(interpolation=None) + try: + device.read_string(f.read_text(), str(f)) + except (OSError, UnicodeDecodeError, configparser.Error): + continue + if device.has_section('audio'): + parser.read_dict({'audio': dict(device['audio'])}) parser.read(path or CONFIG) return parser diff --git a/packages/omamobile-modem-sit/lib/voice_audio.py b/packages/omamobile-modem-sit/lib/voice_audio.py index aa75df4f2..748571e32 100644 --- a/packages/omamobile-modem-sit/lib/voice_audio.py +++ b/packages/omamobile-modem-sit/lib/voice_audio.py @@ -8,12 +8,14 @@ with omamobile-audio: the downlink plays through TDM 0, so it needs the amplifiers set up (stock's TDM 0 format, protection service running). -TDM 0 feeds both amplifiers, and the top one is the earpiece. Until the -protection service has an earpiece mode (TELEPHONY-APPS-PLAN T4), routing is -refused unless the protection service reports itself running at stage -media or c8 and the amplifiers are at or below the earpiece ceiling (top -analog <= 6, AUDIO-PLAN.md section 4) and the media stage's (digital <= 737, -analog <= 10, AGENTS.md). The default config routes no call audio at all. +TDM 0 feeds both amplifiers, and the top one is the earpiece. With the +protection service's earpiece mode (AOC-PLAN.md C9k) each call runs in that +mode; without it, routing is refused unless the protection service reports +itself running at stage media or c8 and the amplifiers are at or below the +earpiece ceiling (top analog <= 6, AUDIO-PLAN.md section 4) and the media +stage's (digital <= 737, analog <= 10, AGENTS.md). The built-in default +routes no call audio; a device package whose route is verified sets +[audio] card = auto in its defaults (paths.DEVICE_DEFAULTS). """ import ctypes as C import os diff --git a/packages/omamobile-modem-sit/omamobile-modem-sit.install b/packages/omamobile-modem-sit/omamobile-modem-sit.install index 1a0e69f48..892123058 100644 --- a/packages/omamobile-modem-sit/omamobile-modem-sit.install +++ b/packages/omamobile-modem-sit/omamobile-modem-sit.install @@ -20,6 +20,13 @@ post_upgrade() { echo " setup: no attach APN, IMS first on CID 2, the internet on CID 3, stock's profiles);" echo " values you typed keep working. New: [data] roaming (.pacnew)." fi + if [[ $(vercmp "$2" 0.3.30) -lt 0 ]] \ + && grep -Eq '^[[:space:]]*card[[:space:]]*=[[:space:]]*none[[:space:]]*$' /etc/omamobile/modem-sit.conf 2>/dev/null; then + echo "omamobile-modem-sit 0.3.30: [audio] card now comes from the device package when" + echo " /etc/omamobile/modem-sit.conf leaves it unset. Your edited file keeps its" + echo " \"card = none\" line: on a Pixel 7 Pro, delete that line for call audio through" + echo " the earpiece, then restart the phone. On other phones, leave it." + fi } pre_remove() { systemctl disable --now omamobile-sit-data.service omamobile-sitd.service 2>/dev/null || true diff --git a/packages/omamobile-modem-sit/test/env.py b/packages/omamobile-modem-sit/test/env.py index 56f563655..584eee1aa 100644 --- a/packages/omamobile-modem-sit/test/env.py +++ b/packages/omamobile-modem-sit/test/env.py @@ -15,6 +15,7 @@ 'OMAMOBILE_SIT_RUN': os.path.join(TMP, 'run'), 'OMAMOBILE_SIT_STATE': os.path.join(TMP, 'state'), 'OMAMOBILE_SIT_CONFIG': os.path.join(TMP, 'modem-sit.conf'), + 'OMAMOBILE_SIT_DEFAULTS': os.path.join(TMP, 'modem-sit.conf.d'), 'OMAMOBILE_SIT_DEVICE': 'unix:' + os.path.join(TMP, 'ipc0'), 'OMAMOBILE_SIT_ROUTER': 'unix:' + os.path.join(TMP, 'router'), 'OMAMOBILE_SIT_BOOT': 'none', diff --git a/packages/omamobile-modem-sit/test/test_voice_audio.py b/packages/omamobile-modem-sit/test/test_voice_audio.py index 6675c22c9..86b2479ec 100644 --- a/packages/omamobile-modem-sit/test/test_voice_audio.py +++ b/packages/omamobile-modem-sit/test/test_voice_audio.py @@ -1,6 +1,7 @@ # SPDX-License-Identifier: MIT -import env # noqa: F401 (paths and sys.path first) +import env # (paths and sys.path first; env.TMP for scratch files) import os +import shutil import tempfile import unittest from unittest.mock import patch @@ -170,12 +171,56 @@ def test_unreadable_level_refuses(self): class CallAudioDefaultTests(unittest.TestCase): + PACKAGED = os.path.join(os.path.dirname(__file__), '..', 'etc', 'omamobile', 'modem-sit.conf') + + def device_defaults(self, text): + directory = tempfile.mkdtemp(dir=env.TMP) + if text is not None: + with open(os.path.join(directory, '50-device.conf'), 'w') as f: + f.write(text) + return patch.object(paths, 'DEVICE_DEFAULTS', paths.Path(directory)) + def test_no_call_audio_by_default(self): - self.assertEqual(paths.config('/nonexistent')['audio']['card'], 'none') - packaged = paths.config(os.path.join(os.path.dirname(__file__), '..', 'etc', 'omamobile', 'modem-sit.conf')) - self.assertEqual(packaged['audio']['card'], 'none') + # No device package defaults (any phone but a verified one): no route. + with self.device_defaults(None): + self.assertEqual(paths.config('/nonexistent')['audio']['card'], 'none') + self.assertEqual(paths.config(self.PACKAGED)['audio']['card'], 'none') self.assertIsNone(voice_audio.aoc_card('none')) + def test_the_packaged_config_leaves_the_card_to_the_device(self): + # A fresh install's /etc file must not override the device package's + # default: an explicit "card = none" there gave the 7 Pro silent calls. + with self.device_defaults('[audio]\ncard = auto\n'): + self.assertEqual(paths.config(self.PACKAGED)['audio']['card'], 'auto') + + def test_a_broken_device_file_is_skipped(self): + for text in ('[audio\ncard = auto\n', 'card = auto\n'): + with self.device_defaults(text): + self.assertEqual(paths.config(self.PACKAGED)['audio']['card'], 'none') + + def test_device_defaults_set_only_audio(self): + with self.device_defaults('[network]\napn = example\n[audio]\ncard = auto\n'): + settings = paths.config(self.PACKAGED) + self.assertEqual(settings['audio']['card'], 'auto') + self.assertEqual(settings['network']['apn'], 'auto') + + def test_a_typed_card_wins_over_the_device_default(self): + conf = os.path.join(tempfile.mkdtemp(dir=env.TMP), 'modem-sit.conf') + with open(conf, 'w') as f: + f.write('[audio]\ncard = none\n') + with self.device_defaults('[audio]\ncard = auto\n'): + self.assertEqual(paths.config(conf)['audio']['card'], 'none') + + def test_the_7_pro_ships_auto(self): + shipped = os.path.join(os.path.dirname(__file__), '..', '..', 'omamobile-device-cheetah', 'vendor', + 'omamobile', 'modem-sit.conf.d', '50-cheetah.conf') + if not os.path.exists(shipped): + self.skipTest('not in the repository (a copy of this package alone)') + directory = tempfile.mkdtemp(dir=env.TMP) + shutil.copy(shipped, directory) + with patch.object(paths, 'DEVICE_DEFAULTS', paths.Path(directory)): + self.assertEqual(paths.config(self.PACKAGED)['audio']['card'], 'auto') + def test_no_aoc_card_routes_nothing(self): with patch.object(voice_audio, 'Path') as fake: fake.return_value.read_text.return_value = ' 0 [Headset ]: USB-Audio - Headset\n' diff --git a/packages/omamobile-modem-sit/version b/packages/omamobile-modem-sit/version index a6c8cf78c..cfa5015f6 100644 --- a/packages/omamobile-modem-sit/version +++ b/packages/omamobile-modem-sit/version @@ -1 +1 @@ -0.3.29 +0.3.30