mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-14 03:30:02 +00:00
revert usb reset related commits
As it stands, they cause more harm than good for a point release. This code will be returned later, when it is more mature
This commit is contained in:
parent
0a8b5a08c2
commit
697f86210f
@ -22,7 +22,6 @@ _At the moment, the project does __not__ adhere to [Semantic Versioning](http://
|
||||
- Cardano: change `network` to `protocol_magic`
|
||||
- tests can run interactively when `INTERACT=1` environment variable is set
|
||||
- protobuf: improved `to_dict` function
|
||||
- webusb: issue device reset before connecting (fixes weird device states)
|
||||
|
||||
### Deprecated
|
||||
- trezorctl: interactive signing with `sign-tx` is considered deprecated
|
||||
|
@ -374,8 +374,7 @@ def wipe_device(connect, bootloader):
|
||||
click.echo("Wiping user data!")
|
||||
|
||||
try:
|
||||
device.wipe(client)
|
||||
click.echo("Device wiped")
|
||||
return device.wipe(connect())
|
||||
except tools.CallException as e:
|
||||
click.echo("Action failed: {} {}".format(*e.args))
|
||||
sys.exit(3)
|
||||
|
@ -45,7 +45,6 @@ class TrezorDevice:
|
||||
|
||||
|
||||
@expect(proto.Success, field="message")
|
||||
@session
|
||||
def apply_settings(
|
||||
client,
|
||||
label=None,
|
||||
@ -75,7 +74,6 @@ def apply_settings(
|
||||
|
||||
|
||||
@expect(proto.Success, field="message")
|
||||
@session
|
||||
def apply_flags(client, flags):
|
||||
out = client.call(proto.ApplyFlags(flags=flags))
|
||||
client.init_device() # Reload Features
|
||||
@ -83,7 +81,6 @@ def apply_flags(client, flags):
|
||||
|
||||
|
||||
@expect(proto.Success, field="message")
|
||||
@session
|
||||
def change_pin(client, remove=False):
|
||||
ret = client.call(proto.ChangePin(remove=remove))
|
||||
client.init_device() # Re-read features
|
||||
@ -96,26 +93,14 @@ def set_u2f_counter(client, u2f_counter):
|
||||
return ret
|
||||
|
||||
|
||||
def wipe(client) -> bool:
|
||||
"""Initiate device wipe.
|
||||
|
||||
Returns whether it's safe to continue using the client instance.
|
||||
(see comment in `WebUsbHandle.open`)
|
||||
"""
|
||||
# This is not marked @session by design: the subsequent init_device should run
|
||||
# in a separate session, so that when it triggers a USB error, a subsequent
|
||||
# re-enumeration fixes it. See comment in WebUsbHandle.open
|
||||
# XXX this should actually call the USB reset explicitly
|
||||
client.call(proto.WipeDevice())
|
||||
try:
|
||||
client.init_device()
|
||||
return True
|
||||
except Exception:
|
||||
return False
|
||||
@expect(proto.Success, field="message")
|
||||
def wipe(client):
|
||||
ret = client.call(proto.WipeDevice())
|
||||
client.init_device()
|
||||
return ret
|
||||
|
||||
|
||||
@expect(proto.Success, field="message")
|
||||
@session
|
||||
def recover(
|
||||
client,
|
||||
word_count=24,
|
||||
|
@ -53,16 +53,6 @@ class WebUsbHandle:
|
||||
else:
|
||||
args = ()
|
||||
raise IOError("Cannot open device", *args)
|
||||
|
||||
self.handle.resetDevice()
|
||||
# XXX this may fail with LIBUSB_ERROR_NOT_FOUND
|
||||
# This will usually happen after device wipe, because USB serial has changed,
|
||||
# and requires re-enumeration and reacquiring of the device.
|
||||
# I haven't found a reasonable way of handling it here, or in the enumeration
|
||||
# step. (In particular, it seems impossible to force libusb to re-enumerate
|
||||
# explicitly, without calling device reset.)
|
||||
# So now I'm just leaving it here to crash in some cases.
|
||||
|
||||
self.handle.claimInterface(self.interface)
|
||||
|
||||
def close(self) -> None:
|
||||
|
Loading…
Reference in New Issue
Block a user