mirror of
https://github.com/romanz/amodem.git
synced 2026-04-21 05:36:42 +08:00
ledger.py: fix EOF not always set
This commit is contained in:
@@ -121,12 +121,11 @@ class LedgerNanoS(interface.Device):
|
|||||||
else:
|
else:
|
||||||
p2 = '82' if identity.identity_dict['proto'] == 'ssh' else '02'
|
p2 = '82' if identity.identity_dict['proto'] == 'ssh' else '02'
|
||||||
|
|
||||||
if offset == 0:
|
if offset + chunk_size == len(blob) and self.ledger_app_supports_end_of_frame_byte:
|
||||||
p1 = "00"
|
# mark that we are at the end of the frame
|
||||||
elif offset + chunk_size == len(blob) and self.ledger_app_supports_end_of_frame_byte:
|
p1 = "80" if offset == 0 else "81"
|
||||||
p1 = "81" # end of frame byte only handled in 0.0.8+
|
|
||||||
else:
|
else:
|
||||||
p1 = "01"
|
p1 = "00" if offset == 0 else "01"
|
||||||
|
|
||||||
apdu = binascii.unhexlify('80' + ins + p1 + p2) + len(data).to_bytes(1, 'little') + data
|
apdu = binascii.unhexlify('80' + ins + p1 + p2) + len(data).to_bytes(1, 'little') + data
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user