Skip to main content

Crate keyroost_hid

Crate keyroost_hid 

Source
Expand description

USB HID enumeration for FIDO / security-key devices.

On Linux this enumerates /dev/hidraw* device nodes by reading sysfs metadata — no external dependencies, no ioctls, no device-open required. That keeps enumeration root-free and means it works even when the user has not yet installed the udev rules in udev/70-keyroost-fido.rules.

On macOS and Windows it uses the hidapi crate (IOKit / hid.dll), selected automatically off Linux. The hidapi-backend feature forces that path on for building/testing the cross-platform backend on Linux too. USB topology (usb_bus/usb_address) is only available via the sysfs backend.

Structs§

HidDevice
Metadata for a single connected HID device.

Enums§

HidError
Things that can go wrong enumerating HID devices.

Constants§

HID_USAGE_FIDO_AUTHENTICATOR
HID usage within the FIDO page used by U2F / CTAP HID authenticators.
HID_USAGE_PAGE_FIDO
HID usage page assigned to FIDO U2F / CTAP HID by usb.org.

Functions§

bootloader_device_present
Scan all connected HID devices for any recognized security key in bootloader / DFU mode, returning the first match’s description. A front-end that finds no FIDO devices can call this to explain why (e.g. a Solo 2 stuck in DFU) rather than just reporting an empty list.
enumerate
List all /dev/hidraw* devices visible to the current user via sysfs.
hid_supported
Whether this platform has a HID backend: Linux (sysfs), macOS (IOKit via hidapi), and Windows (hid.dll via hidapi). When false, enumerate returns an empty list and FIDO/CTAP is unavailable — front-ends should say so explicitly rather than reporting “no FIDO devices”, which would imply none are plugged in.