mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-20 08:42:11 +08:00
ModemManager restart (#36433)
* res * limit * not needed * comments + explicit
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user