【USB描述符系列】U盘
简介
读取了一下手头一个USB3.0的U盘的USB描述符,U盘接到了电脑的USB2.0口上,作为USB2.0设备使用。从描述符上看,相对不是很复杂,一个interface,两个endpoint。毕竟U盘的主要信息还是通过Mass Storage Class Request来获取。详细的看USB描述符。
下面是这个U盘接到USB2.0口上的USB描述符。
Device Descriptor
Offset | Field | Size | Value | Description |
---|
0 | bLength | 1 | 12h | Size of this descriptor |
1 | bDescriptorType | 1 | 01h | Device |
2 | bcdUSB | 2 | 0210h | 2.10 |
4 | bDeviceClass | 1 | 00h | Class info in Ifc Descriptors |
5 | bDeviceSubClass | 1 | 00h | Unused |
6 | bDeviceProtocol | 1 | 00h | Unused |
7 | bMaxPacketSize0 | 1 | 40h | 64 bytes |
8 | idVendor | 2 | 0951h | Vendor ID |
10 | idProduct | 2 | 1666h | Product ID |
12 | bcdDevice | 2 | 0110h | 1.10 |
14 | iManufacturer | 1 | 01h | Index to string descriptor that contains the string < Your Name > in Unicode |
15 | iProduct | 1 | 02h | Index to string descriptor that contains the string < Your Product Name > in Unicode |
16 | iSerialNumber | 1 | 03h | Index to string descriptor that contains the string < Your Serial Number > in Unicode |
17 | bNumConfigurations | 1 | 01h | One configuration |
Device Qualifier Descriptor
Offset | Field | Size | Value | Description |
---|
0 | bLength | 1 | 0Ah | Size of descriptor |
1 | bDescriptorType | 1 | 06h | Device Qualifier |
2 | bcdUSB | 2 | 0200h | USB Spec 2.0 |
4 | bDeviceClass | 1 | 00h | Class info in Ifc Descriptors |
5 | bDeviceSubClass | 1 | 00h | Unused |
6 | bDeviceProtocol | 1 | 00h | Unused |
7 | bMaxPacketSize0 | 1 | 40h | 64 bytes |
8 | bNumConfigurations | 1 | 01h | Number of Other-speed Configurations |
9 | bReserved | 1 | 00h | Unused |
Configuration Descriptor
Offset | Field | Size | Value | Description |
---|
0 | bLength | 1 | 09h | Size of this descriptor |
1 | bDescriptorType | 1 | 02h | Configuration |
2 | wTotalLength | 2 | 0020h | Length of the total configuration block, including this descriptor, in bytes |
4 | bNumInterfaces | 1 | 01h | One interfaces |
5 | bConfigurationValue | 1 | 01h | ID of this configuration |
6 | iConfiguration | 1 | 00h | Unused |
7 | bmAttributes | 1 | 80h | Bus Powered |
| 4…0: Reserved | | . . . 00000 | Unused |
| 5: Remote Wakeup | | . .0 . . . . . | No |
| 6: Self Powered | | . 0 . . . . . . | No, Bus Powered |
| 7: Reserved (set to one) (bus-powered for 1.0) | | 1 . . . . . . . | Unused |
8 | bMaxPower | 1 | 96h | 300 mA |
Interface Descriptor 0/0 Mass Storage, 2 Endpoints
Offset | Field | Size | Value | Description |
---|
0 | bLength | 1 | 09h | Size of this descriptor |
1 | bDescriptorType | 1 | 04h | Interface |
2 | bInterfaceNumber | 1 | 00h | Index of this interface |
3 | bAlternateSetting | 1 | 00h | Index of this setting |
4 | bNumEndpoints | 1 | 02h | 2 endpoints |
5 | bInterfaceClass | 1 | 08h | Mass Storage |
6 | bInterfaceSubClass | 1 | 06h | SCSI Transparent Command Set |
7 | bInterfaceProtocol | 1 | 50h | Bulk-Only Transport |
8 | iInterface | 1 | 00h | Unused |
Endpoint Descriptor 81 1 In, Bulk, 512 bytes
Offset | Field | Size | Value | Description |
---|
0 | bLength | 1 | 07h | Size of this descriptor |
1 | bDescriptorType | 1 | 05h | Endpoint |
2 | bEndpointAddress | 1 | 81h | 1 In |
3 | bmAttributes | 1 | 02h | Bulk |
| 1…0: Transfer Type | | . . . . . .10 | Bulk |
| 7…2: Reserved | | 000000 . . | Unused |
4 | wMaxPacketSize | 2 | 0200h | 512 bytes |
6 | bInterval | 1 | 00h | Unused |
Endpoint Descriptor 02 2 Out, Bulk, 512 bytes
Offset | Field | Size | Value | Description |
---|
0 | bLength | 1 | 07h | Size of this descriptor |
1 | bDescriptorType | 1 | 05h | Endpoint |
2 | bEndpointAddress | 1 | 02h | 2 Out |
3 | bmAttributes | 1 | 02h | Bulk |
| 1…0: Transfer Type | | . . . . . .10 | Bulk |
| 7…2: Reserved | | 000000 . . | Unused |
4 | wMaxPacketSize | 2 | 0200h | 512 bytes |
6 | bInterval | 1 | 00h | Unused |
Other Speed Configuration Descriptor
Offset | Field | Size | Value | Description |
---|
0 | bLength | 1 | 09h | Size of this descriptor |
1 | bDescriptorType | 1 | 07h | Other Speed Configuration |
2 | wTotalLength | 2 | 0020h | Total length of data returned |
4 | bNumInterfaces | 1 | 01h | One interfaces |
5 | bConfigurationValue | 1 | 01h | ID of this configuration |
6 | iConfiguration | 1 | 00h | Unused |
7 | bmAttributes | 1 | 80h | Bus Powered |
| 4…0: Reserved | | . . . 00000 | Unused |
| 5: Remote Wakeup | | . .0 . . . . . | No |
| 6: Self Powered | | . 0 . . . . . . | No, Bus Powered |
| 7: Reserved (set to one) (bus-powered for 1.0) | | 1 . . . . . . . | Unused |
8 | bMaxPower | 1 | 00h | Unused |
Interface Descriptor 0/0 Mass Storage, 2 Endpoints
Offset | Field | Size | Value | Description |
---|
0 | bLength | 1 | 09h | Size of this descriptor |
1 | bDescriptorType | 1 | 04h | Interface |
2 | bInterfaceNumber | 1 | 00h | Index of this interface |
3 | bAlternateSetting | 1 | 00h | Index of this setting |
4 | bNumEndpoints | 1 | 02h | 2 endpoints |
5 | bInterfaceClass | 1 | 08h | Mass Storage |
6 | bInterfaceSubClass | 1 | 06h | SCSI Transparent Command Set |
7 | bInterfaceProtocol | 1 | 50h | Bulk-Only Transport |
8 | iInterface | 1 | 00h | Unused |
Endpoint Descriptor 81 1 In, Bulk, 64 bytes
Offset | Field | Size | Value | Description |
---|
0 | bLength | 1 | 07h | Size of this descriptor |
1 | bDescriptorType | 1 | 05h | Endpoint |
2 | bEndpointAddress | 1 | 81h | 1 In |
3 | bmAttributes | 1 | 02h | Bulk |
| 1…0: Transfer Type | | . . . . . .10 | Bulk |
| 7…2: Reserved | | 000000 . . | Unused |
4 | wMaxPacketSize | 2 | 0040h | 64 bytes |
6 | bInterval | 1 | 00h | Unused |
Endpoint Descriptor 02 2 Out, Bulk, 64 bytes
Offset | Field | Size | Value | Description |
---|
0 | bLength | 1 | 07h | Size of this descriptor |
1 | bDescriptorType | 1 | 05h | Endpoint |
2 | bEndpointAddress | 1 | 02h | 2 Out |
3 | bmAttributes | 1 | 02h | Bulk |
| 1…0: Transfer Type | | . . . . . .10 | Bulk |
| 7…2: Reserved | | 000000 . . | Unused |
4 | wMaxPacketSize | 2 | 0040h | 64 bytes |
6 | bInterval | 1 | 00h | Unused |
本文链接:https://blog.csdn.net/u012028275/article/details/118881469