#[non_exhaustive]pub struct Config<'a> {Show 13 fields
pub bcd_usb: UsbVersion,
pub device_class: u8,
pub device_sub_class: u8,
pub device_protocol: u8,
pub device_release: u16,
pub max_packet_size_0: u8,
pub manufacturer: Option<&'a str>,
pub product: Option<&'a str>,
pub serial_number: Option<&'a str>,
pub supports_remote_wakeup: bool,
pub composite_with_iads: bool,
pub self_powered: bool,
pub max_power: u16,
/* private fields */
}
Expand description
Configuration used when creating UsbDevice
.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.bcd_usb: UsbVersion
Device BCD USB version.
Default: 0x0210
(“2.1”)
device_class: u8
Device class code assigned by USB.org. Set to 0xff
for vendor-specific
devices that do not conform to any class.
Default: 0x00
(class code specified by interfaces)
device_sub_class: u8
Device sub-class code. Depends on class.
Default: 0x00
device_protocol: u8
Device protocol code. Depends on class and sub-class.
Default: 0x00
device_release: u16
Device release version in BCD.
Default: 0x0010
(“0.1”)
max_packet_size_0: u8
Maximum packet size in bytes for the control endpoint 0.
Valid values depend on the speed at which the bus is enumerated.
- low speed: 8
- full speed: 8, 16, 32, or 64
- high speed: 64
Default: 64 bytes
manufacturer: Option<&'a str>
Manufacturer name string descriptor.
Default: (none)
product: Option<&'a str>
Product name string descriptor.
Default: (none)
serial_number: Option<&'a str>
Serial number string descriptor.
Default: (none)
supports_remote_wakeup: bool
Whether the device supports remotely waking up the host is requested.
Default: false
composite_with_iads: bool
Configures the device as a composite device with interface association descriptors.
If set to true
, the following fields should have the given values:
device_class
=0xEF
device_sub_class
=0x02
device_protocol
=0x01
self_powered: bool
Whether the device has its own power source.
This should be set to true
even if the device is sometimes self-powered and may not
always draw power from the USB bus.
Default: false
See also: max_power
max_power: u16
Maximum current drawn from the USB bus by the device, in milliamps.
The default is 100 mA. If your device always uses an external power source and never draws power from the USB bus, this can be set to 0.
See also: self_powered
Default: 100mA Max: 500mA