aboutsummaryrefslogtreecommitdiff
path: root/hid/examples/list.rs
blob: da24bcbe04a16efbc3e684e2b8808455cd65171d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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!();
	}
}