USB Component
Version 6.17.0
MDK Middleware for USB Device and Host Communication
|
String descriptors (USB_STRING_DESCRIPTOR) are optional and add human readable information to the other descriptors. If a device does not support string descriptors, all references to string descriptors within device, configuration, and interface descriptors must be set to zero.
String descriptors are encoded in Unicode so that multiple languages can be supported with a single product. When requesting a string descriptor, the requester specifies the desired language using a 16-bit language ID (LANGID) defined by the USB-IF. String index zero is used for all languages and returns a string descriptor that contains an array of two-byte LANGID codes supported by the device.
The array of LANGID codes is not NULL-terminated. The size of the array (in byte) is computed by subtracting two from the value of the first byte to the descriptor.
Offset | Field | Type | Size | Value | Description |
---|---|---|---|---|---|
0 | bLength | uint8_t | N + 2 | Number | Size of this descriptor in bytes. |
1 | bDescriptorType | uint8_t | 1 | Constant | String Descriptor Type |
2 | wLANGID[0] | uint8_t | 2 | Number | LANGID code zero (for example 0x0407 German (Standard)). |
... | ... | ... | ... | ... | ... |
N | wLANGID[x] | uint8_t | 2 | Number | LANGID code zero x (for example 0x0409 English (United States)). |
The UNICODE string descriptor is not NULL-terminated. The string length is computed by subtracting two from the value of the first byte of the descriptor.
Offset | Field | Type | Size | Value | Description |
---|---|---|---|---|---|
0 | bLength | uint8_t | 1 | Number | Size of this descriptor in bytes. |
1 | bDescriptorType | uint8_t | 1 | Constant | String Descriptor Type |
2 | bString | uint8_t | N | Number | UNICODE encoded string. |