Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix upload via python3 #21

Merged
merged 1 commit into from
Feb 19, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions keepkeyctl
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ class Commands(object):
raise Exception("Must provide firmware filename or URL")

if args.file:
fp = open(args.file, 'r')
fp = open(args.file, 'rb')
elif args.url:
print("Downloading from", args.url)
resp = urllib.urlretrieve(args.url)
Expand All @@ -316,8 +316,9 @@ class Commands(object):
fp_old.close()

fp.seek(0)
if fp.read(4) != 'KPKY':
raise Exception("KeepKey firmware header expected")
magic = fp.read(4).decode("utf-8")
if magic != 'KPKY':
raise Exception("KeepKey firmware header expected. magic={}".format(magic))

print("Please confirm action on device...")

Expand Down