-
Notifications
You must be signed in to change notification settings - Fork 20.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
account/usbwallet: make ledger x discoverable on macos14 #28516
account/usbwallet: make ledger x discoverable on macos14 #28516
Conversation
@karalabe appreciate if you can take a look |
@@ -93,30 +94,30 @@ func NewLedgerHub() (*Hub, error) { | |||
0x4011, /* HID + WebUSB Ledger Nano X */ | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: here the endpointID
was changed to 2
. Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, there is a usageID
of zero in the array here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those values matches what was enumerated on my device.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
Path
as 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.