kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/transport/cbulkonlytransport.cpp
changeset 39 5d2844f35677
parent 0 a41df078684a
child 62 4a8fed1c0ef6
--- a/kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/transport/cbulkonlytransport.cpp	Mon Jan 18 21:31:10 2010 +0200
+++ b/kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/transport/cbulkonlytransport.cpp	Tue Jan 26 13:13:38 2010 +0200
@@ -231,6 +231,8 @@
 			{
 			// KInEndpoint is going to be our TX (IN, write) endpoint
 			ifc().iEndpointData[0].iType = KUsbEpTypeBulk;
+			if((d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) == KUsbDevCapsFeatureWord1_EndpointResourceAllocV2)
+				ifc().iEndpointData[0].iFeatureWord1  = KUsbcEndpointInfoFeatureWord1_DMA|KUsbcEndpointInfoFeatureWord1_DoubleBuffering;
 			ifc().iEndpointData[0].iDir  = KUsbEpDirIn;
 			ifc().iEndpointData[0].iSize = maxPacketSize;
 			ifc().iEndpointData[0].iInterval_Hs = 0;
@@ -246,6 +248,8 @@
 			{
 			// KOutEndpoint is going to be our RX (OUT, read) endpoint
 			ifc().iEndpointData[1].iType = KUsbEpTypeBulk;
+			if((d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) == KUsbDevCapsFeatureWord1_EndpointResourceAllocV2)
+				ifc().iEndpointData[1].iFeatureWord1  = KUsbcEndpointInfoFeatureWord1_DMA|KUsbcEndpointInfoFeatureWord1_DoubleBuffering;
 			ifc().iEndpointData[1].iDir  = KUsbEpDirOut;
 			ifc().iEndpointData[1].iSize = maxPacketSize;
 			ifc().iEndpointData[1].iInterval_Hs = 0;
@@ -360,28 +364,36 @@
     iDataTransferMan.Init();
 	iStarted = ETrue;
 
-	// Set up DMA if possible (errors are non-critical)
-	TInt err = iLdd.AllocateEndpointResource(KOutEndpoint, EUsbcEndpointResourceDMA);
-	if (err != KErrNone)
-		{
-		__PRINT1(_L("Set DMA on OUT endpoint failed with error code: %d"), err);
-		}
-	err = iLdd.AllocateEndpointResource(KInEndpoint, EUsbcEndpointResourceDMA);
-	if (err != KErrNone)
+	TUsbDeviceCaps d_caps;
+	TInt ret = iLdd.DeviceCaps(d_caps);
+	if (ret == KErrNone)
 		{
-		__PRINT1(_L("Set DMA on IN endpoint failed with error code: %d"), err);
-		}
+		if((d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) != KUsbDevCapsFeatureWord1_EndpointResourceAllocV2)
+			{
+			// Set up DMA if possible (errors are non-critical)
+			TInt err = iLdd.AllocateEndpointResource(KOutEndpoint, EUsbcEndpointResourceDMA);
+			if (err != KErrNone)
+				{
+				__PRINT1(_L("Set DMA on OUT endpoint failed with error code: %d"), err);
+				}
+			err = iLdd.AllocateEndpointResource(KInEndpoint, EUsbcEndpointResourceDMA);
+			if (err != KErrNone)
+				{
+				__PRINT1(_L("Set DMA on IN endpoint failed with error code: %d"), err);
+				}
 
-	// Set up Double Buffering if possible (errors are non-critical)
-	err = iLdd.AllocateEndpointResource(KOutEndpoint, EUsbcEndpointResourceDoubleBuffering);
-	if (err != KErrNone)
-		{
-		__PRINT1(_L("Set Double Buffering on OUT endpoint failed with error code: %d"), err);
-		}
-	err = iLdd.AllocateEndpointResource(KInEndpoint, EUsbcEndpointResourceDoubleBuffering);
-	if (err != KErrNone)
-		{
-		__PRINT1(_L("Set Double Buffering on IN endpoint failed with error code: %d"), err);
+			// Set up Double Buffering if possible (errors are non-critical)
+			err = iLdd.AllocateEndpointResource(KOutEndpoint, EUsbcEndpointResourceDoubleBuffering);
+			if (err != KErrNone)
+				{
+				__PRINT1(_L("Set Double Buffering on OUT endpoint failed with error code: %d"), err);
+				}
+			err = iLdd.AllocateEndpointResource(KInEndpoint, EUsbcEndpointResourceDoubleBuffering);
+			if (err != KErrNone)
+				{
+				__PRINT1(_L("Set Double Buffering on IN endpoint failed with error code: %d"), err);
+				}
+			}
 		}
 
     if (aDiscard)