HWI icon indicating copy to clipboard operation
HWI copied to clipboard

Uninitialized bitbox2 causes enumerate to fail

Open instagibbs opened this issue 3 years ago • 4 comments

Trying to setup the device.

client = Bitbox02Client(path)
  File "/Users/.../HWI/hwi_env/lib/python3.9/site-packages/hwilib/devices/bitbox02.py", line 235, in __init__
    hid_device.open_path(path.encode())
  File "hid.pyx", line 74, in hid.device.open_path
OSError: open failed

instagibbs avatar Feb 01 '21 05:02 instagibbs

@benma can you take a look?

instagibbs avatar Feb 01 '21 05:02 instagibbs

@instagibbs "open failed" usually indicates that the device is already occupied with another app. Maybe you have another app running already, e.g. the BitBoxApp. another instance of hwi (or hwi-qt), Electrum, etc.?

I tested `hwi.py enumerate' and it seems to work as expected.

benma avatar Feb 01 '21 09:02 benma

Ah you're right. Unsure if that's the proper behavior(throwing an inscrutable error), so leaving this issue open for ideas.

instagibbs avatar Feb 02 '21 01:02 instagibbs

The error is raused by thie hidapi lib when attempting to open device. I guess we should wrap and re-raise the exception with a better message in the bitbox02 library.

benma avatar Feb 02 '21 12:02 benma