# HG changeset patch # User hgs # Date 1277443179 -28800 # Node ID f3a1ae528deed76dabd126eacae457d339ba3503 # Parent 4ddb65515eddb03ff44461919b2aeef70c45d151 201025_03 diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgr/conf/usbmanager.confml Binary file usbmgmt/usbmgr/conf/usbmanager.confml has changed diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgr/group/Usbman.iby --- a/usbmgmt/usbmgr/group/Usbman.iby Fri Jun 25 13:07:44 2010 +0800 +++ b/usbmgmt/usbmgr/group/Usbman.iby Fri Jun 25 13:19:39 2010 +0800 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2003-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" @@ -25,8 +25,140 @@ #include #include -// Resources are in a separate file, for easier customisation -#include -#include +// If __USB_DEBUG__ is defined pull in debug versions of the +// USB DLLs and Plugins regardless of the ROM type +#ifdef __USB_DEBUG__ +define USB_DIR UDEB +#define USB_PLUGIN ECOM_PLUGIN_UDEB +#else +define USB_DIR BUILD_DIR +#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. +#endif + +// *** USBMAN.DLL is the client side. It is always included in the ROM, +// *** whether USB is supported by the device or not, so that client +// *** applications can link against it regardless. +file=ABI_DIR\USB_DIR\usbman.dll usbman.dll + +// The main backup registration file. Plug-ins should use its own backup registration file in order to back its perfered data. +data=ZPRIVATE\101fe1db\backup_registration.xml private\101fe1db\backup_registration.xml + +// *** USB logger. This is not dependent on EUSBC as it is used by +// *** usbman.dll. It compiles down to next to nothing when __FLOG_ACTIVE is +// *** undefined, and we cannot remove it altogether because things link +// *** against it. +file=ABI_DIR\USB_DIR\usblogger.dll usblogger.dll + +#if defined(_DEBUG) || defined (__USB_DEBUG__) +#include "commsdebugutility.iby" +#endif + +// *** Now for things which should only be included if the device supports +// *** USB, to save ROM space... +#if !defined(__USB) || !defined(EUSBC) +REM Feature USB is not included in this ROM (usbman.iby) +#else //defined(__USB) && defined(EUSBC) + +#include + +#ifndef __OBEX_OVER_USB__ + #ifndef __TEST_USB_ZLP__ + #ifdef __EXAMPLE_OBEX_CC__ + // *** OBEX Class Controller plugin. + USB_PLUGIN(obexclasscontroller.dll,1027433a.rsc) + // *** All the files needed by Obex Class Controller + // *** The executable that the class controller links to + file=ABI_DIR\BUILD_DIR\classControllerServerSession.exe sys\bin\classControllerServerSession.exe + // *** The dll that the class controller uses as a client + file=ABI_DIR\BUILD_DIR\classControllerClientSession.dll sys\bin\classControllerClientSession.dll + #endif //__EXAMPLE_OBEX_CC__ + #endif //__TEST_USB_ZLP__ +#endif //__OBEX_OVER_USB__ + +// *** 'buildrom -D__USBMAN_DUMMYCC__' will use the dummy Class Controller +// *** build of USBSVR for testing purposes. +// *** Note: DummyCC never includes OTG code. +#ifdef __USBMAN_DUMMYCC__ +#include +file=ABI_DIR\USB_DIR\t_usbman_dummycc.exe usbsvr.exe +#else +// +// Configuration of OTG or Client. +// +#if defined(SYMBIAN_ENABLE_USB_OTG_HOST) + + #if defined(SYMBIAN_INCLUDE_USB_OTG_HOST) + REM Feature USB Host (and related OTG) is included in this ROM (usbman.iby) + file=ABI_DIR\USB_DIR\usbsvrotg.exe usbsvr.exe + #include + REM Host Mass Storage binaries + #ifdef WITH_MASS_STORAGE + #include + #include + #endif + #else + REM Feature USB Host (and related OTG) is NOT included in this ROM (usbman.iby) + file=ABI_DIR\USB_DIR\usbsvr.exe usbsvr.exe + #endif // SYMBIAN_INCLUDE_USB_OTG_HOST + +#else + + REM SYMBIAN_ENABLE_USB_OTG_HOST is not defined - so we fall back to building in the + REM non-OTG usbsvr.exe + file=ABI_DIR\USB_DIR\usbsvr.exe usbsvr.exe + +#endif // SYMBIAN_ENABLE_USB_OTG_HOST + +#endif + +file=ABI_DIR\USB_DIR\usbclasscontroller.dll usbclasscontroller.dll +file=ABI_DIR\USB_DIR\usbmanextensionplugin.dll usbmanextensionplugin.dll + +#ifdef WITH_REFERENCE_USB_CHARGING_PLUGIN +// *** Reference battery charging plug-in +#if defined(SYMBIAN_ENABLE_USB_OTG_HOST) && defined (SYMBIAN_INCLUDE_USB_OTG_HOST) +USB_PLUGIN(usbbatterychargingpluginotg.dll,usbbatterychargingpluginotg.rsc) +#else +USB_PLUGIN(usbbatterychargingplugin.dll,usbbatterychargingplugin.rsc) +#endif +#endif + +// *** WHCM Class Controller - used for OBEX over USB. +USB_PLUGIN(whcmclasscontroller.dll,101fbf23.rsc) + +// *** Mass Storage Class Controller. +USB_PLUGIN(msclasscontroller.dll,10204bbb.rsc) +data=ZPRIVATE\10204bbb\usbms.rsc PRIVATE\101fe1db\usbms.rsc +#ifdef WITH_MASS_STORAGE_EXAMPLE_APP +file=ABI_DIR\USB_DIR\usbmsexampleapp.exe usbmsexampleapp.exe +#endif + +// *** OBEX Class Controller. This is test code, used for descriptor checking +// *** only. +// USB_PLUGIN(Obexclasscontroller.dll,101fbf27.rsc) + +#ifdef SYMBIAN_INCLUDE_USB_RNDIS +// *** RNDIS Class Controller. + +#include + +USB_PLUGIN(rndisclasscontroller.dll, rndisclasscontroller.rsc) +USB_PLUGIN(rndisproviders.dll, rndisproviders.rsc) + +// RNDIS IAP ID Backup registration file +data=ZPRIVATE\101fe1db\backup_registration_rndis.xml private\101fe1db\backup_registration_rndis.xml + +file=ABI_DIR\USB_DIR\rndispkt.drv System\Libs\rndispkt.drv +file=ABI_DIR\USB_DIR\rndismessages.dll System\Libs\rndismessages.dll +file=ABI_DIR\USB_DIR\rndisagt.agt System\Libs\rndisagt.agt +#endif // SYMBIAN_INCLUDE_USB_RNDIS + +#endif // !defined(__USB) || !defined(EUSBC) #endif // __USBMAN_IBY__ diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgr/group/Usbmanbin.iby --- a/usbmgmt/usbmgr/group/Usbmanbin.iby Fri Jun 25 13:07:44 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,158 +0,0 @@ -/* -* Copyright (c) 2003-2009 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: -* Universal Serial Bus Interface Manager Binaries -* -*/ - -#ifndef __USBMANBIN_IBY__ -#define __USBMANBIN_IBY__ - -// If __USB_DEBUG__ is defined pull in debug versions of the -// USB DLLs and Plugins regardless of the ROM type -#ifdef __USB_DEBUG__ -define USB_DIR UDEB -#define USB_PLUGIN ECOM_PLUGIN_UDEB -#else -define USB_DIR BUILD_DIR -#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. -#endif - -// *** USBMAN.DLL is the client side. It is always included in the ROM, -// *** whether USB is supported by the device or not, so that client -// *** applications can link against it regardless. -file=ABI_DIR\USB_DIR\usbman.dll usbman.dll - -// The main backup registration file. Plug-ins should use its own backup registration file in order to back its perfered data. -data=ZPRIVATE\101fe1db\backup_registration.xml private\101fe1db\backup_registration.xml - -// *** USB logger. This is not dependent on EUSBC as it is used by -// *** usbman.dll. It compiles down to next to nothing when __FLOG_ACTIVE is -// *** undefined, and we cannot remove it altogether because things link -// *** against it. -file=ABI_DIR\USB_DIR\usblogger.dll usblogger.dll - -#if defined(_DEBUG) || defined (__USB_DEBUG__) -#include "commsdebugutility.iby" -#endif - -// *** Now for things which should only be included if the device supports -// *** USB, to save ROM space... -#if !defined(__USB) || !defined(EUSBC) -REM Feature USB is not included in this ROM (usbman.iby) -#else //defined(__USB) && defined(EUSBC) - -#include - -#ifndef __OBEX_OVER_USB__ - #ifndef __TEST_USB_ZLP__ - #ifdef __EXAMPLE_OBEX_CC__ - // *** OBEX Class Controller plugin. - USB_PLUGIN(obexclasscontroller.dll,1027433a.rsc) - // *** All the files needed by Obex Class Controller - // *** The executable that the class controller links to - file=ABI_DIR\BUILD_DIR\classControllerServerSession.exe sys\bin\classControllerServerSession.exe - // *** The dll that the class controller uses as a client - file=ABI_DIR\BUILD_DIR\classControllerClientSession.dll sys\bin\classControllerClientSession.dll - #endif //__EXAMPLE_OBEX_CC__ - #endif //__TEST_USB_ZLP__ -#endif //__OBEX_OVER_USB__ - -// *** 'buildrom -D__USBMAN_DUMMYCC__' will use the dummy Class Controller -// *** build of USBSVR for testing purposes. -// *** Note: DummyCC never includes OTG code. -#ifdef __USBMAN_DUMMYCC__ -#include -file=ABI_DIR\USB_DIR\t_usbman_dummycc.exe usbsvr.exe -#else -// -// Configuration of OTG or Client. -// -#if defined(SYMBIAN_ENABLE_USB_OTG_HOST) - - #if defined(SYMBIAN_INCLUDE_USB_OTG_HOST) - REM Feature USB Host (and related OTG) is included in this ROM (usbman.iby) - file=ABI_DIR\USB_DIR\usbsvrotg.exe usbsvr.exe - #include - REM Host Mass Storage binaries - #ifdef WITH_MASS_STORAGE - #include - #include - #endif - #else - REM Feature USB Host (and related OTG) is NOT included in this ROM (usbman.iby) - file=ABI_DIR\USB_DIR\usbsvr.exe usbsvr.exe - #endif // SYMBIAN_INCLUDE_USB_OTG_HOST - -#else - - REM SYMBIAN_ENABLE_USB_OTG_HOST is not defined - so we fall back to building in the - REM non-OTG usbsvr.exe - file=ABI_DIR\USB_DIR\usbsvr.exe usbsvr.exe - -#endif // SYMBIAN_ENABLE_USB_OTG_HOST - -#endif - -file=ABI_DIR\USB_DIR\usbclasscontroller.dll usbclasscontroller.dll -file=ABI_DIR\USB_DIR\usbmanextensionplugin.dll usbmanextensionplugin.dll - -#ifdef WITH_REFERENCE_USB_CHARGING_PLUGIN -// *** Reference battery charging plug-in -#if defined(SYMBIAN_ENABLE_USB_OTG_HOST) && defined (SYMBIAN_INCLUDE_USB_OTG_HOST) -USB_PLUGIN(usbbatterychargingpluginotg.dll,usbbatterychargingpluginotg.rsc) -#else -USB_PLUGIN(usbbatterychargingplugin.dll,usbbatterychargingplugin.rsc) -#endif -#endif - -// *** WHCM Class Controller - used for OBEX over USB. -USB_PLUGIN(whcmclasscontroller.dll,101fbf23.rsc) - -// *** Mass Storage Class Controller. -USB_PLUGIN(msclasscontroller.dll,10204bbb.rsc) -data=ZPRIVATE\10204bbb\usbms.rsc PRIVATE\101fe1db\usbms.rsc -#ifdef WITH_MASS_STORAGE_EXAMPLE_APP -file=ABI_DIR\USB_DIR\usbmsexampleapp.exe usbmsexampleapp.exe -#endif - -// *** OBEX Class Controller. This is test code, used for descriptor checking -// *** only. -// USB_PLUGIN(Obexclasscontroller.dll,101fbf27.rsc) - -#ifdef SYMBIAN_INCLUDE_USB_RNDIS -// *** RNDIS Class Controller. - -#include - -USB_PLUGIN(rndisclasscontroller.dll, rndisclasscontroller.rsc) -USB_PLUGIN(rndisproviders.dll, rndisproviders.rsc) - -// RNDIS IAP ID Backup registration file -data=ZPRIVATE\101fe1db\backup_registration_rndis.xml private\101fe1db\backup_registration_rndis.xml - -file=ABI_DIR\USB_DIR\rndispkt.drv System\Libs\rndispkt.drv -file=ABI_DIR\USB_DIR\rndismessages.dll System\Libs\rndismessages.dll -file=ABI_DIR\USB_DIR\rndisagt.agt System\Libs\rndisagt.agt -#endif // SYMBIAN_INCLUDE_USB_RNDIS - -#endif // !defined(__USB) || !defined(EUSBC) - -#endif // __USBMANBIN_IBY__ diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgr/group/Usbmanrsc.iby --- a/usbmgmt/usbmgr/group/Usbmanrsc.iby Fri Jun 25 13:07:44 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ - -/* -* Copyright (c) 2003-2009 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: -* Universal Serial Bus Interface Manager Resources -* -*/ - -#ifndef __USBMANRSC_IBY__ -#define __USBMANRSC_IBY__ - - -// *** Only include resource files if device supports USB -#if !defined(__USB) || !defined(EUSBC) -REM Feature USB is not included in this ROM (usbman.iby) -#else // defined(__USB) && defined(EUSBC) - -DEFINE __USBMAN_RSC_ZPATH__ ZPRIVATE\101fe1db -DEFINE __USBMAN_RSC_PATH__ PRIVATE\101fe1db - - -#ifdef __TEST_USB_ZLP__ - // *** use the ZLP-configured resource file (PID and VID for the ACM CC are different) - data=__USBMAN_RSC_ZPATH__\usbmanzlp.rsc __USBMAN_RSC_PATH__\usbman.rsc -#else //__TEST_USB_ZLP__ - - #ifdef __EXAMPLE_OBEX_CC__ - // *** 'buildrom -D__EXAMPLE_OBEX_CC__' will use example Obex class controller - // *** The RSC file that was created when building the example source - data=__USBMAN_RSC_ZPATH__\obexusbman.rsc __USBMAN_RSC_PATH__\usbman.rsc - #else //__EXAMPLE_OBEX_CC__ - // *** This is the normal resource file.. - #ifndef USB_EXCLUDE_DEFAULT_PERSONALITIES - #ifndef __MTP_PROTOCOL_SUPPORT - #ifdef SYMBIAN_INCLUDE_USB_RNDIS - // *** Normal resource file including RNDIS support but excluding MTP - data=__USBMAN_RSC_ZPATH__\usbmanrndis.rsc __USBMAN_RSC_PATH__\usbman.rsc - #else - // *** Normal resource file excluding MTP and RNDIS support - data=__USBMAN_RSC_ZPATH__\usbman.rsc __USBMAN_RSC_PATH__\usbman.rsc - #endif // SYMBIAN_INCLUDE_USB_RNDIS - #else // defined(__MTP_PROTOCOL_SUPPORT) - #ifdef SYMBIAN_INCLUDE_USB_RNDIS - // *** Normal resource file including RNDIS and MTP support - data=__USBMAN_RSC_ZPATH__\usbmanmtprndis.rsc __USBMAN_RSC_PATH__\usbman.rsc - #else - // *** Normal resource file including MTP support but excluding RNDIS - data=__USBMAN_RSC_ZPATH__\usbmanmtp.rsc __USBMAN_RSC_PATH__\usbman.rsc - #endif // SYMBIAN_INCLUDE_USB_RNDIS - #endif // __MTP_PROTOCOL_SUPPORT - #endif // USB_EXCLUDE_DEFAULT_PERSONALITIES - #endif //__EXAMPLE_OBEX_CC__ -#endif //__TEST_USB_ZLP__ - -#endif // !defined(__USB) || !defined(EUSBC) - -#endif // __USBMANRSC_IBY__ diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgr/group/bld.inf --- a/usbmgmt/usbmgr/group/bld.inf Fri Jun 25 13:07:44 2010 +0800 +++ b/usbmgmt/usbmgr/group/bld.inf Fri Jun 25 13:19:39 2010 +0800 @@ -1,5 +1,5 @@ /* -* Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 1999-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" @@ -33,8 +33,6 @@ PRJ_EXPORTS usb.iby /epoc32/rom/include/usb.iby Usbman.iby /epoc32/rom/include/usbman.iby -Usbmanbin.iby /epoc32/rom/include/usbmanbin.iby -Usbmanrsc.iby /epoc32/rom/include/usbmanrsc.iby // ConfML Files ../conf/usbmanager.confml OS_LAYER_EXPORTS_CONFML(usbmanager.confml) diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgr/usbman/client/SRC/RUsb.cpp --- a/usbmgmt/usbmgr/usbman/client/SRC/RUsb.cpp Fri Jun 25 13:07:44 2010 +0800 +++ b/usbmgmt/usbmgr/usbman/client/SRC/RUsb.cpp Fri Jun 25 13:19:39 2010 +0800 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2003-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" @@ -750,28 +750,12 @@ return SendReceive(EUsbRequestSession); } -EXPORT_C TInt RUsb::GetDetailedDescription(TInt aPersonalityId, HBufC*& aLocalizedPersonalityDescriptor) +EXPORT_C TInt RUsb::GetDetailedDescription(TInt /*aPersonalityId*/, HBufC*& /*aLocalizedPersonalityDescriptor*/) { LOG_LINE LOG_FUNC - - TInt ret = KErrNone; - // caller is responsible for freeing up memory allocated for aLocalizedPersonalityDescriptor - TRAP(ret, aLocalizedPersonalityDescriptor = HBufC::NewL(KUsbStringDescStringMaxSize)); - if (ret == KErrNone) - { - TPtr ptr = aLocalizedPersonalityDescriptor->Des(); - TIpcArgs ipcArgs(0, &ptr); - ipcArgs.Set(0, aPersonalityId); - ret = SendReceive(EUsbGetDetailedDescription, ipcArgs); - } - else - { - // just in case caller tries to free the memory before checking the return code - aLocalizedPersonalityDescriptor = NULL; - } - - return ret; + //This API has been deprecated + return KErrNotSupported; } EXPORT_C TInt RUsb::GetPersonalityProperty(TInt aPersonalityId, TUint32& aProperty) diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgr/usbman/server/INC/CPersonality.h --- a/usbmgmt/usbmgr/usbman/server/INC/CPersonality.h Fri Jun 25 13:07:44 2010 +0800 +++ b/usbmgmt/usbmgr/usbman/server/INC/CPersonality.h Fri Jun 25 13:19:39 2010 +0800 @@ -1,5 +1,5 @@ /** -* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2004-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" @@ -29,60 +29,102 @@ #include #include "CUsbDevice.h" + +/** + * The CPersonalityConfigurations class keep all information of the table + * "Configuration" of USB cenrep + */ + +NONSHARABLE_CLASS(CPersonalityConfigurations) : public CBase + { +public: + /*USB Classes*/ + class TUsbClasses + { + public: + TUid iClassUid; + TInt iFeatureId; // Indicates the class is configurable or not. + }; +public: + void SetPersonalityId(TInt aPersonalityId); + void SetConfigId(TInt aConfigId); + inline const RArray& Classes() const; + void AppendClassesL(const TUsbClasses& aClasses ); + ~CPersonalityConfigurations(); + +private: + TInt iPersonalityId; /*Personality Id*/ + TInt iConfigId; /*Configuration Id*/ + RArray iClasses; /*Class array*/ + }; + NONSHARABLE_CLASS(CPersonality) : public CBase { public: static CPersonality* NewL(); ~CPersonality(); - TInt PersonalityId() const; - const RArray& SupportedClasses() const; - TInt ClassSupported(TUid aClassId) const; - const CUsbDevice::TUsbDeviceDescriptor& DeviceDescriptor() const; - CUsbDevice::TUsbDeviceDescriptor& DeviceDescriptor(); - const TDesC* Manufacturer() const; - const TDesC* Product() const; - const TDesC* Description() const; - TInt AddSupportedClasses(TUid aClassId); - void SetId(TInt aId); - void SetManufacturer(const TDesC* aManufacturer); - void SetProduct(const TDesC* aProduct); - void SetDescription(const TDesC* aDescription); + const RArray& SupportedClasses() const; + TBool ClassSupported(TUid aClassId) const; static TInt Compare(const TUid& aFirst, const TUid& aSecond); - const TDesC* DetailedDescription() const; - void SetDetailedDescription(const TDesC* aDetailedDescription); + inline TInt Version() const; + void SetVersion(TInt version); + + inline TUint32 Property() const; + void SetProperty(TUint32 aProperty); + + inline TUint8 DeviceClass() const; + void SetDeviceClass(TUint8 aDeviceClass); + + inline TUint8 DeviceSubClass() const; + void SetDeviceSubClass(TUint8 aDeviceSubClass); - TUint32 Property() const; - void SetProperty(TUint32 aProperty); - - TInt Version() const; - void SetVersion(TInt version); + inline TUint8 DeviceProtocol() const; + void SetDeviceProtocol(TUint8 aDeviceProtocol); + + inline TUint8 NumConfigurations() const; + void SetNumConfigurations(TUint8 aNumConfigurations); + + inline TUint16 ProductId() const; + void SetProductId(TUint16 aProductId); + + inline TInt FeatureId() const; + void SetFeatureId(TInt aFeatureId); + + inline TUint16 BcdDevice() const; + void SetBcdDevice(TUint16 aBcdDevice); + + inline TInt PersonalityId() const; + void SetPersonalityId(TInt aPersonalityId); + + inline const TDesC* Description() const; + void SetDescription(const TDesC* aDescription); + + inline const RPointerArray& PersonalityConfigs() const; + void AppendPersonalityConfigsL(const CPersonalityConfigurations *aPersonalityConfig ); private: CPersonality(); void ConstructL(); - + private: - // personality id - TInt iId; - // USB class ids - RArray iClassUids; - // textual description of manufacturer - HBufC* iManufacturer; - // textual description of product - HBufC* iProduct; - // textual description of personality - HBufC* iDescription; - // USB device descriptor struct - CUsbDevice::TUsbDeviceDescriptor iDeviceDescriptor; - // detailed textual description of personality - HBufC* iDetailedDescription; - - TInt iVersion; - TUint32 iProperty; + TInt iVersion; + TUint32 iProperty; + TUint8 iDeviceClass; + TUint8 iDeviceSubClass; + TUint8 iDeviceProtocol; + TUint8 iNumConfigurations; + TUint16 iProductId; + TInt iFeatureId; + TUint16 iBcdDevice; + TInt iPersonalityId; // personality id + HBufC* iDescription; // Own this Personality's description + RPointerArray iPersonalityConfigs; }; + + #include "CPersonality.inl" #endif // __CPERSONALITY_H__ diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgr/usbman/server/INC/CPersonality.inl --- a/usbmgmt/usbmgr/usbman/server/INC/CPersonality.inl Fri Jun 25 13:07:44 2010 +0800 +++ b/usbmgmt/usbmgr/usbman/server/INC/CPersonality.inl Fri Jun 25 13:19:39 2010 +0800 @@ -1,5 +1,5 @@ /** -* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2004-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" @@ -28,79 +28,6 @@ /** * @internalComponent - * @return personality id - */ -inline TInt CPersonality::PersonalityId() const - { - return iId; - } - -/** - * @internalComponent - * @return supported class uids - */ -inline const RArray& CPersonality::SupportedClasses() const - { - return iClassUids; - } - -/** - * @internalComponent - * @return a const reference to device descriptor - */ -inline const CUsbDevice::TUsbDeviceDescriptor& CPersonality::DeviceDescriptor() const - { - return iDeviceDescriptor; - } - -/** - * @internalComponent - * @return a const reference to device descriptor - */ -inline CUsbDevice::TUsbDeviceDescriptor& CPersonality::DeviceDescriptor() - { - return iDeviceDescriptor; - } - -/** - * @internalComponent - * @return a const pointer to manufacturer string - */ -inline const TDesC* CPersonality::Manufacturer() const - { - return iManufacturer; - } - -/** - * @internalComponent - * @return a const pointer to product string - */ -inline const TDesC* CPersonality::Product() const - { - return iProduct; - } - -/** - * @internalComponent - * @return a const pointer to description string - */ -inline const TDesC* CPersonality::Description() const - { - return iDescription; - } - -/** - * @internalComponent - * @return a const pointer to detailed description string - */ -inline const TDesC* CPersonality::DetailedDescription() const - { - return iDetailedDescription; - } - - -/** - * @internalComponent * @return version */ inline TInt CPersonality::Version() const @@ -116,5 +43,106 @@ { return iProperty; } + +/** + * @internalComponent + * @return the Device Class information + */ +inline TUint8 CPersonality::DeviceClass() const + { + return iDeviceClass; + } + +/** + * @internalComponent + * @return the Device Sub Class information + */ +inline TUint8 CPersonality::DeviceSubClass() const + { + return iDeviceSubClass; + } + +/** + * @internalComponent + * @return the Device Protocol information + */ +inline TUint8 CPersonality::DeviceProtocol() const + { + return iDeviceProtocol; + } + +/** + * @internalComponent + * @return the Configurations Number information + */ +inline TUint8 CPersonality::NumConfigurations() const + { + return iNumConfigurations; + } + +/** + * @internalComponent + * @return the Product Id information + */ +inline TUint16 CPersonality::ProductId() const + { + return iProductId; + } + +/** + * @internalComponent + * @return the Feature Id information + */ +inline TInt CPersonality::FeatureId() const + { + return iFeatureId; + } + +/** + * @internalComponent + * @return the Feature Id information + */ +inline TUint16 CPersonality::BcdDevice() const + { + return iBcdDevice; + } + +/** + * @internalComponent + * @return personality id + */ +inline TInt CPersonality::PersonalityId() const + { + return iPersonalityId; + } + +/** + * @internalComponent + * @return a const pointer to description string + */ +inline const TDesC* CPersonality::Description() const + { + return iDescription; + } + +/** + * @internalComponent + * @return a const pointer to Personality Configs + */ +inline const RPointerArray& CPersonality::PersonalityConfigs() const + { + return iPersonalityConfigs; + } + + +/** + * @internalComponent + * @return a const to Classes + */ +inline const RArray & CPersonalityConfigurations::Classes() const + { + return iClasses; + } + #endif // __PERSONALITY_INL__ diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgr/usbman/server/INC/CUsbDevice.h --- a/usbmgmt/usbmgr/usbman/server/INC/CUsbDevice.h Fri Jun 25 13:07:44 2010 +0800 +++ b/usbmgmt/usbmgr/usbman/server/INC/CUsbDevice.h Fri Jun 25 13:19:39 2010 +0800 @@ -1,5 +1,5 @@ /** -* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -35,12 +35,16 @@ #include #include + + class CUsbDeviceStateWatcher; class CUsbClassControllerBase; class CUsbServer; class MUsbDeviceNotify; class CPersonality; class CUsbmanExtensionPlugin; +class CUsbManCenRepManager; + const TUid KUidUsbPlugIns = {0x101fbf21}; @@ -74,14 +78,24 @@ TUint8 iDeviceProtocol; TUint8 iMaxPacketSize; TUint16 iIdVendor; - TUint16 iIdProduct; + TUint16 iProductId; TUint16 iBcdDevice; TUint8 iManufacturer; TUint8 iProduct; TUint8 iSerialNumber; TUint8 iNumConfigurations; }; - + + /** + * See Central Repository + */ + class TUsbDeviceConfiguration + { + public: + TUint16 iVendorId; + HBufC* iManufacturerName; + HBufC* iProductName; + }; public: static CUsbDevice* NewL(CUsbServer& aUsbServer); virtual ~CUsbDevice(); @@ -115,6 +129,7 @@ void ReadPersonalitiesL(); void SetDefaultPersonalityL(); void LoadFallbackClassControllersL(); + void ConvertUidsL(const TDesC& aStr, RArray& aUidArray); public: // From CActive void RunL(); @@ -137,14 +152,12 @@ private: void SetDeviceDescriptorL(); - void SetUsbDeviceSettingsL(TUsbDeviceDescriptor& aDeviceDescriptor); void SetUsbDeviceSettingsDefaultsL(TUsbDeviceDescriptor& aDeviceDescriptor); void SelectClassControllersL(); void SetCurrentPersonalityL(TInt aPersonalityId); void SetUsbDeviceSettingsFromPersonalityL(CUsbDevice::TUsbDeviceDescriptor& aDeviceDescriptor); void ResourceFileNameL(TFileName& aFileName); void CreateClassControllersL(const RArray& aClassUids); - void ConvertUidsL(const TDesC& aStr, RArray& aUidArray); TInt PowerUpAndConnect(); #ifdef __FLOG_ACTIVE void PrintDescriptor(CUsbDevice::TUsbDeviceDescriptor& aDeviceDescriptor); @@ -167,6 +180,8 @@ TBool iPersonalityCfged; TBool iUdcSupportsCableDetectWhenUnpowered; HBufC16* iDefaultSerialNumber; + CUsbManCenRepManager* iCenRepManager; // Own CenRepManager instance + TUsbDeviceConfiguration iDeviceConfiguration; REComSession* iEcom; // Not to be deleted, only closed! }; diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgr/usbman/server/INC/CUsbSession.h --- a/usbmgmt/usbmgr/usbman/server/INC/CUsbSession.h Fri Jun 25 13:07:44 2010 +0800 +++ b/usbmgmt/usbmgr/usbman/server/INC/CUsbSession.h Fri Jun 25 13:19:39 2010 +0800 @@ -1,5 +1,5 @@ /** -* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -97,7 +97,6 @@ TInt GetSupportedClasses(const RMessage2& aMessage); TInt GetPersonalityIds(const RMessage2& aMessage); TInt GetDescription(const RMessage2& aMessage); - TInt GetDetailedDescription(const RMessage2& aMessage); TInt ClassSupported(const RMessage2& aMessage); TInt GetPersonalityProperty(const RMessage2& aMessage); diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgr/usbman/server/INC/UsbSettings.h --- a/usbmgmt/usbmgr/usbman/server/INC/UsbSettings.h Fri Jun 25 13:07:44 2010 +0800 +++ b/usbmgmt/usbmgr/usbman/server/INC/UsbSettings.h Fri Jun 25 13:19:39 2010 +0800 @@ -1,5 +1,5 @@ /** -* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -50,16 +50,11 @@ _LIT(KUsbDefaultSerialNumber, "0123456789"); _LIT(KUsbDefaultConfig, "First and Last and Always"); -const TInt KUsbManagerResourceVersion = 0; -const TInt KUsbManagerResourceVersionNew = 1; - -enum TUsbManagerResourceVersion +enum TUsbManagerSupportedVersion { - EUsbManagerResourceVersionOne = 1, - EUsbManagerResourceVersionTwo = 2, - EUsbManagerResourceVersionThree = 3 + TUsbManagerSupportedVersionMin = 4, + TUsbManagerSupportedVersionFour = 4, + TUsbManagerSupportedVersionMax = 4 }; -_LIT(KUsbManagerResource, "z:\\private\\101fe1db\\usbman.rsc"); - #endif // __USBSETTINGS_H__ diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgr/usbman/server/INC/UsbmanServerSecurityPolicy.h --- a/usbmgmt/usbmgr/usbman/server/INC/UsbmanServerSecurityPolicy.h Fri Jun 25 13:07:44 2010 +0800 +++ b/usbmgmt/usbmgr/usbman/server/INC/UsbmanServerSecurityPolicy.h Fri Jun 25 13:19:39 2010 +0800 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2004-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" @@ -105,7 +105,6 @@ /** EUsbGetOtgDescriptor */ /** EUsbDbgAlloc */ /** EUsbRequestSession */ - /** EUsbGetDetailedDescription */ /** EUsbGetPersonalityProperty */ CPolicyServer::ENotSupported, /** EUsbGetPersonalityProperty + 1 to KMaxTInt */ diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgr/usbman/server/INC/usbmancenrepmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbmgmt/usbmgr/usbman/server/INC/usbmancenrepmanager.h Fri Jun 25 13:19:39 2010 +0800 @@ -0,0 +1,72 @@ +/* +* 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: +* +*/ + +/** + @file +*/ + +#ifndef USBMANCENREPMANAGER_H +#define USBMANCENREPMANAGER_H + +#include + +class CRepository; +class CPersonality; +class TUsbDeviceDescriptor; +class CUsbDevice; + +/** Helper class for tasks related to central repository. It reads settings from + * appropriate cenrep keys */ +NONSHARABLE_CLASS( CUsbManCenRepManager ) : public CBase +{ + public: + + /** Two-phased constructor. */ + static CUsbManCenRepManager* NewL(CUsbDevice& aUsbDevice); + + /** Destructor. */ + virtual ~CUsbManCenRepManager(); + + void ReadPersonalitiesL(RPointerArray& aPersonalities); + + void ReadDeviceConfigurationL(CUsbDevice::TUsbDeviceConfiguration& aDeviceConfig); + + private: + CUsbManCenRepManager(CUsbDevice& aUsbDevice); + + void ConstructL(); + + void CheckSignatureL(); + + void ReadConfigurationsForPersonalityL(TInt aPersonalityId, CPersonality& aPersonality); + + HBufC* ReadStringKeyLC( TUint32 aKeyId ); + TInt ReadKeyL ( TUint32 aKeyId ); + + TBool IsClassConfigurableL(TUint aClassId, TInt& aFeatureId); + TBool IsFeatureSupportedL(TInt aFeatureId); + + private: + /** Own repository instance */ + CRepository* iRepository; + /**reference to CUsbDevice*/ + CUsbDevice& iUsbDevice; + /*the USB Configuratiron signature*/ + TInt iSignature; +}; + +#endif /*USBMANCENREPMANAGER_H*/ diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgr/usbman/server/INC/usbmanprivatecrkeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbmgmt/usbmgr/usbman/server/INC/usbmanprivatecrkeys.h Fri Jun 25 13:19:39 2010 +0800 @@ -0,0 +1,73 @@ +/* +* 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: +* +*/ +#ifndef USBMANPRIVATECRKEYS_H +#define USBMANPRIVATECRKEYS_H + +const TUid KCRUidUSBManagerConfiguration = { 0x101fe1db }; + +// Keys for USB configuration format +const TUint32 KUsbManConfigSign = 0; + +const TUint32 KUsbManDevicePartialKey = 0x00010000; +const TUint32 KUsbManDeviceCountIndexKey = 0x0001ff00; + +const TUint32 KUsbManDeviceConfigurationsPartialKey = 0x00020000; +const TUint32 KUsbManDeviceConfigurationsCountIndexKey = 0x0002ff00; + +const TUint32 KUsbManDevicePersonalitiesPartialKey = 0x00030000; +const TUint32 KUsbManDevicePersonalitiesCountIndexKey = 0x0003ff00; + +const TUint32 KUsbManDeviceConfigurableClassesPartialKey = 0x00040000; +const TUint32 KUsbManDeviceConfigurableClassesCountIndexKey = 0x0004ff00; + +const TUint32 KUsbManConfigKeyMask = 0x00FFFF00; +const TUint32 KUsbManConfigIndexMask = 0x0000FF00; +const TUint32 KUsbManConfigFieldMask = 0x000000FF; +const TUint32 KUsbManConfigFirstEntryMask = 0x00FF00FF; + +const TUint32 KUsbManPersonalitiesOffset = 8; + +const TInt KUsbManFeatureNotConfigurable = -1; + +//Device +const TUint32 KUsbManDeviceVendorIdKey = 0x00000000; +const TUint32 KUsbManDeviceManufacturerNameKey = 0x00000001; +const TUint32 KUsbManDeviceProductNameKey = 0x00000002; + +//Configurations +const TUint32 KUsbManDeviceConfigurationsPersonalityIdKey = 0x00000000; +const TUint32 KUsbManDeviceConfigurationsIdKey = 0x00000001; +const TUint32 KUsbManDeviceConfigurationsClassUidsKey = 0x00000002; +const TUint32 KUsbManDeviceConfigurationsKeyCountVersionFour = 3; //Key count of each configuration. + +//Personalities +const TUint32 KUsbManDevicePersonalitiesDeviceClassKey = 0x00000000; +const TUint32 KUsbManDevicePersonalitiesDeviceSubClassKey = 0x00000001; +const TUint32 KUsbManDevicePersonalitiesProtocolKey = 0x00000002; +const TUint32 KUsbManDevicePersonalitiesNumConfigKey = 0x00000003; +const TUint32 KUsbManDevicePersonalitiesProductIdKey = 0x00000004; +const TUint32 KUsbManDevicePersonalitiesBcdDeviceKey = 0x00000005; +const TUint32 KUsbManDevicePersonalitiesFeatureIdKey = 0x00000006; +const TUint32 KUsbManDevicePersonalitiesPersonalityIdKey = 0x00000007; +const TUint32 KUsbManDevicePersonalitiesPropertyKey = 0x00000008; +const TUint32 KUsbManDevicePersonalitiesDescriptionKey = 0x00000009; + +//Configurable Classes +const TUint32 KUsbManDeviceConfigurableClassesUidKey = 0x00000000; +const TUint32 KUsbManDeviceConfigurableClassesFeatureIdKey = 0x00000001; + +#endif // USBMANPRIVATECRKEYS_H diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgr/usbman/server/SRC/CPersonality.cpp --- a/usbmgmt/usbmgr/usbman/server/SRC/CPersonality.cpp Fri Jun 25 13:07:44 2010 +0800 +++ b/usbmgmt/usbmgr/usbman/server/SRC/CPersonality.cpp Fri Jun 25 13:19:39 2010 +0800 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2004-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" @@ -21,13 +21,26 @@ @internalAll */ +#include #include "CPersonality.h" -#include #ifdef __FLOG_ACTIVE _LIT8(KLogComponent, "USBSVR"); #endif +// Panic category only used in debug builds +#ifdef _DEBUG +_LIT(KUsbPersonalityPanicCategory, "CUsbPersonality"); +#endif + +/** + * Panic codes for the USB Personality Class + */ +enum TUsbPersonalityPanic + { + EPersonalityConfigsArrayEmpty, + }; + /** * Factory method. Constructs a CPersonality object. * @@ -45,20 +58,12 @@ } /** - * Allocates max amount of memory for each of 3 strings + * Allocates max amount of memory for description string */ void CPersonality::ConstructL() { LOG_FUNC - - iManufacturer = HBufC::NewLC(KUsbStringDescStringMaxSize); - CleanupStack::Pop(); - iProduct = HBufC::NewLC(KUsbStringDescStringMaxSize); - CleanupStack::Pop(); - iDescription = HBufC::NewLC(KUsbStringDescStringMaxSize); - CleanupStack::Pop(); - iDetailedDescription = HBufC::NewLC(KUsbStringDescStringMaxSize); - CleanupStack::Pop(); + iDescription = HBufC::NewL(KUsbStringDescStringMaxSize); } /** @@ -74,61 +79,38 @@ CPersonality::~CPersonality() { LOG_FUNC - - iClassUids.Close(); - delete iManufacturer; - delete iProduct; + iPersonalityConfigs.ResetAndDestroy(); delete iDescription; - delete iDetailedDescription; - } - -/** - * @return the index of the first match or KErrNotFound - */ -TInt CPersonality::ClassSupported(TUid aClassUid) const - { - TIdentityRelation relation(CPersonality::Compare); - return iClassUids.Find(aClassUid, relation); - } - -/** - * @return KErrNone or system wide error code - */ -TInt CPersonality::AddSupportedClasses(TUid aClassUid) - { - return iClassUids.Append(aClassUid); } /** - * Sets personality id + * @return supported class uids */ -void CPersonality::SetId(TInt aId) - { - iId = aId; - } +const RArray& CPersonality::SupportedClasses() const + { + //we only support configuration 0 now + __ASSERT_DEBUG( iPersonalityConfigs.Count() != 0, _USB_PANIC(KUsbPersonalityPanicCategory, EPersonalityConfigsArrayEmpty) ); + return iPersonalityConfigs[0]->Classes(); + } /** - * Sets manufacturer textual description - */ -void CPersonality::SetManufacturer(const TDesC* aManufacturer) + * @return ETrue if this class is supported + * otherwise return EFalse + */ +TBool CPersonality::ClassSupported(TUid aClassUid) const { - iManufacturer->Des().Copy(*aManufacturer); - } - -/** - * Sets product textual description - */ -void CPersonality::SetProduct(const TDesC* aProduct) - { - iProduct->Des().Copy(*aProduct); - } - -/** - * Sets personality textual description - */ -void CPersonality::SetDescription(const TDesC* aDescription) - { - iDescription->Des().Copy((*aDescription).Left(KUsbStringDescStringMaxSize-1)); + //we only support configuration 0 now + __ASSERT_DEBUG( iPersonalityConfigs.Count() != 0, _USB_PANIC(KUsbPersonalityPanicCategory, EPersonalityConfigsArrayEmpty) ); + const RArray &classes = iPersonalityConfigs[0]->Classes(); + TInt classesCount = classes.Count(); + for(TInt classesIndex = 0; classesIndex < classesCount; ++classesIndex) + { + if(aClassUid == classes[classesIndex].iClassUid) + { + return ETrue; + } + } + return EFalse; } /** @@ -142,14 +124,6 @@ }; /** - * Sets detailed personality textual description - */ -void CPersonality::SetDetailedDescription(const TDesC* aDetailedDescription) - { - iDetailedDescription->Des().Copy((*aDetailedDescription).Left(KUsbStringDescStringMaxSize-1)); - } - -/** * Sets version */ void CPersonality::SetVersion(TInt aVersion) @@ -164,3 +138,117 @@ { iProperty = aProperty; } + +/** + * Sets DeviceClass + */ +void CPersonality::SetDeviceClass(TUint8 aDeviceClass) + { + iDeviceClass = aDeviceClass; + } + +/** + * Sets DeviceSubClass + */ +void CPersonality::SetDeviceSubClass(TUint8 aDeviceSubClass) + { + iDeviceSubClass = aDeviceSubClass; + } + +/** + * Sets DeviceProtocol + */ +void CPersonality::SetDeviceProtocol(TUint8 aDeviceProtocol) + { + iDeviceProtocol = aDeviceProtocol; + } + +/** + * Sets NumConfigurations + */ +void CPersonality::SetNumConfigurations(TUint8 aNumConfigurations) + { + iNumConfigurations = aNumConfigurations; + } + +/** + * Sets ProductId + */ +void CPersonality::SetProductId(TUint16 aProductId) + { + iProductId = aProductId; + } + +/** + * Sets FeatureId + */ +void CPersonality::SetFeatureId(TInt aFeatureId) + { + iFeatureId = aFeatureId; + } + +/** + * Sets BcdDevice + */ +void CPersonality::SetBcdDevice(TUint16 aBcdDevice) + { + iBcdDevice = aBcdDevice; + } + +/** + * Sets personality id + */ +void CPersonality::SetPersonalityId(TInt aPersonalityId) + { + iPersonalityId = aPersonalityId; + } + +/** + * Sets Description + */ +void CPersonality::SetDescription(const TDesC* aDescription) + { + iDescription->Des().Copy((*aDescription).Left(KUsbStringDescStringMaxSize-1)); + } + +/** + * Append PersonalityConfig + */ +void CPersonality::AppendPersonalityConfigsL(const CPersonalityConfigurations *aPersonalityConfig ) + { + iPersonalityConfigs.AppendL(aPersonalityConfig); + } + +/** + * Sets personality id + */ +void CPersonalityConfigurations::SetPersonalityId(TInt aPersonalityId) + { + iPersonalityId = aPersonalityId; + } + +/** + * Sets Config Id + */ +void CPersonalityConfigurations::SetConfigId(TInt aConfigId) + { + iConfigId = aConfigId; + } + + +/** + * Append PersonalityConfig + */ +void CPersonalityConfigurations::AppendClassesL(const TUsbClasses &aClasses ) + { + iClasses.AppendL(aClasses); + } + +/** + * De-Constructor + */ +CPersonalityConfigurations::~CPersonalityConfigurations() + { + LOG_FUNC + iClasses.Close(); + } diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgr/usbman/server/SRC/CUsbDevice.cpp --- a/usbmgmt/usbmgr/usbman/server/SRC/CUsbDevice.cpp Fri Jun 25 13:07:44 2010 +0800 +++ b/usbmgmt/usbmgr/usbman/server/SRC/CUsbDevice.cpp Fri Jun 25 13:19:39 2010 +0800 @@ -1,5 +1,5 @@ /* -* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -21,33 +21,32 @@ @file */ -#include "CUsbDevice.h" -#include "CUsbDeviceStateWatcher.h" #include -#include "MUsbDeviceNotify.h" -#include "UsbSettings.h" -#include "CUsbServer.h" #include #include -#include "UsbUtils.h" #include - -#ifdef USE_DUMMY_CLASS_CONTROLLER -#include "CUsbDummyClassController.h" -#endif - #include #include #include #include #include -#include #include #include #include #include #include //Publish & Subscribe header +#ifdef USE_DUMMY_CLASS_CONTROLLER +#include "CUsbDummyClassController.h" +#endif +#include "MUsbDeviceNotify.h" +#include "UsbSettings.h" +#include "CUsbServer.h" +#include "UsbUtils.h" +#include "CUsbDevice.h" +#include "CUsbDeviceStateWatcher.h" #include "CPersonality.h" +#include "usbmancenrepmanager.h" +#include "usbmanprivatecrkeys.h" _LIT(KUsbLDDName, "eusbc"); //Name used in call to User::LoadLogicalDevice _LIT(KUsbLDDFreeName, "Usbc"); //Name used in call to User::FreeLogicalDevice @@ -108,6 +107,11 @@ iSupportedClassUids.Close(); iExtensionPlugins.ResetAndDestroy(); + + delete iCenRepManager; + + delete iDeviceConfiguration.iManufacturerName; + delete iDeviceConfiguration.iProductName; if(iEcom) iEcom->Close(); @@ -165,8 +169,11 @@ iEcom = &(REComSession::OpenL()); iUsbClassControllerIterator = new(ELeave) CUsbClassControllerIterator(iSupportedClasses); + iCenRepManager = CUsbManCenRepManager::NewL(*this); -#ifndef __OVER_DUMMYUSBDI__ + iDeviceConfiguration.iManufacturerName = HBufC::NewL(KUsbStringDescStringMaxSize); + iDeviceConfiguration.iProductName = HBufC::NewL(KUsbStringDescStringMaxSize); +#ifndef __OVER_DUMMYUSBDI__ #ifndef __WINS__ LOGTEXT(_L8("About to load LDD")); TInt err = User::LoadLogicalDevice(KUsbLDDName); @@ -787,7 +794,7 @@ LOGTEXT2(_L8("\tiMaxPacketSize is: 0x%02x"), aDeviceDescriptor.iMaxPacketSize); LOGTEXT2(_L8("\tVendorId is: 0x%04x"), aDeviceDescriptor.iIdVendor); - LOGTEXT2(_L8("\tProductId is: 0x%04x"), aDeviceDescriptor.iIdProduct); + LOGTEXT2(_L8("\tProductId is: 0x%04x"), aDeviceDescriptor.iProductId); LOGTEXT2(_L8("\tBcdDevice is: 0x%04x"), aDeviceDescriptor.iBcdDevice); LOGTEXT2(_L8("\tiManufacturer is: 0x%04x"), aDeviceDescriptor.iManufacturer); @@ -839,7 +846,8 @@ } else { - SetUsbDeviceSettingsL(*deviceDescriptor); + LOGTEXT(_L8("USB configuration is not read")); + LEAVEL(KErrNotFound); } #ifndef __OVER_DUMMYUSBDI__ @@ -870,140 +878,7 @@ aDeviceDescriptor.iDeviceSubClass = KUsbDefaultDeviceSubClass; aDeviceDescriptor.iDeviceProtocol = KUsbDefaultDeviceProtocol; aDeviceDescriptor.iIdVendor = KUsbDefaultVendorId; - aDeviceDescriptor.iIdProduct = KUsbDefaultProductId; - } - -void CUsbDevice::SetUsbDeviceSettingsL(CUsbDevice::TUsbDeviceDescriptor& aDeviceDescriptor) -/** - * Configure the USB device, reading in the settings from a - * resource file where possible. - * - * @param aDeviceDescriptor The device descriptor for the USB device - */ - { - LOG_FUNC - - // First, use the default values - LOGTEXT(_L8("Setting default values for the configuration")); - SetUsbDeviceSettingsDefaultsL(aDeviceDescriptor); - - // Now try to get the configuration from the resource file - RFs fs; - LEAVEIFERRORL(fs.Connect()); - CleanupClosePushL(fs); - - RResourceFile resource; - TRAPD(err, resource.OpenL(fs, KUsbManagerResource)); - LOGTEXT2(_L8("Opened resource file with error %d"), err); - - if (err != KErrNone) - { - LOGTEXT(_L8("Unable to open resource file: using default settings")); - CleanupStack::PopAndDestroy(&fs); - return; - } - - CleanupClosePushL(resource); - - resource.ConfirmSignatureL(KUsbManagerResourceVersion); - - HBufC8* id = resource.AllocReadLC(USB_CONFIG); - - // The format of the USB resource structure is: - // - // STRUCT usb_configuration - // { - // WORD vendorId = 0x0e22; - // WORD productId = 0x000b; - // WORD bcdDevice = 0x0000; - // LTEXT manufacturer = "Symbian Ltd."; - // LTEXT product = "Symbian OS"; - // } - // - // Note that the resource must be read in this order! - - TResourceReader reader; - reader.SetBuffer(id); - - aDeviceDescriptor.iIdVendor = static_cast(reader.ReadUint16()); - aDeviceDescriptor.iIdProduct = static_cast(reader.ReadUint16()); - aDeviceDescriptor.iBcdDevice = static_cast(reader.ReadUint16()); - - // Try to read device and manufacturer name from new SysUtil API - TPtrC16 sysUtilModelName; - TPtrC16 sysUtilManuName; - - // This method returns ownership. - CDeviceTypeInformation* deviceInfo = SysUtil::GetDeviceTypeInfoL(); - CleanupStack::PushL(deviceInfo); - TInt gotSysUtilModelName = deviceInfo->GetModelName(sysUtilModelName); - TInt gotSysUtilManuName = deviceInfo->GetManufacturerName(sysUtilManuName); - - TPtrC manufacturerString = reader.ReadTPtrC(); - TPtrC productString = reader.ReadTPtrC(); - - // If we succesfully read the manufacturer or device name from SysUtil API - // then set these results, otherwise use the values defined in resource file -#ifndef __OVER_DUMMYUSBDI__ -#ifndef __WINS__ - if (gotSysUtilManuName == KErrNone) - { - LEAVEIFERRORL(iLdd.SetManufacturerStringDescriptor(sysUtilManuName)); - } - else - { - LEAVEIFERRORL(iLdd.SetManufacturerStringDescriptor(manufacturerString)); - } - - if (gotSysUtilModelName == KErrNone) - { - LEAVEIFERRORL(iLdd.SetProductStringDescriptor(sysUtilModelName)); - } - else - { - LEAVEIFERRORL(iLdd.SetProductStringDescriptor(productString)); - } - -#endif -#endif // __OVER_DUMMYUSBDI__ - -#ifdef __FLOG_ACTIVE - PrintDescriptor(aDeviceDescriptor); - TBuf8 narrowString; - narrowString.Copy(manufacturerString); - LOGTEXT2(_L8("Manufacturer is: '%S'"), &narrowString); - narrowString.Copy(productString); - LOGTEXT2(_L8("Product is: '%S'"), &narrowString); -#endif // __FLOG_ACTIVE - -#ifndef __OVER_DUMMYUSBDI__ -#ifndef __WINS__ - //Read the published serial number. The key is the UID KUidUsbmanServer = 0x101FE1DB - TBuf16 serNum; - TInt r = RProperty::Get(KUidSystemCategory,0x101FE1DB,serNum); - if(r==KErrNone) - { -#ifdef __FLOG_ACTIVE - TBuf8 narrowString; - narrowString.Copy(serNum); - LOGTEXT2(_L8("Setting published SerialNumber: %S"), &narrowString); -#endif // __FLOG_ACTIVE - //USB spec doesn't give any constraints on what constitutes a valid serial number. - //As long as it is a string descriptor it is valid. - LEAVEIFERRORL(iLdd.SetSerialNumberStringDescriptor(serNum)); - } -#ifdef __FLOG_ACTIVE - else - { - LOGTEXT(_L8("SerialNumber has not been published")); - } -#endif // __FLOG_ACTIVE - -#endif -#endif // __OVER_DUMMYUSBDI__ - - - CleanupStack::PopAndDestroy(4, &fs); // deviceInfo, id, resource, fs + aDeviceDescriptor.iProductId = KUsbDefaultProductId; } void CUsbDevice::SetUsbDeviceSettingsFromPersonalityL(CUsbDevice::TUsbDeviceDescriptor& aDeviceDescriptor) @@ -1020,20 +895,19 @@ SetUsbDeviceSettingsDefaultsL(aDeviceDescriptor); // Now try to get the configuration from the current personality - const CUsbDevice::TUsbDeviceDescriptor& deviceDes = iCurrentPersonality->DeviceDescriptor(); - aDeviceDescriptor.iDeviceClass = deviceDes.iDeviceClass; - aDeviceDescriptor.iDeviceSubClass = deviceDes.iDeviceSubClass; - aDeviceDescriptor.iDeviceProtocol = deviceDes.iDeviceProtocol; - aDeviceDescriptor.iIdVendor = deviceDes.iIdVendor; - aDeviceDescriptor.iIdProduct = deviceDes.iIdProduct; - aDeviceDescriptor.iBcdDevice = deviceDes.iBcdDevice; - aDeviceDescriptor.iSerialNumber = deviceDes.iSerialNumber; - aDeviceDescriptor.iNumConfigurations = deviceDes.iNumConfigurations; + aDeviceDescriptor.iDeviceClass = iCurrentPersonality->DeviceClass(); + aDeviceDescriptor.iDeviceSubClass = iCurrentPersonality->DeviceSubClass(); + aDeviceDescriptor.iDeviceProtocol = iCurrentPersonality->DeviceProtocol(); + aDeviceDescriptor.iIdVendor = iDeviceConfiguration.iVendorId; + aDeviceDescriptor.iProductId = iCurrentPersonality->ProductId(); + aDeviceDescriptor.iBcdDevice = iCurrentPersonality->BcdDevice(); + aDeviceDescriptor.iNumConfigurations = iCurrentPersonality->NumConfigurations(); + #ifndef __OVER_DUMMYUSBDI__ #ifndef __WINS__ - LEAVEIFERRORL(iLdd.SetManufacturerStringDescriptor(*(iCurrentPersonality->Manufacturer()))); - LEAVEIFERRORL(iLdd.SetProductStringDescriptor(*(iCurrentPersonality->Product()))); + LEAVEIFERRORL(iLdd.SetManufacturerStringDescriptor(*(iDeviceConfiguration.iManufacturerName))); + LEAVEIFERRORL(iLdd.SetProductStringDescriptor(*(iDeviceConfiguration.iProductName))); //Read the published serial number. The key is the UID KUidUsbmanServer = 0x101FE1DB TBuf16 serNum; @@ -1171,15 +1045,17 @@ TInt personalityCount = iSupportedPersonalities.Count(); for (TInt i = 0; i < personalityCount; i++) { - const RArray& classUids = iSupportedPersonalities[i]->SupportedClasses(); - TInt uidCount = classUids.Count(); + const RArray& classes = iSupportedPersonalities[i]->SupportedClasses(); + TInt uidCount = classes.Count(); for (TInt j = 0; j < uidCount; j++) { TInt ccCount = iSupportedClassUids.Count(); TInt k; + LOGTEXT2(_L8("iSupportedClassUids Count = %d"),ccCount); for (k = 0; k < ccCount; k++) { - if (iSupportedClassUids[k] == classUids[j]) + LOGTEXT5(_L8("iSupportedClassUids %d %x classes %d %x"), k, iSupportedClassUids[k].iUid, j, classes[j].iClassUid.iUid); + if (iSupportedClassUids[k] == classes[j].iClassUid) { break; } @@ -1204,6 +1080,7 @@ */ void CUsbDevice::ConvertUidsL(const TDesC& aStr, RArray& aUidArray) { + LOG_FUNC // Function assumes that aUIDs is empty __ASSERT_DEBUG( aUidArray.Count() == 0, _USB_PANIC(KUsbDevicePanicCategory, EUidArrayNotEmpty) ); @@ -1228,214 +1105,36 @@ } void CUsbDevice::ReadPersonalitiesL() -/** - * Reads configured personalities from the resource file - */ - { - LOG_FUNC - iPersonalityCfged = EFalse; - // Now try to connect to file server - RFs fs; - LEAVEIFERRORL(fs.Connect()); - CleanupClosePushL(fs); - - TFileName resourceFileName; - ResourceFileNameL(resourceFileName); - RResourceFile resource; - TRAPD(err, resource.OpenL(fs, resourceFileName)); - LOGTEXT2(_L8("Opened resource file with error %d"), err); - - if (err != KErrNone) - { - LOGTEXT(_L8("Unable to open resource file")); - CleanupStack::PopAndDestroy(&fs); - return; - } - - CleanupClosePushL(resource); - - TInt resourceVersion = resource.SignatureL(); - LOGTEXT2(_L8("Resource file signature is %d"), resourceVersion); - // Check for the version is valid(EUsbManagerResourceVersionOne, EUsbManagerResourceVersionTwo - // or EUsbManagerResourceVersionThree). - if(resourceVersion > EUsbManagerResourceVersionThree) - { - LOGTEXT2(_L8("Version of resource file is valid (>%d)"), EUsbManagerResourceVersionThree); - User::LeaveIfError(KErrNotSupported); - } - - resource.ConfirmSignatureL(resourceVersion); - - HBufC8* personalityBuf = 0; - TRAPD(ret, personalityBuf = resource.AllocReadL(DEVICE_PERSONALITIES)); - // If personalities resource is not found, swallow the error and return - // as no specified personalities is a valid configuration - if (ret == KErrNotFound) - { - LOGTEXT(_L8("Personalities are not configured")); - CleanupStack::PopAndDestroy(2, &fs); - return; - } - // Otherwise leave noisily if the AllocRead fails - LEAVEIFERRORL(ret); - CleanupStack::PushL(personalityBuf); - - // The format of the USB resource structure is: - // - // STRUCT PERSONALITY - // { - // WORD bcdDeviceClass; - // WORD bcdDeviceSubClass; - // WORD protocol; - // WORD numConfigurations; - // WORD vendorId; - // WORD productId; - // WORD bcdDevice; - // LTEXT manufacturer; - // LTEXT product; - // WORD id; // personality id - // LTEXT class_uids; - // LTEXT description; // personality description - // LTEXT detailedDescription; //detailed description. This is in version 2 - // LONG Property; - // } - // - // Note that the resource must be read in this order! - - TResourceReader reader; - reader.SetBuffer(personalityBuf); - - TUint16 personalityCount = static_cast(reader.ReadUint16()); - - // Read the manufacturer and device name (product) here from SysUtil class - TPtrC16 sysUtilModelName; - TPtrC16 sysUtilManuName; - - // This method returns ownership. - CDeviceTypeInformation* deviceInfo = SysUtil::GetDeviceTypeInfoL(); - CleanupStack::PushL(deviceInfo); - TInt gotSysUtilModelName = deviceInfo->GetModelName(sysUtilModelName); - TInt gotSysUtilManuName = deviceInfo->GetManufacturerName(sysUtilManuName); - - for (TInt idx = 0; idx < personalityCount; idx++) - { - // read a personality - TUint8 bDeviceClass = static_cast(reader.ReadUint8()); - TUint8 bDeviceSubClass = static_cast(reader.ReadUint8()); - TUint8 protocol = static_cast(reader.ReadUint8()); - TUint8 numConfigurations = static_cast(reader.ReadUint8()); - TUint16 vendorId = static_cast(reader.ReadUint16()); - TUint16 productId = static_cast(reader.ReadUint16()); - TUint16 bcdDevice = static_cast(reader.ReadUint16()); - TPtrC manufacturer = reader.ReadTPtrC(); - TPtrC product = reader.ReadTPtrC(); - TUint16 id = static_cast(reader.ReadUint16()); - TPtrC uidsStr = reader.ReadTPtrC(); - TPtrC description = reader.ReadTPtrC(); - - RArray uids; - CleanupClosePushL(uids); - ConvertUidsL(uidsStr, uids); - // creates a CPersonality object - CPersonality* personality = CPersonality::NewL(); - CleanupStack::PushL(personality); - - personality->SetVersion(resourceVersion); - - // populates personality object - personality->SetId(id); - - for (TInt uidIdx = 0; uidIdx < uids.Count(); uidIdx++) - { - LEAVEIFERRORL(personality->AddSupportedClasses(TUid::Uid(uids[uidIdx]))); - } - - // gets a handle to iDeviceDescriptor of personality - CUsbDevice::TUsbDeviceDescriptor& dvceDes = personality->DeviceDescriptor(); - if (gotSysUtilManuName == KErrNone) - { - personality->SetManufacturer(&sysUtilManuName); - } - else - { - personality->SetManufacturer(&manufacturer); - } - - if (gotSysUtilModelName == KErrNone) - { - personality->SetProduct(&sysUtilModelName); - } - else - { - personality->SetProduct(&product); - } - - personality->SetDescription(&description); - dvceDes.iDeviceClass = bDeviceClass; - dvceDes.iDeviceSubClass = bDeviceSubClass; - dvceDes.iDeviceProtocol = protocol; - dvceDes.iIdVendor = vendorId; - dvceDes.iIdProduct= productId; - dvceDes.iBcdDevice = bcdDevice; - dvceDes.iNumConfigurations = numConfigurations; - - //detailedDescription is only supported after EUsbManagerResourceVersionTwo - if(resourceVersion >= EUsbManagerResourceVersionTwo) - { - TPtrC detailedDescription = reader.ReadTPtrC(); - personality->SetDetailedDescription(&detailedDescription); -#ifdef __FLOG_ACTIVE - TBuf8 narrowLongBuf; - narrowLongBuf.Copy(detailedDescription); - LOGTEXT2(_L8("detailed description = '%S'"), &narrowLongBuf); -#endif // __FLOG_ACTIVE - } - - //Property is only supported after EUsbManagerResourceVersionThree - if(resourceVersion >= EUsbManagerResourceVersionThree) - { - TUint32 property = static_cast(reader.ReadUint32()); - personality->SetProperty(property); -#ifdef __FLOG_ACTIVE - LOGTEXT2(_L8("property = %d\n"), property); -#endif // __FLOG_ACTIVE - } - - // Append personality to iSupportedPersonalities - iSupportedPersonalities.AppendL(personality); - // Now pop off personality - CleanupStack::Pop(personality); -#ifdef __FLOG_ACTIVE - // Debugging - LOGTEXT2(_L8("personalityCount = %d\n"), personalityCount); - LOGTEXT2(_L8("bDeviceClass = %d\n"), bDeviceClass); - LOGTEXT2(_L8("bDeviceSubClass = %d\n"), bDeviceSubClass); - LOGTEXT2(_L8("protocol = %d\n"), protocol); - LOGTEXT2(_L8("numConfigurations = %d\n"), numConfigurations); - LOGTEXT2(_L8("vendorId = %d\n"), vendorId); - LOGTEXT2(_L8("productId = %d\n"), productId); - LOGTEXT2(_L8("bcdDevice = %d\n"), bcdDevice); - TBuf8 narrowBuf; - narrowBuf.Copy(manufacturer); - LOGTEXT2(_L8("manufacturer = '%S'"), &narrowBuf); - narrowBuf.Copy(product); - LOGTEXT2(_L8("product = '%S'"), &narrowBuf); - LOGTEXT2(_L8("id = %d\n"), id); - LOGTEXT(_L8("ClassUids{")); - for (TInt k = 0; k < uids.Count(); k++) - { - LOGTEXT2(_L8("%d"), uids[k]); - } - LOGTEXT(_L8("}")); - narrowBuf.Copy(description); - LOGTEXT2(_L8("description = '%S'"), &narrowBuf); -#endif // __FLOG_ACTIVE - CleanupStack::PopAndDestroy(&uids); // close uid array - } - - CleanupStack::PopAndDestroy(4, &fs); // deviceInfo, personalityBuf, resource, fs - iPersonalityCfged = ETrue; - } + { + LOG_FUNC + TPtrC16 sysUtilModelName; + TPtrC16 sysUtilManuName; + + iPersonalityCfged = EFalse; + + iCenRepManager->ReadDeviceConfigurationL(iDeviceConfiguration); + + iCenRepManager->ReadPersonalitiesL(iSupportedPersonalities); + + //update info for SetManufacturer & SetProduct + CDeviceTypeInformation* deviceInfo = SysUtil::GetDeviceTypeInfoL(); + CleanupStack::PushL(deviceInfo); + TInt gotSysUtilModelName = deviceInfo->GetModelName(sysUtilModelName); + TInt gotSysUtilManuName = deviceInfo->GetManufacturerName(sysUtilManuName); + + //To overlap info + if (gotSysUtilManuName == KErrNone) + { + iDeviceConfiguration.iManufacturerName->Des().Copy(sysUtilManuName); + } + + if (gotSysUtilModelName == KErrNone) + { + iDeviceConfiguration.iProductName->Des().Copy(sysUtilModelName); + } + CleanupStack::PopAndDestroy(deviceInfo); + iPersonalityCfged = ETrue; + } void CUsbDevice::SelectClassControllersL() /** @@ -1443,8 +1142,19 @@ */ { LOG_FUNC - - CreateClassControllersL(iCurrentPersonality->SupportedClasses()); + const RArray& classes = iCurrentPersonality->SupportedClasses(); + RArray classUids; + CleanupClosePushL( classUids ); + TInt classCount = classes.Count(); + for(TInt classIndex = 0; classIndex& /* aClassUids*/) @@ -1489,7 +1199,6 @@ TInt smallestId = iSupportedPersonalities[0]->PersonalityId(); TInt count = iSupportedPersonalities.Count(); - for (TInt i = 1; i < count; i++) { if(iSupportedPersonalities[i]->PersonalityId() < smallestId) @@ -1497,7 +1206,7 @@ smallestId = iSupportedPersonalities[i]->PersonalityId(); } } - + SetCurrentPersonalityL(smallestId); SelectClassControllersL(); } @@ -1516,44 +1225,6 @@ CreateClassControllersL(iSupportedClassUids); } -void CUsbDevice::ResourceFileNameL(TFileName& aFileName) -/** - * Gets resource file name - * - * @param aFileName Descriptor to populate with resource file name - */ - { - LOG_FUNC - - RFs fs; - LEAVEIFERRORL(fs.Connect()); - CleanupClosePushL(fs); - -#ifdef __WINS__ - // If we are running in the emulator then read the resource file from system drive. - // This makes testing with different resource files easier. - _LIT(KPrivatePath, ":\\Private\\101fe1db\\"); - aFileName.Append(RFs::GetSystemDriveChar()); //get the name of system drive - aFileName.Append(KPrivatePath); -#else - const TDriveNumber KResourceDrive = EDriveZ; - - TDriveUnit driveUnit(KResourceDrive); - TDriveName drive=driveUnit.Name(); - aFileName.Insert(0, drive); - // append private path - TPath privatePath; - fs.PrivatePath(privatePath); - aFileName.Append(privatePath); -#endif //WINS - - // Find the nearest match of resource file for the chosen locale - aFileName.Append(_L("usbman.rsc")); - BaflUtils::NearestLanguageFile(fs, aFileName); // if a match is not found, usbman.rsc will be used - - CleanupStack::PopAndDestroy(&fs); // fs no longer needed - } - RDevUsbcClient& CUsbDevice::MuepoDoDevUsbcClient() /** * Inherited from MUsbmanExtensionPluginObserver - Function used by plugins to diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgr/usbman/server/SRC/CUsbSession.cpp --- a/usbmgmt/usbmgr/usbman/server/SRC/CUsbSession.cpp Fri Jun 25 13:07:44 2010 +0800 +++ b/usbmgmt/usbmgr/usbman/server/SRC/CUsbSession.cpp Fri Jun 25 13:19:39 2010 +0800 @@ -1,5 +1,5 @@ /* -* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -518,9 +518,6 @@ case EUsbGetDescription: ret = GetDescription(aMessage); break; - case EUsbGetDetailedDescription: - ret = GetDetailedDescription(aMessage); - break; case EUsbGetPersonalityProperty: ret = GetPersonalityProperty(aMessage); break; @@ -1274,7 +1271,7 @@ { if (j < KUsbMaxSupportedClasses + 1) { - classUids[j] = personalities[i]->SupportedClasses()[j - 1].iUid; + classUids[j] = personalities[i]->SupportedClasses()[j - 1].iClassUid.iUid; LOGTEXT3(_L8("\tclassUids[%d] = %d"), j, classUids[j]); } else @@ -1375,36 +1372,6 @@ return KErrNotSupported; } -/** - * Gets personality detailed description - * - * @internalComponent - * @param aMessage Message received from the client - * @return Any error that occurred or KErrNone - */ -TInt CUsbSession::GetDetailedDescription(const RMessage2& aMessage) - { - LOG_FUNC - - if (!iPersonalityCfged) - { - return KErrNotSupported; - } - - TInt personalityId = aMessage.Int0(); - const CPersonality* personality = iUsbServer->Device().GetPersonality(personalityId); - if (personality) - { - if(personality->Version() < EUsbManagerResourceVersionTwo) - { - return KErrNotFound; - } - return aMessage.Write(1, *(personality->DetailedDescription())); - } - - // We should never reach here - return KErrNotSupported; - } /** * Gets personality property @@ -1426,10 +1393,6 @@ const CPersonality* personality = iUsbServer->Device().GetPersonality(personalityId); if (personality) { - if(personality->Version() < EUsbManagerResourceVersionThree) - { - return KErrNotFound; - } TPckg pckg(personality->Property()); return aMessage.Write(1, pckg); } @@ -1459,7 +1422,7 @@ const CPersonality* personality = iUsbServer->Device().GetPersonality(personalityId); if (personality) { - isSupported = (personality->ClassSupported(classUid) != KErrNotFound); + isSupported = personality->ClassSupported(classUid); TPckg pkg2(isSupported); return aMessage.Write(2, pkg2); } diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgr/usbman/server/SRC/usbman.rls --- a/usbmgmt/usbmgr/usbman/server/SRC/usbman.rls Fri Jun 25 13:07:44 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* -* Copyright (c) 2004-2009 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: -* @file -* This file serves a template for the purpose of localization. The -* content of this file shall be properly filled with unicode pertaining -* to the configured language. -* localized strings, US english -* -*/ - -// personality one -rls_string per_manufacturer1 "localized manufacturer" -rls_string per_product1 "localized product description" -rls_string per_description1 "localized personality description" -rls_string per_detailedDescription1 "localized personality detailed description" - -// personality two -rls_string per_manufacturer2 "localized manufacturer" -rls_string per_product2 "localized product description" -rls_string per_description2 "localized personality description" -rls_string per_detailedDescription2 "localized personality detailed description" diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgr/usbman/server/SRC/usbman.rss --- a/usbmgmt/usbmgr/usbman/server/SRC/usbman.rss Fri Jun 25 13:07:44 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,112 +0,0 @@ -/* -* Copyright (c) 2005-2009 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: -* Resource file for usbman configuration. -* -*/ - -/** - @file -*/ - -NAME USBM - -#include -#include "usbman.rh" - -#ifdef LANGUAGE_01 // UK English - #include "usbman_01.rls" -#elif LANGUAGE_02 // French - #include "usbman_02.rls" -#elif defined LANGUAGE_03 // German - #include "usbman_03.rls" -#elif defined LANGUAGE_10 // US English - #include "usbman_10.rls" -#else // default to UK English strings in usbman.rsc - #include "usbman_01.rls" -#endif - -RESOURCE BA_RSS_SIGNATURE - { - signature = 3; - } - -RESOURCE usb_configuration usb_config - { - } - - -RESOURCE PERSONALITY_ARRAY device_personalities - { - personalities = - { - PERSONALITY - { - bDeviceClass = 02; - bDeviceSubClass = 0; - protocol = 0; - numConfigurations = 1; - vendorId = 0x0e22; - productId = 0x000b; - bcdDevice = 0; - manufacturer = per_manufacturer1; - product = per_product1; - id = 1; - class_uids = "101FBF22"; - description = per_description1; - detailedDescription = per_detailedDescription1; - property = 0x00000000; - }, - PERSONALITY - { - bDeviceClass = 1; - bDeviceSubClass = 2; - protocol = 0; - numConfigurations = 1; - vendorId = 0x0e22; - productId = 0x000c; - bcdDevice = 2; - manufacturer= per_manufacturer2; - product = per_product2; - id = 2; - class_uids = "101fbf24"; - description = per_description2; - detailedDescription = per_detailedDescription2; - property = 0x00000000; - }, - PERSONALITY - { - bDeviceClass = 0; - bDeviceSubClass = 0; - protocol = 0; - numConfigurations = 1; - vendorId = 0x0e22; - productId = 0x1113; - bcdDevice = 0; - manufacturer = per_manufacturer3; - product = per_product3; - id = 3; - class_uids = "10204bbc"; - description = per_description3; - detailedDescription = per_detailedDescription3; - property = 0x00000000; - } - - // The productId's value of personalities to be implemented in the - // future should be > 0x1115, to avoid conflict with IDs used by - // other drivers or applications - - }; - } - diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgr/usbman/server/SRC/usbman_01.rls --- a/usbmgmt/usbmgr/usbman/server/SRC/usbman_01.rls Fri Jun 25 13:07:44 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* Copyright (c) 2004-2009 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: -* @file -* Resource file for testing and example mass storage application -* localized strings for UK English. A place holder only. The actual -* strings however may not be UK English at all. -* -*/ - -// personality one -rls_string per_manufacturer1 "Symbian" -rls_string per_product1 "Symbian OS ACM" -rls_string per_description1 "Serial Emulation" -rls_string per_detailedDescription1 "Serial Emulation(detail)" - -// personality two -rls_string per_manufacturer2 "Symbian" -rls_string per_product2 "Symbian OS WHCM" -rls_string per_description2 "Obex over USB" -rls_string per_detailedDescription2 "Obex over USB(detail)" - -// personality three -rls_string per_manufacturer3 "Symbian" -rls_string per_product3 "Symbian OS MSCC" -rls_string per_description3 "USB Mass Storage" -rls_string per_detailedDescription3 "USB Mass Storage(detail)" - -// personality four -rls_string per_manufacturer4 "Symbian" -rls_string per_product4 "Symbian OS MTP" -rls_string per_description4 "MTP over USB" -rls_string per_detailedDescription4 "MTP over USB(detail)" - -// personality five -rls_string per_manufacturer5 "Symbian" -rls_string per_product5 "Symbian OS RNDIS" -rls_string per_description5 "IP over USB - RNDIS" -rls_string per_detailedDescription5 "IP over USB - RNDIS(detail)" diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgr/usbman/server/SRC/usbman_02.rls --- a/usbmgmt/usbmgr/usbman/server/SRC/usbman_02.rls Fri Jun 25 13:07:44 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* Copyright (c) 2004-2009 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: -* @file -* This file serves a template for the purpose of localization. The -* content of this file shall be properly filled with unicode pertaining -* to the configured language. -* localized strings for French. A place holder only. you know the -* following strings are not French -* -*/ - - -// personality one -rls_string per_manufacturer1 "Symbian" -rls_string per_product1 "Symbian OS ACM" -rls_string per_description1 "Serial Emulation" -rls_string per_detailedDescription1 "Serial Emulation(detail)" - -// personality two -rls_string per_manufacturer2 "Symbian" -rls_string per_product2 "Symbian OS WHCM" -rls_string per_description2 "Obex over USB" -rls_string per_detailedDescription2 "Obex over USB(detail)" - -// personality three -rls_string per_manufacturer3 "Symbian" -rls_string per_product3 "Symbian OS MSCC" -rls_string per_description3 "USB Mass Storage" -rls_string per_detailedDescription3 "USB Mass Storage(detail)" - -// personality four -rls_string per_manufacturer4 "Symbian" -rls_string per_product4 "Symbian OS MTP" -rls_string per_description4 "MTP over USB" -rls_string per_detailedDescription4 "MTP over USB(detail)" - -// personality five -rls_string per_manufacturer5 "Symbian" -rls_string per_product5 "Symbian OS RNDIS" -rls_string per_description5 "IP over USB - RNDIS" -rls_string per_detailedDescription5 "IP over USB - RNDIS(detail)" - diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgr/usbman/server/SRC/usbman_03.rls --- a/usbmgmt/usbmgr/usbman/server/SRC/usbman_03.rls Fri Jun 25 13:07:44 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* Copyright (c) 2004-2009 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: -* @file -* This file serves a template for the purpose of localization. The -* content of this file shall be properly filled with unicode pertaining -* to the configured language. -* localized strings for German. A place holder only. you know the -* following strings are not German -* -*/ - - -// personality one -// personality one -rls_string per_manufacturer1 "Symbian" -rls_string per_product1 "Symbian OS ACM" -rls_string per_description1 "Serial Emulation" -rls_string per_detailedDescription1 "Serial Emulation(detail)" - -// personality two -rls_string per_manufacturer2 "Symbian" -rls_string per_product2 "Symbian OS WHCM" -rls_string per_description2 "Obex over USB" -rls_string per_detailedDescription2 "Obex over USB(detail)" - -// personality three -rls_string per_manufacturer3 "Symbian" -rls_string per_product3 "Symbian OS MSCC" -rls_string per_description3 "USB Mass Storage" -rls_string per_detailedDescription3 "USB Mass Storage(detail)" - -// personality four -rls_string per_manufacturer4 "Symbian" -rls_string per_product4 "Symbian OS MTP" -rls_string per_description4 "MTP over USB" -rls_string per_detailedDescription4 "MTP over USB(detail)" - -// personality five -rls_string per_manufacturer5 "Symbian" -rls_string per_product5 "Symbian OS RNDIS" -rls_string per_description5 "IP over USB - RNDIS" -rls_string per_detailedDescription5 "IP over USB - RNDIS(detail)" diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgr/usbman/server/SRC/usbman_10.rls --- a/usbmgmt/usbmgr/usbman/server/SRC/usbman_10.rls Fri Jun 25 13:07:44 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* -* Copyright (c) 2004-2009 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: -* @file -* This file serves a template for the purpose of localization. The -* content of this file shall be properly filled with unicode pertaining -* to the configured language. -* localized strings, US english -* -*/ - - -// personality one -rls_string per_manufacturer1 "Symbian" -rls_string per_product1 "Symbian OS ACM" -rls_string per_description1 "Serial Emulation" -rls_string per_detailedDescription1 "Serial Emulation(detail)" - -// personality two -rls_string per_manufacturer2 "Symbian" -rls_string per_product2 "Symbian OS WHCM" -rls_string per_description2 "Obex over USB" -rls_string per_detailedDescription2 "Obex over USB(detail)" - -// personality three -rls_string per_manufacturer3 "Symbian" -rls_string per_product3 "Symbian OS MSCC" -rls_string per_description3 "USB Mass Storage" -rls_string per_detailedDescription3 "USB Mass Storage(detail)" - -// personality four -rls_string per_manufacturer4 "Symbian" -rls_string per_product4 "Symbian OS MTP" -rls_string per_description4 "MTP over USB" -rls_string per_detailedDescription4 "MTP over USB(detail)" - -// personality five -rls_string per_manufacturer5 "Symbian" -rls_string per_product5 "Symbian OS RNDIS" -rls_string per_description5 "IP over USB - RNDIS" -rls_string per_detailedDescription5 "IP over USB - RNDIS(detail)" diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgr/usbman/server/SRC/usbmancenrepmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbmgmt/usbmgr/usbman/server/SRC/usbmancenrepmanager.cpp Fri Jun 25 13:19:39 2010 +0800 @@ -0,0 +1,489 @@ +// 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: +// Implements a utility class which read information from Central Repository + + + +#include +#include +#ifdef SYMBIAN_FEATURE_MANAGER + #include + #include +#endif +#include "usbmanprivatecrkeys.h" +#include "UsbSettings.h" +#include "CPersonality.h" +#include "usbmancenrepmanager.h" +#include "CUsbDevice.h" + + +#ifdef __FLOG_ACTIVE +_LIT8(KLogComponent, "USBSVR"); +#endif + +_LIT(KUsbCenRepPanic, "UsbCenRep"); + +/** + * Panic codes for the USB Central Repository Manager + */ +enum TUsbCenRepPanic + { + ECenRepObserverNotStopped = 0, + ECenRepObserverAlreadySet, + ECenRepConfigError, + ECenRepFeatureManagerError, + }; + +// --------------------------------------------------------------------------- +// Private consctruction +// --------------------------------------------------------------------------- +// +CUsbManCenRepManager::CUsbManCenRepManager(CUsbDevice& aUsbDevice) + : iUsbDevice( aUsbDevice ) + { + LOG_FUNC + } + +// --------------------------------------------------------------------------- +// The first phase construction +// --------------------------------------------------------------------------- +// +CUsbManCenRepManager* CUsbManCenRepManager::NewL(CUsbDevice& aUsbDevice) + { + LOG_STATIC_FUNC_ENTRY + CUsbManCenRepManager* self = new (ELeave) CUsbManCenRepManager(aUsbDevice); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// The second phase construction +// --------------------------------------------------------------------------- +// +void CUsbManCenRepManager::ConstructL() + { + LOG_FUNC + // Open the Central Repository + iRepository = CRepository::NewL( KCRUidUSBManagerConfiguration ); + CheckSignatureL(); + } + +// --------------------------------------------------------------------------- +// Deconstruction +// --------------------------------------------------------------------------- +// +CUsbManCenRepManager::~CUsbManCenRepManager() + { + LOG_FUNC + delete iRepository; + } + +// --------------------------------------------------------------------------- +// Read specific Key whose value type is String +// --------------------------------------------------------------------------- +// +HBufC* CUsbManCenRepManager::ReadStringKeyLC( TUint32 aKeyId ) + { + LOG_FUNC + HBufC* keyBuf = HBufC::NewLC( NCentralRepositoryConstants::KMaxUnicodeStringLength ); + TPtr key = keyBuf->Des(); + + LEAVEIFERRORL( iRepository->Get( aKeyId, key ) ); + LOGTEXT3(_L("LocSets: ReadStringKeyLC id: %x, val: %S"), aKeyId, &key ); + + return keyBuf; + } + +// --------------------------------------------------------------------------- +// Read specific Key whose value type is TInt +// --------------------------------------------------------------------------- +// +TInt CUsbManCenRepManager::ReadKeyL( TUint32 aKeyId ) + { + LOG_FUNC + TInt key; + + LEAVEIFERRORL( iRepository->Get( aKeyId, key ) ); + LOGTEXT3(_L("LocSets: ReadKeyL id: 0x%x, val: 0x%x"), aKeyId, key); + + return key; + } + +// --------------------------------------------------------------------------- +// Check wheather cenrep's version is supported by cenrep manager +// --------------------------------------------------------------------------- +// +void CUsbManCenRepManager::CheckSignatureL() + { + LOG_FUNC + iSignature = ReadKeyL( KUsbManConfigSign ); + + if ( iSignature < TUsbManagerSupportedVersionMin || + iSignature > TUsbManagerSupportedVersionMax ) + { + LEAVEL(KErrNotSupported); + } + } + +// --------------------------------------------------------------------------- +// Read Device configuration table +// --------------------------------------------------------------------------- +// +void CUsbManCenRepManager::ReadDeviceConfigurationL(CUsbDevice::TUsbDeviceConfiguration& aDeviceConfig) + { + LOG_FUNC + //Only support version four right now. + __ASSERT_DEBUG( ( TUsbManagerSupportedVersionFour == iSignature ), _USB_PANIC( KUsbCenRepPanic, ECenRepConfigError ) ); + + //Shall only have on device configuration setting. + TUint32 devConfigCount = ReadKeyL( KUsbManDeviceCountIndexKey ); + __ASSERT_DEBUG( ( devConfigCount == 1 ), _USB_PANIC( KUsbCenRepPanic, ECenRepConfigError ) ); + + RArray keyArray; + CleanupClosePushL( keyArray ); + LEAVEIFERRORL( iRepository->FindL( KUsbManDevicePartialKey, KUsbManConfigKeyMask, keyArray ) ); + + TInt keyCount = keyArray.Count(); + LOGTEXT2( _L("CUsbManCenRepManager::ReadDeviceConfigurationL keyCount of device config = %d"), keyCount ); + + //Get each extension type key value and store in iExtList array + for( TInt index = 0; index < keyCount; index++ ) + { + TUint32 key = keyArray[index]; + TUint32 fieldId = ( key & KUsbManConfigFieldMask ); + LOGTEXT2( _L("CUsbManCenRepManager::ReadDeviceConfigurationL fieldId = %d"), fieldId ); + if( fieldId == KUsbManDeviceVendorIdKey ) + { + aDeviceConfig.iVendorId = ReadKeyL( key ); + } + else if( fieldId == KUsbManDeviceManufacturerNameKey ) + { + HBufC* manufacturer = ReadStringKeyLC( key ); + TPtr manufacturerPtr = manufacturer->Des(); + aDeviceConfig.iManufacturerName->Des().Copy( manufacturerPtr ); + CleanupStack::PopAndDestroy( manufacturer ); + } + else if( fieldId == KUsbManDeviceProductNameKey ) + { + HBufC* product = ReadStringKeyLC( key ); + TPtr productName = product->Des(); + aDeviceConfig.iProductName->Des().Copy( productName ); + CleanupStack::PopAndDestroy( product ); + } + else + { + _USB_PANIC( KUsbCenRepPanic, ECenRepConfigError ); + } + } + CleanupStack::PopAndDestroy( &keyArray ); + } + + +// --------------------------------------------------------------------------- +// Read personality table +// --------------------------------------------------------------------------- +// +void CUsbManCenRepManager::ReadPersonalitiesL(RPointerArray& aPersonalities) + { + LOG_FUNC + + //Only support version four right now. + __ASSERT_DEBUG( ( TUsbManagerSupportedVersionFour == iSignature ), _USB_PANIC( KUsbCenRepPanic, ECenRepConfigError ) ); + + // Get the personality count. + TUint32 personalityCount = ReadKeyL( KUsbManDevicePersonalitiesCountIndexKey ); + LOGTEXT2( _L("CUsbManCenRepManager::ReadPersonalitiesL personalityCount = %d"), personalityCount ); + + RArray keyArray; + CleanupClosePushL( keyArray ); + + + // Go through all personalities and store them. + for( TInt personalityIdx = 0; personalityIdx < personalityCount; personalityIdx++ ) + { + CPersonality* personality = CPersonality::NewL(); + CleanupStack::PushL( personality ); + + // Find the keys belonging to the personality + TUint32 devicePersonalitiesKey = KUsbManDevicePersonalitiesPartialKey | ( personalityIdx << KUsbManPersonalitiesOffset ); + LEAVEIFERRORL( iRepository->FindL( devicePersonalitiesKey, KUsbManConfigKeyMask, keyArray ) ); + + TInt keyCount = keyArray.Count(); + LOGTEXT2( _L("CUsbManCenRepManager::ReadPersonalitiesL keyCount of personality = %d"), keyCount ); + + // Get each key value of the personality and store it. + for( TInt keyIdx = 0; keyIdx < keyCount; keyIdx++ ) + { + TUint32 key = keyArray[keyIdx]; + TUint32 fieldId = (key & KUsbManConfigFieldMask); + LOGTEXT2( _L("CUsbManCenRepManager::ReadPersonalitiesL key id of personality = %d"), fieldId ); + switch( fieldId ) + { + case KUsbManDevicePersonalitiesDeviceClassKey: + personality->SetDeviceClass(ReadKeyL( key )); + break; + case KUsbManDevicePersonalitiesDeviceSubClassKey: + personality->SetDeviceSubClass(ReadKeyL( key )); + break; + case KUsbManDevicePersonalitiesProtocolKey: + personality->SetDeviceProtocol(ReadKeyL( key )); + break; + case KUsbManDevicePersonalitiesNumConfigKey: + personality->SetNumConfigurations(ReadKeyL( key )); + break; + case KUsbManDevicePersonalitiesProductIdKey: + personality->SetProductId(ReadKeyL( key )); + break; + case KUsbManDevicePersonalitiesBcdDeviceKey: + personality->SetBcdDevice(ReadKeyL( key )); + break; + case KUsbManDevicePersonalitiesFeatureIdKey: + personality->SetFeatureId(ReadKeyL( key )); + break; + case KUsbManDevicePersonalitiesPersonalityIdKey: + personality->SetPersonalityId(ReadKeyL( key )); + ReadConfigurationsForPersonalityL( personality->PersonalityId(), *personality ); + break; + case KUsbManDevicePersonalitiesPropertyKey: + personality->SetProperty(ReadKeyL( key )); + break; + case KUsbManDevicePersonalitiesDescriptionKey: + { + HBufC* description; + description = ReadStringKeyLC( key ); + personality->SetDescription( description ); + CleanupStack::PopAndDestroy( description ); + break; + } + default: + _USB_PANIC( KUsbCenRepPanic, ECenRepConfigError ); + break; + } + } + + personality->SetVersion(iSignature); + + //The following code is to check whether we support this personality. + if(personality->FeatureId() != KUsbManFeatureNotConfigurable) + { + if(!IsFeatureSupportedL(personality->FeatureId())) + { + CleanupStack::PopAndDestroy(personality); + continue; + } + } + + //The following code is to check whether we support this personality. It will not include: + //1)the personality which contains single class which is not supported + //2)the personality which contains multiple classes which are all not supported + TBool isPersonalitySupport = EFalse; + TInt configurationCount = personality->PersonalityConfigs().Count(); + for(TInt configurationIdx = 0; configurationIdx < configurationCount; ++configurationIdx) + { + const RPointerArray& personalityConfigs = personality->PersonalityConfigs(); + CPersonalityConfigurations *personalityConfigurations = personalityConfigs[configurationIdx]; + TInt classesCount = personalityConfigurations->Classes().Count(); + if(0 != classesCount) + { + isPersonalitySupport = ETrue; + break; + } + } + + if(isPersonalitySupport) + { + LOGTEXT2( _L("CUsbManCenRepManager::ReadPersonalitiesL Personality ID: %d is supported"), personality->PersonalityId() ); + aPersonalities.Append( personality ); + CleanupStack::Pop( personality ); + } + else + { + LOGTEXT2( _L("CUsbManCenRepManager::ReadPersonalitiesL Personality ID: %d is not supported"), personality->PersonalityId() ); + CleanupStack::PopAndDestroy(personality); + } + } + CleanupStack::PopAndDestroy( &keyArray ); + } + +// --------------------------------------------------------------------------- +// Read configuration table for specific personality +// --------------------------------------------------------------------------- +// +void CUsbManCenRepManager::ReadConfigurationsForPersonalityL(TInt aPersonalityId, CPersonality& aPersonality) + { + LOG_FUNC + RArray configArray; + CleanupClosePushL(configArray); + + //Only support version four right now. + __ASSERT_DEBUG( ( TUsbManagerSupportedVersionFour == iSignature ), _USB_PANIC( KUsbCenRepPanic, ECenRepConfigError ) ); + + LEAVEIFERRORL( iRepository->FindEqL( KUsbManDeviceConfigurationsPartialKey, KUsbManConfigFirstEntryMask, aPersonalityId, configArray ) ); + + // Get the configuration count. + TUint32 configCount = configArray.Count(); + TUint32 totalConfigCount = ReadKeyL( KUsbManDeviceConfigurationsCountIndexKey ); + + LOGTEXT4( _L("ReadConfigurationsForPersonalityL: aPersonalityId = %d total configCount = %d configArray.Count() = %d"), aPersonalityId, totalConfigCount, configArray.Count()); + + //This is intend to handle one special case that key 0x2ff00's value + // equal our target personality id. + if(totalConfigCount == aPersonalityId) + { + --configCount; + } + + TInt keyCount = 0; + if(TUsbManagerSupportedVersionFour == iSignature) + { + keyCount = KUsbManDeviceConfigurationsKeyCountVersionFour; + } + + // Go through all configurations belonging to this personality 'aPersonalityId' + for ( TInt configIdx = 0; configIdx < configCount; configIdx++ ) + { + CPersonalityConfigurations* config = new ( ELeave ) CPersonalityConfigurations; + CleanupStack::PushL( config ); + TUint32 key = configArray[configIdx]; + + // Get each key value in the configuration and store it + for ( TInt keyIdx = 0; keyIdx < keyCount; keyIdx++ ) + { + TUint32 fieldId = ( (key + keyIdx ) & KUsbManConfigFieldMask ); + TInt keyValue = -1; + LOGTEXT4( _L("ReadConfigurationsForPersonalityL fieldId = %d configIdx = %d keyIdx = %d"), fieldId, configIdx, keyIdx ); + + if(KUsbManDeviceConfigurationsPersonalityIdKey == fieldId) + { + TRAPD( err, keyValue = ReadKeyL( key + keyIdx ) ); + if( err == KErrNone ) + { + __ASSERT_DEBUG( ( keyValue == aPersonalityId ), _USB_PANIC( KUsbCenRepPanic, ECenRepConfigError ) ); + config->SetPersonalityId( keyValue ); + } + } + else if(KUsbManDeviceConfigurationsIdKey == fieldId) + { + TRAPD( err, keyValue = ReadKeyL( key + keyIdx ) ); + if( err == KErrNone ) + { + config->SetConfigId(keyValue); + } + } + else if(KUsbManDeviceConfigurationsClassUidsKey == fieldId) + { + HBufC* keyValueBuf = ReadStringKeyLC( key + keyIdx ); + TPtr keyPtr = keyValueBuf->Des(); + + RArray classUids; + CleanupClosePushL( classUids ); + + iUsbDevice.ConvertUidsL( keyPtr, classUids ); + TInt uidsCnt = classUids.Count(); + + // Get featureId of each class and store each class. + TInt featureId = KUsbManFeatureNotConfigurable; + CPersonalityConfigurations::TUsbClasses usbClass; + for ( TInt uidIdx = 0; uidIdx < uidsCnt; uidIdx++ ) + { + usbClass.iClassUid = TUid::Uid( classUids[uidIdx] ); + usbClass.iFeatureId = featureId; // By default + if ( IsClassConfigurableL( classUids[uidIdx], featureId ) ) + { + usbClass.iFeatureId = featureId; + if(IsFeatureSupportedL(featureId)) + { + config->AppendClassesL( usbClass ); + } + } + else + { + config->AppendClassesL( usbClass ); + } + } + + CleanupStack::PopAndDestroy( &classUids ); // close uid array + CleanupStack::PopAndDestroy( keyValueBuf ); + } + else + { + _USB_PANIC( KUsbCenRepPanic, ECenRepConfigError ); + } + } + aPersonality.AppendPersonalityConfigsL( config ); + + CleanupStack::Pop( config ); + } + + CleanupStack::PopAndDestroy( &configArray ); + } + +// --------------------------------------------------------------------------- +// Check the class belonging to a personality configurable or not. +// --------------------------------------------------------------------------- +// +TBool CUsbManCenRepManager::IsClassConfigurableL(TUint aClassId, TInt& aFeatureId) + { + LOG_FUNC + TBool classConfigurable = EFalse; + RArray keyArray; + CleanupClosePushL(keyArray); + + TInt err = iRepository->FindEqL( KUsbManDeviceConfigurableClassesPartialKey, KUsbManConfigFirstEntryMask, (TInt)aClassId, keyArray ); + LOGTEXT3( _L("CUsbManCenRepManager::IsClassConfigurableL: aClassId = 0x%x err = %d "), aClassId, err); + switch ( err ) + { + case KErrNotFound: + break; + case KErrNone: + { + __ASSERT_DEBUG( ( keyArray.Count() == 1 ), _USB_PANIC( KUsbCenRepPanic, ECenRepConfigError ) ); + // The array size always is 1, so here using 0 as index. + aFeatureId = ReadKeyL( keyArray[0] | KUsbManDeviceConfigurableClassesFeatureIdKey ); + classConfigurable = ETrue; + break; + } + default: + LEAVEL( err ); + break; + } + + CleanupStack::PopAndDestroy( &keyArray ); + return classConfigurable; + } + +// --------------------------------------------------------------------------- +// Check the class belonging to a personality support or not. +// --------------------------------------------------------------------------- +// +TBool CUsbManCenRepManager::IsFeatureSupportedL(TInt aFeatureId) + { + LOG_FUNC +#ifdef SYMBIAN_FEATURE_MANAGER + if(CFeatureDiscovery::IsFeatureSupportedL(TUid::Uid(aFeatureId))) + { + LOGTEXT2( _L("CUsbManCenRepManager::IsFeatureSupportedL featureId = 0x%x supported"), aFeatureId ); + return ETrue; + } + else + { + LOGTEXT2( _L("CUsbManCenRepManager::IsFeatureSupportedL featureId = 0x%x not supported"), aFeatureId ); + return EFalse; + } +#else + _USB_PANIC( KUsbCenRepPanic, ECenRepFeatureManagerError ) +#endif + } diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgr/usbman/server/SRC/usbmanlubbockobex.rss --- a/usbmgmt/usbmgr/usbman/server/SRC/usbmanlubbockobex.rss Fri Jun 25 13:07:44 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +0,0 @@ -/* -* Copyright (c) 2005-2009 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: -* Resource file for usbman configuration. -* -*/ - -/** - @file -*/ - -NAME USBM - -#include -#include "usbman.rh" -#ifdef LANGUAGE_01 // UK English - #include "usbman_01.rls" -#elif LANGUAGE_02 // French - #include "usbman_02.rls" -#elif defined LANGUAGE_03 // German - #include "usbman_03.rls" -#elif defined LANGUAGE_10 // US English - #include "usbman_10.rls" -#else // default to UK English strings in usbman.rsc - #include "usbman_01.rls" -#endif - -RESOURCE BA_RSS_SIGNATURE - { - signature = 3; - } - -RESOURCE usb_configuration usb_config - { - } - - -RESOURCE PERSONALITY_ARRAY device_personalities - { - personalities = - { - PERSONALITY - { - bDeviceClass = 02; - bDeviceSubClass = 0; - protocol = 0; - numConfigurations = 1; - vendorId = 0x0e22; - productId = 0x000b; - bcdDevice = 0; - manufacturer = per_manufacturer1; - product = per_product1; - id = 1; - class_uids = "101FBF22"; - description = per_description1; - detailedDescription = per_detailedDescription1; - property = 0x00000000; - }, - PERSONALITY - { - bDeviceClass = 1; - bDeviceSubClass = 2; - protocol = 0; - numConfigurations = 1; - vendorId = 0x0e22; - productId = 0x000d; // instead of 0x000c - bcdDevice = 2; - manufacturer= per_manufacturer2; - product = per_product2; - id = 2; - class_uids = "101fbf24"; - description = per_description2; - detailedDescription = per_detailedDescription2; - property = 0x00000000; - }, - PERSONALITY - { - bDeviceClass = 0; - bDeviceSubClass = 0; - protocol = 0; - numConfigurations = 1; - vendorId = 0x0e22; - productId = 0x1111; - bcdDevice = 0; - manufacturer = per_manufacturer3; - product = per_product3; - id = 3; - class_uids = "10204bbc"; - description = per_description3; - detailedDescription = per_detailedDescription3; - property = 0x00000000; - } - - }; - } - - diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgr/usbman/server/SRC/usbmanmtp.rss --- a/usbmgmt/usbmgr/usbman/server/SRC/usbmanmtp.rss Fri Jun 25 13:07:44 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,129 +0,0 @@ -/* -* Copyright (c) 2005-2009 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: -* Resource file for usbman configuration. -* -*/ - -/** - @file -*/ - -NAME USBM - -#include -#include "usbman.rh" - -#ifdef LANGUAGE_01 // UK English - #include "usbman_01.rls" -#elif LANGUAGE_02 // French - #include "usbman_02.rls" -#elif defined LANGUAGE_03 // German - #include "usbman_03.rls" -#elif defined LANGUAGE_10 // US English - #include "usbman_10.rls" -#else // default to UK English strings in usbman.rsc - #include "usbman_01.rls" -#endif - -RESOURCE BA_RSS_SIGNATURE - { - signature = 3; - } - -RESOURCE usb_configuration usb_config - { - } - - -RESOURCE PERSONALITY_ARRAY device_personalities - { - personalities = - { - PERSONALITY - { - bDeviceClass = 02; - bDeviceSubClass = 0; - protocol = 0; - numConfigurations = 1; - vendorId = 0x0e22; - productId = 0x000b; - bcdDevice = 0; - manufacturer = per_manufacturer1; - product = per_product1; - id = 1; - class_uids = "101FBF22"; - description = per_description1; - detailedDescription = per_detailedDescription1; - property = 0x00000000; - }, - PERSONALITY - { - bDeviceClass = 1; - bDeviceSubClass = 2; - protocol = 0; - numConfigurations = 1; - vendorId = 0x0e22; - productId = 0x000c; - bcdDevice = 2; - manufacturer= per_manufacturer2; - product = per_product2; - id = 2; - class_uids = "101fbf24"; - description = per_description2; - detailedDescription = per_detailedDescription2; - property = 0x00000000; - }, - PERSONALITY - { - bDeviceClass = 0; - bDeviceSubClass = 0; - protocol = 0; - numConfigurations = 1; - vendorId = 0x0e22; - productId = 0x1113; - bcdDevice = 0; - manufacturer = per_manufacturer3; - product = per_product3; - id = 3; - class_uids = "10204bbc"; - description = per_description3; - detailedDescription = per_detailedDescription3; - property = 0x00000000; - }, - PERSONALITY - { - bDeviceClass = 0x00; - bDeviceSubClass = 0; - protocol = 0; - numConfigurations = 1; - vendorId = 0x0e22; - productId = 0x1114; - bcdDevice = 0x0100; - manufacturer = per_manufacturer4; - product = per_product4; - id = 4; - class_uids = "102827B3"; - description = per_description4; - detailedDescription = per_detailedDescription4; - property = 0x00000000; - } - - // The productId's value of personalities to be implemented in the - // future should be > 0x1115, to avoid conflict with IDs used by - // other drivers or applications - - }; - } - diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgr/usbman/server/SRC/usbmanmtprndis.rss --- a/usbmgmt/usbmgr/usbman/server/SRC/usbmanmtprndis.rss Fri Jun 25 13:07:44 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,146 +0,0 @@ -/* -* Copyright (c) 2008-2009 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: -* Resource file for usbman configuration. -* -*/ - -/** -@file - */ - -NAME USBM - -#include -#include "usbman.rh" - -#ifdef LANGUAGE_01 // UK English - #include "usbman_01.rls" -#elif LANGUAGE_02 // French - #include "usbman_02.rls" -#elif defined LANGUAGE_03 // German - #include "usbman_03.rls" -#elif defined LANGUAGE_10 // US English - #include "usbman_10.rls" -#else // default to UK English strings in usbman.rsc - #include "usbman_01.rls" -#endif - -RESOURCE BA_RSS_SIGNATURE - { - signature = 3; - } - -RESOURCE usb_configuration usb_config - { - } - - -RESOURCE PERSONALITY_ARRAY device_personalities - { - personalities = - { - PERSONALITY - { - bDeviceClass = 02; - bDeviceSubClass = 0; - protocol = 0; - numConfigurations = 1; - vendorId = 0x0e22; - productId = 0x000b; - bcdDevice = 0; - manufacturer = per_manufacturer1; - product = per_product1; - id = 1; - class_uids = "101FBF22"; - description = per_description1; - detailedDescription = per_detailedDescription1; - property = 0x00000000; - }, - PERSONALITY - { - bDeviceClass = 1; - bDeviceSubClass = 2; - protocol = 0; - numConfigurations = 1; - vendorId = 0x0e22; - productId = 0x000c; - bcdDevice = 2; - manufacturer= per_manufacturer2; - product = per_product2; - id = 2; - class_uids = "101fbf24"; - description = per_description2; - detailedDescription = per_detailedDescription2; - property = 0x00000000; - }, - PERSONALITY - { - bDeviceClass = 0; - bDeviceSubClass = 0; - protocol = 0; - numConfigurations = 1; - vendorId = 0x0e22; - productId = 0x1113; - bcdDevice = 0; - manufacturer = per_manufacturer3; - product = per_product3; - id = 3; - class_uids = "10204bbc"; - description = per_description3; - detailedDescription = per_detailedDescription3; - property = 0x00000000; - }, - PERSONALITY - { - bDeviceClass = 0x00; - bDeviceSubClass = 0; - protocol = 0; - numConfigurations = 1; - vendorId = 0x0e22; - productId = 0x1114; - bcdDevice = 0x0100; - manufacturer = per_manufacturer4; - product = per_product4; - id = 4; - class_uids = "102827B3"; - description = per_description4; - detailedDescription = per_detailedDescription4; - property = 0x00000000; - }, - PERSONALITY - { - bDeviceClass = 0x02; - bDeviceSubClass = 0x00; - protocol = 0x00; - numConfigurations = 1; - vendorId = 0x0e22; - productId = 0x1115; - bcdDevice = 0x0100; - manufacturer = per_manufacturer5; - product = per_product5; - id = 5; - class_uids = "20013d2f"; - description = per_description5; - detailedDescription = per_detailedDescription5; - property = 0x00000000; - } - - // The productId's value of personalities to be implemented in the - // future should be > 0x1115, to avoid conflict with IDs used by - // other drivers or applications - - }; - } - diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgr/usbman/server/SRC/usbmanrndis.rss --- a/usbmgmt/usbmgr/usbman/server/SRC/usbmanrndis.rss Fri Jun 25 13:07:44 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,129 +0,0 @@ -/* -* Copyright (c) 2008-2009 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: -* Resource file for usbman configuration. -* -*/ - -/** -@file - */ - -NAME USBM - -#include -#include "usbman.rh" - -#ifdef LANGUAGE_01 // UK English - #include "usbman_01.rls" -#elif LANGUAGE_02 // French - #include "usbman_02.rls" -#elif defined LANGUAGE_03 // German - #include "usbman_03.rls" -#elif defined LANGUAGE_10 // US English - #include "usbman_10.rls" -#else // default to UK English strings in usbman.rsc - #include "usbman_01.rls" -#endif - -RESOURCE BA_RSS_SIGNATURE - { - signature = 3; - } - -RESOURCE usb_configuration usb_config - { - } - - -RESOURCE PERSONALITY_ARRAY device_personalities - { - personalities = - { - PERSONALITY - { - bDeviceClass = 02; - bDeviceSubClass = 0; - protocol = 0; - numConfigurations = 1; - vendorId = 0x0e22; - productId = 0x000b; - bcdDevice = 0; - manufacturer = per_manufacturer1; - product = per_product1; - id = 1; - class_uids = "101FBF22"; - description = per_description1; - detailedDescription = per_detailedDescription1; - property = 0x00000000; - }, - PERSONALITY - { - bDeviceClass = 1; - bDeviceSubClass = 2; - protocol = 0; - numConfigurations = 1; - vendorId = 0x0e22; - productId = 0x000c; - bcdDevice = 2; - manufacturer= per_manufacturer2; - product = per_product2; - id = 2; - class_uids = "101fbf24"; - description = per_description2; - detailedDescription = per_detailedDescription2; - property = 0x00000000; - }, - PERSONALITY - { - bDeviceClass = 0; - bDeviceSubClass = 0; - protocol = 0; - numConfigurations = 1; - vendorId = 0x0e22; - productId = 0x1113; - bcdDevice = 0; - manufacturer = per_manufacturer3; - product = per_product3; - id = 3; - class_uids = "10204bbc"; - description = per_description3; - detailedDescription = per_detailedDescription3; - property = 0x00000000; - }, - PERSONALITY - { - bDeviceClass = 0x02; - bDeviceSubClass = 0x00; - protocol = 0x00; - numConfigurations = 1; - vendorId = 0x0e22; - productId = 0x1115; - bcdDevice = 0x0100; - manufacturer = per_manufacturer5; - product = per_product5; - id = 4; - class_uids = "20013d2f"; - description = per_description5; - detailedDescription = per_detailedDescription5; - property = 0x00000000; - } - - // The productId's value of personalities to be implemented in the - // future should be > 0x1115, to avoid conflict with IDs used by - // other drivers or applications - - }; - } - diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgr/usbman/server/conf/usbmanager_101fe1db.crml Binary file usbmgmt/usbmgr/usbman/server/conf/usbmanager_101fe1db.crml has changed diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgr/usbman/server/data/demo_mcci_usbman.rh --- a/usbmgmt/usbmgr/usbman/server/data/demo_mcci_usbman.rh Fri Jun 25 13:07:44 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2004-2009 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: -* Resource header for usbman configuration. -* this file can be renamed usbman.rh and pasted to ser-comms\usb\usbman\inc -* -*/ - -STRUCT usb_configuration - { - WORD vendorId = 0x040E; //values matching demo mcci inf files on PC - WORD productId = 0xF10F; // use those to have the symbian device using mcci drivers - WORD bcdDevice = 0x0000; - LTEXT manufacturer = "Symbian Ltd."; - LTEXT product = "Symbian OS"; - } diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgr/usbman/server/group/bld.inf --- a/usbmgmt/usbmgr/usbman/server/group/bld.inf Fri Jun 25 13:07:44 2010 +0800 +++ b/usbmgmt/usbmgr/usbman/server/group/bld.inf Fri Jun 25 13:19:39 2010 +0800 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2003-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" @@ -21,13 +21,13 @@ PRJ_EXPORTS ../public/Usb_std.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(usb_std.h) ../public/MUsbDeviceNotify.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(musbdevicenotify.h) -../public/usbman.rh /epoc32/include/usbman.rh ../public/usberrors.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(usberrors.h) ../public/UsbClassUids.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(usbclassuids.h) ../public/usbshared.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(usb/usbshared.h) ../public/usbotgdefs.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(usbotgdefs.h) ../public/usbhostdefs.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(usbhostdefs.h) -./backup_registration.xml /epoc32/data/z/private/101fe1db/backup_registration.xml +./backup_registration.xml /epoc32/data/z/private/101fe1db/backup_registration.xml +../conf/usbmanager_101fe1db.crml OS_LAYER_EXPORTS_CRML(usbmanager_101fe1db.crml) PRJ_TESTEXPORTS diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgr/usbman/server/group/usbsvrbase.mmp --- a/usbmgmt/usbmgr/usbman/server/group/usbsvrbase.mmp Fri Jun 25 13:07:44 2010 +0800 +++ b/usbmgmt/usbmgr/usbman/server/group/usbsvrbase.mmp Fri Jun 25 13:19:39 2010 +0800 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2004-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" @@ -37,43 +37,13 @@ source CUsbDeviceStateWatcher.cpp source UsbUtils.cpp source CPersonality.cpp +source usbmancenrepmanager.cpp userinclude ../INC userinclude ../public userinclude ../../../host/fdf/production/client/public OS_LAYER_SYSTEMINCLUDE_SYMBIAN -lang sc 01 02 03 10 // UK English, French, German, US English - -START RESOURCE usbman.rss -TARGETPATH /private/101fe1db -HEADER -END - -#ifdef SYMBIAN_USB_RNDIS -START RESOURCE usbmanrndis.rss -TARGETPATH /private/101fe1db -HEADER -END -#endif - -START RESOURCE usbmanmtp.rss -TARGETPATH /private/101fe1db -HEADER -END - -#ifdef SYMBIAN_USB_RNDIS -START RESOURCE usbmanmtprndis.rss -TARGETPATH /private/101fe1db -HEADER -END -#endif - -START RESOURCE usbmanlubbockobex.rss -TARGETPATH /private/101fe1db -HEADER -END - library euser.lib library usbclasscontroller.lib library ecom.lib @@ -81,5 +51,10 @@ library bafl.lib library usbmanextensionplugin.lib library sysutil.lib +library centralrepository.lib + +#ifdef SYMBIAN_FEATURE_MANAGER +library featdiscovery.lib +#endif #include diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgr/usbman/server/public/rusb.h --- a/usbmgmt/usbmgr/usbman/server/public/rusb.h Fri Jun 25 13:07:44 2010 +0800 +++ b/usbmgmt/usbmgr/usbman/server/public/rusb.h Fri Jun 25 13:19:39 2010 +0800 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2003-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" @@ -85,7 +85,6 @@ EUsbGetOtgDescriptor, EUsbDbgAlloc, EUsbRequestSession, - EUsbGetDetailedDescription, EUsbGetPersonalityProperty }; diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgr/usbman/server/public/usbman.rh --- a/usbmgmt/usbmgr/usbman/server/public/usbman.rh Fri Jun 25 13:07:44 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,133 +0,0 @@ -/* -* Copyright (c) 2003-2009 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: -* Resource header for usbman configuration. -* -*/ - -/** - @file - @publishedPartner - @released -*/ - -STRUCT usb_configuration - { - /** - vendorId is the 16-bit number that is assigned by USB-ORG. - */ - WORD vendorId = 0x0e22; - - /** - productId is a 16-bit number that is assigned by the licensee to - uniquely identify this particular type of device. - */ - WORD productId = 0x000b; - - /** - bcdDevice may be optionally used during enumeration, this depends on - the licensee's policy regarding device upgrades (new versions of a - device may require to use new host driver files) - */ - WORD bcdDevice = 0x0000; - - /** - manufacturerString is displayed on the Windows screen during first - enumeration of the device, and should identify the same company that - owns the USB vendorId given above - */ - LTEXT manufacturer = "Symbian Ltd."; - - /** - productString is displayed on the Windows screen during first - enumeration of the device, and should identify the same device that is - implied by the productId given above - */ - LTEXT product = "Symbian OS"; - } - -STRUCT PERSONALITY - { - /** Class code (assigned by the USB-IF). If this field is set to zero, each interface within - a configuration specifies its own class information and the various interfaces operate independently. - - If this field is set to a value between 1 and FEH, the device supports different class - specifications on different interfaces and the interfaces may not operate independently. - This value identifies the class definition used for the aggregate interfaces. - - If this field is set to FFH, the device class is vendor-specific. */ - BYTE bDeviceClass; - - /** Subclass code (assigned by the USB-IF). These codes are qualified by the value of the bDeviceClass field. - If the bDeviceClass field is set to zero, this field must also be set to zero. - If the bDeviceClass field is not set to FFH, all values are reserved for assignment by the USB-IF. */ - BYTE bDeviceSubClass; - - /** Protocol code (assigned by the USB-IF). These codes are qualified by the value of the bDeviceClass and the - bDeviceSubClass fields. If a device supports class-specific protocols on a device basis as opposed to an - interface basis, this code identifies the protocols that the device uses as defined by the specification of the device class. - If this field is set to zero, the device does not use class-specific protocols on a device basis. However, it may use - classspecific protocols on an interface basis. - If this field is set to FFH, the device uses a vendor-specific protocol on a device basis. */ - BYTE protocol; - - /** Number of possible configurations */ - BYTE numConfigurations; - - /** vendorId is the 16-bit number that is assigned by USB-ORG. */ - WORD vendorId; - - /** productId is a 16-bit number that is assigned by the licensee to - uniquely identify this particular personality as type of device . */ - WORD productId; - - /** bcdDevice may be optionally used during enumeration, this depends on - the licensee's policy regarding device upgrades */ - WORD bcdDevice; - - /** manufacturerString is displayed on the Windows screen during first - enumeration of the device, and should identify the same company that - owns the USB vendorId given above */ - LTEXT manufacturer; - - /** productString is displayed on the Windows screen during first - enumeration of the device, and should identify the same device that is - implied by the productId given above */ - LTEXT product; - - /** personality id - UID which identified this personality */ - WORD id; - - /** list of Class Controllers UIDs associated with this personality. - UIDs shoud be provided as list of hexadecimal numbers separated by space or comma. - Note Do not provide leading 0x or any trailing characters! - Example "1Abc3422, 12345678 FE43bc33" - Incorrect example "1abc3422, 0x12345678," */ - LTEXT class_uids; - - /** free text description of this personality. */ - LTEXT description; - - /** free text detailed description of this personality. */ - LTEXT detailedDescription; - - /** personality property - the property of this personality */ - LONG property; - - } - -STRUCT PERSONALITY_ARRAY - { - STRUCT personalities[]; // STRUCT PERSONALITY - } diff -r 4ddb65515edd -r f3a1ae528dee usbmgmt/usbmgrtest/t_charging_emu/src/tbatterycharging.cpp --- a/usbmgmt/usbmgrtest/t_charging_emu/src/tbatterycharging.cpp Fri Jun 25 13:07:44 2010 +0800 +++ b/usbmgmt/usbmgrtest/t_charging_emu/src/tbatterycharging.cpp Fri Jun 25 13:19:39 2010 +0800 @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -129,6 +128,7 @@ iPlugin = iExtensionPlugins[0]; iDummyLdd.Initialise(); + //iRepository = CRepository::NewL(KUsbBatteryChargingCentralRepositoryUid); User::LeaveIfError(iTimer.CreateLocal()); DefinePropertyL(KBattChargWriteRepositoryUid, KBattChargWriteRepositoryKey,RProperty::EInt); @@ -345,7 +345,7 @@ TInt CDummyUsbDevice::GetNextLine() { - TInt newLineOffset = (iPtr.Mid(iFileOffset)).Locate(13); + TInt newLineOffset = (iPtr.Mid(iFileOffset)).Locate(13);//Find(_L("\r\n")); if (newLineOffset < 0) { return newLineOffset; @@ -426,6 +426,7 @@ { TInt err = WriteToRepositoryProperty(iCommandValue); + //TInt err = iRepository->Set(KUsbBatteryChargingKeyEnabledUserSetting, iCommandValue); iTest(err == KErrNone); } break; @@ -481,6 +482,8 @@ TInt current; TInt err = GetChargingCurrentFromProperty(current); + //TInt err = RProperty::Get(KPropertyUidUsbBatteryChargingCategory, + // KPropertyUidUsbBatteryChargingChargingCurrent, current); iTest(err == KErrNone); iTest(current == iCheckValue); }