Change USB strings handling code

This commit add an extra field to the _usbd_device, that allows to
keep track of the number of USB strings  which allows simplify
boundaries checking code in usb_standard_get_descriptor.

This commit also changes the index base for strings in
usb_standard_get_descriptor which allows to get rid of necessity to
have a dummy one-character string in a strings array.
This commit is contained in:
Andrey Smirnov
2012-11-06 16:46:55 -08:00
parent 74405de4a5
commit 7a5da60e26
4 changed files with 16 additions and 13 deletions

View File

@@ -29,6 +29,7 @@ extern struct _usbd_device {
const struct usb_device_descriptor *desc;
const struct usb_config_descriptor *config;
const char **strings;
int num_strings;
u8 *ctrl_buf; /**< Internal buffer used for control transfers */
u16 ctrl_buf_len;