mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-18 10:32:02 +00:00
transport/hid: reload serial when closing
because device.wipe() causes the device to change serial, which breaks the connection unnecessarily.
This commit is contained in:
parent
f3a13f50e0
commit
40eaa1fa36
@ -61,7 +61,9 @@ class HidHandle:
|
|||||||
if serial != self.serial:
|
if serial != self.serial:
|
||||||
self.handle.close()
|
self.handle.close()
|
||||||
self.handle = None
|
self.handle = None
|
||||||
raise TransportException("Unexpected device on path %s" % self.path)
|
raise TransportException(
|
||||||
|
"Unexpected device {} on path {}".format(serial, self.path.decode())
|
||||||
|
)
|
||||||
|
|
||||||
self.handle.set_nonblocking(True)
|
self.handle.set_nonblocking(True)
|
||||||
|
|
||||||
@ -70,6 +72,8 @@ class HidHandle:
|
|||||||
|
|
||||||
def close(self) -> None:
|
def close(self) -> None:
|
||||||
if self.handle is not None:
|
if self.handle is not None:
|
||||||
|
# reload serial, because device.wipe() can reset it
|
||||||
|
self.serial = self.handle.get_serial_number_string()
|
||||||
self.handle.close()
|
self.handle.close()
|
||||||
self.handle = None
|
self.handle = None
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user