Skip to content

Commit b6978af

Browse files
committed
chore: fix emulator build error and track the new code base
1 parent 42f75c5 commit b6978af

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

hwilib/devices/onekey.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def __init__(
230230

231231
ONEKEY_LEGACY = TrezorModel(
232232
name="1",
233-
internal_name="T1B1",
233+
internal_name="onekey_1",
234234
minimum_version=(2, 11, 0),
235235
vendors=VENDORS,
236236
usb_ids=USB_IDS,
@@ -239,7 +239,7 @@ def __init__(
239239

240240
ONEKEY_TOUCH = TrezorModel(
241241
name="T",
242-
internal_name="T2T1",
242+
internal_name="onekey_t",
243243
minimum_version=(4, 2, 0),
244244
vendors=VENDORS,
245245
usb_ids=USB_IDS,
@@ -283,11 +283,12 @@ def __init__(
283283
self.client.ensure_model = MethodType(ensure_model, self.client)
284284

285285
def enumerate(
286-
password: Optional[str] = None, expert: bool = False, chain: Chain = Chain.MAIN
286+
password: Optional[str] = None, expert: bool = False, chain: Chain = Chain.MAIN, allow_emulators: bool = False
287287
) -> List[Dict[str, Any]]:
288288
results = []
289289
devs = webusb.WebUsbTransport.enumerate(usb_ids=USB_IDS)
290-
devs.extend(udp.UdpTransport.enumerate(path=ONEKEY_EMULATOR_PATH))
290+
if allow_emulators:
291+
devs.extend(udp.UdpTransport.enumerate(path=ONEKEY_EMULATOR_PATH))
291292
for dev in devs:
292293
d_data: Dict[str, Any] = {}
293294

test/setup_environment.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ if [[ -n ${build_onekey_1} || -n ${build_onekey_t} ]]; then
152152
git checkout bixin_dev
153153
git checkout .
154154
git pull origin bixin_dev
155+
poetry lock --no-update
155156
poetry install
156157
poetry run pip install protobuf==3.20.0
157158
export EMULATOR=1 DEBUG_LINK=1 TREZOR_TRANSPORT_V1=1
@@ -172,6 +173,7 @@ if [[ -n ${build_onekey_1} || -n ${build_onekey_t} ]]; then
172173
git checkout .
173174
git pull origin touch
174175
git submodule update --init --recursive vendor/lvgl_mp
176+
poetry lock --no-update
175177
poetry install
176178
cd core
177179
poetry run make build_unix

test/test_onekey.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def setUp(self):
203203
self.dev_args = ['-t', 'onekey', '-d', "udp:127.0.0.1:54935"]
204204

205205
def test_label(self):
206-
result = self.do_command(self.dev_args + ['enumerate'])
206+
result = self.do_command(self.dev_args + ["--emulators", "enumerate"])
207207
for dev in result:
208208
if dev['type'] == 'onekey' and dev['path'] == "udp:127.0.0.1:54935":
209209
self.assertEqual(dev['label'], 'test')

0 commit comments

Comments
 (0)