Device Descriptor
The USB control transfer command you provided appears to be requesting the Device Descriptor from a USB device. Here's a breakdown of the request:
USB Control Transfer Fields
Command:
CTL 80 06 00 01 00 00 12 00
Field Name | Value | Explanation |
---|---|---|
bmRequestType | 80 |
0b10000000 : Direction = IN (Device-to-Host), Type = Standard, Recipient = Device. |
bRequest | 06 |
GET_DESCRIPTOR : Request to retrieve a descriptor. |
wValue | 00 01 |
Descriptor Type = 0x01 (Device Descriptor), Index = 0x00 . |
wIndex | 00 00 |
Index or language ID. Here, 0x0000 means the default language or no index. |
wLength | 12 00 |
Length = 0x0012 (18 bytes), which is the size of a USB Device Descriptor. |
Interpretation
This control transfer is a Get Descriptor request to retrieve the Device Descriptor from the USB device. The Device Descriptor provides general information about the USB device, such as vendor ID, product ID, device class, and supported USB version.
Expected Response
The device should return an 18-byte Device Descriptor. The structure of the Device Descriptor is as follows:
Byte Offset | Field | Size (Bytes) | Example Value | Description |
---|---|---|---|---|
0 |
bLength | 1 | 18 (0x12) |
Descriptor length (18 bytes). |
1 |
bDescriptorType | 1 | 01 |
Descriptor type (Device). |
2-3 |
bcdUSB | 2 | 0x0200 |
USB version (e.g., 2.0). |
4 |
bDeviceClass | 1 | 00 |
Device class (e.g., 0 = per interface). |
5 |
bDeviceSubClass | 1 | 00 |
Subclass (e.g., 0 = none). |
6 |
bDeviceProtocol | 1 | 00 |
Protocol (e.g., 0 = none). |
7 |
bMaxPacketSize0 | 1 | 64 |
Max packet size for endpoint 0. |
8-9 |
idVendor | 2 | 0xXXXX |
Vendor ID assigned by USB-IF. |
10-11 |
idProduct | 2 | 0xXXXX |
Product ID assigned by the vendor. |
12-13 |
bcdDevice | 2 | 0xYYYY |
Device release number. |
14 |
iManufacturer | 1 | 01 |
Index of manufacturer string. |
15 |
iProduct | 1 | 02 |
Index of product string. |
16 |
iSerialNumber | 1 | 03 |
Index of serial number string. |
17 |
bNumConfigurations | 1 | 01 |
Number of configurations. |
Command Context
This is often the first request issued by a USB host when enumerating a device. It helps the host identify the device and determine the next steps in initialization (e.g., requesting configuration or string descriptors).
If you'd like further help with parsing the response or issuing this command in a program, let me know!
The bDescriptorType
field in USB descriptors identifies the type of descriptor being referenced. It is a single byte in the descriptor that helps the host know what kind of data the descriptor contains.
Common Descriptor Types (bDescriptorType
)
Value (Hex) | Descriptor Type | Description |
---|---|---|
01 |
Device | Contains general information about the device (e.g., USB version, vendor ID). |
02 |
Configuration | Contains details about a specific configuration, including power requirements. |
03 |
String | Holds human-readable information such as manufacturer or product name (Unicode). |
04 |
Interface | Describes the interfaces supported by the device (e.g., HID, audio, etc.). |
05 |
Endpoint | Describes an endpoint's attributes (e.g., direction, type, maximum packet size). |
21 |
HID | Contains HID-specific information, such as version and descriptor links. |
22 |
HID Report | Contains a detailed structure of input, output, and feature reports for HID devices. |
23 |
HID Physical | (Optional) Describes the physical properties of the HID device (e.g., button layout). |
29 |
Hub | Contains information about a hub device and its ports. |
Where bDescriptorType
Appears
-
In the Request (
Get Descriptor
):- The Descriptor Type is specified in the high byte of the
wValue
field. - For example:
wValue = 0x0100
: Requesting the Device Descriptor.wValue = 0x2200
: Requesting the HID Report Descriptor.
- The Descriptor Type is specified in the high byte of the
-
In the Descriptor Itself:
- Each descriptor includes its own
bDescriptorType
field, which identifies the descriptor's type.
- Each descriptor includes its own
Example in a Device Descriptor
For a typical Device Descriptor:
Byte Offset | Field | Value (Hex) | Description |
---|---|---|---|
0 |
bLength | 12 |
Descriptor length (18 bytes). |
1 |
bDescriptorType | 01 |
Device Descriptor. |
In Summary
The bDescriptorType
is a key field that tells the host what kind of descriptor is being processed. The value depends on the context of the descriptor or the type requested. If you need more help identifying or using a specific bDescriptorType
, feel free to ask!
bcdUSB
Yes, the bcdUSB
field in the Device Descriptor indicates the USB specification version that the device supports. This field is a 16-bit value encoded in Binary-Coded Decimal (BCD) format.
How to Interpret bcdUSB
- Format:
0xMMmm
(BCD)- MM: Major version number
- mm: Minor version number
- For example:
0x0200
= USB version 2.00x0110
= USB version 1.10x0300
= USB version 3.00x0310
= USB version 3.10x0320
= USB version 3.2
Why bcdUSB
is Important
- This field informs the USB host (e.g., computer, hub) about the highest USB specification the device supports.
- It determines which features and speeds the device can use, such as:
- USB 1.x: Low-speed (1.5 Mbps) or Full-speed (12 Mbps).
- USB 2.0: High-speed (480 Mbps).
- USB 3.x: SuperSpeed (5 Gbps or higher, depending on the sub-version).
Example Scenario
If a USB host queries a device and receives bcdUSB = 0x0200
in the Device Descriptor:
- The device is compliant with USB 2.0.
- The host can enable USB 2.0 features like high-speed transfers.
Let me know if you need further details!
bDeviceClass
The bDeviceClass
field in the USB Device Descriptor specifies the class of the device. This helps the host system identify the device type and determine which driver to use. The value can indicate a specific class or a generic "classless" device, where the class is determined by the interfaces it contains.
Details of bDeviceClass
- Size: 1 byte
- Location: Byte 4 of the Device Descriptor
- Purpose: Defines the primary functionality or category of the device.
Key Values for bDeviceClass
Value (Hex) | Device Class | Description |
---|---|---|
00 |
Defined by Interface | The device does not specify a class at the device level. Class is defined by its interfaces. |
01 |
Audio | Audio devices (e.g., speakers, microphones). |
02 |
Communications | Communication devices (e.g., modems, network adapters). |
03 |
HID | Human Interface Devices (e.g., keyboards, mice, game controllers). |
05 |
Physical | Physical devices (e.g., force-feedback devices). |
06 |
Image | Imaging devices (e.g., scanners, cameras). |
07 |
Printer | Printers. |
08 |
Mass Storage | Storage devices (e.g., USB flash drives, external hard drives). |
09 |
Hub | USB hubs. |
0A |
CDC-Data | Data devices used with the Communications Device Class. |
0B |
Smart Card | Smart card readers. |
0D |
Content Security | Content protection devices. |
0E |
Video | Video devices (e.g., webcams). |
0F |
Personal Healthcare | Healthcare devices (e.g., thermometers, blood pressure monitors). |
10 |
Audio/Video | Multimedia devices (e.g., media players). |
DC |
Diagnostic Device | Diagnostic tools. |
E0 |
Wireless Controller | Wireless devices (e.g., Bluetooth controllers). |
EF |
Miscellaneous | Devices that do not fit into other classes. |
FF |
Vendor-Specific | The device class is vendor-defined, requiring custom drivers. |
Special Cases
-
bDeviceClass = 0x00
(Defined by Interface):- The device relies on its interfaces to define functionality.
- Each interface will have its own
bInterfaceClass
.
-
bDeviceClass = 0xFF
(Vendor-Specific):- The device implements a proprietary protocol.
- Requires a custom driver provided by the manufacturer.
How bDeviceClass
Works with bDeviceSubClass
and bDeviceProtocol
bDeviceClass
: General category of the device.bDeviceSubClass
: Subcategory within the class (specific to thebDeviceClass
).bDeviceProtocol
: Protocol within the subclass (specific tobDeviceClass
andbDeviceSubClass
).
For example:
- A Mass Storage device (
bDeviceClass = 08
) with a subClass of SCSI transparent command set (bDeviceSubClass = 06
) and a protocol of Bulk-Only Transport (bDeviceProtocol = 50
).
Example: Retrieving bDeviceClass
When you fetch the Device Descriptor, the bDeviceClass
field is at offset 4:
Byte Offset | Field | Value | Description |
---|---|---|---|
4 |
bDeviceClass | 08 |
Mass Storage Device. |
If you’re working with a USB device and want to parse its descriptors, let me know—I can assist further!
idVendor ==> VID
idProduct --> PID
bcdDevice Device revision (e.g., 2.01). |
iProduct Index of product string.
iSerialNumber Index of serial number string.
|
留言