Skip to content

Commit

Permalink
Merge pull request #127 from LedgerHQ/mru-dev-minor-updates
Browse files Browse the repository at this point in the history
shutdown socket before closing
  • Loading branch information
mruiz-ledger authored Apr 30, 2024
2 parents 7567198 + f958b35 commit 39f1b55
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ledgerblue/commTCP.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def get_data():
# When more data is available, the chip sends 0x61XX
# So 0x61xx as a SW must not be interpreted as an error
if (sw & 0xFF00) != 0x6100:
raise CommException("Invalid status %04x" % sw, sw)
raise CommException("Invalid status %04x" % sw, sw, data=response)
else:
while (sw & 0xFF00) == 0x6100:
send_apdu(bytes.fromhex("00c0000000")) # GET RESPONSE
Expand All @@ -72,13 +72,14 @@ def get_data():
return bytearray(response)

# In any other case return an exception
raise CommException("Invalid status %04x" % sw, sw)
raise CommException("Invalid status %04x" % sw, sw, data=response)

def apduMaxDataSize(self):
return 240

def close(self):
try:
self.socket.shutdown(socket.SHUT_RD)
self.socket.close()
self.socket = None
except:
Expand Down

0 comments on commit 39f1b55

Please sign in to comment.