usb_enumeration
A cross platform Rust library that returns the vendor and product IDs of currently connected USB devices
Example
let devices = enumerate;
println!;
// Outputs:
// [
// UsbDevice {
// id: "USB\\VID_0CE9&PID_1220\\0000000004BE",
// vendor_id: 3305,
// product_id: 4640,
// description: Some(
// "PicoScope 4000 series PC Oscilloscope",
// ),
// },
// UsbDevice {
// id: "USB\\VID_046D&PID_C52B\\5&17411534&0&11",
// vendor_id: 1133,
// product_id: 50475,
// description: Some(
// "USB Composite Device",
// ),
// },
// UsbDevice {
// id: "USB\\VID_046D&PID_C52B&MI_00\\6&12D311A2&0&0000",
// vendor_id: 1133,
// product_id: 50475,
// description: Some(
// "Logitech USB Input Device",
// ),
// },
// etc...
// ]
You can also subscribe to events using the Observer
:
use ;
let sub = new
.with_poll_interval
.with_vendor_id
.with_product_id
.subscribe;
// when sub is dropped, the background thread will close
for event in sub.rx_event.iter
License: MIT