device/device.rs
1use std::path::Path;
2
3use hidraw::{Device, Result};
4
5fn print_info<P: AsRef<Path>>(path: P) -> Result<()> {
6 let mut device = Device::open(path)?;
7
8 println!("{device:#?}");
9 println!("\t{:?}", device.get_physical_address()?);
10 println!("\t{:?}", device.get_report_descriptor()?);
11 println!("\t{:?}", device.get_raw_unique()?);
12
13 Ok(())
14}
15
16fn main() {
17 for i in 0..20 {
18 if let Err(error) = print_info(format!("/dev/hidraw{i}")) {
19 eprintln!("{error}");
20 }
21 }
22}