Fix to handle requests larger than maxpacket

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1076 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2008-10-25 14:40:01 +00:00
parent a6944dfe49
commit 032393ae43
2 changed files with 12 additions and 6 deletions

View File

@ -970,15 +970,18 @@ static int dm320_wrrequest(struct dm320_ep_s *privep)
* bytes to send.
*/
privep->txnullpkt = 0;
if (bytesleft > privep->ep.maxpacket)
{
nbytes = privep->ep.maxpacket;
privep->txnullpkt = 0;
}
else
{
nbytes = bytesleft;
privep->txnullpkt = (bytesleft == privep->ep.maxpacket);
if ((privreq->req.flags & USBDEV_REQFLAGS_NULLPKT) != 0)
{
privep->txnullpkt = (bytesleft == privep->ep.maxpacket);
}
}
/* Send the largest number of bytes that we can in this packet */
@ -1000,7 +1003,7 @@ static int dm320_wrrequest(struct dm320_ep_s *privep)
* then we are finished with the transfer
*/
if (bytesleft <= 0 || !privep->txnullpkt)
if (bytesleft <= 0 && !privep->txnullpkt)
{
usbtrace(TRACE_COMPLETE(privep->epphy), privreq->req.xfrd);
privep->txnullpkt = 0;

View File

@ -1062,15 +1062,18 @@ static int lpc214x_wrrequest(struct lpc214x_ep_s *privep)
* bytes to send.
*/
privep->txnullpkt = 0;
if (bytesleft > privep->ep.maxpacket)
{
nbytes = privep->ep.maxpacket;
privep->txnullpkt = 0;
}
else
{
nbytes = bytesleft;
privep->txnullpkt = (bytesleft == privep->ep.maxpacket);
if ((privreq->req.flags & USBDEV_REQFLAGS_NULLPKT) != 0)
{
privep->txnullpkt = (bytesleft == privep->ep.maxpacket);
}
}
/* Send the largest number of bytes that we can in this packet */
@ -1087,7 +1090,7 @@ static int lpc214x_wrrequest(struct lpc214x_ep_s *privep)
* then we are finished with the transfer
*/
if (bytesleft <= 0 || !privep->txnullpkt)
if (bytesleft <= 0 && !privep->txnullpkt)
{
usbtrace(TRACE_COMPLETE(privep->epphy), privreq->req.xfrd);
privep->txnullpkt = 0;