Fix STM32F1 and F3 USB device driver. It was not handling NULL packets correctly and it prevent use of the driver with the CDC/ACM class

This commit is contained in:
Gregory Nutt 2013-05-29 10:26:00 -06:00
parent 9336f73aa1
commit 011a14e39d
1 changed files with 10 additions and 2 deletions

View File

@ -1253,7 +1253,16 @@ static int stm32_wrrequest(struct stm32_usbdev_s *priv, struct stm32_ep_s *prive
#warning "REVISIT: If the EP supports double buffering, then we can do better"
/* Send the next packet */
/* Either (1) we are committed to sending the null packet (because txnullpkt == 1
* && nbytes == 0), or (2) we have not yet send the last packet (nbytes > 0).
* In either case, it is appropriate to clearn txnullpkt now.
*/
privep->txnullpkt = 0;
/* If we are not sending a NULL packet, then clip the size to maxpacket
* and check if we need to send a following NULL packet.
*/
if (nbytes > 0)
{
@ -1261,7 +1270,6 @@ static int stm32_wrrequest(struct stm32_usbdev_s *priv, struct stm32_ep_s *prive
* the request.
*/
privep->txnullpkt = 0;
if (nbytes >= privep->ep.maxpacket)
{
nbytes = privep->ep.maxpacket;