LedgerHQ / btchip-python

Ledger HW.1 Python API
http://www.ledger.co
Apache License 2.0
65 stars 51 forks source link

Can't open Ledger with the latest Bitcoin app selected #48

Closed stepansnigirev closed 3 years ago

stepansnigirev commented 3 years ago

Bitcoin app version: 1.5.1 OS: Ubuntu 20 hid detects Ledger, but open of the device fails. This breaks communication with Ledger for HWI and Specter.

>>> from btchip import btchipComm
>>> btchipComm.getDongle()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ss/dev/desktop/myspecter/.venv/lib/python3.8/site-packages/btchip/btchipComm.py", line 230, in getDongle
    dev.open_path(hidDevicePath)
  File "hid.pyx", line 72, in hid.device.open_path
OSError: open failed
TamtamHero commented 3 years ago

https://github.com/bitcoin-core/HWI/pull/403 should fix it You can also update btchip-python to its latest version, 0.1.31

stepansnigirev commented 3 years ago

No, we already integrated that.

Enumeration works, I get correct path, but hid device can not be opened:

>>> import hid
>>> hid.enumerate()
[{'path': b'0001:0019:00', 'vendor_id': 11415, 'product_id': 4117, 'serial_number': '', 'release_number': 513, 'manufacturer_string': '', 'product_string': '', 'usage_page': 0, 'usage': 0, 'interface_number': 0},
{'path': b'0001:0019:01', 'vendor_id': 11415, 'product_id': 4117, 'serial_number': '', 'release_number': 513, 'manufacturer_string': '', 'product_string': '', 'usage_page': 0, 'usage': 0, 'interface_number': 1},
...
]
>>> dev = hid.device()
>>> dev.open_path(b'0001:0019:00')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "hid.pyx", line 72, in hid.device.open_path
OSError: open failed
TamtamHero commented 3 years ago

This works just fine on my own Ubuntu 20.04 with python3/btchip 0.31.1/bitcoin 1.5.1/Firmware 1.6.1

>>> from btchip import btchipComm
>>> btchipComm.getDongle()

Try to use the other interface: dev.open_path(b'0001:0019:01') instead of dev.open_path(b'0001:0019:00')

Also, you might have to update your udev rules to something less restrictive than before. See here: https://support.ledger.com/hc/en-us/articles/115005165269-Fix-connection-issues

stepansnigirev commented 3 years ago

Thanks, updating udev rules did it.

ArttuPakarinen commented 1 year ago

I have both BTC and ETH apps in my ledger device.

The following code does not run on my ubuntu when i have BTC app open, but it runs when i have ETH app open:

import TransportWebHID from "@ledgerhq/hw-transport-webhid";

const transport = await TransportWebHID.create();

The same code will run in Windows environment.