forked from commaai/openpilot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Log android system shutdown to param (commaai#23520)
* Log android system shutdown to param * comment Co-authored-by: Comma Device <device@comma.ai>
- Loading branch information
1 parent
8c53adf
commit 610b99f
Showing
4 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters