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

Add linux-native-basic-udev feature #167

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

xobs
Copy link

@xobs xobs commented Mar 9, 2025

Add a new feature, linux-native-basic-udev. This is identical to linux-native but uses basic-udev as a udev source rather than udev-rs.

basic-udev is a reimplementation of just enough udev functionality to support device discovery on most common platforms without needing to link libudev.so.

As a result, it becomes possible to cross-compile crates that depend on hidapi-rs to Linux (both GNU and Musl) without needing a full sysroot. This greatly simplifies cross-compiling to multiple target architectures, particularly when using cargo-zigbuild.

Avoid having to rely on libudev, which makes this crate difficult to
cross-compile. Instead, traverse `/sys` directly to discover what it is we
need.

Signed-off-by: Sean Cross <[email protected]>
@xobs xobs force-pushed the add-basic-udev-option branch from 69c0604 to 54732a2 Compare March 9, 2025 05:38
Add an alternative to `libudev-sys` that doesn't require pkgconfig. This
allows for cross-compiling to Linux without first obtaining a sysroot for
the target. It also allows for compiling to musl, and statically-linking
projects that use hidapi.

Signed-off-by: Sean Cross <[email protected]>
@xobs xobs force-pushed the add-basic-udev-option branch from 54732a2 to ada8041 Compare March 9, 2025 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant