summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorYuval Adam <_@yuv.al>2018-07-23 12:07:53 +0300
committerYuval Adam <_@yuv.al>2018-07-23 12:07:53 +0300
commit42b95915c11780a796f32ca9c35cb286155da7cc (patch)
treecf875e901544962ccc53d26c82b1fc36d1ba9f0b /src/main.rs
parentb4975f7e0c42b60350a0b5b98c5e3f8302427cf0 (diff)
Add basic USB device enumeration
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
new file mode 100644
index 0000000..697912b
--- /dev/null
+++ b/src/main.rs
@@ -0,0 +1,14 @@
+extern crate libusb;
+
+fn main() {
+ println!("Running");
+ let ctx = libusb::Context::new().unwrap();
+ for mut dev in ctx.devices().unwrap().iter() {
+ let desc = dev.device_descriptor().unwrap();
+ println!("Bus {:03} Device {:03} ID {:04x}:{:04x}",
+ dev.bus_number(),
+ dev.address(),
+ desc.vendor_id(),
+ desc.product_id());
+ }
+}