MCPcopy Index your code
hub / github.com/FrameworkComputer/framework-system / check_usbhub_version

Function check_usbhub_version

framework_lib/src/usbhub.rs:9–34  ·  view source on GitHub ↗

Get and print the firmware version of the usbhub

()

Source from the content-addressed store, hash-verified

7
8/// Get and print the firmware version of the usbhub
9pub 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}

Callers 1

print_versionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected