list/list.rs
1extern crate hid;
2
3fn main() {
4 let hid = hid::init().unwrap();
5
6 for device in hid.devices() {
7 print!("{} ", device.path().to_str().unwrap());
8 print!("ID {:x}:{:x} ", device.vendor_id(), device.product_id());
9
10 if let Some(name) = device.manufacturer_string() {
11 print!("{} ", name);
12 }
13
14 if let Some(name) = device.product_string() {
15 print!("{} ", name);
16 }
17
18 if let Some(name) = device.serial_number() {
19 print!("{} ", name);
20 }
21
22 println!();
23 }
24}