是的,已经解决了,本来只是想要确认USBX是不是真的会枚举全部接口,因为我本身对USB的理解不深。我是在修改了这个枚举的函数,红色部分是我增加的地方,这个函数意味着,这个被枚举的接口,如果检测到没有主机驱动,那就把他所占用的资源释放掉。
我只是测试了能够枚举成功,并没有做进一步测试。因为之前甚至连枚举都无法成功,因为PIPE超出了。
[C] 纯文本查看 复制代码 UINT _ux_host_stack_configuration_instance_create(UX_CONFIGURATION *configuration)
{
UX_INTERFACE *interface;
UINT status;
/* If trace is enabled, insert this event into the trace buffer. */
UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_STACK_CONFIGURATION_INSTANCE_CREATE, configuration, 0, 0, 0, UX_TRACE_HOST_STACK_EVENTS, 0, 0)
/* Obtain the first interface for this configuration. */
interface = configuration -> ux_configuration_first_interface;
/* Each selected alternate setting 0 for each interface must be created. */
while (interface != UX_NULL)
{
/* Check if we are dealing with the first alternate setting. */
if (interface -> ux_interface_descriptor.bAlternateSetting == 0)
{
/* Create the interface. */
status = _ux_host_stack_interface_instance_create(interface);
[color=Red] if(interface->ux_interface_class == NULL)
{
_ux_host_stack_interface_instance_delete(interface);
}[/color]
/* Check status, the controller may have refused the endpoint creation. */
if (status != UX_SUCCESS)
/* An error occurred. The interface cannot be mounted. */
return(status);
}
/* Next interface. */
interface = interface -> ux_interface_next_interface;
}
/* Return successful completion. */
return(UX_SUCCESS);
} |