Книга: Advanced PIC Microcontroller Projects in C
8.4.3 Interface Descriptors
8.4.3 Interface Descriptors
The interface descriptors specify the class of the interface and the number of endpoints it uses. There may be more than one interface.
Table 8.9 shows the format of the interface descriptor with the meaning of each field.
Table 8.9: Interface descriptor
Offset | Field | Size | Description |
---|---|---|---|
0 | bLength | 1 | Descriptor size in bytes |
1 | bDescriptorType | 1 | Device descriptor (0x04) |
2 | bInterfaceNumber | 1 | Number of interface |
3 | bAlternateSetting | 1 | Value to select alternate setting |
4 | bNumEndpoints | 1 | Number of endpoints |
5 | bInterfaceClass | 1 | Class code |
6 | bInterfaceSubClass | 1 | Subclass code |
7 | bInterfaceProtocol | 1 | Protocol code |
8 | iInterface | 1 | Index of string descriptor to interface |
bLength is the length of the device descriptor.
bDescriptorType is the descriptor type.
bInterfaceNumber indicates the index of the interface descriptor.
bAlternateSetting can be used to specify alternate interfaces that can be selected by the host using command Set Interface.
bNumEndpoints indicates the number of endpoints used by the interface.
bInterfaceClass specifies the device class code (assigned by the USB organization).
bInterfaceSubClass specifies the device subclass code (assigned by the USB organization).
bInterfaceProtocol specifies the device protocol code (assigned by the USB organization).
iInterface is an index to a string descriptor of the interface.
Table 8.10 shows an example interface descriptor for a mouse device. The descriptor length is 9 bytes (bLength=9) and the descriptor type is 0x04 (bDescriptorType=0x04). The interface number used to reference this interface is 1 (bInterfaceNumber=1).
Table 8.10: Example interface descriptor
Offset | Field | Value | Description |
---|---|---|---|
0 | bLength | 9 | Descriptor size is 9 bytes |
1 | bDescriptorType | 0x04 | Device descriptor is 0x04 |
2 | bInterfaceNumber | 0 | Number of interface |
3 | bAlternateSetting | 0 | Value to select alternate setting |
4 | bNumEndpoints | 1 | Number of endpoints is 1 |
5 | bInterfaceClass | 0x03 | Class code is 0x03 |
6 | bInterfaceSubClass | 0x02 | Subclass code is 0x02 |
7 | bInterfaceProtocol | 0x02 | Protocol code is 0x02 |
8 | iInterface | 0 | Index of string descriptor to interface |
bAlternateSetting is set to 0 (i.e., no alternate interfaces). The number of endpoints used by this interface is 1 (excluding endpoint 0), and this is the endpoint used for the mouse to send its data. The device class code is 0x03 (bInterfaceClass=0x03). This is an HID (human interface device) type class. The interface subclass is set to 0x02. The device protocol is 0x02 (mouse). There is no string to describe this interface (iInterface=0).
- 8.4 Descriptors
- 8.4.1 Device Descriptors
- 8.4.2 Configuration Descriptors
- 8.4.4 HID Descriptors
- 8.4.5 Endpoint Descriptors
- Interface Configuration for IP
- Chapter 15. Graphical User Interfaces for Iptables
- Displaying Interface Statistics
- QueryInterface и IUnknown
- 5.1.2. The Directory Server Interface
- Command-Line Network Interface Configuration
- Laying the Foundation: The localhost Interface