good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
github
maticnetwork
bor
Commits
8d126a49
Unverified
Commit
8d126a49
authored
7 years ago
by
Péter Szilágyi
Browse files
Options
Downloads
Patches
Plain Diff
accounts/usbwallet: handle bad interface number on macOS
parent
f4c49bc0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
accounts/usbwallet/hub.go
+8
-4
8 additions, 4 deletions
accounts/usbwallet/hub.go
with
8 additions
and
4 deletions
accounts/usbwallet/hub.go
+
8
−
4
View file @
8d126a49
...
...
@@ -47,6 +47,8 @@ type Hub struct {
scheme
string
// Protocol scheme prefixing account and wallet URLs.
vendorID
uint16
// USB vendor identifier used for device discovery
productIDs
[]
uint16
// USB product identifiers used for device discovery
usageID
uint16
// USB usage page identifier used for macOS device discovery
endpointID
int
// USB endpoint identifier used for non-macOS device discovery
makeDriver
func
(
log
.
Logger
)
driver
// Factory method to construct a vendor specific driver
refreshed
time
.
Time
// Time instance when the list of wallets was last refreshed
...
...
@@ -66,16 +68,16 @@ type Hub struct {
// NewLedgerHub creates a new hardware wallet manager for Ledger devices.
func
NewLedgerHub
()
(
*
Hub
,
error
)
{
return
newHub
(
LedgerScheme
,
0x2c97
,
[]
uint16
{
0x0000
/* Ledger Blue */
,
0x0001
/* Ledger Nano S */
},
newLedgerDriver
)
return
newHub
(
LedgerScheme
,
0x2c97
,
[]
uint16
{
0x0000
/* Ledger Blue */
,
0x0001
/* Ledger Nano S */
},
0xffa0
,
0
,
newLedgerDriver
)
}
// NewTrezorHub creates a new hardware wallet manager for Trezor devices.
func
NewTrezorHub
()
(
*
Hub
,
error
)
{
return
newHub
(
TrezorScheme
,
0x534c
,
[]
uint16
{
0x0001
/* Trezor 1 */
},
newTrezorDriver
)
return
newHub
(
TrezorScheme
,
0x534c
,
[]
uint16
{
0x0001
/* Trezor 1 */
},
0xff00
,
0
,
newTrezorDriver
)
}
// newHub creates a new hardware wallet manager for generic USB devices.
func
newHub
(
scheme
string
,
vendorID
uint16
,
productIDs
[]
uint16
,
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
!
hid
.
Supported
()
{
return
nil
,
errors
.
New
(
"unsupported platform"
)
}
...
...
@@ -83,6 +85,8 @@ func newHub(scheme string, vendorID uint16, productIDs []uint16, makeDriver func
scheme
:
scheme
,
vendorID
:
vendorID
,
productIDs
:
productIDs
,
usageID
:
usageID
,
endpointID
:
endpointID
,
makeDriver
:
makeDriver
,
quit
:
make
(
chan
chan
error
),
}
...
...
@@ -133,7 +137,7 @@ func (hub *Hub) refreshWallets() {
}
for
_
,
info
:=
range
hid
.
Enumerate
(
hub
.
vendorID
,
0
)
{
for
_
,
id
:=
range
hub
.
productIDs
{
if
info
.
ProductID
==
id
&&
info
.
Interface
==
0
{
if
info
.
ProductID
==
id
&&
(
info
.
UsagePage
==
hub
.
usageID
||
info
.
Interface
==
hub
.
endpointID
)
{
devices
=
append
(
devices
,
info
)
break
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment