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

Richo/hotplug events #42

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Conversation

richo
Copy link

@richo richo commented Feb 6, 2021

Hi! I finally got something working as far as libusb callbacks go. This PR is a mess, I mostly wanted to run the API past you before I clean things up and unify (I created some aspirational modules while I was noodling and obviously it's not great to have a module with one enum in it).

I'll add some comments for the parts I'd like you to look at. Thanks!


fn main() -> Result<(), Box<dyn Error>> {
let mut ctx = libusb::Context::new()?;
ctx.register_callback(Default::default(), |device, event| {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dcuddeback This is the user facing API, I'd love your thoughts on this part. I create a native &Device for the callback, and created an Event enum to mirror the libusb side but I'm open to other ideas here.

The libusb interface for filters doesn't really map onto rust super well so I made a builder style thing to let you create filters.

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