mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-01 04:12:37 +00:00
fixup! feat(core): trezorctl working via BLE
This commit is contained in:
parent
01c3fe399b
commit
47ef418835
@ -1,23 +1,22 @@
|
|||||||
from trezorio import ble
|
from trezorio import ble
|
||||||
|
|
||||||
|
|
||||||
class BleInterface:
|
class BleInterfaceInternal:
|
||||||
def __init__(self, interface: int):
|
|
||||||
self.interface = interface
|
|
||||||
pass
|
|
||||||
|
|
||||||
def iface_num(self) -> int:
|
def iface_num(self) -> int:
|
||||||
return self.interface
|
return 16
|
||||||
|
|
||||||
|
def write(self, msg: bytes) -> int:
|
||||||
|
return ble.write_int(self, msg)
|
||||||
|
|
||||||
|
|
||||||
|
class BleInterfaceExternal:
|
||||||
|
def iface_num(self) -> int:
|
||||||
|
return 17
|
||||||
|
|
||||||
def write(self, msg: bytes) -> int:
|
def write(self, msg: bytes) -> int:
|
||||||
if self.interface == 16:
|
|
||||||
return ble.write_int(self, msg)
|
return ble.write_int(self, msg)
|
||||||
if self.interface == 17:
|
|
||||||
return ble.write_ext(self, msg)
|
|
||||||
return 0
|
|
||||||
|
|
||||||
|
|
||||||
# interface used for trezor wire protocol
|
# interface used for trezor wire protocol
|
||||||
|
iface_ble_int = BleInterfaceInternal()
|
||||||
iface_ble_int = BleInterface(16)
|
iface_ble_ext = BleInterfaceExternal()
|
||||||
iface_ble_ext = BleInterface(17)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user