kerneltest/f32test/shostmassstorage/msman/src/cusbmsmountmanager.cpp
changeset 297 b2826f67641f
parent 0 a41df078684a
--- a/kerneltest/f32test/shostmassstorage/msman/src/cusbmsmountmanager.cpp	Tue Oct 26 11:12:58 2010 +0100
+++ b/kerneltest/f32test/shostmassstorage/msman/src/cusbmsmountmanager.cpp	Tue Oct 26 12:49:20 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -27,44 +27,38 @@
 #include "rextfilesystem.h"
 #include "usbtypes.h"
 #include "cusbmsmountmanager.h"
-#include "tmslog.h"
 #include "debug.h"
 
 
 CDevice* CDevice::NewL()
     {
-    __MSFNSLOG
-	CDevice* r = new (ELeave) CDevice();
-	CleanupStack::PushL(r);
+    CDevice* r = new (ELeave) CDevice();
+    CleanupStack::PushL(r);
 
-	r->ConstructL();
-	CleanupStack::Pop();
-	return r;
+    r->ConstructL();
+    CleanupStack::Pop();
+    return r;
     }
 
 
 void CDevice::ConstructL()
     {
-    __MSFNLOG
     }
 
 
 CDevice::CDevice()
     {
-    __MSFNLOG
     }
 
 
 CDevice::~CDevice()
     {
-    __MSFNLOG
     __USBHOSTPRINT1(_L("~CDevice Token=%d"), iDeviceToken);
     }
 
 
 TToken CDevice::OpenDeviceL(TUint aDeviceHandle, RUsbHubDriver& aHub)
     {
-    __MSFNLOG
     __USBHOSTPRINT1(_L("CDevice::OpenDeviceL Handle=%d"), aDeviceHandle);
 
     TInt err = iUsbDevice.Open(aHub, aDeviceHandle);
@@ -106,32 +100,32 @@
         User::Leave(KErrGeneral);
         }
 
-	TUint8 iProtocolId = ifDescriptor.InterfaceSubClass();
-	TUint8 iTransportId = ifDescriptor.InterfaceProtocol();
+    TUint8 iProtocolId = ifDescriptor.InterfaceSubClass();
+    TUint8 iTransportId = ifDescriptor.InterfaceProtocol();
 
     interface_ep0.Close();
 
     THostMassStorageConfig msConfig;
     msConfig.iInterfaceToken = token;
-	msConfig.iProtocolId =iProtocolId;
-	msConfig.iTransportId = iTransportId;
-	msConfig.iStatusPollingInterval = 10; // 10 secs
+    msConfig.iProtocolId =iProtocolId;
+    msConfig.iTransportId = iTransportId;
+    msConfig.iStatusPollingInterval = 10; // 10 secs
 
     TUint32 numLun;
 
     TRequestStatus status;
     iUsbHostMsDevice.Add(msConfig, status);
-	User::WaitForRequest(status);
-	if (status.Int() != KErrNone)
+    User::WaitForRequest(status);
+    if (status.Int() != KErrNone)
         {
-		__USBHOSTPRINT(_L("Add device failed"));
-		User::Leave(status.Int());
+        __USBHOSTPRINT(_L("Add device failed"));
+        User::Leave(status.Int());
         }
-	TInt r = iUsbHostMsDevice.GetNumLun(numLun);
-	if (r != KErrNone)
+    TInt r = iUsbHostMsDevice.GetNumLun(numLun);
+    if (r != KErrNone)
         {
-		__USBHOSTPRINT(_L("GetNumLun failed"));
-		User::Leave(r);
+        __USBHOSTPRINT(_L("GetNumLun failed"));
+        User::Leave(r);
         }
 
     if (numLun > KMaxLun)
@@ -151,8 +145,6 @@
 
 void CDevice::CloseDeviceL()
     {
-    __MSFNLOG
-
     THostMassStorageConfig msConfig;
     msConfig.iInterfaceToken = iDeviceToken;
 
@@ -163,7 +155,6 @@
 
 void CDevice::MountLogicalUnitsL()
     {
-    __MSFNLOG
     iExt.OpenL();
 
     for (TInt lun = 0; lun < iNumLuns; lun++)
@@ -184,7 +175,6 @@
 
 void CDevice::DismountLogicalUnitsL()
     {
-    __MSFNLOG
     for (TInt lun = 0; lun < iLuList.Count(); lun++)
         {
         TDriveNumber driveNumber = iLuList[lun];
@@ -201,83 +191,79 @@
                                  TUint8 aTransferType,
                                  TUint8 aDirection,
                                  TInt& aEndpointAddress) const
-	{
-    __MSFNSLOG
+    {
+    // Get the interface descriptor
+    RDebug::Print(_L("GetEndpointAddress : Getting the interface descriptor for this alternate setting"));
 
-	// Get the interface descriptor
-	RDebug::Print(_L("GetEndpointAddress : Getting the interface descriptor for this alternate setting"));
-
-	TUsbInterfaceDescriptor alternateInterfaceDescriptor;
-	TInt err = aUsbInterface.GetAlternateInterfaceDescriptor(aInterfaceSetting, alternateInterfaceDescriptor);
+    TUsbInterfaceDescriptor alternateInterfaceDescriptor;
+    TInt err = aUsbInterface.GetAlternateInterfaceDescriptor(aInterfaceSetting, alternateInterfaceDescriptor);
 
-	if (err)
-		{
-		RDebug::Print(_L("GetEndpointAddress : <Error %d> Unable to get alternate interface (%d) descriptor"),err,aInterfaceSetting);
-		return err;
-		}
+    if (err)
+        {
+        RDebug::Print(_L("GetEndpointAddress : <Error %d> Unable to get alternate interface (%d) descriptor"),err,aInterfaceSetting);
+        return err;
+        }
+
+    // Parse the descriptor tree from the interface
+    RDebug::Print(_L("Search the child descriptors for matching endpoint attributes"));
 
-	// Parse the descriptor tree from the interface
-	RDebug::Print(_L("Search the child descriptors for matching endpoint attributes"));
+    TUsbGenericDescriptor* descriptor = alternateInterfaceDescriptor.iFirstChild;
 
-	TUsbGenericDescriptor* descriptor = alternateInterfaceDescriptor.iFirstChild;
+    while (descriptor)
+        {
+        RDebug::Print(_L("GetEndpointAddress : Check descriptor type for endpoint"));
 
-	while (descriptor)
-		{
-		RDebug::Print(_L("GetEndpointAddress : Check descriptor type for endpoint"));
+        // Cast the descriptor to an endpoint descriptor
+        TUsbEndpointDescriptor* endpoint = TUsbEndpointDescriptor::Cast(descriptor);
 
-		// Cast the descriptor to an endpoint descriptor
-		TUsbEndpointDescriptor* endpoint = TUsbEndpointDescriptor::Cast(descriptor);
+        if (endpoint)
+            {
+            RDebug::Print(_L("GetEndpointAddress : Match attributes for transfer type"));
 
-		if (endpoint)
-			{
-			RDebug::Print(_L("GetEndpointAddress : Match attributes for transfer type"));
-
-			if ( (endpoint->Attributes() & aTransferType) == aTransferType)
-				{
-				RDebug::Print(_L("GetEndpointAddress : Match attributes for endpoint direction"));
+            if ( (endpoint->Attributes() & aTransferType) == aTransferType)
+                {
+                RDebug::Print(_L("GetEndpointAddress : Match attributes for endpoint direction"));
 
-				if ( (endpoint->EndpointAddress() & 0x80) == aDirection)
-					{
-					aEndpointAddress = endpoint->EndpointAddress();
-					RDebug::Print(_L("GetEndpointAddress : Endpoint address found"));
-					return KErrNone;
-					}
-				}
-			}
+                if ( (endpoint->EndpointAddress() & 0x80) == aDirection)
+                    {
+                    aEndpointAddress = endpoint->EndpointAddress();
+                    RDebug::Print(_L("GetEndpointAddress : Endpoint address found"));
+                    return KErrNone;
+                    }
+                }
+            }
 
-		descriptor = descriptor->iNextPeer;
-		}
+        descriptor = descriptor->iNextPeer;
+        }
 
-	// Unable to find the endpoint address
-	RDebug::Print(_L("GetEndpointAddress : Unable to find endpoint address matching the specified attributes"));
+    // Unable to find the endpoint address
+    RDebug::Print(_L("GetEndpointAddress : Unable to find endpoint address matching the specified attributes"));
 
-	return KErrNotFound;
-	}
+    return KErrNotFound;
+    }
 
 
 TBool CDevice::IsDeviceMassStorage(const TUsbInterfaceDescriptor& aInterfaceDesc,
                                    const TUsbDeviceDescriptor& aDeviceDesc) const
     {
-    __MSFNSLOG
-	/* check the interface descriptor */
-	if(aInterfaceDesc.InterfaceClass() == 0x08 &&
-		aInterfaceDesc.InterfaceSubClass() == 0x06 &&
-		aInterfaceDesc.InterfaceProtocol() == 0x50)
+    /* check the interface descriptor */
+    if(aInterfaceDesc.InterfaceClass() == 0x08 &&
+        aInterfaceDesc.InterfaceSubClass() == 0x06 &&
+        aInterfaceDesc.InterfaceProtocol() == 0x50)
         {
-		if(aDeviceDesc.DeviceClass() == 0x00 &&
-			aDeviceDesc.DeviceSubClass() == 0x00 &&
-			aDeviceDesc.DeviceProtocol() == 0x00)
-			return ETrue;
+        if(aDeviceDesc.DeviceClass() == 0x00 &&
+            aDeviceDesc.DeviceSubClass() == 0x00 &&
+            aDeviceDesc.DeviceProtocol() == 0x00)
+            return ETrue;
         }
 
-	return EFalse;
+    return EFalse;
 
     }
 
 
 TLun CDevice::DriveMap(TDriveMap& aDriveMap) const
     {
-    __MSFNSLOG
     TDriveNumber driveNumber;
     RDebug::Printf("LuList.Count=%d", iLuList.Count());
     for (TInt i = 0; i < iLuList.Count(); i++)
@@ -293,7 +279,6 @@
 
 TLun CDevice::DeviceMap(TDeviceMap& aDeviceMap) const
     {
-    __MSFNSLOG
     TDriveNumber driveNumber;
     RDebug::Printf("LuList.Count=%d", iLuList.Count());
     for (TInt i = 0; i < iLuList.Count(); i++)
@@ -309,31 +294,27 @@
 
 CUsbMsMountManager* CUsbMsMountManager::NewL()
     {
-    __MSFNSLOG
-	CUsbMsMountManager* r = new (ELeave) CUsbMsMountManager();
-	CleanupStack::PushL(r);
+    CUsbMsMountManager* r = new (ELeave) CUsbMsMountManager();
+    CleanupStack::PushL(r);
 
-	r->ConstructL();
-	CleanupStack::Pop();
-	return r;
+    r->ConstructL();
+    CleanupStack::Pop();
+    return r;
     }
 
 
 void CUsbMsMountManager::ConstructL()
     {
-    __MSFNLOG
     }
 
 
 CUsbMsMountManager::CUsbMsMountManager()
     {
-    __MSFNLOG
     }
 
 
 CUsbMsMountManager::~CUsbMsMountManager()
     {
-    __MSFNLOG
     iDeviceList.ResetAndDestroy();
     }
 
@@ -341,23 +322,20 @@
 // adds new entry for this device
 void CUsbMsMountManager::AddDeviceL(CDevice* aDevice)
     {
-    __MSFNLOG
     iDeviceList.Append(aDevice);
     }
 
 
 CDevice* CUsbMsMountManager::RemoveDeviceL(TUint aDeviceHandle)
     {
-    __MSFNLOG
-	TInt index = GetHandleIndexL(aDeviceHandle);
-	CDevice* device = iDeviceList[index];
+    TInt index = GetHandleIndexL(aDeviceHandle);
+    CDevice* device = iDeviceList[index];
     iDeviceList.Remove(index);
     return device;
     }
 
 void CUsbMsMountManager::CloseAllDevicesL()
     {
-    __MSFNLOG
     for (TInt i = 0; i < iDeviceList.Count(); i++)
         {
         iDeviceList[i]->CloseDeviceL();
@@ -367,7 +345,6 @@
 
 TInt CUsbMsMountManager::GetDeviceIndexL(TToken aDeviceToken) const
     {
-    __MSFNSLOG
     TInt index;
     for (index = 0; index < iDeviceList.Count(); index++)
         {
@@ -388,7 +365,6 @@
 
 TInt CUsbMsMountManager::GetHandleIndexL(TUint aDeviceHandle) const
     {
-    __MSFNSLOG
     TInt index;
     for (index = 0; index < iDeviceList.Count(); index++)
         {
@@ -411,7 +387,6 @@
 // mounts all LUNs for the device
 void CUsbMsMountManager::MountDeviceL(TUint aDeviceHandle)
     {
-    __MSFNLOG
     TInt index = GetHandleIndexL(aDeviceHandle);
     iDeviceList[index]->MountLogicalUnitsL();
     }
@@ -421,7 +396,6 @@
 // dismount all LUNs for this device
 void CUsbMsMountManager::DismountDeviceL(TUint aDeviceHandle)
     {
-    __MSFNLOG
     TInt index = GetHandleIndexL(aDeviceHandle);
     iDeviceList[index]->DismountLogicalUnitsL();
     }
@@ -430,7 +404,6 @@
 // dismount all LUNs
 void CUsbMsMountManager::DismountL()
     {
-    __MSFNLOG
     for (TInt i = 0; i < iDeviceList.Count(); i++)
         {
         iDeviceList[i]->DismountLogicalUnitsL();
@@ -440,7 +413,6 @@
 
 void CUsbMsMountManager::DriveMap(TDriveMap& aDriveMap) const
     {
-    __MSFNSLOG
     TInt maxLun = 0;
     RDebug::Printf("DeviceList.Count=%d", iDeviceList.Count());
     for (TInt i = 0; i < iDeviceList.Count(); i++)
@@ -453,7 +425,6 @@
 
 void CUsbMsMountManager::DeviceMap(TInt aDeviceIndex, TDeviceMap& aDeviceMap) const
     {
-    __MSFNSLOG
     RDebug::Printf("Device=%d", aDeviceIndex);
 
     __ASSERT_DEBUG(aDeviceIndex < iDeviceList.Count(), User::Invariant());
@@ -468,215 +439,215 @@
     }
 
 void TUsbPrint::PrintTree(const TUsbGenericDescriptor& aDesc, TInt aDepth)
-	{
+    {
     if (!iDebug)
         {
         return;
         }
 
-	TBuf<20> buf;
-	for(TInt depth=aDepth;depth>=0;--depth)
-		{
-		buf.Append(_L("  "));
-		}
-	if(aDesc.iRecognisedAndParsed == TUsbGenericDescriptor::ERecognised)
-		{
-		RDebug::Print(_L("%S+0x%08x - %d 0x%02x"), &buf, &aDesc, aDesc.ibLength, aDesc.ibDescriptorType);
-		}
-	else
-		{
-		RDebug::Print(_L("%S-0x%08x - %d 0x%02x"), &buf, &aDesc, aDesc.ibLength, aDesc.ibDescriptorType);
-		}
-	HBufC* blob = HBufC::New(5*aDesc.iBlob.Length()); // 5* for " 0x" + 2*bytes for hex representation
-	if(blob)
-		{
-		for(TInt i=0;i<aDesc.iBlob.Length();++i)
-			{
-			blob->Des().AppendFormat(_L("0x%02x "), aDesc.iBlob[i]);
-			}
-		RDebug::Print(_L("%S >%S"), &buf, blob);
-		delete blob;
-		}
-	if(aDesc.iFirstChild)
-		{
-		RDebug::Print(_L("%S \\ "), &buf);
-		PrintTree(*(aDesc.iFirstChild), aDepth+1);
-		RDebug::Print(_L("%S / "), &buf);
-		}
-	if(aDesc.iNextPeer)
-		{
-		PrintTree(*(aDesc.iNextPeer), aDepth);
-		}
-	}
+    TBuf<20> buf;
+    for(TInt depth=aDepth;depth>=0;--depth)
+        {
+        buf.Append(_L("  "));
+        }
+    if(aDesc.iRecognisedAndParsed == TUsbGenericDescriptor::ERecognised)
+        {
+        RDebug::Print(_L("%S+0x%08x - %d 0x%02x"), &buf, &aDesc, aDesc.ibLength, aDesc.ibDescriptorType);
+        }
+    else
+        {
+        RDebug::Print(_L("%S-0x%08x - %d 0x%02x"), &buf, &aDesc, aDesc.ibLength, aDesc.ibDescriptorType);
+        }
+    HBufC* blob = HBufC::New(5*aDesc.iBlob.Length()); // 5* for " 0x" + 2*bytes for hex representation
+    if(blob)
+        {
+        for(TInt i=0;i<aDesc.iBlob.Length();++i)
+            {
+            blob->Des().AppendFormat(_L("0x%02x "), aDesc.iBlob[i]);
+            }
+        RDebug::Print(_L("%S >%S"), &buf, blob);
+        delete blob;
+        }
+    if(aDesc.iFirstChild)
+        {
+        RDebug::Print(_L("%S \\ "), &buf);
+        PrintTree(*(aDesc.iFirstChild), aDepth+1);
+        RDebug::Print(_L("%S / "), &buf);
+        }
+    if(aDesc.iNextPeer)
+        {
+        PrintTree(*(aDesc.iNextPeer), aDepth);
+        }
+    }
 
 
 static TUint16 gLangId = 0x0000;
 
 void TUsbPrint::SetLanguageToPrintL(RUsbDevice& aDevice)
-	{
+    {
     if (!iDebug) return;
 
-	// Try to set language to US Eng, otherwise take the first one listed.
-	if(gLangId == 0x0000) // Only make the request if not been made before.
-		{
-		// Get string descriptor 0.
-		TBuf8<256> stringBuf;
-		TUsbStringDescriptor* stringDesc = NULL;
-		User::LeaveIfError(aDevice.GetStringDescriptor(stringDesc, stringBuf, 0));
-		CleanupStack::PushL(*stringDesc);
+    // Try to set language to US Eng, otherwise take the first one listed.
+    if(gLangId == 0x0000) // Only make the request if not been made before.
+        {
+        // Get string descriptor 0.
+        TBuf8<256> stringBuf;
+        TUsbStringDescriptor* stringDesc = NULL;
+        User::LeaveIfError(aDevice.GetStringDescriptor(stringDesc, stringBuf, 0));
+        CleanupStack::PushL(*stringDesc);
 
-		// Search for US English
-		TBool usEngLang = EFalse;
-		TInt langId = 0;
-		TInt index = 0;
-		const TUint16 KLangIdUsEng = 0x0409;
-		while(!usEngLang && langId != KErrNotFound)
-			{
-			langId = stringDesc->GetLangId(index);
-			usEngLang = (langId == KLangIdUsEng);
-			index++;
-			}
+        // Search for US English
+        TBool usEngLang = EFalse;
+        TInt langId = 0;
+        TInt index = 0;
+        const TUint16 KLangIdUsEng = 0x0409;
+        while(!usEngLang && langId != KErrNotFound)
+            {
+            langId = stringDesc->GetLangId(index);
+            usEngLang = (langId == KLangIdUsEng);
+            index++;
+            }
 
-		// Set the language appropriately
-		if(usEngLang)
-			{
-        	gLangId = KLangIdUsEng;
-			}
-		else
-			{
-			gLangId = stringDesc->GetLangId(0);
-			}
+        // Set the language appropriately
+        if(usEngLang)
+            {
+            gLangId = KLangIdUsEng;
+            }
+        else
+            {
+            gLangId = stringDesc->GetLangId(0);
+            }
 
-		CleanupStack::PopAndDestroy(); // stringDesc
-		}
-	}
+        CleanupStack::PopAndDestroy(); // stringDesc
+        }
+    }
 
 
 void TUsbPrint::PrintStringFromIndex(const TDesC& aFormatString,
                                      TInt aIndex,
                                      RUsbDevice* aDevice)
-	{
+    {
     if (!iDebug) return;
 
-	// If we have no device handle, we cannot go and get any strings.
-	// If we have index 0, this indicates we don't have a string for this entry.
-	if(aDevice && aIndex != 0)
-		{
-		TRAPD(err, SetLanguageToPrintL(*aDevice));
-		if(err == KErrNone)
-			{
-			TBuf8<255> stringBuf;
-			TUsbStringDescriptor* stringDesc = NULL;
-			err = aDevice->GetStringDescriptor(stringDesc, stringBuf, aIndex, gLangId);
-			if(err == KErrNone)
-				{
-				TBuf<128> buf;
-				stringDesc->StringData(buf);
-				RDebug::Print(aFormatString, &buf);
-				stringDesc->DestroyTree();
-				}
-			delete stringDesc;
-			}
-		else
-			{
-			RDebug::Print(_L("Error while Selecting Langauge %d\n"), err);
-			}
-		}
-	}
+    // If we have no device handle, we cannot go and get any strings.
+    // If we have index 0, this indicates we don't have a string for this entry.
+    if(aDevice && aIndex != 0)
+        {
+        TRAPD(err, SetLanguageToPrintL(*aDevice));
+        if(err == KErrNone)
+            {
+            TBuf8<255> stringBuf;
+            TUsbStringDescriptor* stringDesc = NULL;
+            err = aDevice->GetStringDescriptor(stringDesc, stringBuf, aIndex, gLangId);
+            if(err == KErrNone)
+                {
+                TBuf<128> buf;
+                stringDesc->StringData(buf);
+                RDebug::Print(aFormatString, &buf);
+                stringDesc->DestroyTree();
+                }
+            delete stringDesc;
+            }
+        else
+            {
+            RDebug::Print(_L("Error while Selecting Langauge %d\n"), err);
+            }
+        }
+    }
 
 
 void TUsbPrint::PrintDescriptor(const TUsbDeviceDescriptor& aDeviceDesc,
                                 TInt /*aVariant*/,
                                 RUsbDevice* aDevice)
-	{
+    {
     if (!iDebug) return;
 
-	RDebug::Print(_L("USBBcd = 0x%04x\n"), aDeviceDesc.USBBcd());
-	RDebug::Print(_L("DeviceClass = 0x%02x\n"), aDeviceDesc.DeviceClass());
-	RDebug::Print(_L("DeviceSubClass = 0x%02x\n"), aDeviceDesc.DeviceSubClass());
-	RDebug::Print(_L("DeviceProtocol = 0x%02x\n"), aDeviceDesc.DeviceProtocol());
-	RDebug::Print(_L("MaxPacketSize0 = 0x%02x\n"), aDeviceDesc.MaxPacketSize0());
-	RDebug::Print(_L("VendorId = 0x%04x\n"), aDeviceDesc.VendorId());
-	RDebug::Print(_L("ProductId = 0x%04x\n"), aDeviceDesc.ProductId());
-	RDebug::Print(_L("DeviceBcd = 0x%04x\n"), aDeviceDesc.DeviceBcd());
-	RDebug::Print(_L("ManufacturerIndex = 0x%02x\n"), aDeviceDesc.ManufacturerIndex());
-	PrintStringFromIndex(_L("ManufacturerString = %S\n"), aDeviceDesc.ManufacturerIndex(), aDevice);
-	RDebug::Print(_L("ProductIndex = 0x%02x\n"), aDeviceDesc.ProductIndex());
-	PrintStringFromIndex(_L("ProductString = %S\n"), aDeviceDesc.ProductIndex(), aDevice);
-	RDebug::Print(_L("SerialNumberIndex = 0x%02x\n"), aDeviceDesc.SerialNumberIndex());
-	PrintStringFromIndex(_L("SerialNumberString = %S\n"), aDeviceDesc.SerialNumberIndex(), aDevice);
-	RDebug::Print(_L("NumConfigurations = 0x%02x\n"), aDeviceDesc.NumConfigurations());
-	}
+    RDebug::Print(_L("USBBcd = 0x%04x\n"), aDeviceDesc.USBBcd());
+    RDebug::Print(_L("DeviceClass = 0x%02x\n"), aDeviceDesc.DeviceClass());
+    RDebug::Print(_L("DeviceSubClass = 0x%02x\n"), aDeviceDesc.DeviceSubClass());
+    RDebug::Print(_L("DeviceProtocol = 0x%02x\n"), aDeviceDesc.DeviceProtocol());
+    RDebug::Print(_L("MaxPacketSize0 = 0x%02x\n"), aDeviceDesc.MaxPacketSize0());
+    RDebug::Print(_L("VendorId = 0x%04x\n"), aDeviceDesc.VendorId());
+    RDebug::Print(_L("ProductId = 0x%04x\n"), aDeviceDesc.ProductId());
+    RDebug::Print(_L("DeviceBcd = 0x%04x\n"), aDeviceDesc.DeviceBcd());
+    RDebug::Print(_L("ManufacturerIndex = 0x%02x\n"), aDeviceDesc.ManufacturerIndex());
+    PrintStringFromIndex(_L("ManufacturerString = %S\n"), aDeviceDesc.ManufacturerIndex(), aDevice);
+    RDebug::Print(_L("ProductIndex = 0x%02x\n"), aDeviceDesc.ProductIndex());
+    PrintStringFromIndex(_L("ProductString = %S\n"), aDeviceDesc.ProductIndex(), aDevice);
+    RDebug::Print(_L("SerialNumberIndex = 0x%02x\n"), aDeviceDesc.SerialNumberIndex());
+    PrintStringFromIndex(_L("SerialNumberString = %S\n"), aDeviceDesc.SerialNumberIndex(), aDevice);
+    RDebug::Print(_L("NumConfigurations = 0x%02x\n"), aDeviceDesc.NumConfigurations());
+    }
 
 
 void TUsbPrint::PrintDescriptor(const TUsbConfigurationDescriptor& aConfigDesc,
                                 TInt /*aVariant*/,
                                 RUsbDevice* aDevice)
-	{
+    {
     if (!iDebug) return;
-	RDebug::Print(_L("TotalLength = 0x%04x\n"), aConfigDesc.TotalLength());
-	RDebug::Print(_L("NumInterfaces = 0x%02x\n"), aConfigDesc.NumInterfaces());
-	RDebug::Print(_L("ConfigurationValue = 0x%02x\n"), aConfigDesc.ConfigurationValue());
-	RDebug::Print(_L("ConfigurationIndex = 0x%02x\n"), aConfigDesc.ConfigurationIndex());
-	PrintStringFromIndex(_L("ConfigurationString = %S\n"), aConfigDesc.ConfigurationIndex(), aDevice);
-	RDebug::Print(_L("Attributes = 0x%02x\n"), aConfigDesc.Attributes());
-	RDebug::Print(_L("MaxPower = 0x%02x\n"), aConfigDesc.MaxPower());
-	}
+    RDebug::Print(_L("TotalLength = 0x%04x\n"), aConfigDesc.TotalLength());
+    RDebug::Print(_L("NumInterfaces = 0x%02x\n"), aConfigDesc.NumInterfaces());
+    RDebug::Print(_L("ConfigurationValue = 0x%02x\n"), aConfigDesc.ConfigurationValue());
+    RDebug::Print(_L("ConfigurationIndex = 0x%02x\n"), aConfigDesc.ConfigurationIndex());
+    PrintStringFromIndex(_L("ConfigurationString = %S\n"), aConfigDesc.ConfigurationIndex(), aDevice);
+    RDebug::Print(_L("Attributes = 0x%02x\n"), aConfigDesc.Attributes());
+    RDebug::Print(_L("MaxPower = 0x%02x\n"), aConfigDesc.MaxPower());
+    }
 
 
 void TUsbPrint::PrintDescriptor(const TUsbEndpointDescriptor& aEndpointDesc,
                                 TInt /*aVariant*/,
                                 RUsbDevice* /*aDevice*/)
-	{
+    {
     if (!iDebug) return;
-	RDebug::Print(_L("EndpointAddress = 0x%02x\n"), aEndpointDesc.EndpointAddress());
-	RDebug::Print(_L("Attributes = 0x%02x\n"), aEndpointDesc.Attributes());
-	RDebug::Print(_L("MaxPacketSize = 0x%04x\n"), aEndpointDesc.MaxPacketSize());
-	RDebug::Print(_L("Interval = 0x%02x\n"), aEndpointDesc.Interval());
-	}
+    RDebug::Print(_L("EndpointAddress = 0x%02x\n"), aEndpointDesc.EndpointAddress());
+    RDebug::Print(_L("Attributes = 0x%02x\n"), aEndpointDesc.Attributes());
+    RDebug::Print(_L("MaxPacketSize = 0x%04x\n"), aEndpointDesc.MaxPacketSize());
+    RDebug::Print(_L("Interval = 0x%02x\n"), aEndpointDesc.Interval());
+    }
 
 
 void TUsbPrint::PrintDescriptor(const TUsbInterfaceDescriptor& aInterfaceDesc,
                                 TInt /*aVariant*/,
                                 RUsbDevice* /*aDevice*/)
-	{
+    {
     if (!iDebug) return;
-	RDebug::Print(_L("InterfaceNumber = 0x%02x\n"), aInterfaceDesc.InterfaceNumber());
-	RDebug::Print(_L("AlternateSetting = 0x%02x\n"), aInterfaceDesc.AlternateSetting());
-	RDebug::Print(_L("NumEndpoints = 0x%02x\n"), aInterfaceDesc.NumEndpoints());
-	RDebug::Print(_L("InterfaceClass = 0x%02x\n"), aInterfaceDesc.InterfaceClass());
-	RDebug::Print(_L("InterfaceSubClass = 0x%02x\n"), aInterfaceDesc.InterfaceSubClass());
-	RDebug::Print(_L("InterfaceProtocol = 0x%02x\n"), aInterfaceDesc.InterfaceProtocol());
-	RDebug::Print(_L("Interface = 0x%02x\n"), aInterfaceDesc.Interface());
-	}
+    RDebug::Print(_L("InterfaceNumber = 0x%02x\n"), aInterfaceDesc.InterfaceNumber());
+    RDebug::Print(_L("AlternateSetting = 0x%02x\n"), aInterfaceDesc.AlternateSetting());
+    RDebug::Print(_L("NumEndpoints = 0x%02x\n"), aInterfaceDesc.NumEndpoints());
+    RDebug::Print(_L("InterfaceClass = 0x%02x\n"), aInterfaceDesc.InterfaceClass());
+    RDebug::Print(_L("InterfaceSubClass = 0x%02x\n"), aInterfaceDesc.InterfaceSubClass());
+    RDebug::Print(_L("InterfaceProtocol = 0x%02x\n"), aInterfaceDesc.InterfaceProtocol());
+    RDebug::Print(_L("Interface = 0x%02x\n"), aInterfaceDesc.Interface());
+    }
 
 
 void TUsbPrint::PrintDescriptor(const TUsbStringDescriptor& aStringDesc,
                                 TInt aVariant,
                                 RUsbDevice* /*aDevice*/)
-	{
+    {
     if (!iDebug) return;
-	if(aVariant == 0)
-		{
-		RDebug::Print(_L("String Descriptor Zero\n"));
-		TInt index = 0;
-		TInt langId = 0;
-		while((langId = aStringDesc.GetLangId(index)) != KErrNotFound)
-			{
-			RDebug::Print(_L("  >0x%04x\n"), langId);
-			++index;
-			}
-		}
-	else
-		{
-		RDebug::Print(_L("Generic String Descriptor\n"));
-		HBufC16* string = HBufC16::New(128);
-		if(string)
-			{
-			TPtr16 stringPtr = string->Des();
-			aStringDesc.StringData(stringPtr);
-			RDebug::Print(_L("  >%S\n"), string);
-			}
-		delete string;
-		}
-	}
+    if(aVariant == 0)
+        {
+        RDebug::Print(_L("String Descriptor Zero\n"));
+        TInt index = 0;
+        TInt langId = 0;
+        while((langId = aStringDesc.GetLangId(index)) != KErrNotFound)
+            {
+            RDebug::Print(_L("  >0x%04x\n"), langId);
+            ++index;
+            }
+        }
+    else
+        {
+        RDebug::Print(_L("Generic String Descriptor\n"));
+        HBufC16* string = HBufC16::New(128);
+        if(string)
+            {
+            TPtr16 stringPtr = string->Des();
+            aStringDesc.StringData(stringPtr);
+            RDebug::Print(_L("  >%S\n"), string);
+            }
+        delete string;
+        }
+    }