On Thu, Oct 26, 2023 at 09:34:51PM -0300, Martin Rodriguez Reboredo wrote:
[...]
+
+config USB_RUST
+ bool "Rust USB bindings"
+ depends on USB && RUST
+ default n
Nit, "n" is the default, this line is not needed.
Also, if you want to get really picky, _which_ USB is this for, the
"host" apis (you plug a USB device into a Linux maching), or the
"gadget" apis (i.e. Linux is running in the device that you plug into a
USB host)? Linux supports both :)
+ help
+ Enables Rust bindings for USB.
[...]
+//! Rust USB sample.
+
+use kernel::prelude::*;
+
+module! {
+ type: UsbSimple,
+ name: "rust_usb_simple",
+ author: "Martin Rodriguez Reboredo",
+ description: "Rust USB sample",
+ license: "GPL v2",
+}
+
+struct UsbSimple;
"USBSimple" please.
+
+impl kernel::Module for UsbSimple {
+ fn init(_module: &'static ThisModule) -> Result<Self> {
+ pr_info!("usb enabled: {}", !usb::disabled());
+ Ok(UsbSimple)
+ }
+}
I know this is just a fake patch to test the bindings logic, so sorry
for the noise, just wanted to get terminology right :)
thanks,
greg k-h