Files
dragonpilot/python/update.py
Vehicle Researcher 2a0f066426 Squashed 'panda/' changes from 39c1e39e..06958e42
06958e42 Fix pedal bootstub build
f5817e6b Fix Pedal bootstub version
c00fe867 CircleCI needs to check bootstub doesn't break too
9b5b696e Subaru: remove GM leftover
20c76ad5 Power Saving (#169)
c6eeaad6 Subaru: added last engage/disengage regression test
37d46e0c Subaru: added subaru safety tests
5686dae2 Subaru updated driver factor
a6193a82 Dcp remove (#168)
e437b9b4 Subaru: fixed bug and added safety tests
176f1325 Subaru: added proper safety model
0b10bb70 Subaru safety: move camera to bus 2
bce279a6 Pedal: only one firmware (#164)
4f73cb48 Toyota pedal: checking for no pedal being commanded when openpilot is off
0b2327e5 Merge pull request #160 from commaai/capture_make_failure
7b504d2f panda safety test that replays drives of saved CAN messages (#151)
d7d08892 Capture make failure so it can be logged to sentry

git-subtree-dir: panda
git-subtree-split: 06958e424cad7efa3fb35d262480c29817733059
2019-03-26 01:03:49 -07:00

47 lines
1.0 KiB
Python
Executable File

#!/usr/bin/env python
import os
import time
def ensure_st_up_to_date():
from panda import Panda, PandaDFU, BASEDIR
with open(os.path.join(BASEDIR, "VERSION")) as f:
repo_version = f.read()
repo_version += "-EON" if os.path.isfile('/EON') else "-DEV"
panda = None
panda_dfu = None
should_flash_recover = False
while 1:
# break on normal mode Panda
panda_list = Panda.list()
if len(panda_list) > 0:
panda = Panda(panda_list[0])
break
# flash on DFU mode Panda
panda_dfu = PandaDFU.list()
if len(panda_dfu) > 0:
panda_dfu = PandaDFU(panda_dfu[0])
panda_dfu.recover()
print "waiting for board..."
time.sleep(1)
if panda.bootstub or not panda.get_version().startswith(repo_version):
panda.flash()
if panda.bootstub:
panda.recover()
assert(not panda.bootstub)
version = str(panda.get_version())
print("%s should be %s" % (version, repo_version))
assert(version.startswith(repo_version))
if __name__ == "__main__":
ensure_st_up_to_date()