Strings, Usbsenumerationdata – Comtrol eCos User Manual
Page 688

USB Enumeration Data
Strings
The enumeration data can contain a number of strings with additional information. Unicode encoding is used for
the strings, and it is possible for a peripheral to supply a given string in multiple languages using the appropriate
characters. The first two bytes of each string give a length and type field. The first string is special; after the two
bytes header it consists of an array of 2-byte language id codes, indicating the supported languages. The language
code 0x0409 corresponds to English (United States).
const unsigned char* usb_strings[] = {
"\004\003\011\004",
"\020\003R\000e\000d\000 \000H\000a\000t\000"
};
const usbs_enumeration_data usb_enum_data = {
...
total_number_strings:
2,
strings:
usb_strings,
...
};
The default handler for standard control messages assumes that the peripheral only uses a single language. If this is
not the case then higher-level code will have to handle the standard get-descriptor control messages when a string
descriptor is requested.
usbs_enumeration_data
The usbs_enumeration_data data structure collects together all the various descriptors that make up the enumeration
data. It is the responsibility of application code to supply a suitable data structure and install it in the control
endpoints’s
enumeration_data
field before the USB device is started.
584