mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-08-24 01:33:50 +08:00
openpilot v0.8.8 release
This commit is contained in:
Executable
+78
@@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import time
|
||||
import psutil
|
||||
from typing import Optional
|
||||
|
||||
from common.realtime import set_core_affinity, set_realtime_priority
|
||||
from selfdrive.swaglog import cloudlog
|
||||
|
||||
|
||||
MAX_MODEM_CRASHES = 3
|
||||
MODEM_PATH = "/sys/devices/soc/2080000.qcom,mss/subsys5"
|
||||
WATCHED_PROCS = ["zygote", "zygote64", "/system/bin/servicemanager", "/system/bin/surfaceflinger"]
|
||||
|
||||
|
||||
def get_modem_crash_count() -> Optional[int]:
|
||||
try:
|
||||
with open(os.path.join(MODEM_PATH, "crash_count")) as f:
|
||||
return int(f.read())
|
||||
except Exception:
|
||||
cloudlog.exception("Error reading modem crash count")
|
||||
return None
|
||||
|
||||
def get_modem_state() -> str:
|
||||
try:
|
||||
with open(os.path.join(MODEM_PATH, "state")) as f:
|
||||
return f.read().strip()
|
||||
except Exception:
|
||||
cloudlog.exception("Error reading modem state")
|
||||
return ""
|
||||
|
||||
def main():
|
||||
set_core_affinity(1)
|
||||
set_realtime_priority(1)
|
||||
|
||||
procs = {}
|
||||
crash_count = 0
|
||||
modem_killed = False
|
||||
modem_state = "ONLINE"
|
||||
while True:
|
||||
# check critical android services
|
||||
if any(p is None or not p.is_running() for p in procs.values()) or not len(procs):
|
||||
cur = {p: None for p in WATCHED_PROCS}
|
||||
for p in psutil.process_iter(attrs=['cmdline']):
|
||||
cmdline = None if not len(p.info['cmdline']) else p.info['cmdline'][0]
|
||||
if cmdline in WATCHED_PROCS:
|
||||
cur[cmdline] = p
|
||||
|
||||
if len(procs):
|
||||
for p in WATCHED_PROCS:
|
||||
if cur[p] != procs[p]:
|
||||
cloudlog.event("android service pid changed", proc=p, cur=cur[p], prev=procs[p])
|
||||
procs.update(cur)
|
||||
|
||||
# check modem state
|
||||
state = get_modem_state()
|
||||
if state != modem_state and not modem_killed:
|
||||
cloudlog.event("modem state changed", state=state)
|
||||
modem_state = state
|
||||
|
||||
# check modem crashes
|
||||
cnt = get_modem_crash_count()
|
||||
if cnt is not None:
|
||||
if cnt > crash_count:
|
||||
cloudlog.event("modem crash", count=cnt)
|
||||
crash_count = cnt
|
||||
|
||||
# handle excessive modem crashes
|
||||
if crash_count > MAX_MODEM_CRASHES and not modem_killed:
|
||||
cloudlog.event("killing modem")
|
||||
with open("/sys/kernel/debug/msm_subsys/modem", "w") as f:
|
||||
f.write("put")
|
||||
modem_killed = True
|
||||
|
||||
time.sleep(1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "selfdrive/hardware/base.h"
|
||||
#include "selfdrive/common/util.h"
|
||||
|
||||
#ifdef QCOM
|
||||
#include "selfdrive/hardware/eon/hardware.h"
|
||||
@@ -16,3 +17,19 @@ public:
|
||||
};
|
||||
#define Hardware HardwarePC
|
||||
#endif
|
||||
|
||||
namespace Path {
|
||||
inline static std::string HOME = util::getenv("HOME");
|
||||
inline std::string log_root() {
|
||||
if (const char *env = getenv("LOG_ROOT")) {
|
||||
return env;
|
||||
}
|
||||
return Hardware::PC() ? HOME + "/.comma/media/0/realdata" : "/data/media/0/realdata";
|
||||
}
|
||||
inline std::string params() {
|
||||
return Hardware::PC() ? HOME + "/.comma/params" : "/data/params";
|
||||
}
|
||||
inline std::string rsa_file() {
|
||||
return Hardware::PC() ? HOME + "/.comma/persist/comma/id_rsa" : "/persist/comma/id_rsa";
|
||||
}
|
||||
} // namespace Path
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
[
|
||||
{
|
||||
"name": "boot",
|
||||
"url": "https://commadist.azureedge.net/agnosupdate/boot-54fc7edceeabff713b51dd4d4931eb920344aa3f8f8e0f153baad1fb5a15ef19.img.xz",
|
||||
"hash": "54fc7edceeabff713b51dd4d4931eb920344aa3f8f8e0f153baad1fb5a15ef19",
|
||||
"hash_raw": "54fc7edceeabff713b51dd4d4931eb920344aa3f8f8e0f153baad1fb5a15ef19",
|
||||
"size": 14772224,
|
||||
"url": "https://commadist.azureedge.net/agnosupdate/boot-6a5ac08b5c458e24e810dd950185ee69b7c5f3556f9f43b323f1dba4e14f8d44.img.xz",
|
||||
"hash": "6a5ac08b5c458e24e810dd950185ee69b7c5f3556f9f43b323f1dba4e14f8d44",
|
||||
"hash_raw": "6a5ac08b5c458e24e810dd950185ee69b7c5f3556f9f43b323f1dba4e14f8d44",
|
||||
"size": 14776320,
|
||||
"sparse": false,
|
||||
"full_check": true,
|
||||
"has_ab": true
|
||||
@@ -41,9 +41,9 @@
|
||||
},
|
||||
{
|
||||
"name": "system",
|
||||
"url": "https://commadist.azureedge.net/agnosupdate/system-5208f2d72b6d99bbee7dc038b3c95eccabc0bcabc5c718419e06bc7f897a675a.img.xz",
|
||||
"hash": "68a3d0bb892c7b8347ce8b6d5a733a3f15d622af11febaeb3d6595308f15e738",
|
||||
"hash_raw": "5208f2d72b6d99bbee7dc038b3c95eccabc0bcabc5c718419e06bc7f897a675a",
|
||||
"url": "https://commadist.azureedge.net/agnosupdate/system-9056640f926b2612be503a9fec621091ae8a86ec3b2eeb15503db39490a6d2f4.img.xz",
|
||||
"hash": "94445bb5db56bb2d462fa3831d3501cb8ffedafed9bf2e57128ffd71f454a4bd",
|
||||
"hash_raw": "9056640f926b2612be503a9fec621091ae8a86ec3b2eeb15503db39490a6d2f4",
|
||||
"size": 10737418240,
|
||||
"sparse": true,
|
||||
"full_check": false,
|
||||
|
||||
@@ -266,6 +266,8 @@ class Tici(HardwareBase):
|
||||
def set_power_save(self, powersave_enabled):
|
||||
# amplifier, 100mW at idle
|
||||
self.amplifier.set_global_shutdown(amp_disabled=powersave_enabled)
|
||||
if not powersave_enabled:
|
||||
self.amplifier.initialize_configuration()
|
||||
|
||||
# offline big cluster, leave core 4 online for boardd
|
||||
for i in range(5, 8):
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user