LedgerHQ / LedgerHQ/blue-loader-python
Flakiness connecting to Ledger on Mac OS due to multiple HID devices
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 125
- Forks
- 75
- PR merge metrics
- No merged PRs in 30d
Description
We have observed a lot of flakiness with connecting to the Ledger on Mac OS, specifically in this code from the ledgereth library which bottoms out here in ledgerblue.
We found that when the Ethereum app is opened on the Ledger device, another HID entry shows up on the Mac. It is identical to the original HID entry except that usage_page is 61904 instead of 65440. The order of hid.enumerate() is not deterministic, so sometimes you get the original, good device, and sometimes you get the second, bad device. Hence the flakiness.
I'm not knowledgeable about the HID spec but I was wondering if changing the or condition in this line to an and condition would be appropriate. It would fix our problem at least because it would enforce that the device has a usage page of 65440, which would exclude the second, bad device.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at ledgerblue/comm.py around line 357 and inspect how HID devices from hid.enumerate() are filtered, especially usage_page values 65440 and 61904. Reproduce the connection attempt on Mac OS with the Ethereum app open, then verify that the intended Ledger device is selected consistently and the flaky connection no longer occurs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100