From 8c4005ffdbfc6c7c461e01c4e431e186b1c1a9ef Mon Sep 17 00:00:00 2001 From: Firmware Batman Date: Sun, 30 Jul 2017 08:49:53 -0700 Subject: [PATCH] st wifi flash is failing --- board/provision.h | 2 +- panda/__init__.py | 12 ++++++++++++ tests/automated/3_wifi.py | 19 ++++++++++--------- ...i_connected.py => 4_wifi_functionality.py} | 8 ++------ tests/automated/helpers.py | 14 ++++++++++++++ 5 files changed, 39 insertions(+), 16 deletions(-) rename tests/automated/{4_wifi_connected.py => 4_wifi_functionality.py} (85%) diff --git a/board/provision.h b/board/provision.h index da2a0c1b..2fad5135 100644 --- a/board/provision.h +++ b/board/provision.h @@ -4,7 +4,7 @@ // WiFi password = 0x10 - 0x1C // SHA1 checksum = 0x1C - 0x20 -void get_provision_chunk(char *resp) { +void get_provision_chunk(uint8_t *resp) { memcpy(resp, (void *)0x1fff79e0, PROVISION_CHUNK_LEN); if (memcmp(resp, "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff", 0x20) == 0) { memcpy(resp, "unprovisioned\x00\x00\x00testing123\x00\x00\xa3\xa6\x99\xec", 0x20); diff --git a/panda/__init__.py b/panda/__init__.py index 780e70c1..0dbe706b 100644 --- a/panda/__init__.py +++ b/panda/__init__.py @@ -186,6 +186,18 @@ class Panda(object): print("flash: resetting") self.reset() + @staticmethod + def flash_ota_st(): + ret = os.system("cd %s && make clean && make ota" % (os.path.join(BASEDIR, "board"))) + time.sleep(1) + return ret==0 + + @staticmethod + def flash_ota_wifi(): + ret = os.system("cd %s && make clean && make ota" % (os.path.join(BASEDIR, "boardesp"))) + time.sleep(1) + return ret==0 + @staticmethod def recover(legacy=False): ret = os.system("cd %s && make clean && make -f %s recover" % (os.path.join(BASEDIR, "board"), "Makefile.legacy" if legacy else "Makefile")) diff --git a/tests/automated/3_wifi.py b/tests/automated/3_wifi.py index 1be1f475..ea11544c 100644 --- a/tests/automated/3_wifi.py +++ b/tests/automated/3_wifi.py @@ -1,6 +1,8 @@ from __future__ import print_function import os from panda import Panda +from helpers import connect_wifi +import requests def test_get_serial(): p = Panda() @@ -14,16 +16,15 @@ def test_get_serial_in_flash_mode(): p.reset() def test_connect_wifi(): - p = Panda() - ssid, pw = p.get_serial() - ssid = ssid.strip("\x00") - assert(ssid.isalnum()) - assert(pw.isalnum()) - ssid = "panda-" + ssid + connect_wifi() - # Mac OS X only - # TODO: Ubuntu - os.system("networksetup -setairportnetwork en0 %s %s" % (ssid, pw)) +def test_flash_wifi(): + Panda.flash_ota_wifi() + connect_wifi() +def test_webpage_fetch(): + r = requests.get("http://192.168.0.10/") + print(r.text) + assert "This is your comma.ai panda" in r.text diff --git a/tests/automated/4_wifi_connected.py b/tests/automated/4_wifi_functionality.py similarity index 85% rename from tests/automated/4_wifi_connected.py rename to tests/automated/4_wifi_functionality.py index fd2b779f..56f3a0c9 100644 --- a/tests/automated/4_wifi_connected.py +++ b/tests/automated/4_wifi_functionality.py @@ -1,15 +1,11 @@ from __future__ import print_function -import requests import time from panda import Panda from helpers import time_many_sends from nose.tools import timed, assert_equal, assert_less, assert_greater -def test_webpage_fetch(): - r = requests.get("http://192.168.0.10/") - print(r.text) - - assert "This is your comma.ai panda" in r.text +def test_wifi_flash_st(): + Panda.flash_ota_st() def test_get_serial_wifi(): p = Panda("WIFI") diff --git a/tests/automated/helpers.py b/tests/automated/helpers.py index 89f964af..b4bb3afd 100644 --- a/tests/automated/helpers.py +++ b/tests/automated/helpers.py @@ -1,6 +1,7 @@ from panda import Panda from nose.tools import timed, assert_equal, assert_less, assert_greater import time +import os def connect_wo_esp(): # connect to the panda @@ -14,6 +15,18 @@ def connect_wo_esp(): while len(p.can_recv()) > 0: pass +def connect_wifi(): + p = Panda() + ssid, pw = p.get_serial() + ssid = ssid.strip("\x00") + assert(ssid.isalnum()) + assert(pw.isalnum()) + ssid = "panda-" + ssid + + # Mac OS X only + # TODO: Ubuntu + os.system("networksetup -setairportnetwork en0 %s %s" % (ssid, pw)) + def time_many_sends(p, bus): MSG_COUNT = 100 @@ -34,3 +47,4 @@ def time_many_sends(p, bus): comp_kbps = (1+11+1+1+1+4+8*8+15+1+1+1+7)*MSG_COUNT / et return comp_kbps +