| 1 | //! Detach the kernel driver for an FTDI device, claim the USB interface, and |
| 2 | //! then reattach it. |
| 3 | use std::{thread::sleep, time::Duration}; |
| 4 | fn main() { |
| 5 | env_logger::init(); |
| 6 | let di = nusb::list_devices() |
| 7 | .unwrap() |
| 8 | .find(|d| d.vendor_id() == 0x0403 && d.product_id() == 0x6010) |
| 9 | .expect("device should be connected"); |
| 10 | |
| 11 | let device = di.open().unwrap(); |
| 12 | let interface = device.detach_and_claim_interface(0).unwrap(); |
| 13 | sleep(Duration::from_secs(1)); |
| 14 | drop(interface); |
| 15 | } |