diff --git a/files/1.bin b/files/1.bin deleted file mode 120000 index 0e6300f..0000000 --- a/files/1.bin +++ /dev/null @@ -1 +0,0 @@ -esp8266-ota-flash-convert_upg.bin \ No newline at end of file diff --git a/files/esp8266-ota-flash-convert.ino-0x81000.bin b/files/esp8266-ota-flash-convert.ino-0x81000.bin deleted file mode 100644 index 7778254..0000000 Binary files a/files/esp8266-ota-flash-convert.ino-0x81000.bin and /dev/null differ diff --git a/files/esp8266-ota-flash-convert_upg.bin b/files/esp8266-ota-flash-convert_upg.bin deleted file mode 100644 index 8da4bc0..0000000 Binary files a/files/esp8266-ota-flash-convert_upg.bin and /dev/null differ diff --git a/files/upgrade.bin b/files/upgrade.bin new file mode 100644 index 0000000..fcf1807 Binary files /dev/null and b/files/upgrade.bin differ diff --git a/files/user2.bin b/files/user2.bin deleted file mode 120000 index f3430f3..0000000 --- a/files/user2.bin +++ /dev/null @@ -1 +0,0 @@ -esp8266-ota-flash-convert.ino-0x81000.bin \ No newline at end of file diff --git a/files/user2.bin b/files/user2.bin new file mode 100644 index 0000000..bd66093 Binary files /dev/null and b/files/user2.bin differ diff --git a/scripts/backup.py b/scripts/backup.py deleted file mode 100755 index fc3bf23..0000000 --- a/scripts/backup.py +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/python3 -# encoding: utf-8 -""" -backup.py - -Created by nano on 2019-01-10. -Copyright (c) 2019 VTRUST GmbH. All rights reserved. -""" - -import sys -import os -import http.client -from binascii import unhexlify -import datetime - -DEVICE_IP = "10.42.42.42" - - -def main(): - print("Create backup of entire FLASH from %s" % DEVICE_IP ) - data = b"" - conn = http.client.HTTPConnection(DEVICE_IP) - conn.request("GET","/flashsize") - flashsize = int(conn.getresponse().read()) - print("Connected... Flashsize=",flashsize) - for address in range(0,flashsize,1024): - conn.request("GET", "/get?read=%X" % address ) - r1 = conn.getresponse() -# print(r1.status, r1.reason) - block = r1.read().split(b'\n') - print(block[0]) - data += block[1] - conn.close() - bindata = unhexlify(data) - f= open(datetime.datetime.now().strftime("../%Y-%m-%d_%H-%M-%S_readout.bin"),"wb") - f.write(bindata) - f.close - pass - - -if __name__ == '__main__': - main() - - diff --git a/scripts/fake-registration-server.py b/scripts/fake-registration-server.py index 919dbe0..f9eae0f 100755 --- a/scripts/fake-registration-server.py +++ b/scripts/fake-registration-server.py @@ -60,10 +60,7 @@ class JSONHandler(tornado.web.RequestHandler): b'{' b'"schema":"[{' b'\\"mode\\":\\"rw\\",' - b'\\"property\\":{\\"type\\":\\"bool\\"},\\"id\\":1,\\"type\\":\\"obj\\"},' - b'{\\"mode\\":\\"rw\\",' - b'\\"property\\":{\\"min\\":0,\\"max\\":86400,\\"scale\\":0,\\"step\\":1,\\"type\\":\\"value\\"},' - b'\\"id\\":9,\\"type\\":\\"obj\\"' + b'\\"property\\":{\\"type\\":\\"bool\\"},\\"id\\":1,\\"type\\":\\"obj\\"' b'}]",' b'"uid":"00000000000000000000","devEtag":"0000000000","secKey":"0000000000000000","schemaId":"0000000000","localKey":"0000000000000000"' b'},' @@ -81,9 +78,9 @@ class JSONHandler(tornado.web.RequestHandler): print("Answer s.gw.upgrade") #Fixme #Calculate MD5 and Filesize - file_md5 = hashlib.md5(file_as_bytes(open('../files/1.bin', 'rb'))).hexdigest() - file_len = os.path.getsize('../files/1.bin') - answer = b'{"result":{"auto":3,"fileSize":"%d","etag":"0000000000","version":"9.0.0","url":"http://10.42.42.1/files/1.bin","md5":"%s"},"t":100,"e":false,"success":true}' % (file_len,file_md5.encode('utf-8')) + file_md5 = hashlib.md5(file_as_bytes(open('../files/upgrade.bin', 'rb'))).hexdigest() + file_len = os.path.getsize('../files/upgrade.bin') + answer = b'{"result":{"auto":3,"fileSize":"%d","etag":"0000000000","version":"9.0.0","url":"http://10.42.42.1/files/upgrade.bin","md5":"%s"},"t":100,"e":false,"success":true}' % (file_len,file_md5.encode('utf-8')) print(answer) self.set_header("Content-Type", "application/json;charset=UTF-8") self.set_header('Content-Length', str(len(answer))) diff --git a/start_flash.sh b/start_flash.sh index 065eeaf..3351843 100755 --- a/start_flash.sh +++ b/start_flash.sh @@ -59,6 +59,9 @@ echo "======================================================" echo "Starting pairing procedure in screen" sudo ip route add 255.255.255.255 dev $WLAN $screen_with_log smarthack-smartconfig.log -S smarthack-smartconfig -m -d ./smartconfig/smartconfig.js + +popd + echo "Waiting for the upgraded device to appear" echo "If this does not work have a look at the '*.log'-files in the 'scripts' subfolder!" @@ -72,9 +75,7 @@ echo echo "IoT-device is online with ip 10.42.42.42" echo "Fetching firmware backup" sleep 2 -./backup.py - -popd +curl -JO http://10.42.42.42/backup echo "======================================================" echo "Getting Info from IoT-device"