Skip to content
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

accounts/usbwallet: use go-hidapi #28901

Closed
wants to merge 2 commits into from
Closed

Conversation

holiman
Copy link
Contributor

@holiman holiman commented Jan 31, 2024

Instead of updating hidapi within karalabe/usb in karalabe/usb#43, this might be an alternative: use a hidapi-only library from go-ethereum.

Todo tests:

  • Ledger-devices on Linux (Nano X, Nano S, Nano S Plus)
  • Ledger-devices on Mac
  • Ledger-devices on windows
  • Trezor on Linux
  • Trezor on Max
  • Trezor on Windows

go.mod Outdated
Comment on lines 3 to 5
go 1.21

toolchain go1.21.1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My ide started shoving this in there. No idea why.

@lightclient
Copy link
Member

I verified that Ledger X and Ledger S works on mac.

go.mod Outdated Show resolved Hide resolved
@holiman
Copy link
Contributor Author

holiman commented Feb 2, 2024

Building with this PR requires libudev. Fedora dnf install systemd-devel, Ubuntu apt install libhidapi-dev. Do we add this to the build requirements in the makefile somehow?

@holiman
Copy link
Contributor Author

holiman commented Feb 2, 2024

On my fedora, this works well with Ledger Nano S, and Ledger Nano X`

This does not work with Ledger Nano S Plus. I'm investigating

EDIT: I was using the wrong binary. Solved, all works perfectly!

@holiman
Copy link
Contributor Author

holiman commented Feb 2, 2024

Ledger Nano S Plus

[user@work go-hidapi]$ go run ./demo.go 
--------------------------------------------------------------------------------------------------------------------------------
HID #0
  OS Path:      /dev/hidraw0
  Vendor ID:    0x2c97
  Product ID:   0x5015
  Release:      513
  Serial:       0001
  Manufacturer: Ledger
  Product:      Nano S Plus
  Usage Page:   0xffa0
  Usage:        1
  Interface:    0
--------------------------------------------------------------------------------------------------------------------------------
HID #1
  OS Path:      /dev/hidraw1
  Vendor ID:    0x2c97
  Product ID:   0x5015
  Release:      513
  Serial:       0001
  Manufacturer: Ledger
  Product:      Nano S Plus
  Usage Page:   0xf1d0
  Usage:        1
  Interface:    1
================================================================================================================================

@holiman
Copy link
Contributor Author

holiman commented Feb 5, 2024

Tagging for triage,

  • Which USB lib to use?
  • How to handle libudev build requirement (systemd-devel/libhidapi-dev)
  • Further testing?

@holiman
Copy link
Contributor Author

holiman commented Feb 7, 2024

Closing in favour of #28945

@holiman holiman closed this Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants