diff --git a/hwilib/devices/onekey.py b/hwilib/devices/onekey.py index 87cbb65aa..677cdd895 100644 --- a/hwilib/devices/onekey.py +++ b/hwilib/devices/onekey.py @@ -230,7 +230,7 @@ def __init__( ONEKEY_LEGACY = TrezorModel( name="1", - internal_name="T1B1", + internal_name="onekey_1", minimum_version=(2, 11, 0), vendors=VENDORS, usb_ids=USB_IDS, @@ -239,7 +239,7 @@ def __init__( ONEKEY_TOUCH = TrezorModel( name="T", - internal_name="T2T1", + internal_name="onekey_t", minimum_version=(4, 2, 0), vendors=VENDORS, usb_ids=USB_IDS, @@ -283,11 +283,12 @@ def __init__( self.client.ensure_model = MethodType(ensure_model, self.client) def enumerate( - password: Optional[str] = None, expert: bool = False, chain: Chain = Chain.MAIN + password: Optional[str] = None, expert: bool = False, chain: Chain = Chain.MAIN, allow_emulators: bool = False ) -> List[Dict[str, Any]]: results = [] devs = webusb.WebUsbTransport.enumerate(usb_ids=USB_IDS) - devs.extend(udp.UdpTransport.enumerate(path=ONEKEY_EMULATOR_PATH)) + if allow_emulators: + devs.extend(udp.UdpTransport.enumerate(path=ONEKEY_EMULATOR_PATH)) for dev in devs: d_data: Dict[str, Any] = {} diff --git a/test/setup_environment.sh b/test/setup_environment.sh index 529425ebe..7fd94481c 100755 --- a/test/setup_environment.sh +++ b/test/setup_environment.sh @@ -152,6 +152,7 @@ if [[ -n ${build_onekey_1} || -n ${build_onekey_t} ]]; then git checkout bixin_dev git checkout . git pull origin bixin_dev + poetry lock --no-update poetry install poetry run pip install protobuf==3.20.0 export EMULATOR=1 DEBUG_LINK=1 TREZOR_TRANSPORT_V1=1 @@ -172,6 +173,7 @@ if [[ -n ${build_onekey_1} || -n ${build_onekey_t} ]]; then git checkout . git pull origin touch git submodule update --init --recursive vendor/lvgl_mp + poetry lock --no-update poetry install cd core poetry run make build_unix diff --git a/test/test_onekey.py b/test/test_onekey.py index 608a9cd5b..fe2a86f88 100755 --- a/test/test_onekey.py +++ b/test/test_onekey.py @@ -203,7 +203,7 @@ def setUp(self): self.dev_args = ['-t', 'onekey', '-d', "udp:127.0.0.1:54935"] def test_label(self): - result = self.do_command(self.dev_args + ['enumerate']) + result = self.do_command(self.dev_args + ["--emulators", "enumerate"]) for dev in result: if dev['type'] == 'onekey' and dev['path'] == "udp:127.0.0.1:54935": self.assertEqual(dev['label'], 'test')