account/usbwallet: make ledger x discoverable on macos14#28516
account/usbwallet: make ledger x discoverable on macos14#28516felipe-op wants to merge 4 commits intoethereum:masterfrom felipe-op:felipe/ledger-x-on-macos14-usage-0
Conversation
|
@karalabe appreciate if you can take a look |
| 0x5011, /* HID + WebUSB Ledger Nano S Plus */ | ||
| 0x6011, /* HID + WebUSB Ledger Nano FTS */ | ||
| }, 0xffa0, 0, newLedgerDriver) | ||
| }, []uint16{0xffa0, 0}, 2, newLedgerDriver) |
There was a problem hiding this comment.
Question: here the endpointID was changed to 2. Why?
There was a problem hiding this comment.
Also, there is a usageID of zero in the array here?
There was a problem hiding this comment.
Those values matches what was enumerated on my device.
There was a problem hiding this comment.
On macos13 I don't see any difference after removing the usageID of zero and setting endpointID to 0.
|
Just ran into the same issue today so would love to see this resolved :) |
|
I can confirm that master is not working on macos 13 with a ledger x. Going to update to 14 and check again. |
lightclient
left a comment
There was a problem hiding this comment.
I confirm it is working on macos14 with ledger nano also. I lean towards removing the additional usageID of zero and setting endpointID back to 0, but it seems to work either way.
@lightclient but is there anything left of the PR at this point? Are you saying it's moot? EDIT: I guess this change still remains: |
|
I ran the diff --git a/accounts/usbwallet/hub.go b/accounts/usbwallet/hub.go
index e67942dbc1..53a0463967 100644
--- a/accounts/usbwallet/hub.go
+++ b/accounts/usbwallet/hub.go
@@ -23,6 +23,7 @@ import (
"sync/atomic"
"time"
+ "fmt"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/log"
@@ -183,6 +184,11 @@ func (hub *Hub) refreshWallets() {
}
hub.enumFails.Store(0)
+ fmt.Printf("enumerated:\n")
+ for i, info := range infos {
+ fmt.Printf("%d. %#v\n", i, info)
+ }
+ fmt.Printf("-----\n")
for _, info := range infos {
for _, id := range hub.productIDs {
// Windows and Macos use UsageID matching, Linux uses Interface matching
On linux, On linux, And linux, So from what I can tell, changing the discovery to require non-empty path should not affect |
|
On my machine, it selected this one: Which seems to work. I don't know if or why this one is any better than the other two. |
It appears it will affect macos though. Running your patch with a nano x, I get
I must have confused this by removing each individually and not together. As you can see, if you send the But the issue is that the official ledger library does it like we already have on master. So I wonder if there is another issue somewhere farther up the usb stack. |
|
Also foundry imports coins_ledger which matches using |
|
According to @lightclient , this PR karalabe/usb#43 which contains an updated hid-library, also fixes the problems on macosx14. Once we that working on windows, we'll merge that + update the usb library, and we don't need this PR. Closing. |
Hi,
I tried using this code to interface with a Ledger X device and I bumped into this error:
This started happened in my Mac M2 with macos 14 (sonoma). Debugging it I noticed the usb.DeviceInfo path got an empty string, which then failed when Open is called.
Debugging it I found it actually enumerate 3 interfaces, but go-ethereum usbwallet hub arbitrarily picks one based on the
usageID. So I decided to change to pick the other two. It eventually worked.To match additional usageIDs, I converted the field into a slice and ignored matches with empty
Pathas seems like they can't be opened anyways.Here are the three enumerated devices printed with a simple
fmt.Printf("enumerate: %#v", infos)Test
Tested only on macos 14 with a Ledger X.
Would be interesting if someone can validate this is not breaking other OS and devices before merging. i.e. not sure how Linux and Windows would handle the empty usb.DeviceInfo Path.