userlibandfileserver/fileserver/smassstorage/cbulkonlytransportusbcscldd.cpp
changeset 47 46fffbe7b5a7
parent 43 96e5fb8b040d
child 269 d57b86b1867a
--- a/userlibandfileserver/fileserver/smassstorage/cbulkonlytransportusbcscldd.cpp	Fri Jan 22 11:03:55 2010 +0200
+++ b/userlibandfileserver/fileserver/smassstorage/cbulkonlytransportusbcscldd.cpp	Tue Jan 26 13:13:38 2010 +0200
@@ -426,6 +426,8 @@
 			{
 			// InEndpoint 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;
@@ -442,6 +444,8 @@
 			{
 			// OutEndpoint 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;
@@ -553,32 +557,40 @@
 				}
 			}
 		}
-		
-	__PRINT(_L("CBulkOnlyTransportUsbcScLdd::Start  - Setting up DMA and double buffering\n"));
-	// Set up DMA if possible (errors are non-critical)
-	TInt err = iLdd.AllocateEndpointResource(iOutEndpoint, EUsbcEndpointResourceDMA);
-	if (err != KErrNone)
+
+	TUsbDeviceCaps d_caps;
+	TInt err;
+	TInt ret = iLdd.DeviceCaps(d_caps);
+	if (ret == KErrNone)
 		{
-		__PRINT1(_L("Set DMA on OUT endpoint failed with error code: %d"), err);
-		}
-	err = iLdd.AllocateEndpointResource(iInEndpoint, EUsbcEndpointResourceDMA);
-	if (err != KErrNone)
-		{
-		__PRINT1(_L("Set DMA on IN endpoint failed with error code: %d"), err);
+		if((d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) != KUsbDevCapsFeatureWord1_EndpointResourceAllocV2)
+			{		
+			__PRINT(_L("CBulkOnlyTransportUsbcScLdd::Start  - Setting up DMA and double buffering\n"));
+				// Set up DMA if possible (errors are non-critical)
+			err = iLdd.AllocateEndpointResource(iOutEndpoint, EUsbcEndpointResourceDMA);
+			if (err != KErrNone)
+				{
+				__PRINT1(_L("Set DMA on OUT endpoint failed with error code: %d"), err);
+				}
+			err = iLdd.AllocateEndpointResource(iInEndpoint, 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(iOutEndpoint, EUsbcEndpointResourceDoubleBuffering);
+			if (err != KErrNone)
+				{
+				__PRINT1(_L("Set Double Buffering on OUT endpoint failed with error code: %d"), err);
+				}
+			err = iLdd.AllocateEndpointResource(iInEndpoint, 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(iOutEndpoint, EUsbcEndpointResourceDoubleBuffering);
-	if (err != KErrNone)
-		{
-		__PRINT1(_L("Set Double Buffering on OUT endpoint failed with error code: %d"), err);
-		}
-	err = iLdd.AllocateEndpointResource(iInEndpoint, EUsbcEndpointResourceDoubleBuffering);
-	if (err != KErrNone)
-		{
-		__PRINT1(_L("Set Double Buffering on IN endpoint failed with error code: %d"), err);
-		}
-
 	
 	err = OpenEndpoints();
 	}