#[non_exhaustive]#[repr(u8)]pub enum BaseClass {
Show 25 variants
UseInterfaceDescriptor = 0,
Audio = 1,
CdcCommunications = 2,
Hid = 3,
Physical = 5,
Image = 6,
Printer = 7,
MassStorage = 8,
Hub = 9,
CdcData = 10,
SmartCard = 11,
ContentSecurity = 13,
Video = 14,
PersonalHealthcare = 15,
AudioVideo = 16,
Billboard = 17,
UsbTypeCBridge = 18,
Bdp = 19,
Mctp = 20,
I3cDevice = 60,
Diagnostic = 220,
WirelessController = 224,
Miscellaneous = 239,
ApplicationSpecificInterface = 254,
VendorSpecificClass = 255,
}Expand description
USB class code defines ref
Technically this is the ‘Base Class’ - the ‘Class Code’ is the full triplet of (Base Class, Sub Class, Protocol).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
UseInterfaceDescriptor = 0
Device class is unspecified, interface descriptors are used to determine needed drivers
Audio = 1
Speaker, microphone, sound card, MIDI
CdcCommunications = 2
The modern serial interface; appears as a UART/RS232 port on most systems
Hid = 3
Human Interface Device; game controllers, keyboards, mice etc. Also commonly used as a device data interface rather then creating something from scratch
Physical = 5
Force feedback joystick
Image = 6
Still imaging device; scanners, cameras
Printer = 7
Laser printer, inkjet printer, CNC machine
MassStorage = 8
Mass storage devices (MSD): USB flash drive, memory card reader, digital audio player, digital camera, external drive
Hub = 9
High speed USB hub
CdcData = 10
Used together with class 02h (Communications and CDC Control) above
SmartCard = 11
USB smart card reader
ContentSecurity = 13
Fingerprint reader
Video = 14
Webcam
PersonalHealthcare = 15
Pulse monitor (watch)
AudioVideo = 16
Webcam, TV
Billboard = 17
Describes USB-C alternate modes supported by device
UsbTypeCBridge = 18
An interface to expose and configure the USB Type-C capabilities of Connectors on USB Hubs or Alternate Mode Adapters
Bdp = 19
This base class is defined for devices that conform to the “VESA USB BDP Device Specification” found at the VESA website. This specification defines the usable set of SubClass and Protocol values. Values outside of this defined spec are reserved. These class codes can only be used in Interface Descriptors.
Mctp = 20
This base class is defined for devices that conform to the “MCTP over USB” found at the DMTF website as DSP0283. This specification defines the usable set of SubClass and Protocol values. Values outside of this defined spec are reserved. These class codes can only be used in Interface Descriptors.
I3cDevice = 60
An interface to expose and configure I3C function within a USB device to allow interaction between host software and the I3C device, to drive transaction on the I3C bus to/from target devices
Diagnostic = 220
Trace and debugging equipment
WirelessController = 224
Wireless controllers: Bluetooth adaptors, Microsoft RNDIS
Miscellaneous = 239
This base class is defined for miscellaneous device definitions. Some matching SubClass and Protocols are defined on the USB-IF website
ApplicationSpecificInterface = 254
This base class is defined for devices that conform to several class specifications found on the USB-IF website
VendorSpecificClass = 255
This base class is defined for vendors to use as they please
Implementations§
Source§impl BaseClass
impl BaseClass
Sourcepub fn usage(&self) -> DescriptorUsage
pub fn usage(&self) -> DescriptorUsage
How the BaseClass is used DescriptorUsage
Sourcepub fn to_lsusb_string(&self) -> String
pub fn to_lsusb_string(&self) -> String
lsusb is explicit for some in styling of tree
assert_eq!(BaseClass::Hid.to_lsusb_string(), "Human Interface Device");Sourcepub fn to_title_case(&self) -> String
pub fn to_title_case(&self) -> String
Converts Pascal case enum to space separated on capitals
assert_eq!(BaseClass::UseInterfaceDescriptor.to_title_case(), "Use Interface Descriptor");
assert_eq!(BaseClass::CdcData.to_title_case(), "CDC Data");Trait Implementations§
Source§impl<'de> Deserialize<'de> for BaseClass
impl<'de> Deserialize<'de> for BaseClass
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<BaseClass> for DescriptorUsage
impl From<BaseClass> for DescriptorUsage
Source§fn from(c: BaseClass) -> DescriptorUsage
fn from(c: BaseClass) -> DescriptorUsage
impl Copy for BaseClass
impl Eq for BaseClass
impl StructuralPartialEq for BaseClass
Auto Trait Implementations§
impl Freeze for BaseClass
impl RefUnwindSafe for BaseClass
impl Send for BaseClass
impl Sync for BaseClass
impl Unpin for BaseClass
impl UnsafeUnpin for BaseClass
impl UnwindSafe for BaseClass
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more