# HG changeset patch # User William Roberts # Date 1279813779 -3600 # Node ID c7df333992faadeef615d3d33d387fa680191120 # Parent 59d8e4a44a15d349f6c03605a8e45ca9cd12a212# Parent 4bea936937d0d99fe100d92a6af85fab342f7b92 Catchup to latest Symbian^4 diff -r 59d8e4a44a15 -r c7df333992fa layers.sysdef.xml --- a/layers.sysdef.xml Fri Jun 11 16:29:16 2010 +0100 +++ b/layers.sysdef.xml Thu Jul 22 16:49:39 2010 +0100 @@ -7,11 +7,11 @@ - + - - + + diff -r 59d8e4a44a15 -r c7df333992fa package_definition.xml --- a/package_definition.xml Fri Jun 11 16:29:16 2010 +0100 +++ b/package_definition.xml Thu Jul 22 16:49:39 2010 +0100 @@ -20,7 +20,7 @@ - + diff -r 59d8e4a44a15 -r c7df333992fa usb_info/usb_metadata/usb_metadata.mrp --- a/usb_info/usb_metadata/usb_metadata.mrp Fri Jun 11 16:29:16 2010 +0100 +++ b/usb_info/usb_metadata/usb_metadata.mrp Thu Jul 22 16:49:39 2010 +0100 @@ -1,19 +1,3 @@ -# -# Copyright (c) 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: -# - component usb_metadata source \sf\os\usb\usb_info\usb_metadata source \sf\os\usb\package_definition.xml diff -r 59d8e4a44a15 -r c7df333992fa usb_plat/group/usb_plat.mrp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usb_plat/group/usb_plat.mrp Thu Jul 22 16:49:39 2010 +0100 @@ -0,0 +1,26 @@ +# 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: +# +# +component usb_plat + +source \sf\os\usb\usb_plat\group + +binary \sf\os\usb\usb_plat\group all + +exports \sf\os\usb\usb_plat\group + +notes_source \component_defs\release.src + +ipr E diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/conf/usbmanager.confml Binary file usbmgmt/usbmgr/conf/usbmanager.confml has changed diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/group/BLD.INF --- a/usbmgmt/usbmgr/group/BLD.INF Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/group/BLD.INF Thu Jul 22 16:49:39 2010 +0100 @@ -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,9 @@ 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 + +//Temporary location, Will be moved if SHAI is ready +usbperipheral.iby /epoc32/rom/include/usbperipheral.iby // ConfML Files ../conf/usbmanager.confml OS_LAYER_EXPORTS_CONFML(usbmanager.confml) diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/group/Usbman.iby --- a/usbmgmt/usbmgr/group/Usbman.iby Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/group/Usbman.iby Thu Jul 22 16:49:39 2010 +0100 @@ -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 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/group/Usbmanbin.iby --- a/usbmgmt/usbmgr/group/Usbmanbin.iby Fri Jun 11 16:29:16 2010 +0100 +++ /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 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/group/Usbmanrsc.iby --- a/usbmgmt/usbmgr/group/Usbmanrsc.iby Fri Jun 11 16:29:16 2010 +0100 +++ /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 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/group/usbperipheral.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbmgmt/usbmgr/group/usbperipheral.iby Thu Jul 22 16:49:39 2010 +0100 @@ -0,0 +1,30 @@ +/* +* 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: +* Logical Device Driver of USB peripheral stack +* +*/ +#ifndef USBPERIPHERAL_IBY +#define USBPERIPHERAL_IBY + +#include + +#ifndef COREOS +#ifndef NCP_COMMON_PLATFORM_SIMULATOR +device[VARID]=KERNEL_DIR\BUILD_DIR\usbc.ldd \Sys\Bin\eusbc.ldd +device[VARID]=KERNEL_DIR\BUILD_DIR\usbcsc.ldd \Sys\Bin\eusbcsc.ldd +#endif // NCP_COMMON_PLATFORM_SIMULATOR +#endif // COREOS + +#endif \ No newline at end of file diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/host/fdf/production/server/public/fdfapi.h --- a/usbmgmt/usbmgr/host/fdf/production/server/public/fdfapi.h Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/host/fdf/production/server/public/fdfapi.h Thu Jul 22 16:49:39 2010 +0100 @@ -28,15 +28,15 @@ #ifdef __OVER_DUMMYUSBDI__ const TUint32 KUsbFdfTUint = 0x10282B50; _LIT(KUsbFdfImg, "fdf_over_dummyusbdi.exe"); +_LIT(KUsbFdfServerName, "!FdfSrv_over_dummyusbdi"); #else const TUint32 KUsbFdfTUint = 0x10282B48; _LIT(KUsbFdfImg, "fdf.exe"); +_LIT(KUsbFdfServerName, "!FdfSrv"); #endif const TUid KUsbFdfUid = {KUsbFdfTUint}; -_LIT(KUsbFdfServerName, "!FdfSrv"); - /** Version numbers. */ const TInt8 KUsbFdfSrvMajorVersionNumber = 1; const TInt8 KUsbFdfSrvMinorVersionNumber = 1; diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/bwins/msmmicsession_over_dummycomponentu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/bwins/msmmicsession_over_dummycomponentu.def Thu Jul 22 16:49:39 2010 +0100 @@ -0,0 +1,6 @@ +EXPORTS + ?EjectUsbDrives@RHostMassStorage@@QAEHXZ @ 1 NONAME ; int RHostMassStorage::EjectUsbDrives(void) + ?Disconnect@RHostMassStorage@@QAEHXZ @ 2 NONAME ; int RHostMassStorage::Disconnect(void) + ?Connect@RHostMassStorage@@QAEHXZ @ 3 NONAME ; int RHostMassStorage::Connect(void) + ?Version@RHostMassStorage@@QBE?AVTVersion@@XZ @ 4 NONAME ; class TVersion RHostMassStorage::Version(void) const + diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/eabi/msmmicsession_over_dummycomponentu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/eabi/msmmicsession_over_dummycomponentu.def Thu Jul 22 16:49:39 2010 +0100 @@ -0,0 +1,6 @@ +EXPORTS + _ZN16RHostMassStorage10DisconnectEv @ 1 NONAME + _ZN16RHostMassStorage14EjectUsbDrivesEv @ 2 NONAME + _ZN16RHostMassStorage7ConnectEv @ 3 NONAME + _ZNK16RHostMassStorage7VersionEv @ 4 NONAME + diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/eabi/msmmindicatorsessionu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/eabi/msmmindicatorsessionu.def Thu Jul 22 16:49:39 2010 +0100 @@ -0,0 +1,6 @@ +EXPORTS + _ZN16RHostMassStorage10DisconnectEv @ 1 NONAME + _ZN16RHostMassStorage14EjectUsbDrivesEv @ 2 NONAME + _ZN16RHostMassStorage7ConnectEv @ 3 NONAME + _ZNK16RHostMassStorage7VersionEv @ 4 NONAME + diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/group/bld.inf --- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/group/bld.inf Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/group/bld.inf Thu Jul 22 16:49:39 2010 +0100 @@ -27,9 +27,11 @@ #if defined(SYMBIAN_ENABLE_USB_OTG_HOST) && !defined(WINS) && !defined(X86GCC) msmmclient.mmp +msmmindicatorclient.mmp #endif - PRJ_TESTEXPORTS ../public/msmmclient.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(usb/hostms/msmmclient.h) +PRJ_EXPORTS +../public/msmmindicatorclient.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(usb/hostms/msmmindicatorclient.h) diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/group/msmmclient_over_dummycomponent.mmp --- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/group/msmmclient_over_dummycomponent.mmp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/group/msmmclient_over_dummycomponent.mmp Thu Jul 22 16:49:39 2010 +0100 @@ -28,6 +28,6 @@ #include "msmmclient_base.mmp" -CAPABILITY ProtServ WriteDeviceData CommDD DiskAdmin NetworkControl +CAPABILITY ProtServ WriteDeviceData CommDD DiskAdmin NetworkControl TrustedUI MACRO __OVER_DUMMYCOMPONENT__ \ No newline at end of file diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/group/msmmindicatorclient.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/group/msmmindicatorclient.mmp Thu Jul 22 16:49:39 2010 +0100 @@ -0,0 +1,30 @@ +/* +* 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: +* +*/ + +/** + @file + @internalComponent +*/ + + +TARGET msmmindicatorsession.dll +TARGETTYPE dll +UID 0x1000008d 0x20031571 + +CAPABILITY All -TCB + +#include "msmmindicatorclient_base.mmp" diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/group/msmmindicatorclient_base.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/group/msmmindicatorclient_base.mmp Thu Jul 22 16:49:39 2010 +0100 @@ -0,0 +1,37 @@ +/* +* 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: +* +*/ + +/** + @file + @internalComponent +*/ + +#include + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib + +SOURCEPATH ../src + +SOURCE msmmindicatorclient.cpp + +USERINCLUDE ../../inc +USERINCLUDE ../public +USERINCLUDE ../../server/public + +VENDORID 0x70000001 diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/group/msmmindicatorclient_over_dummycomponent.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/group/msmmindicatorclient_over_dummycomponent.mmp Thu Jul 22 16:49:39 2010 +0100 @@ -0,0 +1,33 @@ +/* +* 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: +* +*/ + +/** + @file + @internalComponent + @test +*/ + + +TARGET msmmicsession_over_dummycomponent.dll +TARGETTYPE dll +UID 0x1000008d 0x0F15655A + +#include "msmmindicatorclient_base.mmp" + +CAPABILITY ProtServ WriteDeviceData CommDD DiskAdmin NetworkControl TrustedUI + +MACRO __OVER_DUMMYCOMPONENT__ \ No newline at end of file diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/public/msmmindicatorclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/public/msmmindicatorclient.h Thu Jul 22 16:49:39 2010 +0100 @@ -0,0 +1,49 @@ +/* +* 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: +* +*/ + +/** + @file + @internalComponent +*/ + +#ifndef MSMMINDICATORCLIENT_H +#define MSMMINDICATORCLIENT_H + +#include + +/** +RHostMassStorage is the interface for Mass Storage Indicator UI to use the MSMM. +*/ +NONSHARABLE_CLASS(RHostMassStorage) : public RSessionBase +{ +public: + // RHostMassStorage Implementation API to add a session to the running MSMM server + IMPORT_C TInt Connect(); + IMPORT_C TInt Disconnect(); + IMPORT_C TVersion Version() const; + + /** Dismount USB drives from File System asynchronously. The function will return immediately to the UI with complete status + The result of dismounting USB drives will be notified to the MSMM Plugin via CMsmmPolicyPluginBase + @return Error code of IPC. + */ + IMPORT_C TInt EjectUsbDrives(); + +}; + +#endif // MSMMINDICATORCLIENT_H + +// End of file diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/src/msmmindicatorclient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/src/msmmindicatorclient.cpp Thu Jul 22 16:49:39 2010 +0100 @@ -0,0 +1,110 @@ +/* +* 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: +* +*/ + +/** + @file + @internalComponent +*/ + +#include +#include + +#include "srvdef.h" +#include "msmmindicatorclient.h" + +#ifdef __FLOG_ACTIVE +_LIT8(KLogComponent, "UsbHostMsmmIndicatorClient"); +#endif + +// Costants +const TInt KConnectRetry = 0x2; + + +//--------------------------------------------------------------------------- +// RHostMassStorage +// +// Public member functions + +EXPORT_C TInt RHostMassStorage::Connect() + { + LOG_FUNC + + TInt retry = KConnectRetry; // Attempt to add a session to MSMM Server twice + TInt ret(KErrNone); + FOREVER + { + ret = CreateSession(KMsmmServerName, Version(), KDefaultMessageSlots); + // We are not allowed to start the server + if ((KErrNotFound == ret) || (KErrServerTerminated == ret)) + { + LOGTEXT2(_L("Underlying error value = %d"), ret) + return KErrNotReady; + } + if ( KErrNone == ret ) + { + break; + } + if ((--retry) == 0) + { + break; + } + } + return ret; + } + +EXPORT_C TInt RHostMassStorage::Disconnect() + { + LOG_FUNC + + Close(); + return KErrNone; + } + +/** + * Called to validate the version of the server we require for this API + * @return TVersion The version of MSMM Server that supports this API + */ +EXPORT_C TVersion RHostMassStorage::Version() const + { + LOG_FUNC + + return TVersion(KMsmmServMajorVersionNumber, + KMsmmServMinorVersionNumber, + KMsmmServBuildVersionNumber); + } + +/** + * Dismount USB drives from File System asynchronously. The function will return immediately to the UI with complete status + * The result of dismounting USB drives will be notified to the MSMM Plugin via CMsmmPolicyPluginBase + * @return Error code of IPC. +*/ + +EXPORT_C TInt RHostMassStorage::EjectUsbDrives() + { + LOG_FUNC + + TInt ret(KErrNone); + + TIpcArgs usbmsIpcArgs; + + ret = Send(EHostMsmmServerEjectUsbDrives, usbmsIpcArgs); + + return ret; + } + + +// End of file diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/host/functiondrivers/ms/msmm/group/bld.inf --- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/group/bld.inf Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/group/bld.inf Thu Jul 22 16:49:39 2010 +0100 @@ -23,10 +23,11 @@ PRJ_PLATFORMS ARMV5 GCCXML +#include "../client/group/bld.inf" #include "../server/group/bld.inf" -#include "../client/group/bld.inf" #include "../referencepolicyplugin/group/bld.inf" #include "../refppnotifier/group/bld.inf" PRJ_EXPORTS usbhostmsmm.iby /epoc32/rom/include/usbhostmsmm.iby + diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/host/functiondrivers/ms/msmm/group/msmm_over_dummycomponent_bld.inf --- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/group/msmm_over_dummycomponent_bld.inf Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/group/msmm_over_dummycomponent_bld.inf Thu Jul 22 16:49:39 2010 +0100 @@ -28,4 +28,5 @@ PRJ_TESTMMPFILES ../server/group/msmmserver_over_dummycomponent.mmp ../client/group/msmmclient_over_dummycomponent.mmp +../client/group/msmmindicatorclient_over_dummycomponent.mmp ../referencepolicyplugin/group/refpp_over_dummycomponent.mmp diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/host/functiondrivers/ms/msmm/group/usbhostmsmm.iby --- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/group/usbhostmsmm.iby Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/group/usbhostmsmm.iby Thu Jul 22 16:49:39 2010 +0100 @@ -30,6 +30,7 @@ file=ABI_DIR\USB_DIR\msmmsession.dll Sys\bin\msmmsession.dll file=ABI_DIR\USB_DIR\msmmserver.exe Sys\bin\msmmserver.exe +file=ABI_DIR\USB_DIR\msmmindicatorsession.dll Sys\bin\msmmindicatorsession.dll #endif diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/host/functiondrivers/ms/msmm/inc/srvdef.h --- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/inc/srvdef.h Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/inc/srvdef.h Thu Jul 22 16:49:39 2010 +0100 @@ -48,6 +48,12 @@ const TUint32 KFDFWSecureId = 0x10282B48; #endif +#ifdef __OVER_DUMMYCOMPONENT__ +const TUint32 KSidHbDeviceDialogAppServer = 0x20022FC4; // SID for unit test project +#else +const TUint32 KSidHbDeviceDialogAppServer = 0x20022FC5; //SID for indicator UI that will call eject usb drives +#endif + /** The Msmm Version numbers */ const TUint KMsmmServMajorVersionNumber = 1; const TUint KMsmmServMinorVersionNumber = 0; @@ -60,6 +66,7 @@ EHostMsmmServerRemoveDevice = 2, // Remove device request EHostMsmmServerDbgFailNext = 3, EHostMsmmServerDbgAlloc = 4, + EHostMsmmServerEjectUsbDrives = 5, // Dismount USB drives request EHostMsmmServerEndMarker // Request end mark }; @@ -67,6 +74,6 @@ const TUint KDefaultMessageSlots = 1; // Max connection number -const TInt KMaxClientCount = 1; +const TInt KMaxClientCount = 2; #endif // #ifndef SRVDEF_H diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/inc/refppdialog.h --- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/inc/refppdialog.h Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/inc/refppdialog.h Thu Jul 22 16:49:39 2010 +0100 @@ -24,7 +24,7 @@ #define CREFPPDIALOG_H // INCLUDES -#include +#include // CLASS DECLARATION /** diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/inc/refppnotifier.h --- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/inc/refppnotifier.h Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/inc/refppnotifier.h Thu Jul 22 16:49:39 2010 +0100 @@ -23,7 +23,7 @@ #ifndef REFPPNOTIFIER_H #define REFPPNOTIFIER_H -#include +#include #include #include "refppdialog.h" diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/src/dialog.rss --- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/src/dialog.rss Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/src/dialog.rss Thu Jul 22 16:49:39 2010 +0100 @@ -21,9 +21,8 @@ @internalComponent */ -#include -#include -#include +#include +#include #include #include "refppnotifier.hrh" NAME REFN diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/src/refppnotifier.cpp --- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/src/refppnotifier.cpp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/src/refppnotifier.cpp Thu Jul 22 16:49:39 2010 +0100 @@ -23,9 +23,9 @@ #include "refppnotifier.h" #include #include "refppnotifier.hrh" -#include +#include #include -#include +#include #include #include const TUid KMsmmRefNotifierChannel = {0x10009D48}; //0x10208C14 diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/group/msmmserver_base.mmp --- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/group/msmmserver_base.mmp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/group/msmmserver_base.mmp Thu Jul 22 16:49:39 2010 +0100 @@ -33,6 +33,7 @@ SOURCE main.cpp SOURCE msmmserver.cpp SOURCE msmmsession.cpp +SOURCE msmmdismountusbdrives.cpp SOURCE eventqueue.cpp SOURCE eventhandler.cpp SOURCE msmmterminator.cpp diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/group/msmmserver_over_dummycomponent.mmp --- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/group/msmmserver_over_dummycomponent.mmp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/group/msmmserver_over_dummycomponent.mmp Thu Jul 22 16:49:39 2010 +0100 @@ -27,6 +27,7 @@ UID 0 0x1028653F LIBRARY dummymsc.lib +LIBRARY dummyfilesysclient.lib #include "msmmserver_base.mmp" diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/inc/msmmdismountusbdrives.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/inc/msmmdismountusbdrives.h Thu Jul 22 16:49:39 2010 +0100 @@ -0,0 +1,169 @@ +/* +* Copyright (c) 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: Header file for Stylus Tap indicator eject usb drives +* +*/ + + +#ifndef MSMMDISMOUNTUSBDRIVES_H +#define MSMMDISMOUNTUSBDRIVES_H + +#include +#ifdef __OVER_DUMMYCOMPONENT__ +#include "usb/hostms/dummycomponent/dummyfsclient.h" +#else +#include +#endif + +#include "msmm_pub_def.h" + +class CDismountTimer; +class CMsmmPolicyPluginBase; + +/** + * Timer callback interface to indicate USB drive in use + * + * This class specifies the function to be called when a timeout occurs. + * Used in conjunction with CDismountTimer class + * + */ +class MTimerNotifier + { +public: + /** + * The function to be called when a timeout occurs. + * + */ + virtual void TimerExpired() = 0; + }; + +/** + * An Active Object class to request dismount of usb specific drives and notify the result to MSMM plugin + * + */ +NONSHARABLE_CLASS( CMsmmDismountUsbDrives ) : public CActive, + public MTimerNotifier + { +public: + virtual ~CMsmmDismountUsbDrives(); + static CMsmmDismountUsbDrives* NewL(); + static CMsmmDismountUsbDrives* NewLC(); + +public: + /** + * Send dismount notifications for all usb drives. + */ + void DismountUsbDrives(CMsmmPolicyPluginBase& aPlugin, TUSBMSDeviceDescription& aDevice); + +protected: + CMsmmDismountUsbDrives(); + void ConstructL(); + +private: + /** + * Send dismount notification via RFs + */ + void DoDismount(); + + /** + * Callback to CMsmmPolicyPluginBase + */ + void CompleteDismountRequest(const TInt aResult); + +private: //from CActive + void RunL(); + void DoCancel(); + +private: // from MTimerNotifier + + /** + * Dismount timer callback + */ + void TimerExpired(); + +private: + /** + * Drive index + */ + TInt iDriveIndex; + /** + * RFs session + */ +#ifdef __OVER_DUMMYCOMPONENT__ + RDummyFs iRFs; +#else + RFs iRFs; +#endif + /** + * List of drives + */ + TDriveList iDriveList; + + /** + * Dismount timer + * Own + */ + CDismountTimer* iDismountTimer; + + /** + * Callback API for dismount result + * Do not own + */ + CMsmmPolicyPluginBase* iPlugin; + + /** + * Device specific details, manufacturer and productid + */ + TPckgBuf iDevicePkgInfo; + }; + + +/** + * Timer interface for dismount request + * + * This class will notify an object after a specified timeout. + * + */ +class CDismountTimer : public CTimer + { +public: + static CDismountTimer* NewL( MTimerNotifier* aTimeOutNotify ); + static CDismountTimer* NewLC( MTimerNotifier* aTimeOutNotify); + virtual ~CDismountTimer(); + void CancelTimer(); + void StartTimer(); + +protected: + /** + * From CTimer + * Invoked when a timeout occurs + * + */ + virtual void RunL(); + +private: + CDismountTimer( MTimerNotifier* aTimeOutNotify ); + void ConstructL(); + +private: // Member variables + + /** + * The observer for this objects events + * Not own. + */ + MTimerNotifier* iNotify; + }; + + +#endif // MSMMDISMOUNTUSBDRIVES_H diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/inc/msmmserver.h --- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/inc/msmmserver.h Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/inc/msmmserver.h Thu Jul 22 16:49:39 2010 +0100 @@ -37,6 +37,9 @@ class CMsmmTerminator; class CDeviceEventQueue; class CMsmmPolicyPluginBase; +class THostMsErrData; +class CMsmmDismountUsbDrives; +class TUSBMSDeviceDescription; // Server side resource container class // Intends to be used by any internal objects (such as sub-command objects) @@ -66,11 +69,16 @@ // CMsmmServer API virtual CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const; - + CPolicyServer::TCustomResult CustomSecurityCheckL(const RMessage2& aMsg, + TInt& aAction, + TSecurityInfo& aMissing); + TInt SessionNumber() const; void AddSession(); void RemoveSession(); + void DismountUsbDrivesL(TUSBMSDeviceDescription& aDevice); + // From MMsmmSrvProxy inline CMsmmEngine& Engine() const; inline RFs& FileServerSession() const; @@ -87,6 +95,8 @@ RFs iFs; CMsmmPolicyPluginBase* iPolicyPlugin; // Owned CDeviceEventQueue* iEventQueue; // Owned + CMsmmDismountUsbDrives* iDismountManager; //Singleton to request dismounting usb drives via RFs + THostMsErrData* iDismountErrData; // The data nodes try, Owned }; #include "msmmserver.inl" #endif // MSMMSERVER_H diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/inc/srvsec.h --- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/inc/srvsec.h Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/inc/srvsec.h Thu Jul 22 16:49:39 2010 +0100 @@ -26,6 +26,7 @@ const TInt KMsmmServerRanges[] = { EHostMsmmServerAddFunction, + EHostMsmmServerEjectUsbDrives, //separate policy check for Eject usb drives client EHostMsmmServerEndMarker }; const TUint KMsmmServerRangeCount = @@ -34,18 +35,21 @@ const TUint8 KMsmmServerElementsIndex[KMsmmServerRangeCount] = { 0, + 1, CPolicyServer::ENotSupported }; const CPolicyServer::TPolicyElement KMsmmServerElements[] = { {_INIT_SECURITY_POLICY_S1( KFDFWSecureId, ECapabilityCommDD ), + CPolicyServer::EFailClient}, + {_INIT_SECURITY_POLICY_S1( KSidHbDeviceDialogAppServer, ECapabilityTrustedUI ), CPolicyServer::EFailClient} }; const CPolicyServer::TPolicy KMsmmServerSecurityPolicy = { - 0, + CPolicyServer::ECustomCheck, KMsmmServerRangeCount, KMsmmServerRanges, KMsmmServerElementsIndex, diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/public/srverr.h --- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/public/srverr.h Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/public/srverr.h Thu Jul 22 16:49:39 2010 +0100 @@ -31,6 +31,9 @@ // adding device EHostMsErrInvalidParameter = 0x4, // Invalid request parameter EHostMsErrOutOfMemory = 0x5, // Out of memory + EHostMsEjectInProgress = 0x6, // eject request commenced + EHostMsErrNone = 0x7, // no error == success condition + EHostMsErrInUse = 0x8, // Drives in use EHostMsErrorEndMarker }; diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/eventhandler.cpp --- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/eventhandler.cpp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/eventhandler.cpp Thu Jul 22 16:49:39 2010 +0100 @@ -212,9 +212,12 @@ LOG_FUNC // Complete client with KErrCancel CompleteClient(KErrCancel); - + // Cancel current pending command - iSubCommandQueue.Head().CancelAsyncCmd(); + if (iSubCommandQueue.Count()) + { + iSubCommandQueue.Head().CancelAsyncCmd(); + } } void CDeviceEventHandler::RunL( ) @@ -251,30 +254,33 @@ TInt CDeviceEventHandler::RunError(TInt aError) { LOG_FUNC - // Retrieve sub-command related error notification data - iSubCommandQueue.Head().HandleError(*iErrNotiData, aError); - - // If current sub-command isn't a key one, the handler will continue to - // execute rest sub-command in the queue. But, if current sub-command - // is the last one in the queue, handler shall complete the client also. - if (iSubCommandQueue.Head().IsKeyCommand() || - (iSubCommandQueue.Count() == 1)) + + if (iSubCommandQueue.Count()) { - CompleteClient(aError); + // Retrieve sub-command related error notification data + iSubCommandQueue.Head().HandleError(*iErrNotiData, aError); + + // If current sub-command isn't a key one, the handler will continue to + // execute rest sub-command in the queue. But, if current sub-command + // is the last one in the queue, handler shall complete the client also. + if (iSubCommandQueue.Head().IsKeyCommand() || + (iSubCommandQueue.Count() == 1)) + { + CompleteClient(aError); + } + iSubCommandQueue.Pop(); } - //Restart the handler after error handling; - if (!IsActive()) + if( IsActive() ) + { + Complete(aError); + } + else if (iSubCommandQueue.Count()) { Start(); + Complete(); } - Complete(aError); - - if (iSubCommandQueue.Count()) - { - iSubCommandQueue.Pop(); - } - + return KErrNone; } diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/msmmdismountusbdrives.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/msmmdismountusbdrives.cpp Thu Jul 22 16:49:39 2010 +0100 @@ -0,0 +1,248 @@ +/* +* Copyright (c) 2007-2008 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: Active Object to dismount usb drives +* +*/ + + +#include +#include +#include + +#include "msmmdismountusbdrives.h" + +const TInt KDismountTimeOut = 6000000; // 6 seconds + + +#ifdef __FLOG_ACTIVE +_LIT8(KLogComponent, "UsbHostMsmmServer"); +#endif + +CMsmmDismountUsbDrives::~CMsmmDismountUsbDrives() + { + LOG_FUNC + Cancel(); + delete iDismountTimer; + iRFs.Close(); + } + +/** + * Symbian two phase constructor + */ +CMsmmDismountUsbDrives* CMsmmDismountUsbDrives::NewL() + { + LOG_STATIC_FUNC_ENTRY + CMsmmDismountUsbDrives* self = CMsmmDismountUsbDrives::NewLC(); + CleanupStack::Pop(self); + return self; + } + +/** + * Symbian two phase constructor. Object pushed to cleanup stack + */ +CMsmmDismountUsbDrives* CMsmmDismountUsbDrives::NewLC() + { + LOG_STATIC_FUNC_ENTRY + CMsmmDismountUsbDrives* self = new (ELeave) CMsmmDismountUsbDrives(); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +/** + * Check the status of current dismount request and continue issuing next if no error + */ +void CMsmmDismountUsbDrives::RunL() + { + LOG_FUNC + + iDismountTimer->CancelTimer(); + + // Indicates there has been an error dismounting a usb drive, report immediately to MSMM plugin and + // abort the process + if ( iStatus != KErrNone ) + { + CompleteDismountRequest( iStatus.Int() ); + } + // Indicates we have reached the end of all usb drives dismounting, in other words a success condition + else if ( iDriveIndex == KMaxDrives ) + { + CompleteDismountRequest( KErrNone ); + } + // We still have more drives to traverse + else if ( iDriveIndex < KMaxDrives ) + { + DoDismount(); + } + } + +/** + * Cancel pending notifier and those in queue + */ +void CMsmmDismountUsbDrives::DoCancel() + { + LOG_FUNC + iRFs.NotifyDismountCancel(iStatus); + } + +CMsmmDismountUsbDrives::CMsmmDismountUsbDrives() + : CActive(EPriorityStandard) + { + LOG_FUNC + CActiveScheduler::Add(this); + } + +void CMsmmDismountUsbDrives::ConstructL() + { + LOG_FUNC + User::LeaveIfError( iRFs.Connect()); + iDismountTimer = CDismountTimer::NewL(this); + } + +/** + * Dismount usb drives + */ +void CMsmmDismountUsbDrives::DismountUsbDrives(CMsmmPolicyPluginBase& aPlugin, TUSBMSDeviceDescription& aDevice) + { + LOG_FUNC + Cancel(); + iPlugin = &aPlugin; + TUSBMSDeviceDescription& device = iDevicePkgInfo(); + device = aDevice; + iDriveIndex = 0; + iRFs.DriveList( iDriveList ); + DoDismount(); + } + +/** + * Callback to CMsmmPolicyPluginBase with either success or failure message + */ +void CMsmmDismountUsbDrives::CompleteDismountRequest(const TInt aResult) + { + THostMsErrData data; + if( aResult == KErrNone ) + data.iError = EHostMsErrNone; + else + data.iError = EHostMsErrInUse; + data.iE32Error = aResult; + data.iManufacturerString = iDevicePkgInfo().iManufacturerString; + data.iProductString = iDevicePkgInfo().iProductString; + data.iDriveName = 0x0; + + TRAP_IGNORE(iPlugin->SendErrorNotificationL(data)); + } + +/** + * Dismount next usb drive + */ +void CMsmmDismountUsbDrives::DoDismount() + { + LOG_FUNC + TDriveInfo info; + TInt err = KErrNone; + for ( ; iDriveIndex < KMaxDrives; iDriveIndex++ ) + { + if ( iDriveList[iDriveIndex] ) + { + err = iRFs.Drive( info , iDriveIndex ); + if ( info.iConnectionBusType == EConnectionBusUsb && + info.iDriveAtt & KDriveAttExternal && + err == KErrNone ) + { + LOGTEXT(_L("CMsmmDismountUsbDrives::DoDismount Dismount notify request ")); + iRFs.NotifyDismount( iDriveIndex, iStatus, EFsDismountNotifyClients ); + iDismountTimer->StartTimer(); + SetActive(); + return; + } + } + } + // Indicates we have gone through all the drives and no more usb drives left to request dismount + CompleteDismountRequest( KErrNone ); + } + + +/** + * Callback function from CDismountTimer after 6 seconds indicating a usb drive is not released by another process, report it as an error + */ +void CMsmmDismountUsbDrives::TimerExpired() + { + LOG_FUNC + + Cancel(); + iDismountTimer->CancelTimer(); + CompleteDismountRequest( KErrInUse ); + } + +//CDismountTimer + +CDismountTimer* CDismountTimer::NewL( MTimerNotifier* aTimeOutNotify) + { + LOG_STATIC_FUNC_ENTRY + CDismountTimer* self = CDismountTimer::NewLC( aTimeOutNotify ); + CleanupStack::Pop(self); + return self; + } + +CDismountTimer* CDismountTimer::NewLC( MTimerNotifier* aTimeOutNotify ) + { + LOG_STATIC_FUNC_ENTRY + CDismountTimer* self = new (ELeave) CDismountTimer( aTimeOutNotify ); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +CDismountTimer::CDismountTimer( MTimerNotifier* aTimeOutNotify): + CTimer(EPriorityStandard), + iNotify(aTimeOutNotify) + { + LOG_FUNC + } + +CDismountTimer::~CDismountTimer() + { + LOG_FUNC + Cancel(); + } + +void CDismountTimer::ConstructL() + { + LOG_FUNC + if ( !iNotify ) + { + User::Leave(KErrArgument); + } + CTimer::ConstructL(); + CActiveScheduler::Add(this); + } + +void CDismountTimer::RunL() + { + LOG_FUNC + // Timer request has completed, so notify the timer's owner + iNotify->TimerExpired(); + } +void CDismountTimer::CancelTimer() + { + LOG_FUNC + Cancel(); + } + +void CDismountTimer::StartTimer() + { + LOG_FUNC + After( KDismountTimeOut ); + } +// End of File diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/msmmserver.cpp --- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/msmmserver.cpp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/msmmserver.cpp Thu Jul 22 16:49:39 2010 +0100 @@ -21,13 +21,14 @@ */ #include "msmmserver.h" -#include #include "msmm_internal_def.h" #include "msmmsession.h" #include "msmmengine.h" #include "eventqueue.h" #include "msmmterminator.h" +#include "msmmdismountusbdrives.h" +#include #include #ifdef __FLOG_ACTIVE @@ -97,6 +98,26 @@ CleanupStack::PopAndDestroy(2, scheduler); } +CPolicyServer::TCustomResult CMsmmServer::CustomSecurityCheckL( + const RMessage2& aMsg, + TInt& /*aAction*/, + TSecurityInfo& /*aMissing*/) + { + CPolicyServer::TCustomResult returnValue = CPolicyServer::EFail; + + TSecureId ClientSID = aMsg.SecureId(); + + if (KFDFWSecureId == ClientSID) + { + returnValue = CPolicyServer::EPass; + } + else if ((KSidHbDeviceDialogAppServer == ClientSID) && SessionNumber() > 0) + { + returnValue = CPolicyServer::EPass; + } + return returnValue; + } + // Public functions // Construction and destruction CMsmmServer* CMsmmServer::NewLC() @@ -119,6 +140,8 @@ delete iEventQueue; delete iEngine; delete iTerminator; + delete iDismountErrData; + delete iDismountManager; REComSession::FinalClose(); #ifndef __OVER_DUMMYCOMPONENT__ @@ -136,7 +159,7 @@ if (KMaxClientCount <= SessionNumber()) { // There is a connection to MSMM server already. - // Currently design of MSMM allows only one activated client + // Currently design of MSMM can have two clients, one FDF and the other Indicator UI // at any time. User::Leave(KErrInUse); } @@ -188,6 +211,26 @@ } } +void CMsmmServer::DismountUsbDrivesL(TUSBMSDeviceDescription& aDevice) + { + LOG_FUNC + delete iDismountManager; + iDismountManager = NULL; + iDismountManager= CMsmmDismountUsbDrives::NewL(); + + //Also notify the MSMM plugin of beginning of dismounting + iDismountErrData->iError = EHostMsEjectInProgress; + iDismountErrData->iE32Error = KErrNone; + iDismountErrData->iManufacturerString = aDevice.iManufacturerString; + iDismountErrData->iProductString = aDevice.iProductString; + iDismountErrData->iDriveName = 0x0; + + TRAP_IGNORE(iPolicyPlugin->SendErrorNotificationL(*iDismountErrData)); + + // Start dismounting + iDismountManager->DismountUsbDrives(*iPolicyPlugin, aDevice); + } + // Private functions // CMsmmServer Construction CMsmmServer::CMsmmServer(TInt aPriority) @@ -205,6 +248,7 @@ iEventQueue = CDeviceEventQueue::NewL(*this); iTerminator = CMsmmTerminator::NewL(*iEventQueue); iPolicyPlugin = CMsmmPolicyPluginBase::NewL(); + iDismountErrData = new (ELeave) THostMsErrData; if (!iPolicyPlugin) { // Not any policy plugin implementation available diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/msmmsession.cpp --- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/msmmsession.cpp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/msmmsession.cpp Thu Jul 22 16:49:39 2010 +0100 @@ -24,9 +24,9 @@ #include "msmmserver.h" #include "msmmengine.h" #include "eventqueue.h" +#include "msmmnodebase.h" #include #include -#include "msmmnodebase.h" #include #ifdef __FLOG_ACTIVE @@ -92,7 +92,10 @@ delete heapObj; #endif // _DEBUG break; - + + case EHostMsmmServerEjectUsbDrives: + iServer.DismountUsbDrivesL(iDevicePkg()); + break; default: // Unsupported function number - panic the client PanicClient(aMessage, EBadRequest); diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/usbman/chargingplugin/src/idpinwatcher.cpp --- a/usbmgmt/usbmgr/usbman/chargingplugin/src/idpinwatcher.cpp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/usbman/chargingplugin/src/idpinwatcher.cpp Thu Jul 22 16:49:39 2010 +0100 @@ -48,7 +48,13 @@ void CIdPinWatcher::ConstructL() { - User::LeaveIfError(iIdPinProp.Attach(KUidUsbManCategory, KUsbOtgIdPinPresentProperty)); +#ifdef __CHARGING_PLUGIN_TEST_CODE__ + const TInt8 KPropertyOffsetForChargingTest = 100; + User::LeaveIfError(iIdPinProp.Attach(KUidUsbManCategory, KUsbOtgIdPinPresentProperty + KPropertyOffsetForChargingTest)); +#else + User::LeaveIfError(iIdPinProp.Attach(KUidUsbManCategory, KUsbOtgIdPinPresentProperty)); +#endif + iIdPinProp.Subscribe(iStatus); SetActive(); diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/usbman/chargingplugin/src/otgstatewatcher.cpp --- a/usbmgmt/usbmgr/usbman/chargingplugin/src/otgstatewatcher.cpp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/usbman/chargingplugin/src/otgstatewatcher.cpp Thu Jul 22 16:49:39 2010 +0100 @@ -48,7 +48,13 @@ void COtgStateWatcher::ConstructL() { - User::LeaveIfError(iOtgStateProp.Attach(KUidUsbManCategory, KUsbOtgStateProperty)); +#ifdef __CHARGING_PLUGIN_TEST_CODE__ + const TInt8 KPropertyOffsetForChargingTest = 100; + User::LeaveIfError(iOtgStateProp.Attach(KUidUsbManCategory, KUsbOtgStateProperty + KPropertyOffsetForChargingTest)); +#else + User::LeaveIfError(iOtgStateProp.Attach(KUidUsbManCategory, KUsbOtgStateProperty)); +#endif + iOtgStateProp.Subscribe(iStatus); SetActive(); diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/usbman/chargingplugin/src/vbuswatcher.cpp --- a/usbmgmt/usbmgr/usbman/chargingplugin/src/vbuswatcher.cpp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/usbman/chargingplugin/src/vbuswatcher.cpp Thu Jul 22 16:49:39 2010 +0100 @@ -48,7 +48,13 @@ void CVBusWatcher::ConstructL() { - User::LeaveIfError(iVBusProp.Attach(KUidUsbManCategory, KUsbOtgVBusPoweredProperty)); +#ifdef __CHARGING_PLUGIN_TEST_CODE__ + const TInt8 KPropertyOffsetForChargingTest = 100; + User::LeaveIfError(iVBusProp.Attach(KUidUsbManCategory, KUsbOtgVBusPoweredProperty + KPropertyOffsetForChargingTest)); +#else + User::LeaveIfError(iVBusProp.Attach(KUidUsbManCategory, KUsbOtgVBusPoweredProperty)); +#endif + iVBusProp.Subscribe(iStatus); SetActive(); diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/usbman/client/SRC/RUsb.cpp --- a/usbmgmt/usbmgr/usbman/client/SRC/RUsb.cpp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/usbman/client/SRC/RUsb.cpp Thu Jul 22 16:49:39 2010 +0100 @@ -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 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/usbman/server/INC/CPersonality.h --- a/usbmgmt/usbmgr/usbman/server/INC/CPersonality.h Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/usbman/server/INC/CPersonality.h Thu Jul 22 16:49:39 2010 +0100 @@ -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 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/usbman/server/INC/CPersonality.inl --- a/usbmgmt/usbmgr/usbman/server/INC/CPersonality.inl Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/usbman/server/INC/CPersonality.inl Thu Jul 22 16:49:39 2010 +0100 @@ -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 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/usbman/server/INC/CUsbDevice.h --- a/usbmgmt/usbmgr/usbman/server/INC/CUsbDevice.h Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/usbman/server/INC/CUsbDevice.h Thu Jul 22 16:49:39 2010 +0100 @@ -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 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/usbman/server/INC/CUsbSession.h --- a/usbmgmt/usbmgr/usbman/server/INC/CUsbSession.h Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/usbman/server/INC/CUsbSession.h Thu Jul 22 16:49:39 2010 +0100 @@ -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 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/usbman/server/INC/UsbSettings.h --- a/usbmgmt/usbmgr/usbman/server/INC/UsbSettings.h Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/usbman/server/INC/UsbSettings.h Thu Jul 22 16:49:39 2010 +0100 @@ -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 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/usbman/server/INC/UsbmanServerSecurityPolicy.h --- a/usbmgmt/usbmgr/usbman/server/INC/UsbmanServerSecurityPolicy.h Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/usbman/server/INC/UsbmanServerSecurityPolicy.h Thu Jul 22 16:49:39 2010 +0100 @@ -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 59d8e4a44a15 -r c7df333992fa 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 Thu Jul 22 16:49:39 2010 +0100 @@ -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 59d8e4a44a15 -r c7df333992fa 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 Thu Jul 22 16:49:39 2010 +0100 @@ -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 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/usbman/server/SRC/CPersonality.cpp --- a/usbmgmt/usbmgr/usbman/server/SRC/CPersonality.cpp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/usbman/server/SRC/CPersonality.cpp Thu Jul 22 16:49:39 2010 +0100 @@ -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 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/usbman/server/SRC/CUsbDevice.cpp --- a/usbmgmt/usbmgr/usbman/server/SRC/CUsbDevice.cpp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/usbman/server/SRC/CUsbDevice.cpp Thu Jul 22 16:49:39 2010 +0100 @@ -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(); @@ -118,6 +122,7 @@ // the observers themselves. iObservers.Reset(); +#ifndef __OVER_DUMMYUSBDI__ #ifndef __WINS__ LOGTEXT2(_L8("about to delete device state watcher @ %08x"), (TUint32) iDeviceStateWatcher); delete iDeviceStateWatcher; @@ -133,6 +138,7 @@ { LOGTEXT2(_L8(" User::FreeLogicalDevice returned %d"),err); } +#endif #endif delete iDefaultSerialNumber; @@ -163,7 +169,11 @@ iEcom = &(REComSession::OpenL()); iUsbClassControllerIterator = new(ELeave) CUsbClassControllerIterator(iSupportedClasses); + iCenRepManager = CUsbManCenRepManager::NewL(*this); + 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); @@ -229,6 +239,7 @@ LOGTEXT(_L8("UsbDevice::ConstructL() finished")); #endif +#endif #ifndef __OVER_DUMMYUSBDI__ InstantiateExtensionPluginsL(); @@ -491,6 +502,7 @@ if (iDeviceState != state) { +#ifndef __OVER_DUMMYUSBDI__ #ifndef __WINS__ if (iDeviceState == EUsbDeviceStateUndefined && iUdcSupportsCableDetectWhenUnpowered && @@ -502,7 +514,8 @@ // it up (so long as usbman is fully started). (void)PowerUpAndConnect(); // We don't care about any errors here. } -#endif // __WINS__ +#endif +#endif // __OVER_DUMMYUSBDI__ // Change state straight away in case any of the clients check it TUsbDeviceState oldState = iDeviceState; iDeviceState = state; @@ -610,6 +623,7 @@ case EUsbServiceStarting: if (iUsbClassControllerIterator->Next() == KErrNotFound) { +#ifndef __OVER_DUMMYUSBDI__ #ifndef __WINS__ if (!iUdcSupportsCableDetectWhenUnpowered || iDeviceState != EUsbDeviceStateUndefined) { @@ -623,6 +637,7 @@ (void)PowerUpAndConnect(); } #endif +#endif // If we're not running on target, we can just go to "started". SetServiceState(EUsbServiceStarted); } @@ -636,6 +651,7 @@ if (iUsbClassControllerIterator->Previous() == KErrNotFound) { // if stopping classes, hide the USB interface from the host +#ifndef __OVER_DUMMYUSBDI__ #ifndef __WINS__ iLdd.DeviceDisconnectFromHost(); @@ -650,7 +666,8 @@ TInt res = iLdd.RemoveSerialNumberStringDescriptor(); LOGTEXT2(_L8("Remove serial number res = %d"), res); } - + +#endif #endif SetServiceState(EUsbServiceIdle); } @@ -777,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); @@ -793,7 +810,7 @@ { LOG_FUNC -#ifndef __WINS__ +#if !defined(__OVER_DUMMYUSBDI__) && !defined(__WINS__) TInt desSize = 0; iLdd.GetDeviceDescriptorSize(desSize); @@ -821,7 +838,7 @@ TUsbDeviceDescriptor descriptor; TUsbDeviceDescriptor* deviceDescriptor = &descriptor; -#endif // __WINS__ +#endif // __OVER_DUMMYUSBDI__ && _WINS_ if (iPersonalityCfged) { @@ -829,9 +846,11 @@ } else { - SetUsbDeviceSettingsL(*deviceDescriptor); + LOGTEXT(_L8("USB configuration is not read")); + LEAVEL(KErrNotFound); } +#ifndef __OVER_DUMMYUSBDI__ #ifndef __WINS__ ret = iLdd.SetDeviceDescriptor(devicePtr); @@ -843,7 +862,8 @@ CleanupStack::PopAndDestroy(deviceBuf); -#endif // __WINS__ +#endif +#endif // __OVER_DUMMYUSBDI__ } void CUsbDevice::SetUsbDeviceSettingsDefaultsL(CUsbDevice::TUsbDeviceDescriptor& aDeviceDescriptor) @@ -858,134 +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 __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 // __WINS__ - -#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 __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 // __WINS__ - - - CleanupStack::PopAndDestroy(4, &fs); // deviceInfo, id, resource, fs + aDeviceDescriptor.iProductId = KUsbDefaultProductId; } void CUsbDevice::SetUsbDeviceSettingsFromPersonalityL(CUsbDevice::TUsbDeviceDescriptor& aDeviceDescriptor) @@ -1002,19 +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; @@ -1036,12 +929,15 @@ LOGTEXT(_L8("SerialNumber has not been published")); } #endif // __FLOG_ACTIVE -#endif // __WINS__ + +#endif +#endif // __OVER_DUMMYUSBDI__ #ifdef __FLOG_ACTIVE PrintDescriptor(aDeviceDescriptor); +#ifndef __OVER_DUMMYUSBDI__ #ifndef __WINS__ TBuf16 wideString; TBuf8 narrowString; @@ -1049,7 +945,8 @@ LEAVEIFERRORL(iLdd.GetConfigurationStringDescriptor(wideString)); narrowString.Copy(wideString); LOGTEXT2(_L8("Configuration is: '%S'"), &narrowString); -#endif // __WINS__ +#endif +#endif // __OVER_DUMMYUSBDI__ #endif // __FLOG_ACTIVE } @@ -1148,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; } @@ -1181,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) ); @@ -1205,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() /** @@ -1420,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*/) @@ -1466,7 +1199,6 @@ TInt smallestId = iSupportedPersonalities[0]->PersonalityId(); TInt count = iSupportedPersonalities.Count(); - for (TInt i = 1; i < count; i++) { if(iSupportedPersonalities[i]->PersonalityId() < smallestId) @@ -1474,7 +1206,7 @@ smallestId = iSupportedPersonalities[i]->PersonalityId(); } } - + SetCurrentPersonalityL(smallestId); SelectClassControllersL(); } @@ -1493,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 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/usbman/server/SRC/CUsbSession.cpp --- a/usbmgmt/usbmgr/usbman/server/SRC/CUsbSession.cpp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/usbman/server/SRC/CUsbSession.cpp Thu Jul 22 16:49:39 2010 +0100 @@ -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 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/usbman/server/SRC/usbman.rls --- a/usbmgmt/usbmgr/usbman/server/SRC/usbman.rls Fri Jun 11 16:29:16 2010 +0100 +++ /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 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/usbman/server/SRC/usbman.rss --- a/usbmgmt/usbmgr/usbman/server/SRC/usbman.rss Fri Jun 11 16:29:16 2010 +0100 +++ /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 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/usbman/server/SRC/usbman_01.rls --- a/usbmgmt/usbmgr/usbman/server/SRC/usbman_01.rls Fri Jun 11 16:29:16 2010 +0100 +++ /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 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/usbman/server/SRC/usbman_02.rls --- a/usbmgmt/usbmgr/usbman/server/SRC/usbman_02.rls Fri Jun 11 16:29:16 2010 +0100 +++ /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 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/usbman/server/SRC/usbman_03.rls --- a/usbmgmt/usbmgr/usbman/server/SRC/usbman_03.rls Fri Jun 11 16:29:16 2010 +0100 +++ /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 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/usbman/server/SRC/usbman_10.rls --- a/usbmgmt/usbmgr/usbman/server/SRC/usbman_10.rls Fri Jun 11 16:29:16 2010 +0100 +++ /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 59d8e4a44a15 -r c7df333992fa 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 Thu Jul 22 16:49:39 2010 +0100 @@ -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 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/usbman/server/SRC/usbmanlubbockobex.rss --- a/usbmgmt/usbmgr/usbman/server/SRC/usbmanlubbockobex.rss Fri Jun 11 16:29:16 2010 +0100 +++ /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 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/usbman/server/SRC/usbmanmtp.rss --- a/usbmgmt/usbmgr/usbman/server/SRC/usbmanmtp.rss Fri Jun 11 16:29:16 2010 +0100 +++ /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 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/usbman/server/SRC/usbmanmtprndis.rss --- a/usbmgmt/usbmgr/usbman/server/SRC/usbmanmtprndis.rss Fri Jun 11 16:29:16 2010 +0100 +++ /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 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/usbman/server/SRC/usbmanrndis.rss --- a/usbmgmt/usbmgr/usbman/server/SRC/usbmanrndis.rss Fri Jun 11 16:29:16 2010 +0100 +++ /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 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/usbman/server/conf/usbmanager_101fe1db.crml Binary file usbmgmt/usbmgr/usbman/server/conf/usbmanager_101fe1db.crml has changed diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/usbman/server/data/demo_mcci_usbman.rh --- a/usbmgmt/usbmgr/usbman/server/data/demo_mcci_usbman.rh Fri Jun 11 16:29:16 2010 +0100 +++ /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 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/usbman/server/group/BLD.INF --- a/usbmgmt/usbmgr/usbman/server/group/BLD.INF Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/usbman/server/group/BLD.INF Thu Jul 22 16:49:39 2010 +0100 @@ -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 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/usbman/server/group/usbsvrbase.mmp --- a/usbmgmt/usbmgr/usbman/server/group/usbsvrbase.mmp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/usbman/server/group/usbsvrbase.mmp Thu Jul 22 16:49:39 2010 +0100 @@ -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 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/usbman/server/public/rusb.h --- a/usbmgmt/usbmgr/usbman/server/public/rusb.h Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgr/usbman/server/public/rusb.h Thu Jul 22 16:49:39 2010 +0100 @@ -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" @@ -35,7 +35,11 @@ const TInt KUsbMaxSupportedPersonalities = 64; // Max number of supported personalities +#ifndef __OVER_DUMMYUSBDI__ _LIT(KUsbServerName, "!usbman"); +#else +_LIT(KUsbServerName, "!usbman_over_dummyusbdi"); +#endif enum TUsbMessages { @@ -81,7 +85,6 @@ EUsbGetOtgDescriptor, EUsbDbgAlloc, EUsbRequestSession, - EUsbGetDetailedDescription, EUsbGetPersonalityProperty }; diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgr/usbman/server/public/usbman.rh --- a/usbmgmt/usbmgr/usbman/server/public/usbman.rh Fri Jun 11 16:29:16 2010 +0100 +++ /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 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgrtest/ObexClassController/test/src/simpleObexApp.cpp --- a/usbmgmt/usbmgrtest/ObexClassController/test/src/simpleObexApp.cpp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgrtest/ObexClassController/test/src/simpleObexApp.cpp Thu Jul 22 16:49:39 2010 +0100 @@ -455,33 +455,33 @@ CleanupStack::PushL(myScheduler); CActiveScheduler::Install(myScheduler); - CConsoleBase* aConsole = + CConsoleBase* console = Console::NewL(_L("Obex Program"),TSize(KConsFullScreen, KConsFullScreen)); // Load Device drivers TInt err; // Start C32 now - aConsole->Printf(_L("Loading C32...\n")); + console->Printf(_L("Loading C32...\n")); err=StartC32(); if (err!=KErrNone && err!=KErrAlreadyExists) - aConsole->Printf(_L(" Failed %d\n"), err); + console->Printf(_L(" Failed %d\n"), err); else - aConsole->Printf(_L(" Sucess\n")); + console->Printf(_L(" Sucess\n")); // If running on PC emulator // Load drivers for using Serial communication #ifdef __WINS__ TInt load = User::LoadLogicalDevice(KWinsLddName); - aConsole->Printf(_L("Load LDD : %d\n"), load); + console->Printf(_L("Load LDD : %d\n"), load); load = User::LoadPhysicalDevice(KWinsPddName); - aConsole->Printf(_L("Load PDD : %d\n"), load); + console->Printf(_L("Load PDD : %d\n"), load); #endif //__WINS__ - CleanupStack::PushL(aConsole); - CActiveConsole* my_console = CActiveConsole::NewLC(aConsole);// New active console + CleanupStack::PushL(console); + CActiveConsole* my_console = CActiveConsole::NewLC(console);// New active console my_console->RequestCharacter(); CActiveScheduler::Start(); CleanupStack::PopAndDestroy(3); diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgrtest/ObexClassController/test/src/simpleObexClient.cpp --- a/usbmgmt/usbmgrtest/ObexClassController/test/src/simpleObexClient.cpp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgrtest/ObexClassController/test/src/simpleObexClient.cpp Thu Jul 22 16:49:39 2010 +0100 @@ -119,16 +119,16 @@ // Create file session and create a new private path on drive C RFs fileSession; - fileSession.Connect(); + User::LeaveIfError(fileSession.Connect()); - fileSession.CreatePrivatePath(EDriveC); - fileSession.SetSessionToPrivate(EDriveC); - fileSession.SessionPath(iSessionPath); + User::LeaveIfError(fileSession.CreatePrivatePath(EDriveC)); + User::LeaveIfError(fileSession.SetSessionToPrivate(EDriveC)); + User::LeaveIfError(fileSession.SessionPath(iSessionPath)); // Copy the files from oby file ro the newly created path - BaflUtils::CopyFile(fileSession, KFilePath1, KFilename1,0); - BaflUtils::CopyFile(fileSession, KFilePath2, KFilename2,0); - BaflUtils::CopyFile(fileSession, KFilePath3, KFilename3,0); + User::LeaveIfError(BaflUtils::CopyFile(fileSession, KFilePath1, KFilename1,0)); + User::LeaveIfError(BaflUtils::CopyFile(fileSession, KFilePath2, KFilename2,0)); + User::LeaveIfError(BaflUtils::CopyFile(fileSession, KFilePath3, KFilename3,0)); fileSession.Close(); diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgrtest/ObexClassController/test/src/simpleObexServer.cpp --- a/usbmgmt/usbmgrtest/ObexClassController/test/src/simpleObexServer.cpp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgrtest/ObexClassController/test/src/simpleObexServer.cpp Thu Jul 22 16:49:39 2010 +0100 @@ -63,7 +63,7 @@ { // Start bluetooth socket and set security RSocketServ socketServ; - socketServ.Connect(); + User::LeaveIfError(socketServ.Connect()); RSocket listen; TInt test = listen.Open(socketServ, KRFCOMMDesC); @@ -129,6 +129,7 @@ // Update attribute iSdpdb.UpdateAttributeL(ftphandle, KProtocolDescriptorListUUID, *iProtDescList); // put into both records delete iProtDescList; + iProtDescList = NULL; User::LeaveIfError(listen.Bind(addr)); diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgrtest/csy/t_ecacm/src/t_csyaccess.cpp --- a/usbmgmt/usbmgrtest/csy/t_ecacm/src/t_csyaccess.cpp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgrtest/csy/t_ecacm/src/t_csyaccess.cpp Thu Jul 22 16:49:39 2010 +0100 @@ -24,12 +24,10 @@ #ifndef __WINS__ _LIT(KCommDriverName, "EUSBC"); -//_LIT(KCommDeviceName, "USBC"); #else _LIT(KCommPhysDriverName, "ECDRV"); _LIT(KCommPhysDeviceName, "Comm.Wins"); _LIT(KCommDriverName, "ECOMM"); -//_LIT(KCommDeviceName, "Comm"); #endif LOCAL_D RTest gTest(_L("T_CSYACCESS")); @@ -467,21 +465,6 @@ if ( !err ) { gTest.Printf(_L("\tsuccessful result from RComm::Open\n")); - - /* TCommServerConfigV01 serverConfig; - TCommServerConfig serverConfigBuf(serverConfig); - comm.Mode(serverConfigBuf); - - const TUint KBufSize = 0x1000; - serverConfig.iBufSize = KBufSize; - - err = comm.SetMode(serverConfig); - if ( !err ) - { - gTest.Printf(_L("\tsuccessful result from RComm::SetMode\n")); - // End of use case. - } - */ comm.Close(); } } @@ -751,7 +734,10 @@ TInt error = KErrNone; RCommServ sess; - sess.Connect(); + gTest.Next(_L("Connecting to Comm Server")); + r = sess.Connect(); + gTest(r == KErrNone); + sess.__DbgMarkHeap(); switch (key ) @@ -830,7 +816,9 @@ void RunAll() { RCommServ sess; - sess.Connect(); + gTest.Next(_L("Connecting to Comm Server")); + TInt r = sess.Connect(); + gTest(r == KErrNone); for ( TInt ii = 0 ; ii < 9 ; ii++ ) // TODO: keep 9 up-to-date with number of tests. { diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgrtest/t_acm/src/t_acm.cpp --- a/usbmgmt/usbmgrtest/t_acm/src/t_acm.cpp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgrtest/t_acm/src/t_acm.cpp Thu Jul 22 16:49:39 2010 +0100 @@ -34,7 +34,6 @@ const TInt KReceiveBufferLength = 4096; const TInt KMaxAcmPortNameLength = 8; -//_LIT(KUsbCsyName, "ECACM"); _LIT(KUsbPortName, "ACM::0"); _LIT(KUsbPortNameAcm1, "ACM::1"); @@ -943,8 +942,6 @@ _printf(_L("Writing data\n")); for (timeout = 10; timeout<100; timeout++) { -// FillBuffer(readBuf); - port.Write(status, readBuf); // Wait before cancelling @@ -1774,19 +1771,7 @@ _printf(_L("a. Event notification, flow control (test 2.8.2)\n")); _printf(_L("b. Event notification, config change (test 2.8.3)\n")); _printf(_L("c. Second client (test 2.9)\n")); -/* _printf(_L("d. ACM request, encapsulated command (test 2.10.1)\n")); - _printf(_L("e. ACM request, break (test 2.10.2)\n")); - _printf(_L("f. ACM request, setting feature (test 2.10.3)\n")); - _printf(_L("g. ACM request, clearing feature (test 2.10.4)\n")); - _printf(_L("h. ACM request, setting line coding (test 2.10.5)\n")); - _printf(_L("i. ACM request, control line state (test 2.10.6)\n")); - _printf(_L("j. ACM request, encapsualted response (test 2.10.7)\n")); - _printf(_L("k. ACM request, comms feature (test 2.10.8)\n")); - _printf(_L("l. ACM request, getting line coding (test 2.10.9)\n")); - _printf(_L("m. ACM Notifications, send serial state (test 2.11.1)\n")); - _printf(_L("n. ACM Notifications, network status (test 2.11.2)\n")); - _printf(_L("o. ACM Notifications, response available (test 2.11.3)\n")); -*/ _printf(_L("p. Loopback test (test 2.12)\n")); + _printf(_L("p. Loopback test (test 2.12)\n")); _printf(_L("q. Main menu\n")); ch = (char) _getch(); diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgrtest/t_acm_cc/src/t_acm_cc.cpp --- a/usbmgmt/usbmgrtest/t_acm_cc/src/t_acm_cc.cpp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgrtest/t_acm_cc/src/t_acm_cc.cpp Thu Jul 22 16:49:39 2010 +0100 @@ -119,17 +119,6 @@ current_test_state = EUSBManConnected; break; case EUSBManConnected: - // Register as primary client. - // *** Obsolete *** - /* - r = usbman->RegisterAsPrimarySession(); - if (r != KErrNone) - { - test.Printf(_L(" Failed to register as primary client. Error = %d\n"), r); - return r; - } - test.Printf(_L(" Registered as primary client.\n")); - */ current_test_state = EPrimaryRegistered; break; default: @@ -162,8 +151,6 @@ current_test_state = EPrimaryRegistered; break; case EPrimaryRegistered: - // *** Obsolete *** - // usbman->DeregisterAsPrimarySession(); current_test_state = EUSBManConnected; break; case EUSBManConnected: @@ -240,44 +227,6 @@ } /** - * Executes test B2 (as detailed in the USB Manager Test Specification). - * No longer a relevant test. - */ -/*static TInt RunTest_B2() - { - TInt r; - - test.Next(_L("Test B2.\n")); - - // Perform common startup - current_test_state = EStart; - r = CommonStart(); - if (r != KErrNone) - return r; - - // Start the USB Manager - TRequestStatus status; - test.Printf(_L("Starting.\n")); - usbman->Start(status); - - // Wait for specific time (has to be less than the time to process a start request) - timer.After(status, CANCEL_START_REQ_DELAY); - User::WaitForRequest(status); - - // Cancel the start request - test.Printf(_L("Cancelling.\n")); - usbman->StartCancel(); - - // Check service status - test.Printf(_L("Checking service status.\n")); - r = CheckServiceState(EUsbServiceIdle); - if ( r != KErrNone) - return r; - - return KErrNone; - } -*/ -/** * Executes test B3 (as detailed in the USB Manager Test Specification). */ static TInt RunTest_B3() @@ -314,47 +263,6 @@ } /** - * Executes test B4 (as detailed in the USB Manager Test Specification). - * No longer a relevant test. - */ -/*static TInt RunTest_B4() - { - TInt r; - - test.Next(_L("Test B4.\n")); - - // Perform common startup - current_test_state = EStart; - r = CommonStart(); - if (r != KErrNone) - return r; - - // Start the USB Manager - TRequestStatus status, timerStatus; - usbman->Start(status); - User::WaitForRequest(status); - test.Printf(_L("Start completed with status %d\n"), status.Int()); - current_test_state = EUSBManStarted; - - // Stop the USB Manager - usbman->Stop(status); - - // Wait for specific time (has to be less than the time to process a start request) - timer.After(timerStatus, CANCEL_STOP_REQ_DELAY); - User::WaitForRequest(status, timerStatus); - - // Cancel the stop request - usbman->StopCancel(); - - // Check service status - r = CheckServiceState(EUsbServiceStarted); - if ( r != KErrNone) - return r; - - return KErrNone; - } -*/ -/** * Executes test B5 (as detailed in the USB Manager Test Specification). */ static TInt RunTest_B5() @@ -507,16 +415,6 @@ test.Printf(_L("Test B1 passed.\n\n")); CommonCleanup(); -/* Depreciated test. - err=RunTest_B2(); - if (err != KErrNone) - { - test.Printf(_L("Test B2 failed, code: %d\n\n"), err); - } - else - test.Printf(_L("Test B2 passed.\n\n")); - CommonCleanup(); -*/ err=RunTest_B3(); if (err != KErrNone) { @@ -526,16 +424,6 @@ test.Printf(_L("Test B3 passed.\n\n")); CommonCleanup(); -/* Depreciated test. - err=RunTest_B4(); - if (err != KErrNone) - { - test.Printf(_L("Test B4 failed, code: %d\n\n"), err); - } - else - test.Printf(_L("Test B4 passed.\n\n")); - CommonCleanup(); -*/ err=RunTest_B5(); if (err != KErrNone) { diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgrtest/t_acm_pub_sub/src/t_acm_pub_sub.cpp --- a/usbmgmt/usbmgrtest/t_acm_pub_sub/src/t_acm_pub_sub.cpp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgrtest/t_acm_pub_sub/src/t_acm_pub_sub.cpp Thu Jul 22 16:49:39 2010 +0100 @@ -344,7 +344,7 @@ } //Connect to the file server - gFs.Connect(); + User::LeaveIfError(gFs.Connect()); TInt result = KErrNone; TRAPD(error, result = TestCase1L()); if(error) diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgrtest/t_acm_spec/src/t_acm_spec.cpp --- a/usbmgmt/usbmgrtest/t_acm_spec/src/t_acm_spec.cpp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgrtest/t_acm_spec/src/t_acm_spec.cpp Thu Jul 22 16:49:39 2010 +0100 @@ -35,7 +35,6 @@ const TInt KReceiveBufferLength = 8192; -//_LIT(KUsbCsyName, "ECACM"); _LIT(KUsbPortName, "ACM::0"); _LIT(KUsbLddName, "EUSBC"); @@ -421,8 +420,6 @@ _printf(_L("Writing data\n")); for (timeout = 10; timeout<100; timeout++) { -// FillBuffer(readBuf); - port.Write(status, readBuf); // Wait before cancelling @@ -527,7 +524,6 @@ if (status != KErrNone) // Error code ? TODO { - //LEAVE(status.Int()); _printf(_L("Read failed\n")); } @@ -985,7 +981,6 @@ break; } -// _printf(_L("Read %d bytes\n"), readBuf.Length()); port.Write(status, readBuf); User::WaitForRequest(status, consoleStatus); @@ -1135,14 +1130,6 @@ port.SetConfig(TheConfigBuf); -// _printf(_L("----------------------------------------\n")); -// _printf(_L("Initial port config:\n")); -// _printf(_L(" Rate: %d bps\n"), TheConfig.iRate); -// _printf(_L(" Data bits: %d. Parity type: %d. Stop bits: %d\n"), -// TheConfig.iStopBits, TheConfig.iParity, TheConfig.iStopBits); -// _printf(_L(" Handshaking options: 0x%X\n"), TheConfig.iHandshake); -// _printf(_L("----------------------------------------\n\n")); - CleanupStack::PopAndDestroy(); // port TBool noExit = ETrue; @@ -1185,19 +1172,7 @@ _printf(_L("a. Event notification, flow control (test 2.8.2)\n")); _printf(_L("b. Event notification, config change (test 2.8.3)\n")); _printf(_L("c. Second client (test 2.9)\n")); -/* _printf(_L("d. ACM request, encapsulated command (test 2.10.1)\n")); - _printf(_L("e. ACM request, break (test 2.10.2)\n")); - _printf(_L("f. ACM request, setting feature (test 2.10.3)\n")); - _printf(_L("g. ACM request, clearing feature (test 2.10.4)\n")); - _printf(_L("h. ACM request, setting line coding (test 2.10.5)\n")); - _printf(_L("i. ACM request, control line state (test 2.10.6)\n")); - _printf(_L("j. ACM request, encapsualted response (test 2.10.7)\n")); - _printf(_L("k. ACM request, comms feature (test 2.10.8)\n")); - _printf(_L("l. ACM request, getting line coding (test 2.10.9)\n")); - _printf(_L("m. ACM Notifications, send serial state (test 2.11.1)\n")); - _printf(_L("n. ACM Notifications, network status (test 2.11.2)\n")); - _printf(_L("o. ACM Notifications, response available (test 2.11.3)\n")); -*/ _printf(_L("p. Loopback test (test 2.12)\n")); + _printf(_L("p. Loopback test (test 2.12)\n")); _printf(_L("q. Main menu\n")); ch = (char) _getch(); diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgrtest/t_acm_wins/src/t_acm_wins.cpp --- a/usbmgmt/usbmgrtest/t_acm_wins/src/t_acm_wins.cpp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgrtest/t_acm_wins/src/t_acm_wins.cpp Thu Jul 22 16:49:39 2010 +0100 @@ -758,7 +758,6 @@ memset(writeBufbig, i, MAX_BUFFER_SIZE); // fill the write buffer with known data _printf(_L("%d: "), (TInt)i); WriteData(writeBufbig, 64); - //FlushFileBuffers(hSerial); ReadData(readBufbig, 64); for (int j=0; j<64; j++) { @@ -806,19 +805,7 @@ _printf(_L("a. Event notification, flow control (test 2.8.2)\n")); _printf(_L("b. Event notification, config change (test 2.8.3)\n")); _printf(_L("c. Second client (test 2.9)\n")); -/* _printf(_L("d. ACM request, encapsulated command (test 2.10.1)\n")); - _printf(_L("e. ACM request, break (test 2.10.2)\n")); - _printf(_L("f. ACM request, setting feature (test 2.10.3)\n")); - _printf(_L("g. ACM request, clearing feature (test 2.10.4)\n")); - _printf(_L("h. ACM request, setting line coding (test 2.10.5)\n")); - _printf(_L("i. ACM request, control line state (test 2.10.6)\n")); - _printf(_L("j. ACM request, encapsualted response (test 2.10.7)\n")); - _printf(_L("k. ACM request, comms feature (test 2.10.8)\n")); - _printf(_L("l. ACM request, getting line coding (test 2.10.9)\n")); - _printf(_L("m. ACM Notifications, send serial state (test 2.11.1)\n")); - _printf(_L("n. ACM Notifications, network status (test 2.11.2)\n")); - _printf(_L("o. ACM Notifications, response available (test 2.11.3)\n")); -*/ _printf(_L("p. Loopback test (test 2.12)\n")); + _printf(_L("p. Loopback test (test 2.12)\n")); _printf(_L("\n")); _printf(_L("\nSelection (x to exit): ")); diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgrtest/t_catc/src/t_catc.cpp --- a/usbmgmt/usbmgrtest/t_catc/src/t_catc.cpp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgrtest/t_catc/src/t_catc.cpp Thu Jul 22 16:49:39 2010 +0100 @@ -37,12 +37,10 @@ TCommConfigV01& TheConfig = TheConfigBuf(); const TInt KReceiveBufferLength = 65536/*16384*/; // TODO: speed enhancement! -//const TInt KMaxBufferSize = 8192; // TODO: speed enhancement! const TUint KChunkSize = 65536; //////////////////////////////////////////////////////////////////////////////// -//_LIT(KUsbCsyName, "ECACM"); _LIT(KUsbPortName, "ACM::0"); _LIT(KUsbLddName, "EUSBC"); @@ -137,7 +135,6 @@ TRequestStatus status; RComm port; -// static TBuf8<1024> OUT_Buf; // TODO: speed enhancement! static TBuf8 OUT_Buf; _printf(_L("\n")); @@ -162,7 +159,6 @@ console->Read(consoleStatus); TInt uReadCount = 0 ; - //TInt uThermoBar = 0 ; // TODO: speed enhancement! (remove ThermoBar fnality) _printf(_L("\tWatch : ")); @@ -216,25 +212,6 @@ } uReadCount += OUT_Buf.Length() ; - -/* if( uReadCount >= 1024 ) - { - // uThermoBar runs from 0..63 - - uThermoBar = ( uThermoBar + 1 ) & 0x3F ; - - if( uThermoBar < 32 ) - { - _printf(_L("*")); - } - else - { - _printf(_L("\b \b")); - } - - uReadCount -= 1024 ; - } - */ } else { @@ -270,7 +247,6 @@ TRequestStatus status; RComm port; -//#define uInBufSize 4096 // TODO: speed enhancement! reduce number of IPC calls #define uInBufSize 65536 static TBuf8 IN_Buf; @@ -337,7 +313,6 @@ TInt bNeedZLP = bUseZLP && ((IN_Buf.Length()%64)==0); TInt uWriteCount = 0 ; -// TInt uThermoBar = 0 ; // TODO: speed enhancement! _printf(_L("\tWatch : ")); @@ -378,24 +353,6 @@ // reassure watcher that there is something happening... -/* while( uWriteCount >= 1024 ) - { - // uThermoBar runs from 0..63 - - uThermoBar = ( uThermoBar + 1 ) & 0x3F ; - - if( uThermoBar < 32 ) - { - _printf(_L("*")); - } - else - { - _printf(_L("\b \b")); - } - - uWriteCount -= 1024 ; - } - */ } else { @@ -498,49 +455,7 @@ _printf(_L("Restarted USB.\n")); } -//////////////////////////////////////////////////////////////////////////////// -/*void ThermoBar() - { - TUint uCol = 0 ; - - TTime now; - - TDateTime WasDT; - TDateTime NowDT; - - now.HomeTime(); - WasDT = now.DateTime(); - - for( TUint line = 0 ; line < 30 ; ) - { - for( TUint dotO = 0 ; dotO < 1000 ; dotO++ ) - { - for( TUint dotI = 0 ; dotI < 1000 ; dotI++ ) - { - ; - } - } - - _printf(_L("*")); - - now.HomeTime(); - NowDT = now.DateTime(); - - if( ( ++uCol >= 79 ) || ( WasDT.Second() != NowDT.Second() ) ) - { - _printf(_L("\n")); - - uCol = 0 ; - - line++ ; - - WasDT = now.DateTime() ; - } - } - } -*/ -//////////////////////////////////////////////////////////////////////////////// void ToggleTermL() { @@ -659,7 +574,6 @@ _printf(_L("2. Bulk IN test \n")); _printf(_L("3. Set handshaking \n")); _printf(_L("4. Restart USB \n")); -// _printf(_L("5. Run ThermoBar \n")); _printf(_L("6. Swap Read Method \n")); _printf(_L("7. Swap ZLP Method \n")); _printf(_L("8. Swap Term Method \n")); @@ -675,7 +589,6 @@ case '2': Bulk_IN_TestL(); break; case '3': SetHandshakingL(); break; case '4': RestartUsbL(); break; -// case '5': ThermoBar(); break; case '6': bReadCall = ( bReadCall == EFalse ) ; break; case '7': bUseZLP = ( bUseZLP == EFalse ) ; break; case '8': ToggleTermL() ; break; diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgrtest/t_charging_emu/inc/dummyldd.h --- a/usbmgmt/usbmgrtest/t_charging_emu/inc/dummyldd.h Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgrtest/t_charging_emu/inc/dummyldd.h Thu Jul 22 16:49:39 2010 +0100 @@ -42,7 +42,7 @@ inline TInt RDevUsbcClient::GetConfigurationDescriptor(TDes8& aConfigurationDescriptor) { // 8th byte is bMaxPower - aConfigurationDescriptor.Copy(iConfigDesc);//[8] = iConfigDesc[8]; + aConfigurationDescriptor.Copy(iConfigDesc); return KErrNone; } diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgrtest/t_charging_emu/inc/tbatterycharging.h --- a/usbmgmt/usbmgrtest/t_charging_emu/inc/tbatterycharging.h Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgrtest/t_charging_emu/inc/tbatterycharging.h Thu Jul 22 16:49:39 2010 +0100 @@ -120,7 +120,6 @@ RTest iTest; RTimer iTimer; - //CRepository* iRepository; TPtr8 iPtr; // data file TPtr8 iLine; // current line diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgrtest/t_charging_emu/inc/tpropertybatterycharging.h --- a/usbmgmt/usbmgrtest/t_charging_emu/inc/tpropertybatterycharging.h Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgrtest/t_charging_emu/inc/tpropertybatterycharging.h Thu Jul 22 16:49:39 2010 +0100 @@ -56,9 +56,7 @@ CActivePropertyReadChargingCurrent* iActiveReadChargingCurrent; CRepository* iRepository; - //RProperty iPropertyWrittenToRepositoryAck; - //RProperty iPropertyReadChargingCurrentAck; RProperty iProperty; // only one protected needed ? - }; \ No newline at end of file + }; diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgrtest/t_charging_emu/src/1020DEA7.rss --- a/usbmgmt/usbmgrtest/t_charging_emu/src/1020DEA7.rss Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgrtest/t_charging_emu/src/1020DEA7.rss Thu Jul 22 16:49:39 2010 +0100 @@ -29,7 +29,7 @@ { INTERFACE_INFO { - interface_uid = 0x10208DD6; + interface_uid = 0xE0208DD6; implementations = { IMPLEMENTATION_INFO diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgrtest/t_charging_emu/src/tbatterycharging.cpp --- a/usbmgmt/usbmgrtest/t_charging_emu/src/tbatterycharging.cpp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgrtest/t_charging_emu/src/tbatterycharging.cpp Thu Jul 22 16:49:39 2010 +0100 @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgrtest/t_multi_acm/src/t_multiple_acm.cpp --- a/usbmgmt/usbmgrtest/t_multi_acm/src/t_multiple_acm.cpp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgrtest/t_multi_acm/src/t_multiple_acm.cpp Thu Jul 22 16:49:39 2010 +0100 @@ -33,7 +33,6 @@ const TInt KReceiveBufferLength = 4096; const TInt KMaxAcmPortNameLength = 8; -//_LIT(KUsbCsyName, "ECACM"); _LIT(KUsbPortName, "ACM::0"); _LIT(KUsbPortNameAcm1, "ACM::1"); diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgrtest/t_termusb/src/t_termusb.cpp --- a/usbmgmt/usbmgrtest/t_termusb/src/t_termusb.cpp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgrtest/t_termusb/src/t_termusb.cpp Thu Jul 22 16:49:39 2010 +0100 @@ -205,11 +205,6 @@ aBuf.Append(_L("DSR/DTR ")); if (aConfig.iHandshake&KConfigWriteBufferedComplete) aBuf.Append(_L("Early ")); - //|KConfigObeyDCD|KConfigFailDCD|)) - - -// if (aConfig.iBreak==TEiger::EBreakOn) -// aBuf.Append(_L("Brk ")); if (aConfig.iFifo==EFifoEnable) aBuf.Append(_L("Fifo ")); @@ -223,10 +218,6 @@ aBuf.Append(_L("LpBk")); else if ((aSettings.iRxMode&~ECapture)==ECountChars) aBuf.Append(_L("CtCh")); - //else if (aSettings.iRxMode==ERxOff) - //{ - //aBuf.Append(_L("NoRx")); - //} aBuf.Append(_L(" ")); aBuf.AppendNum((TInt)(RThread().Priority())); if (aSettings.iInfraRed==1) @@ -357,23 +348,6 @@ aWait=ETrue; } -/*LOCAL_C void GetBreak(const TDesC &aDes) - { - - if (aDes==_L("")) - { - if (data.iBreak==TEiger::EBreakOn) - data.iBreak=TEiger::EBreakOff; - else - data.iBreak=TEiger::EBreakOn; - } - if (aDes.FindF(_L("N"))>=0) - data.iBreak=TEiger::EBreakOn; - if (aDes.FindF(_L("F"))>=0) - data.iBreak=TEiger::EBreakOff; - SetConfig(); - } -*/ LOCAL_C void GetFifo(TUint& aFifo, const TDesC &aDes) { @@ -468,8 +442,6 @@ TPtrC s(&a,1); dialog.Write(s); aSettings.iDumpData.Append(k.Code()); - //if (a=='\r') - // dialog.Write(_L("\n")); } while (aSettings.iDumpData.Length()=0) - data.iBreak=TEiger::EBreakOn; - if (aDes.FindF(_L("F"))>=0) - data.iBreak=TEiger::EBreakOff; - SetConfig(); - } -*/ LOCAL_C void GetFifo(TUint& aFifo, const TDesC &aDes) { @@ -466,8 +440,6 @@ TPtrC s(&a,1); dialog.Write(s); aSettings.iDumpData.Append(k.Code()); - //if (a=='\r') - // dialog.Write(_L("\n")); } while (aSettings.iDumpData.Length() cmd; - User::CommandLine(cmd); - TInt port=0; - if ((cmd.Length()>0) && (cmd[0]>='1' && cmd[0]<='4')) - port=(TInt)(cmd[0]-'0'); -*/ // Load Device Drivers TInt r; @@ -761,7 +720,7 @@ RDebug::Print(_L("E32Main: Open USB Comm Port")); TheCommPort.Config(TheConfigBuf); // get config - TheConfig.iHandshake=0; //KConfigObeyXoff|KConfigSendXoff; + TheConfig.iHandshake=0; TheConfig.iTerminator[0] = 'Z'; TheConfig.iTerminatorCount = 1; TheCommPort.SetConfig(TheConfigBuf); diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgrtest/t_usb_cable_detect/src/t_usb_cable_detect.cpp --- a/usbmgmt/usbmgrtest/t_usb_cable_detect/src/t_usb_cable_detect.cpp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgrtest/t_usb_cable_detect/src/t_usb_cable_detect.cpp Thu Jul 22 16:49:39 2010 +0100 @@ -136,7 +136,7 @@ TUsbServiceState serviceState; User::LeaveIfError(iUsbMan.GetServiceState(serviceState)); -// RDebug::Print(_L("Service state: %d. Device state: %d"), serviceState, iDeviceState); + if ((serviceState != EUsbServiceIdle) && (iDeviceState == EUsbDeviceStateUndefined)) diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgrtest/t_usbman/src/t_usbman.cpp --- a/usbmgmt/usbmgrtest/t_usbman/src/t_usbman.cpp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgrtest/t_usbman/src/t_usbman.cpp Thu Jul 22 16:49:39 2010 +0100 @@ -41,8 +41,6 @@ RUsb TheSecondUsbSession; TBool ThePrimaryClient; -//_LIT(KUsbCsyName, "ECACM"); -//_LIT(KUsbPortName, "ACM::0"); _LIT(KUsbLddName, "EUSBC"); // These are used in the startup stress test. @@ -656,19 +654,7 @@ TheSecondUsbSession.Close(); } -/* -void RegisterAsPrimaryClientL() - { - LEAVEIFERROR(TheUsb.RegisterAsPrimarySession()); - ThePrimaryClient = ETrue; - } -void DeregisterAsPrimaryClientL() - { - LEAVEIFERROR(TheUsb.DeregisterAsPrimarySession()); - ThePrimaryClient = EFalse; - } -*/ void DbgCheckHeapL() { _printf(_L("Expected number of allocated heap cells: ")); @@ -1050,9 +1036,7 @@ case '5': SetUsbSerialNumberL(); break; case 's': case 'S': SanityTestL(); break; #ifndef HURRICANE -/* case 'r': RegisterAsPrimaryClientL(); break; - case 'd': DeregisterAsPrimaryClientL(); break; -*/ case 'm': MemoryTestsL(); break; + case 'm': MemoryTestsL(); break; #endif // HURRICANE case 'c': case 'C': CloseUsbL(); break; case 'o': case 'O': OpenUsbL(); break; @@ -1105,9 +1089,7 @@ _printf(_L("5. Publish Serial Number\n")); _printf(_L("S. Sanity test- quickly calls all APIs to make sure they don't panic\n")); #ifndef HURRICANE -/* _printf(_L("R. Register as primary client\n")); - _printf(_L("D. Deregister as primary client\n")); -*/ _printf(_L("M. Memory tests\n")); + _printf(_L("M. Memory tests\n")); #endif // HURRICANE _printf(_L("C. Close connection to USB Manager\n")); _printf(_L("O. Connect to USB Manager\n")); diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgrtest/t_usbmanager_suite/Stub1CC/inc/Stub1CC.h --- a/usbmgmt/usbmgrtest/t_usbmanager_suite/Stub1CC/inc/Stub1CC.h Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgrtest/t_usbmanager_suite/Stub1CC/inc/Stub1CC.h Thu Jul 22 16:49:39 2010 +0100 @@ -40,12 +40,7 @@ const TInt Kstub1NumberOfInterfacesPerstub1Function = 2; // data and control interfaces -// The name of the ini file specifying the number of functions required different from default -/* -_LIT(Kstub1FunctionsIniFileName, "NumberOfstub1Functions.ini"); -_LIT(Kstub1ConfigSection,"stub1_CONF"); -_LIT(KNumberOfstub1FunctionsKeyWord,"NumberOfstub1Functions"); -*/ + // Lengths of the various bits of the descriptor. Taken from the USB // WMCDC specification, v1.0. const TInt Kstub1InterfaceDescriptorLength = 3; diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgrtest/t_usbmanager_suite/Stub2CC/inc/Stub2CC.h --- a/usbmgmt/usbmgrtest/t_usbmanager_suite/Stub2CC/inc/Stub2CC.h Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgrtest/t_usbmanager_suite/Stub2CC/inc/Stub2CC.h Thu Jul 22 16:49:39 2010 +0100 @@ -40,12 +40,7 @@ const TInt Kstub2NumberOfInterfacesPerstub2Function = 2; // data and control interfaces -// The name of the ini file specifying the number of functions required different from default -/* -_LIT(Kstub2FunctionsIniFileName, "NumberOfstub2Functions.ini"); -_LIT(Kstub2ConfigSection,"stub2_CONF"); -_LIT(KNumberOfstub2FunctionsKeyWord,"NumberOfstub2Functions"); -*/ + // Lengths of the various bits of the descriptor. Taken from the USB // WMCDC specification, v1.0. const TInt Kstub2InterfaceDescriptorLength = 3; diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgrtest/t_usbmanager_suite/Stub3CC/inc/Stub3CC.h --- a/usbmgmt/usbmgrtest/t_usbmanager_suite/Stub3CC/inc/Stub3CC.h Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgrtest/t_usbmanager_suite/Stub3CC/inc/Stub3CC.h Thu Jul 22 16:49:39 2010 +0100 @@ -40,12 +40,7 @@ const TInt Kstub3NumberOfInterfacesPerstub3Function = 2; // data and control interfaces -// The name of the ini file specifying the number of functions required different from default -/* -_LIT(Kstub3FunctionsIniFileName, "NumberOfstub3Functions.ini"); -_LIT(Kstub3ConfigSection,"stub3_CONF"); -_LIT(KNumberOfstub3FunctionsKeyWord,"NumberOfstub3Functions"); -*/ + // Lengths of the various bits of the descriptor. Taken from the USB // WMCDC specification, v1.0. const TInt Kstub3InterfaceDescriptorLength = 3; diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgrtest/t_usbmanager_suite/T_UsbManager/src/CUsbComponentTest.cpp --- a/usbmgmt/usbmgrtest/t_usbmanager_suite/T_UsbManager/src/CUsbComponentTest.cpp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgrtest/t_usbmanager_suite/T_UsbManager/src/CUsbComponentTest.cpp Thu Jul 22 16:49:39 2010 +0100 @@ -403,7 +403,6 @@ INFO_PRINTF1(_L("Can't get class id from config file")); SetTestStepResult(EFail); } -// TUid temp = uidArray[k]; TEST(uidArray[k] ==TUid::Uid(classID)); } diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgrtest/t_usbmanager_suite/T_UsbManager/src/T_UsbManagerServer.cpp --- a/usbmgmt/usbmgrtest/t_usbmanager_suite/T_UsbManager/src/T_UsbManagerServer.cpp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgrtest/t_usbmanager_suite/T_UsbManager/src/T_UsbManagerServer.cpp Thu Jul 22 16:49:39 2010 +0100 @@ -53,7 +53,6 @@ // Server Logging. server->StartL(KServerName); - //server-> ConstructL(KServerName); CleanupStack::Pop(server); return server; } diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgrtest/t_usbmodem/inc/t_usbmodem.h --- a/usbmgmt/usbmgrtest/t_usbmodem/inc/t_usbmodem.h Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgrtest/t_usbmodem/inc/t_usbmodem.h Thu Jul 22 16:49:39 2010 +0100 @@ -146,7 +146,7 @@ RComm* iCommPort; }; -class CDuplex : public MTransferNotifier, CBase +class CDuplex : public CBase, MTransferNotifier { public: // Construction diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgrtest/t_usbmodem/src/t_usbmodem.cpp --- a/usbmgmt/usbmgrtest/t_usbmodem/src/t_usbmodem.cpp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgrtest/t_usbmodem/src/t_usbmodem.cpp Thu Jul 22 16:49:39 2010 +0100 @@ -46,7 +46,6 @@ RDebug::Print(_L(": CSimplexRead::StartL Warning - Already active\n")); return; } - //iBuffer.SetMax(); iCommPort->ReadOneOrMore(iStatus, iBuffer); SetActive(); } @@ -56,8 +55,6 @@ #ifdef _DEBUG RDebug::Print(_L(": CSimplexRead::RunL - iStatus:%d iBuffer.Length:%d TotalAmount Left:%d\n"),iStatus.Int(),iBuffer.Length(),iTotalAmount); #endif - //RDebug::Print(_L(">%S<\n"),&iBuffer); - //Notify Duplex object iDuplex.NotifyRead(iStatus.Int(),iBuffer.Length(), iBuffer); } @@ -342,7 +339,6 @@ RDebug::Print(_L(": Serial RTS on")); #endif TheSerialPort.SetSignals( KSignalRTS, 0 ); - //TheUsbPort.SetSignals( KSignalCTS, 0 ); } else { @@ -350,7 +346,6 @@ RDebug::Print(_L(": Serial RTS off")); #endif TheSerialPort.SetSignals( 0, KSignalRTS ); - //TheUsbPort.SetSignals( 0, KSignalCTS ); } } @@ -362,7 +357,6 @@ RDebug::Print(_L(": Serial DTR on")); #endif TheSerialPort.SetSignals( KSignalDTR, 0 ); - //TheUsbPort.SetSignals( KSignalDSR, 0 ); } else { @@ -370,7 +364,6 @@ RDebug::Print(_L(": Serial DTR off")); #endif TheSerialPort.SetSignals( 0, KSignalDTR ); - //TheUsbPort.SetSignals( 0, KSignalDSR ); } } @@ -534,7 +527,6 @@ iUsbConfigChangeNotifier->Cancel(); iSerialSignalChangeNotifier->Cancel(); iUsbSignalChangeNotifier->Cancel(); - //iUsbFControlNotifier->Cancel(); iUsbToSerial->Cancel(); iSerialToUsb->Cancel(); @@ -571,7 +563,6 @@ iSerialSignalChangeNotifier = CSignalChangeNotifier::NewL(EFalse); iUsbSignalChangeNotifier = CSignalChangeNotifier::NewL(ETrue); -// iUsbFControlNotifier = CFControlChangeNotifier::NewL(); iUsbConfigChangeNotifier = CConfigChangeNotifier::NewL(); } @@ -590,7 +581,6 @@ TRAP(ignoreErr, iUsbConfigChangeNotifier->StartL()); TRAP(ignoreErr, iSerialSignalChangeNotifier->StartL()); TRAP(ignoreErr, iUsbSignalChangeNotifier->StartL()); -// iUsbFControlNotifier->StartL(); TRAP(ignoreErr, iUsbToSerial->StartL()); TRAP(ignoreErr, iSerialToUsb->StartL()); @@ -701,107 +691,6 @@ } } -/* -LOCAL_C TInt RateToInt(TBps aRate) - { - switch (aRate) - { - case EBps115200: return 115200; - case EBps57600: return 57600; - case EBps38400: return 38400; - case EBps19200: return 19200; - case EBps9600: return 9600; - case EBps7200: return 7200; - case EBps4800: return 4800; - case EBps3600: return 3600; - case EBps2400: return 2400; - case EBps2000: return 2000; - case EBps1800: return 1800; - case EBps1200: return 1200; - case EBps600: return 600; - case EBps300: return 300; - case EBps150: return 150; - case EBps134: return 134; - case EBps110: return 110; - case EBps75: return 75; - case EBps50: return 50; - default: return -1; - } - } - -LOCAL_C void ConfigString(TDes &aBuf, const TCommNotificationV01 &aConfig) - { - // Config - aBuf.Format(_L(" %d "), RateToInt(aConfig.iRate)); - switch (aConfig.iParity) - { - case EParityEven: aBuf.Append(_L("E")); break; - case EParityOdd: aBuf.Append(_L("O")); break; - case EParityNone: aBuf.Append(_L("N")); break; - default: break; - } - switch (aConfig.iDataBits) - { - case EData5: aBuf.Append(_L("5")); break; - case EData6: aBuf.Append(_L("6")); break; - case EData7: aBuf.Append(_L("7")); break; - case EData8: aBuf.Append(_L("8")); break; - default: break; - } - if (aConfig.iStopBits==EStop1) - aBuf.Append(_L("1 ")); - else - aBuf.Append(_L("2 ")); - - aBuf.Append(_L("Use:")); - if (aConfig.iHandshake==0) - aBuf.Append(_L("NoControl ")); - if (aConfig.iHandshake&(KConfigObeyXoff|KConfigSendXoff)) - aBuf.Append(_L("XonXoff ")); - if (aConfig.iHandshake&KConfigObeyCTS) - aBuf.Append(_L("CTS/RTS ")); - if (aConfig.iHandshake&KConfigObeyDSR) - aBuf.Append(_L("DSR/DTR ")); - if (aConfig.iHandshake&KConfigWriteBufferedComplete) - aBuf.Append(_L("Early ")); - //|KConfigObeyDCD|KConfigFailDCD|)) - -// if (aConfig.iBreak==TEiger::EBreakOn) -// aBuf.Append(_L("Brk ")); -// if (aConfig.iFifo==EFifoEnable) -// aBuf.Append(_L("Fifo ")); - } - -LOCAL_C void PrintCaps() - { - TCommCaps2 caps; - TheUsbPort.Caps(caps); - TUint notifycaps = caps().iNotificationCaps; - RDebug::Print(_L("Capabilities:\n")); - if (notifycaps&KNotifySignalsChangeSupported) - RDebug::Print(_L("Notify Signals Change supported\n")); - if (notifycaps&KNotifyRateChangeSupported) - RDebug::Print(_L("Notify Rate Change supported\n")); - if (notifycaps&KNotifyDataFormatChangeSupported) - RDebug::Print(_L("Notify Data Format Change supported\n")); - if (notifycaps&KNotifyHandshakeChangeSupported) - RDebug::Print(_L("Notify Handshake Change supported\n")); - if (notifycaps&KNotifyBreakSupported) - RDebug::Print(_L("Notify Break supported\n")); - if (notifycaps&KNotifyFlowControlChangeSupported) - RDebug::Print(_L("Notify Flow Control Change supported\n")); - if (notifycaps&KNotifyDataAvailableSupported) - RDebug::Print(_L("Notify Data Available supported\n")); - if (notifycaps&KNotifyOutputEmptySupported) - RDebug::Print(_L("Notify Output Empty supported\n")); - RDebug::Print(_L("\n")); - if ((caps().iRoleCaps)&KCapsRoleSwitchSupported) - RDebug::Print(_L("Role switching is supported\n")); - RDebug::Print(_L("\n")); - if ((caps().iFlowControlCaps)&KCapsFlowControlStatusSupported) - RDebug::Print(_L("Retrieve flow control status is supported\n")); - } -*/ LOCAL_C void DoInitL() { // Do the necessary initialisation of the C32, 2 comm ports, USB stuff. @@ -901,8 +790,6 @@ } RDebug::Print(_L("E32Main: Opened Serial Comm Port")); - // Print the caps - //PrintCaps(); RDebug::Print(_L("E32Main: Reading Serial Comm Port config")); TheSerialPort.Config(TheSerialConfigBuf); // get config @@ -911,12 +798,10 @@ TBuf<80> buf; buf.FillZ(); - //ConfigString(buf, TheUsbConfig); RDebug::Print(_L("E32Main: Old USB Port Settings")); RDebug::Print(buf); RDebug::Print(_L("")); buf.FillZ(); - //ConfigString(buf, TheSerialConfig); RDebug::Print(_L("E32Main: Old Serial Port Settings")); RDebug::Print(buf); RDebug::Print(_L("")); diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgrtest/t_whcm_cc/src/t_whcm_cc.cpp --- a/usbmgmt/usbmgrtest/t_whcm_cc/src/t_whcm_cc.cpp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgrtest/t_whcm_cc/src/t_whcm_cc.cpp Thu Jul 22 16:49:39 2010 +0100 @@ -117,17 +117,6 @@ current_test_state = EUSBManConnected; break; case EUSBManConnected: - // Register as primary client. - // *** Obsolete *** - /* - r = usbman->RegisterAsPrimarySession(); - if (r != KErrNone) - { - test.Printf(_L(" Failed to register as primary client. Error = %d\n"), r); - return r; - } - test.Printf(_L(" Registered as primary client.\n")); - */ current_test_state = EPrimaryRegistered; break; default: @@ -160,8 +149,6 @@ current_test_state = EPrimaryRegistered; break; case EPrimaryRegistered: - // *** Obsolete *** - // usbman->DeregisterAsPrimarySession(); current_test_state = EUSBManConnected; break; case EUSBManConnected: @@ -237,45 +224,6 @@ return KErrNone; } - -/** - * Executes test A2 (as detailed in the USB Manager Test Specification). - * No longer a relevant test. - */ -/*static TInt RunTest_A2() - { - TInt r; - - test.Next(_L("Test A2.\n")); - - // Perform common startup - current_test_state = EStart; - r = CommonStart(); - if (r != KErrNone) - return r; - - // Start the USB Manager - TRequestStatus status; - test.Printf(_L("Starting.\n")); - usbman->Start(status); - - // Wait for specific time (has to be less than the time to process a start request) - timer.After(status, CANCEL_START_REQ_DELAY); - User::WaitForRequest(status); - - // Cancel the start request - test.Printf(_L("Cancelling.\n")); - usbman->StartCancel(); - - // Check service status - test.Printf(_L("Checking service status.\n")); - r = CheckServiceState(EUsbServiceIdle); - if ( r != KErrNone) - return r; - - return KErrNone; - } -*/ /** * Executes test A3 (as detailed in the USB Manager Test Specification). */ @@ -313,47 +261,6 @@ } /** - * Executes test A4 (as detailed in the USB Manager Test Specification). - * No longer a relevant test. - */ -/*static TInt RunTest_A4() - { - TInt r; - - test.Next(_L("Test A4.\n")); - - // Perform common startup - current_test_state = EStart; - r = CommonStart(); - if (r != KErrNone) - return r; - - // Start the USB Manager - TRequestStatus status, timerStatus; - usbman->Start(status); - User::WaitForRequest(status); - test.Printf(_L("Start completed with status %d\n"), status.Int()); - current_test_state = EUSBManStarted; - - // Stop the USB Manager - usbman->Stop(status); - - // Wait for specific time (has to be less than the time to process a start request) - timer.After(timerStatus, CANCEL_STOP_REQ_DELAY); - User::WaitForRequest(status, timerStatus); - - // Cancel the stop request - usbman->StopCancel(); - - // Check service status - r = CheckServiceState(EUsbServiceStarted); - if ( r != KErrNone) - return r; - - return KErrNone; - } -*/ -/** * Main function. * * Runs all the tests in order. @@ -373,16 +280,6 @@ test.Printf(_L("Test A1 passed.\n\n")); CommonCleanup(); -/* Depreciated test. - err=RunTest_A2(); - if (err != KErrNone) - { - test.Printf(_L("Test A2 failed, code: %d\n\n"), err); - } - else - test.Printf(_L("Test A2 passed.\n\n")); - CommonCleanup(); -*/ err=RunTest_A3(); if (err != KErrNone) { @@ -392,16 +289,7 @@ test.Printf(_L("Test A3 passed.\n\n")); CommonCleanup(); -/* Depreciated test. - err=RunTest_A4(); - if (err != KErrNone) - { - test.Printf(_L("Test A4 failed, code: %d\n\n"), err); - } - else - test.Printf(_L("Test A4 passed.\n\n")); - CommonCleanup(); -*/ + // Tests finished } diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgrtest/usbmsapp/usbms_stub/inc/usbms_stub.h --- a/usbmgmt/usbmgrtest/usbmsapp/usbms_stub/inc/usbms_stub.h Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgrtest/usbmsapp/usbms_stub/inc/usbms_stub.h Thu Jul 22 16:49:39 2010 +0100 @@ -40,12 +40,7 @@ const TInt Kstub3NumberOfInterfacesPerstub3Function = 2; // data and control interfaces -// The name of the ini file specifying the number of functions required different from default -/* -_LIT(Kstub3FunctionsIniFileName, "NumberOfstub3Functions.ini"); -_LIT(Kstub3ConfigSection,"stub3_CONF"); -_LIT(KNumberOfstub3FunctionsKeyWord,"NumberOfstub3Functions"); -*/ + // Lengths of the various bits of the descriptor. Taken from the USB // WMCDC specification, v1.0. const TInt Kstub3InterfaceDescriptorLength = 3; diff -r 59d8e4a44a15 -r c7df333992fa usbmgmt/usbmgrtest/usbmsapp/usbms_stub/src/usbms_stub.cpp --- a/usbmgmt/usbmgrtest/usbmsapp/usbms_stub/src/usbms_stub.cpp Fri Jun 11 16:29:16 2010 +0100 +++ b/usbmgmt/usbmgrtest/usbmsapp/usbms_stub/src/usbms_stub.cpp Thu Jul 22 16:49:39 2010 +0100 @@ -80,11 +80,6 @@ Cancel(); iTimer.Close(); - -#ifndef __WINS__ -// iLdd.Close(); -#endif - } @@ -255,7 +250,7 @@ * endpoint and, if found, configuring the interface. */ { -return 0; + return 0; }