-
Notifications
You must be signed in to change notification settings - Fork 212
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
proposal: core-foundation-rs hosted IOKit bindings #632
Comments
micolous
changed the title
core-foundation-rs hosted IOKit bindings
proposal: core-foundation-rs hosted IOKit bindings
Aug 10, 2023
As a passer-by looking for said bindings, would you be able to place those somewhere public? Even a Github gist would be a lot to run with. Of course, the ideal action would be to see this rolled into |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm currently using
core-foundation-rs
a couple of projects which have their ownIOKit
bindings to access USB HID and system power management state:My USB HID bindings are based on Mozilla's authenticator-rs bindings, but I've fixed some issues with it, and made it use more
core-foundation-rs
APIs and add more Rust-like API surfaces (as the existing bindings were pretty bare-bones).Regarding licensing,
authenticator-rs
is MPL-2.0 licensed; there would need to be a discussion with Mozilla folks about re-licensing for this project. My modifications are also MPL-2.0 licensed, but I'm happy for that to change to Apache-2.0/MIT like the rest of this project.The USB HID bindings would need some modifications to make it useful for things other than FIDO/CTAP authenticators, as they have hard-coded device matching rules, and
IOHIDManager
requiresInput Monitoring
permission if you don't provide them.There are other macOS-compatible Rust bindings for USB HID, but they use the
hidapi
C library, which has its own quirks and limitations. It seems likehidapi-rs
is looking to move away fromhidapi
and move to pure Rust bindings, and this would provide them a way to deliver it.My system power management API wrappers (
IORegisterForSystemPower
etc.) I've rolled myself, but these aren't in any public repository at present.I'm happy for this to be released as Apache-2.0/MIT as with the rest of this project, and that could be upstreamed fairly easily.
None of these implement 100% of
IOKit
APIs, but this can be an incremental process as with other parts of Core Foundation.I think
core-foundation-rs
might be a good home for these bindings, as it hosts Rust bindings for a bunch of macOS platform APIs, and it seems to be the closest equivalent of "windows-rs
but for macOS".There's an existing
io-kit-sys
library (MIT licensed) which has a pending PR to switch to usingcore-foundation-sys
, but this looks like it's no longer maintained. There are a bunch of forks of it which add more functionality (like power management), which at least show there's Rust community interest in having these sorts of APIs available.My intent in raising this issue is to see if you're interested (as a project) in expanding in scope, before I start doing some further legwork (starting to upstream what I can, and starting discussions to unblock the rest).
My ultimate goal is to stop re-implementing IOKit APIs in multiple projects, and hopefully provide something useful to others in the process. 😄
The text was updated successfully, but these errors were encountered: