Expand description
This library allows implementation of USB peripherals, so called USB gadgets, on Linux devices that have a USB device controller (UDC). Both, pre-defined USB functions and fully custom implementations of the USB interface are supported.
§Requirements
A USB device controller (UDC) supported by Linux is required.
The Linux kernel configuration options CONFIG_USB_GADGET
and CONFIG_USB_CONFIGFS
need to be enabled.
root permissions are required to configure USB gadgets and
the configfs
filesystem needs to be mounted.
§Usage
Start defining an USB gadget by calling Gadget::new
.
When the gadget is fully specified, call Gadget::bind
to register it with
a USB device controller (UDC).
Modules§
- function
- USB gadget functions.
Structs§
- Class
- USB gadget or interface class.
- Config
- USB gadget configuration.
- Gadget
- USB gadget definition.
- Id
- USB gadget id.
- OsDescriptor
- USB gadget operating system descriptor.
- RegGadget
- USB gadget registered with the system.
- Strings
- USB gadget description strings.
- Udc
- USB device controller (UDC).
- WebUsb
- USB gadget WebUSB descriptor.
Enums§
- Language
- USB language id.
- Speed
- USB speed.
- UdcState
- USB device controller (UDC) connection state.
- UsbVersion
- USB version.
- WebUsb
Version - WebUSB version.
Constants§
- GADGET_
IOC_ MAGIC - USB gadget ioctl magic byte.
Functions§
- default_
udc - The default USB device controller (UDC) in the system by alphabetical sorting.
- registered
- Get all USB gadgets registered on the system.
- remove_
all - Remove all USB gadgets defined on the system.
- udcs
- Gets the available USB device controllers (UDCs) in the system.
- unbind_
all - Unbind all USB gadgets defined on the system.