diff options
Diffstat (limited to 'nuttx/drivers/usbdev/cdcacm.c')
-rw-r--r-- | nuttx/drivers/usbdev/cdcacm.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/nuttx/drivers/usbdev/cdcacm.c b/nuttx/drivers/usbdev/cdcacm.c index 24903b504..97c9d7c77 100644 --- a/nuttx/drivers/usbdev/cdcacm.c +++ b/nuttx/drivers/usbdev/cdcacm.c @@ -318,6 +318,7 @@ static int cdcacm_sndpacket(FAR struct cdcacm_dev_s *priv) FAR struct usbdev_ep_s *ep; FAR struct usbdev_req_s *req; FAR struct cdcacm_req_s *reqcontainer; + uint16_t reqlen; irqstate_t flags; int len; int ret = OK; @@ -337,7 +338,7 @@ static int cdcacm_sndpacket(FAR struct cdcacm_dev_s *priv) ep = priv->epbulkin; /* Loop until either (1) we run out or write requests, or (2) cdcacm_fillrequest() - * is unable to fill the request with data (i.e., untilthere is no more data + * is unable to fill the request with data (i.e., until there is no more data * to be sent). */ @@ -345,6 +346,14 @@ static int cdcacm_sndpacket(FAR struct cdcacm_dev_s *priv) priv->serdev.xmit.head, priv->serdev.xmit.tail, priv->nwrq, sq_empty(&priv->reqlist)); + /* Get the maximum number of bytes that will fit into one bulk IN request */ + +#ifdef CONFIG_CDCACM_BULKREQLEN + reqlen = MAX(CONFIG_CDCACM_BULKREQLEN, ep->maxpacket); +#else + reqlen = ep->maxpacket; +#endif + while (!sq_empty(&priv->reqlist)) { /* Peek at the request in the container at the head of the list */ @@ -354,7 +363,7 @@ static int cdcacm_sndpacket(FAR struct cdcacm_dev_s *priv) /* Fill the request with serial TX data */ - len = cdcacm_fillrequest(priv, req->buf, req->len); + len = cdcacm_fillrequest(priv, req->buf, reqlen); if (len > 0) { /* Remove the empty container from the request list */ |