File: extra_data.rs

package info (click to toggle)
cyme 2.2.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 3,404 kB
  • sloc: makefile: 147; sh: 51
file content (21 lines) | stat: -rw-r--r-- 676 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use cyme::profiler;

fn main() -> Result<(), String> {
    // get all system devices - this time with extra data which contain the Configuration, driver data (with udev)
    let sp_usb = profiler::get_spusb_with_extra()
        .map_err(|e| format!("Failed to gather system USB data from libusb, Error({})", e))?;

    let devices = sp_usb.flattened_devices();

    // print all configurations
    for device in devices {
        if let Some(extra) = device.extra.as_ref() {
            println!("Device {} has configurations:", device.name);
            for c in extra.configurations.iter() {
                println!("{:?}", c);
            }
        };
    }

    Ok(())
}