10#include "lockfree_list.hpp"
11#include "lockfree_pool.hpp"
20enum class DescriptorType : uint8_t
104 static_assert(
sizeof(
Data) == 18,
"DeviceDescriptor must be 18 bytes");
122 uint16_t bcd, uint8_t num_configs);
原始数据封装类。 A class for encapsulating raw data.
USB描述符基类 USB descriptor base class.
Data data_
设备描述符数据实例 / Internal data instance
DeviceDescriptor(USBSpec spec, PacketSize0 packet_size, uint16_t vid, uint16_t pid, uint16_t bcd, uint8_t num_configs)
构造函数,初始化设备描述符 Constructor, initialize device descriptor fields
USBSpec GetUSBSpec() const
获取USB协议版本 Get USB specification
@ VENDOR_SPECIFIC
厂商自定义类 / Vendor Specific
@ APPLICATION_SPECIFIC
应用专用类 / Application Specific
@ DIAGNOSTIC
诊断类 / Diagnostic
@ CONTENT_SECURITY
内容安全类 / Content Security
@ WIRELESS
无线控制类 / Wireless Controller
@ PERSONAL_HEALTHCARE
个人医疗健康类 / Personal Healthcare
@ COMM
通信类 / Communications (CDC)
@ SMART_CARD
智能卡类 / Smart Card
@ CDC_DATA
CDC 数据类 / CDC Data.
@ BULK_DISPLAY
Bulk Display类
@ MISCELLANEOUS
杂项类 / Miscellaneous
@ BILLBOARD
Billboard类(USB Type-C专用)/ Billboard (Type-C)
@ PER_INTERFACE
每个接口自定义类 / Per-interface
@ TYPE_C_BRIDGE
Type-C Bridge类
@ MASS_STORAGE
大容量存储类 / Mass Storage
@ PHYSICAL
物理设备类 / Physical Device
static constexpr uint8_t DEVICE_DESC_LENGTH
设备描述符长度(固定18字节)/ Device descriptor length (18 bytes)
PacketSize0
控制端点0最大包长度枚举 Packet size for endpoint 0 (bMaxPacketSize0)
@ SIZE_512
512字节 / 512 bytes (SuperSpeed)
@ SIZE_32
32字节 / 32 bytes (Full Speed)
@ SIZE_8
8字节 / 8 bytes (Low Speed / Full Speed)
@ SIZE_16
16字节 / 16 bytes (Full Speed)
@ SIZE_64
64字节 / 64 bytes (Full Speed / High Speed)
RawData GetData()
获取设备描述符的原始数据指针及长度 Get the raw device descriptor data pointer and length
USB HID(Human Interface Device)基类,支持可选 OUT 端点、自动生成描述符,适合键盘、鼠标、手柄等扩展。 USB HID (Human Interface Device)...
uint16_t idProduct
产品ID(PID)/ Product ID
ClassID bDeviceClass
设备类代码 / Device class code
DescriptorType bDescriptorType
uint8_t bDeviceSubClass
设备子类代码 / Device subclass code
uint8_t bLength
描述符长度(固定18)/ Descriptor length (always 18)
uint16_t idVendor
厂商ID(VID)/ Vendor ID
uint8_t iProduct
产品字符串索引 / Index of product string
uint8_t iSerialNumber
序列号字符串索引 / Index of serial number string
PacketSize0 bMaxPacketSize0
控制端点0最大包长 / Max packet size for endpoint 0
uint8_t bDeviceProtocol
协议代码 / Protocol code
USBSpec bcdUSB
USB协议版本 / USB specification release (e.g. 0x0200 for USB2.0)
uint8_t bNumConfigurations
支持的配置数 / Number of possible configurations
uint8_t iManufacturer
厂商字符串索引 / Index of manufacturer string
uint16_t bcdDevice
设备版本号 / Device release number