RT-Thread / RT-Thread/rt-thread
rt_usbd_find_config() 函数一个错误
Open
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 12.2k
- Forks
- 5.4k
- Avg merge
- 4d 12h
- Merged PRs (30d)
- 40
Description
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;
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating rt_usbd_find_config() in the USB device code and inspect the list-entry cast against its uconfig_t return type. Verify that configuration lookup still matches bConfigurationValue after the correction, then run the relevant USB or RTOS tests if available; done means the function returns the expected configuration without a type mismatch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100