mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
Update hub.go
This commit is contained in:
parent
c2b80fb781
commit
787c02cd50
1 changed files with 9 additions and 6 deletions
|
|
@ -185,12 +185,8 @@ func (hub *Hub) refreshWallets() {
|
||||||
hub.enumFails.Store(0)
|
hub.enumFails.Store(0)
|
||||||
|
|
||||||
for _, info := range infos {
|
for _, info := range infos {
|
||||||
for _, id := range hub.productIDs {
|
if hub.matchDevice(info) {
|
||||||
// Windows and Macos use UsageID matching, Linux uses Interface matching
|
|
||||||
if info.ProductID == id && info.Path != "" && (slices.Contains(hub.usageIDs, info.UsagePage) || info.Interface == hub.endpointID) {
|
|
||||||
devices = append(devices, info)
|
devices = append(devices, info)
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if runtime.GOOS == "linux" {
|
if runtime.GOOS == "linux" {
|
||||||
|
|
@ -249,6 +245,13 @@ func (hub *Hub) refreshWallets() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (hub *Hub) matchDevice(info usb.DeviceInfo) bool {
|
||||||
|
// Windows and Macos use UsageID matching, Linux uses Interface matching
|
||||||
|
return slices.Contains(hub.productIDs, info.ProductID) &&
|
||||||
|
info.Path != "" &&
|
||||||
|
(slices.Contains(hub.usageIDs, info.UsagePage) || info.Interface == hub.endpointID)
|
||||||
|
}
|
||||||
|
|
||||||
// Subscribe implements accounts.Backend, creating an async subscription to
|
// Subscribe implements accounts.Backend, creating an async subscription to
|
||||||
// receive notifications on the addition or removal of USB wallets.
|
// receive notifications on the addition or removal of USB wallets.
|
||||||
func (hub *Hub) Subscribe(sink chan<- accounts.WalletEvent) event.Subscription {
|
func (hub *Hub) Subscribe(sink chan<- accounts.WalletEvent) event.Subscription {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue