[][src]Struct usbd_bulk_only_transport::CommandBlockWrapper

pub struct CommandBlockWrapper {
    pub signature: u32,
    pub tag: u32,
    pub data_transfer_length: u32,
    pub direction: Direction,
    pub lun: u8,
    pub data_length: u8,
    pub data: [u8; 16],
}

A wrapper that identifies a command sent from the host to the device on the OUT endpoint. Describes the data transfer IN or OUT that should happen immediatly after this wrapper is received. Little Endian

Fields

signature: u32

Signature that identifies this packet as CBW Must contain 0x43425355

tag: u32

Tag sent by the host. Must be echoed back to host in tag field of the command status wrapper sent after the command has been executed/rejected. Host uses it to positively associate a CSW with the corresponding CBW

data_transfer_length: u32

Number of bytes of data that the host expects to receive on the IN or OUT endpoint (as indicated by the direction field) during the execution of this command. If this field is zero, must respond directly with CSW

direction: Direction

Direction of transfer initiated by this command. 0b0XXXXXXX = OUT from host to device 0b1XXXXXXX = IN from device to host X bits are obsolete or reserved

lun: u8

The device Logical Unit Number (LUN) to which the command is for. For devices that don't support multiple LUNs the host will set this field to zero. Devices that don't support multiple LUNS must not ignore this field and apply all commands to LUN 0, see General Problems with Commands

data_length: u8

The number of valid bytes in data field

data: [u8; 16]

The command set specific data for this command

Methods

impl CommandBlockWrapper[src]

pub fn truncate_to_signature(buf: &mut [u8]) -> usize[src]

Trait Implementations

impl Clone for CommandBlockWrapper[src]

impl Copy for CommandBlockWrapper[src]

impl Debug for CommandBlockWrapper[src]

impl Default for CommandBlockWrapper[src]

impl Eq for CommandBlockWrapper[src]

impl Packed for CommandBlockWrapper[src]

type Error = Error

fn pack(&self, bytes: &mut [u8]) -> Result<(), Self::Error>[src]

Pack into the provided byte slice.

bytes.len() must be at least 31

byte76543210
0signature MSB-------
1--------
2--------
3-------signature LSB
4tag MSB-------
5--------
6--------
7-------tag LSB
8data_transfer_length MSB-------
9--------
10--------
11-------data_transfer_length LSB
12direction MSB------direction LSB
13lun MSB------lun LSB
14data_length MSB------data_length LSB
15data MSB-------
16--------
17--------
18--------
19--------
20--------
21--------
22--------
23--------
24--------
25--------
26--------
27--------
28--------
29--------
30-------data LSB

impl PackedBytes<[u8; 31]> for CommandBlockWrapper[src]

type Error = Error

impl PackedSize for CommandBlockWrapper[src]

impl PartialEq<CommandBlockWrapper> for CommandBlockWrapper[src]

impl StructuralEq for CommandBlockWrapper[src]

impl StructuralPartialEq for CommandBlockWrapper[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.