ModemManager restart (#36433)

* res

* limit

* not needed

* comments + explicit
pull/36500/head
Maxime Desroches 2 weeks ago committed by GitHub
parent 2d0340cefd
commit 6c85e2c697
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 24
      system/hardware/hardwared.py

@ -103,8 +103,8 @@ def hw_state_thread(end_event, hw_queue):
modem_version = None
modem_configured = False
modem_restarted = False
modem_missing_count = 0
modem_restart_count = 0
while not end_event.is_set():
# these are expensive calls. update every 10s
@ -121,16 +121,18 @@ def hw_state_thread(end_event, hw_queue):
if modem_version is not None:
cloudlog.event("modem version", version=modem_version)
else:
if not modem_restarted:
# TODO: we may be able to remove this with a MM update
# ModemManager's probing on startup can fail
# rarely, restart the service to probe again.
modem_missing_count += 1
if modem_missing_count > 3:
modem_restarted = True
cloudlog.event("restarting ModemManager")
os.system("sudo systemctl restart --no-block ModemManager")
if AGNOS and modem_restart_count < 3 and HARDWARE.get_modem_version() is None:
# TODO: we may be able to remove this with a MM update
# ModemManager's probing on startup can fail
# rarely, restart the service to probe again.
# Also, AT commands sometimes timeout resulting in ModemManager not
# trying to use this modem anymore.
modem_missing_count += 1
if (modem_missing_count % 4) == 0:
modem_restart_count += 1
cloudlog.event("restarting ModemManager")
os.system("sudo systemctl restart --no-block ModemManager")
tx, rx = HARDWARE.get_modem_data_usage()

Loading…
Cancel
Save