RT-Thread / rt-thread

RT-Thread is an open source IoT Real-Time Operating System (RTOS).
https://www.rt-thread.io
Apache License 2.0
10.47k stars 5.01k forks source link

rt_usbd_find_config() 函数一个错误 #6539

Open xbd119 opened 2 years ago

xbd119 commented 2 years ago

uconfig_t rt_usbd_find_config(udevice_t device, rt_uint8_t value) { struct rt_list_node* node; uconfig_t cfg = RT_NULL;

RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbd_find_config\n"));

/* parameter check */
RT_ASSERT(device != RT_NULL);
RT_ASSERT(value <= device->dev_desc.bNumConfigurations);

/* search a configration in the the device */
for (node = device->cfg_list.next; node != &device->cfg_list; node = node->next)
{
    cfg = (uconfig_t)rt_list_entry(node, struct udevice, list);                                           //**udevice 应该改为uconfig_t**
    if(cfg->cfg_desc.bConfigurationValue == value)
    {
        return cfg;
    }
}

rt_kprintf("can't find configuration %d\n", value);
return RT_NULL;

}

mysterywolf commented 2 years ago

欢迎提交PR 谢谢反馈