Skip to content

Commit

Permalink
chore: fix emulator build error and track the new code base
Browse files Browse the repository at this point in the history
  • Loading branch information
somebodyLi committed Dec 5, 2024
1 parent 42f75c5 commit b6978af
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
9 changes: 5 additions & 4 deletions hwilib/devices/onekey.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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] = {}

Expand Down
2 changes: 2 additions & 0 deletions test/setup_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/test_onekey.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit b6978af

Please sign in to comment.