# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1268650006 -7200 # Node ID 96e5756969015ccd9ddad4fc932695611e889baf # Parent c2db6e29750c40cd4a1c071e63eb3888b0d039ac Revision: 201007 Kit: 201010 diff -r c2db6e29750c -r 96e575696901 usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/INC/CUsbACMClassController.h --- a/usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/INC/CUsbACMClassController.h Fri Mar 12 15:51:10 2010 +0200 +++ b/usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/INC/CUsbACMClassController.h Mon Mar 15 12:46:46 2010 +0200 @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available @@ -36,22 +36,24 @@ #include #endif class MUsbClassControllerNotify; -class CIniFile; const TInt KAcmStartupPriority = 3; const TUint KDefaultNumberOfAcmFunctions = 1; -const TInt KMaximumAcmFunctions = 15; + +// The maximum ACM function has been decreased from 15 to 5. +const TInt KMaximumAcmFunctions = 5; + + +extern const TUint32 KUsbAcmNumberOfAcmFunctions; + +extern const TInt32 KUsbAcmProtocolNumAcm1; +extern const TInt32 KUsbAcmProtocolNumAcm2; +extern const TInt32 KUsbAcmProtocolNumAcm3; +extern const TInt32 KUsbAcmProtocolNumAcm4; +extern const TInt32 KUsbAcmProtocolNumAcm5; + const TInt KAcmNumberOfInterfacesPerAcmFunction = 2; // data and control interfaces -// The name of the ini file specifying the number of ACM functions required and optionally their interface names -_LIT(KAcmFunctionsIniFileName, "NumberOfAcmFunctions.ini"); -_LIT(KAcmConfigSection,"ACM_CONF"); -_LIT(KNumberOfAcmFunctionsKeyWord,"NumberOfAcmFunctions"); - -_LIT(KAcmSettingsSection,"ACM %d"); -_LIT(KAcmProtocolNum,"ProtocolNum"); -_LIT(KAcmControlIfcName,"ControlInterfaceName"); -_LIT(KAcmDataIfcName,"DataInterfaceName"); // Lengths of the various bits of the ACM descriptor. Taken from the USB // WMCDC specification, v1.0. @@ -107,9 +109,7 @@ private: void DoStartL(); - void ReadAcmConfigurationL(); void DoStop(); - void ReadAcmIniDataL(CIniFile* aIniFile, TUint aCount, RBuf& aAcmControlIfcName, RBuf& aAcmDataIfcName); private: #ifdef USE_ACM_REGISTRATION_PORT @@ -120,8 +120,6 @@ #endif TInt iNumberOfAcmFunctions; TFixedArray iAcmProtocolNum; - TFixedArray iAcmControlIfcName; - TFixedArray iAcmDataIfcName; }; #endif //__CUSBACMCLASSCONTROLLER_H__ diff -r c2db6e29750c -r 96e575696901 usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/SRC/CUsbACMClassController.cpp --- a/usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/SRC/CUsbACMClassController.cpp Fri Mar 12 15:51:10 2010 +0200 +++ b/usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/SRC/CUsbACMClassController.cpp Mon Mar 15 12:46:46 2010 +0200 @@ -26,19 +26,19 @@ #include #include #include -#include "inifile.h" #include "UsbmanInternalConstants.h" #include #include "acmserverconsts.h" #ifdef __FLOG_ACTIVE _LIT8(KLogComponent, "ACMCC"); -#endif - // Panic category _LIT( KAcmCcPanicCategory, "UsbAcmCc" ); +#endif + + /** * Panic codes for the USB ACM Class Controller. @@ -49,10 +49,10 @@ EBadApiCallStart = 0, /** Asynchronous function called (not needed, as all requests complete synchronously) */ EUnusedFunction = 1, - /** Error reading ini file. */ - EPanicBadIniFile = 2, - /** Bad value for the iNumberOfAcmFunctions member.*/ - EPanicBadNumberOfAcmFunctions = 3, + /** Value reserved */ + EPanicReserved2 = 2, + /** Value reserved */ + EPanicReserved3 = 3, /** Stop called while in an illegal state */ EBadApiCallStop = 4, }; @@ -87,13 +87,7 @@ iComm.Close(); iCommServer.Close(); #else - // Clean up any interface name strings - for ( TUint i = 0 ; i < KMaximumAcmFunctions ; i++ ) - { - iAcmControlIfcName[i].Close(); - iAcmDataIfcName[i].Close(); - } - iAcmServer.Close(); + iAcmServer.Close(); #endif // USE_ACM_REGISTRATION_PORT } @@ -103,25 +97,24 @@ * @param aOwner USB Device that owns and manages the class */ CUsbACMClassController::CUsbACMClassController( - MUsbClassControllerNotify& aOwner) - : CUsbClassControllerPlugIn(aOwner, KAcmStartupPriority), - iNumberOfAcmFunctions(KDefaultNumberOfAcmFunctions) - { - // Initialise all elements to KDefaultAcmProtocolNum. - for ( TUint ii = 0 ; ii < KMaximumAcmFunctions ; ii++ ) - { - iAcmProtocolNum[ii] = KDefaultAcmProtocolNum; - // iAcmControlIfcName[ii] and iAcmDataIfcName[ii] are already set to empty strings (RBuf); - } - } + MUsbClassControllerNotify& aOwner) + : CUsbClassControllerPlugIn(aOwner, KAcmStartupPriority), + iNumberOfAcmFunctions(KDefaultNumberOfAcmFunctions) + { + } /** * 2nd Phase Construction. */ void CUsbACMClassController::ConstructL() - { - //open ini file to find out how many acm functions are needed and read in their configuration data - ReadAcmConfigurationL(); + { + iNumberOfAcmFunctions = KUsbAcmNumberOfAcmFunctions; + + iAcmProtocolNum[0] = KUsbAcmProtocolNumAcm1; + iAcmProtocolNum[1] = KUsbAcmProtocolNumAcm2; + iAcmProtocolNum[2] = KUsbAcmProtocolNumAcm3; + iAcmProtocolNum[3] = KUsbAcmProtocolNumAcm4; + iAcmProtocolNum[4] = KUsbAcmProtocolNumAcm5; // Prepare to use whichever mechanism is enabled to control bringing ACM // functions up and down. @@ -137,137 +130,11 @@ #else - LEAVEIFERRORL(iAcmServer.Connect()); + LEAVEIFERRORL(iAcmServer.Connect()); #endif // USE_ACM_REGISTRATION_PORT - } - -/** -* Searches numberofacmfunctions.ini file for protocol number and for control and data -* interface names, leaving if any is not found. -*/ -void CUsbACMClassController::ReadAcmIniDataL(CIniFile* aIniFile, TUint aCount, RBuf& aAcmControlIfcName, RBuf& aAcmDataIfcName) - { - LOG_FUNC - - TName sectionName; - TInt protocolNum; - -#ifdef __FLOG_ACTIVE - TName acmProtocolNum(KAcmProtocolNum); - TBuf8 narrowAcmProtocolNum; - narrowAcmProtocolNum.Copy(acmProtocolNum); -#endif - LOGTEXT3(_L8("\tLooking for ACM Section %d, keyword \"%S\""), aCount+1, &narrowAcmProtocolNum); - - sectionName.Format(KAcmSettingsSection,(aCount+1)); - -#ifdef __FLOG_ACTIVE - // Set up useful narrow logging strings. - TBuf8 narrowSectionName; - narrowSectionName.Copy(sectionName); -#endif - LOGTEXT2(_L8("\t Section Name %S"), &narrowSectionName); - - if (aIniFile->FindVar(sectionName, KAcmProtocolNum(), protocolNum)) - { - LOGTEXT3(_L8("\tACM Section %d: Protocol No %d"),aCount+1, protocolNum); - iAcmProtocolNum[aCount] = static_cast(protocolNum); - } - - // Search ini file for interface names. If either of the interface names does not exist then the - // descriptors remain at zero length. This is caught in DoStartL and the descriptors defaulted. - // Using this method saves memory on storing copies of the default interface names. - TPtrC ptrControlIfcName; - if (aIniFile->FindVar(sectionName, KAcmControlIfcName(), ptrControlIfcName)) - { - TPtrC ptrDataIfcName; - if (aIniFile->FindVar(sectionName, KAcmDataIfcName(), ptrDataIfcName)) - { - // Only copy the data if both interface names are valid - aAcmControlIfcName.CreateL(ptrControlIfcName); - aAcmControlIfcName.CleanupClosePushL(); - aAcmDataIfcName.CreateL(ptrDataIfcName); - CleanupStack::Pop(&aAcmControlIfcName); - } - } - -#ifdef __FLOG_ACTIVE - // Set up useful narrow logging strings. - TName dbgControlIfcName(aAcmControlIfcName); - TBuf8 narrowControlIfcName; - narrowControlIfcName.Copy(dbgControlIfcName); + } - TName dbgDataIfcName(aAcmDataIfcName); - TBuf8 narrowDataIfcName; - narrowDataIfcName.Copy(dbgDataIfcName); -#endif - LOGTEXT2(_L8("\t Control Interface Name %S"), &narrowControlIfcName); - LOGTEXT2(_L8("\t Data Interface Name %S"), &narrowDataIfcName); - } - -/** -Called when class Controller constructed -It opens a numberofacmfunctions.ini file and gets the info from there -Error behaviour: -If the ini file is not found the number of ACM functions, their protocol -settings and interface names will be the default values. -If a memory error occurs then leaves with KErrNoMemory. -If the ini file is created but the file contains invalid configuration then panic. -*/ -void CUsbACMClassController::ReadAcmConfigurationL() - { - LOG_FUNC - - // The number of ACM functions should at this point be as set in the - // constructor. - __ASSERT_DEBUG(static_cast(iNumberOfAcmFunctions) == KDefaultNumberOfAcmFunctions, - _USB_PANIC(KAcmCcPanicCategory, EPanicBadNumberOfAcmFunctions)); - - LOGTEXT3(_L("\ttrying to open file \"%S\" in directory \"%S\""), - &KAcmFunctionsIniFileName, &KUsbManPrivatePath); - - // First find the file - CIniFile* iniFile = NULL; - TRAPD (error, iniFile = CIniFile::NewL(KAcmFunctionsIniFileName, KUsbManPrivatePath)); - - if (error == KErrNotFound) - { - LOGTEXT(_L8("\tfile not found")); - } - else if (error != KErrNone) - { - LOGTEXT(_L8("\tini file was found, but couldn't be opened")); - LEAVEL(error); - } - else - { - LOGTEXT(_L8("\tOpened ini file")); - LOGTEXT3(_L("\tLooking for Section \"%S\", keyword \"%S\""), - &KAcmConfigSection, &KNumberOfAcmFunctionsKeyWord); - - CleanupStack::PushL(iniFile); - if ( !iniFile->FindVar(KAcmConfigSection(), KNumberOfAcmFunctionsKeyWord(), iNumberOfAcmFunctions) ) - { - // PANIC since this should only happen in development environment. - // The file is incorrectly written. - LOGTEXT(_L8("\tCan't find item")); - _USB_PANIC(KAcmCcPanicCategory, EPanicBadNumberOfAcmFunctions); - } - - LOGTEXT2(_L8("\tini file specifies %d ACM function(s)"), iNumberOfAcmFunctions); - - for ( TUint i = 0 ; i < iNumberOfAcmFunctions ; i++ ) - { - // Search ini file for the protocol number and interface names for - // the function, using defaults if any are not found. - // May leave with KErrNoMemory. - ReadAcmIniDataL(iniFile, i, iAcmControlIfcName[i], iAcmDataIfcName[i]); - } - CleanupStack::PopAndDestroy(iniFile); - } - } - /** * Called by UsbMan when it wants to start the USB ACM class. This always * completes immediately. @@ -293,57 +160,54 @@ LOG_FUNC iState = EUsbServiceStarting; + LOGTEXT2(_L8(" iNumberOfAcmFunctions = %d"), iNumberOfAcmFunctions); #ifdef USE_ACM_REGISTRATION_PORT - // Create ACM functions. - TUint acmSetting; - for ( TUint i = 0 ; i < iNumberOfAcmFunctions ; i++ ) - { - // indicate the number of ACMs to create, and its protocol number (in the 3rd-lowest byte) - acmSetting = 1 | (static_cast(iAcmProtocolNum[i])<< 16); - TInt err = iComm.SetSignalsToMark(acmSetting); - if ( err != KErrNone ) - { - LOGTEXT2(_L8(" SetSignalsToMark error = %d"), err); - if (i != 0) - { - // Must clear any ACMs that have completed. - // only other than KErrNone if C32 Server fails - (void)iComm.SetSignalsToSpace(i); - } - LEAVEL(err); - } - } + // Create ACM functions. + TUint acmSetting; + for (TUint i = 0; i < iNumberOfAcmFunctions; i++) + { + LOGTEXT2(_L8(" iAcmProtocolNum[i] = %d"), iAcmProtocolNum[i]); + + // indicate the number of ACMs to create, and its protocol number (in the 3rd-lowest byte) + acmSetting = 1 | (static_cast (iAcmProtocolNum[i]) << 16); + TInt err = iComm.SetSignalsToMark(acmSetting); + if (err != KErrNone) + { + LOGTEXT2(_L8(" SetSignalsToMark error = %d"), err); + if (i != 0) + { + // Must clear any ACMs that have completed. + // only other than KErrNone if C32 Server fails + (void) iComm.SetSignalsToSpace(i); + } + LEAVEL(err); + } + } #else // use ACM server + // Create ACM functions + for ( TInt i = 0; i < iNumberOfAcmFunctions; i++ ) + { + TInt err; + //Use default control interface name and data interface name + //For improving performance, control interface name and data interface name configurable + //is not supported now. + err = iAcmServer.CreateFunctions(1, iAcmProtocolNum[i], KControlIfcName, KDataIfcName); - // Create ACM functions - for ( TInt i = 0 ; i < iNumberOfAcmFunctions ; i++ ) - { - TInt err; - // Check for zero length descriptor and default it if so - if (iAcmControlIfcName[i].Length()) - { - err = iAcmServer.CreateFunctions(1, iAcmProtocolNum[i], iAcmControlIfcName[i], iAcmDataIfcName[i]); - } - else - { - err = iAcmServer.CreateFunctions(1, iAcmProtocolNum[i], KControlIfcName, KDataIfcName); - } - - if ( err != KErrNone ) - { - LOGTEXT2(_L8("\tFailed to create ACM function. Error: %d"), err); - if (i != 0) - { - //Must clear any ACMs that have been completed - iAcmServer.DestroyFunctions(i); - LOGTEXT2(_L8("\tDestroyed %d Interfaces"), i); - } - LEAVEL(err); - } - } + if ( err != KErrNone ) + { + LOGTEXT2(_L8("\tFailed to create ACM function. Error: %d"), err); + if (i != 0) + { + //Must clear any ACMs that have been completed + iAcmServer.DestroyFunctions(i); + LOGTEXT2(_L8("\tDestroyed %d Interfaces"), i); + } + LEAVEL(err); + } + } #endif // USE_ACM_REGISTRATION_PORT diff -r c2db6e29750c -r 96e575696901 usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/SRC/acmpatchedconsts.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/SRC/acmpatchedconsts.cpp Mon Mar 15 12:46:46 2010 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +* +*/ + +#include "CUsbACMClassController.h" + +extern const TUint32 KUsbAcmNumberOfAcmFunctions = KDefaultNumberOfAcmFunctions; + +extern const TInt32 KUsbAcmProtocolNumAcm1 = 1; +extern const TInt32 KUsbAcmProtocolNumAcm2 = 1; +extern const TInt32 KUsbAcmProtocolNumAcm3 = 1; +extern const TInt32 KUsbAcmProtocolNumAcm4 = 1; +extern const TInt32 KUsbAcmProtocolNumAcm5 = 1; + diff -r c2db6e29750c -r 96e575696901 usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/group/AcmClassControllerBase.mmp --- a/usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/group/AcmClassControllerBase.mmp Fri Mar 12 15:51:10 2010 +0200 +++ b/usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/group/AcmClassControllerBase.mmp Mon Mar 15 12:46:46 2010 +0200 @@ -25,12 +25,10 @@ SOURCEPATH ../SRC SOURCE CUsbAcmClassImpCollection.cpp SOURCE CUsbACMClassController.cpp +SOURCE acmpatchedconsts.cpp -SOURCEPATH ../../../../../inifile/src -SOURCE inifile.cpp USERINCLUDE ../INC -USERINCLUDE ../../../../../inifile/inc USERINCLUDE ../../classimplementation/ecacm/public USERINCLUDE ../../../../../usbman/server/public diff -r c2db6e29750c -r 96e575696901 usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/group/bld.inf --- a/usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/group/bld.inf Fri Mar 12 15:51:10 2010 +0200 +++ b/usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/group/bld.inf Mon Mar 15 12:46:46 2010 +0200 @@ -16,8 +16,8 @@ */ PRJ_EXPORTS -NumberOfAcmFunctions.ini /epoc32/data/z/private/101fe1db/numberofacmfunctions.ini - +usbacmconfiguration.hby /epoc32/rom/include/usbacmconfiguration.hby +usbacm.iby /epoc32/rom/include/usbacm.iby PRJ_MMPFILES // @@ -26,7 +26,7 @@ // // ACM Class Controller plugin support ACM::1 functions by default. The number of -// ACM functions can be changed by editing NumberOfAcmFunctions.ini file +// ACM functions can be changed by editing usbacmconfiguration.hby file AcmClassController.mmp PRJ_TESTMMPFILES diff -r c2db6e29750c -r 96e575696901 usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/group/usbacm.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/group/usbacm.iby Mon Mar 15 12:46:46 2010 +0200 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Configuration for ACM functions +* +*/ + +#ifndef USBACM_IBY +#define USBACM_IBY + +#include + +// *** Abstract Control Model (serial emulation) Class Controller. +#ifdef __ACM_REGPORT__ +USB_PLUGIN(t_regport_acmclasscontroller.dll,101fbf20.rsc) +#else +USB_PLUGIN(acmclasscontroller.dll,101fbf20.rsc) +#endif + + +#ifdef USBACM_PATCHDATA_KUSBACMNUMBEROFACMFUNCTIONS +patchdata acmclasscontroller.dll@KUsbAcmNumberOfAcmFunctions USBACM_PATCHDATA_KUSBACMNUMBEROFACMFUNCTIONS +#endif + +#ifdef USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM1 +patchdata acmclasscontroller.dll@KUsbAcmProtocolNumAcm1 USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM1 +#endif + + +#ifdef USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM2 +patchdata acmclasscontroller.dll@KUsbAcmProtocolNumAcm2 USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM2 +#endif + +#ifdef USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM3 +patchdata acmclasscontroller.dll@KUsbAcmProtocolNumAcm3 USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM3 +#endif + +#ifdef USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM4 +patchdata acmclasscontroller.dll@KUsbAcmProtocolNumAcm4 USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM4 +#endif + +#ifdef USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM5 +patchdata acmclasscontroller.dll@KUsbAcmProtocolNumAcm5 USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM5 +#endif + + +REM *** 'buildrom -D__TEST_USB_ZLP__' will use the ZLP version of the hby file. +REM *** Note that this is a test configuration only. +#ifndef __TEST_USB_ZLP__ + #include +#else //__TEST_USB_ZLP__ + #include +#endif //__TEST_USB_ZLP__ + +file=ABI_DIR\USB_DIR\acmserver.dll acmserver.dll +file=ABI_DIR\USB_DIR\ecacm.csy Ecacm.csy + + +#ifdef USBECACM_PATCHDATA_KUSBACMHOSTCANHANDLEZLPS +patchdata ecacm.csy@KUsbAcmHostCanHandleZLPs USBECACM_PATCHDATA_KUSBACMHOSTCANHANDLEZLPS +#endif + + +#endif // USBACM_IBY diff -r c2db6e29750c -r 96e575696901 usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/group/usbacmconfiguration.hby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/group/usbacmconfiguration.hby Mon Mar 15 12:46:46 2010 +0200 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Configuration for ACM functions +* +*/ + +#ifndef USBACMCONFIGURATION_HBY +#define USBACMCONFIGURATION_HBY + + +#define USBACM_PATCHDATA_KUSBACMNUMBEROFACMFUNCTIONS 1 + + +// USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM[X] is referring to the Xth ACM *function* +// which is accessed by the (X-1)th ACM *port* + +#define USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM1 1 +//0x01 - code taken from USBCDC 1.1 Table 17- Hayes compatible modem + +//#define USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM2 255 +//0xFF - Vendor-specific + +//#define USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM3 1 +//#define USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM4 1 +//#define USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM5 1 + +// To enable an ACM function, you need to change the +// value of USBACM_PATCHDATA_KUSBACMNUMBEROFACMFUNCTIONS, +// uncomment one define line then replace the protocol number with +// the ACM protocol number expected. +// + +#endif // USBACMCONFIGURATION_HBY diff -r c2db6e29750c -r 96e575696901 usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/group/BLD.INF --- a/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/group/BLD.INF Fri Mar 12 15:51:10 2010 +0200 +++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/group/BLD.INF Mon Mar 15 12:46:46 2010 +0200 @@ -23,9 +23,10 @@ PRJ_EXPORTS ../public/AcmInterface.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(acminterface.h) -ecacm.ini /epoc32/data/z/system/data/ecacm.ini ../public/AcmConfig.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(usb/acmconfig.h) +usbecacmconfiguration.hby /epoc32/rom/include/usbecacmconfiguration.hby +t_usbecacmconfiguration.hby /epoc32/rom/include/t_usbecacmconfiguration.hby PRJ_MMPFILES ECACM.MMP diff -r c2db6e29750c -r 96e575696901 usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/group/ECACM.MMP --- a/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/group/ECACM.MMP Fri Mar 12 15:51:10 2010 +0200 +++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/group/ECACM.MMP Mon Mar 15 12:46:46 2010 +0200 @@ -58,12 +58,9 @@ SOURCE acmsession.cpp SOURCE ActiveDataAvailableNotifier.cpp -SOURCEPATH ../../../../../../inifile/src -SOURCE inifile.cpp - USERINCLUDE ../inc USERINCLUDE ../public -USERINCLUDE ../../../../../../inifile/inc + OS_LAYER_SYSTEMINCLUDE_SYMBIAN LIBRARY euser.lib diff -r c2db6e29750c -r 96e575696901 usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/group/t_usbecacmconfiguration.hby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/group/t_usbecacmconfiguration.hby Mon Mar 15 12:46:46 2010 +0200 @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Configuration for ECACM +* +*/ + +#ifndef T_USBECACMCONFIGURATION_HBY +#define T_USBECACMCONFIGURATION_HBY + +#define USBECACM_PATCHDATA_KUSBACMHOSTCANHANDLEZLPS 1 + +#endif // T_USBECACMCONFIGURATION_HBY diff -r c2db6e29750c -r 96e575696901 usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/group/usbecacmconfiguration.hby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/group/usbecacmconfiguration.hby Mon Mar 15 12:46:46 2010 +0200 @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Configuration for ECACM +* +*/ + +#ifndef USBECACMCONFIGURATION_HBY +#define USBECACMCONFIGURATION_HBY + +#define USBECACM_PATCHDATA_KUSBACMHOSTCANHANDLEZLPS 0 + +#endif // USBECACMCONFIGURATION_HBY diff -r c2db6e29750c -r 96e575696901 usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/inc/CdcDataInterface.h --- a/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/inc/CdcDataInterface.h Fri Mar 12 15:51:10 2010 +0200 +++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/inc/CdcDataInterface.h Mon Mar 15 12:46:46 2010 +0200 @@ -25,7 +25,7 @@ #include "linkstatenotifier.h" #include "NotifyDataAvailableObserver.h" - +extern const TInt32 KUsbAcmHostCanHandleZLPs; class CActiveReadOneOrMoreReader; class CActiveReader; @@ -81,8 +81,6 @@ private: // from MNotifyDataAvailableObserver void NotifyDataAvailableCompleted(TInt aError); -private: - void GetHostZLPHandlingFromFile(); private: // owned CActiveReadOneOrMoreReader* iReadOneOrMoreReader; diff -r c2db6e29750c -r 96e575696901 usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/CdcAcmClass.cpp --- a/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/CdcAcmClass.cpp Fri Mar 12 15:51:10 2010 +0200 +++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/CdcAcmClass.cpp Mon Mar 15 12:46:46 2010 +0200 @@ -28,6 +28,8 @@ _LIT8(KLogComponent, "ECACM"); #endif +extern const TInt32 KUsbAcmHostCanHandleZLPs = 0; + CCdcAcmClass::CCdcAcmClass() /** * Constructor. diff -r c2db6e29750c -r 96e575696901 usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/CdcDataInterface.cpp --- a/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/CdcDataInterface.cpp Fri Mar 12 15:51:10 2010 +0200 +++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/CdcDataInterface.cpp Mon Mar 15 12:46:46 2010 +0200 @@ -23,7 +23,6 @@ #include "AcmUtils.h" #include "ActiveReadOneOrMoreReader.h" #include "ActiveDataAvailableNotifier.h" -#include "inifile.h" #include #ifdef __FLOG_ACTIVE @@ -83,10 +82,8 @@ iLinkState->Start(); - LOGTEXT(_L8("\tchecking ecacm.ini")); - iHostCanHandleZLPs = EFalse; - GetHostZLPHandlingFromFile(); - LOGTEXT(_L8("\tfinished checking ecacm.ini")); + iHostCanHandleZLPs = (KUsbAcmHostCanHandleZLPs != 0); + } TInt CCdcDataInterface::SetUpInterface() @@ -493,41 +490,6 @@ iReadOneOrMoreObserver = NULL; } - -void CCdcDataInterface::GetHostZLPHandlingFromFile() -/** - * Opens the ECACM.ini file to check on the capabilities of the host device. - * If the ini file cannot be found or read successfully, the default setting i.e. the - * host device CANNOT handle Zero Length Packets (set in CCdcAcmClass::ConstructL()), - * is kept. - */ - { - LOG_FUNC - - CIniFile* iniFile = NULL; - - _LIT(KEcacmIniFilename, "ecacm.ini" ); - _LIT(KEcacmIniFilePath, "\\system\\data\\" ); - - TRAPD(error, iniFile = CIniFile::NewL(KEcacmIniFilename, KEcacmIniFilePath)); - - if (error == KErrNone) - { - TInt hostHandlesZLPs = 1; - - _LIT(KHostUSBDeviceDriver, "HostUSBDeviceDriver"); - _LIT(KCanHandleZLP, "CanHandleZLP"); - - if ( iniFile->FindVar(KHostUSBDeviceDriver, KCanHandleZLP(), hostHandlesZLPs)) - { - iHostCanHandleZLPs = (( hostHandlesZLPs == 1 ) ? ETrue : EFalse ); - - LOGTEXT2(_L8("\tecacm.ini: CanHandleZLP=%d"), hostHandlesZLPs); - } - - delete iniFile; - } - } void CCdcDataInterface::NotifyDataAvailableCompleted(TInt aError) /** diff -r c2db6e29750c -r 96e575696901 usbmgmt/usbmgr/group/Usbmanbin.iby --- a/usbmgmt/usbmgr/group/Usbmanbin.iby Fri Mar 12 15:51:10 2010 +0200 +++ b/usbmgmt/usbmgr/group/Usbmanbin.iby Mon Mar 15 12:46:46 2010 +0200 @@ -1,5 +1,3 @@ - - /* * Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. @@ -31,6 +29,7 @@ #define USB_PLUGIN ECOM_PLUGIN #endif + // *** Check we have been given a sensible set of buildrom options #if defined (__OBEX_OVER_USB__) && (defined (__TEST_USB_ZLP__) || defined (__USBMAN_DUMMYCC__)) #error Defining both OBEX over USB _and_ Zero Length Packet testing or dummy class controllers does not make sense. @@ -60,6 +59,8 @@ REM Feature USB is not included in this ROM (usbman.iby) #else +#include + #ifndef __OBEX_OVER_USB__ #ifndef __TEST_USB_ZLP__ #ifdef __EXAMPLE_OBEX_CC__ @@ -113,13 +114,6 @@ file=ABI_DIR\USB_DIR\usbclasscontroller.dll usbclasscontroller.dll file=ABI_DIR\USB_DIR\usbmanextensionplugin.dll usbmanextensionplugin.dll -// *** Abstract Control Model (serial emulation) Class Controller. -#ifdef __ACM_REGPORT__ -USB_PLUGIN(t_regport_acmclasscontroller.dll,101fbf20.rsc) -#else -USB_PLUGIN(acmclasscontroller.dll,101fbf20.rsc) -#endif - #ifdef WITH_REFERENCE_USB_CHARGING_PLUGIN // *** Reference battery charging plug-in #if defined(SYMBIAN_ENABLE_USB_OTG_HOST) && defined (SYMBIAN_INCLUDE_USB_OTG_HOST) @@ -129,8 +123,6 @@ #endif #endif -file=ABI_DIR\USB_DIR\acmserver.dll acmserver.dll - // *** WHCM Class Controller - used for OBEX over USB. USB_PLUGIN(whcmclasscontroller.dll,101fbf23.rsc) @@ -145,10 +137,6 @@ // *** only. // USB_PLUGIN(Obexclasscontroller.dll,101fbf27.rsc) -// *** Uncomment the following file and modify if the number or type of ACM -// *** Functions required is different from the default -// data=ZPRIVATE\101fe1db\NumberOfAcmFunctions.ini private\101fe1db\NumberOfAcmFunctions.ini - #ifdef SYMBIAN_INCLUDE_USB_RNDIS // *** RNDIS Class Controller. diff -r c2db6e29750c -r 96e575696901 usbmgmt/usbmgr/group/usb.iby --- a/usbmgmt/usbmgr/group/usb.iby Fri Mar 12 15:51:10 2010 +0200 +++ b/usbmgmt/usbmgr/group/usb.iby Mon Mar 15 12:46:46 2010 +0200 @@ -31,17 +31,7 @@ #if defined(SYMBIAN_EXCLUDE_USB) || !defined(EUSBC) REM Feature USB is not included in this ROM (usb.iby) #else - -file=ABI_DIR\USB_DIR\ecacm.csy Ecacm.csy - -REM *** 'buildrom -D__TEST_USB_ZLP__' will use the ZLP version of the ini file. -REM *** Note that this is a test configuration only. -#ifndef __TEST_USB_ZLP__ - data=ZSYSTEM\data\ecacm.ini System\Data\ecacm.ini -#else //__TEST_USB_ZLP__ - data=ZSYSTEM\data\ecacm_for_usb_zlp_testing.ini System\Data\ecacm.ini -#endif //__TEST_USB_ZLP__ - +REM USB component can be added here. #endif // SYMBIAN_EXCLUDE_USB #endif diff -r c2db6e29750c -r 96e575696901 usbmgmt/usbmgr/usbman/server/SRC/CUsbServer.cpp --- a/usbmgmt/usbmgr/usbman/server/SRC/CUsbServer.cpp Fri Mar 12 15:51:10 2010 +0200 +++ b/usbmgmt/usbmgr/usbman/server/SRC/CUsbServer.cpp Mon Mar 15 12:46:46 2010 +0200 @@ -198,7 +198,10 @@ #ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV iUsbHost = CUsbHost::NewL(); - //moved to CUsbSession:StartDeviceL() and similar: iUsbHost->StartL(); + //previously this was moved to CUsbSession:StartDeviceL() and similar + //But it will cause the loading of personality longer. + //So it is moved back here. + iUsbHost->StartL(); #endif // SYMBIAN_ENABLE_USB_OTG_HOST_PRIV LOGTEXT(_L8("CUsbServer constructed")); diff -r c2db6e29750c -r 96e575696901 usbmgmt/usbmgr/usbman/server/SRC/CUsbSession.cpp --- a/usbmgmt/usbmgr/usbman/server/SRC/CUsbSession.cpp Fri Mar 12 15:51:10 2010 +0200 +++ b/usbmgmt/usbmgr/usbman/server/SRC/CUsbSession.cpp Mon Mar 15 12:46:46 2010 +0200 @@ -1862,18 +1862,27 @@ LOG_FUNC - if (!iHostEventObserverOutstanding) + if (!iHostEventObserverQueueEvents) { + //Never register + LOGTEXT(_L8("iHostEventObserverQueueEvents is FALSE!")); return KErrNone; } - iHostEventObserverOutstanding = EFalse; - iHostEventObserverMessage.Complete(KErrCancel); + if (iHostEventObserverOutstanding) + { + iHostEventObserverOutstanding = EFalse; + iHostEventObserverMessage.Complete(KErrCancel); + LOGTEXT(_L8("iHostEventObserverMessage.Complete(KErrCancel);")); + } // client doesn't need events queuing any more iHostEventObserverQueueEvents = EFalse; + //Reset OTG Host State Queue + iHostEventQueueHead = 0; + iHostEventQueueTail = 0; - return KErrNone; + return KErrNone; } /** diff -r c2db6e29750c -r 96e575696901 usbmgmt/usbmgr/usbman/server/group/backup_registration.xml --- a/usbmgmt/usbmgr/usbman/server/group/backup_registration.xml Fri Mar 12 15:51:10 2010 +0200 +++ b/usbmgmt/usbmgr/usbman/server/group/backup_registration.xml Mon Mar 15 12:46:46 2010 +0200 @@ -1,23 +1,22 @@ - - \ No newline at end of file + diff -r c2db6e29750c -r 96e575696901 usbmgmt/usbmgrtest/t_acm_pub_sub/group/Bld.inf --- a/usbmgmt/usbmgrtest/t_acm_pub_sub/group/Bld.inf Fri Mar 12 15:51:10 2010 +0200 +++ b/usbmgmt/usbmgrtest/t_acm_pub_sub/group/Bld.inf Mon Mar 15 12:46:46 2010 +0200 @@ -18,7 +18,7 @@ PRJ_TESTEXPORTS t_acm_pub_sub.iby /epoc32/rom/include/t_acm_pub_sub.iby -../data/NumberofAcmFunctions.ini z:/private/101fe1db/NumberOfAcmFunctions.ini +usbacmconfiguration.hby /epoc32/rom/include/usbacmconfiguration.hby PRJ_TESTMMPFILES diff -r c2db6e29750c -r 96e575696901 usbmgmt/usbmgrtest/t_acm_pub_sub/group/usbacmconfiguration.hby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbmgmt/usbmgrtest/t_acm_pub_sub/group/usbacmconfiguration.hby Mon Mar 15 12:46:46 2010 +0200 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Configuration for ACM functions +* +*/ + +#ifndef USBACMCONFIGURATION_HBY +#define USBACMCONFIGURATION_HBY + +#define USBACM_PATCHDATA_KUSBACMNUMBEROFACMFUNCTIONS 3 + +// USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM[X] is referring to the Xth ACM *function* +// which is accessed by the (X-1)th ACM *port* + +#define USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM1 1 +//0x01 - code taken from USBCDC 1.1 Table 17- Hayes compatible modem + +#define USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM2 255 +//0xFF - Vendor-specific + +#define USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM3 127 +//0x7F - Random code + +//#define USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM4 1 +//#define USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM5 1 + +// To enable an ACM function, you need to change the +// value of USBACM_PATCHDATA_KUSBACMNUMBEROFACMFUNCTIONS, +// uncomment one define line then replace the protocol number with +// the ACM protocol number expected. +// + +#endif // USBACMCONFIGURATION_HBY