davids5 commented on a change in pull request #3162:
URL: https://github.com/apache/incubator-nuttx/pull/3162#discussion_r600445613
##########
File path: arch/arm/src/stm32/stm32_otgfsdev.c
##########
@@ -1587,22 +1587,46 @@ static inline void stm32_ep0out_receive(FAR struct
stm32_ep_s *privep,
if (priv->ep0state == EP0STATE_SETUP_OUT)
{
- /* Read the data into our special buffer for SETUP data */
+ if (priv->ep0datlen < CONFIG_USBDEV_SETUP_MAXDATASIZE)
+ {
+ /* Read the data into our special buffer for SETUP data */
- int readlen = MIN(CONFIG_USBDEV_SETUP_MAXDATASIZE, bcnt);
- stm32_rxfifo_read(privep, priv->ep0data, readlen);
+ int bufspace = CONFIG_USBDEV_SETUP_MAXDATASIZE - priv->ep0datlen;
+ int readlen = MIN(bufspace, bcnt);
+ stm32_rxfifo_read(privep, priv->ep0data, readlen);
+ priv->ep0datlen += readlen;
+ bcnt -= readlen;
+ }
/* Do we have to discard any excess bytes? */
- stm32_rxfifo_discard(privep, bcnt - readlen);
+ if (bcnt > 0)
+ {
+ stm32_rxfifo_discard(privep, bcnt);
+ priv->ep0datlen += bcnt;
Review comment:
@PetteriAimonen - Thank you, do you think it is worthwhile to update
https://github.com/apache/incubator-nuttx/blob/6b16ecf8142001a930f24de8b6e4e76b6b75da4c/arch/arm/src/stm32/stm32_otgfsdev.c#L491-L493
to reflect the change?
Length of OUT DATA **received** in ep0data[]
--
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:
[email protected]