/* This function will find an usb interface object. */
uintf_t rt_usbd_find_interface(udevice_t device, rt_uint8_t value, ufunction_t *pfunc)
/* This function will find an usb interface object. */
uintf_t rt_usbd_find_interface(udevice_t device, rt_uint8_t value, ufunction_t *pfunc)
{
    struct rt_list_node *i, *j;
    ufunction_t func;
    uintf_t intf;
    LOG_D("rt_usbd_find_interface");
    RT_ASSERT(device != RT_NULL);
    RT_ASSERT(value < device->nr_intf);
    for (i=device->curr_cfg->func_list.next;
            i!=&device->curr_cfg->func_list; i=i->next)
    {
        func = (ufunction_t)rt_list_entry(i, struct ufunction, list);
        for(j=func->intf_list.next; j!=&func->intf_list; j=j->next)
        {
            intf = (uintf_t)rt_list_entry(j, struct uinterface, list);
            if(intf->intf_num == value)
            {
                if (pfunc != RT_NULL)
                    *pfunc = func;
                return intf;
            }
        }
    }
    rt_kprintf("can't find interface %d\n", value);
    return RT_NULL;
}