Log android system shutdown to param (#23520)

* Log android system shutdown to param

* comment

Co-authored-by: Comma Device <device@comma.ai>
pull/23521/head
Adeeb Shihadeh 2022-01-13 22:40:35 -08:00 committed by GitHub
parent 8c53adf4ab
commit 610b99fd68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 1 deletions

View File

@ -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

View File

@ -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},

View File

@ -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()

View File

@ -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),
]