This fixes a problem in enumeration after a gadget function is removed.
Submitted on behalf of RaviKumar Vembu <ravi.v@motorola.com>
Signed-off-by: Jared Suttles <jared.suttles@motorola.com>
Signed-off-by: Mike Lockwood <lockwood@android.com>
int len = USB_BUFSIZ - USB_DT_CONFIG_SIZE;
struct usb_function *f;
int status;
+ int interfaceCount = 0;
/* write the config descriptor */
c = buf;
descriptors = f->hs_descriptors;
else
descriptors = f->descriptors;
- if (!descriptors)
+ if (!descriptors || descriptors[0] == NULL) {
+ for (; f != config->interface[interfaceCount];) {
+ interfaceCount++;
+ c->bNumInterfaces--;
+ }
continue;
+ }
+ for (; f != config->interface[interfaceCount];)
+ interfaceCount++;
+
status = usb_descriptor_fillbuf(next, len,
(const struct usb_descriptor_header **) descriptors);
if (status < 0)