From de55f7fd49fd5ed8401d997ec14bbca6b1d60b57 Mon Sep 17 00:00:00 2001 From: Martin Quarda Date: Thu, 8 May 2025 07:59:38 +0200 Subject: [PATCH] poc in rust --- POC_in_rust/Cargo.toml | 7 +++++++ POC_in_rust/src/main.rs | 11 +++++++++++ run.sh | 0 3 files changed, 18 insertions(+) create mode 100644 POC_in_rust/Cargo.toml create mode 100644 POC_in_rust/src/main.rs mode change 100755 => 100644 run.sh diff --git a/POC_in_rust/Cargo.toml b/POC_in_rust/Cargo.toml new file mode 100644 index 0000000..b977416 --- /dev/null +++ b/POC_in_rust/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "POC_in_rust" +version = "0.1.0" +edition = "2024" + +[dependencies] +nusb = "0.1.13" diff --git a/POC_in_rust/src/main.rs b/POC_in_rust/src/main.rs new file mode 100644 index 0000000..28d439a --- /dev/null +++ b/POC_in_rust/src/main.rs @@ -0,0 +1,11 @@ +use nusb; + +static USB_VENDOR: u16 = 0xffff; +static USB_PRODUCT: u16 = 0x0035; + +fn main() { + let dev = nusb::list_devices().unwrap().find(|dev| dev.vendor_id() == USB_VENDOR && dev.product_id() == USB_PRODUCT).expect("Device not connected!"); + let device = dev.open().expect("failed to open device"); + let interface = device.claim_interface(0).expect("failed to claim interface"); + println!("Success") +} diff --git a/run.sh b/run.sh old mode 100755 new mode 100644