From 9fa199675fe59cdba7e75c1c65387b842b78612e Mon Sep 17 00:00:00 2001 From: Ritchie Date: Wed, 26 Jun 2024 17:53:47 +0800 Subject: [PATCH] chore: fix emulator build error and track the new code base --- hwilib/devices/onekey.py | 5 +++-- test/setup_environment.sh | 2 ++ test/test_onekey.py | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hwilib/devices/onekey.py b/hwilib/devices/onekey.py index 87cbb65aa..9685eb24d 100644 --- a/hwilib/devices/onekey.py +++ b/hwilib/devices/onekey.py @@ -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 9f933a9d9..813916827 100755 --- a/test/setup_environment.sh +++ b/test/setup_environment.sh @@ -145,6 +145,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 @@ -165,6 +166,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')