Log android system shutdown to param (#23520)

* Log android system shutdown to param

* comment

Co-authored-by: Comma Device <device@comma.ai>
old-commit-hash: 610b99fd68
commatwo_master
Adeeb Shihadeh 3 years ago committed by GitHub
parent 7ea602dafe
commit 2f87bde2ff
  1. 1
      release/files_common
  2. 1
      selfdrive/common/params.cc
  3. 27
      selfdrive/hardware/eon/shutdownd.py
  4. 3
      selfdrive/manager/process_config.py

@ -255,6 +255,7 @@ selfdrive/hardware/base.py
selfdrive/hardware/hw.h
selfdrive/hardware/eon/__init__.py
selfdrive/hardware/eon/androidd.py
selfdrive/hardware/eon/shutdownd.py
selfdrive/hardware/eon/hardware.h
selfdrive/hardware/eon/hardware.py
selfdrive/hardware/eon/neos.py

@ -133,6 +133,7 @@ std::unordered_map<std::string, uint32_t> keys = {
{"LastGPSPosition", PERSISTENT},
{"LastPeripheralPandaType", PERSISTENT},
{"LastPowerDropDetected", CLEAR_ON_MANAGER_START},
{"LastSystemShutdown", CLEAR_ON_MANAGER_START},
{"LastUpdateException", PERSISTENT},
{"LastUpdateTime", PERSISTENT},
{"LiveParameters", PERSISTENT},

@ -0,0 +1,27 @@
#!/usr/bin/env python3
import os
import time
import datetime
from common.params import Params
from selfdrive.hardware.eon.hardware import getprop
from selfdrive.swaglog import cloudlog
def main():
params = Params()
while True:
# 0 for shutdown, 1 for reboot
prop = getprop("sys.shutdown.requested")
if prop is not None and len(prop) > 0:
os.system("pkill -9 loggerd")
params.put("LastSystemShutdown", f"'{prop}' {datetime.datetime.now()}")
print("shutdown detected", repr(prop))
time.sleep(120)
cloudlog.error('shutdown false positive')
break
time.sleep(0.1)
if __name__ == "__main__":
main()

@ -1,7 +1,7 @@
import os
from selfdrive.manager.process import PythonProcess, NativeProcess, DaemonProcess
from selfdrive.hardware import EON, TICI, PC
from selfdrive.manager.process import PythonProcess, NativeProcess, DaemonProcess
WEBCAM = os.getenv("USE_WEBCAM") is not None
@ -40,6 +40,7 @@ procs = [
# EON only
PythonProcess("rtshield", "selfdrive.rtshield", enabled=EON),
PythonProcess("shutdownd", "selfdrive.hardware.eon.shutdownd", enabled=EON),
PythonProcess("androidd", "selfdrive.hardware.eon.androidd", enabled=EON, persistent=True),
]

Loading…
Cancel
Save