Thursday, January 1, 2015

USB getConfigurationDescription

Let's continue by receiving the descriptor for configuration 1 (the only configuration supplied by the device)
4002 0105 0900 2002 0224 0604 0120 0130 0103 2409 0001 1001 4002 0324 0903 1001 0224 0600 2501 0001 2407 0000 0301 0200 0004 0932 8000 0101 0053 0209 
Byte Field Value Meaning
0 bLength 0x09 The Configuration description consists of 9 bytes
1 bDescriptorType 0x02 Descriptor type CONFIGURATION
2-3 wTotalLength 0x0053 Total length of configuration, including descriptors for configuration, interfaces and endpoints
4 bNumInterfaces 0x01 Configuration has 1 interface
5 bConfigurationValue 0x01 The value of this configuration is 1
6 iConfiguration 0x00 String index 0 describes this configuration
7 bmAttributes 0x80 Device powered by bus and has no remote wake up feature
8 bMaxPower 0x32 Max power consumption is 50*2mA = 100mA

The rest of the supplied data should be descriptors for interfaces and endpoints:

Interface descriptor

This descriptor starts with byte 9 in the data above. The first value is the length of the descriptor, which we can see is 0x09. That means that the data to interpret is:
0000 0301 0200 0004 09

Byte Field Value Meaning
0 bLength 0x09 The Interface description consists of 9 bytes
1 bDescriptorType 0x04 Descriptor type INTERFACE
2 bInterfaceNumber 0x00 Interface is number 0
3 bAlternateSetting 0x00 Value to select this alternate setting
4 bNumEndpoints 0x02 This interface uses two endpoints
5 bInterfaceClass 0x01 Interface class is 1
6 bInterfaceSubClass 0x03 Interface sub class is 3
7 bInterfaceProtocol 0x00 Device does not use class-specific protocol
8 iInterface 0x00 String index for this descriptor is 0

Now, the next entry puzzles me, descriptor is of type 0x24. I found this post, that explaines that this is a class specific interface descriptor. I'll have to look into this some more.



No comments:

Post a Comment