dcuddeback / libusb-rs

A safe Rust wrapper for libusb.
MIT License
199 stars 64 forks source link

hotplug callback #24

Open gad2103 opened 6 years ago

gad2103 commented 6 years ago

hi. thanks for making this library wrapper. one thing i would love to use but don't see implemented is the hotplug functionality. from the docs:


int libusb_hotplug_register_callback | ( | libusb_context * | ctx,
-- | -- | -- | --
  |   | libusb_hotplug_event | events,
  |   | libusb_hotplug_flag | flags,
  |   | int | vendor_id,
  |   | int | product_id,
  |   | int | dev_class,
  |   | libusb_hotplug_callback_fn | cb_fn,
  |   | void * | user_data,
  |   | libusb_hotplug_callback_handle * | handle
  | )

is this already available and i'm missing something?

woodruffw commented 3 years ago

Taking a look about two years later: it looks like this isn't currently supported.

I could take a stab at implementing it, if nobody else is currently trying.

woodruffw commented 3 years ago

Looks like rusb, which is the actively maintained fork of this crate, already has hotplug support: https://docs.rs/rusb/0.6.5/rusb/trait.UsbContext.html#method.register_callback