Skip to content

Commit

Permalink
tools: fixed bug to select signed bin
Browse files Browse the repository at this point in the history
From platform.txt, the binary to be uploaded is hardcoded to *.bin file.
This is not the expected behaviour when Signed Update is used.
  • Loading branch information
thangktran committed Jul 23, 2019
1 parent a64ef54 commit 1311bf4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tools/espota.py
Expand Up @@ -81,6 +81,14 @@ def serve(remoteAddr, localAddr, remotePort, localPort, password, filename, comm
logging.error("Listen Failed")
return 1

# Check whether Signed Update is used.
if ( os.path.isfile(filename + '.signed') ):
filename = filename + '.signed'
file_check_msg = 'Detected Signed Update. %s will be uploaded instead.' % (filename)
sys.stderr.write(file_check_msg + '\n')
sys.stderr.flush()
logging.info(file_check_msg)

content_size = os.path.getsize(filename)
f = open(filename,'rb')
file_md5 = hashlib.md5(f.read()).hexdigest()
Expand Down

0 comments on commit 1311bf4

Please sign in to comment.