sys/bus/usb/usbdi_util.c
const usb_descriptor_t *
usb_find_desc_if(usbd_device_handle dev, int type, int subtype,
		 usb_interface_descriptor_t *id)
{
	usbd_desc_iter_t iter;
	const usb_descriptor_t *desc;

	usb_desc_iter_init(dev, &iter);

	iter.cur = (void *)id;		/* start from the interface desc */
	usb_desc_iter_next(&iter);	/* and skip it */

	while ((desc = usb_desc_iter_next(&iter)) != NULL) {
		if (desc->bDescriptorType == UDESC_INTERFACE) {
			/* we ran into the next interface --- not found */
			return NULL;
		}
		if (desc->bDescriptorType == type &&
		     (subtype == USBD_SUBTYPE_ANY ||
		      subtype == desc->bDescriptorSubtype))
			break;
	}
	return desc;
}
/* same as usb_find_desc(), but searches only in the specified interface. */
same as usb_find_desc(), but searches only in the specified interface.
same as usb_find_desc () but searches only in the specified interface .
const usb_descriptor_t *
usb_find_desc_if(usbd_device_handle dev, int type, int subtype,
		 usb_interface_descriptor_t *id)
{
	usbd_desc_iter_t iter;
	const usb_descriptor_t *desc;
	usb_desc_iter_init(dev, &iter);
	iter.cur = (void *)id;		
	usb_desc_iter_next(&iter);	
	while ((desc = usb_desc_iter_next(&iter)) != NULL) {
		if (desc->bDescriptorType == UDESC_INTERFACE) {
			return NULL;
		}
		if (desc->bDescriptorType == type &&
		     (subtype == USBD_SUBTYPE_ANY ||
		      subtype == desc->bDescriptorSubtype))
			break;
	}
	return desc;
}
const usb_descriptor_t * usb_find_desc_if ( usbd_device_handle dev , int type , int subtype , usb_interface_descriptor_t * id ) { usbd_desc_iter_t iter ; const usb_descriptor_t * desc ; usb_desc_iter_init ( dev , & iter ) ; iter . cur = ( void * ) id ; usb_desc_iter_next ( & iter ) ; while ( ( desc = usb_desc_iter_next ( & iter ) ) != NULL ) { if ( desc -> bDescriptorType == UDESC_INTERFACE ) { return NULL ; } if ( desc -> bDescriptorType == type && ( subtype == USBD_SUBTYPE_ANY || subtype == desc -> bDescriptorSubtype ) ) break ; } return desc ; }
same as usb_find_desc(), but searches only in the specified interface.
same as usb_find_desc () but searches only in the specified interface .
/* start from the interface desc */ /* and skip it */ /* we ran into the next interface --- not found */