summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-10-27 22:45:55 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-10-27 22:45:55 +0000
commit487a06cc5aab3a1d55273e634a0b8c41f2153ab7 (patch)
tree880ba85f514775519ed187246c10ae83ff44b6fe /nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c
parente6b22157354611433eb01f6c20f7ac166a8fe21d (diff)
downloadpx4-nuttx-487a06cc5aab3a1d55273e634a0b8c41f2153ab7.tar.gz
px4-nuttx-487a06cc5aab3a1d55273e634a0b8c41f2153ab7.tar.bz2
px4-nuttx-487a06cc5aab3a1d55273e634a0b8c41f2153ab7.zip
Fix read failures when OUT req size > maxpacket
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1086 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c')
-rw-r--r--nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c41
1 files changed, 18 insertions, 23 deletions
diff --git a/nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c b/nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c
index 71c30596d..e23da86cc 100644
--- a/nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c
+++ b/nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c
@@ -1136,34 +1136,29 @@ static int lpc214x_rdrequest(struct lpc214x_ep_s *privep)
}
usbtrace(TRACE_READ(privep->epphy), privreq->req.xfrd);
- for (;;)
- {
- /* Receive the next packet if (1) there are more bytes to be receive, or
- * (2) the last packet was exactly maxpacketsize.
- */
- buf = privreq->req.buf + privreq->req.xfrd;
- nbytesread = lpc214x_epread(privep->epphy, buf, privep->ep.maxpacket);
- if (nbytesread < 0)
- {
- usbtrace(TRACE_DEVERROR(LPC214X_TRACEERR_EPREAD), nbytesread);
- return ERROR;
- }
+ /* Receive the next packet */
- /* If the receive buffer is full or if the last packet was not full
- * then we are finished with the transfer.
- */
+ buf = privreq->req.buf + privreq->req.xfrd;
+ nbytesread = lpc214x_epread(privep->epphy, buf, privep->ep.maxpacket);
+ if (nbytesread < 0)
+ {
+ usbtrace(TRACE_DEVERROR(LPC214X_TRACEERR_EPREAD), nbytesread);
+ return ERROR;
+ }
- privreq->req.xfrd += nbytesread;
- if (privreq->req.xfrd >= privreq->req.len || nbytesread < privep->ep.maxpacket)
- {
- usbtrace(TRACE_COMPLETE(privep->epphy), privreq->req.xfrd);
- lpc214x_reqcomplete(privep, OK);
- return OK;
- }
+ /* If the receive buffer is full or if the last packet was not full
+ * then we are finished with the transfer.
+ */
+
+ privreq->req.xfrd += nbytesread;
+ if (privreq->req.xfrd >= privreq->req.len || nbytesread < privep->ep.maxpacket)
+ {
+ usbtrace(TRACE_COMPLETE(privep->epphy), privreq->req.xfrd);
+ lpc214x_reqcomplete(privep, OK);
}
- return OK; /* Won't get here */
+ return OK;
}
/*******************************************************************************