From cd6e41862cea59ec306e7c9c578270575eb2a73b Mon Sep 17 00:00:00 2001 From: Daniel Mueller Date: Sun, 26 Mar 2017 17:07:56 -0700 Subject: Import subrepo hid/:hid at 3ac1005fe3e874bef850ab733fe1a09bc36b91c5 --- hid/examples/list.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 hid/examples/list.rs (limited to 'hid/examples') diff --git a/hid/examples/list.rs b/hid/examples/list.rs new file mode 100644 index 0000000..da24bcb --- /dev/null +++ b/hid/examples/list.rs @@ -0,0 +1,24 @@ +extern crate hid; + +fn main() { + let hid = hid::init().unwrap(); + + for device in hid.devices() { + print!("{} ", device.path().to_str().unwrap()); + print!("ID {:x}:{:x} ", device.vendor_id(), device.product_id()); + + if let Some(name) = device.manufacturer_string() { + print!("{} ", name); + } + + if let Some(name) = device.product_string() { + print!("{} ", name); + } + + if let Some(name) = device.serial_number() { + print!("{} ", name); + } + + println!(); + } +} -- cgit v1.2.1