Skip to content

Commit

Permalink
Merge #505: bitbox02: handle multiple connected bitbox02s correctly
Browse files Browse the repository at this point in the history
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
  • Loading branch information
achow101 committed Apr 9, 2021
2 parents cecf472 + 15d8eca commit d6a8cde
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions hwilib/devices/bitbox02.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,17 +286,19 @@ def init(self, expect_initialized: Optional[bool] = True) -> bitbox02.BitBox02:
return self.bb02

for device_info in devices.get_any_bitbox02s():
if device_info["path"].decode() == self.device_path:
bb02 = bitbox02.BitBox02(
transport=self.transport,
device_info=device_info,
noise_config=self.noise_config,
)
try:
bb02.check_min_version()
except FirmwareVersionOutdatedException as exc:
sys.stderr.write("WARNING: {}\n".format(exc))
raise
if device_info["path"].decode() != self.device_path:
continue

bb02 = bitbox02.BitBox02(
transport=self.transport,
device_info=device_info,
noise_config=self.noise_config,
)
try:
bb02.check_min_version()
except FirmwareVersionOutdatedException as exc:
sys.stderr.write("WARNING: {}\n".format(exc))
raise
self.bb02 = bb02
is_initialized = bb02.device_info()["initialized"]
if expect_initialized is not None:
Expand Down

1 comment on commit d6a8cde

@InfiniteQE
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm this commit works allowing 2 simultaneous BitBox02 to work with the latest commit of Sparrow

Thanks @achow101 @benma @craigraw

Please sign in to comment.