|
|
@ -26,7 +26,7 @@ import ( |
|
|
|
"github.com/ethereum/go-ethereum/accounts" |
|
|
|
"github.com/ethereum/go-ethereum/accounts" |
|
|
|
"github.com/ethereum/go-ethereum/event" |
|
|
|
"github.com/ethereum/go-ethereum/event" |
|
|
|
"github.com/ethereum/go-ethereum/log" |
|
|
|
"github.com/ethereum/go-ethereum/log" |
|
|
|
"github.com/karalabe/usb" |
|
|
|
"github.com/karalabe/hid" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
// LedgerScheme is the protocol scheme prefixing account and wallet URLs.
|
|
|
|
// LedgerScheme is the protocol scheme prefixing account and wallet URLs.
|
|
|
@ -109,7 +109,7 @@ func NewTrezorHubWithWebUSB() (*Hub, error) { |
|
|
|
|
|
|
|
|
|
|
|
// newHub creates a new hardware wallet manager for generic USB devices.
|
|
|
|
// newHub creates a new hardware wallet manager for generic USB devices.
|
|
|
|
func newHub(scheme string, vendorID uint16, productIDs []uint16, usageID uint16, endpointID int, makeDriver func(log.Logger) driver) (*Hub, error) { |
|
|
|
func newHub(scheme string, vendorID uint16, productIDs []uint16, usageID uint16, endpointID int, makeDriver func(log.Logger) driver) (*Hub, error) { |
|
|
|
if !usb.Supported() { |
|
|
|
if !hid.Supported() { |
|
|
|
return nil, errors.New("unsupported platform") |
|
|
|
return nil, errors.New("unsupported platform") |
|
|
|
} |
|
|
|
} |
|
|
|
hub := &Hub{ |
|
|
|
hub := &Hub{ |
|
|
@ -155,7 +155,7 @@ func (hub *Hub) refreshWallets() { |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
// Retrieve the current list of USB wallet devices
|
|
|
|
// Retrieve the current list of USB wallet devices
|
|
|
|
var devices []usb.DeviceInfo |
|
|
|
var devices []hid.DeviceInfo |
|
|
|
|
|
|
|
|
|
|
|
if runtime.GOOS == "linux" { |
|
|
|
if runtime.GOOS == "linux" { |
|
|
|
// hidapi on Linux opens the device during enumeration to retrieve some infos,
|
|
|
|
// hidapi on Linux opens the device during enumeration to retrieve some infos,
|
|
|
@ -170,7 +170,7 @@ func (hub *Hub) refreshWallets() { |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
infos, err := usb.Enumerate(hub.vendorID, 0) |
|
|
|
infos, err := hid.Enumerate(hub.vendorID, 0) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
failcount := hub.enumFails.Add(1) |
|
|
|
failcount := hub.enumFails.Add(1) |
|
|
|
if runtime.GOOS == "linux" { |
|
|
|
if runtime.GOOS == "linux" { |
|
|
|