-
Notifications
You must be signed in to change notification settings - Fork 20
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
Support discovering USB HID devices on linux #1
Comments
First poc version
Merge upstream
I'm trying to use this library on linux, but it filters out my keys due to this line: https://github.com/marshallbrekka/go-u2fhost/blob/master/hid/hid.go#L46 |
@VictorDenisov this has been long on my personal backlog of issues to resolve. Short answer:usage and usage page are available on linux, but they are not accessible given the current way that hidapi uses libusb. Longer AnswerI had done some research a while ago, but can't seem to find it, so sorry if my notes are a little sparse, or not as correct as they should be. libusb currently has the code disabled for grabbing the full usage page. This is probably a fine choice as most users may not need it. In our case it would be ideal to be able to access it when needed to validate the device is u2f compatible. There is another usability issue. The karalabe/hid project chooses to use the libusb backend on linux, as opposed to the Fortunately we can look at what Firefox has done, via their rust library. I'm not 100% sure what the best path is to move forward, as it seems some decent changes would be required outside of this project. Can the usage page check just be removed entirely?Honestly I'm not sure what kind of dangers might arise by issuing commands to non-u2f devices. I'd be very open to exploring that if you have the bandwidth to do that research. |
Thanks for your reply. I'll be looking into this problem as it's a more or less pressing issue for me. Though it looks like if I want a tool that works just for me I can just do the custom build of the tool that is using your library. |
Also looks like there is some progress on making it more accessible on linux libusb/hidapi#139 |
Requires passing "-tags=hidraw" when building to enable the fix. This commit changes the hid library used for accessing u2f USB devices from karalabe/hid to bearsh/hid. bearsh/hid has updated karalabe's libusb and hidapi code base with upstream libusb/libusb and libusb/hidapi, which among other things incorporate the changes in libusb/hidapi to support Usage Page and Usage on Linux with hidraw. (see https://github.com/libusb/hidapi/pull/139/files) that fix marshallbrekka#1 when built with "-tags=hidraw", while maintaining the old behaviour when built without it. The fork includes fixes and enhancements related to vendoring modules. The commit also fixes the module name in go.mod.
Requires passing "-tags=hidraw" when building to enable the fix. This commit changes the hid library used for accessing u2f USB devices from karalabe/hid to bearsh/hid. bearsh/hid has updated karalabe's libusb and hidapi code base with upstream libusb/libusb and libusb/hidapi, which among other things incorporate the changes in libusb/hidapi to support Usage Page and Usage on Linux with hidraw. (see https://github.com/libusb/hidapi/pull/139/files) that fix marshallbrekka#1 when built with "-tags=hidraw", while maintaining the old behaviour when built without it. The fork includes fixes and enhancements related to vendoring modules. The commit also fixes the module name in go.mod.
Requires passing "-tags=hidraw" when building to enable the fix. This commit changes the hid library used for accessing u2f USB devices from karalabe/hid to bearsh/hid. bearsh/hid has updated karalabe's libusb and hidapi code base with upstream libusb/libusb and libusb/hidapi, which among other things incorporate the changes in libusb/hidapi to support Usage Page and Usage on Linux with hidraw. (see https://github.com/libusb/hidapi/pull/139/files) that fix marshallbrekka#1 when built with "-tags=hidraw", while maintaining the old behaviour when built without it. The fork includes fixes and enhancements related to vendoring modules. The commit also fixes the module directive in go.mod and adds the vendor directory resulting from executing "go mod vendor"
Requires passing "-tags=hidraw" when building to enable the fix. This commit changes the hid library used for accessing u2f USB devices from karalabe/hid to bearsh/hid. bearsh/hid has updated karalabe's libusb and hidapi code base with upstream libusb/libusb and libusb/hidapi, which among other things incorporate the changes in libusb/hidapi to support Usage Page and Usage on Linux with hidraw. (see https://github.com/libusb/hidapi/pull/139/files) that fix marshallbrekka#1 when built with "-tags=hidraw", while maintaining the old behaviour when built without it. The fork includes fixes and enhancements related to vendoring modules. The commit also fixes the module directive in go.mod and adds the vendor directory resulting from executing "go mod vendor"
Requires passing "-tags=hidraw" when building to enable the fix. This commit changes the hid library used for accessing u2f USB devices from karalabe/hid to bearsh/hid. bearsh/hid has updated karalabe's libusb and hidapi code base with upstream libusb/libusb and libusb/hidapi, which among other things incorporate the changes in libusb/hidapi to support Usage Page and Usage on Linux with hidraw. (see https://github.com/libusb/hidapi/pull/139/files) that fix marshallbrekka#1 when built with "-tags=hidraw", while maintaining the old behaviour when built without it. The fork includes fixes and enhancements related to vendoring modules. The commit also fixes the module directive in go.mod and adds the vendor directory resulting from executing "go mod vendor"
Optional support for discovering USB HID devices on Linux Requires passing "-tags=hidraw" when building to enable the fix. This commit changes the hid library used for accessing u2f USB devices from karalabe/hid to bearsh/hid. bearsh/hid has updated karalabe's libusb and hidapi code base with upstream libusb/libusb and libusb/hidapi, which among other things incorporate the changes in libusb/hidapi to support Usage Page and Usage on Linux with hidraw. (see https://github.com/libusb/hidapi/pull/139/files) that fix #1 when built with "-tags=hidraw", while maintaining the old behaviour when built without it. The fork includes fixes and enhancements related to vendoring modules. The commit also fixes the module directive in go.mod and adds the vendor directory resulting from executing "go mod vendor" * Remove vendor folder The vendor folder had been initially added to allow interoperation with older versions of Go and to make sure we had a copy of all deps living under the same file tree. Depending on the module users Go version, the first part may not hold. As for making sure we keep a copy of the dependencies, it should not be a problem if dependency repositories are not completely removed. Neither of these seem to be/should be an issue, so based on comment #10 (comment) this commit removes vendor/ Co-authored-by: Brendan Roy <[email protected]>
Use this firefox extension as a reference.
https://github.com/prefiks/u2f4moz/blob/master/c_src/libu2f-host/devs.c#L117-L142
The text was updated successfully, but these errors were encountered: