kernel/eka/drivers/usbc/usbdma.cpp
changeset 102 ef2a444a7410
parent 33 0173bcd7697c
child 253 d37db4dcc88d
--- a/kernel/eka/drivers/usbc/usbdma.cpp	Fri Apr 16 16:24:37 2010 +0300
+++ b/kernel/eka/drivers/usbc/usbdma.cpp	Mon May 03 13:47:38 2010 +0300
@@ -619,7 +619,14 @@
 			{
 			if (iEndpointType == KUsbEpTypeBulk)
 				{
-				isShortPacket = (size < iMaxPacketSize) || (size & maxPacketSizeMask);
+                if(iExtractOffset & maxPacketSizeMask)
+                	{
+                    isShortPacket = ((size+iExtractOffset) < iMaxPacketSize) || ((size+iExtractOffset) & maxPacketSizeMask);
+                	}
+                else
+                	{
+                    isShortPacket = (size < iMaxPacketSize) || (size & maxPacketSizeMask);
+                	}
 				}
 			else
 				{
@@ -830,17 +837,7 @@
 		if (iEndpointType == KUsbEpTypeBulk)
 			{
 			const TInt mask = iMaxPacketSize - 1;
-			if (iTotalRxBytesAvail & mask)
-				return ETrue;
 
-			// residue==0; this can be because
-			// zlps exist, or short packets combine to n * max_packet_size
-			// This means spadework
-			const TInt s = iCurrentPacketSizeArray[iCurrentPacket] - iExtractOffset;
-			if ((s == 0) || (s & mask))
-				{
-				return ETrue;
-				}
 
 			for (TInt i = 0; i < iNumberofBuffers; i++)
 				{