Expand description
Loopback function (for testing).
The Linux kernel configuration option CONFIG_USB_CONFIGFS_F_LB_SS must be enabled.
The loopback function loops back a configurable number of transfers, useful for testing
USB device controllers and host-side software.
§Example
use usb_gadget::{
default_udc, function::loopback::Loopback, Class, Config, Gadget, Id, Strings,
};
let (loopback, func) = Loopback::new();
let udc = default_udc().expect("cannot get UDC");
let reg = Gadget::new(
Class::vendor_specific(0, 0),
Id::LINUX_FOUNDATION_COMPOSITE,
Strings::new("Manufacturer", "Loopback", "0123456"),
)
.with_config(Config::new("Loopback Config 1").with_function(func))
.bind(&udc)
.expect("cannot bind to UDC");
println!(
"Loopback {} at {} status {:?}",
reg.name().to_string_lossy(),
reg.path().display(),
loopback.status()
);Structs§
- Loopback
- USB loopback function.
- Loopback
Builder - Builder for USB loopback function.