USB host composite: Fix places where the wrong pointer was used; Add a test for an error condition.

This commit is contained in:
Gregory Nutt 2016-08-30 13:58:01 -06:00
parent ac623abc7d
commit aa0d1868f5

View file

@ -341,11 +341,11 @@ static int usbhost_copyinterface(uint8_t ifno, FAR const uint8_t *configdesc,
offset += len)
{
epdesc = (FAR struct usb_epdesc_s *)&configdesc[offset];
len = ifdesc->len;
len = epdesc->len;
/* Is this an endpoint descriptor? */
if (ifdesc->type == USB_DESC_TYPE_ENDPOINT)
if (epdesc->type == USB_DESC_TYPE_ENDPOINT)
{
/* Yes.. return the endpoint descriptor */
@ -363,6 +363,17 @@ static int usbhost_copyinterface(uint8_t ifno, FAR const uint8_t *configdesc,
return retsize;
}
}
/* The endpoint descriptors following the interface descriptor
* should all be contiguous. But we will complain only if another
* interface descriptor is encountered before all of the endpoint
* descriptors have been found.
*/
else if (epdesc->type == USB_DESC_TYPE_INTERFACE)
{
break;
}
}
/* Did not find all of the interface descriptors */