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)
|
||||
Loading…
Reference in a new issue