Use subsystem recovery for Sargo modem faults
Select RELATED before HAL startup and create oFono’s private state directory. A controlled modem restart recovered network registration without rebooting the phone; two persistent boots and native UI checks passed. The IMS firmware watchdog root cause remains unresolved.
This commit is contained in:
parent
bdbb2e13f3
commit
d5cfc8a7d7
4 changed files with 261 additions and 0 deletions
35
tundra/runtime/modem-recovery.py
Normal file
35
tundra/runtime/modem-recovery.py
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/env python3
|
||||
# SPDX-License-Identifier: MPL-2.0
|
||||
"""Keep a Sargo modem fault from immediately restarting the whole phone."""
|
||||
from pathlib import Path
|
||||
import time
|
||||
|
||||
|
||||
def configure(devices=Path('/sys/bus/msm_subsys/devices')):
|
||||
matches = [p.parent for p in devices.glob('*/name')
|
||||
if p.read_text().strip() == 'modem']
|
||||
if len(matches) != 1:
|
||||
raise RuntimeError('Expected one Sargo modem subsystem')
|
||||
level = matches[0]/'restart_level'
|
||||
previous = level.read_text().strip()
|
||||
if previous not in ('SYSTEM', 'RELATED'):
|
||||
raise RuntimeError('Unsupported modem restart policy: '+previous)
|
||||
# This kernel supports coupled subsystem recovery. Firmware failures and
|
||||
# unsuccessful recovery remain visible in the kernel log; do not suppress
|
||||
# its watchdog or crash accounting.
|
||||
if previous != 'RELATED':
|
||||
level.write_text('RELATED\n')
|
||||
if level.read_text().strip() != 'RELATED':
|
||||
raise RuntimeError('Modem restart policy was not applied')
|
||||
print('Sargo modem recovery: '+previous+' -> RELATED', flush=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
for attempt in range(30):
|
||||
try:
|
||||
configure()
|
||||
break
|
||||
except (FileNotFoundError, RuntimeError):
|
||||
if attempt == 29:
|
||||
raise
|
||||
time.sleep(1)
|
||||
|
|
@ -2,10 +2,16 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
"""Configure isolated oFono/PulseAudio diagnostics; no call or SMS on startup."""
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
|
||||
|
||||
def prepare(root, write):
|
||||
write('etc/tundra/hardware-enabled', 'sargo\n')
|
||||
shutil.copy2(Path(__file__).with_name('modem-recovery.py'),
|
||||
root/'etc/tundra/modem-recovery.py')
|
||||
write('etc/systemd/system/tundra-hal.service.d/modem-recovery.conf', '''[Service]
|
||||
ExecStartPre=/usr/bin/python3 /etc/tundra/modem-recovery.py
|
||||
''')
|
||||
with (root/'etc/group').open('a') as groups:
|
||||
groups.write('audio:x:1005:droidian\ncamera:x:1006:droidian\nradio:x:1001:\nmedia:x:1013:droidian\n')
|
||||
write('etc/ofono/binder.conf', '[Settings]\nExpectSlots = slot1\n\n[slot1]\npath = /ril_0\nslot = 0\n')
|
||||
|
|
@ -26,6 +32,8 @@ After=tundra-hal.service dbus.service
|
|||
[Service]
|
||||
Type=dbus
|
||||
BusName=org.ofono
|
||||
StateDirectory=ofono
|
||||
StateDirectoryMode=0700
|
||||
ExecStartPre=/usr/bin/binder-wait android.hardware.radio@1.0::IRadio/slot1
|
||||
ExecStart=/usr/sbin/ofonod --nodetach
|
||||
Restart=on-failure
|
||||
|
|
|
|||
Loading…
Reference in a new issue