[−][src]Struct usb_device::device::UsbDeviceBuilder
Used to build new UsbDevice
s.
Methods
impl<'a, B: UsbBus> UsbDeviceBuilder<'a, B>
[src]
pub fn new(
alloc: &'a UsbBusAllocator<B>,
vid_pid: UsbVidPid
) -> UsbDeviceBuilder<'a, B>
[src]
alloc: &'a UsbBusAllocator<B>,
vid_pid: UsbVidPid
) -> UsbDeviceBuilder<'a, B>
Creates a builder for constructing a new UsbDevice
.
pub fn build(self) -> UsbDevice<'a, B>
[src]
Creates the UsbDevice
instance with the configuration in this builder.
pub fn device_class(self, device_class: u8) -> Self
[src]
Sets the 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)
pub fn device_sub_class(self, device_sub_class: u8) -> Self
[src]
Sets the device sub-class code. Depends on class.
Default: 0x00
pub fn device_protocol(self, device_protocol: u8) -> Self
[src]
Sets the device protocol code. Depends on class and sub-class.
Default: 0x00
pub fn device_release(self, device_release: u16) -> Self
[src]
Sets the device release version in BCD.
Default: 0x0010
("0.1")
pub fn self_powered(self, self_powered: bool) -> Self
[src]
Sets whether the device may have an external 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
pub fn supports_remote_wakeup(self, supports_remote_wakeup: bool) -> Self
[src]
Sets whether the device supports remotely waking up the host is requested.
Default: false
pub fn manufacturer(self, manufacturer: &'a str) -> Self
[src]
Sets the manufacturer name string descriptor.
Default: (none)
pub fn product(self, product: &'a str) -> Self
[src]
Sets the product name string descriptor.
Default: (none)
pub fn serial_number(self, serial_number: &'a str) -> Self
[src]
Sets the serial number string descriptor.
Default: (none)
pub fn max_packet_size_0(self, max_packet_size_0: u8) -> Self
[src]
Sets the maximum packet size in bytes for the control endpoint 0.
Valid values are 8, 16, 32 and 64. There's generally no need to change this from the default value of 8 bytes unless a class uses control transfers for sending large amounts of data, in which case using a larger packet size may be more efficient.
Default: 8 bytes
pub fn max_power(self, max_power_ma: usize) -> Self
[src]
Sets the 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
Auto Trait Implementations
impl<'a, B> !Send for UsbDeviceBuilder<'a, B>
impl<'a, B> !Sync for UsbDeviceBuilder<'a, B>
impl<'a, B> Unpin for UsbDeviceBuilder<'a, B>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,