
AN1886 - APPLICATION NOTE
16/54
A device may return class- or vendor-specific descriptors in two ways.
If the class or vendor specific descriptors use the same format as standard descriptors (for example,
they start with a length byte, followed by a type byte), they may be returned interleaved with standard
descriptors in the configuration information returned by a GetDescriptor(Configuration) request. In this
case, the class or vendor-specific descriptors typically follow a related standard descriptor that they
modify or extend.
If the class or vendor specific descriptors are independent of configuration information, or use a non-
standard format, a GetDescriptor() request specifying the class or vendor specific descriptor type and
index may be used to retrieve the descriptor from the device. A class or vendor specification will define
the appropriate way to retrieve these descriptors.
GET_Descriptor Request Servicing Routine
The
Get_descriptor
request is serviced in
uPSD_USB.c/OnGetDescriptor
routine. This routine is shown
in
APPENDIX D.
.
Descriptors
The format of all USB descriptors is given by the USB specification standards, and all the descriptors can
be found in file
USB_DESC.C
. This can have the following content:
■
■
const uchar code string1Desc[];
const uchar code string2Desc[];
const uchar code string3Desc[];
const uchar code stringXDesc[];
Next, the
Report
descriptor contains the HID report information that is shown in
APPENDIX E.
.
The descriptor area can also contain physical descriptors. A physical descriptor is a data structure that
provides information about the specific part, or parts, of the human body that are activating a control or
controls. For example, a physical descriptor might indicate that the right hand thumb is used to activate
button 5. An application can use this information to assign functionality to the controls of a device. Note
that physical descriptors are entirely optional. They add complexity, and offer very little in return for most
devices. However, some devices, particularly those with a large number of identical controls (for example,
buttons) will find that physical descriptors help different applications assign functionality to these controls
in a more consistent manner. See the HID standard for more information. In the USB demonstration pro-
gram, it is defined as an empty descriptor:
const uchar code PhysicalReportDesc[] =
{
0,0,0 // no physical descriptor defined now
};
const uchar code PhysicalReportDescSize = sizeof(PhysicalReportDesc);
Next, the
Device
descriptor contains detailed information about the USB device, and supported endpoints.
This routine is shown in
APPENDIX F.
.
Next, each of the String descriptors contains important strings defining the USB device. String descriptors
are optional. As noted previously, if a device does not support string descriptors, all references to string
descriptors within device, configuration, and interface descriptors must be reset to zero. String descriptors
use
Unicode
encoding
.
The strings in a USB device may support multiple languages. When requesting a
string descriptor, the requester specifies the desired language using a sixteen-bit language
ID (LANGID)
defined by
Microsoft for Windows
as described in
Developing International Software for Windows 95 and
Windows NT.