Skip to content

Commit 21d619c

Browse files
holimanjorgemmsilva
authored andcommitted
accounts/usbwallet: update hid library (ethereum#29176)
1 parent f7661db commit 21d619c

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

accounts/usbwallet/hub.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
"github.com/ethereum/go-ethereum/accounts"
2727
"github.com/ethereum/go-ethereum/event"
2828
"github.com/ethereum/go-ethereum/log"
29-
"github.com/karalabe/usb"
29+
"github.com/karalabe/hid"
3030
)
3131

3232
// LedgerScheme is the protocol scheme prefixing account and wallet URLs.
@@ -109,7 +109,7 @@ func NewTrezorHubWithWebUSB() (*Hub, error) {
109109

110110
// newHub creates a new hardware wallet manager for generic USB devices.
111111
func newHub(scheme string, vendorID uint16, productIDs []uint16, usageID uint16, endpointID int, makeDriver func(log.Logger) driver) (*Hub, error) {
112-
if !usb.Supported() {
112+
if !hid.Supported() {
113113
return nil, errors.New("unsupported platform")
114114
}
115115
hub := &Hub{
@@ -155,7 +155,7 @@ func (hub *Hub) refreshWallets() {
155155
return
156156
}
157157
// Retrieve the current list of USB wallet devices
158-
var devices []usb.DeviceInfo
158+
var devices []hid.DeviceInfo
159159

160160
if runtime.GOOS == "linux" {
161161
// hidapi on Linux opens the device during enumeration to retrieve some infos,
@@ -170,7 +170,7 @@ func (hub *Hub) refreshWallets() {
170170
return
171171
}
172172
}
173-
infos, err := usb.Enumerate(hub.vendorID, 0)
173+
infos, err := hid.Enumerate(hub.vendorID, 0)
174174
if err != nil {
175175
failcount := hub.enumFails.Add(1)
176176
if runtime.GOOS == "linux" {

accounts/usbwallet/wallet.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131
"github.com/ethereum/go-ethereum/core/types"
3232
"github.com/ethereum/go-ethereum/crypto"
3333
"github.com/ethereum/go-ethereum/log"
34-
"github.com/karalabe/usb"
34+
"github.com/karalabe/hid"
3535
)
3636

3737
// Maximum time between wallet health checks to detect USB unplugs.
@@ -79,8 +79,8 @@ type wallet struct {
7979
driver driver // Hardware implementation of the low level device operations
8080
url *accounts.URL // Textual URL uniquely identifying this wallet
8181

82-
info usb.DeviceInfo // Known USB device infos about the wallet
83-
device usb.Device // USB device advertising itself as a hardware wallet
82+
info hid.DeviceInfo // Known USB device infos about the wallet
83+
device hid.Device // USB device advertising itself as a hardware wallet
8484

8585
accounts []accounts.Account // List of derive accounts pinned on the hardware wallet
8686
paths map[common.Address]accounts.DerivationPath // Known derivation paths for signing operations

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ require (
4646
github.com/jackpal/go-nat-pmp v1.0.2
4747
github.com/jedisct1/go-minisign v0.0.0-20230811132847-661be99b8267
4848
github.com/julienschmidt/httprouter v1.3.0
49-
github.com/karalabe/usb v0.0.2
49+
github.com/karalabe/hid v1.0.1-0.20240306101548-573246063e52
5050
github.com/kylelemons/godebug v1.1.0
5151
github.com/mattn/go-colorable v0.1.13
5252
github.com/mattn/go-isatty v0.0.17

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,8 @@ github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/X
329329
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
330330
github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U=
331331
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
332-
github.com/karalabe/usb v0.0.2 h1:M6QQBNxF+CQ8OFvxrT90BA0qBOXymndZnk5q235mFc4=
333-
github.com/karalabe/usb v0.0.2/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU=
332+
github.com/karalabe/hid v1.0.1-0.20240306101548-573246063e52 h1:msKODTL1m0wigztaqILOtla9HeW1ciscYG4xjLtvk5I=
333+
github.com/karalabe/hid v1.0.1-0.20240306101548-573246063e52/go.mod h1:qk1sX/IBgppQNcGCRoj90u6EGC056EBoIc1oEjCWla8=
334334
github.com/kilic/bls12-381 v0.1.0 h1:encrdjqKMEvabVQ7qYOKu1OvhqpK4s47wDYtNiPtlp4=
335335
github.com/kilic/bls12-381 v0.1.0/go.mod h1:vDTTHJONJ6G+P2R74EhnyotQDTliQDnFEwhdmfzw1ig=
336336
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=

0 commit comments

Comments
 (0)