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