9
0
Fork 0

Don't send final packet if length is zero

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@1093 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2008-10-28 17:20:09 +00:00
parent 8e06f0196e
commit f31c07b373
1 changed files with 29 additions and 22 deletions

View File

@ -714,7 +714,7 @@ static int inline usbstrg_cmdmodesense6(FAR struct usbstrg_dev_s *priv,
*
* (1) A MODESENSE6-specific mode parameter header,
* (2) A variable length list of block descriptors, and
* (3) A variable lengtth list of mode page formats
* (3) A variable length list of mode page formats
*/
mph->type = 0; /* Medium type */
@ -1743,7 +1743,7 @@ static int usbstrg_cmdparsestate(FAR struct usbstrg_dev_s *priv)
break;
/* * 0x20-22 Vendor specific */
case SCSI_CMD_READFORMATCAPACITIES: /* 0x23 Vendor-specific */
case SCSI_CMD_READFORMATCAPACITIES: /* 0x23 Vendor-specific (defined in MMC spec) */
ret = usbstrg_cmdreadformatcapacity(priv, buf);
break;
/* * 0x24 Vendor specific */
@ -2261,6 +2261,12 @@ static int usbstrg_cmdfinishstate(FAR struct usbstrg_dev_s *priv)
case USBSTRG_FLAGS_DIRDEVICE2HOST:
if (priv->cbwlen > 0)
{
/* On most commands (the exception is outgoing, write commands),
* the data has not not yet been sent.
*/
if (priv->nreqbytes > 0)
{
struct usbdev_req_s *req;
@ -2285,6 +2291,7 @@ static int usbstrg_cmdfinishstate(FAR struct usbstrg_dev_s *priv)
{
usbtrace(TRACE_CLSERROR(USBSTRG_TRACEERR_CMDFINISHSUBMIT), (uint16)-ret);
}
}
/* Stall the BULK In endpoint if there is a residue */