mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-07 22:52:06 +08:00
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:441c03e9bcb881ecc7933872d31d9dc7734a8673f3898fc8d8c49c6a15875b72
|
||||
size 15382430
|
||||
oid sha256:d6f5543949481e6c9dc225d33efb122957a8a85b2c16e6454f8c4f1b01d5d463
|
||||
size 15385239
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0795c5ce6068f7ab3fcf23dccbee8b9c76da86808eacf4814ea99be4057ee83f
|
||||
size 12
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ce98217d60516c28fd68135a87144be86c63bd8f5e87de64f945925b6cce46af
|
||||
size 1947345
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:57f794afccdc34ed52fc38628dbd20c1b9cae170b8c148cb49ab1e9dd1fe84f0
|
||||
size 3870675
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3e43d684937dfd3f907ac5bcc83a513a3030600bba042ef2396dce208847f551
|
||||
size 3521
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8358afec7442e90c4eeffc4db4b4b00793df0f51c909976b4e95e3c8f8dacdcd
|
||||
size 1310659
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ca197862754835da4f0bc30823845e3448334f8c5e2093a1947348d2fed753a2
|
||||
size 176
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b2e32152e7972032fd64ad351323f50008602c60feb19522b1aadd414bf1f7b4
|
||||
size 1001
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a07ce769d17334f803a499c520d4a7d88478ceb1a9cf740faf296f8f54616e82
|
||||
size 633
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5743dd91db33116bd7444d7407eb14b140ab2694f8525fc34c66d22256f50634
|
||||
size 542612
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:123549475cad6ae6ce2261f81caf8f094b3b3d31076e3c320fd08301eb45e657
|
||||
size 194
|
||||
+6
-6
@@ -8,12 +8,6 @@ function launch {
|
||||
exec "${BASH_SOURCE[0]}"
|
||||
fi
|
||||
|
||||
# check if NEOS update is required
|
||||
while [ "$(cat /VERSION)" -lt 4 ] && [ ! -e /data/media/0/noupdate ]; do
|
||||
curl -o /tmp/updater https://neos.comma.ai/updater && chmod +x /tmp/updater && /tmp/updater
|
||||
sleep 10
|
||||
done
|
||||
|
||||
# no cpu rationing for now
|
||||
echo 0-3 > /dev/cpuset/background/cpus
|
||||
echo 0-3 > /dev/cpuset/system-background/cpus
|
||||
@@ -26,6 +20,12 @@ function launch {
|
||||
until ping -W 1 -c 1 8.8.8.8; do sleep 1; done
|
||||
kill $spin_pid
|
||||
|
||||
# check if NEOS update is required
|
||||
while [ "$(cat /VERSION)" -lt 4 ] && [ ! -e /data/media/0/noupdate ]; do
|
||||
curl -o /tmp/updater https://neos.comma.ai/updater && chmod +x /tmp/updater && /tmp/updater
|
||||
sleep 10
|
||||
done
|
||||
|
||||
export PYTHONPATH="$PWD"
|
||||
|
||||
# start manager
|
||||
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# simple script to get a vehicle fingerprint.
|
||||
# keep this script running for few seconds: some messages are published every few seconds
|
||||
|
||||
# Instructions:
|
||||
# - connect to a Panda
|
||||
# - run selfdrive/boardd/boardd
|
||||
# - launching this script
|
||||
# - since some messages are published at low frequency, keep this script running for few seconds,
|
||||
# until all messages are received at least once
|
||||
|
||||
import zmq
|
||||
import selfdrive.messaging as messaging
|
||||
from selfdrive.services import service_list
|
||||
|
||||
context = zmq.Context()
|
||||
logcan = messaging.sub_sock(context, service_list['can'].port)
|
||||
msgs = {}
|
||||
while True:
|
||||
lc = messaging.recv_sock(logcan, True)
|
||||
for c in lc.can:
|
||||
if c.src == 0:
|
||||
msgs[c.address] = len(c.dat)
|
||||
|
||||
fingerprint = ', '.join("%d: %d" % v for v in sorted(msgs.items()))
|
||||
|
||||
print "number of messages:", len(msgs)
|
||||
print "fingerprint", fingerprint
|
||||
+41
-24
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python2.7
|
||||
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
@@ -40,6 +41,7 @@ if __name__ == "__main__":
|
||||
|
||||
os._exit(os.wait()[1])
|
||||
|
||||
import glob
|
||||
import shutil
|
||||
import hashlib
|
||||
import importlib
|
||||
@@ -54,6 +56,7 @@ os.environ['BASEDIR'] = BASEDIR
|
||||
import usb1
|
||||
import zmq
|
||||
from setproctitle import setproctitle
|
||||
from smbus2 import SMBus
|
||||
|
||||
from common.params import Params
|
||||
from common.realtime import sec_since_boot
|
||||
@@ -68,6 +71,8 @@ import selfdrive.crash as crash
|
||||
|
||||
from selfdrive.loggerd.config import ROOT
|
||||
|
||||
EON = os.path.exists("/EON")
|
||||
|
||||
# comment out anything you don't want to run
|
||||
managed_processes = {
|
||||
"uploader": "selfdrive.loggerd.uploader",
|
||||
@@ -272,10 +277,6 @@ def system(cmd):
|
||||
output=e.output[-1024:],
|
||||
returncode=e.returncode)
|
||||
|
||||
EON = os.path.exists("/EON")
|
||||
if EON:
|
||||
from smbus2 import SMBus
|
||||
|
||||
def setup_eon_fan():
|
||||
if not EON:
|
||||
return
|
||||
@@ -530,34 +531,50 @@ def install_apk(path):
|
||||
return ret == 0
|
||||
|
||||
def update_apks():
|
||||
# patch apks
|
||||
if os.getenv("PREPAREONLY"):
|
||||
# assume we have internet, download too
|
||||
patched = subprocess.call([os.path.join(BASEDIR, "apk/external/patcher.py")])
|
||||
else:
|
||||
patched = subprocess.call([os.path.join(BASEDIR, "apk/external/patcher.py"), "patch"])
|
||||
cloudlog.info("patcher: %r" % (patched,))
|
||||
|
||||
# install apks
|
||||
installed = get_installed_apks()
|
||||
for app in os.listdir(os.path.join(BASEDIR, "apk/")):
|
||||
if ".apk" in app:
|
||||
app = app.split(".apk")[0]
|
||||
if app not in installed:
|
||||
installed[app] = None
|
||||
|
||||
install_apks = (glob.glob(os.path.join(BASEDIR, "apk/*.apk"))
|
||||
+ glob.glob(os.path.join(BASEDIR, "apk/external/out/*.apk")))
|
||||
for apk in install_apks:
|
||||
app = os.path.basename(apk)[:-4]
|
||||
if app not in installed:
|
||||
installed[app] = None
|
||||
|
||||
cloudlog.info("installed apks %s" % (str(installed), ))
|
||||
|
||||
for app in installed.iterkeys():
|
||||
|
||||
apk_path = os.path.join(BASEDIR, "apk/"+app+".apk")
|
||||
if os.path.isfile(apk_path):
|
||||
h1 = hashlib.sha1(open(apk_path).read()).hexdigest()
|
||||
h2 = None
|
||||
if installed[app] is not None:
|
||||
h2 = hashlib.sha1(open(installed[app]).read()).hexdigest()
|
||||
cloudlog.info("comparing version of %s %s vs %s" % (app, h1, h2))
|
||||
if not os.path.exists(apk_path):
|
||||
apk_path = os.path.join(BASEDIR, "apk/external/out/"+app+".apk")
|
||||
if not os.path.exists(apk_path):
|
||||
continue
|
||||
|
||||
if h2 is None or h1 != h2:
|
||||
cloudlog.info("installing %s" % app)
|
||||
h1 = hashlib.sha1(open(apk_path).read()).hexdigest()
|
||||
h2 = None
|
||||
if installed[app] is not None:
|
||||
h2 = hashlib.sha1(open(installed[app]).read()).hexdigest()
|
||||
cloudlog.info("comparing version of %s %s vs %s" % (app, h1, h2))
|
||||
|
||||
if h2 is None or h1 != h2:
|
||||
cloudlog.info("installing %s" % app)
|
||||
|
||||
success = install_apk(apk_path)
|
||||
if not success:
|
||||
cloudlog.info("needing to uninstall %s" % app)
|
||||
system("pm uninstall %s" % app)
|
||||
success = install_apk(apk_path)
|
||||
if not success:
|
||||
cloudlog.info("needing to uninstall %s" % app)
|
||||
system("pm uninstall %s" % app)
|
||||
success = install_apk(apk_path)
|
||||
|
||||
assert success
|
||||
assert success
|
||||
|
||||
def manager_update():
|
||||
update_apks()
|
||||
@@ -577,7 +594,7 @@ def uninstall():
|
||||
with open('/cache/recovery/command', 'w') as f:
|
||||
f.write('--wipe_data\n')
|
||||
# IPowerManager.reboot(confirm=false, reason="recovery", wait=true)
|
||||
os.system("service call power 16 i32 0 s16 recovery i32 1")
|
||||
os.system("service call power 16 i32 0 s16 recovery i32 1")
|
||||
|
||||
def main():
|
||||
if os.getenv("NOLOG") is not None:
|
||||
|
||||
@@ -6,6 +6,9 @@ import os
|
||||
import time
|
||||
import subprocess
|
||||
|
||||
from common.basedir import BASEDIR
|
||||
from selfdrive.swaglog import cloudlog
|
||||
|
||||
def main(gctx=None):
|
||||
while True:
|
||||
# try network
|
||||
@@ -14,12 +17,16 @@ def main(gctx=None):
|
||||
time.sleep(60)
|
||||
continue
|
||||
|
||||
# try fetch
|
||||
r = subprocess.call(["nice", "-n", "19", "git", "fetch", "--depth=1"])
|
||||
cloudlog.info("git fetch: %r", r)
|
||||
if r:
|
||||
time.sleep(60)
|
||||
continue
|
||||
|
||||
# download apks
|
||||
r = subprocess.call(["nice", "-n", "19", os.path.join(BASEDIR, "apk/external/patcher.py"), "download"])
|
||||
cloudlog.info("patcher download: %r", r)
|
||||
|
||||
time.sleep(60*60*3)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user