spiriou commented on pull request #2097:
URL: https://github.com/apache/incubator-nuttx/pull/2097#issuecomment-716179822


   > > Can someone help me on this topic ?
   > > Should I implement the fix in composite_ep0submit() instead ?
   > 
   > Hi Simon, could you please describe more clearly the issue you were facing 
and why do you implement this way?
   > 
   > Looking the code it appears that you modified the set configuration to 
reset the previous set device case an error happening setting a device. But 
your comment about endpoint 0 (EP0) shouldn't be set is not clear. Do you have 
some point for the spec that explain about it?
   
   The issue occurs when the host sends USB_REQ_SETCONFIGURATION to select a 
USB configuration on NuttX device. The current behaviour is that the 
USB_REQ_SETCONFIGURATION is forwarded to the usb device drivers 
(CLASS_SETUP()), with is good.
   The issue is that all the device drivers will then submit the result to EP0. 
This leads to a situation where you are trying to submit multiple times on EP0, 
But the host PC only expects one reply to know if the USB_REQ_SETCONFIGURATION 
request is ok or not.
   On stm32, multiple calls to EP0_SUBMIT leads to memory corruption. I did not 
try on other devices.
   
   The solution would be to check the return value of CLASS_SETUP() calls in 
composite driver for each USB_REQ_SETCONFIGURATION, and let the composite 
driver manage the EP0_SUBMIT in the end.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to