Possible device postinit bug in the USB 5.0 stack

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Possible device postinit bug in the USB 5.0 stack

1,069 次查看
johnstrohm
Contributor III

Routine usb_dci_khci_postinit() enables the D+ pullup resistor, enables the USB module, and clears the Suspend condition on the bus.  Presumably, there is an equivalent routine in ehci_dev.c, but I haven't looked for it.

usb_dci_khci_postinit() is called through usb_device_postinit().

Every device class driver's class init routine includes a call to usb_device_postinit().

That specifically includes usb_composite.c, the Composite device class driver.

This means that a composite device is going to issue several calls to usb_device_postinit().  This is probably OK for now, until/unless someone adds code to the routine that should only be executed once.

Suggested fix:  Wrap the calls in usb_audio.c, usb_dfu.c, usb_hid.c, usb_msc.c, ..., in #if !USBCFG_DEV_COMPOSITE/#endif pairs.  This guarantees that devices compiled as standalone devices (not composite) will execute the call as always, and composite devices will only execute the call in usb_composite.c.

标签 (2)
标记 (2)
0 项奖励
回复
1 回复

811 次查看
Kan_Li
NXP TechSupport
NXP TechSupport

Hi John,

Thanks for the suggestion! I will forward this to our USB stack develop team.

Thanks again and Best Regards,

Kan

0 项奖励
回复