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

hiddevice: add AsFd impl #150

Merged
merged 2 commits into from
Feb 7, 2024

Conversation

JohannesSchilling
Copy link

This is useful to allow performing custom ioctls/operations on nonstandard HID devices.

@ruabmbua
Copy link
Owner

ruabmbua commented Feb 6, 2024

Its probably better to impl https://doc.rust-lang.org/std/os/fd/trait.AsFd.html ?

@ruabmbua
Copy link
Owner

ruabmbua commented Feb 6, 2024

Also, would you mind looking into if we can do the same for the rust windows backend?

@JohannesSchilling JohannesSchilling changed the title hiddevice: add AsRawFd impl hiddevice: add AsFd impl Feb 6, 2024
@JohannesSchilling
Copy link
Author

hm, on first look windows looks more difficult, because there we use https://docs.rs/windows-sys/latest/windows_sys/Win32/Foundation/type.HANDLE.html as basis, but the AsHandle trait uses https://doc.rust-lang.org/std/os/windows/io/type.RawHandle.html, so we'd have to cast isize to *mut c_void (?)

@ruabmbua
Copy link
Owner

ruabmbua commented Feb 7, 2024

I say lets ignore windows for now. I looked through some comments e.g. microsoft/windows-rs#2222. If windows_sys devs decide to implement something, we can use that.

@ruabmbua
Copy link
Owner

ruabmbua commented Feb 7, 2024

Seems like your changes do not compile, pls check.

This is useful to allow performing custom ioctls/operations on
nonstandard HID devices.
@ruabmbua ruabmbua merged commit de3b9e3 into ruabmbua:main Feb 7, 2024
9 checks passed
@ruabmbua
Copy link
Owner

ruabmbua commented Feb 7, 2024

Thx, will release a new version to crates.io soon.

@JohannesSchilling JohannesSchilling deleted the hiddevice-as-raw-fd branch February 7, 2024 14:04
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.

3 participants