/* This function will find an usb configuration object. */
uconfig_t rt_usbd_find_config(udevice_t device, rt_uint8_t value)
/* This function will find an usb configuration object. */
uconfig_t rt_usbd_find_config(udevice_t device, rt_uint8_t value)
{
    struct rt_list_node* node;
    uconfig_t cfg = RT_NULL;
    LOG_D("rt_usbd_find_config");
    RT_ASSERT(device != RT_NULL);
    RT_ASSERT(value <= device->dev_desc.bNumConfigurations);
    for (node = device->cfg_list.next; node != &device->cfg_list; node = node->next)
    {
        cfg = (uconfig_t)rt_list_entry(node, struct udevice, list);
        if(cfg->cfg_desc.bConfigurationValue == value)
        {
            return cfg;
        }
    }
    rt_kprintf("can't find configuration %d\n", value);
    return RT_NULL;
}