usb: Added support for Interface Association descriptors.

This commit is contained in:
Gareth McMullin
2011-12-28 21:04:36 +13:00
parent 651917aeb4
commit 0731bba610
2 changed files with 30 additions and 1 deletions

View File

@@ -41,10 +41,20 @@ static u16 build_config_descriptor(u8 index, u8 *buf, u16 len)
/* For each interface... */
for (i = 0; i < cfg->bNumInterfaces; i++) {
/* Interface Association Descriptor, if any */
if (cfg->interface[i].iface_assoc) {
const struct usb_iface_assoc_descriptor *assoc =
cfg->interface[i].iface_assoc;
memcpy(buf, assoc, count = MIN(len, assoc->bLength));
buf += count;
len -= count;
total += count;
totallen += assoc->bLength;
}
/* For each alternate setting... */
for (j = 0; j < cfg->interface[i].num_altsetting; j++) {
const struct usb_interface_descriptor *iface =
&cfg->interface[i].altsetting[j];
&cfg->interface[i].altsetting[j];
/* Copy interface descriptor. */
memcpy(buf, iface, count = MIN(len, iface->bLength));
buf += count;