Skip to content

Commit d6a8cde

Browse files
committed
Merge #505: bitbox02: handle multiple connected bitbox02s correctly
15d8eca bitbox02: handle multiple connected bitbox02s correctly (Marko Bencun) Pull request description: If there were more than one BitBox02 connected, enumerate would fail. This commit fixes a small mistake in the initialization, allowing HWI to handle multiple BitBox02s at once. ACKs for top commit: achow101: ACK 15d8eca Tree-SHA512: 10dd17f645714a027ccb8174053b097fff7340c35e321da052a83b073690594f41b50d7ddd3ab2c6088613041e488c1331022e0ad0ba56eb4bc89c151971fba7
2 parents cecf472 + 15d8eca commit d6a8cde

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

hwilib/devices/bitbox02.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -286,17 +286,19 @@ def init(self, expect_initialized: Optional[bool] = True) -> bitbox02.BitBox02:
286286
return self.bb02
287287

288288
for device_info in devices.get_any_bitbox02s():
289-
if device_info["path"].decode() == self.device_path:
290-
bb02 = bitbox02.BitBox02(
291-
transport=self.transport,
292-
device_info=device_info,
293-
noise_config=self.noise_config,
294-
)
295-
try:
296-
bb02.check_min_version()
297-
except FirmwareVersionOutdatedException as exc:
298-
sys.stderr.write("WARNING: {}\n".format(exc))
299-
raise
289+
if device_info["path"].decode() != self.device_path:
290+
continue
291+
292+
bb02 = bitbox02.BitBox02(
293+
transport=self.transport,
294+
device_info=device_info,
295+
noise_config=self.noise_config,
296+
)
297+
try:
298+
bb02.check_min_version()
299+
except FirmwareVersionOutdatedException as exc:
300+
sys.stderr.write("WARNING: {}\n".format(exc))
301+
raise
300302
self.bb02 = bb02
301303
is_initialized = bb02.device_info()["initialized"]
302304
if expect_initialized is not None:

0 commit comments

Comments
 (0)