Get and print the firmware version of the usbhub
()
| 7 | |
| 8 | /// Get and print the firmware version of the usbhub |
| 9 | pub fn check_usbhub_version() -> Result<(), rusb::Error> { |
| 10 | for dev in rusb::devices().unwrap().iter() { |
| 11 | let dev_descriptor = dev.device_descriptor().unwrap(); |
| 12 | |
| 13 | if dev_descriptor.vendor_id() == REALTEK_VID |
| 14 | && [RTL5432_PID, RTL5424_PID].contains(&dev_descriptor.product_id()) |
| 15 | { |
| 16 | let dev_descriptor = dev.device_descriptor()?; |
| 17 | println!("USB Hub RTL{:04X}", dev_descriptor.product_id()); |
| 18 | println!(" Firmware Version: {}", dev_descriptor.device_version()); |
| 19 | } |
| 20 | |
| 21 | if dev_descriptor.vendor_id() == GENESYS_VID |
| 22 | && [GL3590_PID].contains(&dev_descriptor.product_id()) |
| 23 | { |
| 24 | let dev_descriptor = dev.device_descriptor()?; |
| 25 | if GL3590_PID == dev_descriptor.product_id() { |
| 26 | println!("USB Hub GL3590"); |
| 27 | } else { |
| 28 | println!("USB Hub GL????"); |
| 29 | } |
| 30 | println!(" Firmware Version: {}", dev_descriptor.device_version()); |
| 31 | } |
| 32 | } |
| 33 | Ok(()) |
| 34 | } |