| 82 | } |
| 83 | |
| 84 | pub fn reset_usb() { |
| 85 | let Some(handle) = |
| 86 | rusb::open_device_with_vid_pid(VENDOR_ID, PRODUCT_ID) |
| 87 | else { |
| 88 | error!("Failed to open device for USB reset"); |
| 89 | return; |
| 90 | }; |
| 91 | |
| 92 | info!("Resetting device..."); |
| 93 | let _ = handle.reset(); |
| 94 | drop(handle); |
| 95 | // the kernel needs time to re-enumerate, |
| 96 | // and the device sends some initial data we don't care about |
| 97 | std::thread::sleep(std::time::Duration::from_secs(2)); |
| 98 | info!("Device reset complete."); |
| 99 | } |
| 100 | |
| 101 | /// Queries every feature from hardware individually. |
| 102 | /// This will update the internal state of the features with the current hardware values. |