diff --git a/proto9x/flash.py b/proto9x/flash.py index 7c79a2c..d0d1483 100644 --- a/proto9x/flash.py +++ b/proto9x/flash.py @@ -88,6 +88,9 @@ def get_fw_info(partition): return FirmwareInfo(major, minor, buildtime, modules) +def write_enable(): + assert_status(tls.cmd(db_write_enable)) + def flush_changes(): assert_status(tls.cmd(b'\x1a')) diff --git a/proto9x/sensor.py b/proto9x/sensor.py index 4754ddb..a7b91b8 100644 --- a/proto9x/sensor.py +++ b/proto9x/sensor.py @@ -2,6 +2,7 @@ from .tls import tls from .usb import usb from .db import db, subtype_to_string +from .flash import write_enable, flush_changes from time import sleep from struct import pack, unpack from binascii import hexlify, unhexlify @@ -9,7 +10,6 @@ from .util import assert_status, unhex from .hw_tables import dev_info_lookup from .blobs import identify_prg, enroll_prg, reset_blob - def glow_start_scan(): cmd=unhexlify('3920bf0200ffff0000019900200000000099990000000000000000000000000020000000000000000000000000ffff000000990020000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000') assert_status(tls.app(cmd)) @@ -96,13 +96,19 @@ def append_new_image(key=0, prev=b''): usb.wait_int() + + write_enable() rsp=tls.app(b'\x6b' + prev) assert_status(rsp) + flush_changes() usb.wait_int() + write_enable() rsp=tls.app(b'\x6b' + prev) assert_status(rsp) + flush_changes() + res=rsp[2:] rsp=tls.app(unhexlify('6900000000'))