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
parent
7ea602dafe
commit
2f87bde2ff
4 changed files with 31 additions and 1 deletions
@ -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() |
Loading…
Reference in new issue