pub struct Config {
pub max_packet_size: u16,
pub vendor_id: [u8; 8],
pub product_id: [u8; 16],
pub product_revision_level: [u8; 4],
pub serial_number: [u8; 32],
pub serial_number_len: u8,
pub double_buffered: bool,
}Expand description
Configuration for the USB Mass Storage Class.
Fields§
§max_packet_size: u16Maximum packet size for Bulk endpoints (typically 64 for Full Speed, 512 for High Speed).
vendor_id: [u8; 8]Vendor identification (8 ASCII characters, space-padded per SPC-2).
product_id: [u8; 16]Product identification (16 ASCII characters, space-padded per SPC-2).
product_revision_level: [u8; 4]Product revision level (4 ASCII characters, space-padded per SPC-2).
serial_number: [u8; 32]Unit serial number (up to 32 ASCII characters).
serial_number_len: u8Length of the unit serial number in bytes (0..=32).
double_buffered: boolAsk the driver to double-buffer the bulk endpoints. See
Driver::alloc_endpoint_bulk_in_double_buffered.
Implementations§
Source§impl Config
impl Config
Sourcepub const fn new(max_packet_size: u16) -> Self
pub const fn new(max_packet_size: u16) -> Self
Creates a new Config with the given max_packet_size and empty vendor/product/serial strings.
Sourcepub fn vendor_id(self, vendor_id: &str) -> Self
pub fn vendor_id(self, vendor_id: &str) -> Self
Sets the SCSI Vendor Identification (space-padded or truncated to 8 bytes).
Sourcepub fn set_vendor_id(&mut self, vendor_id: &str)
pub fn set_vendor_id(&mut self, vendor_id: &str)
Sets the SCSI Vendor Identification (space-padded or truncated to 8 bytes).
Sourcepub fn product_id(self, product_id: &str) -> Self
pub fn product_id(self, product_id: &str) -> Self
Sets the SCSI Product Identification (space-padded or truncated to 16 bytes).
Sourcepub fn set_product_id(&mut self, product_id: &str)
pub fn set_product_id(&mut self, product_id: &str)
Sets the SCSI Product Identification (space-padded or truncated to 16 bytes).
Sourcepub fn product_revision_level(self, revision: &str) -> Self
pub fn product_revision_level(self, revision: &str) -> Self
Sets the SCSI Product Revision Level (space-padded or truncated to 4 bytes).
Sourcepub fn set_product_revision_level(&mut self, revision: &str)
pub fn set_product_revision_level(&mut self, revision: &str)
Sets the SCSI Product Revision Level (space-padded or truncated to 4 bytes).
Sourcepub fn double_buffered(self, double_buffered: bool) -> Self
pub fn double_buffered(self, double_buffered: bool) -> Self
Asks the driver to double-buffer the bulk endpoints.
This improves throughput on drivers that support it, at the cost of more endpoint resources. Drivers that don’t support it allocate ordinary endpoints.
Sourcepub fn serial_number(self, serial_number: &str) -> Self
pub fn serial_number(self, serial_number: &str) -> Self
Sets the Unit Serial Number (up to 32 ASCII characters).
Sourcepub fn set_serial_number(&mut self, serial_number: &str)
pub fn set_serial_number(&mut self, serial_number: &str)
Sets the Unit Serial Number (up to 32 ASCII characters).
Sourcepub fn serial_number_bytes(&self) -> &[u8]
pub fn serial_number_bytes(&self) -> &[u8]
Returns the unit serial number bytes.