Revision: 201033 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 31 Aug 2010 17:01:47 +0300
branchRCL_3
changeset 15 f92a4f87e424
parent 14 d3e8e7d462dd
child 16 012cc2ee6408
Revision: 201033 Kit: 201035
layers.sysdef.xml
package_definition.xml
package_map.xml
usb_plat/group/bld.inf
usb_plat/group/usb_plat.mrp
usb_plat/usb_shai_api/group/bld.inf
usb_plat/usb_shai_api/inc/usb_charger_detection_shai.h
usb_plat/usb_shai_api/inc/usb_common_shai.h
usb_plat/usb_shai_api/inc/usb_host_shai.h
usb_plat/usb_shai_api/inc/usb_otg_shai.h
usb_plat/usb_shai_api/inc/usb_peripheral_shai.h
usb_plat/usb_shai_api/inc/usb_peripheral_shai.inl
usb_plat/usb_shai_api/inc/usb_peripheral_shai_shared.h
usbdrv/peripheral/ldd/perildd/group/base_e32_drivers_usbcli.mrp
usbdrv/peripheral/ldd/perildd/group/bld.inf
usbdrv/peripheral/ldd/perildd/group/usbc.mmp
usbdrv/peripheral/ldd/perildd/src/d_usbc.cpp
usbdrv/peripheral/ldd/perildd/src/usbdma.cpp
usbdrv/peripheral/ldd/perilddsc/appifwrapper/eabi/usbcscu.def
usbdrv/peripheral/ldd/perilddsc/appifwrapper/group/bld.inf
usbdrv/peripheral/ldd/perilddsc/appifwrapper/group/usbcsc_bil.mmp
usbdrv/peripheral/ldd/perilddsc/appifwrapper/src/usbcsc_bil.cpp
usbdrv/peripheral/ldd/perilddsc/group/bld.inf
usbdrv/peripheral/ldd/perilddsc/group/usbcsc.mmp
usbdrv/peripheral/ldd/perilddsc/src/d_usbcsc.cpp
usbdrv/peripheral/pdd/pil/eabi/usbperipheralpilu.def
usbdrv/peripheral/pdd/pil/group/bld.inf
usbdrv/peripheral/pdd/pil/group/usbperipheralpil.mmp
usbdrv/peripheral/pdd/pil/src/chapter9.cpp
usbdrv/peripheral/pdd/pil/src/controltransfersm.cpp
usbdrv/peripheral/pdd/pil/src/descriptors.cpp
usbdrv/peripheral/pdd/pil/src/misc.cpp
usbdrv/peripheral/pdd/pil/src/ps_usbc.cpp
usbdrv/peripheral/pdd/pil/src/queue.cpp
usbdrv/peripheral/public/d32usbc.h
usbdrv/peripheral/public/d32usbc.inl
usbdrv/peripheral/public/d32usbcsc.h
usbdrv/peripheral/public/d32usbcsc.inl
usbdrv/peripheral/public/d32usbcshared.h
usbdrv/peripheral/public/d32usbcshared.inl
usbdrv/peripheral/public/d32usbdescriptors.h
usbdrv/peripheral/public/d32usbtransfers.h
usbdrv/peripheral/public/usb.h
usbdrv/peripheral/public/usbc.h
usbdrv/peripheral/public/usbc.inl
usbdrv/peripheral/public/usbcdesc.h
usbdrv/peripheral/public/usbcontrolxferif.h
usbdrv/peripheral/public/usbcque.h
usbdrv/peripheral/public/usbcsc.h
usbdrv/peripheral/public/usbcsc.inl
usbdrv/peripheral/public/usbcshared.h
usbdrv/peripheral/public/usbcshared.inl
usbdrv/peripheral/public/usbotgperipheralcontrolif.h
usbmgmt/usbmgr/conf/usbmanager.confml
usbmgmt/usbmgr/device/classcontroller/SRC/CUsbClassControllerIterator.cpp
usbmgmt/usbmgr/device/classcontroller/SRC/CUsbClassControllerPlugIn.cpp
usbmgmt/usbmgr/device/classcontroller/group/UsbClassController.mmp
usbmgmt/usbmgr/device/classcontroller/traces/OstTraceDefinitions.h
usbmgmt/usbmgr/device/classcontroller/traces/fixed_id.definitions
usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/SRC/CUsbACMClassController.cpp
usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/SRC/CUsbAcmClassImpCollection.cpp
usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/group/AcmClassController.mmp
usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/group/AcmClassControllerBase.mmp
usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/group/t_regport_AcmClassController.mmp
usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/group/usbacmconfiguration.hby
usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/traces/OstTraceDefinitions.h
usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/traces/fixed_id.definitions
usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/acmserver/group/acmserver.mmp
usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/acmserver/src/acmserver.cpp
usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/acmserver/src/acmserverclient.cpp
usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/acmserver/src/acmserverimpl.cpp
usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/acmserver/traces/OstTraceDefinitions.h
usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/acmserver/traces/fixed_id.definitions
usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/group/ECACM.MMP
usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/AcmPort.cpp
usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/AcmPortFactory.cpp
usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/AcmReader.cpp
usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/AcmWriter.cpp
usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/ActiveDataAvailableNotifier.cpp
usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/ActiveReadOneOrMoreReader.cpp
usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/ActiveReader.cpp
usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/ActiveWriter.cpp
usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/BreakController.cpp
usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/CdcAcmClass.cpp
usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/CdcControlInterface.cpp
usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/CdcControlInterfaceReader.cpp
usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/CdcDataInterface.cpp
usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/CdcInterfaceBase.cpp
usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/ClassDescriptor.cpp
usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/DllMain.cpp
usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/RegistrationPort.cpp
usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/RequestHeader.cpp
usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/acmserver.cpp
usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/acmsession.cpp
usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/linkstatenotifier.cpp
usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/traces/OstTraceDefinitions.h
usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/traces/fixed_id.definitions
usbmgmt/usbmgr/device/classdrivers/bld.inf
usbmgmt/usbmgr/device/classdrivers/ms/classcontroller/group/msclasscontroller.mmp
usbmgmt/usbmgr/device/classdrivers/ms/classcontroller/src/CUsbMsClassController.cpp
usbmgmt/usbmgr/device/classdrivers/ms/classcontroller/src/CUsbMsClassImpCollection.cpp
usbmgmt/usbmgr/device/classdrivers/ms/classcontroller/src/usbms.rss
usbmgmt/usbmgr/device/classdrivers/ms/classcontroller/traces/OstTraceDefinitions.h
usbmgmt/usbmgr/device/classdrivers/ms/classcontroller/traces/fixed_id.definitions
usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/group/bld.inf
usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/group/ncmcc_over_dummy_stubs.mmp
usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/group/ncmclasscontroller.mmp
usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/group/ncmclasscontroller_base.mmp
usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/group/usbncm.iby
usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/group/usbncmconfiguration.hby
usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/inc/ncmclasscontroller.h
usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/inc/ncmclassdescriptor.h
usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/inc/ncmclientmanager.h
usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/inc/ncmconnectionmanager.h
usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/inc/ncmconnectionmanagerhelper.h
usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/inc/ncmconnectionmanagerobserver.h
usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/inc/ncmdhcpnotifobserver.h
usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/inc/ncmdhcpnotifwatcher.h
usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/inc/ncmiapconnectionobserver.h
usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/inc/ncmiapprogressstateobserver.h
usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/inc/ncmiapprogresswatcher.h
usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/inc/ncmiapreader.h
usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/inc/ncmiapreaderobserver.h
usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/src/2002bcfd.rss
usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/src/ncmcc_over_dummy.rss
usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/src/ncmclasscontroller.cpp
usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/src/ncmclassdescriptor.cpp
usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/src/ncmclassimpcollection.cpp
usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/src/ncmclientmanager.cpp
usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/src/ncmconnectionmanager.cpp
usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/src/ncmconnectionmanagerhelper.cpp
usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/src/ncmdhcpnotifwatcher.cpp
usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/src/ncmiapprogresswatcher.cpp
usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/src/ncmiapreader.cpp
usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/traces/OstTraceDefinitions.h
usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/traces/fixed_id.definitions
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/group/bld.inf
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/client/bwins/ncminternalsrvu.def
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/client/eabi/ncminternalsrvu.def
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/client/group/bld.inf
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/client/group/ncminternalsrv.mmp
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/group/bld.inf
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/eabi/ncmpktu.def
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/group/bld.inf
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/group/pktdrv.mmp
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/group/pktdrv_overdummyusbldd.mmp
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmbuffermanager.h
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmcoexistbearerwatcher.h
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmcoexistbearerwatcher.inl
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmcomminterfacesenderandreceiver.h
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmcommunicationinterface.h
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmcommunicationinterface.inl
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmdatainterface.h
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmdatainterface.inl
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmdatareceiver.h
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmdatareceiver.inl
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmdatasender.h
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmdatasender.inl
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmengine.h
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmengine.inl
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmnotificationdescriptor.h
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmntb16builder.h
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmntbbuilder.h
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmntbbuilder.inl
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmntbbuildpolicy.h
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmntbbuildsimplepolicy.h
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmntbparser.h
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmntbparser.inl
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmpktdrv.h
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmpktdrvcommon.h
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmpktdrvfactory.h
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmsharedstatemanager.h
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/src/ncmbuffermanager.cpp
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/src/ncmcoexistbearerwatcher.cpp
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/src/ncmcomminterfacesenderandreceiver.cpp
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/src/ncmcommunicationinterface.cpp
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/src/ncmdatainterface.cpp
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/src/ncmdatareceiver.cpp
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/src/ncmdatasender.cpp
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/src/ncmengine.cpp
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/src/ncmnotificationdescriptor.cpp
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/src/ncmntb16builder.cpp
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/src/ncmntbbuilder.cpp
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/src/ncmntbbuildpolicy.cpp
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/src/ncmntbbuildsimplepolicy.cpp
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/src/ncmntbparser.cpp
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/src/ncmpktdrv.cpp
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/src/ncmpktdrvfactory.cpp
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/src/ncmsharedstatemanager.cpp
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/traces/OstTraceDefinitions.h
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/traces/fixed_id.definitions
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/server/group/server.mmh
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/server/inc/ncmserver.h
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/server/inc/ncmserverconsts.h
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/server/inc/ncmserversecuritypolicy.h
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/server/inc/ncmsession.h
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/server/src/ncmserver.cpp
usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/server/src/ncmsession.cpp
usbmgmt/usbmgr/device/classdrivers/ncm/group/bld.inf
usbmgmt/usbmgr/device/classdrivers/ncm/inc/ncmcommon.h
usbmgmt/usbmgr/device/classdrivers/ncm/inc/ncminternalsrv.h
usbmgmt/usbmgr/device/classdrivers/ncm/public/usbncm.h
usbmgmt/usbmgr/device/classdrivers/obex/classcontroller/group/ObexClassController.mmp
usbmgmt/usbmgr/device/classdrivers/obex/classcontroller/src/CUsbObexClassController.cpp
usbmgmt/usbmgr/device/classdrivers/obex/classcontroller/src/CUsbObexClassImpCollection.cpp
usbmgmt/usbmgr/device/classdrivers/obex/classcontroller/traces/OstTraceDefinitions.h
usbmgmt/usbmgr/device/classdrivers/obex/classcontroller/traces/fixed_id.definitions
usbmgmt/usbmgr/device/classdrivers/whcm/classcontroller/SRC/CUsbWHCMClassController.cpp
usbmgmt/usbmgr/device/classdrivers/whcm/classcontroller/SRC/CUsbWHCMClassImpCollection.cpp
usbmgmt/usbmgr/device/classdrivers/whcm/classcontroller/group/WHCMClassController.mmp
usbmgmt/usbmgr/device/classdrivers/whcm/classcontroller/traces/OstTraceDefinitions.h
usbmgmt/usbmgr/device/classdrivers/whcm/classcontroller/traces/fixed_id.definitions
usbmgmt/usbmgr/group/BLD.INF
usbmgmt/usbmgr/group/Usbman.iby
usbmgmt/usbmgr/group/Usbmanbin.iby
usbmgmt/usbmgr/group/Usbmanrsc.iby
usbmgmt/usbmgr/group/usb.iby
usbmgmt/usbmgr/group/usb_manager.history.xml
usbmgmt/usbmgr/group/usbperipheral.iby
usbmgmt/usbmgr/host/fdf/production/client/group/usbhoststack.mmp
usbmgmt/usbmgr/host/fdf/production/client/group/usbhoststack_base.mmp
usbmgmt/usbmgr/host/fdf/production/client/group/usbhoststack_over_dummyusbdi.mmp
usbmgmt/usbmgr/host/fdf/production/client/public/usbhosterrors.h
usbmgmt/usbmgr/host/fdf/production/client/public/usbhoststack.h
usbmgmt/usbmgr/host/fdf/production/client/src/session.cpp
usbmgmt/usbmgr/host/fdf/production/client/traces/OstTraceDefinitions.h
usbmgmt/usbmgr/host/fdf/production/client/traces/fixed_id.definitions
usbmgmt/usbmgr/host/fdf/production/fdcbase/group/bld.inf
usbmgmt/usbmgr/host/fdf/production/fdcbase/group/fdcbase.mmp
usbmgmt/usbmgr/host/fdf/production/fdcbase/group/fdcbase_base_bld.inf
usbmgmt/usbmgr/host/fdf/production/fdcbase/group/fdcbase_over_dummyusbdi_bld.inf
usbmgmt/usbmgr/host/fdf/production/fdcbase/public/fdcinterface.h
usbmgmt/usbmgr/host/fdf/production/fdcbase/public/fdcplugin.h
usbmgmt/usbmgr/host/fdf/production/fdcbase/public/fdcplugin.hrh
usbmgmt/usbmgr/host/fdf/production/fdcbase/public/fdcpluginobserver.h
usbmgmt/usbmgr/host/fdf/production/fdcbase/src/fdcplugin.cpp
usbmgmt/usbmgr/host/fdf/production/fdcbase/src/fdcpluginobserver.cpp
usbmgmt/usbmgr/host/fdf/production/fdcbase/traces/OstTraceDefinitions.h
usbmgmt/usbmgr/host/fdf/production/fdcbase/traces/fixed_id.definitions
usbmgmt/usbmgr/host/fdf/production/server/group/fdf.mmp
usbmgmt/usbmgr/host/fdf/production/server/group/fdf_base.mmp
usbmgmt/usbmgr/host/fdf/production/server/group/fdf_over_dummyusbdi.mmp
usbmgmt/usbmgr/host/fdf/production/server/group/fdf_over_dummyusbdi_bld.inf
usbmgmt/usbmgr/host/fdf/production/server/inc/activewaitforbusevent.h
usbmgmt/usbmgr/host/fdf/production/server/inc/activewaitforecomevent.h
usbmgmt/usbmgr/host/fdf/production/server/inc/deviceproxy.h
usbmgmt/usbmgr/host/fdf/production/server/inc/event.h
usbmgmt/usbmgr/host/fdf/production/server/inc/eventqueue.h
usbmgmt/usbmgr/host/fdf/production/server/inc/fdcproxy.h
usbmgmt/usbmgr/host/fdf/production/server/inc/fdf.h
usbmgmt/usbmgr/host/fdf/production/server/inc/fdfserver.h
usbmgmt/usbmgr/host/fdf/production/server/inc/fdfsession.h
usbmgmt/usbmgr/host/fdf/production/server/inc/utils.h
usbmgmt/usbmgr/host/fdf/production/server/public/fdfapi.h
usbmgmt/usbmgr/host/fdf/production/server/src/activewaitforbusevent.cpp
usbmgmt/usbmgr/host/fdf/production/server/src/activewaitforecomevent.cpp
usbmgmt/usbmgr/host/fdf/production/server/src/deviceproxy.cpp
usbmgmt/usbmgr/host/fdf/production/server/src/event.cpp
usbmgmt/usbmgr/host/fdf/production/server/src/eventqueue.cpp
usbmgmt/usbmgr/host/fdf/production/server/src/fdcproxy.cpp
usbmgmt/usbmgr/host/fdf/production/server/src/fdf.cpp
usbmgmt/usbmgr/host/fdf/production/server/src/fdfserver.cpp
usbmgmt/usbmgr/host/fdf/production/server/src/fdfsession.cpp
usbmgmt/usbmgr/host/fdf/production/server/src/main.cpp
usbmgmt/usbmgr/host/fdf/production/server/src/utils.cpp
usbmgmt/usbmgr/host/fdf/production/server/traces/OstTraceDefinitions.h
usbmgmt/usbmgr/host/fdf/production/server/traces/fixed_id.definitions
usbmgmt/usbmgr/host/fdf/reference/reffdc/group/reffdc.mmp
usbmgmt/usbmgr/host/fdf/reference/reffdc/src/reffdc.cpp
usbmgmt/usbmgr/host/fdf/reference/reffdc/src/reffdcmain.cpp
usbmgmt/usbmgr/host/fdf/reference/reffdc/traces/OstTraceDefinitions.h
usbmgmt/usbmgr/host/fdf/reference/reffdc/traces/fixed_id.definitions
usbmgmt/usbmgr/host/functiondrivers/ms/msfdc/group/msfdc.mmp
usbmgmt/usbmgr/host/functiondrivers/ms/msfdc/src/msfdc.cpp
usbmgmt/usbmgr/host/functiondrivers/ms/msfdc/src/msfdcmain.cpp
usbmgmt/usbmgr/host/functiondrivers/ms/msfdc/traces/OstTraceDefinitions.h
usbmgmt/usbmgr/host/functiondrivers/ms/msfdc/traces/fixed_id.definitions
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/bwins/msmmicsession_over_dummycomponentu.def
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/eabi/msmmicsession_over_dummycomponentu.def
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/eabi/msmmindicatorsessionu.def
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/group/bld.inf
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/group/msmmclient_base.mmp
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/group/msmmclient_over_dummycomponent.mmp
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/group/msmmindicatorclient.mmp
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/group/msmmindicatorclient_base.mmp
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/group/msmmindicatorclient_over_dummycomponent.mmp
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/public/msmmindicatorclient.h
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/src/msmmclient.cpp
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/src/msmmindicatorclient.cpp
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/traces/OstTraceDefinitions.h
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/traces/fixed_id.definitions
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/group/bld.inf
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/group/msmm_over_dummycomponent_bld.inf
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/group/usbhostmsmm.iby
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/inc/srvdef.h
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/referencepolicyplugin/group/referencepolicyplugin.mmh
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/referencepolicyplugin/group/refpp_over_dummycomponent.mmp
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/referencepolicyplugin/inc/refppnotificationman.h
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/referencepolicyplugin/src/proxy.cpp
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/referencepolicyplugin/src/referencepolicyplugin.cpp
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/referencepolicyplugin/src/refppnotificationman.cpp
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/referencepolicyplugin/traces/OstTraceDefinitions.h
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/referencepolicyplugin/traces/fixed_id.definitions
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/group/bld.inf
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/group/refppnotifier.iby
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/group/refppnotifier.mmp
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/inc/refppdialog.h
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/inc/refppnotifier.h
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/inc/refppnotifier.hrh
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/src/dialog.rss
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/src/refppdialog.cpp
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/src/refppnotifier.cpp
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/src/refppnotifier.rss
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/group/msmmserver_base.mmp
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/group/msmmserver_over_dummycomponent.mmp
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/inc/msmmdismountusbdrives.h
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/inc/msmmserver.h
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/inc/srvsec.h
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/public/srverr.h
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/eventhandler.cpp
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/eventqueue.cpp
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/main.cpp
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/msmmdismountusbdrives.cpp
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/msmmengine.cpp
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/msmmnodebase.cpp
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/msmmserver.cpp
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/msmmsession.cpp
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/msmmterminator.cpp
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/subcommandbase.cpp
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/subcommands.cpp
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/traces/OstTraceDefinitions.h
usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/traces/fixed_id.definitions
usbmgmt/usbmgr/inifile/src/inifile.cpp
usbmgmt/usbmgr/logger/BWINS/usbloggerU.DEF
usbmgmt/usbmgr/logger/EABI/usbloggerU.DEF
usbmgmt/usbmgr/logger/group/BLD.INF
usbmgmt/usbmgr/logger/group/usblogger.MMP
usbmgmt/usbmgr/logger/group/usblogger.mmh
usbmgmt/usbmgr/logger/public/usblogger.h
usbmgmt/usbmgr/logger/src/usblogger.cpp
usbmgmt/usbmgr/test/cit/ROMConfig/group/bld.inf
usbmgmt/usbmgr/test/cit/ROMConfig/group/testserversymbianexcludeusb.mmp
usbmgmt/usbmgr/test/cit/ROMConfig/inc/cteststepusbromconfig001.h
usbmgmt/usbmgr/test/cit/ROMConfig/inc/cteststepusbromconfig002.h
usbmgmt/usbmgr/test/cit/ROMConfig/inc/cteststepusbromconfig003.h
usbmgmt/usbmgr/test/cit/ROMConfig/inc/cteststepusbromconfig004.h
usbmgmt/usbmgr/test/cit/ROMConfig/inc/cteststepusbromconfigbase.h
usbmgmt/usbmgr/test/cit/ROMConfig/inc/testserversymbianexcludeusb.h
usbmgmt/usbmgr/test/cit/ROMConfig/scripts/USB_CIT_P581_UsbExcluded.script
usbmgmt/usbmgr/test/cit/ROMConfig/scripts/USB_CIT_P581_UsbIncluded.script
usbmgmt/usbmgr/test/cit/ROMConfig/scripts/USB_INC_ROMCONFIG_001.script
usbmgmt/usbmgr/test/cit/ROMConfig/scripts/USB_INC_ROMCONFIG_002.script
usbmgmt/usbmgr/test/cit/ROMConfig/scripts/USB_INC_ROMCONFIG_003.script
usbmgmt/usbmgr/test/cit/ROMConfig/scripts/USB_INC_ROMCONFIG_004.script
usbmgmt/usbmgr/test/cit/ROMConfig/scripts/USB_ROMCONFIG_001.script
usbmgmt/usbmgr/test/cit/ROMConfig/scripts/USB_ROMCONFIG_002.script
usbmgmt/usbmgr/test/cit/ROMConfig/scripts/USB_ROMCONFIG_003.script
usbmgmt/usbmgr/test/cit/ROMConfig/scripts/USB_ROMCONFIG_004.script
usbmgmt/usbmgr/test/cit/ROMConfig/src/cteststepusbromconfig001.cpp
usbmgmt/usbmgr/test/cit/ROMConfig/src/cteststepusbromconfig002.cpp
usbmgmt/usbmgr/test/cit/ROMConfig/src/cteststepusbromconfig003.cpp
usbmgmt/usbmgr/test/cit/ROMConfig/src/cteststepusbromconfig004.cpp
usbmgmt/usbmgr/test/cit/ROMConfig/src/cteststepusbromconfigbase.cpp
usbmgmt/usbmgr/test/cit/ROMConfig/src/testserversymbianexcludeusb.cpp
usbmgmt/usbmgr/test/cit/ROMConfig/testdata/UsbRomConfig.ini
usbmgmt/usbmgr/test/cit/ROMConfig/xml/UsbRomConfigSuite.xml
usbmgmt/usbmgr/test/cit/ROMConfig/xml/UsbRomConfigSuite/TestExecuteServers/TestServerSymbianExcludeUsb.xml
usbmgmt/usbmgr/test/cit/ROMConfig/xml/UsbRomConfigSuite/UsbExcSuite.xml
usbmgmt/usbmgr/test/cit/ROMConfig/xml/UsbRomConfigSuite/UsbExcSuite/UsbRomConfig001.xml
usbmgmt/usbmgr/test/cit/ROMConfig/xml/UsbRomConfigSuite/UsbExcSuite/UsbRomConfig002.xml
usbmgmt/usbmgr/test/cit/ROMConfig/xml/UsbRomConfigSuite/UsbExcSuite/UsbRomConfig003.xml
usbmgmt/usbmgr/test/cit/ROMConfig/xml/UsbRomConfigSuite/UsbExcSuite/UsbRomConfig004.xml
usbmgmt/usbmgr/test/cit/ROMConfig/xml/UsbRomConfigSuite/UsbIncSuite.xml
usbmgmt/usbmgr/test/cit/ROMConfig/xml/UsbRomConfigSuite/UsbIncSuite/UsbIncRomConfig001.xml
usbmgmt/usbmgr/test/cit/ROMConfig/xml/UsbRomConfigSuite/UsbIncSuite/UsbIncRomConfig002.xml
usbmgmt/usbmgr/test/cit/ROMConfig/xml/UsbRomConfigSuite/UsbIncSuite/UsbIncRomConfig003.xml
usbmgmt/usbmgr/test/cit/ROMConfig/xml/UsbRomConfigSuite/UsbIncSuite/UsbIncRomConfig004.xml
usbmgmt/usbmgr/usbman/chargingplugin/group/UsbBatteryChargingPluginBase.mmp
usbmgmt/usbmgr/usbman/chargingplugin/group/bld.inf
usbmgmt/usbmgr/usbman/chargingplugin/public/usbchargingpublishedinfo.h
usbmgmt/usbmgr/usbman/chargingplugin/src/CUsbBatteryChargingPlugin.cpp
usbmgmt/usbmgr/usbman/chargingplugin/src/chargingstates.cpp
usbmgmt/usbmgr/usbman/chargingplugin/src/idpinwatcher.cpp
usbmgmt/usbmgr/usbman/chargingplugin/src/otgstatewatcher.cpp
usbmgmt/usbmgr/usbman/chargingplugin/src/vbuswatcher.cpp
usbmgmt/usbmgr/usbman/chargingplugin/traces/OstTraceDefinitions.h
usbmgmt/usbmgr/usbman/chargingplugin/traces/fixed_id.definitions
usbmgmt/usbmgr/usbman/client/SRC/RUsb.cpp
usbmgmt/usbmgr/usbman/client/group/Usbman.mmp
usbmgmt/usbmgr/usbman/client/group/Usbman_over_dummyusbdi.mmp
usbmgmt/usbmgr/usbman/client/traces/OstTraceDefinitions.h
usbmgmt/usbmgr/usbman/client/traces/fixed_id.definitions
usbmgmt/usbmgr/usbman/server/INC/CPersonality.h
usbmgmt/usbmgr/usbman/server/INC/CPersonality.inl
usbmgmt/usbmgr/usbman/server/INC/CUsbDevice.h
usbmgmt/usbmgr/usbman/server/INC/CUsbSession.h
usbmgmt/usbmgr/usbman/server/INC/UsbSettings.h
usbmgmt/usbmgr/usbman/server/INC/UsbmanServerSecurityPolicy.h
usbmgmt/usbmgr/usbman/server/INC/usbmancenrepmanager.h
usbmgmt/usbmgr/usbman/server/INC/usbmanprivatecrkeys.h
usbmgmt/usbmgr/usbman/server/SRC/CPersonality.cpp
usbmgmt/usbmgr/usbman/server/SRC/CUsbDevice.cpp
usbmgmt/usbmgr/usbman/server/SRC/CUsbDeviceStateWatcher.cpp
usbmgmt/usbmgr/usbman/server/SRC/CUsbDummyClassController.cpp
usbmgmt/usbmgr/usbman/server/SRC/CUsbOtg.cpp
usbmgmt/usbmgr/usbman/server/SRC/CUsbScheduler.cpp
usbmgmt/usbmgr/usbman/server/SRC/CUsbServer.cpp
usbmgmt/usbmgr/usbman/server/SRC/CUsbSession.cpp
usbmgmt/usbmgr/usbman/server/SRC/UsbSvr.cpp
usbmgmt/usbmgr/usbman/server/SRC/cusbhost.cpp
usbmgmt/usbmgr/usbman/server/SRC/cusbhostwatcher.cpp
usbmgmt/usbmgr/usbman/server/SRC/cusbotgwatcher.cpp
usbmgmt/usbmgr/usbman/server/SRC/usbman.rls
usbmgmt/usbmgr/usbman/server/SRC/usbman.rss
usbmgmt/usbmgr/usbman/server/SRC/usbman_01.rls
usbmgmt/usbmgr/usbman/server/SRC/usbman_02.rls
usbmgmt/usbmgr/usbman/server/SRC/usbman_03.rls
usbmgmt/usbmgr/usbman/server/SRC/usbman_10.rls
usbmgmt/usbmgr/usbman/server/SRC/usbmancenrepmanager.cpp
usbmgmt/usbmgr/usbman/server/SRC/usbmanlubbockobex.rss
usbmgmt/usbmgr/usbman/server/SRC/usbmanmtp.rss
usbmgmt/usbmgr/usbman/server/SRC/usbmanmtprndis.rss
usbmgmt/usbmgr/usbman/server/SRC/usbmanrndis.rss
usbmgmt/usbmgr/usbman/server/conf/usbmanager_101fe1db.crml
usbmgmt/usbmgr/usbman/server/data/demo_mcci_usbman.rh
usbmgmt/usbmgr/usbman/server/group/BLD.INF
usbmgmt/usbmgr/usbman/server/group/usbsvrbase.mmp
usbmgmt/usbmgr/usbman/server/public/rusb.h
usbmgmt/usbmgr/usbman/server/public/usbman.rh
usbmgmt/usbmgr/usbman/server/traces/OstTraceDefinitions.h
usbmgmt/usbmgr/usbman/server/traces/fixed_id.definitions
usbmgmt/usbmgrautotest/TestExecute/USB/ncm_unit_test/ncmcctest/dummy_ncminternalsrv/group/bld.inf
usbmgmt/usbmgrautotest/TestExecute/USB/ncm_unit_test/ncmcctest/dummy_ncminternalsrv/group/dummy_ncminternalsrv.mmp
usbmgmt/usbmgrtest/ObexClassController/ObexUsbClassController/ObexClassController/group/CUsbObexClassController.mmp
usbmgmt/usbmgrtest/ObexClassController/ObexUsbClassController/ObexClassController/group/bld.inf
usbmgmt/usbmgrtest/ObexClassController/ObexUsbClassController/ObexClassController/src/obexusbman.rss
usbmgmt/usbmgrtest/ObexClassController/test/src/simpleObexApp.cpp
usbmgmt/usbmgrtest/ObexClassController/test/src/simpleObexClient.cpp
usbmgmt/usbmgrtest/ObexClassController/test/src/simpleObexServer.cpp
usbmgmt/usbmgrtest/csy/t_ecacm/src/t_csyaccess.cpp
usbmgmt/usbmgrtest/t_acm/src/t_acm.cpp
usbmgmt/usbmgrtest/t_acm_cc/src/t_acm_cc.cpp
usbmgmt/usbmgrtest/t_acm_pub_sub/src/t_acm_pub_sub.cpp
usbmgmt/usbmgrtest/t_acm_spec/src/t_acm_spec.cpp
usbmgmt/usbmgrtest/t_acm_wins/src/t_acm_wins.cpp
usbmgmt/usbmgrtest/t_catc/src/t_catc.cpp
usbmgmt/usbmgrtest/t_charging_arm/group/t_usbchargingarm.mmp
usbmgmt/usbmgrtest/t_charging_emu/group/TestPlugin.mmp
usbmgmt/usbmgrtest/t_charging_emu/group/TestPluginotg.mmp
usbmgmt/usbmgrtest/t_charging_emu/inc/dummyldd.h
usbmgmt/usbmgrtest/t_charging_emu/inc/tbatterycharging.h
usbmgmt/usbmgrtest/t_charging_emu/inc/tpropertybatterycharging.h
usbmgmt/usbmgrtest/t_charging_emu/src/1020DEA7.rss
usbmgmt/usbmgrtest/t_charging_emu/src/CUsbBatteryChargingTestPlugin.cpp
usbmgmt/usbmgrtest/t_charging_emu/src/tbatterycharging.cpp
usbmgmt/usbmgrtest/t_charging_emu/traces/OstTraceDefinitions.h
usbmgmt/usbmgrtest/t_charging_emu/traces/fixed_id.definitions
usbmgmt/usbmgrtest/t_headlessecacm/group/t_headlessecacm.mmp
usbmgmt/usbmgrtest/t_multi_acm/src/t_multiple_acm.cpp
usbmgmt/usbmgrtest/t_ncm/group/bld.inf
usbmgmt/usbmgrtest/t_ncm/group/ncmtestconsole.iby
usbmgmt/usbmgrtest/t_ncm/group/ncmtestconsole.mmp
usbmgmt/usbmgrtest/t_ncm/inc/commandengine.h
usbmgmt/usbmgrtest/t_ncm/inc/devicewatcher.h
usbmgmt/usbmgrtest/t_ncm/inc/exitcommand.h
usbmgmt/usbmgrtest/t_ncm/inc/ncmtestconsole.h
usbmgmt/usbmgrtest/t_ncm/inc/ncmtestdefines.hrh
usbmgmt/usbmgrtest/t_ncm/inc/ncmwatcher.h
usbmgmt/usbmgrtest/t_ncm/inc/servicewatcher.h
usbmgmt/usbmgrtest/t_ncm/inc/setncmiapcommand.h
usbmgmt/usbmgrtest/t_ncm/inc/simpancommand.h
usbmgmt/usbmgrtest/t_ncm/inc/startwatchercommand.h
usbmgmt/usbmgrtest/t_ncm/inc/tcpcommand.h
usbmgmt/usbmgrtest/t_ncm/inc/tcptest.h
usbmgmt/usbmgrtest/t_ncm/sis/ncmtestconsole.pkg
usbmgmt/usbmgrtest/t_ncm/src/commandengine.cpp
usbmgmt/usbmgrtest/t_ncm/src/devicewatcher.cpp
usbmgmt/usbmgrtest/t_ncm/src/exitcommand.cpp
usbmgmt/usbmgrtest/t_ncm/src/ncmtestconsole.cpp
usbmgmt/usbmgrtest/t_ncm/src/ncmwatcher.cpp
usbmgmt/usbmgrtest/t_ncm/src/servicewatcher.cpp
usbmgmt/usbmgrtest/t_ncm/src/setncmiapcommand.cpp
usbmgmt/usbmgrtest/t_ncm/src/simpancommand.cpp
usbmgmt/usbmgrtest/t_ncm/src/tcpcommand.cpp
usbmgmt/usbmgrtest/t_ncm/src/tcptest.cpp
usbmgmt/usbmgrtest/t_termusb/src/t_termusb.cpp
usbmgmt/usbmgrtest/t_termusb2/src/t_termusb2.cpp
usbmgmt/usbmgrtest/t_usb_cable_detect/src/t_usb_cable_detect.cpp
usbmgmt/usbmgrtest/t_usbman/src/t_usbman.cpp
usbmgmt/usbmgrtest/t_usbmanager_suite/Stub1CC/group/BLD.INF
usbmgmt/usbmgrtest/t_usbmanager_suite/Stub1CC/group/Stub1CC.mmp
usbmgmt/usbmgrtest/t_usbmanager_suite/Stub1CC/inc/Stub1CC.h
usbmgmt/usbmgrtest/t_usbmanager_suite/Stub1CC/src/Stub1CC.cpp
usbmgmt/usbmgrtest/t_usbmanager_suite/Stub1CC/traces/OstTraceDefinitions.h
usbmgmt/usbmgrtest/t_usbmanager_suite/Stub1CC/traces/fixed_id.definitions
usbmgmt/usbmgrtest/t_usbmanager_suite/Stub2CC/group/Stub2CC.mmp
usbmgmt/usbmgrtest/t_usbmanager_suite/Stub2CC/inc/Stub2CC.h
usbmgmt/usbmgrtest/t_usbmanager_suite/Stub2CC/src/Stub2CC.cpp
usbmgmt/usbmgrtest/t_usbmanager_suite/Stub2CC/traces/OstTraceDefinitions.h
usbmgmt/usbmgrtest/t_usbmanager_suite/Stub2CC/traces/fixed_id.definitions
usbmgmt/usbmgrtest/t_usbmanager_suite/Stub3CC/group/Stub3CC.mmp
usbmgmt/usbmgrtest/t_usbmanager_suite/Stub3CC/inc/Stub3CC.h
usbmgmt/usbmgrtest/t_usbmanager_suite/Stub3CC/src/Stub3CC.cpp
usbmgmt/usbmgrtest/t_usbmanager_suite/Stub3CC/traces/OstTraceDefinitions.h
usbmgmt/usbmgrtest/t_usbmanager_suite/Stub3CC/traces/fixed_id.definitions
usbmgmt/usbmgrtest/t_usbmanager_suite/T_UsbManager/src/CUsbComponentTest.cpp
usbmgmt/usbmgrtest/t_usbmanager_suite/T_UsbManager/src/T_UsbManagerServer.cpp
usbmgmt/usbmgrtest/t_usbmanager_suite/mscc/group/te_msclasscontroller.mmp
usbmgmt/usbmgrtest/t_usbmodem/inc/t_usbmodem.h
usbmgmt/usbmgrtest/t_usbmodem/src/t_usbmodem.cpp
usbmgmt/usbmgrtest/t_whcm_cc/src/t_whcm_cc.cpp
usbmgmt/usbmgrtest/usbmsapp/usbms_stub/group/usbms_stub1cc.mmp
usbmgmt/usbmgrtest/usbmsapp/usbms_stub/group/usbms_stub2cc.mmp
usbmgmt/usbmgrtest/usbmsapp/usbms_stub/group/usbms_stub3cc.mmp
usbmgmt/usbmgrtest/usbmsapp/usbms_stub/inc/usbms_stub.h
usbmgmt/usbmgrtest/usbmsapp/usbms_stub/src/usbms_stub.cpp
usbmgmt/usbmgrtest/usbmsapp/usbms_stub/traces/OstTraceDefinitions.h
usbmgmt/usbmgrtest/usbmsapp/usbms_stub/traces/fixed_id.definitions
--- a/layers.sysdef.xml	Thu Jul 15 20:42:20 2010 +0300
+++ b/layers.sysdef.xml	Tue Aug 31 17:01:47 2010 +0300
@@ -7,11 +7,11 @@
   <systemModel>
     <layer name="os_layer">
       <module name="usb">
-        <unit unitID="lcdo.usb" mrp="" bldFile="&layer_real_source_path;/group" name="usb" />
+        <unit unitID="usbdo.usb" mrp="" bldFile="&layer_real_source_path;/group" name="usb" />
       </module>
       <module name="">
-        <unit unitID="lcdo.usb.usbextension" mrp="" bldFile="&layer_real_source_path;/usbextension/group" filter="!sf_build" name="usb_usbextension" />
-        <unit unitID="lcdo.usb.usb_plat.usb_audio_stream_plugin_api" mrp="" bldFile="&layer_real_source_path;/usb_plat/usb_audio_stream_plugin_api/group" filter="!sf_build" name="usb_usb_plat_usb_audio_stream_plugin_api" />
+        <unit unitID="usbdo.usb.usbextension" mrp="" bldFile="&layer_real_source_path;/usbextension/group" filter="!sf_build" name="usb_usbextension" />
+        <unit unitID="usbdo.usb.usb_plat.usb_audio_stream_plugin_api" mrp="" bldFile="&layer_real_source_path;/usb_plat/usb_audio_stream_plugin_api/group" filter="!sf_build" name="usb_usb_plat_usb_audio_stream_plugin_api" />
       </module>    
     </layer>
   </systemModel>
--- a/package_definition.xml	Thu Jul 15 20:42:20 2010 +0300
+++ b/package_definition.xml	Tue Aug 31 17:01:47 2010 +0300
@@ -1,27 +1,29 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <SystemDefinition schema="3.0.0">
-  <package id="usb" name="USB" levels="adaptation hw-if plugin framework server app-if">
-    <collection id="usbldd" name="USB Logical Device Drivers" level="hw-if">
-      <!-- usbclientdrivers  to be moved here from kernelhwsrv-->
-    </collection>
-    <collection id="usbmgmt" name="USB Management" level="server">
-      <component id="usbmgr" name="USB Manager" purpose="optional">
-        <unit version="2" bldFile="usbmgmt/usbmgr/group" mrp="usbmgmt/usbmgr/group/usb_manager.mrp"/>
-      </component>
-      <component id="usbmgrtest" name="USB Manager Tests" introduced="7.0" purpose="development" filter="test">
-        <unit version="2" mrp="usbmgmt/usbmgrtest/group/usb_test.mrp" bldFile="usbmgmt/usbmgrtest/group"/>
-      </component>
-      <component id="usbclassandmgrdocs" name="USB Class and Manager Documentation" purpose="development" class="doc">
-        <unit mrp="usbmgmt/usbclassandmgrdocs/usb_documentation.mrp"/>
-      </component>
-    </collection>
-    <collection id="usb_info" name="USB Info" level="app-if">
-      <component id="usb_metadata" name="USB Metadata" class="config" introduced="^3" purpose="development" target="desktop">
-        <unit mrp="usb_info/usb_metadata/usb_metadata.mrp"/>
-      </component>
-      <component id="usb_plat" name="USB Platform Interfaces" class="api" filter="s60">
-        <!--unit bldFile="usb_plat/group"/-->
-      </component>
-    </collection>
-  </package>
+ <package id="usb" name="USB" levels="adaptation hw-if plugin framework server app-if">
+  <collection id="usb_plat" name="USB Platform Interfaces" level="app-if">
+	<!-- placeholder for platform APIs -->
+  </collection>
+  <collection id="usbdrv" name="USB Device Drivers" level="hw-if">
+	 	<component id="peripheraldrv" name="Usb peripheral driver" purpose="optional">
+  		<unit version="1" bldFile="usbdrv/peripheral/group" mrp="usbdrv/peripheral/group/peripheral.mrp" /> 
+  	</component>
+  </collection>
+  <collection id="usbmgmt" name="USB Management" level="server">
+   <component id="usbmgr" name="USB Manager" purpose="optional">
+    <unit version="2" bldFile="usbmgmt/usbmgr/group" mrp="usbmgmt/usbmgr/group/usb_manager.mrp"/>
+   </component>
+   <component id="usbmgrtest" name="USB Manager Tests" introduced="7.0" purpose="development" filter="test">
+    <unit version="2" mrp="usbmgmt/usbmgrtest/group/usb_test.mrp" bldFile="usbmgmt/usbmgrtest/group"/>
+   </component>
+   <component id="usbclassandmgrdocs" name="USB Class and Manager Documentation" purpose="development" class="doc">
+    <unit mrp="usbmgmt/usbclassandmgrdocs/usb_documentation.mrp"/>
+   </component>
+  </collection>
+  <collection id="usb_info" name="USB Info" level="app-if">
+   <component id="usb_metadata" name="USB Metadata" class="config" introduced="^3" purpose="development" target="desktop">
+    <unit mrp="usb_info/usb_metadata/usb_metadata.mrp"/>
+   </component>
+  </collection>
+ </package>
 </SystemDefinition>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/package_map.xml	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,1 @@
+<PackageMap root="sf" layer="os"/>
--- a/usb_plat/group/bld.inf	Thu Jul 15 20:42:20 2010 +0300
+++ b/usb_plat/group/bld.inf	Tue Aug 31 17:01:47 2010 +0300
@@ -15,6 +15,7 @@
 *
 */
 
+#include "../usb_shai_api/group/bld.inf"
 
 PRJ_PLATFORMS
 DEFAULT
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usb_plat/group/usb_plat.mrp	Tue Aug 31 17:01:47 2010 +0300
@@ -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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usb_plat/usb_shai_api/group/bld.inf	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2007 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:  Build information file
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+ARMV5
+
+PRJ_EXPORTS
+
+
+../inc/usb_common_shai.h               SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(usb/)
+../inc/usb_host_shai.h                 SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(usb/)
+../inc/usb_otg_shai.h                  SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(usb/)
+../inc/usb_peripheral_shai.h            SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(usb/)
+../inc/usb_peripheral_shai.inl          SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(usb/)
+../inc/usb_peripheral_shai_shared.h      SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(usb/)
+../inc/usb_charger_detection_shai.h      SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(usb/)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usb_plat/usb_shai_api/inc/usb_charger_detection_shai.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,403 @@
+/*
+* 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
+    @brief USB Charger Detection SHAI header
+    @version 0.2.0
+
+    This header specifies the USB Charger Detection SHAI.
+
+    @publishedDeviceAbstraction
+*/
+
+
+#ifndef USB_CHARGER_DETECTION_SHAI_H
+#define USB_CHARGER_DETECTION_SHAI_H
+
+// System includes
+#include <kern_priv.h>
+
+/**
+ * This macro specifies the version of the USB Charger Detection SHAI
+ * header in binary coded decimal format. This allows the PSL layer to
+ * confirm a certain definition is available, if needed. This can for
+ * example make it possible for a new PSL to support compilation in an
+ * older environment with old USB SHAI version that is missing some
+ * new definitions.
+ */
+#define USB_CHARGER_DETECTION_SHAI_VERSION 0x020
+
+// The namespace is documented in file usb_common_shai.h, so it is not
+// repeated here
+namespace UsbShai
+    {
+    // Data types
+
+    /**
+     * An enumeration listing the different port types that can be
+     * reported to the PIL layer by a registered Charger Detector
+     * PSL. The available types mostly correspond to those mentioned
+     * in the Battery Charging Specification Revision 1.1.
+     */
+    enum TPortType
+        {
+        /**
+         * This type is reported to indicate that the Charger Detector
+         * PSL has detected that we are no longer connected to a
+         * powered port. This situation occurs when VBUS driven from
+         * outside drops, or the Accessory Charger Adapter changes the
+         * RID state from RID_A to RID_GND (which usually also means
+         * that VBUS will drop very soon).
+         */
+        EPortTypeNone = 0,
+
+        /**
+         * This type is reported to indicate that the Charger
+         * Detector PSL has detected that our device is connected to
+         * an unsupported port. One common type of an unsupported port
+         * is a PS/2 to USB adapter connected to a PS/2 port of a
+         * computer.
+         */
+        EPortTypeUnsupported,
+
+        /** 
+         * This type is reported when the Charger Detector PSL has
+         * detected that our device is connected to a charging port,
+         * but has not yet distinguished whether the port is a
+         * Charging Downstream Port or a Dedicated Charging Port.
+         *
+         * When this port type is detected, the upper layers will
+         * connect to the USB bus as the peripheral by requesting the
+         * Peripheral Controller PSL to assert the D+ pull-up. The
+         * Charger Detector PSL can then detect the exact port type by
+         * observing what happens to the level of the D- line, as
+         * specified in the Battery Charging Specification. Upon
+         * detecting the exact port type, the Charger Detector PSL can
+         * notify a new event with the correct type.
+         *
+         * If the Charger Detector PSL can directly distinguish the
+         * exact port type, the PSL does not need to report this
+         * generic charging port type, but can directly report the
+         * more specific type EPortTypeDedicatedChargingPort or
+         * EPortTypeChargingDownstreamPort.
+         */
+        EPortTypeChargingPort,
+
+        /** 
+         * This type is reported when the Charger Detector PSL has
+         * detected that our device is connected to a Dedicated
+         * Charging Port.
+         *
+         * When this port type is detected, the upper layers will
+         * connect to the USB bus as the peripheral by requesting the
+         * Peripheral Controller PSL to assert the D+ pull-up, as
+         * specified in the Battery Charging Specification.
+         */
+        EPortTypeDedicatedChargingPort,
+            
+        /** 
+         * This type is reported when the Charger Detector PSL has
+         * detected that our device is connected to a Charging
+         * Downstream Port.
+         *
+         * When this port type is detected, the upper layers will
+         * connect to the USB bus as the peripheral by requesting the
+         * Peripheral Controller PSL to assert the D+ pull-up, as
+         * specified in the Battery Charging Specification.
+         */
+        EPortTypeChargingDownstreamPort,
+            
+        /** 
+         * This type is reported when the Charger Detector PSL has
+         * detected that our device is connected to a Standard
+         * Downstream Port.
+         *
+         * When this port type is detected, the upper layers will
+         * connect to the USB bus as the peripheral by requesting the
+         * Peripheral Controller PSL to assert the D+ pull-up, as
+         * specified in the Battery Charging Specification.
+         */
+        EPortTypeStandardDownstreamPort,
+
+        /** 
+         * This type is reported when the Charger Detector PSL has
+         * detected that our device is connected to the OTG port of an
+         * Accessory Charger Adapter and the ID pin is in the RID_A
+         * range.
+         *
+         * When this port type is detected in an OTG-capable device,
+         * the OTG State Machine will default to the host role.
+         */
+        EPortTypeAcaRidA,
+
+        /** 
+         * This type is reported when the Charger Detector PSL has
+         * detected that our device is connected to the OTG port of an
+         * Accessory Charger Adapter and the ID pin is in the RID_B
+         * range.
+         *
+         * When this port type is detected, the USB Peripheral PIL
+         * layer will ensure that the Peripheral Controller PSL is not
+         * allowed to connect to the bus, as required by the Battery
+         * Charging Specification.
+         */
+        EPortTypeAcaRidB,
+
+        /** 
+         * This type is reported when the Charger Detector PSL has
+         * detected that our device is connected to the OTG port of an
+         * Accessory Charger Adapter and the ID pin is in the RID_C
+         * range.
+         *
+         * When this port type is detected, the upper layers will
+         * connect to the USB bus as the peripheral by requesting the
+         * Peripheral Controller PSL to assert the D+ pull-up, as
+         * specified in the Battery Charging Specification.
+         */
+        EPortTypeAcaRidC,
+        };
+
+
+    // Class declaration
+
+    /**
+     * An interface class implemented by the PIL layer to allow the
+     * Charger Detector PSL to report charger detection events to the
+     * PIL layer.
+     */
+    NONSHARABLE_CLASS( MChargerDetectorObserverIf )
+        {
+        public:            
+        /**
+         * Called by the Charger Detector PSL to report the detection
+         * of a specified type of a port.
+         *
+         * When the PIL layer has registered itself as the observer of
+         * the Charger Detector PSL, it is the responsibility of the
+         * Charger Detector PSL to run the charger detection algorithm
+         * when applicable. These situations include:
+         *
+         * 1. When VBUS has risen while our device is the B-device. A
+         *    Charger Detector PSL that supports Data Contact Detect
+         *    (see Battery Charging Specification 1.1, Section 3.3)
+         *    should complete Data Contact Detect and the charger
+         *    detection algorithm before notifying the VBUS rising
+         *    event to the respective PIL layer.
+         *
+         *    For a peripheral-only port, this requirement is
+         *    documented in more detail in usb_peripheral_shai.h,
+         *    function
+         *    MUsbPeripheralPilCallbackIf::DeviceEventNotification(). For
+         *    an OTG-capable port, the requirement is documented in
+         *    usb_otg_shai.h, function
+         *    MOtgObserverIf::NotifyVbusState().
+         *
+         * 2. When VBUS is high, the Charger Detector PSL needs to
+         *    observe changes in the ID pin state, if the Charger
+         *    Detector PSL support detecting the port types relevant
+         *    to Accessory Charger Adapter. This requirement is
+         *    documented in more detail in usb_otg_shai.h, function
+         *    MOtgObserverIf::NotifyIdPinState().
+         *
+         * @param aPortType The type of the port detected
+         */    
+        virtual void NotifyPortType( TPortType aPortType ) = 0;
+        };
+
+
+    /**
+     * An interface class that needs to be implemented by the Charger
+     * Detector PSL that registers to the PIL layer.
+     *
+     * A system that does not support USB Battery Charging does not
+     * need a Charger Detector PSL. In this case the PIL layer will
+     * always assume the device is connected to a Standard Downstream
+     * Port and will always connect to the bus when VBUS rises.
+     *
+     * Due to the dependencies between normal USB functionality
+     * (observing the state of the ID pin, the VBUS level, the line
+     * state, and controlling connecting to the bus) and USB Battery
+     * Charging (in terms of charger detection and requirements about
+     * connecting to the bus and driving VBUS), the Charger Detector
+     * PSL cannot be considered independent of the USB Controller
+     * PSLs.
+     *
+     * In practice, it is expected that the Charger Detector interface
+     * for a peripheral-only port is implemented by the Peripheral
+     * Controller PSL, or at least that the Peripheral Controller PSL
+     * is communicating with the Charger Detector PSL. This is
+     * necessary to ensure that the necessary parts of charger
+     * detection are run before reporting VBUS high, and that the
+     * Peripheral Controller and the charger detection can safely
+     * share the bus without conflict (as both will need to touch the
+     * line state). See usb_peripheral_shai.h,
+     * MUsbPeripheralPilCallbackIf::DeviceEventNotification() for
+     * description of the requirements.
+     *
+     * Similarly, it is expected that the Charger Detector interface
+     * for an OTG-capable port is implemented by the OTG Controller
+     * PSL, or at least that the OTG Controller PSL is communicating
+     * with the Charger Detector PSL. See usb_otg_shai.h,
+     * MOtgObserverIf::NotifyIdPinState() and
+     * MOtgObserverIf::NotifyVbusState() for description of the
+     * requirements.
+     *
+     * When the PIL layer is ready to receive charger detection
+     * notifications from the PSL, it will use this interface to
+     * register itself as the Charger Detector PSL observer. This is
+     * guaranteed to occur before any USB usage is attempted.
+     */
+    NONSHARABLE_CLASS( MChargerDetectorIf )
+        {
+        public:
+        /**
+         * Called by the PIL layer to set itself as the observer of
+         * charger detection events.
+         *
+         * If the port type has already been detected by the Charger
+         * Detector PSL when the observer is being set (typically
+         * because VBUS was already high at boot time), it is the
+         * responsibility of the Charger Detector PSL to immediately
+         * report the previously detected port type to the observer to
+         * get the PIL layer to the correct state.
+         *
+         * @param aObserver Reference to the observer interface that
+         *   the charger detector is required to report events to
+         */            
+        virtual void SetChargerDetectorObserver( MChargerDetectorObserverIf& aObserver ) = 0;  
+        };
+
+
+    /**
+     * This class specifies the information provided by a Charger
+     * Detector PSL when registering to the PIL layer.
+     *
+     * The PSL should prepare for the possibility that members may be
+     * added to the end of this class in later SHAI versions if new
+     * information is needed to support new features. The PSL should
+     * not use this class as a direct member in an object that is not
+     * allowed to grow in size due to binary compatibility reasons.
+     *
+     * @see UsbChargerDetectionPil::RegisterChargerDetector()
+     */
+    NONSHARABLE_CLASS( TChargerDetectorProperties )
+        {
+        public: // Types and constants
+        /**
+         * A bitmask type used to indicate the static capabilities of
+         * the Charger Detector.
+         */
+        typedef TUint32 TChargerDetectorCaps;
+
+        /**
+         * Capability bit to indicate whether the USB system below the
+         * SHAI (either in HW or in the low-level SW) supports
+         * automatically reducing charging current for the duration of
+         * the USB high-speed chirp signalling. See Battery Charging
+         * Specification Revision 1.1, Chapter 3.6.2 for description
+         * of the problem.
+         *
+         * If the system does not support this feature, the upper
+         * layer USB components that calculate available charging
+         * current will always limit the charging current taken from a
+         * Charging Downstream Port so that the maximum current during
+         * chirp is not violated.
+         *
+         * If the system supports this feature, the full available
+         * charging current from a Charging Downstream Port is
+         * utilized. It is then the responsibility of the HW or some
+         * low-level SW below to SHAI to ensure that the charging
+         * current is automatically reduced for the duration of chirp
+         * signalling.
+         *
+         * If the system supports this feature, the PSL shall set the
+         * corresponding bit in iCapabilities (by bitwise OR'ing this
+         * value). Otherwise the PSL shall clear the corresponding bit
+         * in iCapabilities.
+         */
+        static const TChargerDetectorCaps KChargerDetectorCapChirpCurrentLimiting = 0x00000001;
+
+        public:
+        /**
+         * Inline constructor for the Charger Detector properties
+         * object. This is inline rather than an exported function to
+         * prevent a binary break in a case where an older PSL binary
+         * might provide the constructor a smaller object due to the
+         * PSL being compiled against an older version of the SHAI
+         * header. When it's inline, the function is always in sync
+         * with the object size.
+         *
+         * We slightly violate the coding conventions which say that
+         * inline functions should be in their own file. We don't want
+         * to double the number of USB SHAI headers just for sake of a
+         * trivial constructor.
+         */
+        inline TChargerDetectorProperties() :
+            iCapabilities(0)
+            {
+            };
+
+        public: // Data
+        /**
+         * A bitmask specifying the static capabilities of this
+         * Charger Detector. The PSL fills this field by bitwise
+         * OR'ing the TChargerDetectorCaps capability bits
+         * corresponding to supported features.
+         */
+        TChargerDetectorCaps iCapabilities;
+        };
+
+    /**
+     * A static class implemented by the USB PIL layer to allow the
+     * PSL layer to register its charger detector component to the PIL
+     * layer.
+     */
+    NONSHARABLE_CLASS( UsbChargerDetectionPil )
+        {
+        public:
+        /**
+         * Registration function to be used by the USB PSL layer to
+         * register a charger detector component to the PIL layer. The
+         * PIL layer will set itself as the observer of the charger
+         * detector component to receive notification of detected USB
+         * chargers.
+         *
+         * The intended usage is that the component that implements
+         * USB charger detection registers itself to the USB PIL layer
+         * by making this call from their own kernel extension entry
+         * point function (or an equivalent code that runs during
+         * bootup).
+         *
+         * @param aChargerDetector Reference to the Charger Detector
+         *   interface implemented by the registering PSL.
+         *
+         * @param aProperties Reference to an object describing the
+         *   static properties of the Charger Detector. The PIL layer
+         *   requires that the supplied reference remains valid
+         *   indefinitely, as the registering Charger Detector cannot
+         *   unregister.
+         *
+         * @lib usbperipheralpil.lib
+         */
+        IMPORT_C static void RegisterChargerDetector( MChargerDetectorIf&         aChargerDetector,
+                                                      TChargerDetectorProperties& aProperties );
+        };
+    };
+
+#endif //USB_CHARGER_DETECTION_SHAI_H
+// END of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usb_plat/usb_shai_api/inc/usb_common_shai.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,92 @@
+/*
+* 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
+    @brief USB SHAI header for common types and constants
+    @version 0.2.0
+
+    This header specifies common types and constants used by both the
+    peripheral and host/OTG USB SHAIs. It is automatically included by
+    the USB Host and Peripheral SHAI headers and is not intended to be
+    directly included by SHAI implementations.
+
+    The file is versioned for the sake of the human reader, but a
+    compile-time constant to show the header version is not available,
+    as this header is not intended to be directly included by PSL
+    implementations. If a change in this header impacts the overall
+    USB SHAI interface (i.e. change other than documentation
+    improvements), the version of the impacted interfaces (USB Host
+    SHAI, USB OTG SHAI, and/or USB Peripheral SHAI) shall too be
+    changed to make the change visible to the PSL.
+
+    @publishedDeviceAbstraction
+*/
+
+
+#ifndef USB_COMMON_SHAI_H
+#define USB_COMMON_SHAI_H
+
+// System includes
+#include <kern_priv.h>
+
+/**
+ * @brief USB SHAI types and interfaces
+ *
+ * This namespace holds all USB SHAI related types, constants,
+ * classes, and functions.
+ */
+namespace UsbShai
+    {
+    // Data types
+
+    /**
+     * Enumeration specifying the available USB endpoint types.
+     */
+    enum TEndpointType
+        {
+        /** Endpoint type is control */
+        EEpTypeControl = 0,
+        
+        /** Endpoint type is bulk */
+        EEpTypeBulk,
+
+        /** Endpoint type is interrupt */
+        EEpTypeInterrupt,
+
+        /** Endpoint type is isochronous */
+        EEpTypeIsochronous
+        };
+
+    /**
+     * Enumeration specifying the available USB speeds.
+     */
+    enum TSpeed
+        {
+        /** The bus operates in low speed mode */
+        ELowSpeed = 0,
+            
+        /** The bus operates in full speed mode */
+        EFullSpeed,
+            
+        /** The bus operates in high speed mode */
+        EHighSpeed
+        };
+    };
+
+#endif // USB_COMMON_SHAI_H
+
+/* End of File */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usb_plat/usb_shai_api/inc/usb_host_shai.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,1290 @@
+/*
+* 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
+    @brief USB Host SHAI header
+    @version 0.2.0
+
+    This header specifies the USB host SHAI.
+
+    @publishedDeviceAbstraction
+*/
+
+
+#ifndef USB_HOST_SHAI_H
+#define USB_HOST_SHAI_H
+
+// System includes
+#include <kern_priv.h>
+#include <usb/usb_common_shai.h> // Common types shared between the USB SHAIs
+
+/**
+ * This macro specifies the version of the USB Host SHAI header in
+ * binary coded decimal format. This allows the PSL layer to confirm a
+ * certain definition is available, if needed. This can for example
+ * make it possible for a new PSL to support compilation in an older
+ * environment with old USB SHAI version that is missing some new
+ * definitions.
+ */
+#define USB_HOST_SHAI_VERSION 0x020
+
+// The namespace is documented in file usb_common_shai.h, so it is not
+// repeated here
+namespace UsbShai
+    {
+    // Forward declarations
+
+    class MHostControllerIf;
+    class MHostTransferCallbackIf;
+    class MRootHubCallbackIf;
+    class MRootHubIf;
+
+    // Data types
+
+    /**
+     * An enumeration listing the host role electrical test modes
+     * supported. These correspond to the test modes specified in
+     * Section "6.4.1.1 Test Modes" of the "On-The-Go and Embedded
+     * Host Supplement to the USB Revision 2.0 Specification" Revision
+     * 2.0 (a.k.a. USB OTG 2.0).
+     *
+     * @see MHostControllerIf::EnterHostTestMode()
+     */
+    enum THostTestMode
+        {
+        /**
+         * Drive SE0 until host controller is reset. The call returns
+         * immediately after enabling the test mode.
+         */
+        ETestModeTestSE0NAK = 0,
+
+        /**
+         * Drive high-speed J until host controller is reset. The call
+         * returns immediately after enabling the test mode.
+         */
+        ETestModeTestJ,
+
+        /**
+         * Drive high-speed K until host controller is reset. The call
+         * returns immediately after enabling the test mode.
+         */
+        ETestModeTestK,
+
+        /**
+         * Send test packets until host controller is reset. The
+         * format of the required test packet is specified in Section
+         * "7.1.20 Test Mode Support" of the USB 2.0 specification.
+         *
+         * The call returns immediately after enabling the test
+         * mode.
+         */
+        ETestModeTestPacket,
+
+        /**
+         * Suspend and resume the port with 15 second delays to allow
+         * the operator to adjust test tool settings. The Host
+         * Controller PSL must perform the following test steps:
+         *
+         * 1. Allow SOFs to continue for 15 seconds.
+         *
+         * 2. Suspend the port under test.
+         *
+         * 3. Wait for 15 seconds.
+         *
+         * 4. Resume the port under test.
+         *
+         * This test mode is synchronous, i.e. the call returns after
+         * the test has been completed.
+         */
+        ETestModeHsHostPortSuspendResume,
+
+        /**
+         * Perform a single-step GetDescriptor(Device) transfer.  This
+         * is called after the USB Host Stack has enumerated a device
+         * with VID=0x1A0A and PID=0x0107. The Host Controller PSL
+         * must perform the following test steps:
+         *
+         * 1. Allow SOFs to continue for 15 seconds.
+         *
+         * 2. Send a complete GetDescriptor(Device) transfer
+         *
+         * This test mode is synchronous, i.e. the call returns after
+         * the test has been completed.
+         */
+        ETestModeSingleStepGetDeviceDescriptor,
+
+        /**
+         * Perform a single-step GetDescriptor(Device) transfer with a
+         * delayed data phase. This is called after the USB Host Stack
+         * has enumerated a device with VID=0x1A0A and PID=0x0108. The
+         * Host Controller PSL must perform the following test steps:
+         *
+         * 1. Send the SETUP packet for GetDescriptor(Device). The
+         *    device ACKs the packet as usual.
+         *
+         * 2. Allow SOFs to continue for 15 seconds.
+         *
+         * 3. Send the IN token for the data phase of
+         *    GetDescriptor(Device). The device responds with
+         *    the data.
+         *
+         * 4. Send the acknowledgement (zero-length OUT data) in
+         *    response to the data.
+         *
+         * This test mode is synchronous, i.e. the call returns after
+         * the test has been completed.
+         */
+        ETestModeSingleStepGetDeviceDescriptorData
+        };
+
+
+    // Class declaration
+
+    /**
+     * This class specifies a memory block that is used for USB
+     * transfers. The memory pointers and the buffer length are filled
+     * by the USB Host stack before issuing the transfer to the Host
+     * Controller PSL.
+     */
+    NONSHARABLE_CLASS( TUsbMemoryBlock )
+        {
+        public:
+        /**
+         * Linear (virtual) start address of the memory buffer. This
+         * address is always provided.
+         */
+        TLinAddr iLinAddr;
+
+        /**
+         * Physical start address of the memory buffer. This address
+         * is always provided, but it is the responsibility of the
+         * Host Controller PSL to guarantee that the memory is
+         * physically contiguous, if contiguous memory is needed. The
+         * PSL can guarantee this by implementing
+         * MHostControllerIf::ChunkCreate() to allocate physically
+         * contiguous memory.
+         *
+         * @see MHostControllerIf::ChunkCreate()
+         */
+        TPhysAddr iPhysAddr;
+
+        /**
+         * Pointer to an array of physical addresses each pointing to
+         * one physical page of the memory block. This address is
+         * always provided.
+         *
+         * The size of each page matches the size reported in
+         * THostControllerProperties::iControllerPageSize by the Host
+         * Controller PSL when it registered to the PIL.
+         */
+        TPhysAddr* iPhysPages;
+
+        /** The length of the memory buffer in bytes */
+        TUint iLength;
+        };
+
+
+    /**
+     * This class specifies the enumerated types for different endpoint
+     * configuration items and specifies the structure of the endpoint
+     * configuration. Instances of this class are used to specify the
+     * endpoint information when opening a pipe.
+     *
+     * @see MHostControllerIf::OpenPipe()
+     */
+    NONSHARABLE_CLASS( THostPipe )
+        {
+        public:
+        // These are flag constants that specify the values that can
+        // be bitwise OR'ed to the endpoint flags field iEndpointFlags
+        // to indicate some boolean parameters of the endpoint
+
+        /**
+         * This flag specifies whether the targeted endpoint is behind
+         * a hub that is performing transaction translation. This
+         * occurs when the attached device is a low/full-speed device
+         * attached to a high-speed hub.
+         *
+         * When this flag is set, the iHubAddr and iHubPort members
+         * specify the hub address and the port to which the targeted
+         * device is connected, and the iEndpointFlags flag
+         * KHubHasMultipleTTs specifies whether the hub has been
+         * configured to use multiple transaction translators.
+         */
+        static const TUint32 KHubTranslates = 0x00000001;
+
+        /**
+         * When the iEndpointFlags flag KHubTranslates is set, this
+         * flag is set if the hub has multiple transaction
+         * translators.
+         */
+        static const TUint32 KHubHasMultipleTTs = 0x00000002;
+
+        public: // Data
+        /**
+         * The type of the endpoint (control, bulk, interrupt,
+         * isochronous)
+         */
+        TEndpointType iType;
+
+        /** Maximum packet size to be used on this endpoint */
+        TUint iMaxPacketSize;
+
+        /** Flags specifying some boolean parameters of the endpoint */
+        TUint32 iEndpointFlags;
+
+        /**
+         * The speed (low, full, high) to use for this endpoint. This
+         * may differ from the current speed of the local port if the
+         * targeted device is a low-speed or full-speed device
+         * connected to a high-speed hub.
+         */
+        TSpeed iSpeed;
+
+        /**
+         * The polling interval specified as number of frames or
+         * microframes, depending on the speed. This is used for
+         * interrupt and isochronous endpoints only.
+         */
+        TUint iPollingInterval;
+
+        /**
+         * The USB address of the remote device that we are
+         * communicating with
+         */
+        TUint8 iRemoteAddr;
+
+        /**
+         * The remote endpoint number that we are communicating
+         * with. This is the physical endpoint number in the USB 2.0
+         * descriptor format, i.e. the most significant bit indicates
+         * the direction (1 for IN, 0 for OUT), and the least
+         * significant bits indicate the endpoint number.
+         */
+        TUint8 iRemoteEpNum;
+
+        /**
+         * For cases where the attached device is a low/full-speed
+         * device attached to a high-speed hub that does the necessary
+         * transaction translation, this member records the address of
+         * the hub doing the translation.
+         */
+        TUint8 iHubAddr;
+
+        /**
+         * For cases where the attached device is a low/full-speed
+         * device attached to a high-speed hub that does the necessary
+         * transaction translation, this member records the number of
+         * the port where the device is connected on the hub that does
+         * the transaction translation.
+         */
+        TUint8 iHubPort;
+        };
+
+
+    /**
+     * This class specifies the structure of the endpoint transfer
+     * requests. The USB Host Stack passes the Host Controller PSL a
+     * reference to an object of this class when setting up a new transfer
+     * with MHostPipeIf::StartTransfer().
+     */
+    NONSHARABLE_CLASS( THostTransfer )
+        {
+        public:
+        // These are public constants that specify the values that can
+        // be bitwise OR'ed to the request flags field iRequestFlags
+        // to indicate some boolean parameters of the transfer
+
+        /**
+         * When set, specifies that the transfer direction is IN,
+         * i.e. the host is reading from the connected device. This is
+         * needed for endpoint zero, which is bi-directional and
+         * cannot implicitly know the direction of the transfer.
+         *
+         * This bit is set or cleared by the USB Host stack before
+         * issuing a new transfer.
+         */
+        static const TUint32 KTransferDirIsIN = 0x00000001;
+
+        /**
+         * For OUT endpoint transfers, indicates whether the Host
+         * Controller PSL is required to force a short packet at the
+         * end of the transfer.
+         *
+         * When the bit is set, the Host Controller PSL must send a
+         * ZLP (Zero-Length Packet) after the last packet of the
+         * transfer, if and only if the last packet was a full packet,
+         * i.e. had the same size as the maximum packet size for the
+         * endpoint.
+         *
+         * This bit is set or cleared by the USB Host stack before
+         * issuing a new transfer.
+         */
+        static const TUint32 KOutForceShortPacket = 0x00000002;
+
+        /**
+         * For IN endpoint transfers, indicates whether the transfer
+         * was terminated with a ZLP (Zero-Length Packet).
+         *
+         * This bit is set by the Host Controller PSL before
+         * completing the transfer if the transfer ended due to a
+         * ZLP. Otherwise the bit is cleared by the Host Controller
+         * PSL.
+         */
+        static const TUint32 KInZlpReceived = 0x00000004;
+
+        /**
+         * Enumeration specifying the packet status values to be used
+         * for isochronous transfers.
+         */
+        enum TIsocPacketStatus
+            {
+            /** No error has occurred, transfer succesful */
+            ESuccess = 0,
+
+            /**
+             * Data error has occurred in a data transfer, i.e. the
+             * CRC did not match
+             */
+            EDataError,
+
+            /** Overrun has occurred */
+            EOverrun,
+
+            /** Underrun has occurred */
+            EUnderrun,
+            };
+
+        public: // Data
+        /**
+         * Pointer to the information of the pipe that this transfer
+         * is being made on. This is the same information that was
+         * used when opening the pipe that the transfer is being made
+         * on.
+         */
+        THostPipe* iPipeInfo;
+
+        /**
+         * A pointer to the callback interface to be used for
+         * indicating the completion of the transfer. This is set by
+         * the USB Host Stack before making a transfer request.
+         */
+        MHostTransferCallbackIf* iTransferCbIf;
+
+        /**
+         * Request flags specifying some boolean parameters for the
+         * transfer.
+         */
+        TUint32 iRequestFlags;
+
+        /**
+         * Memory block specifying the memory buffer used for the data
+         * transfer. This is filled by the USB Host Stack before
+         * making a transfer request.
+         *
+         * The memory block used here will be part of a chunk
+         * previously created by a call to
+         * MHostControllerIf::ChunkCreate() and the block will
+         * fullfill the alignment requirements reported by the call to
+         * MHostControllerIf::GetSizeAndAlignment().
+         *
+         * For control transfers, this specifies the buffer for the
+         * data stage and has zero length and NULL pointers if the
+         * transaction does not include a data stage.
+         */
+        TUsbMemoryBlock iDataBuffer;
+
+        /**
+         * For control transfers, this memory block specifies the
+         * contents of the setup packet to be sent. For other than
+         * control transfers, it is not used, and it has zero length
+         * and NULL pointers.
+         */
+        TUsbMemoryBlock iSetupBuffer;
+
+        /**
+         * For isochronous transfers, this sets the number of
+         * isochronous packets to send/receive. This is set by the
+         * USB Host Stack before making a transfer request.
+         */
+        TInt iNumIsocPackets;
+
+        /**
+         * The number of bytes successfully transferred during the
+         * data transfer. This is set by the Host Controller PSL
+         * before completing the transfer.
+         */
+        TUint iTransferLength;
+
+        /**
+         * The status code of a completed transfer. This is set by the
+         * Host Controller PSL before completing the request to the
+         * transfer callback interface.
+         */
+        TInt iStatus;
+
+        /**
+         * For isochronous transfers, a pointer to an array of
+         * iNumIsoPackets entries that specify the length of each
+         * packet in the transfer. For OUT transfers, the array is
+         * filled by the USB Host Stack and is read by the Host
+         * Controller PSL to decide the length for each packet. For IN
+         * transfers, the array is filled by the Host Controller PSL
+         * to record to length of each received packet.
+         */
+        TUint16* iIsocPacketLengths;
+
+        /**
+         * For isochronous transfers, a pointer to an array of
+         * iNumIsoPackets entries that specify the status of each
+         * packet in the transfer. The array is filled by the Host
+         * Controller PSL to record to success or failure of each
+         * received packet.
+         */
+        TIsocPacketStatus* iIsocPacketStatuses;
+        };
+
+
+    /**
+     * This class specifies the structure and contents of root hub
+     * information that is filled by the adaptation to let the USB Host
+     * Stack hub driver learn the capabilities of the root hub.
+     *
+     * @see MHostControllerIf::OpenRootHub
+     */
+    NONSHARABLE_CLASS( TRootHubInfo )
+        {
+        public: // Types and constants
+        /**
+         * A bitmask type used to indicate the static capabilities of
+         * the root hub.
+         */
+        typedef TUint32 TRootHubCaps;
+
+        /**
+         * Capability bit to indicate whether the root hub supports
+         * user-visible port indications such as LEDs.
+         *
+         * If the root hub supports this feature, the PSL shall set
+         * the corresponding bit in iCapabilities (by bitwise OR'ing
+         * this value). Otherwise the PSL shall clear the
+         * corresponding bit in iCapabilities.
+         */
+        static const TRootHubCaps KRootHubCapPortIndication = 0x00000001;
+
+        public: // Data
+        /**
+         * A bitmask specifying the static capabilities of this root
+         * hub. The PSL fills this field by bitwise OR'ing the
+         * TRootHubCaps capability bits corresponding to supported
+         * features.
+         */
+        TRootHubCaps iCapabilities;
+
+        /** Number of ports in this root hub */
+        TUint iNumberOfPorts;
+
+        /**
+         * Maximum number of milliamps of current that this root hub
+         * can supply to VBUS.
+         */
+        TUint iMaxSuppliedVbusCurrentMA;
+
+        /**
+         * Time taken by this root hub between starting to power up a
+         * port and power being good on that port. This is expressed
+         * in units of one millisecond.
+         */
+        TUint iTimePowerOnToPowerGoodMs;
+
+        /**
+         * The maximum speed supported by the root hub.
+         */
+        TSpeed iMaxSpeed;
+
+        /** Pointer to the root hub interface */
+        MRootHubIf* iRootHubIf;
+        };
+
+
+    /**
+     * An interface class used by the USB Host Stack to perform data
+     * transfers on a USB pipe. The Host Controller PSL must implement
+     * this interface and provide a pointer to a pipe-specific
+     * instance when the USB Host Stack creates the pipe by calling
+     * MHostControllerIf::OpenPipe().
+     *
+     * The USB Host Stack will call the functions of this interface
+     * from a DFC queued on the DFC queue supplied by the Host
+     * Controller in THostControllerProperties::iControllerDfcQueue when the
+     * Host Controller PSL registered.
+     *
+     * @see MHostControllerIf::OpenPipe()
+     */
+    NONSHARABLE_CLASS( MHostPipeIf )
+        {
+        public:
+        /**
+         * Close the USB pipe. This is called by the USB Host Stack
+         * when the pipe is no longer used and the Host Controller PSL
+         * may release any resources that were allocated for this
+         * instance, including deleting the object itself.
+         *
+         * @param aPipeInfo Information describing the target endpoint
+         *   of the pipe. This is the same information passed to
+         *   MHostControllerIf::OpenPipe() when creating the
+         *   pipe.
+         *
+         * @post After calling the function, the USB Host stack will
+         *   consider the invoked instance to have been deleted and will
+         *   no longer call any of the functions.
+         */
+        virtual void ClosePipeD( const THostPipe& aPipeInfo ) = 0;
+
+        /**
+         * Clear the data toggle bit of this pipe. This is used for
+         * interrupt and bulk pipes when the host stack needs to
+         * guarantee that the host controller will start the next
+         * interrupt or bulk transfer with data toggle value zero.
+         *
+         * @param aPipeInfo Information describing the target endpoint
+         *   of the pipe. This is the same information passed to
+         *   MHostControllerIf::OpenPipe() when creating the
+         *   pipe.
+         */
+        virtual void ClearDataToggle( const THostPipe& aPipeInfo ) = 0;
+
+        /**
+         * Start a transfer on this pipe.
+         *
+         * When the transfer is considered completed, the Host
+         * Controller PSL must update the transfer information object
+         * with the actual length and status of the transfer and then
+         * complete it to the callback interface by calling
+         * MHostTransferCallbackIf::CompleteTransfer(). The pointer to
+         * the callback interface is provided in the member
+         * THostTransfer::iTransferCbIf of the supplied aTransferInfo.
+         *
+         * The following rules shall be used by the Host Controller
+         * PSL to assess the completeness of a transfer:
+         *
+         * 1. A read or write transfer on a control pipe is completed
+         * when all the stages (two or three) of the control transfer
+         * have been completed successfully, or when an error
+         * occurs. It is the responsibility of the upper layers to
+         * guarantee that there is sufficient buffer space for a read
+         * request, so the buffer should not run out.
+         *
+         * 2. A read or write transfer on an isochronous pipe is
+         * completed when the number of isochronous packets specified
+         * in the member THostTransfer::iNumIsocPackets of the
+         * supplied aTransferInfo have been sent or received
+         * successfully, or if a fatal error occurs. It is the
+         * responsibility of the upper layers to guarantee that there
+         * is sufficient buffer space for a read request, so the
+         * buffer should not run out.
+         *
+         * 3. A read transfer on a bulk or interrupt pipe is completed
+         * when the buffer space is exhausted, a short packet (a
+         * packet smaller than the maximum packet size of the pipe) is
+         * received, or an error occurs.
+         *
+         * 4. A write transfer on a bulk or interrupt pipe is
+         * completed when the requested buffer has been fully sent, or
+         * an error occurs.
+         *
+         * @param aTransferInfo Information specifying the transfer to perform
+         *
+         * @return KErrNone if the transfer was started successfully,
+         *   otherwise a system-wide error code
+         */
+        virtual TInt StartTransfer( THostTransfer& aTransferInfo ) = 0;
+
+        /**
+         * Cancel a transfer that was previously started with
+         * StartTransfer(). The Host Controller PSL must flush any
+         * pending data (either received or about to be sent) and
+         * discard the transfer. The PSL must not attempt to complete
+         * the canceled transfer by calling
+         * MHostTransferCallbackIf::CompleteTransfer().
+         *
+         * @param aTransferInfo Information specifying the transfer to
+         *   cancel. This is the same information passed to
+         *   StartTransfer() when the transfer as started.
+         */
+        virtual void CancelTransfer( THostTransfer& aTransferInfo ) = 0;
+        };
+
+
+    /**
+     * An interface class used by the USB Host Stack hub driver to
+     * operate on the root hub ports. The Host Controller PSL must
+     * implement this interface and provide a pointer when the USB
+     * Host Stack opens the root hub by calling
+     * MHostControllerIf::OpenRootHub().
+     *
+     * The USB Host Stack will call the functions of this interface
+     * from a DFC queued on the DFC queue supplied by the Host
+     * Controller in THostControllerProperties::iControllerDfcQueue
+     * when the Host Controller PSL registered.
+     *
+     * @see MHostControllerIf::OpenRootHub()
+     */
+    NONSHARABLE_CLASS( MRootHubIf )
+        {
+        public:
+        /**
+         * Close the connection to the root hub. This is called by the
+         * USB Host Stack when the Host Controller is about to be
+         * deleted and the root hub is no longer used. The Host
+         * Controller PSL may release any resources that were
+         * allocated for this instance, including deleting the object
+         * itself.
+         *
+         * @post After calling the function, the USB Host stack will
+         *   consider the invoked instance to have been deleted and will
+         *   no longer call any of the functions.
+         */
+        virtual void CloseRootHubD() = 0;
+
+        /**
+         * Enable the power supply, i.e. raise VBUS, on the specified
+         * root hub port.
+         *
+         * If there are problems raising VBUS, the Host Controller PSL
+         * must report a VBUS error by notifying the root hub callback
+         * interface MRootHubCallbackIf of an over-current condition
+         * on the port.
+         *
+         * @param aPort The number of the root hub port to operate
+         *   on. For a root hub with N ports, the port numbers are in
+         *   range [1..N].
+         *
+         * @see MRootHubCallbackIf::OverCurrentDetected()
+         */
+        virtual void PowerOnPort( TUint aPort ) = 0;
+
+        /**
+         * Stop session (A-device only).
+         *
+         * @param aPort The number of the root hub port to operate
+         *   on. For a root hub with N ports, the port numbers are in
+         *   range [1..N].
+         */
+        virtual void PowerOffPort( TUint aPort ) = 0;
+
+        /**
+         * Reset the specified root hub port. The total reset length
+         * has to be at least 50 milliseconds and the reset signalling
+         * must follow the requirements specified in USB 2.0
+         * Specification Section 7.1.7.5 Reset Signaling.
+         *
+         * This function is synchronous and should return when the
+         * reset signalling on the port has completed.
+         *
+         * @param aPort The number of the root hub port to operate
+         *   on. For a root hub with N ports, the port numbers are in
+         *   range [1..N].
+         */
+        virtual void ResetPort( TUint aPort ) = 0;
+
+        /**
+         * Place the specified root hub port to the USB suspend state
+         * where it does not send SOF packets to the connected device.
+         *
+         * When all ports of the root hub have been suspended, the USB
+         * Host Stack will suspend the entire host controller by
+         * calling MHostControllerIf::SuspendController().
+         *
+         * When the root hub only has one port and SOFs cannot be
+         * gated on the port without suspending the whole controller,
+         * the Host Controller PSL should ignore the port-specific
+         * suspend and resume calls and instead suspend/resume the
+         * controller based on the controller-specific suspend and
+         * resume calls in MHostControllerIf.
+         *
+         * @param aPort The number of the root hub port to operate
+         *   on. For a root hub with N ports, the port numbers are in
+         *   range [1..N].
+         */
+        virtual void SuspendPort( TUint aPort ) = 0;
+
+        /**
+         * Resume the specified root hub port from the USB suspend
+         * state by driving the resume signalling on the port. The
+         * signalling must last at least 20 milliseconds and follow
+         * the requirements specified in USB 2.0 Specification Section
+         * 7.1.7.7 Resume Signaling. After the resume signalling has
+         * completed, the port must allow SOFs to be sent to the
+         * connected device again.
+         *
+         * Before resuming the first port of a completely suspended
+         * controller, the USB Host Stack will first resume the entire
+         * host controller by calling
+         * MHostControllerIf::ResumeController().
+         *
+         * When the root hub only has one port and SOFs cannot be
+         * gated on the port without suspending the whole controller,
+         * the Host Controller PSL should ignore the port-specific
+         * suspend and resume calls and instead suspend/resume the
+         * controller based on the controller-specific suspend and
+         * resume calls in MHostControllerIf.
+         *
+         * @param aPort The number of the root hub port to operate
+         *   on. For a root hub with N ports, the port numbers are in
+         *   range [1..N].
+         */
+        virtual void ResumePort( TUint aPort ) = 0;
+
+        /**
+         * Query whether a device (a hub or a function) is currently
+         * connected to the specified root hub port, and what speed it
+         * is.
+         *
+         * @param aPort The number of the root hub port to check for a
+         *   connected device on. For a root hub with N ports, the port
+         *   numbers are in range [1..N].
+         *
+         * @param aSpeed Variable to fill with the speed, if connected
+         *
+         * @return ETrue if a device is currently connected and aSpeed
+         *   has been set to the speed of the connected device. EFalse
+         *   otherwise.
+         */
+        virtual TBool IsDeviceConnected( TUint   aPort,
+                                         TSpeed& aSpeed ) = 0;
+        };
+
+
+    /**
+     * An interface class that needs to be implemented by each Host
+     * Controller PSL that registers to the USB stack.
+     *
+     * This interface is used by the USB Host Stack to do controller level
+     * operations like suspending and resuming the host controller. It is
+     * also used to open the root hub interface upon creating the SHAI
+     * Host Controller, and to open USB pipes to connected devices.
+     *
+     * The USB Host Stack will call the functions of this interface
+     * from a DFC queued on the DFC queue supplied by the Host
+     * Controller in THostControllerProperties::iControllerDfcQueue when the
+     * Host Controller PSL registered.
+     */
+    NONSHARABLE_CLASS( MHostControllerIf )
+        {
+        public:
+        /**
+         * Open a pipe to an endpoint on a remote USB peripheral.
+         *
+         * This function is called by the USB host stack when it wants
+         * to communicate with a certain endpoint on a discovered USB
+         * peripheral. The opened pipe is then used to read or write
+         * from/to the peripheral until the pipe is later closed by
+         * MHostPipeIf::ClosePipeD().
+         *
+         * @param aPipeInfo Information describing the target endpoint
+         *   that the USB host stack wants to create a pipe to. The
+         *   ownership of the info object remains with the USB host
+         *   stack and the Host Controller PSL must not refer to data
+         *   inside this after the function has returned. All
+         *   MHostPipeIf functions that operate on the pipe will be
+         *   passed the same pipe information so that the Host
+         *   Controller PSL does not necessarily need to take a copy.
+         *
+         * @param aPipe Upon success, set by the Host Controller PSL
+         *   to point to an instance that implements the SHAI pipe
+         *   interface for the opened pipe. This interface will then be
+         *   used by the USB Host Stack to perform transfers until the
+         *   pipe is eventually closed by the USB Host Stack calling
+         *   MHostPipeIf::ClosePipeD().
+         *
+         * @return KErrNone if successful, otherwise a system error code
+         */
+        virtual TInt OpenPipe( const THostPipe& aPipeInfo,
+                               MHostPipeIf*&    aPipe ) = 0;
+
+        /**
+         * Open the root hub for the Host Controller.
+         *
+         * This is called by the USB Host Stack after creating the
+         * Host Controller PSL to learn the capabilities of the
+         * respective root hub and to establish the communication
+         * between the hub driver in the USB Host Stack and the root
+         * hub ports controlled by the Host Controller PSL.
+         *
+         * @param aRootHubInfo Reference to a root hub information
+         *   object to be filled by the adaptation.
+         *
+         * @param aRootHubCbIf Reference to the callback interface of
+         *   the root hub driver in the USB stack. The root hub
+         *   implementation of the Host Controller PSL shall use this
+         *   interface to report events of this root hub.
+         *
+         * @return KErrNone if successful, otherwise a system error code
+         */
+        virtual TInt OpenRootHub( TRootHubInfo&       aRootHubInfo,
+                                  MRootHubCallbackIf& aRootHubCbIf ) = 0;
+
+        /**
+         * Start and enable the host controller. This is called prior
+         * to powering up any port of the root hub to allow to Host
+         * Controller PSL to perform any preparation that may be
+         * necessary to activate the controller. This may include
+         * actions such as enabling clocks or power to the host
+         * controller HW.
+         *
+         * This function is also used in an OTG environment when the
+         * host stack becomes enabled and the controller needs to be
+         * started and enabled for host use. If the HW platform shares
+         * resources such as clocks and power between the host and
+         * peripheral HW, it is probably easiest for the PSL to handle
+         * the role switch based on the
+         * MOtgControllerIf::SetControllerRole() call to the OTG
+         * Controller interface.
+         *
+         * @return KErrNone if the host controller was successfully started,
+         *         otherwise a system-wide error code.
+         *
+         * @see usb_otg_shai.h, MOtgControllerIf::SetControllerRole()
+         */
+        virtual TInt StartHostController() = 0;
+
+        /**
+         * Disable and stop the host controller. This is called after
+         * powering down all ports of the root hub to allow to Host
+         * Controller PSL to release any HW resources needed by the
+         * controller. This may include actions such as disabling
+         * clocks or power to the host controller HW.
+         *
+         * This function is also used in an OTG environment when the
+         * host stack becomes disabled and the host HW resources can
+         * be released. If the HW platform shares resources such as
+         * clocks and power between the host and peripheral HW, it is
+         * probably easiest for the PSL to handle the role switch
+         * based on the MOtgControllerIf::SetControllerRole() call to
+         * the OTG Controller interface.
+         *
+         * @return KErrNone if the host controller was successfully started,
+         *         otherwise a system-wide error code.
+         *
+         * @see usb_otg_shai.h, MOtgControllerIf::SetControllerRole()
+         */
+        virtual TInt StopHostController() = 0;
+        
+        /**
+         * Place the host controller to the USB suspend state where it
+         * does not send SOF packets.
+         */
+        virtual void SuspendController() = 0;
+
+        /**
+         * Resume the host controller from the USB suspend state by
+         * driving the resume signalling towards the root hub. The
+         * signalling must last at least 20 milliseconds and follow
+         * the requirements specified in USB 2.0 Specification Section
+         * 7.1.7.7 Resume Signaling. After the resume signalling has
+         * completed, the controller must allow SOFs to be sent to the
+         * connected device again.
+         */
+        virtual void ResumeController() = 0;
+
+        /**
+         * Force the controller into a specific high-speed host test
+         * mode. This function needs to be implemented only by Host
+         * Controller PSLs for high-speed capable controllers. The
+         * function will only be called when the controller is
+         * operating in high-speed mode and a special test device has
+         * been enumerated.
+         *
+         * When called, the Host Controller PSL shall synchronously
+         * run the selected test as specified for each tests in the
+         * documentation of THostTestMode.
+         *
+         * @param aTestMode Specifies the test mode to enter
+         *
+         * @param aDefaultPipe Information of the default pipe (the
+         *   control pipe to endpoint zero) of the connected test
+         *   device.
+         *
+         * @return KErrNone if the specified test mode was entered
+         *   successfully, otherwise a system-wide error
+         */
+        virtual TInt EnterHostTestMode( THostTestMode    aTestMode,
+                                        const THostPipe& aDefaultPipe ) = 0;
+
+        /**
+         * Get the size and alignment requirements for the Host
+         * Controller. The reference parameters are both input and
+         * output. Upon input, they describe the values requested by
+         * the client, but they may be increased by this function if
+         * the Host Controller requires additional memory or has some
+         * alignment requirements.
+         *
+         * @param aType The type of the endpoint that the memory will
+         *   be used for.
+         *
+         * @param aAlignment Output for required alignment in bytes
+         *
+         * @param aSize Input/output for buffer size (may be increased
+         *   in this function)
+         *
+         * @param aMaxPackets Input/output for maximum number of
+         *   packets in the transfer (may be increased in this function)
+         *
+         * @return KErrNone if successful, otherwise a system-wide
+         *   error code
+         */
+        virtual TInt GetSizeAndAlignment( TEndpointType aType,
+                                          TUint&        aAlignment,
+                                          TInt&         aSize,
+                                          TInt&         aMaxPackets ) = 0;
+
+        /**
+         * Creates a shared chunk and commits memory to it. The memory
+         * allocated with this function will later be used when making
+         * data transfers with this Host Controller (see
+         * THostTransfer::iDataBuffer).
+         *
+         * The adaptation shall create a chunk by calling
+         * Kern::ChunkCreate(), and then commit memory to it with one
+         * of the Commit functions Kern::ChunkCommit(),
+         * Kern::ChunkCommitContiguous(), and Kern::ChunkCommitPhysical().
+         *
+         * This task is delegated to the adaptation so that it can
+         * allocate the correct type of memory. For example, if the
+         * Host Controller requires the memory to be physically
+         * contiguous, the implementation of this function must commit
+         * contiguous memory to the chunk.
+         *
+         * @param aChunk Output handle to the chunk that was created.
+         *   The adaptation must pass this value as the aChunk argument
+         *   to the Kern::ChunkCreate() call.
+         *
+         * @param aOffset The offset (in bytes) from start of chunk,
+         *   which indicates the start of the memory region to be
+         *   committed. This will be a multiple of the MMU page
+         *   size. The adaptation must pass this value as the aOffset
+         *   argument to the used Commit call.
+         *
+         * @param aSize Number of bytes to commit. This will be a
+         *   multiple of the MMU page size. The adaptation must pass
+         *   this value as the aSize argument to the used Commit call.
+         *
+         * @param aInfo At input, specifies the chunk properties
+         *   requested by the upper layers. The adaptation is allowed
+         *   to change the attributes in aInfo.iMapAttr to match the
+         *   requirements of the Host Controller. The adaptation must
+         *   pass this value as the aInfo argument to the
+         *   Kern::ChunkCreate() call. If the adaptation commits
+         *   cached memory, it is the responsibility of the adaptation
+         *   to deal with cache synchronization when making data
+         *   transfers. If the adaptation needs special cleanup when
+         *   the chunk is deleted, the adaptation can set a cleanup
+         *   DFC pointer in aInfo.iDestroyedDfc.
+         *
+         * @param aPhysicalAddress On success, will be set to the
+         *   physical address of the chunk as referenced by the HC
+         *
+         * @return KErrNone if successful, otherwise a system-wide
+         *   error code
+         *
+         * @see System documentation for Kern::ChunkCreate(),
+         *   Kern::ChunkCommit(), Kern::ChunkCommitContiguous(), and
+         *   Kern::ChunkCommitPhysical()
+         */
+        virtual TInt ChunkCreate( DChunk*&          aChunk,
+                                  TUint             aOffset,
+                                  TUint             aSize,
+                                  TChunkCreateInfo& aInfo,
+                                  TPhysAddr&        aPhysicalAddress ) = 0;
+
+        /**
+         * Maps virtual to physical addresses. If the memory addresses
+         * used by the host controller are different to the ones of
+         * the main memory bus (e.g. due to memory mapping or use of
+         * different address spaces), this method is used to translate
+         * from kernel physical addresses to host controller physical
+         * addresses.
+         *
+         * @param aPhysicalAddressList On entering, the list of
+         *   physical addresses as used kernel-side, on successful
+         *   return it contains the list of physical addresses as
+         *   referenced by the HC
+         *
+         * @param aPhysicalAddressListSize Number of elements in
+         *   aPhysicalAddressList
+         *
+         * @return KErrNone if successful, otherwise a system-wide
+         *   error code
+         */
+        virtual TInt MapPhysicalAddresses( TPhysAddr*& aPhysicalAddressList, 
+                                           TInt        aPhysicalAddressListSize ) = 0;
+        };
+
+
+    /**
+     * An interface class implemented by the USB stack to allow the
+     * host controller to report events to the root hub. This includes
+     * notifications of a device being connected or disconnected on a
+     * port, and other port conditions such as seeing a remote wakeup
+     * signalling, an error on the port (such as babble from a
+     * peripheral), or VBUS over-current.
+     *
+     * It is required that the Host Controller PSL calls these
+     * functions in the context of the DFC queue supplied by the Host
+     * Controller PSL in
+     * THostControllerProperties::iControllerDfcQueue when the Host
+     * Controller PSL registered.
+     */
+    NONSHARABLE_CLASS( MRootHubCallbackIf )
+        {
+        public:
+        /**
+         * A constant to specify an unknown port. In those port
+         * notifications where this is explicitly specified to be OK,
+         * this value is allowed to be used as the port number where
+         * the real port number is unknown.
+         */
+        static const TUint KPortUnknown = 0;
+
+        /**
+         * Informs the root hub that a device (a hub or function) has
+         * been connected to the specified root hub port.
+         *
+         * The Host Controller PSL uses this function to inform device
+         * connection also during HNP role switch when the remote
+         * device connects in peripheral role.
+         *
+         * @param aPort The number of the root hub port that the event
+         *   occurred on. For a root hub with N ports, the port numbers
+         *   are in range [1..N].
+         */
+        virtual void DeviceConnected( TUint aPort ) = 0;
+
+        /**
+         * Informs the root hub that a device (a hub or function) has
+         * been disconnected from the specified root hub port.
+         *
+         * The Host Controller PSL uses this function to inform device
+         * disconnection also during HNP role switch when the remote
+         * peripheral disconnects to start the role switch.
+         *
+         * The Host Controller PSL must report device disconnection by
+         * calling this function even if the port is currently
+         * suspended. A disconnection that is part of an HNP role
+         * switch will always occur in suspended state, and even a
+         * normal peripheral may be physically disconnected at any
+         * time.
+         *
+         * @param aPort The number of the root hub port that the event
+         *   occurred on. For a root hub with N ports, the port numbers
+         *   are in range [1..N].
+         */
+        virtual void DeviceDisconnected( TUint aPort ) = 0;
+
+        /**
+         * Informs the root hub that a device connected to the
+         * specified root hub port has requested remote wakeup.
+         *
+         * @param aPort The number of the root hub port that the event
+         *   occurred on. For a root hub with N ports, the port numbers
+         *   are in range [1..N].
+         */
+        virtual void RemoteWakeupRequested( TUint aPort ) = 0;
+
+        /**
+         * Informs the root hub that a port error (such as babble) has
+         * been detected on the specified root hub port. The
+         * adaptation is expected to disable the port that has caused
+         * the error condition.
+         *
+         * @param aPort The number of the root hub port that the event
+         *   occurred on. For a root hub with N ports, the port numbers
+         *   are in range [1..N].
+         */
+        virtual void PortErrorDetected( TUint aPort ) = 0;
+
+        /**
+         * Informs the root hub that an over-current condition has
+         * been detected on the specified port.
+         *
+         * It may not always be possible to see which port out of
+         * several caused the overcurrent. In this case the Host
+         * Controller PSL may use the port number
+         * MRootHubCallbackIf::KPortUnknown.
+         *
+         * @param aPort The number of the root hub port that the event
+         *   occurred on, if known. For a root hub with N ports, the
+         *   port numbers are in range [1..N]. If the exact port is
+         *   not known, the Host Controller PSL root hub may report
+         *   the port number MRootHubCallbackIf::KPortUnknown.
+         */
+        virtual void OverCurrentDetected( TUint aPort ) = 0;
+        };
+
+
+    /**
+     * An interface class implemented by the USB Host Stack to allow the
+     * host controller to complete transfers to the USB Host Stack.
+     *
+     * It is required that the Host Controller PSL calls these
+     * functions in the context of the DFC queue supplied by the Host
+     * Controller PSL in THostControllerProperties::iControllerDfcQueue when
+     * the Host Controller PSL registered.
+     */
+    NONSHARABLE_CLASS( MHostTransferCallbackIf )
+        {
+        public:
+        /**
+         * Complete a transfer request that had been set up with
+         * MHostPipeIf::StartTransfer().
+         *
+         * @param aTransferInfo The transfer information that
+         *   identifies the transfer that has completed
+         */
+        virtual void CompleteTransfer( const THostTransfer& aTransferInfo ) = 0;
+        };
+
+
+    /**
+     * This class specifies the static information provided by a Host
+     * Controller PSL when registering to the USB Host stack.
+     *
+     * The PSL should prepare for the possibility that members may be
+     * added to the end of this class in later SHAI versions if new
+     * information is needed to support new features. The PSL should
+     * not use this class as a direct member in an object that is not
+     * allowed to grow in size due to binary compatibility reasons.
+     *
+     * @see UsbHostPil::RegisterHostController()
+     */
+    NONSHARABLE_CLASS( THostControllerProperties )
+        {
+        public: // Types and constants
+        /**
+         * A bitmask type used to indicate the static capabilities of
+         * the Host Controller.
+         */
+        typedef TUint32 THostCaps;
+
+        public:
+        /**
+         * Inline constructor for the Host Controller properties
+         * object. This is inline rather than an exported function to
+         * prevent a binary break in a case where an older PSL binary
+         * might provide the constructor a smaller object due to the
+         * PSL being compiled against an older version of the SHAI
+         * header. When it's inline, the function is always in sync
+         * with the object size.
+         *
+         * We slightly violate the coding conventions which say that
+         * inline functions should be in their own file. We don't want
+         * to double the number of USB SHAI headers just for sake of a
+         * trivial constructor.
+         */
+        inline THostControllerProperties() :
+            iCapabilities(0),
+            iControllerDfcQueue(NULL),
+            iControllerPageSize(0)
+            {
+            };
+
+        public: // Data
+        /**
+         * A bitmask specifying the static capabilities of this Host
+         * Controller. No capabilities are specified at the moment and
+         * the PSL shall fill this field with a zero value.
+         *
+         * The field is added for sake of future proofing the binary
+         * compatibility of the Host SHAI. By having a field reserved
+         * for capability bits, we can later specify bits to indicate
+         * added virtual functions or extension to this controller
+         * properties structure. The PIL layer can then at runtime
+         * confirm the existence of the new functions or fields and
+         * safely support an older binary, if we choose to.
+         */
+        THostCaps iCapabilities;
+
+        /**
+         * Pointer to a DFC queue that will be used for DFCs of this
+         * controller.
+         *
+         * A stand-alone (one not associated with an OTG-port) Host
+         * Controller PSL must supply a pointer to a dedicated DFC
+         * queue that has been created for this controller. Both the
+         * PSL itself and the PIL layer must queue their DFCs for this
+         * controller in this DFC queue to ensure the code is running
+         * in the same context.
+         *
+         * A Host Controller PSL that is part of an OTG port will be
+         * registered by the OTG PSL. In this case, the DFC queue
+         * supplied here must be the same DFC queue as the one
+         * supplied in the properties of the OTG Controller.
+         */
+        TDfcQue* iControllerDfcQueue;
+
+        /**
+         * The page size used by this Host Controller. The host stack
+         * will fill scatter-gather lists with pages of this size. If
+         * the Host Controller does not have specific page
+         * requirements itself, the registering Host Controller PSL
+         * must supply here the CPU MMU page size that can be obtained
+         * by the call Kern::RoundToPageSize(1).
+         */
+        TInt iControllerPageSize;
+        };
+
+
+    /**
+     * A static class implemented by the USB Host PIL layer to allow
+     * the host controller PSL to register to the PIL layer.
+     */
+    NONSHARABLE_CLASS( UsbHostPil )
+        {
+        public:
+        /**
+         * Registration function to be used by a stand-alone (non-OTG
+         * port) Host Controller PSL to register itself to the PIL
+         * layer. Host Controllers that are part of an OTG-port are
+         * registered by the OTG Controller PSL (see usb_otg_shai.h,
+         * function UsbOtgPil::RegisterOtgController).
+         *
+         * The intended usage is that each stand-alone Host Controller
+         * PSL is a kernel extension that registers itself to the USB
+         * Host PIL layer by making this call from their own kernel
+         * extension entry point function (or an equivalent code that
+         * runs during bootup).
+         *
+         * @param aHostControllerIf Reference to the Host Controller
+         *   interface implemented by the registering PSL.
+         *
+         * @param aProperties Reference to an object describing the
+         *   static properties of the Host Controller. The PIL layer
+         *   requires that the supplied reference remains valid
+         *   indefinitely, as a Host Controller cannot unregister.
+         *
+         * @lib usbotghostpil.lib
+         */
+        IMPORT_C static void RegisterHostController(
+            MHostControllerIf&               aHostControllerIf,
+            const THostControllerProperties& aProperties );
+        };
+    };
+
+#endif // USB_HOST_SHAI_H
+
+/* End of File */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usb_plat/usb_shai_api/inc/usb_otg_shai.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,626 @@
+/*
+* 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
+    @brief USB OTG SHAI header
+    @version 0.2.0
+
+    This header specifies the USB OTG SHAI.
+
+    @publishedDeviceAbstraction
+*/
+
+
+#ifndef USB_OTG_SHAI_H
+#define USB_OTG_SHAI_H
+
+// System includes
+#include <kern_priv.h>
+#include <usb/usb_common_shai.h> // Common types shared between the USB SHAIs
+
+/**
+ * This macro specifies the version of the USB OTG SHAI header in
+ * binary coded decimal format. This allows the PSL layer to confirm a
+ * certain definition is available, if needed. This can for example
+ * make it possible for a new PSL to support compilation in an older
+ * environment with old USB SHAI version that is missing some new
+ * definitions.
+ */
+#define USB_OTG_SHAI_VERSION 0x020
+
+// The namespace is documented in file usb_common_shai.h, so it is not
+// repeated here
+namespace UsbShai
+    {
+    // Forward declarations
+
+    class MOtgControllerIf;
+    class MOtgObserverIf;
+    class MPeripheralControllerIf;
+    class TPeripheralControllerProperties;
+    class MHostControllerIf;
+    class THostControllerProperties;
+
+    // Data types
+
+    /**
+     * Enumeration listing the possible states of the ID pin. Due to a
+     * dependency between OTG and USB Battery Charging, this
+     * enumeration lists also the special states introduced as part of
+     * the Battery Charging Specification version 1.1.
+     *
+     * An OTG Controller PSL for a system that does not support
+     * Accessory Charger Adapter (ACA) will always report only
+     * EIdStateRidFloat or EIdStateRidGnd. An OTG Controller PSL that
+     * supports ACA is required to report the ID pin state accurately
+     * in order for the OTG State Machine to understand why VBUS
+     * appears high even though we should default to the host role and
+     * should normally drive VBUS ourselves (in case of RID_A).
+     *
+     * Reporting an ACA state via the ID pin notification mechanism is
+     * not a substitute for reporting port type detection via the USB
+     * Charger Detection SHAI that is documented separately in
+     * usb_charger_detection_shai.h. When ACA is supported, it is
+     * required that the Charger Detector PSL guarantees that the OTG
+     * Observer gets notified of the ID pin state before reporting the
+     * port type to the Charger Detector Observer.
+     *
+     * @see usb_charger_detection_shai.h
+     */
+    enum TIdPinState
+        {
+        /** ID pin is grounded */
+        EIdStateRidGnd = 0,
+
+        /** ID pin is floating */
+        EIdStateRidFloat,
+
+        /**
+         * ID pin is in the RID_A range, as specified in Battery
+         * Charging 1.1 specification
+         */
+        EIdStateRidA,
+
+        /**
+         * ID pin is in the RID_B range, as specified in Battery
+         * Charging 1.1 specification
+         */
+        EIdStateRidB,
+
+        /**
+         * ID pin is in the RID_C range, as specified in Battery
+         * Charging 1.1 specification
+         */
+        EIdStateRidC
+        };
+
+    /**
+     * Enumeration listing the reported states of VBUS on the OTG
+     * port.
+     *
+     * The threshold for Session Valid comparison is VOTG_SESS_VLD as
+     * defined in the "On-The-Go and Embedded Host Supplement to the
+     * USB Revision 2.0 Specification", Table 4-1 Electrical
+     * Characteristics. The voltage level for a compliant
+     * implementation can be anywhere between 0.8 V and 4.0 V.
+     */
+    enum TVbusState
+        {
+        /** VBUS is below the OTG Session Valid threshold */
+        EVbusStateNoSession = 0,
+
+        /**
+         * VBUS is above the OTG Session Valid threshold, but below
+         * the requirements of AVbusValid.
+         */
+        EVbusStateSessionValid,
+
+        /**
+         * When operating as the A-device and driving VBUS, indicates
+         * that the VBUS is in regulation, as defined in "On-The-Go
+         * and Embedded Host Supplement to the USB Revision 2.0
+         * Specification" Section 4.2.1, "VBUS Output Voltage and
+         * Current".
+         *
+         * When a VBUS session has been started as the A-device, the
+         * OTG Controller PSL is required to report a VBUS level of
+         * EVbusStateAVbusValid when VBUS has successfully risen to
+         * allow the OTG State Machine to transition out of the
+         * a_wait_vrise state.
+         *
+         * After VBUS has been successfully raised when operating as
+         * the A-device, the PSL reporting a VBUS level less than
+         * EVbusStateAVbusValid is considered as a report of a VBUS
+         * error (over-current) situation and will result in ending
+         * the session immediately.
+         */
+        EVbusStateAVbusValid
+        };
+
+    /**
+     * Enumeration listing the state of the OTG 2.0 state machine.
+     *
+     * The states match those defined in the "On-The-Go and Embedded
+     * Host Supplement to the USB Revision 2.0 Specification" for the
+     * OTG A-device and B-device states.
+     */
+    enum TOtgState
+        {
+        /** The OTG state is b_idle */
+        EOtgStateBIdle = 0,
+
+        /** The OTG state is b_peripheral */
+        EOtgStateBPeripheral,
+
+        /** The OTG state is b_wait_acon */
+        EOtgStateBWaitAcon,
+
+        /** The OTG state is b_host */
+        EOtgStateBHost,
+
+        /** The OTG state is a_idle */
+        EOtgStateAIdle,
+
+        /** The OTG state is a_wait_vrise */
+        EOtgStateAWaitVrise,
+
+        /** The OTG state is a_wait_bcon */
+        EOtgStateAWaitBcon,
+
+        /** The OTG state is a_host */
+        EOtgStateAHost,
+
+        /** The OTG state is a_suspend */
+        EOtgStateASuspend,
+
+        /** The OTG state is a_peripheral */
+        EOtgStateAPeripheral,
+
+        /** The OTG state is a_wait_vfall */
+        EOtgStateAWaitVfall,
+
+        /** The OTG state is a_vbus_err */
+        EOtgStateAVbusErr
+        };
+
+    /**
+     * Enumeration listing the roles that our device can be in.
+     */
+    enum TOtgRole
+        {
+        /**
+         * Our device is idle, i.e. we are not operating in either the
+         * peripheral or the host role. This role indicates that
+         * neither the host controller nor the peripheral controller
+         * needs to be activated and the PSL is free to power down the
+         * controllers.
+         */
+        EOtgRoleIdle = 0,
+
+        /** Our device is operating in the peripheral role */
+        EOtgRolePeripheral,
+    
+        /** Our device is operating in the host role */
+        EOtgRoleHost
+        };
+
+    // Class declaration
+
+    /**
+     * An interface class that needs to be implemented by each OTG
+     * Controller PSL that registers to the USB stack.
+     *
+     * The USB OTG Stack will call the functions of this interface
+     * from a DFC queued on the DFC queue supplied by the OTG
+     * Controller PSL in TOtgControllerProperties::iControllerDfcQueue
+     * when the OTG Controller PSL registered.
+     */
+    NONSHARABLE_CLASS( MOtgControllerIf )
+        {
+        public:
+        /**
+         * Called by the OTG stack to set the observer callback
+         * interface to be used by the OTG Controller PSL to report
+         * events.
+         *
+         * When the observer pointer is set to non-NULL value, the OTG
+         * Controller PSL is required to immediately report the
+         * current VBUS and ID states to the observer to get the
+         * status of the OTG stack up to date.
+         *
+         * @param aObserver Pointer to the observer interface to use,
+         *   or NULL when the OTG stack is being unloaded.
+         */
+        virtual void SetOtgObserver( MOtgObserverIf* aObserver ) = 0;
+
+        /**
+         * When operating as the B-peripheral, the OTG stack calls
+         * this function to indicate that the upper layers are
+         * requesting our device to become the B-host. This means that
+         * our OTG device will need start the HNP signalling by
+         * disconnecting from the bus and allowing the A-device to
+         * connect as the peripheral. The signalling shall be started
+         * when the host has suspended the bus, which may already be
+         * the case or happen later.
+         *
+         * This function call is only relevant for OTG controllers
+         * that implement the HNP signalling in hardware and require
+         * an explicit request from SW to start the HNP role switch.
+         * If the OTG controller is under SW control by the Host and
+         * Peripheral Controller PSLs, the OTG Controller PSL should
+         * ignore this call. The HNP signalling in the SW-controlled
+         * case will be handled as normal calls to disconnect as
+         * peripheral and then start the host controller.
+         *
+         * For all controller types, the Host Controller PSL and the
+         * Peripheral Controller PSL associated with the OTG port are
+         * required to report events as they normally would when
+         * operating as the default role. For the Host Controller PSL,
+         * this includes notifying device connection, disconnection,
+         * and other relevant events via MRootHubCallbackIf. For the
+         * Peripheral Controller PSL, this includes notifying bus
+         * state events such as reset, suspend, and resume via
+         * MUsbPeripheralPilCallbackIf::DeviceEventNotification.
+         *
+         * The OTG Controller PSL is not required to perform any
+         * monitoring of HNP success or failure, or report that to the
+         * PIL layer. The PSL is only responsible for making the
+         * normal host and peripheral notifications mentioned above,
+         * and the PIL can see the HNP success or failure from those
+         * notifications.
+         */
+        virtual void SetBHnpRequest() = 0;
+
+        /**
+         * When operating as the B-device, the OTG stack calls this
+         * function to request the PSL to drive SRP signalling on the
+         * bus by pulsing the D+ dataline. The OTG Controller PSL may
+         * synchronously drive the 5..10 millisecond pulse before
+         * returning, but it may also do it asynchronously.
+         *
+         * The OTG PIL layer guarantees that the initial conditions
+         * for driving SRP are satisfied before the PIL calls this
+         * function. That is, the PIL guarantees that sufficient time
+         * has elapsed since the end of the previous VBUS session (if
+         * any) and the bus has been idle long enough.
+         *
+         * No special report from the OTG Controller PSL is required
+         * in either success or fail case. In a success case, the
+         * A-device will raise VBUS and the OTG state machine gets
+         * this as a normal VBUS notifications from the OTG Controller
+         * PSL. In a fail case, a timer in the upper layers will
+         * expire, indicating to upper layers that the SRP was not
+         * successful.
+         */
+        virtual void SignalBSrp() = 0;
+
+        /**
+         * Called by the OTG state machine to indicate a change in the
+         * required controller role.
+         *
+         * Whether the PSL needs to do any actions depends on the HW.
+         * For controllers that require special configuration in
+         * changing a role (other than just starting the peripheral
+         * controller or the host controller normally), the OTG
+         * Controller should do that special configuration when it
+         * gets this call.
+         *
+         * When changing a role, the OTG state machine will first
+         * disable the stack for the previous role, causing that stack
+         * to issue a stop request to the respective controller
+         * PSL. The OTG state machine will then call this function
+         * SetControllerRole() to set the controller role to the
+         * target role. Following this, the OTG state machine will
+         * enable the stack for the target role, causing that stack to
+         * issue a start request to the respective controller PSL.
+         *
+         * @param aControllerRole The OTG role to set our device to
+         *
+         * @return KErrNone if the OTG Controller successfully set the
+         *   role or required no actions. Otherwise a system-wide
+         *   error code.
+         */
+        virtual TInt SetControllerRole( TOtgRole aControllerRole ) = 0;
+        };
+
+
+    /**
+     * An interface class implemented by the USB stack to allow the
+     * OTG controller to report events to the USB stack. This includes
+     * events like VBUS rising and falling, ID pin becoming grounded
+     * or floating, and SRP being detected.
+     *
+     * It is required that the OTG Controller PSL calls these
+     * functions in the context of the DFC queue supplied by the OTG
+     * Controller PSL in TOtgControllerProperties::iControllerDfcQueue
+     * when the OTG Controller PSL registered.
+     */
+    NONSHARABLE_CLASS( MOtgObserverIf )
+        {
+        public:
+        /**
+         * Notify the current ID-pin state to the OTG stack. This
+         * needs to be called by the OTG Controller PSL everytime
+         * there is a change in the ID pin level. Redundant
+         * notifications that don't change the previously reported
+         * state are silently ignored, so the function is safe to call
+         * without worrying about extra calls.
+         *
+         * When USB Battery Charging is supported on the OTG-capable
+         * port, there is a dependency between normal USB
+         * functionality and USB Battery Charging (see
+         * usb_charger_detection_shai.h and specifically the
+         * description of class MChargerDetectorIf). In this case it
+         * is the responsibility of the OTG Controller PSL to
+         * communicate with the Charger Detector PSL (which it may
+         * implement itself) with respect to VBUS and ID pin events.
+         *
+         * For ID pin events that indicate connection to an Accessory
+         * Charger Adapter, it is required that the port type is first
+         * notified to the Charger Detector PSL Observer, followed by
+         * notifying the ID pin state to the OTG Observer (via this
+         * function).
+         *
+         * @param aIdPinState The current ID-pin state
+         */
+        virtual void NotifyIdPinState( TIdPinState aIdPinState ) = 0;
+
+        /**
+         * Notify the current VBUS state to the OTG stack. This needs
+         * to be called by the OTG Controller PSL everytime there is a
+         * change in the VBUS level. Redundant notifications that
+         * don't change the previously reported state are silently
+         * ignored, so the function is safe to call without worrying
+         * about extra calls.
+         *
+         * When USB Battery Charging is supported on the OTG-capable
+         * port, there is a dependency between normal USB
+         * functionality and USB Battery Charging (see
+         * usb_charger_detection_shai.h and specifically the
+         * description of class MChargerDetectorIf). In this case it
+         * is the responsibility of the OTG Controller PSL to
+         * communicate with the Charger Detector PSL (which it may
+         * implement itself) with respect to VBUS and ID pin events.
+         *
+         * When VBUS rises on the OTG-capable port that is currently
+         * the B-device and fully supports Battery Charging
+         * Specification Revision 1.1, the Charger Detector PSL and
+         * the OTG Controller PSL need to together guarantee that Data
+         * Contact Detect is completed and the port type detected
+         * before reporting VBUS rising. When the port type is known,
+         * the port type needs to be notified to the Charger Detector
+         * PSL Observer, followed by notifying the VBUS state to the
+         * OTG Observer (via this function).
+         *
+         * Where Data Contact Detect is not supported, the VBUS rise
+         * event needs to be notified to the OTG Observer (via this
+         * function) immediately and charger detection needs to
+         * proceed in parallel with the upper layers preparing the USB
+         * personality. This is necessary in order to ensure that we
+         * can fulfill the requirement to connect to the bus within a
+         * second, while still making as long as possible charger
+         * detection cycle to minimize the changes of false detections
+         * due to datalines not making contact yet.
+         *
+         * The OTG Controller PSL, the Peripheral Controller PSL and
+         * the Charger Detector PSL need to together guarantee that
+         * the peripheral controller does not attempt to connect to
+         * the bus while charger detection is still on-going. When
+         * detection has been completed and upper layers have
+         * indicated readiness to connect to the bus (see
+         * MPeripheralControllerIf::PeripheralConnect(), the
+         * Peripheral Controller PSL must connect to the bus.
+         *
+         * @param aVbusState The current VBUS state
+         */
+        virtual void NotifyVbusState( TVbusState aVbusState ) = 0;
+
+        /**
+         * When operating as the A-device with VBUS low, notify the
+         * OTG stack that SRP signalling has been detected on the
+         * bus. The OTG Controller must detect the SRP signalling from
+         * dataline pulsing, as specified in the "On-The-Go and
+         * Embedded Host Supplement to the USB Revision 2.0
+         * Specification".
+         */
+        virtual void NotifySrpDetected() = 0;
+
+        /**
+         * This function is called by the OTG Controller PSL to report
+         * that it has detected the attachment of a device (A or B)
+         * that is malfunctioning in a low-level way that prevents
+         * attempting communication with the connected device. Such
+         * cases may include but are not necessarily limited to:
+         *
+         * 1. A B-device that drives its upstream VBUS. To prevent
+         * damage to the VBUS charge pump in our A-device, it may be
+         * necessary to prevent VBUS from being raised by our device.
+         *
+         * 2. A B-device that presents a single-ended one (both
+         * datalines high) on the bus.
+         *
+         * The detection of such malfunctioning devices is left to the
+         * OTG Controller PSL, as this type of malfunctions are
+         * low-level problems not necessarily detectable with the
+         * standard inputs available to the OTG state machine.
+         *
+         * To ensure that the OTG state machine stays in an idle
+         * state, the OTG Controller PSL should report ID floating and
+         * VBUS low prior to reporting the bad device attachment by
+         * calling this function. When the bad device is detached, the
+         * OTG Controller PSL can resume reporting ID and VBUS state
+         * truthfully, and must call NotifyBadDeviceDetached() to
+         * allow the upper layers to see the error condition has been
+         * cleared.
+         *
+         * @see NotifyBadDeviceDetached()
+         */
+        virtual void NotifyBadDeviceAttached() = 0;
+
+        /**
+         * This function is called by the OTG Controller PSL to report
+         * that a previously detected bad device has been detached.
+         * See NotifyBadDeviceAttached() for description of this
+         * functionality.
+         *
+         * @see NotifyBadDeviceAttached()
+         */
+        virtual void NotifyBadDeviceDetached() = 0;
+        };
+
+
+    /**
+     * This class specifies the information provided by an OTG
+     * Controller PSL when registering to the USB OTG stack.
+     *
+     * The PSL should prepare for the possibility that members may be
+     * added to the end of this class in later SHAI versions if new
+     * information is needed to support new features. The PSL should
+     * not use this class as a direct member in an object that is not
+     * allowed to grow in size due to binary compatibility reasons.
+     *
+     * @see UsbOtgPil::RegisterOtgController()
+     */
+    NONSHARABLE_CLASS( TOtgControllerProperties )
+        {
+        public: // Types and constants
+        /**
+         * A bitmask type used to indicate the static capabilities of
+         * the OTG Controller.
+         */
+        typedef TUint32 TOtgCaps;
+
+        public:
+        /**
+         * Inline constructor for the OTG Controller properties
+         * object. This is inline rather than an exported function to
+         * prevent a binary break in a case where an older PSL binary
+         * might provide the constructor a smaller object due to the
+         * PSL being compiled against an older version of the SHAI
+         * header. When it's inline, the function is always in sync
+         * with the object size.
+         *
+         * We slightly violate the coding conventions which say that
+         * inline functions should be in their own file. We don't want
+         * to double the number of USB SHAI headers just for sake of a
+         * trivial constructor.
+         */
+        inline TOtgControllerProperties() :
+            iCapabilities(0),
+            iControllerDfcQueue(NULL)
+            {
+            };
+
+        public: // Data
+        /**
+         * A bitmask specifying the static capabilities of this OTG
+         * Controller. No capabilities are specified at the moment and
+         * the PSL shall fill this field with a zero value.
+         *
+         * The field is added for sake of future proofing the binary
+         * compatibility of the OTG SHAI. By having a field reserved
+         * for capability bits, we can later specify bits to indicate
+         * added virtual functions or extension to this controller
+         * properties structure. The PIL layer can then at runtime
+         * confirm the existence of the new functions or fields and
+         * safely support an older binary, if we choose to.
+         */
+        TOtgCaps iCapabilities;
+
+        /**
+         * Pointer to a DFC queue that will be used for DFCs of this
+         * controller and the associated peripheral and host
+         * controllers.
+         *
+         * The OTG Controller must supply a pointer to a dedicated DFC
+         * queue that has been created for this OTG Controller PSL.
+         * Both the OTG Controller PSL itself and the OTG stack must
+         * queue their DFCs for this controller in this DFC queue to
+         * ensure the code is running in the same context.
+         *
+         * Furthermore, it is the responsibility of the OTG Controller
+         * PSL that registers to ensure that the Peripheral and Host
+         * Controller PSLs that are registered at the same time use
+         * the same DFC Queue in their respective properties object.
+         */
+        TDfcQue* iControllerDfcQueue;
+        };
+
+
+    /**
+     * A static class implemented by the USB OTG PIL layer to allow
+     * the OTG controller PSL to register to the PIL layer.
+     */
+    NONSHARABLE_CLASS( UsbOtgPil )
+        {
+        public:
+        /**
+         * Registration function to be used by the OTG Controller PSL
+         * to register itself and the associated peripheral and host
+         * controller PSLs to the PIL layer.
+         *
+         * The intended usage is that OTG Controller PSL (of which
+         * only one can exists in a given system) is a kernel
+         * extension that registers itself and the associated
+         * peripheral and host controller PSLs to the USB PIL layer by
+         * making this call from its kernel extension entry point
+         * function (or an equivalent code that runs during bootup).
+         *
+         * @param aOtgControllerIf Reference to the OTG Controller
+         *   interface implemented by the registering PSL.
+         *
+         * @param aOtgProperties Reference to an object describing the
+         *   static properties of the OTG Controller. The PIL layer
+         *   requires that the supplied reference remains valid
+         *   indefinitely, as an OTG Controller cannot unregister.
+         *
+         * @param aPeripheralControllerIf Reference to the Peripheral
+         *   Controller interface implemented by the PSL controlling the
+         *   Peripheral Controller associated with the registering OTG
+         *   port.
+         *
+         * @param aPeripheralProperties Reference to an object
+         *   describing the static properties of the Peripheral
+         *   Controller. The PIL layer requires that the supplied
+         *   reference remains valid indefinitely, as the registering
+         *   OTG Controller cannot unregister.
+         *
+         * @param aHostControllerIf Reference to the Host Controller
+         *   interface implemented by the PSL controlling the Host
+         *   Controller associated with the registering OTG port.
+         *
+         * @param aHostProperties Reference to an object describing the
+         *   static properties of the Host Controller. The PIL layer
+         *   requires that the supplied reference remains valid
+         *   indefinitely, as the registering OTG Controller cannot
+         *   unregister.
+         *
+         * @lib usbotghostpil.lib
+         */
+        IMPORT_C static void RegisterOtgController(
+            MOtgControllerIf&                      aOtgControllerIf,
+            const TOtgControllerProperties&        aOtgProperties,
+            MPeripheralControllerIf&               aPeripheralControllerIf, 
+            const TPeripheralControllerProperties& aPeripheralProperties,
+            MHostControllerIf&                     aHostControllerIf,
+            const THostControllerProperties&       aHostProperties );
+        };
+    };
+
+#endif // USB_OTG_SHAI_H
+
+/* End of File */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usb_plat/usb_shai_api/inc/usb_peripheral_shai.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,1181 @@
+/*
+* 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
+    
+    @brief USB Peripheral SHAI header
+    
+    @version 0.3.0
+ 
+    Abstract interface for USB Peripheral Controller.
+ 
+    @publishedDeviceAbstraction
+  
+ */
+ 
+#ifndef USB_PERIPHERAL_SHAI_H
+#define USB_PERIPHERAL_SHAI_H
+
+// System includes
+#include <kern_priv.h>
+#include <usb/usb_common_shai.h> // Common types shared between the USB SHAIs
+#include <usb/usb_peripheral_shai_shared.h> // Common types shared with upper layers
+
+/**
+ * This macro specifies the version of the USB Peripheral SHAI header
+ * in binary coded decimal format. This allows the PSL layer to
+ * confirm a certain definition is available, if needed. This can for
+ * example make it possible for a new PSL to support compilation in an
+ * older environment with old USB SHAI version that is missing some
+ * new definitions.
+ */
+#define USB_PERIPHERAL_SHAI_VERSION 0x030
+
+// The namespace is documented in file usb_common_shai.h, so it is not
+// repeated here
+namespace UsbShai
+    {
+    /** 
+     * Masks defined for TUsbPeripheralEndpointCaps.iSizes.
+     *
+     * Zero means this endpoint is not available (= no size).
+     */
+    const TUint KUsbEpNotAvailable = 0x00000000;
+    
+    /**    
+     * Max packet size is continuously variable up to some size specified.
+     * (Interrupt and Isochronous endpoints only.)
+     */
+    const TUint KUsbEpSizeCont     = 0x00000001;
+    
+    /** Max packet size 8 bytes is supported */
+    const TUint KUsbEpSize8        = 0x00000008;
+    
+    /** Max packet size 16 bytes is supported */
+    const TUint KUsbEpSize16       = 0x00000010;
+    
+    /** Max packet size 32 bytes is supported */
+    const TUint KUsbEpSize32       = 0x00000020;
+    
+    /** Max packet size 64 bytes is supported */
+    const TUint KUsbEpSize64       = 0x00000040;
+    
+    /** Max packet size 128 bytes is supported */
+    const TUint KUsbEpSize128      = 0x00000080;
+    
+    /** Max packet size 256 bytes is supported */
+    const TUint KUsbEpSize256      = 0x00000100;
+    
+    /** Max packet size 512 bytes is supported */
+    const TUint KUsbEpSize512      = 0x00000200;
+    
+    /** Max packet size 1023 bytes is supported */
+    const TUint KUsbEpSize1023     = 0x00000400;
+    
+    /** Max packet size 1024 bytes is supported */
+    const TUint KUsbEpSize1024     = 0x00000800;
+    
+    /** 
+     * Test Mode Selectors (Set/ClearFeature)
+     * Refer to usb specification 2.0, Chapter 9.4.9, table 9-7
+     */
+    enum TUsbTestModeSelector
+        {
+        EUsbTestSelector_Test_J = 0x01,
+        EUsbTestSelector_Test_K,
+        EUsbTestSelector_Test_SE0_NAK,
+        EUsbTestSelector_Test_Packet,
+        EUsbTestSelector_Test_Force_Enable
+        };
+    
+    /** 
+     * Transfer direction of a USB transfer request.
+     * @see TUsbPeripheralRequest
+     */
+    enum TTransferDirection 
+        {
+        EControllerNone,        
+        EControllerRead,
+        EControllerWrite
+        };
+
+    /** 
+     * Enumeration listing the event codes that are passed from PSL to
+     * PIL to indicate peripheral events
+     */
+    enum TUsbPeripheralEvent
+        {
+        /** The USB Suspend bus state has been detected.
+         *
+         * When the Peripheral Controller PSL is part of an
+         * OTG-capable port, the PSL shall report this event also when
+         * operating as the A-peripheral, in which case this final
+         * suspend event starts the HNP role switch back to A-host.
+         */
+        EUsbEventSuspend,
+        
+        /** USB Resume signaling has been detected. */
+        EUsbEventResume,
+        
+        /** A USB Reset condition has been detected. */
+        EUsbEventReset,
+        
+        /**
+         * VBUS level has risen above the B-session valid threshold. This
+         * is only relevant for a stand-alone peripheral controllers
+         * (those not associated with an OTG port). For an OTG port, the
+         * VBUS state is reported to PIL layer by the OTG Controller PSL.
+         */
+        EUsbEventVbusRisen,
+        
+        /**
+         * VBUS level has fallen below the B-session valid threshold. This
+         * is only relevant for a stand-alone peripheral controllers
+         * (those not associated with an OTG port). For an OTG port, the
+         * VBUS state is reported to PIL layer by the OTG Controller PSL.
+         */
+        EUsbEventVbusFallen
+        };   
+
+    typedef TUint32 TUsbPeripheralPacketArray;
+
+    /** 
+     * @brief  A USB transfer request.
+     * 
+     * This class will be constructed in PIL or upper layer, and be
+     * passed down to PSL. After the request was done, PSL layer will
+     * modify corresponding members (like data length, packet info
+     * etc.) and re-pass it back to PIL via interface
+     * MUsbPeripheralPilCallbackIf::EndpointRequestComplete().
+     * 
+     */
+    NONSHARABLE_CLASS(TUsbPeripheralRequest)
+        {
+    public:    
+        /**
+         * This class doesn't need a destructor because it has nothing to be
+         * freed, closed, destroyed. It 'owns' nothing.
+         */
+        IMPORT_C TUsbPeripheralRequest(TInt aRealEpNum);
+        
+    public:
+        /** The 'real' endpoint number this request to be bind to. */
+        TInt iRealEpNum;
+        
+        /** 
+         * Start address of this buffer. Filled-in by PIL.
+         *
+         * PSL needs to put received data in this buffer if it's a read request.
+         * PSL needs to get data from this buffer if it is a write request.
+         */
+        TUint8* iBufferStart;
+        
+        /** Physical address of buffer start (used for DMA). */
+        TUintPtr iBufferAddr;
+        
+        /** Length in bytes to be read/write. Filled-in by PIL. */
+        TInt iLength;
+
+        /** 
+         * Number of bytes transmitted (if it is a write);
+         * This value need to be updated by PSL. 
+         */
+        TUint iTxBytes;
+        
+        /** 
+         * Number of packets received (if it is a read); 
+         * This value need to be updated by PSL.
+         */
+        TUint iRxPackets;
+        
+        /** 
+         * This is a re-interpretation of what's inside in buffer iBufferStart.
+         * It is designed to be that the first packet always contains all the
+         * bytes received. So only the following scenario are possible:
+         *
+         * 1. Nothing, iRxPackets is zero, no packet received.
+         * 
+         * 2. 1 data Packet, iRxPackets is one.
+         *    iPacketIndex[0] is the offset against iBufferStart of where the
+         *    first byte of received data begins.
+         *    iPacketSize[0] is the size (in bytes) of the received data.
+         * 
+         * 3. 1 data packet, and one ZLP packet, iRxPackets is two.
+         *    iPacketIndex[0] is the offset against iBufferStart of where the
+         *    first byte of received data begins.
+         *    iPacketSize[0] is the size (in bytes) of the data packet.
+         *    
+         *    iPacketIndex[1] is the offset of the ZLP packet.
+         *    iPacketSize[1] is always set to zero since ZLP contains no data.
+         * 
+         */
+        TUsbPeripheralPacketArray* iPacketIndex;
+        
+        /** Array of packet sizes. Details see iPacketIndex */
+        TUsbPeripheralPacketArray* iPacketSize;
+        
+        /**
+         * Indicates the transfer direction of this request.
+         * Note, SetupEndpointRead/Write likewise functions already point out 
+         * the transfer direction, PSL may select to use it or not.
+         */
+        TTransferDirection iTransferDir;
+            
+        /** 
+         * For EControllerWrite (IN) transfers, it is used to Indicates that if 
+         * a Zero Length Packet is required at the end of this transfer.
+         * It will be set to ETrue if ZLP is needed, EFalse otherwise.
+         */
+        TBool iZlpReqd;
+        
+        /** 
+         * The error code upon completion of the request;
+         * PSL need to set it to KErrNone if no errors, Set it to other 
+         * system error codes otherwise.
+         */
+        TInt iError;
+        };
+        
+    /** 
+     * Peripheral controller capabilities.
+     * 
+     * PSL should use those values to fill in data member iControllerCaps in
+     * structure TPeripheralControllerProperties.
+     *
+     * @see TPeripheralControllerProperties.
+     */
+    typedef TUint32 TDeviceCaps;
+    
+    /**
+     * Indicates whether peripheral controller hardware supports USB High-speed.
+     * This capability affects driver functionality and behavior throughout the 
+     * implementation.
+     * 
+     * Set this bit if this peripheral controller supports USB High-speed;
+     * Clear it otherwise.
+     */
+    const TDeviceCaps KDevCapHighSpeed = 0x00000001;
+    
+    /** 
+     * Indicates whether the peripheral controller supports hardware acceleration
+     * for setting the device address, i.e. automatically setting device address
+     * on conclusion of status phase of SET_ADDRESS.
+     *
+     * If this capability is supported PIL will call SetDeviceAddress() before
+     * sending a zero byte status packet.
+     *
+     * Set this bit if hardware acceleration is supported.
+     * Clear it otherwise.
+     */
+    const TDeviceCaps KDevCapSetAddressAcceleration = 0x00000002;
+    
+    /**
+     * Indicates whether controller support Session Request Protocol.
+     *
+     * Set this bit if SRP is supported.
+     * Clear it otherwise.
+     */
+    const TDeviceCaps KDevCapSrpSupport = 0x00000004;
+    
+    /**
+     * Indicates whether controller support Host Negotiation Protocol.
+     *
+     * Set this bit if HNP is supported.
+     * Clear it otherwise.
+     */
+    const TDeviceCaps KDevCapHnpSupport = 0x00000008;
+    
+    /**
+     * Indicates whether controller support Remote wakeup
+     * 
+     * Set this bit if remote wakeup is supported.
+     * Clear it otherwise.
+     */
+    const TDeviceCaps KDevCapRemoteWakeupSupport = 0x00000010;
+
+    /** 
+     * Configuration data from PSL to PIL when register a controller through
+     * interface UsbPeripheralPil::RegisterPeripheralController().
+     */
+    NONSHARABLE_CLASS(TPeripheralControllerProperties)
+        {
+        public:
+        TPeripheralControllerProperties();
+        
+        public: // Data
+        /**
+         * A bitmap used to Indicates the capabilities of this controller.
+         * PSL should set the corresponding bit to '1' if one capability is
+         * supported by this controller.
+         */
+        TDeviceCaps iControllerCaps;
+
+        /**
+         * Pointer to a DFC queue that will be used for DFCs of this controller.
+         *
+         * A stand-alone (one not associated with an OTG-port) peripheral PSL 
+         * implementation must supply a pointer to a dedicated DFC queue that 
+         * has been created for this controller. Both the PSL itself and the PIL
+         * layer must queue their DFCs for this controller in this DFC queue to
+         * ensure the code is running in the same context.
+         *
+         * A peripheral PSL that is part of an OTG port will be registered by 
+         * the OTG PSL. In this case, the DFC queue supplied here must be the 
+         * same DFC queue as the one supplied in the properties of the OTG 
+         * Controller.
+         */
+        TDfcQue* iDfcQueue;
+        
+        /** 
+         * Describe the capabilities of all endpoint owned by this controller.
+         *
+         * Note that there might be gaps in the array, because the endpoints 
+         * must be numbered by using the 'real endpoint' numbering scheme.
+         *
+         * An example of end point capability array:
+         *
+         * @code
+         * static const TUsbPeripheralEndpointCaps DevEndpointCaps[KTotalEps] =
+         * {
+         * // MaxSize mask  ,   Types&Dir                      , High  ,Reserved
+         *                                                       speed?
+         * {KEp0MaxPktSzMask,(KUsbEpTypeControl | KUsbEpDirOut), ETrue ,0 , 0},
+         * {KEp0MaxPktSzMask,(KUsbEpTypeControl | KUsbEpDirIn ), ETrue ,0 , 0},
+         *      
+         * {KUsbEpNotAvailable,KUsbEpNotAvailable              , ETrue ,0 , 0},
+         *      
+         * {KBlkMaxPktSzMask,(KUsbEpTypeBulk | KUsbEpDirIn )   , ETrue ,0 , 0},
+         * {KBlkMaxPktSzMask,(KUsbEpTypeBulk | KUsbEpDirOut)   , ETrue ,0 , 0}
+         * };
+         * @endcode
+         *
+         * For endpoint maxinum packet size on USB2.0 High-speed, PSL should
+         * provide the overlaid values for both full speed and high speed, as 
+         * PIL can deduce the appropriate values for either speed.
+         *
+         */
+        const TUsbPeripheralEndpointCaps* iDeviceEndpointCaps;
+        
+        /** 
+         * Set by the PSL to indicate the number of entries in 
+         * iDeviceEndpointCaps array.
+         * Be noted that this value include the ones that are marked as 
+         * KUsbEpNotAvailable in table iDeviceEndpointCaps.
+         */
+        TInt iDeviceTotalEndpoints;
+        
+        /** 
+         * Maximum size of ep0 packet.
+         * @see USB spec 2.0, chapter 9, table 9-8.
+         */
+        TUint8  iMaxEp0Size;
+        
+        /** 
+         * Device Release number in binary-coded decimal.
+         * @see USB spec 2.0, chapter 9, table 9-8.
+         */
+        TUint16  iDeviceRelease;
+        };
+    
+    /** 
+     * Enumeration of stages within a control transfer
+     * 
+     * Possible stages defined in USB spec include:
+     * 1. setup -> status in
+     * 2. setup -> data in -> status out
+     * 3. setup -> data out -> status in
+     */
+    enum TControlStage
+        {
+        /** 
+         * Control transfer always start with a setup stage in which a setup
+         * packet is expected.         
+         */
+        EControlTransferStageSetup,
+        
+        /** The stage that a data packet is expected from be received */
+        EControlTransferStageDataOut,
+        
+        /**
+         * Status in stage can either following a Setup stage (if no data stage)
+         * or following a data out stage.
+         */
+        EControlTransferStageStatusIn,
+                
+        /** 
+         * Depends on the request type of a setup packet, a data in stage maybe 
+         * followed after a setup packet.
+         *
+         * Within this stage we expect upper/ourself to send some data to host.
+         */
+        EControlTransferStageDataIn,
+        
+        /**
+         * This is an optional stage, some controller will silently swallow
+         * Status out packet and not able to report it.
+         * PIL has consider this situation when control transfer state machine
+         * is introduced.
+         */
+        EControlTransferStageStatusOut,
+               
+        EControlTransferStageMax
+        };
+    
+    /** 
+     * Packet types in control transfers.
+     * 
+     * PSL need to tell PIL about the types of each packet it received.
+     * @see MUsbPeripheralPilCallbackIf::Ep0RequestComplete().
+     */
+    enum TControlPacketType
+        {
+        /** Indicates a setup packet */
+        EControlPacketTypeSetup,
+        
+        /** Indicates a data out packet */
+        EControlPacketTypeDataOut,
+        
+        /** 
+         * Indicates a status in packet.
+         * optional, PSL can select not to complete this packet.
+         */
+        EControlPacketTypeStatusIn,
+        
+        /** Indicates a data in packet */
+        EControlPacketTypeDataIn,
+        
+        /** 
+         * Indicates that a status out packet.
+         * optional, PSL can select not to complete this packet.
+         */
+        EControlPacketTypeStatusOut,
+
+        };
+    
+    /** 
+     * @brief Interface for PSL to do callback to PIL
+     * 
+     * This is the interface that a PSL need talk with PIL in order to:
+     * 1. Pass device event (reset/suspend/resume/vbus high/vbus low etc) to PIL.
+     * 2. Complete a read/write request to PIL.
+     * 3. Query control transfer stage from PIL.
+     * 3. Other functions like SetAdress/Handle HNP/Get remote wake up etc.
+     *
+     * This interface already been implemented and exported via library 
+     * usbperipheralpil.lib. PSL need to add this library as a dependency in 
+     * you PSL .mmp file.
+     *
+     * @lib  usbperipheralpil.lib
+     */
+    NONSHARABLE_CLASS(MUsbPeripheralPilCallbackIf)
+        {
+        public:
+        /** 
+         * Used to synchronize the Ep0 Stage machine between PSL and PIL.
+         * Accepts a SETUP packet and returns the next Ep0 Stage.
+         *
+         * This function will NOT lead anything to be changed at PIL, it is 
+         * functioning by parsing the supplied buffer only.
+         *
+         * @param aSetupBuf The SETUP packet received by PSL.
+         * @return The next Ep0 Stage at PIL if PIL receive this setup packet.
+         *
+         */
+        virtual TControlStage EnquireEp0NextStage(const TUint8* aSetupBuf) const = 0;
+        
+        /** 
+         * This function gets called by PSL upon completion of a pending 
+         * endpoint zero data transfer request.
+         *
+         * @param aRealEndpoint Either 0 for Ep0 OUT (= Read)
+         *                      or 1 for Ep0 IN (= Write).
+         * @param aCount The number of bytes received or transmitted.
+         * @param aError The error code of the completed transfer request. 
+         *               KErrNone if no error.
+         *               KErrCancel if transfer was cancelled.
+         *               KErrPrematureEnd if a premature end was encountered.
+         * @param aPktType The type of the packet that being completed.
+         * 
+         * @return KErrNone if no error during transfer completion processing;
+         *  KErrGeneral if request was a read & a Setup packet was received &
+         *  the recipient for that packet couldn't be found (invalid packet: Ep0
+         *  has been stalled); KErrNotFound if the request was a read & the 
+         *  recipient for that packet (Setup or data) _was_ * found - however no
+         *  read had been set up by that recipient (this case should be used by 
+         *  PSL to disable Ep0 interrupt at that point and give the upper layer 
+         *  software time to set up a new Ep0 read; once the 'missing' read was 
+         *  set up either Ep0DataReceiveProceed or Ep0ReadSetupPktProceed of 
+         *  MPeripheralControllerIf class  will be called by PIL).
+         */
+        virtual TInt Ep0RequestComplete(TInt aRealEndpoint, 
+                                        TInt aCount, 
+                                        TInt aError, 
+                                        TControlPacketType aPktType) = 0;
+    
+        /** 
+         * PSL call this function upon completion of a pending data transfer 
+         * request. This function isn't to be used for endpoint zero completions
+         * (use Ep0RequestComplete instead).
+         * 
+         * @param aCallback A pointer to a data transfer request callback 
+         *        structure which was previously passed to PSL in a 
+         *        SetupEndpointWrite() or SetupEndpointRead() call.
+         * 
+         */
+        virtual void EndpointRequestComplete(TUsbPeripheralRequest* aCallback) = 0;
+        
+        /**
+         * This function gets called by PSL upon detection of either of the 
+         * following events:
+         *   - USB Reset,
+         *   - USB Suspend event,
+         *   - USB Resume signaling,
+         *
+         * When the Peripheral Controller PSL is part of an
+         * OTG-capable port, the PSL shall report the above events
+         * also when operating as the A-peripheral, including
+         * reporting the final suspend event that starts the HNP role
+         * switch back to A-host.
+         *
+         * In addition to the events above, a stand-alone peripheral
+         * controller PSL (one not associated with an OTG port) is
+         * required to report the following events:
+         *   - VBUS rising above the session valid threshold
+         *   - VBUS falling below the session valid threshold
+         * 
+         * When the peripheral controller is part of an OTG port, the
+         * PIL layer receives VBUS notifications via the OTG stack,
+         * and the peripheral PSL is not expected to report them via
+         * this interface.
+         *
+         * When USB Battery Charging is supported on the
+         * peripheral-only port, there is a dependency between normal
+         * USB functionality and USB Battery Charging (see
+         * usb_charger_detection_shai.h and specifically the
+         * description of class MChargerDetectorIf). In this case it
+         * is the responsibility of the Peripheral Controller PSL to
+         * communicate with the Charger Detector PSL (which it may
+         * implement itself) with respect to VBUS events.
+         *
+         * When VBUS rises on the peripheral-only port that fully
+         * supports Battery Charging Specification Revision 1.1, the
+         * Charger Detector PSL and the Peripheral Controller PSL need
+         * to together guarantee that Data Contact Detect is completed
+         * and the port type detected before notifying VBUS rising.
+         * When the port type is known, the port type needs to be
+         * notified to the Charger Detector PSL Observer, followed by
+         * notifying a VBUS rising event to the Peripheral Controller
+         * PIL callback interface (via this function).
+         *
+         * Where Data Contact Detect is not supported, the VBUS rise
+         * event needs to be notified to the Peripheral Controller PIL
+         * callback interface (via this function) immediately and
+         * charger detection needs to proceed in parallel with the
+         * upper layers preparing the USB personality. This is
+         * necessary in order to ensure that we can fulfill the
+         * requirement to connect to the bus within a second, while
+         * still making as long as possible charger detection cycle to
+         * minimize the changes of false detections due to datalines
+         * not making contact yet.
+         *
+         * The Peripheral Controller PSL and the Charger Detector PSL
+         * need to together guarantee that the peripheral controller
+         * does not attempt to connect to the bus while charger
+         * detection is still on-going. When detection has been
+         * completed and upper layers have indicated readiness to
+         * connect to the bus (see MPeripheralControllerIf::PeripheralConnect(),
+         * the Peripheral Controller PSL must connect to the bus.
+         *
+         * @param aEvent An enum denoting the event that has occurred.
+         *        
+         * @return KErrArgument if the event is not recognized, KErrNone
+         *         otherwise
+         */
+        virtual TInt DeviceEventNotification(TUsbPeripheralEvent aEvent) = 0;
+        
+        /** 
+         * This function should be called by PSL once the peripheral 
+         * controller (and thus the USB device) is in the Address state.
+         */
+        virtual void MoveToAddressState() = 0;
+        
+        /** 
+         * This function should be called by PSL after reception of an Ep0
+         * SET_FEATURE request with a feature selector of either {b_hnp_enable,
+         * a_hnp_support, a_alt_hnp_support}, but ONLY when that Setup packet is
+         * not handed up to PIL (for instance because it is auto-decoded and
+         * 'swallowed' by the peripheral controller hardware).
+         * 
+         * @param aHnpState A bitmask indicating the present state of the three
+         * OTG feature selectors as follows:
+         * 
+         * bit.0 == a_alt_hnp_support
+         * bit.1 == a_hnp_support
+         * bit.2 == b_hnp_enable
+         *
+         * @see TUsbHnpCaps
+         * 
+         */
+        virtual void HandleHnpRequest(TInt aHnpState) = 0;       
+        
+        /**
+         * Returns the current USB device state.
+         * 
+         * 'USB device state' here refers to the device states as defined 
+         * in chapter 9 of the USB specification.
+         * 
+         * @return The current USB device state, or EUsbPeripheralStateUndefined
+         *         if peripheral stack is disabled.
+         *
+         */
+        virtual TUsbPeripheralState DeviceStatus() const = 0;
+        
+        };
+    
+    /** 
+     * MPeripheralControllerIf
+     * @brief Abstract class for USB peripheral Chipset API.
+     * @version   0.2.
+     *
+     * PSL driver need to implement all those virtual functions in this class.
+     *    
+     * Four Steps to create a vendor specific usb peripheral PDD.
+     *
+     *    Step 1: Derive a new class from MUsbPeripheralControllerIf and 
+     *            implement all interfaces defined. 
+     *              
+     *    Step 2: Create a new instance (we call it inst_of_psl) of the new class.
+     *            Prepare the configuration data defined by structure
+     *            TUsbPeripheralControllerProps (let's call it cfg_data )
+     *
+     *    Step 3: Call UsbPeripheralPil::RegisterPeripheralController(inst_of_psl,cfg_data).
+     *                        
+     *    Step 4: Member function SetPilCallbackInterface() will be called. 
+     *            An instance of MUsbPeripheralPilCallbackIf will be passed to 
+     *            PSL via this call. Record it since PSL need to reuse it later 
+     *            for any PIL functionality callback.
+     *            
+     *    That's all.
+     *    
+     *    dynamic view of PDD creation.
+     *            PIL will be compiled and linked alone.
+     *            PSL will be compiled alone and linked against a new lib named
+     *            usbperipheralpil.lib.
+     *
+     *    For PSL vendors, the following stuff are provided:
+     *            usb_peripheral_shai.h & usb_peripheral_shai_shared.h which is 
+     *            used for PSL to implement against.
+     *            usbperipheralpil.lib which is used for PSL to link against.
+     *
+     */
+    NONSHARABLE_CLASS(MPeripheralControllerIf)
+        {
+        public: 
+        /** 
+         * This function will be called once and only once by PIL when a PSL
+         * registered itself to PIL by calling 
+         * UsbPeripheralPil::RegisterPeripheralController().
+         *
+         * PSL is expected to store the callback interface pointer so that make 
+         * it possible to reporting events back to PIL layer.
+         *
+         * For stand-alone peripheral controllers (controllers not associated 
+         * with an OTG port),the Peripheral Controller PSL is required to report
+         * a EUsbEventVbusRisen event by calling MUsbPeripheralPilCallbackIf::
+         * DeviceEventNotification() if VBUS is already high at the point this 
+         * function is called.
+         *
+         * @param aPilCallbackIf A reference to PIL callback interface which
+                  a PSL must use to report events.
+         */
+        virtual void SetPilCallbackInterface(MUsbPeripheralPilCallbackIf& aPilCallbackIf) = 0;
+        
+        /**
+         * Sets endpoint zero's RX buffer.
+         * This buffer is maintains at PIL and always exists.
+         *
+         * @param aBuffer the buffer address
+         * @param aBufferLen the length of the buffer.
+         *        
+         */
+        virtual void SetEp0RxBuffer(TUint8* aBuffer, TInt aBufferLen) = 0;
+        
+        /** 
+         * Determines the speed mode that this controller is operating at.
+         *
+         * @return one of the speed mode defined by TSpeed.
+         * @see TSpeed.
+         */
+        virtual TSpeed DeviceOperatingSpeed() = 0;
+        
+        /** 
+         * Forces the peripheral controller into a non-idle state to perform a 
+         * USB remote wakeup operation.
+         *
+         * PIL layer will make sure the following preconditions are meet before
+         * calling this function:
+         *   1. we're already in suspended state for at least 5ms (Twtrsm).
+         *   2. remote wakeup had been enabled by host.
+         *
+         * @return KErrNone if successful, otherwise one of the system-wide 
+         *         error codes.
+         */
+        virtual TInt SignalRemoteWakeup() = 0;
+
+        /** 
+         * This function will be called by PIL upon decoding a SET_ADDRESS
+         * request. PIL will make sure that a status packet will be sent before
+         * calling this function as USB spec required if capability of 
+         * KDevCapSetAddressAcceleration is not support by hardware; Otherwise
+         * SetAddress call will go ahead of status packet.
+         * @see KDevCapSetAddressAcceleration
+         *
+         * @param aAddress A valid USB device address that was received with the
+         *        SET_ADDRESS request.
+         *
+         * @return KErrNone if address was set successfully or if controller's 
+         *         address cannot be set manually. otherwise one of the system-
+         *         wide error codes.
+         */
+        virtual TInt SetDeviceAddress(TInt aAddress) = 0;
+        
+        /** 
+         * Configures (enables) an endpoint (incl. Ep0) for data transmission or
+         * reception.
+         *
+         * @param aRealEndpoint The number of the endpoint to be configured.
+         * @param aEndpointInfo A properly filled-in endpoint info structure.
+         *
+         * @return KErrNone if endpoint successfully configured; KErrArgument if
+         *         endpoint number or endpoint info invalid; otherwise one of 
+         *         the system-wide error codes.
+         */
+        virtual TInt ConfigureEndpoint(TInt aRealEndpoint, 
+                                     const TUsbPeripheralEndpointInfo& aEndpointInfo) = 0;
+        
+        /** 
+         * De-configures (disables) an endpoint (incl. Ep0).
+         *
+         * @param aRealEndpoint The number of the endpoint to be disabled.
+         *
+         * @return KErrNone if endpoint successfully de-configured; KErrArgument
+         *         if endpoint number invalid; otherwise one of the system-wide 
+         *         error codes.
+         */
+        virtual TInt DeConfigureEndpoint(TInt aRealEndpoint) = 0;
+        
+        /** 
+         * Queries the use of and endpoint resource.
+         *
+         * @param aRealEndpoint The number of the endpoint.
+         * @param aResource The endpoint resource to be queried.
+         *        they are one of the following currently:
+         *           KUsbEndpointInfoFeatureWord1_DMA.
+         *           KUsbEndpointInfoFeatureWord1_DoubleBuffering.
+         *
+         * @return ETrue if the specified resource is in use at the endpoint, 
+         *         EFalse if not.
+         */
+        virtual TBool QueryEndpointResource(TInt aRealEndpoint, TUint32 aResource) const = 0;
+        
+        /** 
+         * Sets up a read request on an endpoint (excl. Ep0) for data reception.
+         * 
+         * PIL will construct a read request as aCallback, and use this function
+         * to setup and indicate the readiness for reading data from end point.
+         * 
+         * PSL need to update related data member of aCallback and complete this
+         * request by calling EndpointRequestComplete() when request is done.
+         * 
+         * @see TUsbPeripheralRequest
+         *
+         * @param aRealEndpoint The number of the endpoint to be used.
+         * @param aCallback A properly filled-in (by PIL) request callback.
+         *
+         * @return KErrNone if read successfully set up; KErrArgument if endpoint
+         *         number is invalid. otherwise one of the system-wide error 
+         *         codes.
+         */
+        virtual TInt SetupEndpointRead(TInt aRealEndpoint, TUsbPeripheralRequest& aCallback) = 0;
+        
+        /** 
+         * Sets up a write request on an endpoint (excl. Ep0) for transmission.
+         *
+         * PIL will contruct a write request as aCallback, and use this function
+         * to pass down it to PSL.
+         * 
+         * PSL need to update related data member of aCallback and complete this
+         * request by calling EndpointRequestComplete() when data is transmitted
+         * or any error found.
+         * @see TUsbPeripheralRequest
+         *
+         * @param aRealEndpoint The number of the endpoint to be used.
+         * @param aCallback A properly filled-in request callback.
+         *
+         * @return KErrNone if write successfully set up; KErrArgument if 
+         *         endpoint number is invalid; otherwise one of the system-wide 
+         *         error codes.
+         */
+        virtual TInt SetupEndpointWrite(TInt aRealEndpoint, TUsbPeripheralRequest& aCallback) = 0;
+        
+        /** 
+         * Cancels a read request on an endpoint (excl. Ep0).
+         *
+         * Note that endpoint 0 read requests are never cancelled by PIL, so
+         * there is also no CancelEndpointZeroRead() function.
+         *
+         * @param aRealEndpoint The number of the endpoint to be used.
+         *
+         * @return KErrNone if read successfully cancelled; KErrArgument if 
+         *         endpoint number is invalid; otherwise one of the system-wide 
+         *         error codes.
+         */
+        virtual TInt CancelEndpointRead(TInt aRealEndpoint) = 0;
+        
+        /** 
+         * Cancels a write request on an endpoint (incl. Ep0).
+         *
+         * PIL calls this function also to cancel endpoint zero write requests.
+         *
+         * @param aRealEndpoint The number of the endpoint to be used.
+         *
+         * @return KErrNone if write successfully cancelled; KErrArgument if 
+         *         endpoint number is invalid; otherwise one of the system-wide 
+         *         error codes.
+         */
+        virtual TInt CancelEndpointWrite(TInt aRealEndpoint) = 0;
+        
+        /** 
+         * Same as SetupEndpointRead(), but for endpoint zero only.
+         *
+         * No callback structure is used here as reading to ep0 (host may at any
+         * time send a SETUP packet) must be ready even before upper application
+         * is ready. So, a buffer will be passed down to PSL by 
+         * MPeripheralControllerIf::SetEp0RxBuffer() during PIL construction,
+         * this will benefits the PSL to have a buffer always available for this
+         * purpose.
+         *
+         * PSL must complete this request by EndpointRequestComplete()
+         *
+         * @return KErrNone if read successfully set up; otherwise one of the 
+         *         system-wide error codes.
+         */
+        virtual TInt SetupEndpointZeroRead() = 0;
+        
+        /** 
+         * Same as SetupEndpointWrite(), but for endpoint zero only.
+         *
+         * No callback is used here as this function is only used by
+         * PIL layer only and no user side request exists for it.
+         *
+         * @param aBuffer This points to the beginning of the data to be sent.
+         * @param aLength The number of bytes to be sent.
+         * @param aZlpReqd ETrue if a ZLP is must be sent after the data.
+         *
+         * PSL must complete this request by EndpointRequestComplete()
+         *
+         * @return KErrNone if write successfully set up; otherwise one of the 
+         *         system-wide error codes.
+         */
+        virtual TInt SetupEndpointZeroWrite(const TUint8* aBuffer, 
+                                            TInt aLength, 
+                                            TBool aZlpReqd = EFalse) = 0;
+        
+        /** 
+         * Sets up on Ep0 for the transmission of a single zero-length packet.
+         *
+         * @return KErrNone if ZLP successfully set up; otherwise one of the 
+         *         system-wide error codes.
+         */
+        virtual TInt SendEp0ZeroByteStatusPacket() = 0;
+        
+        /** 
+         * Stalls an endpoint (incl. Ep0).
+         *
+         * Not applicable to Isochronous endpoints.
+         *
+         * @param aRealEndpoint The number of the endpoint to be stalled.
+         *
+         * @return KErrNone if endpoint successfully stalled; KErrArgument if 
+         *         endpoint number is invalid; otherwise one of the system-wide 
+         *         error codes.
+         */
+        virtual TInt StallEndpoint(TInt aRealEndpoint) = 0;
+        
+        /** 
+         * Clears the stall condition on an endpoint (incl. Ep0).
+         *
+         * Not applicable to Isochronous endpoints.
+         *
+         * @param aRealEndpoint The number of the endpoint to be stalled.
+         *
+         * @return KErrNone if endpoint successfully de-stalled; KErrArgument if
+         *         endpoint number invalid; otherwise one of the system-wide 
+         *         error codes.
+         */
+        virtual TInt ClearStallEndpoint(TInt aRealEndpoint) = 0;
+        
+        /**
+         * Resets the data toggle bit for an endpoint (incl. Ep0).
+         *
+         * Isochronous endpoints don't use data toggles.
+         *
+         * @param aRealEndpoint The number of the endpoint to be used.
+         *
+         * @return KErrNone if data toggle successfully reset; KErrArgument if 
+         *         endpoint number invalid; otherwise one of the system-wide 
+         *         error codes.
+         */
+        virtual TInt ResetDataToggle(TInt aRealEndpoint) = 0;
+        
+        /** 
+         * Returns the frame number of the last received SOF packet.
+         *
+         * @return The (11-bit) frame number of the last received SOF packet.
+         *
+         */
+        virtual TInt SynchFrameNumber() const = 0;
+        
+        /** 
+         * Stores the (11-bit) frame number that should be sent in response to
+         * the next SYNCH_FRAME request(s).
+         *
+         * @param aFrameNumber The (11-bit) frame number to be set
+         */
+        virtual void SetSynchFrameNumber(TInt aFrameNumber) = 0;
+        
+        /** 
+         * Starts peripheral controller.
+         *
+         * This initializes the device controller hardware before any other 
+         * operation can be performed. 
+         * Tasks to be carried out here might include:
+         *     - resetting the whole peripheral controller design
+         *     - enabling the peripheral controller's clock
+         *     - binding & enabling the peripheral controller (primary) interrupt
+         *     - write meaningful values to some general controller registers
+         *     - enabling the USB Reset interrupt
+         *     - enabling the peripheral controller proper (for instance by 
+         *       setting an Enable bit).
+         *
+         * This function is also used in an OTG environment when the
+         * peripheral stack becomes enabled and the controller needs
+         * to be started and enabled for peripheral use. If the HW
+         * platform shares resources such as clocks and power between
+         * the host and peripheral HW, it is probably easiest for the
+         * PSL to handle the role switch based on the
+         * MOtgControllerIf::SetControllerRole() call to the OTG
+         * Controller interface.
+         *
+         * @return KErrNone if the controller was successfully started;
+         *         otherwise one of the system-wide error codes.
+         *
+         * @see usb_otg_shai.h, MOtgControllerIf::SetControllerRole()
+         */
+        virtual TInt StartPeripheralController() = 0;
+    
+        /** 
+         * Stops the peripheral controller.
+         *
+         * This basically makes undone what happened in StartPeripheralController(). 
+         * Tasks to be carried out here might include:
+         * - disabling peripheral controller proper.
+         * - disabling the USB Reset interrupt.
+         * - disabling & unbinding the peripheral controller (primary) interrupt.
+         * - disabling the peripheral controller's clock.
+         *
+         * This function is also used in an OTG environment when the peripheral 
+         * stack becomes disabled and the peripheral hardware resources can be 
+         * released. If the hardware platform shares resources such as clocks 
+         * and power between the host and peripheral hardware, it is probably 
+         * easiest for the PSL to handle the role switch based on the
+         * MOtgControllerIf::SetControllerRole() call to the OTG Controller 
+         * interface.
+         *
+         * @return KErrNone if peripheral controller successfully stopped;
+         *         otherwise one of the system-wide error codes.
+         *
+         * @see usb_otg_shai.h, MOtgControllerIf::SetControllerRole()
+         */         
+        virtual TInt StopPeripheralController() = 0;
+    
+        /** 
+         * This function is used to indicate that upper layers are ready to 
+         * start operating as peripheral and want to connect to the USB bus
+         * if possible.
+         *
+         * Since this functionality is not part of the USB specification it
+         * has to be explicitly supported, either by the peripheral controller
+         * itself or by the hardware platform.
+         *
+         * This call merely reports the upper layer readiness to connect, and
+         * it is the responsiblity of the PSL to assess when all prerequisites
+         * for connection are satisfied and physically connect when they are.
+         * These prerequisites include:
+         *
+         *  1. Upper layer readiness has been indicated by calling 
+         *     PeripheralConnect().
+         *
+         *  2. The peripheral controller has been started and enabled
+         *     by StartPeripheralController().
+         *
+         * The connection readiness assessment responsibility is delegated to the
+         * PSL because the physical connection may sometimes be handled by a HW
+         * state machine, thus making the correct SW-controlled connection time
+         * HW-specific.
+         *
+         * @return KErrNone if peripheral controller successfully connected;
+         *         otherwise one of the system-wide error codes.
+         */
+        virtual TInt PeripheralConnect() = 0;
+    
+        /** 
+         * Called to indicate that upper layers no longer want to operate as the
+         * peripheral and we must disconnect from the USB bus.
+         *
+         * Since this functionality is not part of the USB specification it
+         * has to be explicitly supported, either by the peripheral controller
+         * itself or by the hardware platform.
+         *
+         * @return KErrNone if controller is successfully disconnected;
+         *         otherwise one of the system-wide error codes.
+         */
+        virtual TInt PeripheralDisconnect() = 0;       
+        
+        /**
+         * Implements anything peripheral controller might required by following
+         * bus resume signal.
+         *
+         * This function gets called by PIL after it has been notified (by
+         * PSL) about the Suspend condition.
+         */
+        virtual void Suspend() = 0;
+        
+        /**
+         * Implements anything peripheral controller might required by following
+         * bus resume signal.
+         *
+         * This function gets called by PIL after it has been notified (by
+         * PSL) about the Resume event.
+         */
+        virtual void Resume() = 0;
+        
+        /**          
+         * Implements anything peripheral controller might required by following
+         * bus resume signal.
+         *
+         * This function gets called by PIL after it has been notified (by
+         * PSL) about the Reset event.
+         */
+        virtual void Reset() = 0;
+        
+        /** 
+         * PIL call this function to signal PSL that it has finished processing
+         * a received Setup packet (on Ep0) and that PSL can now prepare 
+         * itself for the next Ep0 reception.
+         *
+         * The reason for having this function is that the situation where no 
+         * Ep0 read has been set up by user and thus a received Setup packet
+         * cannot immediately be delivered to user. Once user however 
+         * sets up an Ep0 read, PIL then completes the request and eventually 
+         * calls this function. We can implement some sort of flow-control by
+         * this way.
+         */
+        virtual void Ep0ReadSetupPktProceed() = 0;
+        
+        /** 
+         * PIL call this function to signal PSL that it has finished processing 
+         * a received Ep0 data packet and that PSL can now prepare itself for 
+         * the next Ep0 reception.
+         *
+         * The reason for having this function is that the situation where no 
+         * Ep0 read has been set up by user and thus a received Setup packet
+         * cannot immediately be delivered to user. Once user however 
+         * sets up an Ep0 read, PIL then completes the request and eventually 
+         * calls this function. We can implement some sort of flow-control by
+         * this way.
+         */
+        virtual void Ep0ReadDataPktProceed() = 0;
+        
+        /** 
+         * Puts controller into a specific test mode (during HS operation only).
+         *
+         * 9.4.9 Set Feature: "The transition to test mode must be complete no
+         * later than 3 ms after the completion of the status stage of the 
+         * request." (The status stage will have been completed immediately 
+         * before this function gets called.)
+         *
+         * @param aTestSelector The specific test mode selector.
+         *
+         * @return KErrNone if the specified test mode was entered successfully;
+         *         otherwise one of the system-wide error codes.
+         */
+        virtual TInt EnterTestMode(TUsbTestModeSelector aTestSelector) = 0;
+        };
+
+   
+    /**
+     * This static class provides the interface which PSL implementation shall 
+     * use to register itself to PIL layer.
+     */
+    NONSHARABLE_CLASS(UsbPeripheralPil)
+        {
+        public:
+        /**
+         * Registration function to be used by a stand-alone (non-OTG
+         * port) Peripheral Controller PSL to register itself to the
+         * PIL layer. Peripheral Controllers that are part of an
+         * OTG-port are registered by the OTG Controller PSL (see
+         * usb_otg_shai.h, function UsbOtgPil::RegisterOtgController).
+         *
+         * The intended usage is that each stand-alone Peripheral
+         * Controller PSL is a kernel extension that registers itself
+         * to the USB Peripheral PIL layer by making this call from
+         * their own kernel extension entry point function (or an
+         * equivalent code that runs during bootup).
+         *
+         * When the PSL makes this call, PIL layer will call 
+         * SetPilCallbackInterface() function of the supplied Peripheral 
+         * Controller interface to supply the PSL a reference to PIL 
+         * callback interface to be used for reporting peripheral events.
+         *
+         * @param aPeripheralControllerIf Reference to the Peripheral
+         *   Controller interface implemented by the registering PSL.
+         *
+         * @param aProperties Reference to an object describing the
+         *   static properties of the Peripheral Controller. PIL
+         *   layer requires that the supplied reference remains valid
+         *   indefinitely, as a Peripheral Controller cannot unregister.
+         *
+         * @lib usbperipheralpil.lib
+         */
+        IMPORT_C static void RegisterPeripheralController(MPeripheralControllerIf& aPeripheralControllerIf, 
+                                                      const TPeripheralControllerProperties& aProperties );
+    
+        private:
+        /**
+         *  No instance of this class need to be created
+         */
+        UsbPeripheralPil();
+        };
+    };
+
+#include <usb/usb_peripheral_shai.inl>
+    
+#endif // USB_PERIPHERAL_SHAI_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usb_plat/usb_shai_api/inc/usb_peripheral_shai.inl	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,36 @@
+/*
+* 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 USB_PERIPHERAL_SHAI_INL
+#define USB_PERIPHERAL_SHAI_INL
+
+//
+// inline constructor for TPeripheralControllerProperties.
+// The responsibility of this constructor is to reset all
+// data member of TPeripheralControllerProperties to zero.
+//
+inline UsbShai::TPeripheralControllerProperties::TPeripheralControllerProperties():
+    iControllerCaps(0),
+    iDfcQueue(NULL),
+    iDeviceEndpointCaps(NULL),
+    iDeviceTotalEndpoints(0),
+    iMaxEp0Size(0),
+    iDeviceRelease(0)
+    {
+    }
+ 
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usb_plat/usb_shai_api/inc/usb_peripheral_shai_shared.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,200 @@
+/*
+* 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
+
+    @brief USB Peripheral SHAI header shared part.
+
+    Some Non-kernel USB code will also use structure defined in this
+    header.  Since usb_peripheral_shai.h always need to include
+    <kern_priv.h> which is not visible to non-kernel layers, a
+    separated header is needed.
+    
+    This header is the one that defined all common structures used by
+    kernel & non-kernel layers software.
+    
+    Peripheral SHAI header always include this header automatically.
+    
+    @publishedDeviceAbstraction
+*/
+
+#ifndef USB_PERIPHERAL_SHAI_SHARED_H
+#define USB_PERIPHERAL_SHAI_SHARED_H
+
+// The namespace is documented in file usb_common_shai.h, so it is not
+// repeated here
+namespace UsbShai
+    {
+    /** 
+     * Bitmaps for TUsbPeripheralEndpointCaps.iSupportedTypesAndDir.
+     * Endpoint supports Control transfer type.
+     */
+    const TUint KUsbEpTypeControl     = 0x00000001;
+    const TUint KUsbEpTypeIsochronous = 0x00000002;
+    const TUint KUsbEpTypeBulk        = 0x00000004;
+    const TUint KUsbEpTypeInterrupt   = 0x00000008;
+
+    /** Endpoint supports IN transfers. */
+    const TUint KUsbEpDirIn           = 0x80000000;
+    /** Endpoint supports OUT transfers. */
+    const TUint KUsbEpDirOut          = 0x40000000;
+    /** Endpoint supports bidirectional (Control) transfers only.*/
+    const TUint KUsbEpDirBidirect     = 0x20000000;
+    
+    /**
+     * Indicates that whether DMA is preferred to be applied for this endpoint.
+     *
+     * Upper application will declare whether DMA is expected to be used for
+     * this endpoint if there is one available (PSL knows about it) when setup
+     * an interface.
+     * 
+     * PSL can ignore this request if NO DMA is available.
+     *
+     * PIL may query whether a DMA is really applied via interface 
+     * MPeripheralControllerIf::QueryEndpointResource() later.
+     *
+     * @see TUsbPeripheralEndpointInfo::iFeatureWord1.
+     */
+    const TUint KUsbEndpointInfoFeatureWord1_DMA             = 0x00000001;
+
+    /**
+     * Indicates that whether double buffering is preferred to be applied for 
+     * this endpoint. 
+     *
+     * Upper application will declare whether double buffering is expected to 
+     * be used for this endpoint if there is one available (PSL knows about it)
+     * when setup an interface.
+     * 
+     * PSL can ignore this request if NO double buffering is possible.
+     * 
+     * PIL may query whether a double buffering is really applied via interface 
+     * MPeripheralControllerIf::QueryEndpointResource() later.
+     *
+     * @see TUsbPeripheralEndpointInfo::iFeatureWord1.
+     */
+    const TUint KUsbEndpointInfoFeatureWord1_DoubleBuffering = 0x00000002;
+    
+    /** 
+     * These are states that are described in the USB standard.
+     */
+    enum TUsbPeripheralState
+        {
+        EUsbPeripheralStateUndefined,  // 0
+        EUsbPeripheralStateAttached,   // 1
+        EUsbPeripheralStatePowered,    // 2
+        EUsbPeripheralStateDefault,    // 3
+        EUsbPeripheralStateAddress,    // 4
+        EUsbPeripheralStateConfigured, // 5
+        EUsbPeripheralStateSuspended,  // 6
+        EUsbPeripheralNoState = 0xff   // 255 (used as a place holder)
+        };
+    
+    /** 
+     * Endpoint capabilities as reported by the PSL driver.
+     */
+    class TUsbPeripheralEndpointCaps
+        {
+        public:
+        /** The supported maximum packet sizes. */
+        TUint iSizes;
+        
+        /** 
+         * The supported endpoint types and directions.
+         * see the bitmap definition for type and dir inside this header.
+         */
+        TUint iTypesAndDir;
+        
+        /** set it to ETrue if it is a 'high-speed, high bandwidth' endpoint. */
+        TBool iHighBandwidth;
+        
+        /** 
+         * Reserved for future use. 
+         * PSL must set those reserved ram to zero to keep binary compatibility
+         * with new (in furture) PIL binary which may utilize some of the 
+         * reserved space.
+         */
+        TUint32 iReserved[2];
+        };
+    
+    /**
+     * The desired endpoint capabilities.
+     * @see MPeripheralControllerIf::ConfigureEndpoint.
+     */
+    class TUsbPeripheralEndpointInfo
+        {
+        public:
+        /** 
+         * Endpoint type.
+         *(mask: UsbShai::KUsbEpTypeControl, etc., but used as value).
+         */
+        TUint iType;
+        
+        /** Direction (mask: UsbShai::KUsbEpDirIn, etc., but used as value). */
+        TUint iDir;
+        
+        /** Maximum packet size (literal, no mask). */
+        TInt iSize;
+        
+        /** 
+         * Interval for polling full-speed interrupt and isochronous endpoints.
+         * Expressed either directly in milliseconds with a valid range 1..255
+         * (interrupt), or for use as 'value' in the expression of 
+         * interval=2^(value-1) with a valid range 1..16 (isochronous).
+         */
+        TInt iInterval;
+        
+        /** 
+         * Interval for polling high-speed interrupt and isochronous endpoints,
+         * or to specify the NAK rate for high-speed control and bulk OUT
+         * endpoints. Expressed either for use as 'value' in the expression
+         * interval=2^(value-1) with a valid range 1..16 (interrupt and 
+         * isochronous), or directly as the maximum NAK rate with a valid range
+         * 0..255 (control and bulk).
+         */
+        TInt iInterval_Hs;
+        
+        /**
+         * The number of additional transactions per frame to be scheduled(0..2)
+         * (A value greater than zero is only valid for high-speed high bandwidth
+         * interrupt and isochronous endpoints. Also note that there are endpoint
+         * size restrictions associated with additional transactions - see 9.6.6.).
+         */
+        TInt iTransactions;
+        
+        /** 
+         * The number of extra bytes that the standard endpoint descriptor
+         * should be extended by. In almost all cases, this should be 0 (zero).
+         */    
+        TInt iExtra;
+        
+        /** 
+         * 32 flag bits indicating miscellaneous endpoint features.
+         * Currently defined are:
+         * - KUsbEndpointInfoFeatureWord1_DMA which means apply DMA to this 
+         *   endpoint if available.
+         * - KUsbEndpointInfoFeatureWord1_DoubleBuffering which means apply 
+         *   double buffering to this endpoint if available.
+         */
+        TUint32 iFeatureWord1;
+        
+        /** Reserved for future use. */
+        TUint32 iReserved;
+        };
+    }
+#endif //USB_PERIPHERAL_SHAI_SHARED_H
+
+// End of files
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/ldd/perildd/group/base_e32_drivers_usbcli.mrp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,17 @@
+# component name "USB Client Driver"
+
+component	base_e32_drivers_usbcli
+
+
+source	\sf\os\kernelhwsrv\kernel\eka\drivers\usbc
+source	\sf\os\kernelhwsrv\kernel\eka\drivers\usbcc
+source	\sf\os\kernelhwsrv\kernel\eka\drivers\usbcsc
+
+binary	\sf\os\kernelhwsrv\kernel\eka\drivers\usbc all
+exports	\sf\os\kernelhwsrv\kernel\eka\drivers\usbc
+
+notes_source	\component_defs\release.src
+
+
+ipr E
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/ldd/perildd/group/bld.inf	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,39 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// 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:
+// bld.inf
+// USB Client Driver
+// 
+//
+
+/**
+ @file
+*/
+PRJ_PLATFORMS
+
+BASEDEFAULT
+
+PRJ_MMPFILES
+
+#if defined(GENERIC_MARM) || defined(WINS) || defined(GENERIC_X86)
+#if !defined(MARM_THUMB) && !defined(MARM_ARMI)
+
+#if !defined(WINS) 
+#if !defined(X86)
+usbc
+#endif
+#endif
+
+
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/ldd/perildd/group/usbc.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,35 @@
+// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// 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:
+// e32/drivers/usbc/usbc.mmp
+// 
+//
+
+
+#include <kernel/kern_ext.mmh>
+
+OS_LAYER_SYSTEMINCLUDE
+
+
+
+target            usbcshai.ldd
+targettype        ldd
+
+sourcepath      ../src
+source            d_usbc.cpp usbdma.cpp
+
+library            usbperipheralpil.lib
+
+uid             0 0x101F8928
+VENDORID        0x70000001
+capability        all
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/ldd/perildd/src/d_usbc.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,3233 @@
+// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// 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:
+// e32/drivers/usbc/d_usbc.cpp
+// LDD for USB Device driver stack:
+// The channel object.
+// 
+//
+
+/**
+ @file d_usbc.cpp
+ @internalTechnology
+*/
+
+#include <usb/usbc.h>
+
+
+_LIT(KUsbLddName, "Usbc");
+
+static const TInt KUsbRequestCallbackPriority = 2;
+
+
+// Quick sanity check on endpoint properties
+static TBool ValidateEndpoint(const TUsbcEndpointInfo* aEndpointInfo)
+    {
+    const TUint dir = aEndpointInfo->iDir;
+    const TInt size = aEndpointInfo->iSize;
+    if (size <= 0)
+        return EFalse;
+
+    switch (aEndpointInfo->iType)
+        {
+    case UsbShai::KUsbEpTypeControl:
+        if (dir != UsbShai::KUsbEpDirBidirect || size > 64)
+            return EFalse;
+        break;
+    case UsbShai::KUsbEpTypeIsochronous:
+        if ((dir != UsbShai::KUsbEpDirIn && dir != UsbShai::KUsbEpDirOut) || size > 1024)
+            return EFalse;
+        break;
+    case UsbShai::KUsbEpTypeBulk:
+        if ((dir != UsbShai::KUsbEpDirIn && dir != UsbShai::KUsbEpDirOut) || size > 512)
+            return EFalse;
+        break;
+    case UsbShai::KUsbEpTypeInterrupt:
+        if ((dir != UsbShai::KUsbEpDirIn && dir != UsbShai::KUsbEpDirOut) || size > 1024)
+            return EFalse;
+        break;
+    default:
+        return EFalse;
+        }
+    return ETrue;
+    }
+
+
+/** Real entry point from the Kernel: return a new driver.
+ */
+DECLARE_STANDARD_LDD()
+    {
+    return new DUsbcLogDevice;
+    }
+
+
+/** Create a channel on the device.
+
+    @internalComponent
+*/
+TInt DUsbcLogDevice::Create(DLogicalChannelBase*& aChannel)
+    {
+    aChannel = new DLddUsbcChannel;
+    return aChannel ? KErrNone : KErrNoMemory;
+    }
+
+
+DUsbcLogDevice::DUsbcLogDevice()
+      {
+      iParseMask = KDeviceAllowUnit;
+      iUnitsMask = 0xffffffff;                                // Leave units decision to the Controller
+      iVersion = TVersion(KUsbcMajorVersion, KUsbcMinorVersion, KUsbcBuildVersion);
+      }
+
+
+TInt DUsbcLogDevice::Install()
+    {
+    // Only proceed if we have the Controller underneath us
+    if (!DUsbClientController::UsbcControllerPointer())
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("LDD Install: USB Controller Not Present"));
+        return KErrGeneral;
+        }
+    return SetName(&KUsbLddName);
+    }
+
+
+//
+// Return the USB controller capabilities.
+//
+void DUsbcLogDevice::GetCaps(TDes8& aDes) const
+    {
+    TPckgBuf<TCapsDevUsbc> b;
+    b().version = iVersion;
+    Kern::InfoCopy(aDes, b);
+    }
+
+
+//
+// Constructor
+//
+DLddUsbcChannel::DLddUsbcChannel()
+    : iValidInterface(EFalse),
+      iAlternateSettingList(NULL),
+      iCompleteAllCallbackInfo(this, DLddUsbcChannel::EmergencyCompleteDfc, KUsbRequestCallbackPriority),
+      iStatusChangePtr(NULL),
+      iStatusCallbackInfo(this, DLddUsbcChannel::StatusChangeCallback, KUsbRequestCallbackPriority),
+      iEndpointStatusChangePtr(NULL),
+      iEndpointStatusCallbackInfo(this, DLddUsbcChannel::EndpointStatusChangeCallback,
+                                  KUsbRequestCallbackPriority),
+      iOtgFeatureChangePtr(NULL),
+      iOtgFeatureCallbackInfo(this, DLddUsbcChannel::OtgFeatureChangeCallback, KUsbRequestCallbackPriority),
+      iNumberOfEndpoints(0),
+      iDeviceState(UsbShai::EUsbPeripheralStateUndefined),
+      iOwnsDeviceControl(EFalse),
+      iAlternateSetting(0),
+      iDeviceStatusNeeded(EFalse),
+      iChannelClosing(EFalse)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("*** DLddUsbcChannel::DLddUsbcChannel CTOR"));
+    iClient = &Kern::CurrentThread();
+    iClient->Open();
+    for (TInt i = 1; i <= KMaxEndpointsPerClient; i++)
+        {
+        iEndpoint[i] = NULL;
+        }
+    for (TInt i = 1; i < KUsbcMaxRequests; i++)
+        {
+        iRequestStatus[i] = NULL;
+        }
+    }
+
+
+DLddUsbcChannel::~DLddUsbcChannel()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcChannel::~DLddUsbcChannel()"));
+    if (iController)
+        {
+        iController->DeRegisterClient(this);
+        iStatusCallbackInfo.Cancel();
+        iEndpointStatusCallbackInfo.Cancel();
+        iOtgFeatureCallbackInfo.Cancel();
+        iCompleteAllCallbackInfo.Cancel();
+        AbortInterface();
+        DestroyAllInterfaces();
+        if (iOwnsDeviceControl)
+            {
+            iController->ReleaseDeviceControl(this);
+            iOwnsDeviceControl = EFalse;
+            }
+        DestroyEp0();
+        delete iStatusFifo;
+        Kern::DestroyClientRequest(iStatusChangeReq);
+        Kern::DestroyClientRequest(iEndpointStatusChangeReq);
+        Kern::DestroyClientRequest(iOtgFeatureChangeReq);
+
+        Kern::DestroyVirtualPinObject(iPinObj1);
+        Kern::DestroyVirtualPinObject(iPinObj2);
+        Kern::DestroyVirtualPinObject(iPinObj3);
+
+        for (TInt i = 0; i < KUsbcMaxRequests; i++)
+            {
+            Kern::DestroyClientBufferRequest(iClientAsynchNotify[i]->iBufferRequest);
+            delete iClientAsynchNotify[i];
+            }
+        }
+    Kern::SafeClose((DObject*&)iClient, NULL);
+    }
+
+
+inline TBool DLddUsbcChannel::ValidEndpoint(TInt aEndpoint)
+    {
+    return (aEndpoint <= iNumberOfEndpoints && aEndpoint >= 0);
+    }
+
+
+//
+// Create channel
+//
+TInt DLddUsbcChannel::DoCreate(TInt /*aUnit*/, const TDesC8* /*aInfo*/, const TVersion& aVer)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("LDD DoCreateL 1 Ver = %02d %02d %02d",
+                                    aVer.iMajor, aVer.iMinor, aVer.iBuild));
+    if (!Kern::CurrentThreadHasCapability(ECapabilityCommDD,
+                                          __PLATSEC_DIAGNOSTIC_STRING("Checked by USBC.LDD (USB Driver)")))
+        {
+        return KErrPermissionDenied;
+        }
+
+    iController = DUsbClientController::UsbcControllerPointer();
+
+    if (!iController)
+        {
+        return KErrGeneral;
+        }
+
+    iStatusFifo = new TUsbcDeviceStatusQueue;
+    if (iStatusFifo == NULL)
+        {
+        return KErrNoMemory;
+        }
+
+      if (!Kern::QueryVersionSupported(TVersion(KUsbcMajorVersion, KUsbcMinorVersion, KUsbcBuildVersion), aVer))
+        {
+        return KErrNotSupported;
+        }
+
+    // set up the correct DFC queue
+    SetDfcQ(iController->DfcQ(0));                            // sets the channel's dfc queue
+    #ifdef DFC_REALTIME_STATE
+        iDfcQ.SetRealtimeState(ERealtimeStateOn);
+    #endif
+    iCompleteAllCallbackInfo.SetDfcQ(iDfcQ);
+    iStatusCallbackInfo.SetDfcQ(iDfcQ);                        // use the channel's dfcq for this dfc
+    iEndpointStatusCallbackInfo.SetDfcQ(iDfcQ);                // use the channel's dfcq for this dfc
+    iOtgFeatureCallbackInfo.SetDfcQ(iDfcQ);
+    iMsgQ.Receive();                                        //start up the message q
+    TInt r = iController->RegisterClientCallback(iCompleteAllCallbackInfo);
+    if (r != KErrNone)
+        return r;
+    r = iController->RegisterForStatusChange(iStatusCallbackInfo);
+    if (r != KErrNone)
+        return r;
+    r = iController->RegisterForEndpointStatusChange(iEndpointStatusCallbackInfo);
+    if (r != KErrNone)
+        return r;
+    r = iController->RegisterForOtgFeatureChange(iOtgFeatureCallbackInfo);
+    if (r != KErrNone)
+        return r;
+
+    r = Kern::CreateClientDataRequest(iStatusChangeReq);
+    if (r != KErrNone)
+        return r;
+    r = Kern::CreateClientDataRequest(iEndpointStatusChangeReq);
+    if (r != KErrNone)
+        return r;
+    r = Kern::CreateClientDataRequest(iOtgFeatureChangeReq);
+    if (r != KErrNone)
+        return r;
+    
+    Kern::CreateVirtualPinObject(iPinObj1);
+    Kern::CreateVirtualPinObject(iPinObj2);
+    Kern::CreateVirtualPinObject(iPinObj3);
+
+    for (TInt i = 0; i < KUsbcMaxRequests; i++)
+        {
+            iClientAsynchNotify[i] = new TClientAsynchNotify;
+            if(iClientAsynchNotify[i] == NULL)
+                return KErrNoMemory;
+            r = Kern::CreateClientBufferRequest(iClientAsynchNotify[i]->iBufferRequest,1,TClientBufferRequest::EPinVirtual);
+            if (r != KErrNone)
+                {
+                delete iClientAsynchNotify[i];
+                iClientAsynchNotify[i]=NULL;
+                return r;
+                }
+        }
+    
+    return r;
+    }
+
+
+
+void DLddUsbcChannel::CompleteBufferRequest(DThread* aThread, TInt aReqNo, TInt aReason)
+{
+    iRequestStatus[aReqNo]=NULL;
+    Kern::QueueBufferRequestComplete(aThread, iClientAsynchNotify[aReqNo]->iBufferRequest, aReason);
+}
+
+
+TClientBuffer * DLddUsbcChannel::GetClientBuffer(TInt aEndpoint)
+{
+    return iClientAsynchNotify[aEndpoint]->iClientBuffer;
+}
+
+//Runs in client thread
+TInt DLddUsbcChannel::SendMsg(TMessageBase * aMsg)
+{
+    TThreadMessage& m=* (TThreadMessage*)aMsg;
+    TInt id = m.iValue;
+    
+    TInt r = KErrNone;
+    //Cancel Request
+    if (id == KMaxTInt)
+        {
+            r = DLogicalChannel::SendMsg(aMsg);
+            return r;
+        }
+    if (id < 0)
+        {
+        // DoRequest
+        TRequestStatus* pS = (TRequestStatus*) m.Ptr0();
+        r = PreSendRequest(aMsg,~id, pS, m.Ptr1(), m.Ptr2());
+        if (r == KErrNone)
+            {
+            r = DLogicalChannel::SendMsg(aMsg);
+            }
+        }
+    else
+        {
+        //SendControl
+        r = SendControl(aMsg);
+        }
+    return r;
+}
+
+
+TInt DLddUsbcChannel::PreSendRequest(TMessageBase * aMsg,TInt aReqNo, TRequestStatus* aStatus, TAny* a1, TAny* a2)
+{
+    TInt r = KErrNone;
+    if (aReqNo >= KUsbcMaxRequests)
+    {
+        Kern::RequestComplete(aStatus, KErrNotSupported);
+        return KErrNotSupported;
+    }
+    if (aReqNo > KUsbcMaxEpNumber)//DoOtherAsyncReq
+    {
+        switch (aReqNo)
+        {
+            case RDevUsbcClient::ERequestEndpointStatusNotify:
+                iEndpointStatusChangeReq->Reset();
+                iEndpointStatusChangeReq->SetStatus(aStatus);
+                iEndpointStatusChangeReq->SetDestPtr(a1);
+            break;
+            case RDevUsbcClient::ERequestOtgFeaturesNotify:
+                iOtgFeatureChangeReq->Reset();
+                iOtgFeatureChangeReq->SetStatus(aStatus);
+                iOtgFeatureChangeReq->SetDestPtr(a1);
+            break;
+            case RDevUsbcClient::ERequestAlternateDeviceStatusNotify:
+                iStatusChangeReq->Reset();
+                iStatusChangeReq->SetStatus(aStatus);
+                iStatusChangeReq->SetDestPtr(a1);
+            break;
+            case RDevUsbcClient::ERequestReEnumerate://WE use bufferrequest to complete even tho we dont add any buffers
+                iClientAsynchNotify[aReqNo]->Reset();
+                r=iClientAsynchNotify[aReqNo]->iBufferRequest->StartSetup(aStatus);
+                if (r != KErrNone)
+                    return r;
+                iClientAsynchNotify[aReqNo]->iBufferRequest->EndSetup();
+            break;
+        }
+    }
+    else //DoTransferAsyncReq
+    {
+            if(a1 == NULL)
+                return KErrArgument;
+            iClientAsynchNotify[aReqNo]->Reset();
+            r=iClientAsynchNotify[aReqNo]->iBufferRequest->StartSetup(aStatus);
+            if (r != KErrNone)
+                return r;
+            kumemget(&iTfrInfo,a1,sizeof(TEndpointTransferInfo));
+            r=iClientAsynchNotify[aReqNo]->iBufferRequest->AddBuffer(iClientAsynchNotify[aReqNo]->iClientBuffer, iTfrInfo.iDes);
+            if (r != KErrNone)
+                return r;
+            iClientAsynchNotify[aReqNo]->iBufferRequest->EndSetup();
+            TThreadMessage& m=*(TThreadMessage*)aMsg;
+            m.iArg[1] = (TAny*)&iTfrInfo; //Use Channel owned TransfereInfo structure 
+    }
+    return KErrNone;
+}
+
+
+void DLddUsbcChannel::HandleMsg(TMessageBase* aMsg)
+    {
+    TThreadMessage& m = *(TThreadMessage*)aMsg;
+    TInt id = m.iValue;
+    if (id == (TInt) ECloseMsg)
+        {
+        iChannelClosing = ETrue;
+        m.Complete(KErrNone, EFalse);
+        return;
+        }
+    else if (id == KMaxTInt)
+        {
+        // Cancel request
+        TInt mask = m.Int0();
+        TInt b = 1;
+        for(TInt reqNo = 0; reqNo < KUsbcMaxRequests; reqNo++)
+            {
+            TRequestStatus* pS = iRequestStatus[reqNo];
+            if ((mask & b) && (pS != NULL))
+                {
+                DoCancel(reqNo);
+                }
+            b <<= 1;
+            }
+        m.Complete(KErrNone, ETrue);
+        return;
+        }
+
+    if (id < 0)
+        {
+        // DoRequest
+        TRequestStatus* pS = (TRequestStatus*) m.Ptr0();
+        DoRequest(~id, pS, m.Ptr1(), m.Ptr2());
+        m.Complete(KErrNone, ETrue);
+        }
+    else
+        {
+        // DoControl
+        TInt r = DoControl(id, m.Ptr0(), m.Ptr1());
+        m.Complete(r, ETrue);
+        }
+    }
+
+
+//
+// Overriding DObject virtual
+//
+TInt DLddUsbcChannel::RequestUserHandle(DThread* aThread, TOwnerType /*aType*/)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcChannel::RequestUserHandle"));
+    // The USB client LDD is not designed for a channel to be shared between
+    // threads. It saves a pointer to the current thread when it is opened, and
+    // uses this to complete any asynchronous requests.
+    // It is therefore not acceptable for the handle to be duplicated and used
+    // by another thread:
+    if (aThread == iClient)
+        {
+        return KErrNone;
+        }
+    else
+        {
+        return KErrAccessDenied;
+        }
+    }
+
+
+//
+// Asynchronous requests - overriding pure virtual
+//
+void DLddUsbcChannel::DoRequest(TInt aReqNo, TRequestStatus* aStatus, TAny* a1, TAny* a2)
+    {
+    // Check on request status
+    __KTRACE_OPT(KUSB, Kern::Printf("DoRequest 0x%08x", aReqNo));
+        TInt r = KErrNone;
+        if (iRequestStatus[aReqNo] != NULL)
+            {
+            DestroyAllInterfaces();
+            PanicClientThread(ERequestAlreadyPending);
+            }
+        else
+            {
+            TBool needsCompletion;
+            iRequestStatus[aReqNo] = aStatus;
+
+            if (aReqNo > KUsbcMaxEpNumber)
+                {
+                r = DoOtherAsyncReq(aReqNo, a1, a2, needsCompletion);
+                if (needsCompletion)
+                    {
+                    switch (aReqNo)
+                    {
+                        case RDevUsbcClient::ERequestEndpointStatusNotify:
+                            iRequestStatus[aReqNo]=NULL;
+                            Kern::QueueRequestComplete(iClient,iEndpointStatusChangeReq,r);
+                        break;
+                        case RDevUsbcClient::ERequestOtgFeaturesNotify:
+                            iRequestStatus[aReqNo]=NULL;
+                            Kern::QueueRequestComplete(iClient,iOtgFeatureChangeReq,r);
+                        break;
+                        case RDevUsbcClient::ERequestAlternateDeviceStatusNotify:
+                            iRequestStatus[aReqNo]=NULL;
+                            Kern::QueueRequestComplete(iClient,iStatusChangeReq,r);
+                        break;
+                        case RDevUsbcClient::ERequestReEnumerate:
+                            iRequestStatus[aReqNo]=NULL;
+                            Kern::QueueBufferRequestComplete(iClient, iClientAsynchNotify[aReqNo]->iBufferRequest, r);
+                        break;
+                    }
+                  }
+                }
+            else
+                {
+                r = DoTransferAsyncReq(aReqNo, a1, a2, needsCompletion);
+                if (needsCompletion)
+                    {
+                    //Kern::RequestComplete(iClient, iRequestStatus[aReqNo], r);
+                    CompleteBufferRequest(iClient, aReqNo, r);
+                    }
+                }
+            }
+    }
+
+
+
+TInt DLddUsbcChannel::DoOtherAsyncReq(TInt aReqNo, TAny* a1, TAny* a2, TBool& aNeedsCompletion)
+    {
+    // The general assumption is that none of these will complete now.
+    // However, those that make this function return something other than
+    // KErrNone will get completed by the calling function.
+    // So, 1) If you are returning KErrNone but really need to complete because
+    //        completion criteria can be met (for example, sufficient data is
+    //        available in the buffer) and then set aNeedsCompletion = ETrue.
+    //     2) Do NOT complete here AT ALL.
+    //
+    aNeedsCompletion = EFalse;
+    TInt r = KErrNone;
+
+    switch (aReqNo)
+        {
+    case RDevUsbcClient::ERequestAlternateDeviceStatusNotify:
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlReqDeviceStatusNotify"));
+        if (a1 != NULL)
+            {
+            iDeviceStatusNeeded = ETrue;
+            iStatusChangePtr = a1;
+            aNeedsCompletion = AlternateDeviceStateTestComplete();
+            }
+        else
+            r = KErrArgument;
+        break;
+        }
+    case RDevUsbcClient::ERequestReEnumerate:
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("ERequestReEnumerate"));
+        // If successful, this will complete via the status notification.
+        r = iController->ReEnumerate();
+        break;
+        }
+    case RDevUsbcClient::ERequestEndpointStatusNotify:
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("ERequestEndpointStatusNotify"));
+        if (a1 != NULL)
+            {
+            iEndpointStatusChangePtr = a1;
+            }
+        else
+            r = KErrArgument;
+        break;
+            }
+    case RDevUsbcClient::ERequestOtgFeaturesNotify:
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("ERequestOtgFeaturesNotify"));
+        if (a1 != NULL)
+            {
+            iOtgFeatureChangePtr = a1;
+            }
+        else
+            r = KErrArgument;
+        break;
+        }
+    default:
+        r = KErrNotSupported;
+        }
+
+    aNeedsCompletion = aNeedsCompletion || (r != KErrNone);
+
+    return r;
+    }
+
+
+TInt DLddUsbcChannel::DoTransferAsyncReq(TInt aEndpointNum, TAny* a1, TAny* a2, TBool& aNeedsCompletion)
+    {
+    // The general assumption is that none of these will complete now.
+    // however, those that are returning something other than KErrNone will get completed
+    // by the calling function.
+    // So,    1) if you are returning KErrNone but really need to complete because completion criteria can be met
+    //            (for example, sufficient data is available in the buffer) and then set aNeedsCompletion=ETrue..
+    //        2) Do NOT complete here AT ALL.
+    //
+    aNeedsCompletion = EFalse;
+    TInt r = KErrNone;
+    TUsbcEndpoint* pEndpoint = NULL;
+    TUsbcEndpointInfo* pEndpointInfo = NULL;
+    TEndpointTransferInfo* pTfr = NULL;
+
+    if (aEndpointNum == 0)
+        {
+        // ep0 requests
+        if (!(iValidInterface || iOwnsDeviceControl))
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("DoRequest rejected: not configured (Ep0)"));
+            r = KErrUsbInterfaceNotReady;
+            goto exit;
+            }
+        }
+    else
+        {
+        // other eps
+        if (!(iValidInterface && (iDeviceState == UsbShai::EUsbPeripheralStateConfigured ||
+                                  iDeviceState == UsbShai::EUsbPeripheralStateSuspended))
+           )
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("DoRequest rejected not configured (Ep %d)", aEndpointNum));
+            r = KErrUsbInterfaceNotReady;
+            goto exit;
+            }
+        }
+
+    if (!ValidEndpoint(aEndpointNum))
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: DoRequest Read: in error complete"));
+        r = KErrUsbEpNotInInterface;
+        goto exit;
+         }
+
+    if (a1 == NULL)
+        {
+        r = KErrArgument;
+        goto exit;
+        }
+    pTfr = (TEndpointTransferInfo *)a1;
+
+    if (pTfr->iTransferSize < 0)
+        {
+        r = KErrArgument;
+        goto exit;
+        }
+    pEndpoint = iEndpoint[aEndpointNum];
+    if (!pEndpoint)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: DoRequest Read: in error complete"));
+        r = KErrUsbEpNotInInterface;
+        goto exit;
+        }
+
+    pEndpointInfo = pEndpoint->EndpointInfo();
+    __KTRACE_OPT(KUSB, Kern::Printf("DoRequest %d", aEndpointNum));
+
+    switch (pTfr->iTransferType)
+        {
+
+    case ETransferTypeReadData:
+    case ETransferTypeReadPacket:
+    case ETransferTypeReadUntilShort:
+    case ETransferTypeReadOneOrMore:
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("DoRequest Read"));
+        if (pEndpoint->iDmaBuffers->RxIsActive())
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("**** ReadReq ep%d RxActive", aEndpointNum));
+            }
+        else
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("**** ReadReq ep%d RxInActive", aEndpointNum));
+            }
+
+        if (pEndpointInfo->iDir != UsbShai::KUsbEpDirOut &&
+            pEndpointInfo->iDir != UsbShai::KUsbEpDirBidirect)
+            {
+            // Trying to do the wrong thing
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: DoRequest Read: in error complete"));
+            r = KErrUsbEpBadDirection;
+            break;
+            }
+        // Set the length of data to zero now to catch all cases
+        TPtrC8 pZeroDesc(NULL, 0);
+        r=Kern::ThreadBufWrite(iClient,iClientAsynchNotify[aEndpointNum]->iClientBuffer, pZeroDesc, 0, 0,iClient);
+        if (r != KErrNone)
+            PanicClientThread(r);
+        pEndpoint->SetTransferInfo(pTfr);
+        if (pEndpoint->iDmaBuffers->IsReaderEmpty())
+            {
+            pEndpoint->SetClientReadPending(ETrue);
+            }
+        else
+            {
+            if (pTfr->iTransferType == ETransferTypeReadPacket)
+                {
+                __KTRACE_OPT(KUSB, Kern::Printf("DoRequest Read packet: data available complete"));
+                r = pEndpoint->CopyToClient(iClient,iClientAsynchNotify[aEndpointNum]->iClientBuffer);
+                aNeedsCompletion = ETrue;
+                break;
+                }
+            else if (pTfr->iTransferType == ETransferTypeReadData)
+                {
+                if (pTfr->iTransferSize <= pEndpoint->RxBytesAvailable())
+                    {
+                    __KTRACE_OPT(KUSB, Kern::Printf("DoRequest Read data: data available complete"));
+                    r = pEndpoint->CopyToClient(iClient,iClientAsynchNotify[aEndpointNum]->iClientBuffer);
+                    aNeedsCompletion = ETrue;
+                    break;
+                    }
+                else
+                    {
+                    pEndpoint->SetClientReadPending(ETrue);
+                    }
+                }
+            else if (pTfr->iTransferType == ETransferTypeReadOneOrMore)
+                {
+                if (pEndpoint->RxBytesAvailable() > 0)
+                    {
+                    __KTRACE_OPT(KUSB, Kern::Printf("DoRequest Read data: data available complete"));
+                    r = pEndpoint->CopyToClient(iClient,iClientAsynchNotify[aEndpointNum]->iClientBuffer);
+                    aNeedsCompletion = ETrue;
+                    break;
+                    }
+                else
+                    {
+                    pEndpoint->SetClientReadPending(ETrue);
+                    }
+                }
+            else if (pTfr->iTransferType == ETransferTypeReadUntilShort)
+                {
+                TInt nRx = pEndpoint->RxBytesAvailable();
+                TInt maxPacketSize = pEndpoint->EndpointInfo()->iSize;
+                if( (pTfr->iTransferSize <= nRx) ||
+                    (nRx < maxPacketSize) ||
+                    pEndpoint->iDmaBuffers->ShortPacketExists())
+                    {
+                    __KTRACE_OPT(KUSB, Kern::Printf("DoRequest Read data: data available complete"));
+                    r = pEndpoint->CopyToClient(iClient,iClientAsynchNotify[aEndpointNum]->iClientBuffer);
+                    aNeedsCompletion = ETrue;
+                    }
+                else
+                    {
+                    pEndpoint->SetClientReadPending(ETrue);
+                    }
+                }
+            }
+        r = pEndpoint->TryToStartRead(EFalse);
+        if (r != KErrNone)
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("DoRequest Read: couldn't start read"));
+            r = KErrNone;                                    // Reader full isn't a userside error;
+            }
+        break;
+        }
+
+    case ETransferTypeWrite:
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("DoRequest Write 1"));
+        if (pEndpointInfo->iDir != UsbShai::KUsbEpDirIn &&
+            pEndpointInfo->iDir != UsbShai::KUsbEpDirBidirect)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: DoRequest Write: wrong direction complete"));
+            r = KErrUsbEpBadDirection;
+            break;
+            }
+        __KTRACE_OPT(KUSB, Kern::Printf("DoRequest Write 2"));
+
+
+        TInt desLength=iClientAsynchNotify[aEndpointNum]->iClientBuffer->Length();
+        
+        if (desLength < pTfr->iTransferSize)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: DoRequest Write: user buffer too short"));
+            r = KErrUsbTransferSize;
+            break;
+            }
+
+        __KTRACE_OPT(KUSB, Kern::Printf("DoRequest Write 3 length=%d maxlength=%d",
+                                        pTfr->iTransferSize, desLength));
+        // Zero length writes are acceptable
+        pEndpoint->SetClientWritePending(ETrue);
+        r = pEndpoint->TryToStartWrite(pTfr);
+        if (r != KErrNone)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: DoRequest Write: couldn't start write"));
+            pEndpoint->SetClientWritePending(EFalse);
+            }
+        break;
+        }
+
+    default:
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: DoTransferAsyncReq: pTfr->iTransferType = %d not supported",
+                                          pTfr->iTransferType));
+        r = KErrNotSupported;
+        break;
+        }
+ exit:
+    aNeedsCompletion = aNeedsCompletion || (r != KErrNone);
+    return r;
+    }
+
+
+//
+// Cancel an outstanding request - overriding pure virtual
+//
+TInt DLddUsbcChannel::DoCancel(TInt aReqNo)
+    {
+    TInt r = KErrNone;
+    __KTRACE_OPT(KUSB, Kern::Printf("DoCancel: 0x%x", aReqNo));
+    if (aReqNo <= iNumberOfEndpoints)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("DoCancel endpoint: 0x%x", aReqNo));
+        iEndpoint[aReqNo]->CancelTransfer(iClient,iClientAsynchNotify[aReqNo]->iClientBuffer);
+        }
+    else if (aReqNo == RDevUsbcClient::ERequestAlternateDeviceStatusNotify)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("DoCancel: ERequestAlternateDeviceStatusNotify 0x%x", aReqNo));
+        iDeviceStatusNeeded = EFalse;
+        iStatusFifo->FlushQueue();
+        if (iStatusChangePtr)
+            {
+            iStatusChangeReq->Data()=iController->GetDeviceStatus();
+            iStatusChangePtr = NULL;
+
+            if (iStatusChangeReq->IsReady())
+                {
+                iRequestStatus[aReqNo] = NULL;
+                Kern::QueueRequestComplete(iClient, iStatusChangeReq, KErrCancel);
+                }
+                return KErrNone;
+            }
+        }
+    else if (aReqNo == RDevUsbcClient::ERequestReEnumerate)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("DoCancel ERequestReEnumerate: 0x%x", aReqNo));
+        }
+    else if (aReqNo == RDevUsbcClient::ERequestEndpointStatusNotify)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("DoCancel ERequestEndpointStatusNotify: 0x%x", aReqNo));
+        CancelNotifyEndpointStatus();
+        if (iEndpointStatusChangeReq->IsReady())
+            {
+            iRequestStatus[aReqNo] = NULL;
+            Kern::QueueRequestComplete(iClient, iEndpointStatusChangeReq, KErrCancel);
+            }
+        return KErrNone;
+        }
+    else if (aReqNo == RDevUsbcClient::ERequestOtgFeaturesNotify)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("DoCancel ERequestOtgFeaturesNotify: 0x%x", aReqNo));
+        CancelNotifyOtgFeatures();
+        if (iOtgFeatureChangeReq->IsReady())
+            {
+            iRequestStatus[aReqNo] = NULL;
+            Kern::QueueRequestComplete(iClient, iOtgFeatureChangeReq, KErrCancel);
+            }
+        }
+    else
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("DoCancel Unknown! 0x%x", aReqNo));
+        }
+
+        if (r == KErrNone)
+            r = KErrCancel;
+
+        CompleteBufferRequest(iClient, aReqNo, r);
+    return r;
+    }
+
+
+void DLddUsbcChannel::CancelNotifyEndpointStatus()
+    {
+    if (iEndpointStatusChangePtr)
+        {
+        TUint epBitmap = 0;
+        for (TInt i = 0; i <= iNumberOfEndpoints; i++)
+            {
+            TInt v = iController->GetEndpointStatus(this, iEndpoint[i]->RealEpNumber());
+            TUint b;
+            (v == EEndpointStateStalled) ? b = 1 : b = 0;
+            epBitmap |= b << i;
+            }
+        iEndpointStatusChangeReq->Data()=epBitmap;
+        iEndpointStatusChangePtr = NULL;
+        }
+    }
+
+
+void DLddUsbcChannel::CancelNotifyOtgFeatures()
+    {
+    if (iOtgFeatureChangePtr)
+        {
+        TUint8 features;
+        iController->GetCurrentOtgFeatures(features);
+     iOtgFeatureChangeReq->Data()=features;
+        iOtgFeatureChangePtr = NULL;
+        }
+    }
+
+TInt DLddUsbcChannel::PinMemory(TDesC8 *aDes, TVirtualPinObject *aPinObj)
+    {
+    TInt r = KErrNone;
+    TInt  len,mlen;
+    
+    const TUint8*p = Kern::KUDesInfo(*aDes, len,mlen);
+    r=Kern::PinVirtualMemory(aPinObj, (TLinAddr) p, len);
+    return r;
+    }
+
+//Called in Client thread context
+TInt DLddUsbcChannel::SendControl(TMessageBase* aMsg)
+    {
+    TThreadMessage& m=*(TThreadMessage*)aMsg;
+    const TInt fn=m.iValue;
+    TAny *const a1=m.Ptr0();
+    TAny *const a2=m.Ptr1();
+    TInt  kern_param;
+    TEndpointDescriptorInfo epi;
+    TUsbcIfcInfo ifc;
+    TCSDescriptorInfo desInfo;
+    TInt r = KErrNone;
+
+    switch (fn)
+        {
+        
+    case RDevUsbcClient::EControlDeviceStatus:
+    case RDevUsbcClient::EControlGetAlternateSetting:
+        m.iArg[0] = &kern_param;              // update message to point to kernel-side buffer
+        break;
+
+    case RDevUsbcClient::EControlQueryReceiveBuffer:
+    case RDevUsbcClient::EControlEndpointStatus:
+        m.iArg[1] = &kern_param;              // update message to point to kernel-side buffer
+        break;
+
+    case RDevUsbcClient::EControlEndpointCaps:
+    case RDevUsbcClient::EControlDeviceCaps:
+    case RDevUsbcClient::EControlGetDeviceDescriptor:
+    case RDevUsbcClient::EControlSetDeviceDescriptor:
+    case RDevUsbcClient::EControlGetDeviceDescriptorSize:
+    case RDevUsbcClient::EControlGetConfigurationDescriptor:
+    case RDevUsbcClient::EControlGetConfigurationDescriptorSize:
+    case RDevUsbcClient::EControlGetDeviceQualifierDescriptor:
+    case RDevUsbcClient::EControlSetDeviceQualifierDescriptor:
+    case RDevUsbcClient::EControlGetOtherSpeedConfigurationDescriptor:
+    case RDevUsbcClient::EControlSetOtherSpeedConfigurationDescriptor:
+    case RDevUsbcClient::EControlGetStringDescriptorLangId:
+    case RDevUsbcClient::EControlGetManufacturerStringDescriptor:
+    case RDevUsbcClient::EControlSetManufacturerStringDescriptor:
+    case RDevUsbcClient::EControlGetProductStringDescriptor:
+    case RDevUsbcClient::EControlSetProductStringDescriptor:
+    case RDevUsbcClient::EControlGetSerialNumberStringDescriptor:    
+    case RDevUsbcClient::EControlSetSerialNumberStringDescriptor:
+    case RDevUsbcClient::EControlGetConfigurationStringDescriptor:
+    case RDevUsbcClient::EControlSetConfigurationStringDescriptor:
+    case RDevUsbcClient::EControlSetOtgDescriptor:
+    case RDevUsbcClient::EControlGetOtgDescriptor:
+    case RDevUsbcClient::EControlGetOtgFeatures:
+        r=PinMemory((TDesC8 *) a1, iPinObj1);
+        if(r!=KErrNone)
+            {
+            PanicClientThread(r);
+            return r;
+            }
+        break;
+
+    case RDevUsbcClient::EControlGetInterfaceDescriptor:
+    case RDevUsbcClient::EControlGetInterfaceDescriptorSize:
+    case RDevUsbcClient::EControlSetInterfaceDescriptor:
+    case RDevUsbcClient::EControlGetCSInterfaceDescriptor:
+    case RDevUsbcClient::EControlGetCSInterfaceDescriptorSize:
+    case RDevUsbcClient::EControlGetStringDescriptor:
+    case RDevUsbcClient::EControlSetStringDescriptor:
+        r=PinMemory((TDesC8 *) a2, iPinObj1);
+        if(r!=KErrNone)
+            {
+            PanicClientThread(r);
+            return r;
+            }
+        break;
+
+    case RDevUsbcClient::EControlGetEndpointDescriptor:
+    case RDevUsbcClient::EControlGetEndpointDescriptorSize:
+    case RDevUsbcClient::EControlSetEndpointDescriptor:
+    case RDevUsbcClient::EControlGetCSEndpointDescriptor:
+    case RDevUsbcClient::EControlGetCSEndpointDescriptorSize:
+        if(a1!=NULL)
+            {
+            r=Kern::PinVirtualMemory(iPinObj1, (TLinAddr)a1, sizeof(epi));
+            if(r!=KErrNone)
+                {
+                PanicClientThread(r);
+                return r;
+                }
+            kumemget(&epi, a1, sizeof(epi));
+            r=PinMemory((TDesC8 *) epi.iArg, iPinObj2);
+            if(r!=KErrNone)
+                {
+                Kern::UnpinVirtualMemory(iPinObj1);
+                PanicClientThread(r);
+                return r;
+                }
+            }
+        break;
+
+    case RDevUsbcClient::EControlSetInterface:
+        if(a2!=NULL)
+            {
+            r=Kern::PinVirtualMemory(iPinObj1, (TLinAddr)a2, sizeof(ifc));
+            if(r!=KErrNone)
+                {
+                PanicClientThread(r);
+                return r;
+                }    
+            kumemget(&ifc, a2, sizeof(ifc));                
+            r=PinMemory((TDesC8 *) ifc.iInterfaceData, iPinObj2);
+            if(r!=KErrNone)
+                {
+                Kern::UnpinVirtualMemory(iPinObj1);
+                PanicClientThread(r);
+                return r;
+                }
+            }
+        break;
+
+    case RDevUsbcClient::EControlSetCSInterfaceDescriptor:
+    case RDevUsbcClient::EControlSetCSEndpointDescriptor:
+        if(a1!=NULL)
+            {
+            r=Kern::PinVirtualMemory(iPinObj1, (TLinAddr)a1, sizeof(desInfo));
+            if(r!=KErrNone)
+                {
+                PanicClientThread(r);
+                return r;
+                }
+            kumemget(&desInfo, a1, sizeof(desInfo));
+            r=PinMemory((TDesC8 *) desInfo.iArg, iPinObj2);
+            if(r!=KErrNone)
+                {
+                Kern::UnpinVirtualMemory(iPinObj1);
+                PanicClientThread(r);
+                return r;
+                }
+            }
+        break;
+    }
+
+
+    //Send Message and wait for synchronous complete    
+    r = DLogicalChannel::SendMsg(aMsg);
+    
+    
+    
+    switch (fn)
+        {
+    case RDevUsbcClient::EControlDeviceStatus:
+    case RDevUsbcClient::EControlGetAlternateSetting:
+        umemput32(a1, &kern_param, sizeof(kern_param));
+        break;
+
+    case RDevUsbcClient::EControlQueryReceiveBuffer:
+    case RDevUsbcClient::EControlEndpointStatus:
+        umemput32(a2, &kern_param, sizeof(kern_param));
+        break;
+
+    case RDevUsbcClient::EControlDeviceCaps:
+    case RDevUsbcClient::EControlEndpointCaps:
+    case RDevUsbcClient::EControlGetDeviceDescriptor:
+    case RDevUsbcClient::EControlSetDeviceDescriptor:
+    case RDevUsbcClient::EControlGetDeviceDescriptorSize:
+    case RDevUsbcClient::EControlGetConfigurationDescriptor:
+    case RDevUsbcClient::EControlGetConfigurationDescriptorSize:
+    case RDevUsbcClient::EControlGetDeviceQualifierDescriptor:
+    case RDevUsbcClient::EControlSetDeviceQualifierDescriptor:
+    case RDevUsbcClient::EControlGetOtherSpeedConfigurationDescriptor:
+    case RDevUsbcClient::EControlSetOtherSpeedConfigurationDescriptor:
+    case RDevUsbcClient::EControlGetStringDescriptorLangId:
+    case RDevUsbcClient::EControlGetManufacturerStringDescriptor:
+    case RDevUsbcClient::EControlSetManufacturerStringDescriptor:
+    case RDevUsbcClient::EControlGetProductStringDescriptor:
+    case RDevUsbcClient::EControlSetProductStringDescriptor:
+    case RDevUsbcClient::EControlGetSerialNumberStringDescriptor:    
+    case RDevUsbcClient::EControlSetSerialNumberStringDescriptor:
+    case RDevUsbcClient::EControlGetConfigurationStringDescriptor:
+    case RDevUsbcClient::EControlSetConfigurationStringDescriptor:
+    case RDevUsbcClient::EControlSetOtgDescriptor:
+    case RDevUsbcClient::EControlGetOtgDescriptor:
+    case RDevUsbcClient::EControlGetOtgFeatures:
+        if(a1!=NULL)
+            {
+            Kern::UnpinVirtualMemory(iPinObj1);
+            }
+        break;
+
+    case RDevUsbcClient::EControlGetInterfaceDescriptor:
+    case RDevUsbcClient::EControlGetInterfaceDescriptorSize:
+    case RDevUsbcClient::EControlSetInterfaceDescriptor:
+    case RDevUsbcClient::EControlGetCSInterfaceDescriptor:
+    case RDevUsbcClient::EControlGetCSInterfaceDescriptorSize:
+    case RDevUsbcClient::EControlGetStringDescriptor:
+    case RDevUsbcClient::EControlSetStringDescriptor:
+        if(a2!=NULL)
+            {
+            Kern::UnpinVirtualMemory(iPinObj1);
+            }
+        break;
+    
+    case RDevUsbcClient::EControlGetEndpointDescriptor:
+    case RDevUsbcClient::EControlGetEndpointDescriptorSize:
+    case RDevUsbcClient::EControlSetEndpointDescriptor:
+    case RDevUsbcClient::EControlGetCSEndpointDescriptor:
+    case RDevUsbcClient::EControlGetCSEndpointDescriptorSize:
+    case RDevUsbcClient::EControlSetCSInterfaceDescriptor:
+    case RDevUsbcClient::EControlSetCSEndpointDescriptor:
+        if(a1!=NULL)
+            {
+            Kern::UnpinVirtualMemory(iPinObj1);
+            Kern::UnpinVirtualMemory(iPinObj2);
+            }
+        break;
+
+    case RDevUsbcClient::EControlSetInterface:
+        if(a2!=NULL)
+            {
+            Kern::UnpinVirtualMemory(iPinObj1);
+            Kern::UnpinVirtualMemory(iPinObj2);
+            }
+        break;
+        }
+
+    return r;
+    }
+
+
+TInt DLddUsbcChannel::DoControl(TInt aFunction, TAny* a1, TAny* a2)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DoControl: %d", aFunction));
+
+    TInt r = KErrNone;
+    TInt ep;
+    TUsbcEndpoint* pEndpoint;
+    TPtrC8 pZeroDesc(NULL, 0);
+    TEndpointDescriptorInfo epInfo;
+    TUsbcIfcInfo ifcInfo;
+    TCSDescriptorInfo desInfo;
+    TUsbcEndpointResource epRes;
+    TInt bandwidthPriority;
+
+    switch (aFunction)
+        {
+    case RDevUsbcClient::EControlEndpointZeroRequestError:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlEndpointZeroRequestError"));
+        r = KErrNone;
+        if (iOwnsDeviceControl || (iValidInterface && iDeviceState == UsbShai::EUsbPeripheralStateConfigured))
+            {
+            iController->Ep0Stall(this);
+            }
+        else
+            {
+            if (iDeviceState != UsbShai::EUsbPeripheralStateConfigured)
+                r = KErrUsbDeviceNotConfigured;
+            else
+                r = KErrUsbInterfaceNotReady;
+            }
+        break;
+
+    case RDevUsbcClient::EControlGetAlternateSetting:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetAlternateSetting"));
+        if (iValidInterface && iDeviceState == UsbShai::EUsbPeripheralStateConfigured)
+            {
+            r = iController->GetInterfaceNumber(this, *(TInt*)a1);
+            }
+        else
+            {
+            if (iDeviceState != UsbShai::EUsbPeripheralStateConfigured)
+                r = KErrUsbDeviceNotConfigured;
+            else
+                r = KErrUsbInterfaceNotReady;
+            }
+        break;
+
+    case RDevUsbcClient::EControlDeviceStatus:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlDeviceStatus"));
+        *(TInt*)a1 = iController->GetDeviceStatus();
+        break;
+
+    case RDevUsbcClient::EControlEndpointStatus:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlEndpointStatus"));
+        if (iValidInterface && ValidEndpoint((TInt) a1))
+            {
+            pEndpoint = iEndpoint[(TInt)a1];
+            if (pEndpoint == NULL)
+                r = KErrNotSupported;
+            else
+                {
+                *(TInt*)a2 = iController->GetEndpointStatus(this, iEndpoint[(TInt)a1]->RealEpNumber());
+                }
+            }
+        else
+            {
+            if (iDeviceState != UsbShai::EUsbPeripheralStateConfigured)
+                r = KErrUsbDeviceNotConfigured;
+            else
+                r = KErrUsbInterfaceNotReady;
+            }
+        break;
+
+    case RDevUsbcClient::EControlQueryReceiveBuffer:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlQueryReceiveBuffer"));
+        if (iValidInterface && ValidEndpoint((TInt) a1))
+            {
+            pEndpoint=iEndpoint[(TInt) a1];
+            if (pEndpoint == NULL)
+                r = KErrNotSupported;
+            else if (pEndpoint->EndpointInfo()->iDir != UsbShai::KUsbEpDirIn)
+                {
+                __KTRACE_OPT(KUSB, Kern::Printf("  bytes = %d", pEndpoint->RxBytesAvailable()));
+                *(TInt*)a2 = pEndpoint->RxBytesAvailable();
+                }
+            }
+        else
+            {
+            if (iDeviceState != UsbShai::EUsbPeripheralStateConfigured)
+                r = KErrUsbDeviceNotConfigured;
+            else
+                r = KErrUsbInterfaceNotReady;
+            }
+        break;
+
+    case RDevUsbcClient::EControlEndpointCaps:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlEndpointCaps"));
+        r = Kern::ThreadDesWrite(iClient, a1, pZeroDesc, 0, 0, iClient);
+        if (r != KErrNone)
+            PanicClientThread(r);
+        iController->EndpointCaps(this, *((TDes8*) a1));
+        break;
+
+    case RDevUsbcClient::EControlDeviceCaps:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlDeviceCaps"));
+        r = Kern::ThreadDesWrite(iClient, a1, pZeroDesc, 0, 0, iClient);
+        if (r != KErrNone)
+            PanicClientThread(r);
+        iController->DeviceCaps(this, *((TDes8*) a1));
+        break;
+
+    case RDevUsbcClient::EControlSendEp0StatusPacket:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSendEp0StatusPacket"));
+        iController->SendEp0StatusPacket(this);
+        break;
+
+    case RDevUsbcClient::EControlHaltEndpoint:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlHaltEndpoint"));
+        if (iValidInterface && ValidEndpoint((TInt) a1))
+            {
+            r = iController->HaltEndpoint(this, iEndpoint[(TInt)a1]->RealEpNumber());
+            }
+        else
+            {
+            if (iDeviceState != UsbShai::EUsbPeripheralStateConfigured)
+                r = KErrUsbDeviceNotConfigured;
+            else
+                r = KErrUsbInterfaceNotReady;
+            }
+        break;
+
+    case RDevUsbcClient::EControlClearHaltEndpoint:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlClearHaltEndpoint"));
+        if (iValidInterface && ValidEndpoint((TInt) a1))
+            {
+            r = iController->ClearHaltEndpoint(this, iEndpoint[(TInt)a1]->RealEpNumber());
+            }
+        else
+            {
+            if (iDeviceState != UsbShai::EUsbPeripheralStateConfigured)
+                r = KErrUsbDeviceNotConfigured;
+            else
+                r = KErrUsbInterfaceNotReady;
+            }
+        break;
+
+    case RDevUsbcClient::EControlDumpRegisters:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlDumpRegisters"));
+        iController->DumpRegisters();
+        break;
+
+    case RDevUsbcClient::EControlReleaseDeviceControl:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlReleaseDeviceControl"));
+        iController->ReleaseDeviceControl(this);
+        iOwnsDeviceControl = EFalse;
+        break;
+
+    case RDevUsbcClient::EControlEndpointZeroMaxPacketSizes:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlEndpointZeroMaxPacketSizes"));
+        r = iController->EndpointZeroMaxPacketSizes();
+        break;
+
+    case RDevUsbcClient::EControlSetEndpointZeroMaxPacketSize:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetEndpointZeroMaxPacketSize"));
+        r = iController->SetEndpointZeroMaxPacketSize(reinterpret_cast<TInt>(a1));
+        break;
+
+    case RDevUsbcClient::EControlGetEndpointZeroMaxPacketSize:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetEndpointZeroMaxPacketSize"));
+        r = iController->Ep0PacketSize();
+        break;
+
+    case RDevUsbcClient::EControlGetDeviceDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetDeviceDescriptor"));
+        r = Kern::ThreadDesWrite(iClient, a1, pZeroDesc, 0, 0, iClient);
+        if (r != KErrNone)
+            PanicClientThread(r);
+        r = iController->GetDeviceDescriptor(iClient, *((TDes8*) a1));
+        break;
+
+    case RDevUsbcClient::EControlSetDeviceDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetDeviceDescriptor"));
+        if (a1 != NULL)
+            r = iController->SetDeviceDescriptor(iClient, *((TDes8*) a1));
+        else
+            r = KErrArgument;
+        break;
+
+    case RDevUsbcClient::EControlGetDeviceDescriptorSize:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetDeviceDescriptorSize"));
+        if (a1 != NULL)
+            r = iController->GetDeviceDescriptorSize(iClient, *((TDes8*) a1));
+        else
+            r = KErrArgument;
+        break;
+
+    case RDevUsbcClient::EControlGetConfigurationDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetConfigurationDescriptor"));
+        r = Kern::ThreadDesWrite(iClient, a1, pZeroDesc, 0 , 0, iClient);
+        if (r != KErrNone)
+            PanicClientThread(r);
+        r = iController->GetConfigurationDescriptor(iClient, *((TDes8*) a1));
+        break;
+
+    case RDevUsbcClient::EControlGetConfigurationDescriptorSize:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetConfigurationDescriptorSize"));
+        if (a1 != NULL)
+            {
+            r = iController->GetConfigurationDescriptorSize(iClient, *((TDes8*) a1));
+            }
+        else
+            r = KErrArgument;
+        break;
+
+    case RDevUsbcClient::EControlSetConfigurationDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetConfigurationDescriptor"));
+        r = iController->SetConfigurationDescriptor(iClient, *((TDes8*) a1));
+        break;
+
+    case RDevUsbcClient::EControlGetInterfaceDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetInterfaceDescriptor"));
+        r = iController->GetInterfaceDescriptor(iClient, this, (TInt) a1, *((TDes8*) a2));
+        break;
+
+    case RDevUsbcClient::EControlGetInterfaceDescriptorSize:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetInterfaceDescriptorSize"));
+        r = iController->GetInterfaceDescriptorSize(iClient, this, (TInt) a1, *(TDes8*) a2);
+        break;
+
+    case RDevUsbcClient::EControlSetInterfaceDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetInterfaceDescriptor"));
+        r = iController->SetInterfaceDescriptor(iClient, this, (TInt) a1, *((TDes8*) a2));
+        break;
+
+    case RDevUsbcClient::EControlGetEndpointDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetEndpointDescriptor"));
+        r = Kern::ThreadRawRead(iClient, a1, &epInfo, sizeof(epInfo));
+        if (r != KErrNone)
+            PanicClientThread(r);
+        ep = EpFromAlternateSetting(epInfo.iSetting, epInfo.iEndpoint);
+        r = iController->GetEndpointDescriptor(iClient, this, epInfo.iSetting,
+                                               ep, *(TDes8*) epInfo.iArg);
+        break;
+
+    case RDevUsbcClient::EControlGetEndpointDescriptorSize:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetEndpointDescriptorSize"));
+        r = Kern::ThreadRawRead(iClient, a1, &epInfo, sizeof(epInfo));
+        if (r != KErrNone)
+            PanicClientThread(r);
+        ep = EpFromAlternateSetting(epInfo.iSetting, epInfo.iEndpoint);
+        r = iController->GetEndpointDescriptorSize(iClient, this, epInfo.iSetting,
+                                                   ep, *(TDes8*) epInfo.iArg);
+        break;
+
+    case RDevUsbcClient::EControlSetEndpointDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetEndpointDescriptor"));
+        r = Kern::ThreadRawRead(iClient, a1, &epInfo, sizeof(epInfo));
+        if (r != KErrNone)
+            PanicClientThread(r);
+        ep = EpFromAlternateSetting(epInfo.iSetting, epInfo.iEndpoint);
+        r = iController->SetEndpointDescriptor(iClient, this, epInfo.iSetting,
+                                               ep, *(TDes8*)epInfo.iArg);
+        break;
+
+    case RDevUsbcClient::EControlGetDeviceQualifierDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetDeviceQualifierDescriptor"));
+        r = Kern::ThreadDesWrite(iClient, a1, pZeroDesc, 0, 0, iClient);
+        if (r != KErrNone)
+            PanicClientThread(r);
+        r = iController->GetDeviceQualifierDescriptor(iClient, *((TDes8*) a1));
+        break;
+
+    case RDevUsbcClient::EControlSetDeviceQualifierDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetDeviceQualifierDescriptor"));
+        if (a1 != NULL)
+            r = iController->SetDeviceQualifierDescriptor(iClient, *((TDes8*) a1));
+        else
+            r = KErrArgument;
+        break;
+
+    case RDevUsbcClient::EControlGetOtherSpeedConfigurationDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetOtherSpeedConfigurationDescriptor"));
+        r = Kern::ThreadDesWrite(iClient, a1, pZeroDesc, 0 , 0, iClient);
+        if (r != KErrNone)
+            PanicClientThread(r);
+        r = iController->GetOtherSpeedConfigurationDescriptor(iClient, *((TDes8*) a1));
+        break;
+
+    case RDevUsbcClient::EControlSetOtherSpeedConfigurationDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetOtherSpeedConfigurationDescriptor"));
+        r = iController->SetOtherSpeedConfigurationDescriptor(iClient, *((TDes8*) a1));
+        break;
+
+
+    case RDevUsbcClient::EControlGetCSInterfaceDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetCSInterfaceDescriptor"));
+        r = iController->GetCSInterfaceDescriptorBlock(iClient, this, (TInt) a1, *((TDes8*) a2));
+        break;
+
+    case RDevUsbcClient::EControlGetCSInterfaceDescriptorSize:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetCSInterfaceDescriptorSize"));
+        r = iController->GetCSInterfaceDescriptorBlockSize(iClient, this, (TInt) a1, *(TDes8*) a2);
+        break;
+
+    case RDevUsbcClient::EControlGetCSEndpointDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetCSEndpointDescriptor"));
+        r = Kern::ThreadRawRead(iClient, a1, &epInfo, sizeof(epInfo));
+        if (r != KErrNone)
+            PanicClientThread(r);
+        ep = EpFromAlternateSetting(epInfo.iSetting, epInfo.iEndpoint);
+        r = iController->GetCSEndpointDescriptorBlock(iClient, this, epInfo.iSetting,
+                                                      ep, *(TDes8*) epInfo.iArg);
+        break;
+
+    case RDevUsbcClient::EControlGetCSEndpointDescriptorSize:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetCSEndpointDescriptorSize"));
+        r = Kern::ThreadRawRead(iClient, a1, &epInfo, sizeof(epInfo));
+        if (r != KErrNone)
+            PanicClientThread(r);
+        ep = EpFromAlternateSetting(epInfo.iSetting, epInfo.iEndpoint);
+        r = iController->GetCSEndpointDescriptorBlockSize(iClient, this, epInfo.iSetting,
+                                                          ep, *(TDes8*) epInfo.iArg);
+        break;
+
+    case RDevUsbcClient::EControlSignalRemoteWakeup:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSignalRemoteWakeup"));
+        r = iController->SignalRemoteWakeup();
+        break;
+
+    case RDevUsbcClient::EControlDeviceDisconnectFromHost:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlDeviceDisconnectFromHost"));
+        r = iController->UsbDisconnect();
+        break;
+
+    case RDevUsbcClient::EControlDeviceConnectToHost:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlDeviceConnectToHost"));
+        r = iController->UsbConnect();
+        break;
+
+    case RDevUsbcClient::EControlDevicePowerUpUdc:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlDevicePowerUpUdc"));
+        r = iController->PowerUpUdc();
+        break;
+
+    case RDevUsbcClient::EControlSetDeviceControl:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetDeviceControl"));
+        r = iController->SetDeviceControl(this);
+        if (r == KErrNone)
+            {
+            iOwnsDeviceControl = ETrue;
+            if (iEndpoint[0] == NULL)
+                {
+                __KTRACE_OPT(KUSB, Kern::Printf("EControlSetDeviceControl 11"));
+                r = SetupEp0();
+                if (r != KErrNone)
+                    {
+                    __KTRACE_OPT(KPANIC, Kern::Printf("  Error: SetupEp0() failed"));
+                    iController->ReleaseDeviceControl(this);
+                    DestroyEp0();
+                    iOwnsDeviceControl = EFalse;
+                    }
+                iEndpoint[0]->TryToStartRead(EFalse);
+                }
+            }
+        else
+            r = KErrInUse;
+        break;
+
+    case RDevUsbcClient::EControlCurrentlyUsingHighSpeed:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlCurrentlyUsingHighSpeed"));
+        r = iController->CurrentlyUsingHighSpeed();
+        break;
+
+    case RDevUsbcClient::EControlSetInterface:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetInterface"));
+        r = Kern::ThreadRawRead(iClient, a2, &ifcInfo, sizeof(ifcInfo));
+        if (r != KErrNone)
+            PanicClientThread(r);
+        if (iValidInterface && (iDeviceState == UsbShai::EUsbPeripheralStateConfigured))
+            {
+            r = KErrGeneral;
+            }
+        else
+            {
+            bandwidthPriority = ifcInfo.iBandwidthPriority;
+            if ((bandwidthPriority & 0xffffff00) ||
+                ((bandwidthPriority & 0x0f) >= KUsbcDmaBufMaxPriorities) ||
+                (((bandwidthPriority >> 4) & 0x0f) >= KUsbcDmaBufMaxPriorities))
+                {
+                r = KErrArgument;
+                }
+            else
+                {
+                r = SetInterface((TInt) a1, &ifcInfo);
+                }
+            }
+            
+        break;
+
+    case RDevUsbcClient::EControlReleaseInterface:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlReleaseInterface"));
+        r = iController->ReleaseInterface(this, (TInt) a1);
+        if (r == KErrNone)
+            {
+            DestroyInterface((TUint) a1);
+            }
+        else
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error in PIL: LDD interface won't be released."));
+            }
+        break;
+
+    case RDevUsbcClient::EControlSetCSInterfaceDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetCSInterfaceDescriptor"));
+        r = Kern::ThreadRawRead(iClient, a1, &desInfo, sizeof(desInfo));
+        if (r != KErrNone)
+            PanicClientThread(r);
+        r = iController->SetCSInterfaceDescriptorBlock(iClient, this, desInfo.iSetting,
+                                                       *reinterpret_cast<const TDes8*>(desInfo.iArg),
+                                                       desInfo.iSize);
+        break;
+
+    case RDevUsbcClient::EControlSetCSEndpointDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetCSEndpointDescriptor"));
+        r = Kern::ThreadRawRead(iClient, a1, &desInfo, sizeof(desInfo));
+        if (r != KErrNone)
+            PanicClientThread(r);
+        ep = EpFromAlternateSetting(desInfo.iSetting, desInfo.iEndpoint);
+        r = iController->SetCSEndpointDescriptorBlock(iClient, this, desInfo.iSetting, ep,
+                                                      *reinterpret_cast<const TDes8*>(desInfo.iArg),
+                                                      desInfo.iSize);
+        break;
+
+    case RDevUsbcClient::EControlGetStringDescriptorLangId:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetStringDescriptorLangId"));
+        r = iController->GetStringDescriptorLangId(iClient, *((TDes8*) a1));
+        break;
+
+    case RDevUsbcClient::EControlSetStringDescriptorLangId:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetStringDescriptorLangId"));
+        r = iController->SetStringDescriptorLangId(reinterpret_cast<TUint>(a1));
+        break;
+
+    case RDevUsbcClient::EControlGetManufacturerStringDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetManufacturerStringDescriptor"));
+        r = iController->GetManufacturerStringDescriptor(iClient, *((TPtr8*) a1));
+        break;
+
+    case RDevUsbcClient::EControlSetManufacturerStringDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetManufacturerStringDescriptor"));
+        r = iController->SetManufacturerStringDescriptor(iClient, *((TPtr8*) a1));
+        break;
+
+    case RDevUsbcClient::EControlRemoveManufacturerStringDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlRemoveManufacturerStringDescriptor"));
+        r = iController->RemoveManufacturerStringDescriptor();
+        break;
+
+    case RDevUsbcClient::EControlGetProductStringDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetProductStringDescriptor"));
+        r = iController->GetProductStringDescriptor(iClient, *((TPtr8*) a1));
+        break;
+
+    case RDevUsbcClient::EControlSetProductStringDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetProductStringDescriptor"));
+        r = iController->SetProductStringDescriptor(iClient, *((TPtr8*) a1));
+        break;
+
+    case RDevUsbcClient::EControlRemoveProductStringDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlRemoveProductStringDescriptor"));
+        r = iController->RemoveProductStringDescriptor();
+        break;
+
+    case RDevUsbcClient::EControlGetSerialNumberStringDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetSerialNumberStringDescriptor"));
+        r = iController->GetSerialNumberStringDescriptor(iClient, *((TPtr8*) a1));
+        break;
+
+    case RDevUsbcClient::EControlSetSerialNumberStringDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetSerialNumberStringDescriptor"));
+        r = iController->SetSerialNumberStringDescriptor(iClient, *((TPtr8*) a1));
+        break;
+
+    case RDevUsbcClient::EControlRemoveSerialNumberStringDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlRemoveSerialNumberStringDescriptor"));
+        r = iController->RemoveSerialNumberStringDescriptor();
+        break;
+
+    case RDevUsbcClient::EControlGetConfigurationStringDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetConfigurationStringDescriptor"));
+        r = iController->GetConfigurationStringDescriptor(iClient, *((TPtr8*) a1));
+        break;
+
+    case RDevUsbcClient::EControlSetConfigurationStringDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetConfigurationStringDescriptor"));
+        r = iController->SetConfigurationStringDescriptor(iClient, *((TPtr8*) a1));
+        break;
+
+    case RDevUsbcClient::EControlRemoveConfigurationStringDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlRemoveConfigurationStringDescriptor"));
+        r = iController->RemoveConfigurationStringDescriptor();
+        break;
+
+    case RDevUsbcClient::EControlGetStringDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetStringDescriptor"));
+        r = iController->GetStringDescriptor(iClient, (TUint8) (TInt) a1, *((TPtr8*) a2));
+        break;
+
+    case RDevUsbcClient::EControlSetStringDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetStringDescriptor"));
+        r = iController->SetStringDescriptor(iClient, (TUint8) (TInt) a1, *((TPtr8*) a2));
+        break;
+
+    case RDevUsbcClient::EControlRemoveStringDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlRemoveStringDescriptor"));
+        r = iController->RemoveStringDescriptor((TUint8) (TInt) a1);
+        break;
+
+    case RDevUsbcClient::EControlQueryEndpointResourceUse:
+        epRes = (TUsbcEndpointResource)((TInt) a2);
+        if (!ValidEndpoint((TInt)a1))
+            {
+            r = KErrUsbEpNotInInterface;
+            }
+        else
+            {
+            r = iController->QueryEndpointResource(this, iEndpoint[(TInt)a1]->RealEpNumber(), epRes);
+            }
+        break;
+
+    case RDevUsbcClient::EControlSetOtgDescriptor:
+        {
+        r = iController->SetOtgDescriptor(iClient, *((const TDesC8*)a1));
+        }
+        break;
+
+    case RDevUsbcClient::EControlGetOtgDescriptor:
+        {
+        r = iController->GetOtgDescriptor(iClient, *((TDes8*)a1));
+        }
+        break;
+
+    case RDevUsbcClient::EControlGetOtgFeatures:
+        {
+        r = iController->GetOtgFeatures(iClient, *((TDes8*)a1));
+        }
+        break;
+
+    default:
+        __KTRACE_OPT(KUSB, Kern::Printf("Function code not supported"));
+        r = KErrNotSupported;
+        }
+
+    return r;
+    }
+
+
+TInt DLddUsbcChannel::SetInterface(TInt aInterfaceNumber, TUsbcIfcInfo* aInfoBuf)
+    {
+    TUsbcInterfaceInfoBuf ifc_info_buf;
+    TUsbcInterfaceInfoBuf* const ifc_info_buf_ptr = aInfoBuf->iInterfaceData;
+    const TInt srcLen = Kern::ThreadGetDesLength(iClient, ifc_info_buf_ptr);
+    if (srcLen < ifc_info_buf.Length())
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("SetInterface can't copy"));
+        PanicClientThread(EDesOverflow);
+        }
+
+    TInt r = Kern::ThreadDesRead(iClient, ifc_info_buf_ptr, ifc_info_buf, 0, KChunkShiftBy0);
+    if (r != KErrNone)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("SetInterface Copy failed reason=%d", r));
+        PanicClientThread(r);
+        }
+
+    TUsbcEndpointInfo* pEndpointData = ifc_info_buf().iEndpointData;
+
+    // If an alternate interface is being asked for then do nothing,
+    // just pass it down to the Controller.
+    const TInt num_endpoints = ifc_info_buf().iTotalEndpointsUsed;
+    __KTRACE_OPT(KUSB, Kern::Printf("SetInterface num_endpoints=%d", num_endpoints));
+
+    // [The next 4 variables have to be initialized here because of the goto's that follow.]
+    // Both IN and OUT buffers will be fully cached:
+    const TUint32 cacheAttribs = EMapAttrSupRw | EMapAttrCachedMax;
+    const TUint32 bandwidthPriority = aInfoBuf->iBandwidthPriority;
+
+    // Supports ep0+5 endpoints
+    TInt real_ep_numbers[6] = {-1, -1, -1, -1, -1, -1};
+
+    // See if PIL will accept this interface
+    __KTRACE_OPT(KUSB, Kern::Printf("SetInterface Calling controller"));
+    r = iController->SetInterface(this,
+                                  iClient,
+                                  aInterfaceNumber,
+                                  ifc_info_buf().iClass,
+                                  aInfoBuf->iString,
+                                  ifc_info_buf().iTotalEndpointsUsed,
+                                  ifc_info_buf().iEndpointData,
+                                  &real_ep_numbers,
+                                  ifc_info_buf().iFeatureWord);
+
+    __KTRACE_OPT(KUSB, Kern::Printf("SetInterface controller returned %d", r));
+    if (r != KErrNone)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("SetInterface failed reason=%d", r));
+        return r;
+        }
+
+    // [The next variable has to be initialized here because of the goto's that follow.]
+    TUsbcAlternateSettingList* alternateSettingListRec;
+
+    // ep0
+    if (iEndpoint[0] == NULL)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("SetInterface 11"));
+        r = SetupEp0();
+        if (r != KErrNone)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: SetupEp0() failed"));
+            DestroyEp0();
+            goto F1;
+            }
+        }
+
+    alternateSettingListRec = new TUsbcAlternateSettingList;
+    if (!alternateSettingListRec)
+        {
+        r = KErrNoMemory;
+        goto F1;
+        }
+
+    __KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcChannel::SetInterface num_endpoints=%d", num_endpoints));
+
+    // other endpoints
+    // calculate the total buffer size
+    for (TInt i = 1; i <= num_endpoints; i++, pEndpointData++)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("SetInterface for ep=%d", i));
+        if (!ValidateEndpoint(pEndpointData))
+            {
+            r = KErrUsbBadEndpoint;
+            goto F2;
+            }
+
+        TUsbcEndpoint* ep = new TUsbcEndpoint(this, iController, pEndpointData, i, bandwidthPriority);
+        alternateSettingListRec->iEndpoint[i] = ep;
+        if (!ep)
+            {
+            r = KErrNoMemory;
+            goto F2;
+            }
+        if (ep->Construct() != KErrNone)
+            {
+            r = KErrNoMemory;
+            goto F2;
+            }
+
+        __KTRACE_OPT(KUSB, Kern::Printf("SetInterface for ep=%d rec=0x%08x ep==0x%08x",
+                                        i, alternateSettingListRec, ep));
+        }
+
+    // buf size of each endpoint
+    TInt bufSizes[KMaxEndpointsPerClient + 1];
+    TInt epNum[KMaxEndpointsPerClient + 1];
+
+    // init
+    for( TInt i=0;i<KMaxEndpointsPerClient+1;i++ )
+        {
+        bufSizes[i] = -1;
+        epNum[i] = i;
+        }
+
+    // Record the actual buf size of each endpoint
+    for( TInt i=1;i<=num_endpoints;i++ )
+        {
+        bufSizes[i] = alternateSettingListRec->iEndpoint[i]->BufferSize();
+        }
+
+    __KTRACE_OPT(KUSB, Kern::Printf("Sort the endpoints:"));
+
+    // sort the endpoint number by the bufsize decreasely
+    for( TInt i=1;i<num_endpoints;i++ )
+        {
+        TInt epMaxBuf = i;
+        for(TInt k=i+1;k<=num_endpoints;k++ )
+            {
+            if( bufSizes[epMaxBuf]<bufSizes[k])
+                {
+                epMaxBuf = k;
+                }
+            }
+        TInt temp = bufSizes[i];
+        bufSizes[i] = bufSizes[epMaxBuf];
+        bufSizes[epMaxBuf] = temp;
+
+        temp = epNum[i];
+        epNum[i] = epNum[epMaxBuf];
+        epNum[epMaxBuf] = temp;
+
+        alternateSettingListRec->iEpNumDeOrderedByBufSize[i] = epNum[i];
+
+        __KTRACE_OPT(KUSB, Kern::Printf(" %d:%d", epNum[i], bufSizes[i]));
+        }
+    alternateSettingListRec->iEpNumDeOrderedByBufSize[num_endpoints] = epNum[num_endpoints];
+    __KTRACE_OPT(KUSB, Kern::Printf(" %d:%d", epNum[num_endpoints], bufSizes[num_endpoints]));
+    __KTRACE_OPT(KUSB, Kern::Printf("\n"));
+
+    // chain in this alternate setting
+    alternateSettingListRec->iNext = iAlternateSettingList;
+    iAlternateSettingList = alternateSettingListRec;
+    alternateSettingListRec->iSetting = aInterfaceNumber;
+    alternateSettingListRec->iNumberOfEndpoints = num_endpoints;
+
+    // Record the 'real' endpoint number used by the PDD in both the Ep and
+    // the Req callback:
+    for (TInt i = 1; i <= num_endpoints; i++)
+        {
+        alternateSettingListRec->iEndpoint[i]->SetRealEpNumber(real_ep_numbers[i]);
+        }
+
+    r = SetupInterfaceMemory(iHwChunks, cacheAttribs );
+    if( r==KErrNone )
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("SetInterface ready to exit"));
+    
+        if (aInterfaceNumber == 0)
+            {
+            // make sure we're ready to go with the main interface
+            iValidInterface = ETrue;
+            __KTRACE_OPT(KUSB, Kern::Printf("SetInterface SelectAlternateSetting"));
+            SelectAlternateSetting(0);
+            }
+        return KErrNone;
+        }
+    else
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("Destroying all interfaces"));
+        DestroyAllInterfaces();
+        DestroyEp0();
+        return r;
+        }
+
+ F2:
+    delete alternateSettingListRec;
+    //Fall through
+ 
+ F1:
+#if _DEBUG
+    TInt r1 = iController->ReleaseInterface(this, aInterfaceNumber);
+    __KTRACE_OPT(KUSB, Kern::Printf("Release Interface controller returned %d", r1));
+#else
+    (void)    iController->ReleaseInterface(this, aInterfaceNumber);
+#endif
+    return r;
+    }
+
+// realloc the memory, and set the previous interfaces 
+TInt DLddUsbcChannel::SetupInterfaceMemory(RArray<DPlatChunkHw*> &aHwChunks, 
+        TUint32 aCacheAttribs )
+    {
+    TUsbcAlternateSettingList* asRec = iAlternateSettingList;
+
+    // if buffers has been changed
+    TBool chunkChanged = EFalse;
+    TInt numOfEp = asRec->iNumberOfEndpoints;
+ 
+    // 1, collect all bufs' sizes for the current interface
+    //    to realloc all the chunks
+    __KTRACE_OPT(KUSB, Kern::Printf("Collect all buffer sizes:"));
+    RArray<TInt> bufSizes;
+    for(TInt i=1;i<=numOfEp;i++)
+        {
+        TInt nextEp = asRec->iEpNumDeOrderedByBufSize[i];
+        TInt epBufCount = asRec->iEndpoint[nextEp]->BufferNumber();
+        __KTRACE_OPT(KUSB, Kern::Printf(" ep %d, buf count %d", nextEp, epBufCount ));
+        for(TInt k=0;k<epBufCount;k++)
+            {
+            TInt epBufSize = asRec->iEndpoint[nextEp]->BufferSize();
+            TInt r = bufSizes.Append(epBufSize);
+            if(r!=KErrNone)
+                {
+                iController->DeRegisterClient(this);
+                bufSizes.Close();
+                return r;
+                }
+            __KTRACE_OPT(KUSB,Kern::Printf(" %d", epBufSize ));
+            }
+        __KTRACE_OPT(KUSB, Kern::Printf("\n"));
+
+        }
+   
+    // 2, alloc the buffer decreasely, biggest-->smallest
+    //   2.1 check the existing chunks
+    TInt bufCount = bufSizes.Count();
+    __KTRACE_OPT(KUSB, Kern::Printf(" ep buf number needed %d", bufCount ));
+    __KTRACE_OPT(KUSB, Kern::Printf(" chunks available %d", aHwChunks.Count() ));
+
+    TInt chunkInd = 0;
+    while( (chunkInd<aHwChunks.Count())&& (chunkInd<bufCount))
+        {
+        TUint8* oldAddr = NULL;
+        oldAddr = reinterpret_cast<TUint8*>(aHwChunks[chunkInd]->LinearAddress());
+
+        DPlatChunkHw* chunk = ReAllocate(bufSizes[chunkInd], aHwChunks[chunkInd], aCacheAttribs);
+        if (chunk == NULL)
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("Failed to alloc chunks size %d!", bufSizes[chunkInd]));
+            // lost all interfaces:
+            // Tell Controller to release Interface and h/w resources associated with this
+            iController->DeRegisterClient(this);
+            bufSizes.Close();
+            return KErrNoMemory;
+            }
+        else
+            {
+            // Parcel out the memory between endpoints
+            TUint8* newAddr = reinterpret_cast<TUint8*>(chunk->LinearAddress());
+            __KTRACE_OPT(KUSB, Kern::Printf("SetupInterfaceMemory alloc new chunk=0x%x, size=%d", newAddr,bufSizes[chunkInd]));
+            // The check is important to avoid chunkChanged to be corrupted.
+            // This code change is to fix the problem that one chunk is used by multiple interfaces.
+            if(!chunkChanged)
+                {
+                chunkChanged = (newAddr != oldAddr);
+                }            
+            aHwChunks[chunkInd] = chunk;
+            }
+        chunkInd++;
+        }
+    
+    //   2.2 in case available chunks are not enough
+    while( chunkInd<bufCount)
+        {
+        DPlatChunkHw* chunk = NULL;
+        chunk = Allocate( bufSizes[chunkInd], aCacheAttribs);
+        if (chunk == NULL)
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("Failed to alloc chunk, size %d!", bufSizes[chunkInd]));
+            // lost all interfaces:
+            // Tell Controller to release Interface and h/w resources associated with this
+            iController->DeRegisterClient(this);
+            bufSizes.Close();
+            return KErrNoMemory;
+            }
+        else
+            {
+            // Parcel out the memory between endpoints
+            __KTRACE_OPT(KUSB, Kern::Printf("SetupInterfaceMemory alloc new chunk=0x%x, size=%d",
+                                    reinterpret_cast<TUint8*>(chunk->LinearAddress()), bufSizes[chunkInd]));
+            TInt r = aHwChunks.Append(chunk);
+            if(r!=KErrNone)
+                {
+                ClosePhysicalChunk(chunk);
+                iController->DeRegisterClient(this);
+                bufSizes.Close();
+                return r;
+                }
+            }
+        chunkInd++;
+        }
+
+    // 3, Set the the bufs of the interfaces
+    
+    ReSetInterfaceMemory(asRec, aHwChunks);
+
+    if(chunkChanged)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("SetupInterfaceMemory readdressing."));
+        asRec = asRec->iNext;
+        while (asRec)
+            {
+            // Interfaces are not concurrent so they can all start at the same logical address
+            __KTRACE_OPT(KUSB, Kern::Printf("SetupInterfaceMemory readdressing setting=%d", asRec->iSetting));
+            ReSetInterfaceMemory(asRec, aHwChunks);
+            asRec = asRec->iNext;
+            }
+        }
+    return KErrNone;
+    }
+
+TInt DLddUsbcChannel::SetupEp0()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("SetupEp0 entry %x", this));
+    TInt ep0Size = iController->Ep0PacketSize();
+    TUsbcEndpointInfo ep0Info = TUsbcEndpointInfo(UsbShai::KUsbEpTypeControl, UsbShai::KUsbEpDirBidirect, ep0Size);
+    TUsbcEndpoint* ep0 = new TUsbcEndpoint(this, iController, &ep0Info, 0, 0);
+    if (ep0 == NULL)
+        {
+        return KErrNoMemory;
+        }
+    // In case we have to return early:
+    iEndpoint[0] = ep0;
+    TInt r = ep0->Construct();
+    if (r != KErrNone)
+        {
+        return KErrNoMemory;
+        }
+
+    TInt bufferNum = ep0->BufferNumber();
+    TInt bufferSize = ep0->BufferSize();
+    TUint32 cacheAttribs = EMapAttrSupRw | EMapAttrCachedMax;
+
+    for(TInt i=0;i<bufferNum;i++)
+        {
+        DPlatChunkHw* chunk = Allocate(bufferSize, cacheAttribs );
+        if(chunk==NULL)
+            {
+            return KErrNoMemory;
+            }
+        TInt r = iHwChunksEp0.Append(chunk);
+        if(r!=KErrNone)
+            {
+            ClosePhysicalChunk(chunk);
+            return r;
+            }
+        TUint8 * buf;
+        buf = (TUint8*) chunk->LinearAddress();
+        ep0->SetBufferAddr( i, buf);
+        __KTRACE_OPT(KUSB, Kern::Printf("SetupEp0 60 buffer number %d", i));
+        __KTRACE_OPT(KUSB, Kern::Printf("SetupEp0 60 buffer size %d", bufferSize));
+        }
+
+    ep0->SetRealEpNumber(0);
+    return KErrNone;
+    }
+
+// Set buffer address of the interface
+// Precondition: Enough chunks available.
+void DLddUsbcChannel::ReSetInterfaceMemory(TUsbcAlternateSettingList* aAlternateSettingListRec,
+        RArray<DPlatChunkHw*> &aHwChunks)
+    {
+    TUsbcAlternateSettingList* asRec = aAlternateSettingListRec;
+
+    // set all the interfaces
+    TInt chunkInd = 0;
+    TInt numOfEp = asRec->iNumberOfEndpoints;
+
+    for (TInt i = 1; i <= numOfEp; i++)
+        {
+        TInt nextEp = asRec->iEpNumDeOrderedByBufSize[i];
+        TInt epBufCount = asRec->iEndpoint[nextEp]->BufferNumber();
+        for(TInt k=0;k<epBufCount;k++)
+            {
+            TUsbcEndpoint* ep = asRec->iEndpoint[nextEp];
+            if (ep != NULL )
+                {
+                TUint8* pBuf = NULL;
+                pBuf = reinterpret_cast<TUint8*>(aHwChunks[chunkInd]->LinearAddress());
+                ep->SetBufferAddr( k, pBuf);
+                __KTRACE_OPT(KUSB, Kern::Printf("  ep %d, buf %d, addr 0x%x", nextEp, k, pBuf ));
+                chunkInd++;
+                __ASSERT_DEBUG(chunkInd<=aHwChunks.Count(),
+                               Kern::Printf("  Error: available chunks %d, run out at epInd%d, bufInd%d",
+                                       aHwChunks.Count(), i, k));
+                __ASSERT_DEBUG(chunkInd<=aHwChunks.Count(),
+                                   Kern::Fault("usbc.ldd", __LINE__));
+                }
+            }
+        }
+
+    }
+
+void DLddUsbcChannel::DestroyAllInterfaces()
+    {
+    // Removes all interfaces
+    TUsbcAlternateSettingList* alternateSettingListRec = iAlternateSettingList;
+    while (alternateSettingListRec)
+        {
+        iController->ReleaseInterface(this, alternateSettingListRec->iSetting);
+        TUsbcAlternateSettingList* alternateSettingListRecNext = alternateSettingListRec->iNext;
+        delete alternateSettingListRec;
+        alternateSettingListRec = alternateSettingListRecNext;
+        }
+    iNumberOfEndpoints = 0;
+    iAlternateSettingList = NULL;
+
+    for(TInt i=0;i<iHwChunks.Count();i++)
+        {
+        ClosePhysicalChunk( iHwChunks[i]);
+        }
+    iHwChunks.Close();
+
+    iValidInterface = EFalse;
+    }
+
+
+void DLddUsbcChannel::DestroyInterface(TUint aInterfaceNumber)
+    {
+    if (iAlternateSetting == aInterfaceNumber)
+        {
+        ResetInterface(KErrUsbInterfaceNotReady);
+        iValidInterface = EFalse;
+        iNumberOfEndpoints = 0;
+        for (TInt i = 1; i <= KMaxEndpointsPerClient; i++)
+            {
+            iEndpoint[i] = NULL;
+            }
+        }
+    TUsbcAlternateSettingList* alternateSettingListRec = iAlternateSettingList;
+    TUsbcAlternateSettingList* alternateSettingListRecOld = NULL;
+    while (alternateSettingListRec)
+        {
+        TUsbcAlternateSettingList* alternateSettingListRecNext = alternateSettingListRec->iNext;
+        if (alternateSettingListRec->iSetting == aInterfaceNumber)
+            {
+            // This record is to be deleted
+            if (alternateSettingListRecOld == NULL)
+                {
+                // The record to be deleted is at the list head
+                iAlternateSettingList = alternateSettingListRecNext;
+                }
+            else
+                {
+                // The record to be deleted is NOT at the list head
+                alternateSettingListRecOld->iNext = alternateSettingListRecNext;
+                }
+            delete alternateSettingListRec;
+            break;
+            }
+        alternateSettingListRecOld = alternateSettingListRec;
+        alternateSettingListRec = alternateSettingListRecNext;
+        }
+
+    if (iAlternateSettingList == NULL)
+        {
+        // if no interfaces left destroy non-ep0 buffering
+        for(TInt i=0;i<iHwChunks.Count();i++)
+            {
+            ClosePhysicalChunk( iHwChunks[i]);
+            }
+        iHwChunks.Close();
+        }
+    }
+
+
+void DLddUsbcChannel::DestroyEp0()
+    {
+    delete iEndpoint[0];
+    iEndpoint[0] = NULL;
+    for(TInt i=0;i<iHwChunksEp0.Count();i++)
+        {
+        ClosePhysicalChunk( iHwChunksEp0[i] );
+        }
+    iHwChunksEp0.Close();
+    }
+
+
+void DLddUsbcChannel::EndpointStatusChangeCallback(TAny* aDLddUsbcChannel)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("EndpointStatusChangeCallback"));
+    DLddUsbcChannel* dUsbc = (DLddUsbcChannel*) aDLddUsbcChannel;
+    if (dUsbc->iChannelClosing)
+        return;
+    TUint endpointState = dUsbc->iEndpointStatusCallbackInfo.State();
+    const TInt reqNo = (TInt) RDevUsbcClient::ERequestEndpointStatusNotify;
+    if (dUsbc->iRequestStatus[reqNo])
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("EndpointStatusChangeCallback Notify status"));
+        DThread* client = dUsbc->iClient;
+        
+        dUsbc->iEndpointStatusChangeReq->Data() = endpointState;
+        dUsbc->iRequestStatus[reqNo] = NULL;
+        Kern::QueueRequestComplete(client,dUsbc->iEndpointStatusChangeReq,KErrNone);
+        dUsbc->iEndpointStatusChangePtr = NULL;
+        }
+    }
+
+
+void DLddUsbcChannel::StatusChangeCallback(TAny* aDLddUsbcChannel)
+    {
+    DLddUsbcChannel* dUsbc = (DLddUsbcChannel*) aDLddUsbcChannel;
+    if (dUsbc->iChannelClosing)
+        return;
+
+    TUsbcDeviceState deviceState;
+    TInt i;
+     for (i = 0;
+          (i < KUsbcDeviceStateRequests) && ((deviceState = dUsbc->iStatusCallbackInfo.State(i)) != UsbShai::EUsbPeripheralNoState);
+          ++i)
+        {
+         __KTRACE_OPT(KUSB, Kern::Printf("StatusChangeCallBack status=%d", deviceState));
+        if (deviceState & KUsbAlternateSetting)
+            {
+            dUsbc->ProcessAlternateSetting(deviceState);
+            }
+        else
+            {
+            dUsbc->ProcessDeviceState(deviceState);
+            }
+        // Only queue if userside is interested
+        if (dUsbc->iDeviceStatusNeeded)
+            {
+            dUsbc->iStatusFifo->AddStatusToQueue(deviceState);
+            const TInt reqNo = (TInt) RDevUsbcClient::ERequestAlternateDeviceStatusNotify;
+            if (dUsbc->AlternateDeviceStateTestComplete())
+                {
+                    dUsbc->iRequestStatus[reqNo]=NULL;
+                    Kern::QueueRequestComplete(dUsbc->iClient,dUsbc->iStatusChangeReq,KErrNone);
+                }
+            }
+        }
+     // We don't want to be interrupted in the middle of this:
+    const TInt irqs = NKern::DisableInterrupts(2);
+     dUsbc->iStatusCallbackInfo.ResetState();
+    NKern::RestoreInterrupts(irqs);
+    }
+
+
+void DLddUsbcChannel::OtgFeatureChangeCallback(TAny* aDLddUsbcChannel)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("OtgFeatureChangeCallback"));
+    DLddUsbcChannel* dUsbc = (DLddUsbcChannel*) aDLddUsbcChannel;
+    if (dUsbc->iChannelClosing)
+        return;
+
+    TUint8 features;
+    // No return value check. Assume OTG always supported here
+    dUsbc->iController->GetCurrentOtgFeatures(features);
+
+    const TInt reqNo = (TInt) RDevUsbcClient::ERequestOtgFeaturesNotify;
+    if (dUsbc->iRequestStatus[reqNo])
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("OtgFeatureChangeCallback Notify status"));
+        dUsbc->iOtgFeatureChangeReq->Data()=features;
+        dUsbc->iRequestStatus[reqNo] = NULL;
+        Kern::QueueRequestComplete(dUsbc->iClient,dUsbc->iOtgFeatureChangeReq,KErrNone);
+        dUsbc->iOtgFeatureChangePtr = NULL;
+        }
+    }
+
+
+TInt DLddUsbcChannel::SelectAlternateSetting(TUint aAlternateSetting)
+    {
+    TInt r = KErrGeneral;                                    // error code doesn't go userside
+    TUsbcAlternateSettingList* alternateSettingListRec = iAlternateSettingList;
+    while (alternateSettingListRec)
+        {
+        if (alternateSettingListRec->iSetting == aAlternateSetting)
+            {
+            // found the correct interface, now latch in new endpoint set
+            for (TInt i = 1; i <= KMaxEndpointsPerClient; i++)
+                {
+                iEndpoint[i] = NULL;
+                }
+            iNumberOfEndpoints = alternateSettingListRec->iNumberOfEndpoints;
+            r = KErrNone;
+            for (TInt i = 1; i <= KMaxEndpointsPerClient; i++)
+                {
+                iEndpoint[i] = alternateSettingListRec->iEndpoint[i];
+                }
+            // Only after correct alternate setting has been chosen.
+            UpdateEndpointSizes();
+            }
+        alternateSettingListRec = alternateSettingListRec->iNext;
+        }
+    return r;
+    }
+
+
+TInt DLddUsbcChannel::EpFromAlternateSetting(TUint aAlternateSetting, TInt aEndpoint)
+    {
+    TUsbcAlternateSettingList* alternateSettingListRec = iAlternateSettingList;
+    while (alternateSettingListRec)
+        {
+        if (alternateSettingListRec->iSetting == aAlternateSetting)
+            {
+            if ((aEndpoint <= alternateSettingListRec->iNumberOfEndpoints) &&
+                (aEndpoint >= 0))
+                {
+                return alternateSettingListRec->iEndpoint[aEndpoint]->RealEpNumber();
+                }
+            else
+                {
+                __KTRACE_OPT(KPANIC, Kern::Printf("  Error: aEndpoint %d wrong for aAlternateSetting %d",
+                                                  aEndpoint, aAlternateSetting));
+                return -1;
+                }
+            }
+        alternateSettingListRec = alternateSettingListRec->iNext;
+        }
+    __KTRACE_OPT(KPANIC, Kern::Printf("  Error: no aAlternateSetting %d found", aAlternateSetting));
+    return -1;
+    }
+
+
+TInt DLddUsbcChannel::ProcessAlternateSetting(TUint aAlternateSetting)
+    {
+    ResetInterface(KErrUsbInterfaceChange);                    // kill any outstanding transfers
+    __KTRACE_OPT(KUSB, Kern::Printf("ProcessAlternateSetting 0x%08x", aAlternateSetting));
+    TUint newSetting = aAlternateSetting&(~KUsbAlternateSetting);
+    __KTRACE_OPT(KUSB, Kern::Printf("ProcessAlternateSetting selecting alternate setting 0x%08x", newSetting));
+    TInt r = SelectAlternateSetting(newSetting);
+    if (r != KErrNone)
+        return r;
+    StartEpReads();
+    iAlternateSetting = newSetting;
+    return KErrNone;
+    }
+
+
+TInt DLddUsbcChannel::ProcessDeviceState(TUsbcDeviceState aDeviceState)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("ProcessDeviceState(%d -> %d)", iDeviceState, aDeviceState));
+    if (iDeviceState == aDeviceState)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  No state change => nothing to be done."));
+        return KErrNone;
+        }
+    if (iDeviceState == UsbShai::EUsbPeripheralStateSuspended)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  Coming out of Suspend: old state = %d", iOldDeviceState));
+        iDeviceState = iOldDeviceState;
+        if (iDeviceState == aDeviceState)
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  New state same as before Suspend => nothing to be done."));
+            return KErrNone;
+            }
+        }
+    TBool renumerateState = (aDeviceState == UsbShai::EUsbPeripheralStateConfigured);
+    TBool deconfigured = EFalse;
+    TInt cancellationCode = KErrNone;
+    if (aDeviceState == UsbShai::EUsbPeripheralStateSuspended)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  Suspending..."));
+        iOldDeviceState = iDeviceState;
+        // Put PSL into low power mode here
+        }
+    else
+        {
+        deconfigured = (iDeviceState == UsbShai::EUsbPeripheralStateConfigured &&
+                        aDeviceState != UsbShai::EUsbPeripheralStateConfigured);
+        if (iDeviceState == UsbShai::EUsbPeripheralStateConfigured)
+            {
+            if (aDeviceState == UsbShai::EUsbPeripheralStateUndefined)
+                cancellationCode = KErrUsbCableDetached;
+            else if (aDeviceState == UsbShai::EUsbPeripheralStateAddress)
+                cancellationCode = KErrUsbDeviceNotConfigured;
+            else if (aDeviceState == UsbShai::EUsbPeripheralStateDefault)
+                cancellationCode = KErrUsbDeviceBusReset;
+            else
+                cancellationCode = KErrUsbDeviceNotConfigured;
+            }
+        }
+    __KTRACE_OPT(KUSB, Kern::Printf("  %d --> %d", iDeviceState, aDeviceState));
+    iDeviceState = aDeviceState;
+    if (iValidInterface || iOwnsDeviceControl)
+        {
+        // This LDD may not own an interface. It could be some manager reenumerating
+        // after its subordinate LDDs have setup their interfaces.
+        if (deconfigured)
+            {
+            DeConfigure(cancellationCode);
+            }
+        else if (renumerateState)
+            {
+            // Update size of Ep0.
+            iEndpoint[0]->SetMaxPacketSize(iController->Ep0PacketSize());
+            // First cancel transfers on all endpoints
+            ResetInterface(KErrUsbInterfaceChange);
+            // Select main interface & latch in new endpoint set
+            SelectAlternateSetting(0);
+            // Here we go
+            StartEpReads();
+            }
+        }
+
+    const TInt reqNo = (TInt) RDevUsbcClient::ERequestReEnumerate;
+    if (renumerateState && iRequestStatus[reqNo])
+        {
+        // This lot must be done if we are reenumerated
+        CompleteBufferRequest(iClient, reqNo, KErrNone);
+        }
+
+    return KErrNone;
+    }
+
+
+void DLddUsbcChannel::UpdateEndpointSizes()
+    {
+    // The regular ones.
+    TInt i = 0;
+    while ((++i <= KMaxEndpointsPerClient) && iEndpoint[i])
+        {
+        const TInt size = iController->EndpointPacketSize(this, iEndpoint[i]->RealEpNumber());
+        if (size < 0)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Packet size < 0 for ep %d", i));
+            continue;
+            }
+        iEndpoint[i]->SetMaxPacketSize(size);
+        }
+    __ASSERT_DEBUG(i == iNumberOfEndpoints + 1,
+                   Kern::Printf("  Error: iNumberOfEndpoints wrong (%d)", iNumberOfEndpoints));
+    }
+
+
+DPlatChunkHw* DLddUsbcChannel::ReAllocate(TInt aBuffersize, DPlatChunkHw* aHwChunk, TUint32 aCacheAttribs)
+    {
+    DPlatChunkHw* chunk = aHwChunk;
+    if ((!chunk) || (chunk->iSize < aBuffersize))
+        {
+        if (chunk)
+            {
+            ClosePhysicalChunk(chunk);
+            }
+        __KTRACE_OPT(KUSB, Kern::Printf("ReAllocate need to get new chunk"));
+        chunk = Allocate(aBuffersize, aCacheAttribs);
+        }
+    return chunk;
+    }
+
+
+DPlatChunkHw* DLddUsbcChannel::Allocate(TInt aBuffersize, TUint32 aCacheAttribs)
+    {
+    TUint32 physAddr = 0;
+    TUint32 size = Kern::RoundToPageSize(aBuffersize);
+
+    if (Epoc::AllocPhysicalRam(size, physAddr) != KErrNone)
+        return NULL;
+
+    DPlatChunkHw* HwChunk;
+    if (DPlatChunkHw::New(HwChunk, physAddr, aBuffersize, aCacheAttribs) != KErrNone)
+        {
+        Epoc::FreePhysicalRam(physAddr, size);
+        return NULL;
+        }
+
+    return HwChunk;
+    }
+
+
+TInt DLddUsbcChannel::DoRxComplete(TUsbcEndpoint* aTUsbcEndpoint, TInt aEndpoint, TBool aReEntrant)
+    {
+    TBool completeNow;
+    TInt err = aTUsbcEndpoint->CopyToClient(iClient, completeNow,iClientAsynchNotify[aEndpoint]->iClientBuffer);
+    if (completeNow)
+        {
+        aTUsbcEndpoint->SetClientReadPending(EFalse);
+        CompleteBufferRequest(iClient, aEndpoint, err);
+        }
+    aTUsbcEndpoint->TryToStartRead(aReEntrant);
+    return err;
+    }
+
+
+void DLddUsbcChannel::DoRxCompleteNow(TUsbcEndpoint* aTUsbcEndpoint, TInt aEndpoint)
+    {
+    aTUsbcEndpoint->SetClientReadPending(EFalse);
+    CompleteBufferRequest(iClient, aEndpoint, KErrCancel);
+    }
+
+
+void DLddUsbcChannel::DoTxComplete(TUsbcEndpoint* aTUsbcEndpoint, TInt aEndpoint, TInt aError)
+    {
+    aTUsbcEndpoint->SetClientWritePending(EFalse);
+    CompleteBufferRequest(iClient, aEndpoint, aError);
+    }
+
+
+TBool DLddUsbcChannel::AlternateDeviceStateTestComplete()
+    {
+    TBool completeNow = EFalse;
+    const TInt reqNo = (TInt) RDevUsbcClient::ERequestAlternateDeviceStatusNotify;
+    if (iRequestStatus[reqNo])
+        {
+        // User req is outstanding
+        TUint32 deviceState;
+        if (iStatusFifo->GetDeviceQueuedStatus(deviceState) == KErrNone)
+            {
+            // Device state waiting to be sent userside
+            completeNow = ETrue;
+            __KTRACE_OPT(KUSB, Kern::Printf("StatusChangeCallback Notify status"));
+            iStatusChangeReq->Data()=deviceState;
+            iStatusChangePtr = NULL;
+            }
+        }
+    return completeNow;
+    }
+
+
+void DLddUsbcChannel::EmergencyCompleteDfc(TAny* aDLddUsbcChannel)
+    {
+    ((DLddUsbcChannel*) aDLddUsbcChannel)->DoEmergencyComplete();
+    }
+
+
+void DLddUsbcChannel::DeConfigure(TInt aErrorCode)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcChannel::DeConfigure()"));
+    // Called after deconfiguration. Cancels transfers on all endpoints.
+    ResetInterface(aErrorCode);
+    // Cancel the endpoint status notify request if it is outstanding.
+    const TInt KEpNotReq = RDevUsbcClient::ERequestEndpointStatusNotify;
+    if (iRequestStatus[KEpNotReq])
+        {
+        CancelNotifyEndpointStatus();
+        iRequestStatus[KEpNotReq]=NULL;
+        Kern::QueueRequestComplete(iClient,iEndpointStatusChangeReq,aErrorCode);
+        }
+    // We have to reset the alternate setting number when the config goes away.
+     SelectAlternateSetting(0);
+    iAlternateSetting = 0;
+    }
+
+
+void DLddUsbcChannel::StartEpReads()
+    {
+    // Queued after enumeration. Starts reads on all endpoints.
+    // The endpoint itself decides if it can do a read
+    TInt i;
+    for (i = 0; i <= iNumberOfEndpoints; i++)
+        {
+        // The endpoint itself will decide if it can read
+        iEndpoint[i]->TryToStartRead(EFalse);
+        }
+    }
+
+
+void DLddUsbcChannel::ResetInterface(TInt aErrorCode)
+    {
+    // Called after change in alternate setting.  Cancels transfers on all endpoints
+    if (iValidInterface || iOwnsDeviceControl)
+        {
+        // Reset each endpoint except ep0
+        for (TInt i = 1; i <= iNumberOfEndpoints; i++)
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("Cancelling transfer ep=%d", i));
+            iEndpoint[i]->CancelTransfer(iClient,iClientAsynchNotify[i]->iClientBuffer);            // Copies data userside
+            iEndpoint[i]->AbortTransfer();                    // kills any ldd->pil outstanding transfers
+            iEndpoint[i]->iDmaBuffers->Flush();
+            if (iRequestStatus[i] != NULL)
+                CompleteBufferRequest(iClient, i, aErrorCode);
+            iEndpoint[i]->SetClientWritePending(EFalse);
+            iEndpoint[i]->SetClientReadPending(EFalse);
+            }
+        }
+    }
+
+
+void DLddUsbcChannel::AbortInterface()
+    {
+    // Called after when channel is closing
+    if (iValidInterface || iOwnsDeviceControl)
+        {
+        for (TInt i = 0; i <= iNumberOfEndpoints; i++)
+            {
+            if (iEndpoint[i])
+                {
+                // kills any LDD->PDD outstanding transfers
+                iEndpoint[i]->AbortTransfer();
+                }
+            }
+        }
+    }
+
+
+void DLddUsbcChannel::ClosePhysicalChunk(DPlatChunkHw*& aHwChunk)
+    {
+    if (aHwChunk)
+        {
+         const TPhysAddr addr = aHwChunk->PhysicalAddress();
+         const TInt size = aHwChunk->iSize;
+        aHwChunk->Close(NULL);
+         Epoc::FreePhysicalRam(addr, size);
+        }
+    aHwChunk = NULL;
+    }
+
+
+TInt DLddUsbcChannel::DoEmergencyComplete()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcEndpoint::DoEmergencyComplete"));
+    // cancel any pending DFCs
+    // complete all client requests
+    for (TInt i = 0; i < KUsbcMaxRequests; i++)
+        {
+        if (iRequestStatus[i])
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("Complete request 0x%x", iRequestStatus[i]));
+
+            if (i == RDevUsbcClient::ERequestAlternateDeviceStatusNotify)
+                {
+
+                iDeviceStatusNeeded = EFalse;
+                iStatusFifo->FlushQueue();
+
+                if (iStatusChangePtr)
+                    {
+                    iStatusChangeReq->Data() = iController->GetDeviceStatus();
+                    iStatusChangePtr = NULL;
+
+                    if (iStatusChangeReq->IsReady())
+                        {
+                        iRequestStatus[i] = NULL;
+                        Kern::QueueRequestComplete(iClient, iStatusChangeReq,
+                                KErrDisconnected);
+                        }
+                    }
+
+                }
+            else if (i == RDevUsbcClient::ERequestEndpointStatusNotify)
+                {
+                    
+                   if (iEndpointStatusChangePtr)
+                    {
+                    TUint epBitmap = 0;
+                    for (TInt i = 0; i <= iNumberOfEndpoints; i++)
+                        {
+                        TInt v = iController->GetEndpointStatus(this, iEndpoint[i]->RealEpNumber());
+                        TUint b;
+                        (v == EEndpointStateStalled) ? b = 1 : b = 0;
+                        epBitmap |= b << i;
+                        }    
+
+                    iEndpointStatusChangeReq->Data() = epBitmap;
+                    iEndpointStatusChangePtr = NULL;
+                    }
+
+                if (iEndpointStatusChangeReq->IsReady())
+                    {
+                    iRequestStatus[i] = NULL;
+                    Kern::QueueRequestComplete(iClient,iEndpointStatusChangeReq,KErrDisconnected);
+                    }
+
+                }
+            else if (i == RDevUsbcClient::ERequestOtgFeaturesNotify)
+                {
+                    
+                if (iOtgFeatureChangePtr)
+                    {
+                    TUint8 features;
+                    iController->GetCurrentOtgFeatures(features);
+                    iOtgFeatureChangeReq->Data()=features;
+                    iOtgFeatureChangePtr = NULL;
+                    }
+                    
+                if (iOtgFeatureChangeReq->IsReady())
+                    {
+                    iRequestStatus[i] = NULL;
+                    Kern::QueueRequestComplete(iClient, iOtgFeatureChangeReq,
+                            KErrDisconnected);
+                    }
+
+                }
+            else
+                {
+                CompleteBufferRequest(iClient, i, KErrDisconnected);
+                }
+
+            }
+        }
+
+    iStatusCallbackInfo.Cancel();
+    iEndpointStatusCallbackInfo.Cancel();
+    iOtgFeatureCallbackInfo.Cancel();
+    return KErrNone;
+    }
+
+
+void DLddUsbcChannel::PanicClientThread(TInt aReason)
+    {
+    Kern::ThreadKill(iClient, EExitPanic, aReason, KUsbLDDKillCat);
+    }
+
+
+// ===============Endpoint====================
+
+// Constructor
+TUsbcEndpoint::TUsbcEndpoint(DLddUsbcChannel* aLDD, DUsbClientController* aController,
+                             const TUsbcEndpointInfo* aEndpointInfo, TInt aEndpointNum,
+                             TInt aBandwidthPriority)
+    : iController(aController),
+      iEndpointInfo(aEndpointInfo->iType, aEndpointInfo->iDir, aEndpointInfo->iSize),
+      iClientReadPending(EFalse),
+      iClientWritePending(EFalse),
+      iEndpointNumber(aEndpointNum),
+      iRealEpNumber(-1),
+      iLdd(aLDD),
+      iError(KErrNone),
+      iRequestCallbackInfo(NULL),
+      iBytesTransferred(0),
+      iBandwidthPriority(aBandwidthPriority)
+    {
+     ResetTransferInfo();
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcEndpoint::TUsbcEndpoint 2"));
+    }
+
+
+TInt TUsbcEndpoint::Construct()
+    {
+    iDmaBuffers = new TDmaBuf(&iEndpointInfo, iBandwidthPriority);
+    if (iDmaBuffers == NULL)
+        {
+        return KErrNoMemory;
+        }
+    const TInt r = iDmaBuffers->Construct(&iEndpointInfo);
+    if (r != KErrNone)
+        {
+        return r;
+        }
+    iRequestCallbackInfo = new TUsbcRequestCallback(iLdd,
+                                                    iEndpointNumber,
+                                                    TUsbcEndpoint::RequestCallback,
+                                                    this,
+                                                    iLdd->iDfcQ,
+                                                    KUsbRequestCallbackPriority);
+    if (iRequestCallbackInfo == NULL)
+        {
+        return KErrNoMemory;
+        }
+    return KErrNone;
+    }
+
+
+TUsbcEndpoint::~TUsbcEndpoint()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcEndpoint::~TUsbcEndpoint(%d)", iEndpointNumber));
+    AbortTransfer();
+    delete iRequestCallbackInfo;
+    delete iDmaBuffers;
+    }
+
+
+void TUsbcEndpoint::RequestCallback(TAny* aTUsbcEndpoint)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcEndpoint::RequestCallback"));
+    ((TUsbcEndpoint*) aTUsbcEndpoint)->EndpointComplete();
+    }
+
+
+void TUsbcEndpoint::SetMaxPacketSize(TInt aSize)
+    {
+    iEndpointInfo.iSize = aSize;
+    iDmaBuffers->SetMaxPacketSize(aSize);
+    }
+
+
+TInt TUsbcEndpoint::EndpointComplete()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcEndpoint::EndpointComplete ep=%d %d",
+                                    iEndpointNumber, iRequestCallbackInfo->iEndpointNum));
+
+    if (iLdd->ChannelClosing())
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("We're going home -> completions no longer accepted"));
+        return KErrNone;
+        }
+
+    UsbShai::TTransferDirection transferDir = iRequestCallbackInfo->iTransferDir;
+    TInt error = iRequestCallbackInfo->iError;
+
+    switch (transferDir)
+        {
+
+    case UsbShai::EControllerWrite:
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("TUsbcEndpoint::EndpointComplete Write 2"));
+        if (!iDmaBuffers->TxIsActive())
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  TX completion but !iDmaBuffers->TxIsActive()"));
+            break;
+            }
+
+        iDmaBuffers->TxSetInActive();
+        TBool completeNow = EFalse;
+        iBytesTransferred += iRequestCallbackInfo->iTxBytes;
+        if (iClientWritePending)
+            {
+            //Complete Outstanding Write if necessary
+            iError = error;
+            if (iError != KErrNone)
+                {
+                completeNow = ETrue;
+                if (iError == KErrPrematureEnd)                // Previous write could not be completed
+                    iError = KErrNone;
+                }
+            else
+                {
+                if (iBytesTransferred == (TUint32) iTransferInfo.iTransferSize)
+                    {
+                    completeNow = ETrue;
+                    }
+                else
+                    {
+                    iError = ContinueWrite();
+                    if (iError != KErrNone)
+                        completeNow = ETrue;
+                    }
+                }
+            if (completeNow)
+                {
+                TxComplete();
+                ResetTransferInfo();
+                if (iEndpointNumber == 0)
+                    {
+                    iDmaBuffers->Flush();
+                    TryToStartRead(EFalse);
+                    }
+                }
+            }
+        break;
+        }
+
+    case UsbShai::EControllerRead:
+        {
+        // The first packet always contains the total #of bytes
+        const TInt byteCount = iRequestCallbackInfo->iPacketSize[0];
+        const TInt packetCount = iRequestCallbackInfo->iRxPackets;
+        iDmaBuffers->ReadXferComplete(byteCount, packetCount, error);
+
+        // We queue the dfc if we can complete the read, i.e. if we are reading a packet,
+        // or if we have enough data to satisfy a read data request.
+        if (iClientReadPending)
+            {
+            //Complete outstanding read
+            __KTRACE_OPT(KUSB, Kern::Printf("TUsbcEndpoint::EndpointComplete Read 3 (bytes "
+                                            "available=%d)", iDmaBuffers->RxBytesAvailable()));
+            TInt bytesReqd = iTransferInfo.iTransferSize - iBytesTransferred;
+            TBool completeNow = EFalse;
+
+            if (iTransferInfo.iTransferType == ETransferTypeReadPacket ||
+                iTransferInfo.iTransferType == ETransferTypeReadOneOrMore)
+                {
+                // Always complete on a packet read
+                completeNow = ETrue;
+                }
+            else if (iTransferInfo.iTransferType == ETransferTypeReadData)
+                {
+                // Complete only if enough data is present
+                if (iDmaBuffers->RxBytesAvailable() >= bytesReqd)
+                    completeNow = ETrue;
+                }
+            else if (iTransferInfo.iTransferType == ETransferTypeReadUntilShort)
+                {
+                // Complete if enough data is present or if a short packet has been delivered
+                const TInt maxPacketSize = iEndpointInfo.iSize;
+                const TInt lastPacketSize = iRequestCallbackInfo->iPacketSize[packetCount - 1];
+                if (lastPacketSize < maxPacketSize)
+                    completeNow = ETrue;
+                else if (iDmaBuffers->RxBytesAvailable() >= bytesReqd)
+                    completeNow = ETrue;
+                else
+                    {
+                    const TUint type = iEndpointInfo.iType;
+                    if ((type == UsbShai::KUsbEpTypeBulk) && (lastPacketSize & (maxPacketSize - 1)))
+                        {
+                        completeNow = ETrue;
+                        }
+                    else if ((type != UsbShai::KUsbEpTypeBulk) &&
+                             (lastPacketSize > maxPacketSize) &&
+                             (lastPacketSize % maxPacketSize))
+                        {
+                        completeNow = ETrue;
+                        }
+                    }
+                }
+            if (completeNow)
+                {
+                iError = error;
+                RxComplete(EFalse);
+                iClientReadPending = EFalse;
+                }
+            }
+        iDmaBuffers->RxSetInActive();
+        if (error != KErrNone)
+            {
+            return error;
+            }
+        if (TryToStartRead(EFalse) != KErrNone)
+            {
+//            if (iEndpointNumber != 0)
+//                Kern::Printf("EndpointComplete couldn't start read on ep=%d", iEndpointNumber);
+            }
+        break;
+        }
+
+    default:
+        // shouldn't get here
+        break;
+        }
+
+    return KErrNone;
+    }
+
+
+void TUsbcEndpoint::TxComplete()
+    {
+    iLdd->DoTxComplete(this, iEndpointNumber, iError);
+    }
+
+
+TInt TUsbcEndpoint::RxComplete(TBool aReEntrant)
+    {
+    return iLdd->DoRxComplete(this, iEndpointNumber, aReEntrant);
+    }
+
+
+void TUsbcEndpoint::RxCompleteNow()
+    {
+    iLdd->DoRxCompleteNow(this, iEndpointNumber);
+    }
+
+
+TInt TUsbcEndpoint::CopyToClient(DThread* aClient, TClientBuffer *aTcb)
+    {
+    TBool completeNow;
+    return CopyToClient(aClient, completeNow,aTcb);
+    }
+
+
+TInt TUsbcEndpoint::CopyToClient(DThread* aClient, TBool& aCompleteNow, TClientBuffer *aTcb)
+    {
+    TInt err;
+    const TInt length = iTransferInfo.iTransferSize;
+    const TBool KReadData = EFalse;
+    const TBool KReadUntilShort = ETrue;
+
+    __KTRACE_OPT(KUSB, Kern::Printf("CopyToClient: length = %d", length));
+
+    if (iTransferInfo.iTransferType == ETransferTypeReadPacket)
+        {
+        err = iDmaBuffers->RxCopyPacketToClient(aClient, aTcb, length);
+        aCompleteNow = ETrue;
+        }
+    else if (iTransferInfo.iTransferType == ETransferTypeReadOneOrMore)
+        {
+        err = iDmaBuffers->RxCopyDataToClient(aClient, aTcb, length, iBytesTransferred,
+                                              KReadData, aCompleteNow);
+        aCompleteNow = ETrue;
+        }
+    else if (iTransferInfo.iTransferType == ETransferTypeReadUntilShort)
+        {
+        err = iDmaBuffers->RxCopyDataToClient(aClient, aTcb, length, iBytesTransferred,
+                                              KReadUntilShort, aCompleteNow);
+        }
+    else
+        {
+        err = iDmaBuffers->RxCopyDataToClient(aClient, aTcb, length, iBytesTransferred,
+                                              KReadData, aCompleteNow);
+        }
+
+    if (aCompleteNow)
+        {
+        ResetTransferInfo();
+        SetClientReadPending(EFalse);
+        }
+
+    return err;
+    }
+
+
+TInt TUsbcEndpoint::TryToStartRead(TBool aReEntrant)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TryToStartRead 1 ep=%d", iEndpointNumber));
+    TInt r = KErrNone;
+    if (iEndpointInfo.iDir != UsbShai::KUsbEpDirOut &&
+        iEndpointInfo.iDir != UsbShai::KUsbEpDirBidirect)
+        {
+        // Verify ep direction
+        __KTRACE_OPT(KUSB, Kern::Printf("TryToStartRead wrong direction ep=%d", iEndpointNumber));
+        return KErrUsbEpBadDirection;
+        }
+
+    if (iEndpointNumber == 0)
+        {
+        // Can't issue an Ep0 read if reader or writer is active
+        if (iDmaBuffers->TxIsActive())
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("TryToStartRead ep0 Tx already active FATAL"));
+            return KErrUsbEpNotReady;
+            }
+        if (iDmaBuffers->RxIsActive())
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("TryToStartRead ep0 Rx already active non-FATAL"));
+            }
+        }
+
+    if (!(iDmaBuffers->RxIsActive()))
+        {
+        TUint8* bufferAddr;
+        TPhysAddr physAddr;
+        TUsbcPacketArray* indexArray;
+        TUsbcPacketArray* sizeArray;
+        TInt length;
+        r = iDmaBuffers->RxGetNextXfer(bufferAddr, indexArray, sizeArray, length, physAddr);
+        if (r == KErrNone)
+            {
+            iDmaBuffers->RxSetActive();
+            iRequestCallbackInfo->SetRxBufferInfo(bufferAddr, physAddr, indexArray, sizeArray, length);
+
+            __KTRACE_OPT(KUSB, Kern::Printf("TryToStartRead 2 bufferAddr=0x%08x", bufferAddr));
+
+            r = iController->SetupReadBuffer(*iRequestCallbackInfo);
+            if (r != KErrNone)
+                {
+                iDmaBuffers->RxSetInActive();
+                __KTRACE_OPT(KPANIC, Kern::Printf("  Error: TryToStartRead controller rejects read"));
+                }
+            }
+        else
+            {
+            if (iClientReadPending)
+                {
+                // Deadlock, try to resolve it by draining buffer into descriptor
+                if (!aReEntrant)
+                    {
+                    RxComplete(ETrue);
+                    }
+                else
+                    {
+                    // we are stuck, better complete userside otherwise the userside request will hang
+                    RxCompleteNow();
+                    }
+                }
+            }
+        }
+    return r;
+    }
+
+
+TInt TUsbcEndpoint::TryToStartWrite(TEndpointTransferInfo* pTfr)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TryToStartWrite 1 ep=%d", iEndpointNumber));
+    if (iEndpointInfo.iDir != UsbShai::KUsbEpDirIn &&
+        iEndpointInfo.iDir != UsbShai::KUsbEpDirBidirect)
+        {
+        // Verify ep direction
+        return KErrUsbEpBadDirection;
+        }
+    if (iEndpointNumber == 0)
+        {
+        // Can't issue an Ep0 write if unread data is available or writer is active
+        if (iDmaBuffers->TxIsActive() || !iDmaBuffers->IsReaderEmpty())
+            {
+            return KErrUsbEpNotReady;
+            }
+        if (iDmaBuffers->RxIsActive())
+            {
+            // if a reader is active then cancel the read
+            iDmaBuffers->RxSetInActive();
+            iController->CancelReadBuffer(iLdd, iRealEpNumber);
+            }
+        }
+    SetTransferInfo(pTfr);
+    ContinueWrite();
+    return KErrNone;
+    }
+
+
+TInt TUsbcEndpoint::ContinueWrite()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("ContinueWrite 2"));
+    TUint8* bufferAddr;
+    TPhysAddr physAddr;
+    TInt bufferLength;
+    TInt r = iDmaBuffers->TxGetNextXfer(bufferAddr, bufferLength, physAddr);
+    if (r != KErrNone)                                            // probably already active
+        return r;
+    __KTRACE_OPT(KUSB, Kern::Printf("ContinueWrite 3"));
+    iDmaBuffers->TxSetActive();
+    TBool zlpReqd = EFalse;
+    TUint32 transferSize = iTransferInfo.iTransferSize;
+    TInt length = Min(transferSize - iBytesTransferred, (TUint32) bufferLength);
+    if (iBytesTransferred+length>=transferSize)
+        {
+        // only send a zlp if this is the last buffer of the transfer
+        zlpReqd = iTransferInfo.iZlpReqd;
+        }
+    r = iDmaBuffers->TxStoreData(iLdd->Client(), iLdd->GetClientBuffer(iEndpointNumber), length, iBytesTransferred);
+    if (r != KErrNone)
+        return r;
+    iDmaBuffers->TxSetActive();
+    iRequestCallbackInfo->SetTxBufferInfo(bufferAddr, physAddr, length);
+    iRequestCallbackInfo->iZlpReqd = zlpReqd;
+#if 0
+    for (TInt i = 0; i < iRequestCallbackInfo->iLength; i++)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("Buffer[%d] = 0x%02x", i, iRequestCallbackInfo->iBufferStart[i]));
+        }
+#endif
+    r = iController->SetupWriteBuffer(*iRequestCallbackInfo);
+    return r;
+    }
+
+
+void TUsbcEndpoint::CancelTransfer(DThread* aThread, TClientBuffer *aTcb)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("CancelTransfer"));
+    if (iDmaBuffers != NULL)
+        {
+        if (iClientWritePending)
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  (iClientWritePending)"));
+            iClientWritePending = EFalse;
+            iController->CancelWriteBuffer(iLdd, iRealEpNumber);
+            iDmaBuffers->TxSetInActive();
+            }
+        if (iClientReadPending)
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  (iClientReadPending)"));
+            iClientReadPending = EFalse;
+            CopyToClient(aThread,aTcb);
+            }
+        }
+    }
+
+
+void TUsbcEndpoint::AbortTransfer()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("Abort Transfer"));
+    if (iDmaBuffers != NULL)
+        {
+        if (iDmaBuffers->TxIsActive())
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  (iClientWritePending)"));
+            iController->CancelWriteBuffer(iLdd, iRealEpNumber);
+            iDmaBuffers->TxSetInActive();
+            }
+        if (iDmaBuffers->RxIsActive())
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  (iClientReadPending)"));
+            iController->CancelReadBuffer(iLdd, iRealEpNumber);
+            iDmaBuffers->RxSetInActive();
+            }
+        iRequestCallbackInfo->iDfc.Cancel();
+        }
+    }
+
+
+TUsbcAlternateSettingList::TUsbcAlternateSettingList()
+    : iNext(NULL),
+      iNumberOfEndpoints(0),
+      iSetting(0)
+    {
+    for (TInt i = 0; i <= KMaxEndpointsPerClient; i++)
+        {
+        iEpNumDeOrderedByBufSize[i] = -1;
+        iEndpoint[i] = NULL;
+        }
+    }
+
+
+TUsbcAlternateSettingList::~TUsbcAlternateSettingList()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcAlternateSettingList::~TUsbcAlternateSettingList()"));
+    for (TInt i = 0; i <= KMaxEndpointsPerClient; i++)
+        {
+        delete iEndpoint[i];
+        }
+    }
+
+
+TUsbcDeviceStatusQueue::TUsbcDeviceStatusQueue()
+    {
+    FlushQueue();
+    }
+
+
+void TUsbcDeviceStatusQueue::FlushQueue()
+    {
+    for (TInt i = 0; i < KUsbDeviceStatusQueueDepth; i++)
+        {
+        iDeviceStatusQueue[i] = KUsbDeviceStatusNull;
+        }
+    iStatusQueueHead = 0;
+    }
+
+
+void TUsbcDeviceStatusQueue::AddStatusToQueue(TUint32 aDeviceStatus)
+    {
+    // Only add a new status if it is not a duplicate of the one at the head of the queue
+    if (!(iStatusQueueHead != 0 &&
+          iDeviceStatusQueue[iStatusQueueHead - 1] == aDeviceStatus))
+        {
+        if (iStatusQueueHead == KUsbDeviceStatusQueueDepth)
+            {
+            // Discard item at tail of queue
+            TUint32 status;
+            GetDeviceQueuedStatus(status);
+            }
+        iDeviceStatusQueue[iStatusQueueHead] = aDeviceStatus;
+        iStatusQueueHead++;
+        }
+    }
+
+
+TInt TUsbcDeviceStatusQueue::GetDeviceQueuedStatus(TUint32& aDeviceStatus)
+    {
+    TInt r = KErrNone;
+    if (iStatusQueueHead <= 0)
+        {
+        r = KErrGeneral;
+        aDeviceStatus = KUsbDeviceStatusNull;
+        }
+    else
+        {
+        aDeviceStatus = iDeviceStatusQueue[0];
+        for(TInt i = 1; i < KUsbDeviceStatusQueueDepth; i++)
+            {
+            TUint32 s = iDeviceStatusQueue[i];
+            iDeviceStatusQueue[i - 1] = s;
+            }
+        iStatusQueueHead--;
+        iDeviceStatusQueue[KUsbDeviceStatusQueueDepth - 1] = KUsbDeviceStatusNull;
+        }
+    return r;
+    }
+
+void TClientAsynchNotify::Reset()
+{
+    iBufferRequest->Reset();
+    iClientBuffer=NULL;
+}
+
+//---
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/ldd/perildd/src/usbdma.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,983 @@
+// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// 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:
+// e32\drivers\usbc\usbdma.cpp
+// LDD for USB Device driver stack:
+// Management of DMA-capable data buffers.
+// 
+//
+
+/**
+ @file usbdma.cpp
+ @internalTechnology
+*/
+
+#include <usb/usbc.h>
+
+
+#if defined(_DEBUG)
+static const char KUsbPanicLdd[] = "USB LDD";
+#endif
+
+
+TDmaBuf::TDmaBuf(TUsbcEndpointInfo* aEndpointInfo, TInt aBandwidthPriority)
+    : iBufBasePtr(NULL),
+      iCurrentDrainingBuffer(NULL),
+      iCurrentPacket(0),
+      iCurrentPacketIndexArray(NULL),
+      iCurrentPacketSizeArray(NULL)
+    {
+    iMaxPacketSize = aEndpointInfo->iSize;
+    iEndpointType = aEndpointInfo->iType;
+
+    switch (aEndpointInfo->iType)
+        {
+    case UsbShai::KUsbEpTypeControl:
+        iBufSz = KUsbcDmaBufSzControl;
+        iNumberofBuffers = KUsbcDmaBufNumControl;
+        break;
+    case UsbShai::KUsbEpTypeIsochronous:
+        iBufSz = KUsbcDmaBufSzIsochronous;
+        iNumberofBuffers = KUsbcDmaBufNumIsochronous;
+        break;
+    case UsbShai::KUsbEpTypeBulk:
+        {
+        if (aEndpointInfo->iDir == UsbShai::KUsbEpDirOut)
+            {
+            const TInt priorityOUT = aBandwidthPriority & 0x0f;
+            iBufSz = KUsbcDmaBufSizesBulkOUT[priorityOUT];
+            }
+        else
+            {
+            const TInt priorityIN = (aBandwidthPriority >> 4) & 0x0f;
+            iBufSz = KUsbcDmaBufSizesBulkIN[priorityIN];
+            }
+        iNumberofBuffers = KUsbcDmaBufNumBulk;
+        }
+        break;
+    case UsbShai::KUsbEpTypeInterrupt:
+        iBufSz = KUsbcDmaBufSzInterrupt;
+        iNumberofBuffers = KUsbcDmaBufNumInterrupt;
+        break;
+    default:
+        iBufSz = 0;
+        iNumberofBuffers = 0;
+        }
+
+    if (aEndpointInfo->iDir == UsbShai::KUsbEpDirIn)
+        {
+        iNumberofBuffers = 1;                                // IN endpoints only have 1 buffer
+        }
+
+    for (TInt i = 0; i < KUsbcDmaBufNumMax; i++)
+        {
+        // Buffer logical addresses (pointers)
+        iBuffers[i] = NULL;
+        // Buffer physical addresses
+        iBufferPhys[i] = 0;
+        // Packet indexes base array
+        iPacketIndex[i] = NULL;
+        // Packet sizes base array
+        iPacketSize[i] = NULL;
+        }
+    }
+
+
+TInt TDmaBuf::Construct(TUsbcEndpointInfo* aEndpointInfo)
+    {
+    if (aEndpointInfo->iDir != UsbShai::KUsbEpDirIn)
+        {
+        // IN endpoints don't need a packet array
+
+        // At most 2 packets (clump of max packet size packets) + possible zlp
+        TUsbcPacketArray* bufPtr = iPacketInfoStorage;
+        // this divides up the packet indexing & packet size array over the number of buffers
+        __KTRACE_OPT(KUSB, Kern::Printf("TDmaBuf::Construct() array base=0x%08x", bufPtr));
+        for (TInt i = 0; i < iNumberofBuffers; i++)
+            {
+            iPacketIndex[i] = bufPtr;
+            bufPtr += KUsbcDmaBufMaxPkts;
+            iPacketSize[i] = bufPtr;
+            bufPtr += KUsbcDmaBufMaxPkts;
+            __KTRACE_OPT(KUSB, Kern::Printf("TDmaBuf::Construct() packetIndex[%d]=0x%08x packetSize[%d]=0x%08x",
+                                            i, iPacketIndex[i], i, iPacketSize[i]));
+            }
+        }
+    else
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("TDmaBuf::Construct() IN endpoint"));
+        }
+    Flush();
+    return KErrNone;
+    }
+
+
+TDmaBuf::~TDmaBuf()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TDmaBuf::~TDmaBuf()"));
+    }
+
+TInt TDmaBuf::BufferTotalSize() const
+    {
+    return iBufSz * iNumberofBuffers;
+    }
+
+TInt TDmaBuf::BufferSize() const
+    {
+    return iBufSz;
+    }
+
+TInt TDmaBuf::SetBufferAddr(TInt aBufInd, TUint8* aBufAddr)
+    {
+    __ASSERT_DEBUG((aBufInd < iNumberofBuffers),
+                       Kern::Fault(KUsbPanicLdd, __LINE__));
+    iDrainable[aBufInd] = iCanBeFreed[aBufInd] = EFalse;
+    iBuffers[aBufInd] = aBufAddr;
+    iBufferPhys[aBufInd] = Epoc::LinearToPhysical((TLinAddr)aBufAddr);
+    __KTRACE_OPT(KUSB, Kern::Printf("TDmaBuf::SetBufferAddr() iBuffers[%d]=0x%08x", aBufInd, iBuffers[aBufInd]));
+    return KErrNone;
+    }
+
+TInt TDmaBuf::BufferNumber() const
+    {
+    return iNumberofBuffers;
+    }
+
+void TDmaBuf::SetMaxPacketSize(TInt aSize)
+    {
+    iMaxPacketSize = aSize;
+    }
+
+
+void TDmaBuf::Flush()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TDmaBuf::Flush %x", this));
+    iRxActive = EFalse;
+    iTxActive = EFalse;
+    iExtractOffset = 0;
+    iTotalRxBytesAvail = 0;
+    iTotalRxPacketsAvail = 0;
+    iCurrentDrainingBufferIndex = KUsbcInvalidBufferIndex;
+    iCurrentFillingBufferIndex = 0;
+    iDrainQueueIndex = KUsbcInvalidDrainQueueIndex;
+    for (TInt i = 0; i < KUsbcDmaBufNumMax; i++)
+        {
+        iDrainable[i] = EFalse;
+        iCanBeFreed[i] = EFalse;
+        iNumberofBytesRx[i] = 0;
+        iNumberofPacketsRx[i] = 0;
+        iError[i] = KErrGeneral;
+        iDrainQueue[i] = KUsbcInvalidBufferIndex;
+#if defined(USBC_LDD_BUFFER_TRACE)
+        iFillingOrderArray[i] = 0;
+        iNumberofBytesRxRemain[i] = 0;
+        iNumberofPacketsRxRemain[i] = 0;
+#endif
+        }
+    // Drain queue is 1 oversized
+    iDrainQueue[KUsbcDmaBufNumMax] = KUsbcInvalidBufferIndex;
+
+#if defined(USBC_LDD_BUFFER_TRACE)
+    iFillingOrder = 0;
+    iDrainingOrder = 0;
+#endif
+    }
+
+
+void TDmaBuf::RxSetActive()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TDmaBuf::RxSetActive %x", this));
+    iRxActive = ETrue;
+    }
+
+
+void TDmaBuf::RxSetInActive()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TDmaBuf::RxSetInActive %x", this));
+    iRxActive = EFalse;
+    }
+
+
+TBool TDmaBuf::RxIsActive()
+    {
+    return iRxActive;
+    }
+
+
+void TDmaBuf::TxSetActive()
+    {
+    iTxActive = ETrue;
+    }
+
+
+void TDmaBuf::TxSetInActive()
+    {
+    iTxActive = EFalse;
+    }
+
+
+TBool TDmaBuf::TxIsActive()
+    {
+    return iTxActive;
+    }
+
+
+/**************************** Rx DMA Buffer Access *************************/
+
+void TDmaBuf::ModifyTotalRxBytesAvail(TInt aVal)
+    {
+    iTotalRxBytesAvail += aVal;
+    }
+
+
+void TDmaBuf::ModifyTotalRxPacketsAvail(TInt aVal)
+    {
+    iTotalRxPacketsAvail += aVal;
+    }
+
+
+TBool TDmaBuf::AdvancePacket()
+    {
+    ModifyTotalRxPacketsAvail(-1);
+    TBool r = ETrue;
+    __ASSERT_DEBUG((iCurrentDrainingBufferIndex >= 0),
+                       Kern::Fault(KUsbPanicLdd, __LINE__));
+    if (++iCurrentPacket >= iNumberofPacketsRx[iCurrentDrainingBufferIndex])
+        {
+        r = NextDrainableBuffer();
+        }
+    iExtractOffset = 0;
+    __ASSERT_DEBUG((iCurrentDrainingBufferIndex == KUsbcInvalidBufferIndex) ||
+                   (iCurrentPacket < KUsbcDmaBufMaxPkts),
+                   Kern::Fault(KUsbPanicLdd, __LINE__));
+    return r;
+    }
+
+
+TInt TDmaBuf::PeekNextPacketSize()
+    {
+    TUint pkt = iCurrentPacket;
+    TInt index = iCurrentDrainingBufferIndex;
+    TInt size = -1;
+    if (pkt >= iNumberofPacketsRx[index])
+        {
+        index = PeekNextDrainableBuffer();
+        pkt = 0;
+        }
+
+    if ((index != KUsbcInvalidBufferIndex) && iNumberofPacketsRx[index])
+        {
+        const TUsbcPacketArray* sizeArray = iPacketSize[index];
+        size = (TInt)sizeArray[pkt];
+        }
+
+    __ASSERT_DEBUG((iCurrentDrainingBufferIndex == KUsbcInvalidBufferIndex) ||
+                   (iCurrentPacket < KUsbcDmaBufMaxPkts),
+                   Kern::Fault(KUsbPanicLdd, __LINE__));
+    return size;
+    }
+
+
+inline TInt TDmaBuf::GetCurrentError()
+    {
+    // USB bus errors are v.rare. To avoid having an error code attached to every packet since
+    // almost every errorcode will be KErrNone, we have a single error code per buffer
+    // If the error code is != KErrNone then it refers to the LAST packet in the buffer
+    TInt errorCode = KErrNone;
+    //Check the index, it's not equal to negative (-1) value defined in 
+    //KUsbcInvalidBufferIndex.
+    __ASSERT_DEBUG((iCurrentDrainingBufferIndex >= 0),
+                       Kern::Fault(KUsbPanicLdd, __LINE__));
+    
+    if (iError[iCurrentDrainingBufferIndex] != KErrNone)
+        {
+        // See if we are at the last packet
+        if ((iCurrentPacket + 1) == iNumberofPacketsRx[iCurrentDrainingBufferIndex])
+            {
+            errorCode = iError[iCurrentDrainingBufferIndex];
+            }
+        }
+    return errorCode;
+    }
+
+
+// used to decide whether a client read can complete straight away
+TBool TDmaBuf::IsReaderEmpty()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TDmaBuf::IsReaderEmpty iTotalRxPacketsAvail=%d",
+                                    iTotalRxPacketsAvail));
+    return (iTotalRxPacketsAvail == 0);
+    }
+
+
+void TDmaBuf::ReadXferComplete(TInt aNoBytesRecv, TInt aNoPacketsRecv, TInt aErrorCode)
+    {
+    // Adjust pending packet
+    if ((aNoBytesRecv == 0) && (aErrorCode != KErrNone))
+        {
+        // Make the buffer available for reuse
+        iDrainable[iCurrentFillingBufferIndex] = EFalse;
+        return;
+        }
+
+    ModifyTotalRxBytesAvail(aNoBytesRecv);
+    ModifyTotalRxPacketsAvail(aNoPacketsRecv);
+    iNumberofBytesRx[iCurrentFillingBufferIndex] = aNoBytesRecv;
+    iNumberofPacketsRx[iCurrentFillingBufferIndex] = aNoPacketsRecv;
+
+#if defined(USBC_LDD_BUFFER_TRACE)
+    iNumberofBytesRxRemain[iCurrentFillingBufferIndex] = aNoBytesRecv;
+    iNumberofPacketsRxRemain[iCurrentFillingBufferIndex] = aNoPacketsRecv;
+#endif
+
+    __KTRACE_OPT(KUSB, Kern::Printf("TDmaBuf::ReadXferComplete 2 # of bytes=%d # of packets=%d",
+                                    iTotalRxBytesAvail, iTotalRxPacketsAvail));
+    iDrainable[iCurrentFillingBufferIndex] = ETrue;
+    iError[iCurrentFillingBufferIndex] = aErrorCode;
+    AddToDrainQueue(iCurrentFillingBufferIndex);
+    if (iCurrentDrainingBufferIndex == KUsbcInvalidBufferIndex)
+        {
+        NextDrainableBuffer();
+        }
+    }
+
+
+TInt TDmaBuf::RxGetNextXfer(TUint8*& aBufferAddr, TUsbcPacketArray*& aIndexArray,
+                            TUsbcPacketArray*& aSizeArray, TInt& aLength, TPhysAddr& aBufferPhys)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TDmaBuf::RxGetNextXfer 1"));
+    if (RxIsActive())
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf(" ---> RxIsActive, returning"));
+        return KErrInUse;
+        }
+
+    __KTRACE_OPT(KUSB, Kern::Printf("TDmaBuf::RxGetNextXfer Current buffer=%d",
+                                    iCurrentFillingBufferIndex));
+    if (iDrainable[iCurrentFillingBufferIndex])
+        {
+        // If the controller refused the last read request, then the current buffer will still be marked
+        // as !Drainable, because the controller never completed the read to the ldd. and therefore the buffer
+        // can be reused.
+        if (!NextFillableBuffer())
+            {
+            return KErrNoMemory;
+            }
+        }
+
+    __KTRACE_OPT(KUSB, Kern::Printf("TDmaBuf::RxGetNextXfer New buffer=%d",
+                                    iCurrentFillingBufferIndex));
+    aBufferAddr = iBuffers[iCurrentFillingBufferIndex];
+    aBufferPhys = iBufferPhys[iCurrentFillingBufferIndex];
+    aIndexArray = iPacketIndex[iCurrentFillingBufferIndex];
+    aSizeArray = iPacketSize[iCurrentFillingBufferIndex];
+    aLength = iBufSz;
+
+#if defined(USBC_LDD_BUFFER_TRACE)
+    iFillingOrderArray[iCurrentFillingBufferIndex] = ++iFillingOrder;
+#endif
+
+    return KErrNone;
+    }
+
+
+TInt TDmaBuf::RxCopyPacketToClient(DThread* aThread, TClientBuffer *aTcb, TInt aLength)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TDmaBuf::RxCopyPacketToClient 1"));
+
+#if defined(USBC_LDD_BUFFER_TRACE)
+    const TInt numPkts = NoRxPackets();
+    const TInt numPktsAlt = NoRxPacketsAlt();
+    const TInt numBytes = RxBytesAvailable();
+    const TInt numBytesAlt = NoRxBytesAlt();
+
+    if (numPkts != numPktsAlt)
+        {
+        Kern::Printf(
+            "TDmaBuf::RxCopyPacketToClient: Error: #pkts mismatch global=%d actual=%d",
+            numPkts, numPktsAlt);
+        }
+    if (numBytes != numBytesAlt)
+        {
+        Kern::Printf(
+            "TDmaBuf::RxCopyPacketToClient: Error: #bytes mismatch global=%d actual=%d",
+            numBytes, numBytesAlt);
+        }
+    if ((numPkts == 0) && (numBytes !=0))
+        {
+        Kern::Printf(
+            "TDmaBuf::RxCopyPacketToClient: Error: global bytes & pkts mismatch pkts=%d bytes=%d",
+            numPkts, numBytes);
+        }
+    if ((numPktsAlt == 0) && (numBytesAlt !=0))
+        {
+        Kern::Printf(
+            "TDmaBuf::RxCopyPacketToClient: Error: actual bytes & pkts mismatch pkts=%d bytes=%d",
+            numPktsAlt, numBytesAlt);
+        }
+#endif
+
+    if (!NoRxPackets())
+        return KErrNotFound;
+
+    __KTRACE_OPT(KUSB, Kern::Printf("TDmaBuf::RxCopyPacketToClient 2"));
+    // the next condition should be true because we have some packets available
+    // coverity[var_tested_neg]
+    if (iCurrentDrainingBufferIndex == KUsbcInvalidBufferIndex)
+        {
+        // Marked as Coverity "Intentional" as the member variable
+        // iCurrentDrainingBufferIndex is attentionaly negative, from previous 
+        // initialization to KUsbcInvalidBufferIndex (which equals -1).
+        if (!NextDrainableBuffer())
+            return KErrNotFound;
+        }
+
+    __ASSERT_DEBUG((iCurrentDrainingBufferIndex >= 0 ),
+                           Kern::Fault(KUsbPanicLdd, __LINE__));
+    
+    if (!iDrainable[iCurrentDrainingBufferIndex])
+        return KErrNotFound;
+
+    // Calculate copy-from address & adjust for the fact that
+    // some data may have already been read from the packet
+    TUint8* logicalSrc = iCurrentDrainingBuffer + iCurrentPacketIndexArray[iCurrentPacket] + iExtractOffset;
+    TInt packetSz = iCurrentPacketSizeArray[iCurrentPacket];
+    TInt thisPacketSz = packetSz - iExtractOffset;
+    TInt errorCode;
+    // try and sort out what a "packet" might mean.
+    // in a multi-packet dma environment, we might see super-packets
+    // i.e. we might just see one packet, maybe 4K or so long, made of lots of small packets
+    // Since we don't know where the packet boundaries will be, we have to assume that
+    // any 'packet' larger than the max packet size of the ep is, in fact, a conglomeration
+    // of smaller packets. However, for the purposes of the packet count, this is still regarded
+    // as a single packet and the packet count only decremented when it is consumed.
+    // As before, if the user fails to read an entire packet out then the next packet is moved onto anyway
+    // To be safe the user must always supply a buffer of at least max packet size bytes.
+    if (thisPacketSz > iMaxPacketSize)
+        {
+        // Multiple packets left in buffer
+        // calculate number of bytes to end of packet
+        if (iEndpointType == UsbShai::KUsbEpTypeBulk)
+            {
+            thisPacketSz = iMaxPacketSize - (iExtractOffset & (iMaxPacketSize - 1));
+            }
+        else
+            {
+            thisPacketSz = iMaxPacketSize - (iExtractOffset % iMaxPacketSize);
+            }
+        errorCode = KErrNone;
+        }
+    else
+        {
+        errorCode = GetCurrentError();                        // single packet left
+        }
+
+    iExtractOffset += thisPacketSz;            // iExtractOffset is now at the end of the real or notional packet
+
+    ModifyTotalRxBytesAvail(-thisPacketSz);
+#if defined(USBC_LDD_BUFFER_TRACE)
+    iNumberofBytesRxRemain[iCurrentDrainingBufferIndex] -= thisPacketSz;
+#endif
+    // this can only be untrue if the "packet" is a conglomeration of smaller packets:
+    if (iExtractOffset == packetSz)
+        {
+        // packet consumed, advance to next packet in buffer
+#if defined(USBC_LDD_BUFFER_TRACE)
+        iNumberofPacketsRxRemain[iCurrentDrainingBufferIndex] -= 1;
+#endif
+        AdvancePacket();
+        }
+
+    TPtrC8 des(logicalSrc, thisPacketSz);
+    TInt r=Kern::ThreadBufWrite(aThread, aTcb, des, 0, 0, aThread);
+    if (r == KErrNone)
+        {
+        r = errorCode;
+        }
+    __KTRACE_OPT(KUSB, Kern::Printf("TDmaBuf::RxCopyPacketToClient 3"));
+
+    FreeDrainedBuffers();
+
+    // Use this error code to complete client read request:
+    return r;
+    }
+
+
+TInt TDmaBuf::RxCopyDataToClient(DThread* aThread, TClientBuffer *aTcb, TInt aLength, TUint32& aDestOffset,
+                                 TBool aRUS, TBool& aCompleteNow)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TDmaBuf::RxCopyDataToClient 1"));
+    aCompleteNow = ETrue;
+
+#if defined(USBC_LDD_BUFFER_TRACE)
+    const TInt numPkts = NoRxPackets();
+    const TInt numPktsAlt = NoRxPacketsAlt();
+    const TInt numBytes = RxBytesAvailable();
+    const TInt numBytesAlt = NoRxBytesAlt();
+
+    if (numPkts != numPktsAlt)
+        {
+        Kern::Printf(
+            "TDmaBuf::RxCopyDataToClient: Error: #pkts mismatch global=%d actual=%d",
+            numPkts, numPktsAlt);
+        }
+    if (numBytes != numBytesAlt)
+        {
+        Kern::Printf(
+            "TDmaBuf::RxCopyDataToClient: Error: #bytes mismatch global=%d actual=%d",
+            numBytes, numBytesAlt);
+        }
+    if ((numPkts == 0) && (numBytes != 0))
+        {
+        Kern::Printf(
+            "TDmaBuf::RxCopyDataToClient: Error: global bytes & pkts mismatch pkts=%d bytes=%d",
+            numPkts, numBytes);
+        }
+    if ((numPktsAlt == 0) && (numBytesAlt != 0))
+        {
+        Kern::Printf(
+            "TDmaBuf::RxCopyDataToClient: Error: actual bytes & pkts mismatch pkts=%d bytes=%d",
+            numPktsAlt, numBytesAlt);
+        }
+#endif
+
+    if (!NoRxPackets())
+        {
+        return KErrNotFound;
+        }
+
+    // coverity[var_tested_neg]
+    if (iCurrentDrainingBufferIndex == KUsbcInvalidBufferIndex)
+        {
+        // Marked as Coverity "Inentional" as the member variable
+        // iCurrentDrainingBufferIndex is attentionaly negative, from previous 
+        // initialization to KUsbcInvalidBufferIndex (which equals -1).
+
+        if (!NextDrainableBuffer())
+            {
+#if defined(USBC_LDD_BUFFER_TRACE)
+            Kern::Printf("TDmaBuf::RxCopyDataToClient: Error:  No buffer draining=%d, packets=%d",
+                         iCurrentDrainingBufferIndex, iTotalRxPacketsAvail);
+#endif
+            return KErrNotFound;
+            }
+        }
+#if defined(USBC_LDD_BUFFER_TRACE)
+
+    __ASSERT_DEBUG((iCurrentDrainingBufferIndex >= 0 ),
+                               Kern::Fault(KUsbPanicLdd, __LINE__));
+        
+    if (iDrainingOrder != iFillingOrderArray[iCurrentDrainingBufferIndex])
+        {
+        Kern::Printf("!!! Out of Order Draining TDmaBuf::RxCopyDataToClient 10 draining=%d",
+                     iCurrentDrainingBufferIndex);
+        }
+#endif
+    __KTRACE_OPT(KUSB, Kern::Printf("TDmaBuf::RxCopyDataToClient 2"));
+
+    TUint8* blockStartAddr = iCurrentDrainingBuffer + iCurrentPacketIndexArray[iCurrentPacket] + iExtractOffset;
+    TUint8* lastEndAddr = blockStartAddr;                    // going to track the contiguity of the memory
+    TUint8* thisStartAddr = blockStartAddr;
+    TInt toDo = Min(aLength - (TInt)aDestOffset, iTotalRxBytesAvail);
+#if defined(USBC_LDD_BUFFER_TRACE)
+    TInt bufnum = iCurrentDrainingBufferIndex;
+#endif
+    TInt errorCode = KErrNone;
+    TBool isShortPacket = EFalse;
+    const TInt maxPacketSizeMask = iMaxPacketSize - 1;
+    do
+        {
+#if defined(USBC_LDD_BUFFER_TRACE)
+        if (bufnum != iCurrentDrainingBufferIndex)
+            {
+            bufnum = iCurrentDrainingBufferIndex;
+            if (iDrainingOrder != iFillingOrderArray[iCurrentDrainingBufferIndex])
+                {
+                Kern::Printf("!!! Out of Order Draining TDmaBuf::RxCopyDataToClient 20 draining=%d",
+                             iCurrentDrainingBufferIndex);
+                }
+            }
+#endif
+        if (errorCode == KErrNone)
+            {
+            errorCode = GetCurrentError();
+            }
+        thisStartAddr = iCurrentDrainingBuffer + iCurrentPacketIndexArray[iCurrentPacket] + iExtractOffset;
+        const TInt thisPacketSize = iCurrentPacketSizeArray[iCurrentPacket];
+        const TInt size = thisPacketSize - iExtractOffset;
+        if (aRUS)
+            {
+            if (iEndpointType == UsbShai::KUsbEpTypeBulk)
+                {
+                isShortPacket = (size < iMaxPacketSize) || (size & maxPacketSizeMask);
+                }
+            else
+                {
+                // this 'if' block is arranged to avoid a division on packet sizes <= iMaxPacketSize
+                isShortPacket = (size < iMaxPacketSize) ||
+                    ((size > iMaxPacketSize) && (size % iMaxPacketSize));
+                }
+            }
+        TInt copySize = Min(size, toDo);
+        iExtractOffset += copySize;
+        toDo -= copySize;
+        if (thisStartAddr != lastEndAddr)
+            {
+            TInt bytesToCopy = lastEndAddr - blockStartAddr;
+            TInt r=CopyToUser(aThread, blockStartAddr, bytesToCopy, aTcb, aDestOffset);
+            if(r != KErrNone)
+                Kern::ThreadKill(aThread, EExitPanic, r, KUsbLDDKillCat);
+            blockStartAddr = thisStartAddr;
+            }
+
+        ModifyTotalRxBytesAvail(-copySize);
+#if defined(USBC_LDD_BUFFER_TRACE)
+        iNumberofBytesRxRemain[iCurrentDrainingBufferIndex] -= copySize;
+#endif
+        lastEndAddr = thisStartAddr + copySize;
+        if (iExtractOffset == thisPacketSize)
+            {
+            // More data to copy, so need to access new packet
+#if defined(USBC_LDD_BUFFER_TRACE)
+            iNumberofPacketsRxRemain[iCurrentDrainingBufferIndex] -= 1;
+#endif
+            if (!AdvancePacket())
+                {
+                break;                                        // no more packets left
+                }
+            }
+        } while (toDo > 0 && !isShortPacket);
+
+    if (thisStartAddr != lastEndAddr)
+        {
+        TInt bytesToCopy = lastEndAddr - blockStartAddr;
+        TInt r=CopyToUser(aThread, blockStartAddr, bytesToCopy, aTcb, aDestOffset);
+        if(r != KErrNone)
+            Kern::ThreadKill(aThread, EExitPanic, r, KUsbLDDKillCat);
+        }
+
+    // If we have transferred the requested amount of data it is still possible that
+    // the next packet is a zlp which needs to be bumped over
+
+    if (aRUS && (toDo == 0) && (iExtractOffset == 0) && (!isShortPacket) && (!IsReaderEmpty()) &&
+        (PeekNextPacketSize() == 0))
+        {
+        // swallow a zlp
+        isShortPacket = ETrue;
+#if defined(USBC_LDD_BUFFER_TRACE)
+        iNumberofPacketsRxRemain[iCurrentDrainingBufferIndex] -= 1;
+#endif
+        AdvancePacket();
+        }
+    aCompleteNow = isShortPacket || (((TInt)aDestOffset) == aLength) || (errorCode != KErrNone);
+
+    FreeDrainedBuffers();
+
+    // Use this error code to complete client read request
+    return errorCode;
+    }
+
+
+inline TInt TDmaBuf::CopyToUser(DThread* aThread, const TUint8* aSourceAddr,
+                                TInt aLength, TClientBuffer *aTcb, TUint32& aDestOffset)
+    {
+    TPtrC8 des(aSourceAddr, aLength);
+    TInt errorCode = Kern::ThreadBufWrite(aThread, aTcb, des, aDestOffset, KChunkShiftBy0, aThread);
+    if (errorCode == KErrNone)
+        {
+        aDestOffset += aLength;
+        }
+    return errorCode;
+    }
+
+
+inline TInt TDmaBuf::NoRxPackets() const
+    {
+    return iTotalRxPacketsAvail;
+    }
+
+
+inline void TDmaBuf::IncrementBufferIndex(TInt& aIndex)
+    {
+    if (++aIndex == iNumberofBuffers)
+        aIndex = 0;
+    }
+
+
+TBool TDmaBuf::NextDrainableBuffer()
+    {
+    TBool r = EFalse;
+    if (iCurrentDrainingBufferIndex != KUsbcInvalidBufferIndex)
+        {
+        iCanBeFreed[iCurrentDrainingBufferIndex] = ETrue;
+        iNumberofPacketsRx[iCurrentDrainingBufferIndex] = 0; // Current buffer is empty
+        iNumberofBytesRx[iCurrentDrainingBufferIndex] = 0;    // Current buffer is empty
+
+#if defined(USBC_LDD_BUFFER_TRACE)
+        TUint& bytesRemain = iNumberofBytesRxRemain[iCurrentDrainingBufferIndex];
+        TUint& pktsRemain = iNumberofPacketsRxRemain[iCurrentDrainingBufferIndex];
+        if ((bytesRemain != 0) || (pktsRemain != 0))
+            {
+            Kern::Printf(
+                "TDmaBuf::NextDrainableBuffer: Error: data discarded buffer=%d pkts=%d bytes=%d",
+                iCurrentDrainingBufferIndex, pktsRemain, bytesRemain);
+            bytesRemain = 0;
+            pktsRemain = 0;
+            }
+#endif
+
+        iCurrentDrainingBufferIndex = KUsbcInvalidBufferIndex;
+        iCurrentPacket = KUsbcInvalidPacketIndex;
+        }
+
+    if (iDrainQueueIndex != KUsbcInvalidDrainQueueIndex)
+        {
+        r = ETrue;
+        const TInt index = iDrainQueue[0];
+        iDrainQueueIndex--;
+        for (TInt i = 0; i < iNumberofBuffers; i++)
+            {
+            iDrainQueue[i] = iDrainQueue[i+1];
+            }
+
+#if defined(USBC_LDD_BUFFER_TRACE)
+        if (index != KUsbcInvalidBufferIndex)
+            iDrainingOrder++;
+#endif
+
+        iCurrentDrainingBufferIndex = index;
+        iCurrentDrainingBuffer = iBuffers[index];
+        iCurrentPacketIndexArray = iPacketIndex[index];
+        iCurrentPacketSizeArray = iPacketSize[index];
+        iCurrentPacket = 0;
+        }
+    return r;
+    }
+
+
+TInt TDmaBuf::PeekNextDrainableBuffer()
+    {
+    TInt r = KUsbcInvalidBufferIndex;
+    if (iDrainQueueIndex != KUsbcInvalidDrainQueueIndex)
+        {
+        r = iDrainQueue[0];
+        }
+    return r;
+    }
+
+
+TBool TDmaBuf::NextFillableBuffer()
+    {
+    TBool r = EFalse;
+    TInt index = iCurrentFillingBufferIndex;
+    IncrementBufferIndex(index);
+    // the sequence will restart at 0 if a buffer can't be found this time
+    iCurrentFillingBufferIndex = 0;
+    for (TInt i = 0; i < iNumberofBuffers; i++)
+        {
+        if (!iDrainable[index])
+            {
+            iCurrentFillingBufferIndex = index;
+            r = ETrue;
+            break;
+            }
+        IncrementBufferIndex(index);
+        }
+    return r;
+    }
+
+
+void TDmaBuf::FreeDrainedBuffers()
+    {
+    for (TInt i = 0; i < iNumberofBuffers; i++)
+        {
+        if (iDrainable[i] && iCanBeFreed[i])
+            {
+            iDrainable[i] = iCanBeFreed[i] = EFalse;
+            }
+        }
+    }
+
+
+TBool TDmaBuf::ShortPacketExists()
+    {
+    // Actually, a short packet or residue data
+    __KTRACE_OPT(KUSB, Kern::Printf("TDmaBuf::ShortPacketExists 1"));
+    TInt index = iCurrentDrainingBufferIndex;
+    TUsbcPacketArray* pktSizeArray = iCurrentPacketSizeArray;
+
+    if (iMaxPacketSize > 0)
+        {
+        // No buffers available for draining
+        if ((iCurrentDrainingBufferIndex == KUsbcInvalidBufferIndex) ||
+            (iCurrentPacket == KUsbcInvalidPacketIndex))
+            return EFalse;
+
+        // Zlp waiting at tail
+        if ((iTotalRxBytesAvail == 0) && (NoRxPackets() == 1))
+            return ETrue;
+
+        if (iEndpointType == UsbShai::KUsbEpTypeBulk)
+            {
+            const TInt mask = iMaxPacketSize - 1;
+            if (iTotalRxBytesAvail & mask)
+                return ETrue;
+
+            // residue==0; this can be because
+            // zlps exist, or short packets combine to n * max_packet_size
+            // This means spadework
+            const TInt s = iCurrentPacketSizeArray[iCurrentPacket] - iExtractOffset;
+            if ((s == 0) || (s & mask))
+                {
+                return ETrue;
+                }
+
+            for (TInt i = 0; i < iNumberofBuffers; i++)
+                {
+                if (index == KUsbcInvalidBufferIndex)
+                    break;
+                if (iDrainable[index])
+                    {
+                    const TInt packetCount = iNumberofPacketsRx[index];
+                    const TInt lastPacketSize=pktSizeArray[packetCount - 1];
+                    if ((lastPacketSize < iMaxPacketSize) || (lastPacketSize & mask))
+                        {
+                        return ETrue;
+                        }
+                    }
+                index = iDrainQueue[i];
+                pktSizeArray = iPacketSize[index];
+                }
+            }
+        else
+            {
+            if (iTotalRxBytesAvail % iMaxPacketSize)
+                return ETrue;
+
+            // residue==0; this can be because
+            // zlps exist, or short packets combine to n * max_packet_size
+            // This means spadework
+            const TInt s = iCurrentPacketSizeArray[iCurrentPacket] - iExtractOffset;
+            if ((s == 0) || (s % iMaxPacketSize))
+                {
+                return ETrue;
+                }
+
+            for (TInt i = 0; i < iNumberofBuffers; i++)
+                {
+                if (index == KUsbcInvalidBufferIndex)
+                    break;
+                if (iDrainable[index])
+                    {
+                    const TInt packetCount = iNumberofPacketsRx[index];
+                    const TInt lastPacketSize = pktSizeArray[packetCount - 1];
+                    if ((lastPacketSize < iMaxPacketSize) || (lastPacketSize % iMaxPacketSize))
+                        {
+                        return ETrue;
+                        }
+                    }
+                index = iDrainQueue[i];
+                pktSizeArray = iPacketSize[index];
+                }
+            }
+        }
+
+    return EFalse;
+    }
+
+
+void TDmaBuf::AddToDrainQueue(TInt aBufferIndex)
+    {
+    if (iDrainQueue[iDrainQueueIndex + 1] != KUsbcInvalidBufferIndex)
+        {
+#if defined(USBC_LDD_BUFFER_TRACE)
+        Kern::Printf("TDmaBuf::AddToDrainQueue: Error: invalid iDrainQueue[x]");
+#endif
+        }
+    iDrainQueue[++iDrainQueueIndex] = aBufferIndex;
+    }
+
+
+#if defined(USBC_LDD_BUFFER_TRACE)
+TInt TDmaBuf::NoRxPacketsAlt() const
+    {
+    TInt pktCount = 0;
+    for(TInt i = 0; i < iNumberofBuffers; i++)
+        {
+        if (iDrainable[i])
+            {
+            pktCount += iNumberofPacketsRxRemain[i];
+            }
+        }
+    return pktCount;
+    }
+
+
+TInt TDmaBuf::NoRxBytesAlt() const
+    {
+    TInt byteCount = 0;
+    for(TInt i = 0; i < iNumberofBuffers; i++)
+        {
+        if (iDrainable[i])
+            {
+            byteCount += iNumberofBytesRxRemain[i];
+            }
+        }
+    return byteCount;
+    }
+#endif
+
+
+// We only store 1 transaction, no other buffering is done
+TInt TDmaBuf::TxStoreData(DThread* aThread, TClientBuffer *aTcb, TInt aTxLength, TUint32 aBufferOffset)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TDmaBuf::TxStoreData 1"));
+    if (!IsReaderEmpty())
+        return KErrInUse;
+
+    __KTRACE_OPT(KUSB, Kern::Printf("TDmaBuf::TxStoreData 2"));
+    
+    TInt remainTxLength = aTxLength;
+    TUint32 bufferOffset = aBufferOffset;
+    // Store each buffer separately
+    for( TInt i=0;(i<iNumberofBuffers)&&(remainTxLength>0);i++)
+        {
+        TUint8* logicalDest = iBuffers[i];
+        TInt xferSz = Min(remainTxLength, iBufSz);
+        TPtr8 des(logicalDest, xferSz, xferSz);
+        TInt r = Kern::ThreadBufRead(aThread, aTcb, des, bufferOffset, KChunkShiftBy0);
+        if(r != KErrNone)
+            {
+            Kern::ThreadKill(aThread, EExitPanic, r, KUsbLDDKillCat);
+            return r;
+            }
+        remainTxLength -= iBufSz;
+        bufferOffset += iBufSz;
+        }
+
+    return KErrNone;
+    }
+
+
+TInt TDmaBuf::TxGetNextXfer(TUint8*& aBufferAddr, TInt& aTxLength, TPhysAddr& aBufferPhys)
+    {
+    if (iTxActive)
+        return KErrInUse;
+
+    aBufferAddr = iBuffers[0];                                // only 1 tx buffer
+    aBufferPhys = iBufferPhys[0];
+    aTxLength = BufferTotalSize();
+
+    return KErrNone;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/ldd/perilddsc/appifwrapper/eabi/usbcscu.def	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,23 @@
+EXPORTS
+	_ZN15TEndpointBuffer11WriteBufferEPvjiR14TRequestStatus @ 1 NONAME
+	_ZN15TEndpointBuffer11WriteBufferEjjiR14TRequestStatus @ 2 NONAME
+	_ZN15TEndpointBuffer16GetInBufferRangeERPvRj @ 3 NONAME
+	_ZN15TEndpointBuffer16GetInBufferRangeERjS0_ @ 4 NONAME
+	_ZN15TEndpointBuffer5CloseEv @ 5 NONAME
+	_ZN15TEndpointBuffer9GetBufferERPvRjRiR14TRequestStatusj @ 6 NONAME
+	_ZN15TEndpointBufferC1Ev @ 7 NONAME
+	_ZN15TEndpointBufferC2Ev @ 8 NONAME
+	_ZN16RDevUsbcScClient12OpenEndpointER15TEndpointBufferi @ 9 NONAME
+	_ZN16RDevUsbcScClient17FinalizeInterfaceERP6RChunk @ 10 NONAME
+	_ZN16RDevUsbcScClient17FinalizeInterfaceEv @ 11 NONAME
+	_ZN16RDevUsbcScClient20GetDataTransferChunkERP6RChunk @ 12 NONAME
+	_ZN16RDevUsbcScClient28StartNextOutAlternateSettingEi @ 13 NONAME
+	_ZN18TUsbcScChunkHeader20GetNumberOfEndpointsEi @ 14 NONAME
+	_ZN18TUsbcScChunkHeader9GetBufferEiiRP24TUsbcScHdrEndpointRecord @ 15 NONAME
+	_ZN18TUsbcScChunkHeaderC1E6RChunk @ 16 NONAME
+	_ZN18TUsbcScChunkHeaderC2E6RChunk @ 17 NONAME
+	_ZN15TEndpointBuffer4DumpEv @ 18 NONAME
+	_ZN15TEndpointBuffer10TakeBufferERPvRjRiR14TRequestStatusj @ 19 NONAME
+	_ZN15TEndpointBuffer6ExpireEv @ 20 NONAME
+	_ZN15TEndpointBuffer6ExpireEPv @ 21 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/ldd/perilddsc/appifwrapper/group/bld.inf	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,39 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// 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:
+// bld.inf
+// USB Client Driver
+// 
+//
+
+/**
+ @file
+*/
+PRJ_PLATFORMS
+
+BASEDEFAULT
+
+PRJ_MMPFILES
+
+#if defined(GENERIC_MARM) || defined(WINS) || defined(GENERIC_X86)
+#if !defined(MARM_THUMB) && !defined(MARM_ARMI)
+
+#if !defined(WINS) 
+#if !defined(X86)
+usbcsc_bil
+#endif
+#endif
+
+
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/ldd/perilddsc/appifwrapper/group/usbcsc_bil.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,31 @@
+// 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 the License "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:
+// e32/drivers/usbcsc/usbcsc_bil.mmp
+// 
+//
+USERINCLUDE    ../../include
+
+OS_LAYER_SYSTEMINCLUDE
+
+target            usbcsc_bilshai.dll
+targettype        dll
+sourcepath        ../src
+source            usbcsc_bil.cpp
+
+library           euser.lib
+
+deffile           ../~/usbcsc.def 
+
+VENDORID        0x70000001
+capability        all
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/ldd/perilddsc/appifwrapper/src/usbcsc_bil.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,633 @@
+// 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 the License "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:
+// e32\drivers\usbcsc\usbcsc_bil.cpp
+// 
+//
+
+#include <e32std.h>
+#include <e32std_private.h>
+#include <usb/d32usbcsc.h>
+#include <e32debug.h>
+
+/** @file usbcsc_bil.cpp
+
+	Buffer Interface Layer for USB Client Device driver stack, using shared chunks.
+
+	@internalTechnology
+*/
+
+EXPORT_C TInt RDevUsbcScClient::FinalizeInterface()
+	{
+	TInt errorOrhandle = DoControl(EControlRealizeInterface); //returns a error value or chunk handle
+	TInt r = iSharedChunk.SetReturnedHandle(errorOrhandle);
+	iEndpointStatus = 0x00; //all endpoints are closed at the moment
+	iAlternateSetting = 0;
+	iNewAltSetting = 0;
+	iAltSettingSeq = 0;
+	return r;
+	}
+
+
+EXPORT_C TInt RDevUsbcScClient::FinalizeInterface(RChunk*& aChunk)
+	{
+	TInt errorOrhandle = DoControl(EControlRealizeInterface);
+	iSharedChunk.SetReturnedHandle(errorOrhandle);
+	iEndpointStatus = 0x00; //all endpoints are closed at the moment
+	iAlternateSetting = 0;
+	return aChunk->SetReturnedHandle(errorOrhandle);
+	}
+
+
+EXPORT_C TInt RDevUsbcScClient::OpenEndpoint(TEndpointBuffer& aEpB, TInt aEpI)
+	{
+	TUsbcScHdrEndpointRecord* endpointInf = NULL;
+	TBuf8<KUsbDescSize_Endpoint> descriptor;
+	TUsbcScChunkHeader chunkHeader(iSharedChunk);
+	//Do some validity checks
+	if((aEpB.iInState != TEndpointBuffer::ENotValid) && (aEpB.iOutState != TEndpointBuffer::ENotValid))
+		return KErrArgument;
+
+	TInt nEndpoints = chunkHeader.GetNumberOfEndpoints(iAlternateSetting);	
+	if ((aEpI < KEp0Number) && (aEpI > nEndpoints)) // Check endpoint number range 
+		return KErrNotFound;
+
+	if(iEndpointStatus & (1 << aEpI)) // Check that endpoint isn't already opene
+		return KErrInUse;
+
+	if(aEpI == KEp0Number) //endpoint 0
+		{
+		TUsbcScHdrEndpointRecord ep0=  TUsbcScHdrEndpointRecord(KUsbcScEndpointZero, KUsbScHdrEpDirectionBiDir | KUsbScHdrEpTypeControl);
+		aEpB.Construct(this,iSharedChunk.Base(), &ep0 ,aEpI, 
+		(SUsbcScBufferHeader*) ((TUint)iSharedChunk.Base() + (chunkHeader.iBuffers)->Ep0Out()->Offset()));
+
+		aEpB.iBufferStartAddr = (TUint8*) ((TUint)iSharedChunk.Base() + (chunkHeader.iBuffers)->Ep0In()->Offset());
+		aEpB.iSize = chunkHeader.iBuffers->Ep0In()->Size();
+		}
+	else  // If normal endpoint (!ep0)
+		{
+		TUsbcScBufferRecord* buf = 	chunkHeader.GetBuffer(iAlternateSetting,aEpI,endpointInf);
+		if (!buf)
+			return KErrGeneral;
+		// Set up endpoint members
+		aEpB.iBufferStartAddr = (TUint8*)  (buf->Offset() + (TUint)iSharedChunk.Base());
+		aEpB.iSize = buf->Size();
+		TInt r = GetEndpointDescriptor(iAlternateSetting, aEpI, descriptor);
+		if(r != KErrNone) // We need this to be able to calculate alignment
+			{
+			return r;
+			}
+
+		if (endpointInf->Direction()&KUsbScHdrEpDirectionIn)
+			{  							//in case of IN endpoints, first endpoint buffer location points to end offset
+			aEpB.Construct(this,iSharedChunk.Base(),endpointInf,aEpI);
+			if (iInAltSetting==KErrEof)
+			aEpB.iInState=TEndpointBuffer::EEOF;
+
+			}
+		else
+			{
+			SUsbcScBufferHeader *endpointHdr = (SUsbcScBufferHeader *) aEpB.iBufferStartAddr;
+			//In this case,SUsbcScBufferHeader points to full OUT endpoint header 
+			aEpB.Construct(this,iSharedChunk.Base(),endpointInf,aEpI, endpointHdr);
+			}
+		}
+	iEndpointStatus |= (1 << aEpI);	
+
+#ifdef _DEBUG
+	aEpB.Dump();
+	RDebug::Printf("iEndpointStatus: %x \n",iEndpointStatus);
+#endif
+	return KErrNone;
+	}
+
+
+//Internal, used by RDevUsbcScClient::StartNextOutAlternateSetting(...)
+//This drains any old data from an OUT buffer, and gets it ready for reading an ep.
+//aBufferOffset - The offset, into the chunk, that the buffer in question, may be found.
+ 
+TInt RDevUsbcScClient::Drain(TUint aBufferOffset)
+{
+	TUint8* base = iSharedChunk.Base();
+	SUsbcScBufferHeader* endpointHdr = (SUsbcScBufferHeader*) (aBufferOffset+base);
+	TUint localTail = endpointHdr->iBilTail;
+	TUsbcScTransferHeader* currentTransfer;
+	TUint16 next = (iAltSettingSeq+1)&0xFFFF;
+	TInt err=KErrNone;
+
+	while (ETrue)
+		{
+		if (localTail == (TUint) endpointHdr->iHead)
+			{
+			err = KErrNotReady;
+			break;
+			}
+		currentTransfer = (TUsbcScTransferHeader*) (base + localTail);
+
+		if (currentTransfer->iAltSettingSeq == next)
+			{
+			iNewAltSetting=currentTransfer->iAltSetting; // record new alt setting
+			break;
+			}
+		else
+			{
+			localTail = currentTransfer->iNext;
+			}
+		} // end while
+	endpointHdr->iBilTail = localTail;
+	endpointHdr->iTail = localTail;
+	return err;
+}
+
+//Internal, used by RDevUsbcScClient::StartNextOutAlternateSetting(...)
+//This method checks that the OUT buffer is ready for reading an ep.
+//aBufferOffset - The offset, into the chunk, that the buffer in question, may be found.
+
+TInt RDevUsbcScClient::Peek(TUint aBufferOffset)
+{
+	TUint8* base = iSharedChunk.Base();
+	SUsbcScBufferHeader* endpointHdr = (SUsbcScBufferHeader*) (aBufferOffset+base);
+	TUint localTail = endpointHdr->iBilTail;
+	TUsbcScTransferHeader* currentTransfer = (TUsbcScTransferHeader*) (base + localTail);
+
+	if ((localTail == (TUint)endpointHdr->iHead) || (currentTransfer->iAltSettingSeq != (iAltSettingSeq+1)&0xFFFF))
+		// if alternate setting has not changed
+		return KErrNotReady;
+	else
+		{
+		iNewAltSetting=currentTransfer->iAltSetting;
+		return KErrNone;
+		}
+}
+
+//Internal, used by RDevUsbcScClient::StartNextOutAlternateSetting(...)
+//This method is called if an alternate setting change happens from a set of ONLY IN endpoints.
+//Used to find the least possible alternate setting it can return to the user, stored in iNewAltSetting
+//Returns the sequence number of the 'latest' alternate setting it can switch to
+
+TInt RDevUsbcScClient::FindNextAlternateSetting()
+	{
+	TUsbcScChunkHeader chunkHeader(iSharedChunk);
+	TUsbcScHdrEndpointRecord* endpointInf = NULL;
+	TUint bufOff;
+	TInt altSet;
+	TInt ep;
+	TInt bufNum;
+
+	RArray <TInt> bufferOffset;	// Array to contain all OUT enpoint buffer offsets
+	// Populate array
+	for (altSet = 0; altSet < chunkHeader.iAltSettings->iNumOfAltSettings ; altSet++)
+		{
+		TInt numEndpoints = chunkHeader.GetNumberOfEndpoints(altSet);
+		for (ep =  1; ep  <= numEndpoints ; ep ++)
+			{
+			bufOff = chunkHeader.GetBuffer(altSet, ep, endpointInf)->Offset();	
+			if ((endpointInf->Direction() & KUsbScHdrEpDirectionOut) && (bufferOffset.Find(bufOff) == KErrNotFound))
+				{
+				bufferOffset.Append(bufOff);
+				}
+			}
+		}
+
+	TInt err = KErrNotFound;
+	TUint16 altSetSeqDelta = 0;
+	TUint16 currentaltSetSeqDelta = 0;
+	TBool noNewSettingFound = ETrue;
+	TInt altSetSeq = iAltSettingSeq;
+	TUint8* base = iSharedChunk.Base();
+
+	for (bufNum = 0; bufNum < bufferOffset.Count(); bufNum++) // Scan all OUT buffers
+		{	
+		SUsbcScBufferHeader* endpointHdr = (SUsbcScBufferHeader*) (bufferOffset[bufNum] + base);
+		TUint localTail = endpointHdr->iBilTail;
+		TUsbcScTransferHeader* currentTransfer;
+		TUint16 next = (iAltSettingSeq+1)&0xFFFF;
+		
+		while (ETrue)
+			{
+			if (localTail == (TUint) endpointHdr->iHead)
+				{
+				break;	// This OUT endpoint buffer has no data, proceed checking with other OUT endpoint buffers
+				}
+			currentTransfer = (TUsbcScTransferHeader*) (base + localTail);
+
+			if (currentTransfer->iAltSettingSeq != iAltSettingSeq) 
+				{
+				if (currentTransfer->iAltSettingSeq == next)
+					{
+					altSetSeq = currentTransfer->iAltSettingSeq;
+					iNewAltSetting = currentTransfer->iAltSetting; // record new alt setting
+					err = KErrNone;
+					break;
+					}
+
+				if (noNewSettingFound)
+					{
+					altSetSeqDelta = Abs(iAltSettingSeq - currentTransfer->iAltSettingSeq);
+					altSetSeq = currentTransfer->iAltSettingSeq;
+					iNewAltSetting = currentTransfer->iAltSetting; // record new alt setting
+					noNewSettingFound = EFalse;
+					}
+				else
+					{
+					currentaltSetSeqDelta = Abs(iAltSettingSeq - currentTransfer->iAltSettingSeq);
+					if (currentaltSetSeqDelta < altSetSeqDelta)
+						{
+						altSetSeqDelta = currentaltSetSeqDelta;
+						altSetSeq = currentTransfer->iAltSettingSeq;
+						iNewAltSetting = currentTransfer->iAltSetting;
+						}
+					}
+				break;
+				}
+			
+			localTail = currentTransfer->iNext;
+			} // end while
+
+		if (!err) // Found an alt set sequence one after iAltSettingSeq
+			{
+			break; // found 'the next' alternate setting, exit for loop
+			}
+		
+		}// for loop
+
+	return altSetSeq;
+	}
+
+EXPORT_C TInt RDevUsbcScClient::StartNextOutAlternateSetting(TBool aFlush)
+	{
+	TUsbcScChunkHeader chunkHeader(iSharedChunk);
+	
+	//if endpoints are still open, return KErrInUse 
+	if((iEndpointStatus&~1) != 0)
+		{
+		return KErrInUse;
+		}
+
+	TInt r;
+	TInt ep;
+	TInt noEp;
+	TUint bufOff;
+	TBool inEndpointSet = ETrue;
+	TUsbcScHdrEndpointRecord* endpointInf = NULL;
+
+	// check if alternate setting contains all IN endpoints
+	noEp = chunkHeader.GetNumberOfEndpoints(iAlternateSetting);
+
+	// for each used buffer. 
+	for (ep=1;ep<=noEp;ep++)
+		{
+		bufOff = chunkHeader.GetBuffer(iAlternateSetting,ep,endpointInf)->Offset();	
+	
+		if (endpointInf->Direction() & KUsbScHdrEpDirectionOut) 
+			{
+			inEndpointSet = EFalse;
+			if (aFlush)
+				r = Drain(bufOff); // we need to remove anythng in the way, and get it ready for reading.
+			else
+				r = Peek(bufOff); // we need to check it is ready for reading!
+			if (r) 
+				return r;
+			}
+		}
+
+
+	TInt altSeq = 0;
+	if (inEndpointSet)	// If all endpoints in the current alternate setting are IN endpoints
+		{	// go through all OUT buffers for alternate setting change
+		altSeq = FindNextAlternateSetting();
+		}
+
+	if((iNewAltSetting == iAlternateSetting) && (!inEndpointSet))
+			{
+			return KErrNotReady;
+			}
+
+	// Find/Set IN alternate setting
+	TInt ret = StartNextInAlternateSetting();
+	SUsbcScAlternateSetting* altrec = ((SUsbcScAlternateSetting*) (&ret));
+
+	if (altrec->iSequence==iAltSettingSeq+1)
+		{
+		if (altrec->iSetting!=iNewAltSetting)
+			return KErrGeneral;
+		iInAltSetting=iNewAltSetting;
+		}
+	else
+		{
+		if (inEndpointSet)
+			{
+			if ((altSeq == iAltSettingSeq) || (iAltSettingSeq == altrec->iSequence))
+				{
+				return KErrNotReady;
+				}
+			else if (altSeq != altrec->iSequence)
+				{
+				iInAltSetting=KErrEof;
+				}
+			}
+		iInAltSetting=KErrEof;
+		}
+
+	iAlternateSetting = iNewAltSetting;
+	iAltSettingSeq += 1;
+
+	return iAlternateSetting;
+	}
+
+
+EXPORT_C TInt RDevUsbcScClient::GetDataTransferChunk(RChunk* & aChunk)
+	{
+	aChunk = &iSharedChunk;
+	return KErrNone;
+	}
+
+// Constructor
+
+EXPORT_C TEndpointBuffer::TEndpointBuffer()
+		:iInState(ENotValid),
+		iOutState(ENotValid),
+		iEndpointNumber(-1),
+		iBufferNum(-1),
+		iBufferStartAddr(0),
+		iSize(0)
+	{
+	}
+
+// Internal, called by RDevUsbcScClient::OpenEndpoint.
+void TEndpointBuffer::Construct(RDevUsbcScClient* aClient, TUint8* aBaseAddr, const TUsbcScHdrEndpointRecord* aEpType , TInt aEndpointNumber,SUsbcScBufferHeader* aEndpointHdr)
+	{
+	iClient		= aClient;
+	iBaseAddr	= (TUint) aBaseAddr;
+	iInState 	= (((aEpType->Direction())&KUsbScHdrEpDirectionIn) ? EValid :  ENotValid);
+	iOutState	= (((aEpType->Direction())&KUsbScHdrEpDirectionOut) ? EValid :  ENotValid);
+	iBufferNum	= (aEpType->iBufferNo==(KUsbcScEndpointZero&0xFF))?KUsbcScEndpointZero:aEpType->iBufferNo;
+	iEndpointNumber = aEndpointNumber;
+
+	iEndpointHdr = aEndpointHdr;
+	};
+
+EXPORT_C TInt TEndpointBuffer::GetInBufferRange(TAny*& aStart, TUint& aSize)
+	{
+	if ((iInState))
+		{
+		return iInState;
+		}
+	aStart= iBufferStartAddr;
+	aSize= iSize;
+	return KErrNone;
+	};
+
+EXPORT_C TInt TEndpointBuffer::GetInBufferRange(TUint& aStart, TUint& aSize)
+	{
+	if ((iInState))
+		return iInState;
+	aStart=	(TUint) iBufferStartAddr - iBaseAddr;
+	aSize= iSize;
+	return KErrNone;
+	}
+
+
+EXPORT_C TInt TEndpointBuffer::GetBuffer(TAny*& aBuffer,TUint& aSize,TBool& aZLP,TRequestStatus& aStatus,TUint aLength)
+	{
+	if (iOutState)
+		return iOutState;
+
+	TUsbcScTransferHeader* currentTransfer;
+	TInt r;
+	do // until we have a transfer with data.
+		{
+		iEndpointHdr->iTail = iEndpointHdr->iBilTail; 
+		if(iEndpointHdr->iBilTail == iEndpointHdr->iHead)  //If no new data, create request
+			{
+			r = iClient->ReadDataNotify(iBufferNum,aStatus);
+			if (r!=KErrCompletion)  // Data could arrive since we checked.
+				return r;
+			}
+		currentTransfer = (TUsbcScTransferHeader*) (iBaseAddr + iEndpointHdr->iBilTail);
+
+		iEndpointHdr->iBilTail = currentTransfer->iNext;
+		aZLP = (currentTransfer->iFlags & KUsbcScShortPacket)!=EFalse;
+
+		if(currentTransfer->iAltSettingSeq != (iClient->iAltSettingSeq))  // if alternate setting has changed
+			{
+			if (currentTransfer->iAltSettingSeq == (iClient->iAltSettingSeq+1))	   //Note- KIS ATM, if multiple alternate setting changes happen
+				iClient->iNewAltSetting = currentTransfer->iAltSetting; //before StartNextOutAlternateSetting is called, 		   
+																	   //this variable will reflect the latest requested AlternateSetting
+
+
+			if (iEndpointNumber != KEp0Number)
+				{
+//				iOutState =  EEOF;	
+				return KErrEof;
+				}
+			else if ((currentTransfer->iBytes==0) && (!aZLP)) 
+				{
+				return KErrAlternateSettingChanged;
+				}
+			}						
+
+		}
+	while ((currentTransfer->iBytes==0) && (!aZLP)); // ignore empty transfers
+
+	aBuffer = currentTransfer->iData.i;
+	aSize = currentTransfer->iBytes;	
+	return (currentTransfer->iFlags & KUsbcScStateChange)?KStateChange:KErrCompletion;	
+	}
+
+EXPORT_C TInt TEndpointBuffer::TakeBuffer(TAny*& aBuffer,TUint& aSize,TBool& aZLP,TRequestStatus& aStatus,TUint aLength)
+	{
+	if (iOutState)
+		return iOutState;
+
+	TUsbcScTransferHeader* currentTransfer;
+	TInt r;
+	do // until we have a transfer with data.
+		{
+		if(iEndpointHdr->iBilTail == iEndpointHdr->iHead)  //If no new data, create request
+			{
+			r = iClient->ReadDataNotify(iBufferNum,aStatus);
+			if (r!=KErrCompletion)  // Data could arrive since we checked.
+				{
+				return r;
+				}
+			}
+
+		currentTransfer = (TUsbcScTransferHeader*) (iBaseAddr + iEndpointHdr->iBilTail);
+		iEndpointHdr->iBilTail = currentTransfer->iNext;
+		aZLP = (currentTransfer->iFlags & KUsbcScShortPacket)!=EFalse; // True if short packet else false 
+
+		if(currentTransfer->iAltSettingSeq != (iClient->iAltSettingSeq))  // if alternate setting has changed
+			{
+			if (currentTransfer->iAltSettingSeq == (iClient->iAltSettingSeq+1))	   //Note- KIS ATM, if multiple alternate setting changes happen
+				iClient->iNewAltSetting = currentTransfer->iAltSetting; //before StartNextOutAlternateSetting is called, 		   
+																	   //this variable will reflect the latest requested AlternateSetting
+			Expire(currentTransfer->iData.i);
+			if (iEndpointNumber != KEp0Number)
+				{
+//				iOutState = EEOF;
+				return KErrEof;
+				}
+			else if ((currentTransfer->iBytes==0) && (!aZLP)) 
+				{
+				return KErrAlternateSettingChanged;
+				}
+
+			}	
+
+		if ((currentTransfer->iBytes==0) && (!aZLP)) // here , if empty transfer with alt setting information, Call expire 
+			{
+			Expire(currentTransfer->iData.i);
+			}
+		}
+	while ((currentTransfer->iBytes==0) && (!aZLP)); // ignore empty transfers
+
+	aBuffer = currentTransfer->iData.i;
+	aSize = currentTransfer->iBytes;
+	return (currentTransfer->iFlags & KUsbcScStateChange)?KStateChange:KErrCompletion;	
+	}
+
+EXPORT_C TInt TEndpointBuffer::Expire()
+	{
+	if (!(iOutState != ENotValid))
+		return iOutState;
+
+	if (iEndpointHdr->iTail != iEndpointHdr->iBilTail)
+		{
+		TUsbcScTransferHeader* currentTransfer = (TUsbcScTransferHeader*) (iBaseAddr + iEndpointHdr->iTail);
+		iEndpointHdr->iTail = currentTransfer->iNext;
+		}
+	return KErrNone;
+	}
+
+EXPORT_C TInt TEndpointBuffer::Expire(TAny* aAddress)
+	{
+	if (!(iOutState != ENotValid))
+		return iOutState;
+
+	TUint headerSize = sizeof(TUsbcScTransferHeader)-4; // TransferHeader includes 4 bytes of data.
+	TInt transferToExpire = ((TUint) aAddress - headerSize);
+	TInt offsetToExpire = transferToExpire - iBaseAddr; 
+
+	TInt currentTail = iEndpointHdr->iTail;
+
+	TInt prevTail = NULL;
+	TBool found = EFalse;
+	while (currentTail != iEndpointHdr->iBilTail)
+		{
+		TUsbcScTransferHeader* currentTransfer = (TUsbcScTransferHeader*) (iBaseAddr + currentTail);
+		if (currentTail == offsetToExpire)		// found which to expire
+			{
+			found = ETrue;
+			// This offset is to be expired
+			if (prevTail == NULL)
+				{
+				// The offset is at the list head
+				iEndpointHdr->iTail = currentTransfer->iNext;	
+				}
+			else
+				{
+				// The offset is NOT at the list head
+				// This leaves a GAP in the buffer which will not be filled unless the 'transfers' before 'currentTail' are expired
+				currentTail = currentTransfer->iNext;
+				TUsbcScTransferHeader* prevTransfer = (TUsbcScTransferHeader*) (iBaseAddr + prevTail);
+				prevTransfer->iNext = currentTail;
+				}
+			break;
+			}
+		prevTail = currentTail;
+		currentTail = currentTransfer->iNext;
+		}
+	return found ? KErrNone : KErrNotFound;
+	}
+
+	
+EXPORT_C TInt TEndpointBuffer::WriteBuffer(TAny* aBuffer,TUint aSize,TBool aZLP,TRequestStatus& aStatus)
+	{
+	if (iInState)
+		return iInState;
+
+	iClient->WriteData(iBufferNum, ((TUint)aBuffer - (TUint)iBaseAddr),aSize,aZLP,aStatus);
+	return KErrNone;
+	}
+
+
+EXPORT_C TInt TEndpointBuffer::WriteBuffer(TUint aOffset,TUint aSize,TBool aZLP,TRequestStatus& aStatus)
+	{
+	if (iInState)
+		return iInState;
+
+	iClient->WriteData(iBufferNum,aOffset,aSize,aZLP,aStatus);
+	return KErrNone;
+	}
+
+
+/**
+Closes the endpoint buffer
+@return			KErrNone if close is successfull
+*/	
+EXPORT_C TInt TEndpointBuffer::Close()
+	{
+	if ((iInState == ENotValid) && (iOutState == ENotValid))
+		return KErrNotFound;
+	if (iOutState != ENotValid)
+		{
+		TUsbcScTransferHeader* currentTransfer = (TUsbcScTransferHeader*) (iBaseAddr + iEndpointHdr->iTail);
+		//Incase of AlternateSetting changes and using TEndpointBuffer::GetBuffer, iTail is always one 'transfer' behind iBilTail
+		//Incase of AlternateSetting changes and using TEndpointBuffer::TakeBuffer, this shuold force the user to update iTail & only then closes the endpoint buffer
+		if (((TInt) currentTransfer->iNext != iEndpointHdr->iBilTail) && (iEndpointHdr->iTail != iEndpointHdr->iBilTail))
+			return KErrNotReady;
+		}
+	iClient->iEndpointStatus &= ~(1 << iEndpointNumber); //reset the bit corresponding to endpoint
+	iInState = ENotValid;
+	iOutState = ENotValid;
+	return KErrNone;
+	}
+
+
+  
+EXPORT_C TUsbcScChunkHeader::TUsbcScChunkHeader(RChunk aChunk)
+	{
+	iChunk = aChunk;
+	iBuffers     = (TUsbcScChunkBuffersHeader*)    (aChunk.Base()+((TUsbcScChunkHdrOffs*)iChunk.Base())->iBuffers);
+	iAltSettings = (TUsbcScChunkAltSettingHeader*) (aChunk.Base()+((TUsbcScChunkHdrOffs*)iChunk.Base())->iAltSettings);
+	}
+
+EXPORT_C TInt TUsbcScChunkHeader::GetNumberOfEndpoints(TInt aAltSetting)
+	{
+	if ((aAltSetting<0) || (aAltSetting>=iAltSettings->iNumOfAltSettings))
+		return KErrArgument;
+	return  *((TInt*) (iAltSettings->iAltTableOffset[aAltSetting] + (TInt) iChunk.Base()));
+	}
+
+
+EXPORT_C TUsbcScBufferRecord* TUsbcScChunkHeader::GetBuffer(TInt aAltSetting, TInt aEndpoint, TUsbcScHdrEndpointRecord*& aEndpointInf)
+	{
+	if ((aAltSetting<0) || (aAltSetting>=iAltSettings->iNumOfAltSettings))
+		return NULL;
+	TInt8* iEndpoint = (TInt8*) (iAltSettings->iAltTableOffset[aAltSetting] + (TInt) iChunk.Base());
+	if ((aEndpoint<=0) || (aEndpoint>*iEndpoint))
+		return NULL;
+	aEndpointInf = (TUsbcScHdrEndpointRecord*) &(iEndpoint[aEndpoint*iAltSettings->iEpRecordSize]);
+	return iBuffers->Buffers(aEndpointInf->iBufferNo);
+	}
+
+
+/* Debug functions */
+
+EXPORT_C void TEndpointBuffer::Dump()
+	{
+	RDebug::Printf("TEndpointBuffer::Dump iBufferStart: 0x%x, iSize: 0x%x, iEndpointNumber: 0x%x, iBufferNum: %d, iInState: 0x%x iOutState: 0x%x\n",
+							iBufferStartAddr,iSize,iEndpointNumber,iBufferNum,iInState,iOutState);
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/ldd/perilddsc/group/bld.inf	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,43 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// 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:
+// bld.inf
+// USB Client Driver
+// 
+//
+
+/**
+ @file
+*/
+#include "../appifwrapper/group/bld.inf"
+
+PRJ_PLATFORMS
+
+BASEDEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+
+#if defined(GENERIC_MARM) || defined(WINS) || defined(GENERIC_X86)
+#if !defined(MARM_THUMB) && !defined(MARM_ARMI)
+
+#if !defined(WINS) 
+#if !defined(X86)
+usbcsc
+#endif
+#endif
+
+
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/ldd/perilddsc/group/usbcsc.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,32 @@
+// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// 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:
+// e32/drivers/usbcsc/usbcsc.mmp
+// 
+//
+#include <kernel/kern_ext.mmh>
+
+
+OS_LAYER_SYSTEMINCLUDE
+
+target            usbcscshai.ldd
+targettype        ldd
+
+sourcepath        ../src
+source            d_usbcsc.cpp
+
+library            usbperipheralpil.lib
+
+uid             0 0x101F8928
+VENDORID        0x70000001
+capability        all
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/ldd/perilddsc/src/d_usbcsc.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,3663 @@
+// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// 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:
+// e32\drivers\usbcsc\d_usbcsc.cpp
+// LDD for USB Device driver stack, using shared chunks:
+// The channel object.
+// 
+//
+
+/**
+ @file d_usbcsc.cpp
+ @internalTechnology
+*/
+
+// #include <drivers/usbcsc.h>
+#include <usb/usbcsc.h>
+#include "platform.h"
+
+/*****************************************************************************\
+*   DUsbcScLogDevice                                                          *
+*                                                                             *
+*   Inherits from DLogicalDevice, the USB Shared Chunk LDD factory class      *
+*                                                                             *
+\*****************************************************************************/
+
+_LIT(KUsbScLddName, "Usbcsc");
+
+static const TInt KUsbRequestCallbackPriority = 2;
+
+/** Real entry point from the Kernel: return a new driver.
+ */
+DECLARE_STANDARD_LDD()
+    {
+    return new DUsbcScLogDevice;
+    }
+
+/** Create a channel on the device.
+
+    @internalComponent
+*/
+TInt DUsbcScLogDevice::Create(DLogicalChannelBase*& aChannel)
+    {
+    aChannel = new DLddUsbcScChannel;
+    return aChannel ? KErrNone : KErrNoMemory;
+    }
+
+
+DUsbcScLogDevice::DUsbcScLogDevice()
+      {
+      iParseMask = KDeviceAllowUnit;
+      iUnitsMask = 0xffffffff;                                // Leave units decision to the Controller
+      iVersion = TVersion(KUsbcScMajorVersion, KUsbcScMinorVersion, KUsbcScBuildVersion);
+      }
+
+
+TInt DUsbcScLogDevice::Install()
+    {
+    // Only proceed if we have the Controller underneath us
+    if (!DUsbClientController::UsbcControllerPointer())
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("LDD Install: USB Controller Not Present"));
+        return KErrGeneral;
+        }
+    return SetName(&KUsbScLddName);
+    }
+
+
+//
+// Return the USB controller capabilities.
+//
+void DUsbcScLogDevice::GetCaps(TDes8& aDes) const
+    {
+    TPckgBuf<TCapsDevUsbc> b;
+    b().version = iVersion;
+    Kern::InfoCopy(aDes, b);
+    }
+
+// End DUsbcScLogDevice
+
+/*****************************************************************************\
+*   TUsbcScChunkInfo                                                          *
+*                                                                             *
+*   Where Chunk information is stored for the channel, and preseved for the   *
+*   life of the chunk.                                                        *
+*                                                                             *
+\*****************************************************************************/
+
+void DfcChunkCleanup(TAny*);
+
+TUsbcScChunkInfo::TUsbcScChunkInfo(DLogicalDevice* aLdd)
+    :     iChunk(NULL),
+        iCleanup((TDfcFn)&DfcChunkCleanup,this,Kern::SvMsgQue(),0),
+        iChunkMem(NULL),
+        iLdd(aLdd)
+    {
+    iPageNtz = (TInt8)__e32_find_ls1_32(Kern::RoundToPageSize(1));
+    }
+
+TInt TUsbcScChunkInfo::CreateChunk(TInt aTotalSize)
+    {
+    // First, reserve an TUint of memory for each of pages needed to hold aTotalSize of memory.
+    // This will form the chunk map, so that we can look up the memory geometry.
+    iAllocatedSize = (aTotalSize>>iPageNtz)*sizeof(TUint);
+    iPhysicalMap = (TUint*) Kern::AllocZ(iAllocatedSize);
+    TInt r;
+    if (iPhysicalMap==NULL)
+        r = KErrNoMemory;
+    else
+        {
+        TChunkCreateInfo chunkInfo;
+        chunkInfo.iType = TChunkCreateInfo::ESharedKernelMultiple;
+        chunkInfo.iMaxSize = aTotalSize;
+        chunkInfo.iMapAttr = EMapAttrCachedMax;
+        chunkInfo.iOwnsMemory = EFalse;
+        chunkInfo.iDestroyedDfc = &iCleanup;
+
+        TLinAddr chunkMem;
+        r = Kern::ChunkCreate(chunkInfo, iChunk, chunkMem, iChunkMapAttr);
+        iChunkMem = (TInt8*) chunkMem;
+        if (r==KErrNone)
+            iLdd->Open();
+        }
+
+    return r;
+}
+
+
+// This method requests closing the chunk.
+// Note that nothing may happen immediately, as something else may have the chunk open.
+void TUsbcScChunkInfo::Close()
+{
+    Kern::ChunkClose(iChunk);    
+}
+
+
+TInt TUsbcScChunkInfo::ChunkAlloc(TInt aOffset, TInt aSize)
+    {
+    TUint pageMask = (~0)<<iPageNtz;
+    TUint rleMask = ~pageMask;
+    TUint pageSize = rleMask+1;
+    TInt r;
+    TLinAddr physAddr;
+
+    __KTRACE_OPT(KUSB, Kern::Printf("::chunkalloc  AllocPhysicalRam aSize %d", aSize));
+
+    r = Epoc::AllocPhysicalRam(aSize, physAddr);
+    __KTRACE_OPT(KUSB, if (r!=KErrNone) Kern::Printf("::chunkalloc AllocPhysicalRam r=%d  (Error!)", r));
+    if (r==KErrNone)
+        {    
+        __KTRACE_OPT(KUSB, Kern::Printf("::chunkalloc ChunkCommitPhysical iChunk 0x%x size(%d), aOffset 0x%x, aSize 0x%x phsAddr 0x%x",
+                                                                                     iChunk, sizeof(DChunk), aOffset, aSize,physAddr ));
+
+        r = Kern::ChunkCommitPhysical(iChunk, aOffset, aSize, physAddr);
+        __KTRACE_OPT(KUSB, if (r!=KErrNone) Kern::Printf("::chunkalloc ChunkCommitPhysical r=%d  (Error!)", r));
+
+        if (r!=KErrNone)
+                Epoc::FreePhysicalRam(physAddr, aSize);
+        else 
+            { // record physical address and length in physical map
+            TInt rle;
+            TInt i=0;
+            for (rle=(aSize>>iPageNtz); rle>0; rle--, i++,physAddr+=pageSize) 
+                {
+                __KTRACE_OPT(KUSB, Kern::Printf("::phys offset 0x%x = 0x%x",
+                                                (aOffset>>iPageNtz)+i,  (physAddr & pageMask) | ((rle>(TInt)rleMask)?(TInt)rleMask:rle)));
+                iPhysicalMap[(aOffset>>iPageNtz)+i] = (physAddr & pageMask) | ((rle>(TInt)rleMask)?(TInt)rleMask:rle);
+                }
+            }
+        }
+    else if (r==KErrNoMemory)
+        r = -KErrNoMemory;  // Semi-expected error.
+    return r;
+    }
+
+/**
+This method retrieves the physical address of a given offset into the Chunk, and returns
+the length of contiguous physical memory from this point.
+
+@param aOffset        the offset from the start of the chunk, to be queried.
+@param aPhysical    a pointer to a TPhysAddr, to be filled with the physical
+                    address of the memory at the given offset.
+
+@returns the length of contiguous physical memory from the given offset.
+*/
+
+TInt TUsbcScChunkInfo::GetPhysical(TInt aOffset, TPhysAddr* aPhysical)
+    {
+    // Use masks, to retrieve the two components from the physical map, we created of the memory.
+    TUint pageMask = (~0)<<iPageNtz;
+    TUint val =  iPhysicalMap[aOffset>>iPageNtz];
+    *aPhysical=(val & pageMask)+(aOffset & ~pageMask);
+    return ((val & ~pageMask)<<iPageNtz) -  (aOffset & ~pageMask);
+    }
+
+
+// DFC calls this fuction, which invokes the cleanup method.
+
+void DfcChunkCleanup(TAny* aChunkInfo)
+    {
+    ((TUsbcScChunkInfo*) aChunkInfo)->ChunkCleanup();
+    }
+
+
+void TUsbcScChunkInfo::ChunkCleanup()
+{
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScChunkInfo::ChunkCleanup()"));
+    TUint physAddr;
+    TInt length;
+    TInt offset = 0;
+    
+    // The part of the field used for the physical page address.
+    TUint pageMask = (~0)<<iPageNtz;
+
+    // The part of the field used for the run length encoding, of the contiguous pages.
+    TUint rleMask = ~pageMask;
+    TInt records=(iAllocatedSize>>2);
+
+    while (offset < records) 
+        {
+        physAddr =     iPhysicalMap[offset] & pageMask;
+        length = iPhysicalMap[offset] & rleMask;
+
+        if (physAddr>0)    
+            Epoc::FreePhysicalRam(physAddr, length);
+
+        offset += (length>0)?length:1;
+        }
+    Kern::Free(iPhysicalMap);
+
+    DLogicalDevice* ldd = iLdd;
+    delete this;
+    ldd->Close(NULL);
+}
+
+TInt TUsbcScChunkInfo::New(TUsbcScChunkInfo*& aChunk, TInt aSize, DLogicalDevice* aLdd)
+{
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScChunkInfo::New totalSize %d", aSize));
+
+    aChunk = new TUsbcScChunkInfo(aLdd);
+    if (aChunk==NULL)
+        {
+        return KErrNoMemory;
+        }
+                    
+    TInt r = aChunk->CreateChunk(aSize);
+    if (r!=KErrNone)
+        {
+        delete aChunk;
+        aChunk=NULL;
+        return r;
+        }
+
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScChunkInfo::New Created at 0x%x",  aChunk->iChunkMem  ));
+    return KErrNone;
+}
+
+// End TUsbcScChunkInfo
+
+/*****************************************************************************\
+*    TUsbcScBuffer                                                            *
+*                                                                             *
+*    Represents a buffer, within a chunk.  Each buffers can be used by        *
+*    differt endpoint on differnt alt settings                                *
+*                                                                             *
+\*****************************************************************************/
+
+
+TInt TUsbcScBuffer::Construct(TInt aDirection, DLddUsbcScChannel* aLdd, TInt aBufferOffset, TInt aBufferEndOffset, TInt aMinReadSize, TInt aMaxPacketSize, TInt aMaxReadSize)
+    {
+    TInt r;
+#ifdef _DEBUG
+    iSequence = aBufferOffset; // Initialized at this, so that each buffer starts with a diffrent sequence number
+#endif
+    iMinReadSize = aMinReadSize;
+    TInt size = (aBufferEndOffset - aBufferOffset);
+    TInt pageSize = Kern::RoundToPageSize(1);
+    if (aMaxReadSize > 0)
+        iMaxReadSize = aMaxReadSize;
+    else
+        iMaxReadSize = pageSize + ((size/3) & ~(pageSize -1));
+    iLdd = aLdd;
+    iDirection = aDirection;
+    iMode=0;
+    iChunkInfo = aLdd->iChunkInfo;
+    iChunkAddr = (TLinAddr) (aLdd->iChunkInfo->iChunkMem);  //aChunkAddr;
+
+    TInt headerSize =  sizeof(TUsbcScTransferHeader)-4; // TransferHeader includes 4 bytes of data.
+
+
+    TUint maxAlignment; // Note:  This is a mask for max Alignment, 
+
+    if (aMaxPacketSize)
+        { // EP0 packets are not DMAed, and so dont need ialignment.
+        iAlignMask = ~3;
+        maxAlignment = 3;
+        }
+    else
+         maxAlignment = 1023; // We don't know what the alignment requirement will be until enumeration, so assume worse case.
+
+    iFirstPacket = aBufferOffset + sizeof(SUsbcScBufferHeader) + headerSize;
+    iFirstPacket = (iFirstPacket + maxAlignment) & ~maxAlignment;
+    
+    iBufferStart = (SUsbcScBufferHeader *) (iChunkAddr+aBufferOffset);
+    iBufferEnd = aBufferEndOffset;
+
+    if ((iDirection&1)==KUsbcScOut)
+        iHead = iFirstPacket-headerSize;//aBufferOffset + sizeof(SUsbcScBufferHeader);
+    else
+        iSent = 0;
+
+    iStalled=0;
+    iMaxPacketSize=0;
+    
+    r =  iStatusList.Construct((aDirection==KUsbcScIn)?KUsbcScInRequests:KUsbcScOutRequests, iLdd->iClient);
+    if (!r)
+        {
+        iMaxPacketSize = aMaxPacketSize; // Indicates configured if ep0, otherwise not.
+        }
+    return r;
+    }
+
+
+void TUsbcScBuffer::CreateChunkBufferHeader()
+{
+    if ((iDirection&1)==KUsbcScOut)
+        {
+        iBufferStart->iHead= iHead;
+        iBufferStart->iTail= iHead; // Initially no data!
+        iBufferStart->iBilTail=iHead;
+        __KTRACE_OPT(KUSB, Kern::Printf("Realize:  iHead 0x%x  bufferHeader 0x%x", iHead,iBufferStart ));
+
+        // Dont need to round here, as we will round it up on endpoint change. (configuration)
+        }
+}
+
+/*
+TUsbcScBuffer::StartEndpoint
+
+This method sets the nessesary paramenters to the buffer, for use for a particular endpoint.
+
+*/
+void TUsbcScBuffer::StartEndpoint(TUsbcRequestCallback* aRequestInfo, TUint aFlags)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::StartEndpoint (0x%x) : ep %d(%d)",this,aRequestInfo->iEndpointNum, aRequestInfo->iRealEpNum));
+    
+    iCallback=aRequestInfo;
+    iMaxPacketSize =  iLdd->iController->EndpointPacketSize(iLdd, aRequestInfo->iRealEpNum);
+    iAlignMask = ~(((iMaxPacketSize+1) & 0xFFFFFFF8)-1);
+    iMode = aFlags;
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::StartEndpoint : max Packets %d, mask 0x%x flags 0x%x", iMaxPacketSize, iAlignMask, iMode));
+    if ((iDirection&1)==KUsbcScOut)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::UsbcScOut\n"));
+        // Add dummy packet (doesnt have to be aligned, which avoids what if it changes issue)
+        // And Start next read.
+        iNeedsPacket=KEpIsStarting;
+        }
+    }
+
+
+
+void TUsbcScBuffer::Destroy()
+{
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::Destroy()"));
+    Cancel(KErrCancel);
+    if (iLdd->iController && ((iDirection&1)==KUsbcScOut))  
+        {  // Me must cancel reads to LDD to, an there will be no list for the callbacks to look into.
+        iLdd->iController->CancelReadBuffer(iLdd, iCallback->iRealEpNum);
+        }
+    iStatusList.Destroy();
+}
+
+
+
+TInt TUsbcScBuffer::StartDataRead()
+{
+    if (!iMaxPacketSize)
+    {
+        __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::StartDataRead() - Not Configured"));
+        return KErrNone;
+    }
+    if (iStatusList.iState!=ENotRunning) 
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::StartDataRead() - Already Stated! (%d)",iStatusList.iState));
+        return KErrNone;
+        }
+
+    TInt maxLength;
+    TInt freeSpace;
+    TPhysAddr physAddr;
+
+    // get next request
+    TUsbcScStatusElement* nextJob = iStatusList.Next();
+    if (nextJob == NULL)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("No more jobs"));
+        if (iMode && KUsbScCoupledRead)
+            return KErrEof;
+        iStatusList.iState=EReadingAhead;
+        }
+    else
+        iStatusList.iState=EInProgress;
+
+    TInt tail = iBufferStart->iTail;
+    TInt headerSize =  sizeof(TUsbcScTransferHeader)-4; // TransferHeader includes 4 bytes of data.
+    maxLength = iChunkInfo->GetPhysical(iHead + headerSize, &physAddr); //returns all the bytes available after iHead + headerSize)
+
+    __ASSERT_DEBUG(maxLength>0,Kern::Fault("TUsbcScBuffer::StartDataRead(", __LINE__)); 
+
+
+    if (tail>iHead)  //  # # # H _ _ _ T # # # #
+        {
+        __KTRACE_OPT(KUSB,Kern::Printf("TUsbcScBuffer::StartDataRead() - tail 0x%x>head 0x%x, maxlength 0x%x", tail, iHead, maxLength));
+
+        freeSpace = (tail & iAlignMask) - (iHead +headerSize + (~iAlignMask+1) );  // Cant read right up to last buffer, or head/tail will cross.
+
+        if (freeSpace<iMinReadSize)
+            {
+            iStatusList.iState=ENotRunning;
+            __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::StartDataRead() - Stall!!"));
+            return KErrOverflow;                 // Read STALL !! !! !!
+            }
+
+        if (freeSpace<maxLength)
+            maxLength = freeSpace;
+        }
+    if (maxLength> iMaxReadSize) 
+        maxLength =  iMaxReadSize;
+    // else  tail<iHead (or empty)      _ _ _ T # # # H _ _ _ _
+    // We would not have set iHead here if too small. So must be ok.
+        
+    __ASSERT_DEBUG(maxLength>=iMinReadSize,Kern::Fault("TUsbcScBuffer::StartDataRead(", __LINE__)); 
+
+    TUint8* data = ((TUsbcScTransferHeader *) (iHead + iChunkAddr))->iData.b;
+    // set up callback stucture
+
+    iCallback->SetRxBufferInfo(data, physAddr, iIndexArray, iSizeArray,maxLength);
+    TInt r;
+    // Go!!
+    r = iLdd->iController->SetupReadBuffer(*iCallback);
+    if (r!=KErrNone)
+        {
+        __KTRACE_OPT(KUSB,Kern::Printf("SetupReadBuffer Error: %d, RT %d",r, iStatusList.iState));
+        iStatusList.Complete(r);
+        }
+    // After this, TUsbcScEndpoint::RequestCallback is called in a DFC.
+    // This in turn calls either TUsbcScBuffer::CompleteRead.
+    return KErrNone;
+}
+
+
+void TUsbcScBuffer::CompleteRead(TBool aStartNextRead)
+{
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::CompleteRead buff=%x",this));
+
+    // The first packet always contains the total #of bytes
+    const TInt byteCount = iCallback->iPacketSize[0];
+    const TInt packetCount = iCallback->iRxPackets;
+     iCallback->iRxPackets=0;
+    TUint flags = 0;
+
+    if (iCallback->iPacketSize[packetCount - 1] < (TUint) iMaxPacketSize)
+        flags = KUsbcScShortPacket;
+
+    UpdateBufferList(byteCount, flags, aStartNextRead);
+}
+
+
+// This method "submits" the current transfer, and starts off the next read.
+
+void TUsbcScBuffer::UpdateBufferList(TInt aByteCount,TUint aFlags, TBool aStartNextRead)
+    {
+
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::UpdateBUfferLIst aByteCount %d, flags 0x%x iHead 0x%x", aByteCount, aFlags, iHead));
+
+    TInt headerSize =  sizeof(TUsbcScTransferHeader)-4; // TransferHeader includes 4 bytes of data.
+    TLinAddr dummy;
+    __KTRACE_OPT(KUSB, Kern::Printf("iHead 0x%x headerSize 0x%x",iHead, headerSize));
+
+    // Find iNext
+
+    TInt next =  iHead +  headerSize + aByteCount; // next unused byte in buffer.
+    TInt maxLength; 
+
+    // This may take a few loops before we settle on a value.
+    do 
+        {
+        // round up.
+        next = (next + headerSize + ~iAlignMask) & iAlignMask;
+        maxLength = iChunkInfo->GetPhysical(next, &dummy);
+
+        __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::UpdateBUfferLIst  next %x  buffer end %x min-read: %x  maxRun %x", next, iBufferEnd, iMinReadSize, maxLength));
+        // At the end of the buffer - wrap it if needbe.
+        if ((TUint)(next + iMinReadSize) > iBufferEnd)
+            {
+            next = iFirstPacket;
+            continue;
+            }
+        // Not enough space, move onto next block.
+        if (maxLength<iMinReadSize) 
+            {
+            next+=maxLength;
+            __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::UpdateBUfferLIst Skip exhausted block. next %x max %d", next, maxLength));
+            continue;
+            }
+        }
+    while (EFalse);
+
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::UpdateBUfferLIst next (pre deduct): %x, Fill in header at head: 0x%x,  BuffStart: 0x%x.", next, iHead, iBufferStart));
+    
+    next -=  headerSize;  // Move next back from the data start position, to the header start.
+
+    TUsbcScTransferHeader* header = (TUsbcScTransferHeader*) (iHead + iChunkAddr);
+    
+// Create Header
+#ifdef _DEBUG
+    header->iHashId=59*(iLdd->iAlternateSetting+1)+iCallback->iRealEpNum; // Alt setting realated....
+    header->iSequence=iSequence;
+    iSequence++;
+#endif
+    header->iBytes=aByteCount;
+    header->iNext=next;
+    header->iAltSettingSeq=iLdd->iAsSeq;
+    header->iAltSetting=iLdd->iAlternateSetting;
+    header->iFlags=aFlags;
+    __KTRACE_OPT(KUSB, Kern::Printf("We set next to 0x%x", next));
+
+    iStatusList.iState=ENotRunning;
+    if (next==iBufferStart->iTail) //or (othwise is as good as full)
+        {
+            iStalled=next;
+        }
+    else
+        {
+
+        __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::UpdateBUfferLIst StartRead?? "));
+        TInt oldHead=iHead;
+        iHead = next;
+
+        if ((aStartNextRead) && (StartDataRead() == KErrOverflow))
+            { // Oh crumbs, set state as slalled.
+            if (oldHead != iBufferStart->iBilTail) 
+                // If user has not read everything in the buffer
+                // then set up a stall, so that ldd get to be woken early
+                {
+                iStalled=next;
+                iHead=oldHead;
+                }
+            else // otherwise if everything is read
+                // no choice but to return what we have
+                {
+                iBufferStart->iHead = iHead;
+                }
+            }
+        else
+            {
+            iBufferStart->iHead = next;
+            __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::UpdateBUfferLIst Compleating\n"));
+            }
+        // Complete userside
+        iStatusList.Complete();
+        }  
+    }
+
+void TUsbcScBuffer::PopStall()
+    {
+    if (iStalled==iBufferStart->iTail)
+        return;  // Still stalled.
+
+    if (iStalled!=-1) // If not Alt packet only stall
+    {
+        // pop off packet    
+        iHead = iStalled;
+     }
+    iStalled=0;
+    // If Alt setting of the popped packet is different to now
+    // Add alt setting change packet.
+
+
+    if (StartDataRead() == KErrOverflow)
+    {
+        __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::PopStall Warning: Transfer was freed, but still no space!\n"));
+    }
+
+    iBufferStart->iHead = iHead;
+    }
+
+
+
+void TUsbcScBuffer::StartDataWrite()
+    {
+    
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::StartDataWrite()"));
+    TUsbcScStatusElement* nextJob = iStatusList.Next();
+    TBool zlpReqd;
+    TInt length;
+    TUint start;
+    TUint8* startAddr;
+    TInt maxLength;
+    TPhysAddr physAddr;
+    TInt r;
+    if (!iMaxPacketSize)
+    {
+        __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::StartDataWrite() - Not Configured"));
+        return;
+    }
+
+    if (nextJob == NULL)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::StartDataWrite() - No more jobs d=%d", iDirection));
+        if (iDirection==KUsbcScBiIn) // assume this is EP0, if this is true.
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::StartDataWrite() Queue Read on EP0."));    
+            // Start other read again.
+            iLdd->iBuffers[iLdd->iEP0OutBuff].StartDataRead();
+            }
+        }
+    else
+        {
+        if (iStatusList.iState==ENotRunning)
+            iSent=0;
+        iStatusList.iState=EInProgress;
+
+        start = nextJob->iStart;
+        startAddr = (TUint8*) (start + ((TUint) (iChunkInfo->iChunkMem)));
+
+        length = nextJob->iLength;
+        zlpReqd = (nextJob->iFlags & KUsbcScWriteFlagsZlp) !=0;
+        // get max read length
+        maxLength = iChunkInfo->GetPhysical( start, &physAddr); 
+
+        if (maxLength < length)
+            {
+                // modify request.
+                nextJob->iStart += maxLength;
+                nextJob->iLength -= maxLength;
+                // start this request.
+                iStatusList.iState=EFramgementInProgress;
+                zlpReqd=EFalse;
+                length =  maxLength;
+            }
+
+        if (iDirection==KUsbcScBiIn) // this is for EP0
+            {
+            iLdd->iController->CancelReadBuffer(iLdd, iCallback->iRealEpNum);
+            iLdd->iBuffers[iLdd->iEP0OutBuff].iStatusList.iState=ENotRunning;
+            }
+        
+        iCallback->SetTxBufferInfo(startAddr, physAddr, length);
+        iCallback->iZlpReqd = zlpReqd;
+        r = iLdd->iController->SetupWriteBuffer(*iCallback);
+        if (r!=KErrNone)
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("SetupWriteBUffer Error: %d",r));
+            iStatusList.Complete(r);
+            }
+        }
+
+    }
+
+void TUsbcScBuffer::CompleteWrite()
+    {
+    TInt error = iCallback->iError;
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::CompleteWrite buff=%x, err=%d",this, error));
+    iSent+= iCallback->iTxBytes;
+
+    // More to send?
+    if (error || iStatusList.iState!=EFramgementInProgress)
+        {
+        // complete request with error (if one).
+        // Some data could have been transmitted, even with an error. 
+        iStatusList.Complete(error);
+        }
+
+    // Start next request, or next part of this one.
+    StartDataWrite();
+    
+    }
+
+// Cancels the current request's callback.
+// This is not to say it will cancel the actual operation,
+// However it will cancel any further sections of the user perceived operation
+// that are not yet started.
+void TUsbcScBuffer::Cancel(TInt aErrorCode)
+    {
+    iStatusList.CancelQueued();
+    if (iLdd->iController && ((iDirection&1)==KUsbcScIn))
+        {
+        iLdd->iController->CancelWriteBuffer(iLdd, iCallback->iRealEpNum);
+        }
+
+    iStatusList.Complete(aErrorCode);
+    }
+
+void TUsbcScBuffer::Ep0CancelLddRead()
+    {
+    // Stopping a read isn't as easy as one might think.
+    // We cancel the callback, but then check if any data was received (but not returned to us).
+    // If so, we must de-queue the request, and call the completion code.
+    
+    iLdd->iController->CancelReadBuffer(iLdd, iCallback->iRealEpNum);
+    if (iCallback->iRxPackets) // received data?
+        {
+        // remove DFC (if infact sent)
+        iCallback->iDfc.Cancel();
+
+        // process the callback now, but dont start another
+        CompleteRead(EFalse);
+        }
+    }
+
+void TUsbcScBuffer::SendEp0StatusPacket(TInt aState)
+{
+    __KTRACE_OPT(KUSB, Kern::Printf(" TUsbcScBuffer::SendEp0StatusPacket(%d)", aState));
+
+    // We need to add a packet to the buffer, so we must stop the pending read, and start
+    // another after we have added out packet.  
+    Ep0CancelLddRead();
+
+    TUint* state = ((TUsbcScTransferHeader *) (iHead + iChunkAddr))->iData.i;
+    *state = aState;
+    UpdateBufferList(4,KUsbcScStateChange);
+}
+
+// End TUsbcScBuffer
+
+/*****************************************************************************\
+*    TUsbcScStatusList                                                        *
+*                                                                             *
+*    This is a list of read or write requests, containing user status         *
+*    requests, that should later be completed.                                *
+*                                                                             *
+\*****************************************************************************/
+
+/**
+Constructor for TUsbcScStatusList.
+
+@param aSize    is the number of requests to allow at any one time.  This value
+                must be a power of two, for correct operation.
+
+@returns KErrNoMemory if memory allocation failure, otherwise KErrNone.
+*/
+
+TInt TUsbcScStatusList::Construct(TInt aSize, DThread* aClient)
+    {
+    iSize=aSize;
+    iHead = 0;
+    iLength = 0;
+    iClient = aClient;
+    iElements=(TUsbcScStatusElement *) Kern::AllocZ(sizeof(TUsbcScStatusElement)*aSize);
+    return (iElements==NULL)?KErrNoMemory:KErrNone;    
+    };
+
+
+// StatusList must be inactive before destroying.
+void TUsbcScStatusList::Destroy()
+    {
+    if (iState!=ENotRunning)
+        Kern::Fault("TUsbcScStatusList::Destroy", __LINE__);
+    if (iElements)
+        {
+        Kern::Free(iElements);    
+        iElements=NULL;
+        }
+    iClient=NULL;
+}
+
+void TUsbcScStatusList::Pop()
+    {
+    if (iLength>0)
+        {
+        iLength--;
+        iHead = ((iHead+1) & (iSize-1));
+        }
+    }
+
+TUsbcScStatusElement* TUsbcScStatusList::Next()
+    {
+    return (iLength==0)?NULL:&(iElements[iHead]);
+    }
+
+TInt TUsbcScStatusList ::Add(TRequestStatus* aStatus, TInt aLength, TUint aStart, TUint aFlags)
+    {
+    __KTRACE_OPT(KUSB,Kern::Printf("Adding request.  iLength %d  iSize %d", iLength, iSize));
+    if (iLength<iSize)
+        {
+        TUsbcScStatusElement& e = iElements[((iHead+iLength) & (iSize-1))];
+        e.iStatus = aStatus;
+        e.iLength = aLength;
+        e.iStart = aStart;
+        e.iFlags = aFlags;
+        iLength++;
+        __KTRACE_OPT(KUSB,Kern::Printf("Adding request.  new iLength %d", iLength));
+
+        return KErrNone;
+        }
+    else
+        return KErrInUse;
+    }
+
+
+
+// This method cancels any requests that have yet to be started.
+
+void TUsbcScStatusList::CancelQueued(TInt aError)
+{
+    if ((iLength==0) || ((iState!=ENotRunning) && (iLength==1)))  // Nothing to do.
+        return;  
+    TInt elements2Complete = iLength - (iState?1:0);
+    TInt head = iHead;
+    iLength = 0;
+    if (iState)    // If (iState != ENotRunning), complete all elements excepting the one at head
+        {
+        head = ((head+1) & (iSize-1)); // To iterate through the queue
+        iLength = 1;
+        }
+    // complete them all.
+    for (; elements2Complete>0; elements2Complete--)
+          {
+        Kern::RequestComplete(iClient, iElements[head].iStatus, aError);
+        head = ((head+1) & (iSize-1)); 
+          }
+    
+}
+
+
+/* This method Completes the head status request, and pops it from its list.
+This version of Complete is to be used in cases where the next request is not
+chained - usually because of an error.
+
+@Param aError - the code to complete with.
+
+returns KErrNotFound if there was no request to complete
+*/
+
+
+TInt TUsbcScStatusList::Complete(TInt aError)
+    {
+    if (iState==ENotRunning)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScStatusList::Complete() - iState == ENotRunning!"));
+        }
+     else
+        {
+        iState=ENotRunning;
+        if (iLength==0)
+            return KErrNotFound;
+
+        Kern::RequestComplete(iClient, iElements[iHead].iStatus, aError);
+
+        iLength--;
+        iHead = ((iHead+1) & (iSize-1));
+        }
+    return KErrNone;
+    }
+
+
+/* This method Completes the head status request, and pops it from its list. (If found.)
+This version of Complete is to be used in cases where the request is successful, and
+ next request after this has (if present) been chained.
+*/
+
+void TUsbcScStatusList::Complete()
+    {
+    if (iLength==0)
+        return;
+    __KTRACE_OPT(KUSB, Kern::Printf("Completing request.  iLength %d", iLength));
+
+    Kern::RequestComplete(iClient, iElements[iHead].iStatus, KErrNone);
+
+    iLength--;
+    iHead = ((iHead+1) & (iSize-1));
+    }
+
+// End TUsbcScStatusList
+
+/*****************************************************************************\
+*   TRealizeInfo                                                              *
+*                                                                             *
+*   Used by DLddUsbcScChannel::RealizeInterface to set up the chunk           *
+*                                                                             *
+\*****************************************************************************/
+
+// Init
+//
+// This method works out the number potential maximum number of endpoints
+// and the number of alt settings.  With this information it allocs
+// the necessary space for the given stucture to store information about
+// the endpoints.  
+// This is intended to be called by RealizeInterface.  This stucture is
+// intended to be only temporary, and the space will be freed with Free()
+// before RealizeInteface has finished.
+
+void TRealizeInfo::Init(TUsbcScAlternateSettingList* aAlternateSettingList)
+{
+    iAlternateSettingList = aAlternateSettingList;
+    iMaxEndpoints=0;
+    iTotalSize   =0;
+    iTotalBuffers=0;
+    iAltSettings =0;
+    __KTRACE_OPT(KUSB, Kern::Printf("Realize: work out max endpoint"));
+    // Work out max endpoints and number of alternate settings.
+
+    if (iAlternateSettingList)
+        {
+        TUsbcScAlternateSetting* alt = iAlternateSettingList->iHead;
+        while (alt != NULL) 
+            {
+            iAltSettings++;
+            if (alt->iNumberOfEndpoints>iMaxEndpoints)
+                iMaxEndpoints = alt->iNumberOfEndpoints;
+            // could work out in/out specifics, but unnecessary.
+            alt = alt->iNext;
+            };
+        }
+    
+    // Alloc some temporary working space for temp endpoint metadata 
+    __KTRACE_OPT(KUSB, Kern::Printf("Realize: Alloc temp.  Maxendpoints %d", iMaxEndpoints));
+    TInt inout;
+    for (inout=KUsbcScIn; inout<KUsbcScDirections; inout++)
+        {
+        iBufs[inout].iEp = (TUsbcScEndpoint **) Kern::AllocZ(iAltSettings*iMaxEndpoints*sizeof(TUsbcScEndpoint *));
+        iBufs[inout].iSizes = (TInt *) Kern::AllocZ(iMaxEndpoints*sizeof(TInt));
+        }
+}
+
+// CopyAndSortEndpoints
+//
+// This method copies pointers to the endpoint records into TRealizeInfo
+// such that they are sorted in order of size per alt setting.
+// In and Out endpoints are separated, and kept separate.
+// The provided data structure is assumed to have been initialised with
+// Realize_InitRealizeInfo. 
+//
+// Return KErrArgument if the direction field is neither In or Out.
+//
+
+TInt TRealizeInfo::CopyAndSortEndpoints()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("Realize: copy And sort"));
+
+    TInt altSetting = 0;
+    TInt endpointOffs;
+    TInt endpoint;
+    TInt altEp;
+    TInt inout;
+    TBool placed;
+    TUsbcScAlternateSetting* alt;
+    TEndpointSortBufs* bufsd;
+
+    if (iAlternateSettingList)
+        {
+        for (alt = iAlternateSettingList->iHead;alt!=NULL;alt = alt->iNext )
+            {        
+            __KTRACE_OPT(KUSB, Kern::Printf("Realize:   AlternateSetting %x", alt));
+
+            iBufs[KUsbcScIn].iEps =0;
+            iBufs[KUsbcScOut].iEps =0;
+
+            // For alt setting, iterate eps
+            for (altEp=1; altEp <= alt->iNumberOfEndpoints; altEp++)
+                {
+                __KTRACE_OPT(KUSB, Kern::Printf("Realize:     Endpoint to add: %d",altEp));
+
+                TUsbcScEndpoint* nextEp = alt->iEndpoint[altEp];
+
+                __KTRACE_OPT(KUSB, Kern::Printf("Realize:      ep Buffer Size: %d",nextEp->EndpointInfo()->iBufferSize));
+                
+                inout = (nextEp->EndpointInfo()->iDir==UsbShai::KUsbEpDirIn)?KUsbcScIn:
+                        (nextEp->EndpointInfo()->iDir==UsbShai::KUsbEpDirOut)?KUsbcScOut:KUsbcScUnknown;
+                if (inout==KUsbcScUnknown)
+                    {
+                    __KTRACE_OPT(KUSB, Kern::Printf("Realize:     KUsbcScUnknown %x",nextEp->EndpointInfo()->iDir));
+                    return KErrArgument;
+                    }
+
+                bufsd = &(iBufs[inout]);
+                __KTRACE_OPT(KUSB, Kern::Printf("Realize:      ep direction: %x # endpoints %d", inout, bufsd->iEps));
+
+
+                // find and position ep, and insert.
+
+                if (bufsd->iEps==0) // First entry.
+                    {
+                    __KTRACE_OPT(KUSB, Kern::Printf("Realize:       Add first endpoint"));
+                    endpointOffs = altSetting*iMaxEndpoints;
+                    bufsd->iEp[endpointOffs] = nextEp;
+                    }
+                else
+                    {
+                    placed = EFalse;
+                    // Move down the list, until we find the right place.
+                    for (endpoint=bufsd->iEps-1; endpoint>-1; endpoint--)
+                        {
+                        endpointOffs = altSetting*iMaxEndpoints + endpoint;
+                        if (bufsd->iEp[endpointOffs]->EndpointInfo()->iBufferSize < nextEp->EndpointInfo()->iBufferSize)
+                            {
+                            __KTRACE_OPT(KUSB, Kern::Printf("Realize:       Shift Endpoint %d", endpoint));
+        
+                            bufsd->iEp[endpointOffs+1] = bufsd->iEp[endpointOffs];
+                            }
+                        else
+                            {
+                            __KTRACE_OPT(KUSB, Kern::Printf("Realize:       Insert After Endpoint %d", endpoint));
+
+                            bufsd->iEp[endpointOffs+1] = nextEp;
+                            placed = ETrue;
+                            break;
+                            }
+                        } // end for endpoint
+                        if (!placed) // if we didn't place it, it must be the biggest so far, so goes at the top.
+                            bufsd->iEp[0] = nextEp;
+                    } // endif
+                bufsd->iEps++;            
+                } // for altEp
+                altSetting++;
+            } // for alt
+        }// if iAltsettingList
+    return KErrNone;
+    }
+
+// CalcBuffSizes
+//
+// This works out the sizes of all the buffers, and stores the result in aBufInfo
+// based on the buffer information provided in the same structure.
+// Realize_CopyAndSortEndpoints is used to fill the structure with the informaition
+// required.
+
+void TRealizeInfo::CalcBuffSizes()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("Realize: Calculate Buffers"));
+
+    TInt endpoint;
+    TInt inout;
+    TInt altSetting;
+    TUsbcScEndpoint* nextEp;
+    TInt bufferSize;
+    TEndpointSortBufs* bufsd;
+
+    for (inout=KUsbcScIn; inout<KUsbcScDirections; inout++)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("Realize:   Direction: %d", inout));
+
+
+        bufsd = &(iBufs[inout]);
+        // for each row, ie, buffer, find largest buffer need.
+        for (endpoint=0; endpoint<iMaxEndpoints; endpoint++)
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("Realize:     endpoint %d", endpoint));
+            TInt bufMaxSize=0;
+            for (altSetting=0; altSetting< iAltSettings; altSetting++)
+                {
+                __KTRACE_OPT(KUSB, Kern::Printf("Realize:       altSetting %d", altSetting));
+                nextEp= bufsd->iEp[altSetting* iMaxEndpoints + endpoint];
+                if (nextEp!=NULL)
+                    {
+                    bufferSize = nextEp->EndpointInfo()->iBufferSize;
+                    __KTRACE_OPT(KUSB, Kern::Printf("Realize:       comparing size %d", bufferSize));
+                    if (bufferSize> bufMaxSize)
+                         bufMaxSize = bufferSize;
+                    }
+                } // for altsetting
+            __KTRACE_OPT(KUSB, Kern::Printf("Realize:     bufMaxSize %d", bufMaxSize));
+            bufsd->iSizes[endpoint] = bufMaxSize;
+            if (bufMaxSize>0) 
+                {
+                iTotalSize += bufsd->iSizes[endpoint];
+                iTotalBuffers++;
+                }
+            } // for endpoint
+        } // for in/out    
+}
+
+// Free
+//
+// Cleans up after Init()
+
+void TRealizeInfo::Free()
+    {
+    TInt inout;
+    for (inout=KUsbcScIn; inout<KUsbcScDirections; inout++)
+        {
+        Kern::Free(iBufs[inout].iEp);
+        Kern::Free(iBufs[inout].iSizes);
+        }
+    }
+
+// End TRealizeInfo
+
+
+// LayoutChunkHeader
+//
+// Sets up some geometry for the chunk;
+
+void TRealizeInfo::LayoutChunkHeader(TUsbcScChunkInfo* aChunkInfo)
+{ 
+    // First set up the indexes to the header structures.
+    TUsbcScChunkHdrOffs* chkHdr = (TUsbcScChunkHdrOffs*) aChunkInfo->iChunkMem;
+
+    chkHdr->iBuffers = sizeof(TUsbcScChunkHdrOffs); // First struct just after this one.
+    iChunkStuct = (TUsbcScChunkBuffersHeader*) ( (TInt) aChunkInfo->iChunkMem + chkHdr->iBuffers);
+
+    // Store number of buffers in chunk
+    iChunkStuct->iRecordSize = sizeof(TUsbcScBufferRecord);
+    iChunkStuct->iNumOfBufs=iTotalBuffers;
+
+    iAltSettingsTbl = (TUsbcScChunkAltSettingHeader*) &(iChunkStuct->iBufferOffset[(iTotalBuffers+2)*sizeof(TUsbcScBufferRecord)]); // 2 extra for EP0 in and out.
+
+    chkHdr->iAltSettings = (TUint) iAltSettingsTbl - (TUint) aChunkInfo->iChunkMem;
+
+    iAltSettingsTbl->iEpRecordSize = sizeof(TUint);
+    iAltSettingsTbl->iNumOfAltSettings = iAltSettings;
+
+
+    TInt tableOffset  = (TUint) iAltSettingsTbl->iAltTableOffset - (TUint) aChunkInfo->iChunkMem + iAltSettings*sizeof(TInt);
+    __KTRACE_OPT(KUSB, Kern::Printf("Realize: table offset: 0x%x, altTble %x iChnkMem %x altSettings %x",tableOffset, iAltSettingsTbl, aChunkInfo->iChunkMem, iAltSettings ));
+
+    __KTRACE_OPT(KUSB, Kern::Printf("Realize: populate chunk - create alt settings table"));
+
+    // Create alt settings table.  Set each element of altsettings table, to each induivatual alt setting table.
+    // then fill in the number of endpoints for that alt setting, in the table.
+
+    TInt* noEpForAlt;
+    TInt altSetting;
+    TUsbcScAlternateSetting* alt;
+    if (iAlternateSettingList)
+        {
+        alt = iAlternateSettingList->iHead;
+        for (altSetting=0; altSetting<iAltSettings; altSetting++) 
+            {
+                __KTRACE_OPT(KUSB, Kern::Printf("Realize:   altSetting %d, tableOffset %d", altSetting, tableOffset));
+
+                iAltSettingsTbl->iAltTableOffset[altSetting] = tableOffset;
+                noEpForAlt = (TInt*) &aChunkInfo->iChunkMem[tableOffset];
+             
+                *noEpForAlt = alt->iNumberOfEndpoints;  // Set NumberofEndpoints field in Altsetting table
+                tableOffset+= sizeof(TInt)+ alt->iNumberOfEndpoints*sizeof(TUsbcScHdrEndpointRecord);
+                alt = alt->iNext;
+            }
+        }        
+
+} // end LayoutChunkHeader
+
+
+
+/*****************************************************************************\
+*   DLddUsbcScChannel                                                         *
+*                                                                             *
+*   Inherits from DLogicalDevice, the USB Shared Chunk LDD factory class      *
+*                                                                             *
+\*****************************************************************************/
+
+//
+// Constructor
+//
+DLddUsbcScChannel::DLddUsbcScChannel()
+    : iValidInterface(EFalse),
+      iAlternateSettingList(NULL),
+      iEndpoint(NULL),
+      iCompleteAllCallbackInfo(this, DLddUsbcScChannel::EmergencyCompleteDfc, KUsbRequestCallbackPriority),
+      iStatusChangePtr(NULL),
+      iStatusCallbackInfo(this, DLddUsbcScChannel::StatusChangeCallback, KUsbRequestCallbackPriority),
+      iEndpointStatusChangePtr(NULL),
+      iEndpointStatusCallbackInfo(this, DLddUsbcScChannel::EndpointStatusChangeCallback,
+                                  KUsbRequestCallbackPriority),
+      iOtgFeatureChangePtr(NULL),
+      iOtgFeatureCallbackInfo(this, DLddUsbcScChannel::OtgFeatureChangeCallback, KUsbRequestCallbackPriority),
+      iNumberOfEndpoints(0),
+      iDeviceState(UsbShai::EUsbPeripheralStateUndefined),
+      iOwnsDeviceControl(EFalse),
+      iAlternateSetting(0),
+      iAsSeq(0),
+      iStatusFifo(NULL),
+      iUserKnowsAltSetting(ETrue),
+      iDeviceStatusNeeded(EFalse),
+      iChannelClosing(EFalse),
+      iRealizeCalled(EFalse),
+      iChunkInfo(NULL),
+      iNumBuffers(-1),
+      iBuffers(NULL),
+      iEp0Endpoint(NULL)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcScChannel::DLddUsbcScChannel()"));
+    iClient = &Kern::CurrentThread();
+    iClient->Open();
+    for (TInt i = 1; i < KUsbcMaxRequests; i++)
+        {
+        iRequestStatus[i] = NULL;
+        }
+    }
+
+
+//
+// Destructor
+//
+
+DLddUsbcScChannel::~DLddUsbcScChannel()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcScChannel::~DLddUsbcScChannel()"));
+    if (iController)
+        {
+        iController->DeRegisterClient(this);
+        iStatusCallbackInfo.Cancel();
+        iEndpointStatusCallbackInfo.Cancel();
+        iOtgFeatureCallbackInfo.Cancel();
+        iCompleteAllCallbackInfo.Cancel();
+        DestroyAllInterfaces();
+        if (iOwnsDeviceControl)
+            {
+            iController->ReleaseDeviceControl(this);
+            iOwnsDeviceControl = EFalse;
+            }
+        iController=NULL;
+        DestroyEp0();
+        if (iStatusFifo!=NULL)
+            {
+            delete iStatusFifo;
+            }
+        }
+    __KTRACE_OPT(KUSB, Kern::Printf("Closing buffers"));
+    if (iBuffers)
+        {
+        TInt i;
+        for (i=0; i<(iNumBuffers+2); i++) 
+            {
+            iBuffers[i].Destroy();
+            }
+        Kern::Free(iBuffers);
+        }
+
+    if (iRealizeCalled)
+        {
+        // Close Chunk
+        iChunkInfo->Close();
+        // ChunkInfo will delete itself with DFC, but the pointer here is no longer needed.        
+        iChunkInfo=NULL;
+        }
+    __KTRACE_OPT(KUSB, Kern::Printf("about to SafeClose"));
+    Kern::SafeClose((DObject*&)iClient, NULL);
+    }
+
+
+//
+// DoCreate - Create channel
+//
+
+TInt DLddUsbcScChannel::DoCreate(TInt /*aUnit*/, const TDesC8* /*aInfo*/, const TVersion& aVer)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("LDD DoCreateL 1 Ver = %02d %02d %02d",
+                                    aVer.iMajor, aVer.iMinor, aVer.iBuild));
+    if (!Kern::CurrentThreadHasCapability(ECapabilityCommDD,
+                                          __PLATSEC_DIAGNOSTIC_STRING("Checked by USBCSC.LDD (USB Driver)")))
+        {
+        return KErrPermissionDenied;
+        }
+
+    iController = DUsbClientController::UsbcControllerPointer();
+
+    if (!iController)
+        {
+        return KErrGeneral;
+        }
+
+    iStatusFifo = new TUsbcDeviceStatusQueue;
+    if (iStatusFifo == NULL)
+        {
+        return KErrNoMemory;
+        }
+
+      if (!Kern::QueryVersionSupported(TVersion(KUsbcScMajorVersion, KUsbcScMinorVersion, KUsbcScBuildVersion), aVer))
+        {
+        return KErrNotSupported;
+        }
+
+    // set up the correct DFC queue
+    SetDfcQ(iController->DfcQ(0));                            // sets the channel's dfc queue
+    iCompleteAllCallbackInfo.SetDfcQ(iDfcQ);
+    iStatusCallbackInfo.SetDfcQ(iDfcQ);                        // use the channel's dfcq for this dfc
+    iEndpointStatusCallbackInfo.SetDfcQ(iDfcQ);                // use the channel's dfcq for this dfc
+    iOtgFeatureCallbackInfo.SetDfcQ(iDfcQ);
+    iMsgQ.Receive();                                        //start up the message q
+    TInt r = iController->RegisterClientCallback(iCompleteAllCallbackInfo);
+    if (r != KErrNone)
+        return r;
+    r = iController->RegisterForStatusChange(iStatusCallbackInfo);
+    if (r != KErrNone)
+        return r;
+    r = iController->RegisterForEndpointStatusChange(iEndpointStatusCallbackInfo);
+    if (r != KErrNone)
+        return r;
+    r = iController->RegisterForOtgFeatureChange(iOtgFeatureCallbackInfo);
+    if (r != KErrNone)
+        return r;
+
+    return r;
+    }
+// end DoCreate.
+
+
+//
+// HandleMsg
+//
+// Events from userside arrive here, and delegated to either DoRequest, DoControl or DoCancel.
+//
+
+void DLddUsbcScChannel::HandleMsg(TMessageBase* aMsg)
+    {
+    TThreadMessage& m = *(TThreadMessage*)aMsg;
+    TInt id = m.iValue;
+    __KTRACE_OPT(KUSB, Kern::Printf("HandleMsg 0x%x", id));
+
+    if (id == (TInt) ECloseMsg)
+        {
+        iChannelClosing = ETrue;
+        m.Complete(KErrNone, EFalse);
+        return;
+        }
+
+    TInt r;
+    if (id < 0)
+        {
+        // DoRequest
+        TRequestStatus* pS = (TRequestStatus*) m.Ptr0();
+        r = DoRequest(~id, pS, m.Ptr1(), m.Ptr2());
+        m.Complete(r, ETrue);
+        }
+    else if (id & RDevUsbcScClient::ERequestCancel)
+        {
+        // DoCancel
+        r = DoCancel(id, (TUint) m.Ptr0(), (TUint) m.Ptr1());
+        m.Complete(r, ETrue);
+    }
+    else
+        {
+        // DoControl
+        r = DoControl(id, m.Ptr0(), m.Ptr1());
+        m.Complete(r, ETrue);
+        }
+    }
+// end HandleMsg.
+
+
+#define BREAK_IF_NULL_ARG(a,r) if (a==NULL) { r = KErrArgument; __KTRACE_OPT(KUSB,Kern::Printf("NULL Argument")); break; }
+
+//
+// DoRequest - Asynchronous requests
+//
+// Overrides pure virtual, called by HandleMsg. (Above)
+//
+TInt DLddUsbcScChannel::DoRequest(TInt aReqNo, TRequestStatus* aStatus, TAny* a1, TAny* a2)
+    {
+    TInt reqNo = aReqNo & RDevUsbcScClient::KFieldIdMask;
+    TInt r = KErrNone;  // return via request notify
+    TBool needsCompletion =EFalse;
+
+    __KTRACE_OPT(KUSB, Kern::Printf("DoRequest 0x%08x", aReqNo));
+
+    if ((reqNo>RDevUsbcScClient::ERequestReadDataNotify) &&
+        (reqNo<RDevUsbcScClient::ERequestMaxRequests))
+        {
+        if (iRequestStatus[reqNo])
+            {
+            PanicClientThread(ERequestAlreadyPending);
+            return 0;
+            }
+        iRequestStatus[reqNo] = aStatus;
+        }
+
+    switch (reqNo)
+        {
+    case RDevUsbcScClient::ERequestWriteData:
+        {
+        TInt buffer =  (aReqNo>>RDevUsbcScClient::KFieldBuffPos)&RDevUsbcScClient::KFieldBuffMask;
+        __KTRACE_OPT(KUSB, Kern::Printf("ERequestWriteData"));
+        BREAK_IF_NULL_ARG(a2,r);
+
+        r = DoWriteData( aStatus, buffer, (TInt) a1 /*Start*/, (TInt) a2 /* Length */,
+                         aReqNo>>RDevUsbcScClient::KFieldFlagsPos ); // Flags
+        break;
+        }
+    case RDevUsbcScClient::ERequestReadDataNotify:
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("ERequestReadDataNotify"));
+        return DoReadDataNotify(aStatus, (TInt) a1, (TInt) a2); // a1 = aBufferNumber, a2 - aLength;
+        } 
+
+    case RDevUsbcScClient::ERequestAlternateDeviceStatusNotify:
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("ERequestAlternateDeviceStatusNotify"));
+        BREAK_IF_NULL_ARG(a1,r);
+        iDeviceStatusNeeded = ETrue;
+        iStatusChangePtr = a1;
+        needsCompletion = AlternateDeviceStateTestComplete();
+        break;
+        }
+    case RDevUsbcScClient::ERequestReEnumerate:
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("ERequestReEnumerate"));
+        // If successful, this will complete via the status notification.
+        r = iController->ReEnumerate();
+        break;
+        }
+    case RDevUsbcScClient::ERequestEndpointStatusNotify:
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("ERequestEndpointStatusNotify"));
+        BREAK_IF_NULL_ARG(a1,r);
+        
+        iEndpointStatusChangePtr = a1;
+        break;
+        }
+    case RDevUsbcScClient::ERequestOtgFeaturesNotify:
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("ERequestOtgFeaturesNotify"));
+        BREAK_IF_NULL_ARG(a1,r);
+            
+        iOtgFeatureChangePtr = a1;
+        break;
+        }
+    default:
+        r = KErrNotSupported;
+        }
+
+    if ((needsCompletion) || (r != KErrNone))
+        {
+        iRequestStatus[reqNo] = aStatus;
+        Kern::RequestComplete(iClient, iRequestStatus[reqNo], r);
+        }
+    return KErrNone;
+    }
+// end DoRequest.
+
+
+//
+// DoReadDataNotify
+//
+// This method sets up the request to facilitate the userside being notifed when new data has been read.
+//
+TInt DLddUsbcScChannel::DoReadDataNotify(TRequestStatus* aStatus, TInt aBufferNum, TInt aLength)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf(" DLddUsbcScChannel::DoReadDataNotify(x, %d, 0x%x)", aBufferNum, aLength));
+    TInt r = KErrNone;
+    // check range
+    if ((aBufferNum<0) ||  (aBufferNum>=iNumBuffers))  // Indirectly checks that we are set up.
+        {
+        if (aBufferNum!=KUsbcScEndpointZero)
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf(" DLddUsbcScChannel::DoReadDataNotify : Bad Buffer Number!"));
+            return KErrArgument;
+            }
+        else
+            {
+            aBufferNum = iEP0OutBuff;
+            }
+        }
+    else
+        {
+        // check direction
+        if (iBuffers[aBufferNum].iDirection!=KUsbcScOut)
+            {
+                __KTRACE_OPT(KUSB, Kern::Printf(" DLddUsbcScChannel::DoReadDataNotify : Bad Buffer Direction!"));
+            return KErrNotSupported;
+            }
+        if (!Configured())
+            return KErrUsbInterfaceNotReady;
+        }
+    SUsbcScBufferHeader* scBuffer = (SUsbcScBufferHeader*) iBuffers[aBufferNum].iBufferStart;
+
+    __KTRACE_OPT(KUSB, Kern::Printf(" DLddUsbcScChannel::DoReadDataNotify  head %x tail %x", iBuffers[aBufferNum].iHead , scBuffer->iTail ));
+
+    if (iBuffers[aBufferNum].iHead != scBuffer->iBilTail)
+        r = KErrCompletion;
+    else
+        if (iBuffers[aBufferNum].iStalled)
+            {
+            iBuffers[aBufferNum].PopStall();
+            return KErrCompletion;
+            }
+        else
+            r = iBuffers[aBufferNum].iStatusList.Add(aStatus, aLength, 0,0);
+
+    if (iBuffers[aBufferNum].iStatusList.iState==ENotRunning)
+        {
+        iBuffers[aBufferNum].StartDataRead();
+        }
+    else
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("Job in Progress!"));
+        }
+    return r;
+    }
+// end DoReadDataNotify.
+
+
+
+//
+// DoWriteData
+//
+// This method sets up the request to write data to USB from userside.
+//
+TInt DLddUsbcScChannel::DoWriteData(TRequestStatus* aStatus,TInt aBufferNum, TUint aStart, TUint aLength, TUint aFlags)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf(" DLddUsbcScChannel::DoWriteData(%d, 0x%x, 0x%x, 0x%x)",  aBufferNum, aStart, aLength, aFlags));
+    if (!iUserKnowsAltSetting)
+        return KErrEof;
+    // Check Buffer Number
+    if ((aBufferNum<0) ||  (aBufferNum>=iNumBuffers))
+        {
+        if ((TUint)aBufferNum!=RDevUsbcScClient::KFieldBuffMask)  // KUsbcScEndpointZero & KFieldBuffMas = KFieldBuffMas;
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf(" DLddUsbcScChannel::DoWriteData : Bad Buffer Number!"));
+            return KErrArgument;
+            }
+        else
+            {
+            aBufferNum = iEP0InBuff;
+            }
+        }
+    else
+        {
+        // check direction
+        if (iBuffers[aBufferNum].iDirection!=KUsbcScIn)
+            {
+                __KTRACE_OPT(KUSB, Kern::Printf(" DLddUsbcScChannel::DoWriteData Bad endpoint Direction"));
+                return KErrArgument;
+            }
+        }
+
+    TUsbcScBuffer& buf=iBuffers[aBufferNum];
+
+    if ((aStart< (((TLinAddr) buf.iBufferStart)-buf.iChunkAddr)) || ((aStart+aLength)>iBuffers[aBufferNum].iBufferEnd))
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf(" DLddUsbcScChannel::DoWriteData Bad Range aStart or aLength 0x%x > 0x%x + 0x%x < 0x%x", (((TLinAddr) buf.iBufferStart)-buf.iChunkAddr),aStart, aLength, iBuffers[aBufferNum].iBufferEnd ));
+        return KErrArgument;
+        }
+
+    if ( (aBufferNum != iEP0InBuff) && !Configured())
+        return KErrUsbInterfaceNotReady;
+
+    if (aStart & ~buf.iAlignMask)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::DoDataWrite: address 0x%x unaligned.",aStart));
+        return KErrArgument;
+        }
+            
+    TInt r = iBuffers[aBufferNum].iStatusList.Add(aStatus, aLength, aStart, aFlags); //update
+
+    if (iBuffers[aBufferNum].iStatusList.iState==ENotRunning)
+        {
+            iBuffers[aBufferNum].StartDataWrite();
+        }
+    else
+        {    
+        __KTRACE_OPT(KUSB, Kern::Printf("Job in Progress!"));
+        }
+
+
+    return r;
+    }
+// end DoWriteData.
+
+
+//
+// Cancel an outstanding request                        // Cancel need reworking.
+//
+TInt DLddUsbcScChannel::DoCancel(TInt aReqNo, TUint aBuff, TUint aSpair)
+    {
+    TInt r = KErrNone;
+    TInt direction=KUsbcScOut;
+
+    __KTRACE_OPT(KUSB, Kern::Printf("DoCancel: 0x%x aBuff 0x%x", aReqNo, aBuff));
+    switch (aReqNo)
+        {
+    case RDevUsbcScClient::ERequestCancel:
+        TInt buffer;
+        TInt mask;
+
+        for (buffer=1, mask=1; buffer<iNumBuffers; buffer++,mask<<=1)
+            if (aBuff&mask)
+                iBuffers[buffer].Cancel(KErrCancel);
+
+        return KErrNone;
+
+    // coverity[missing_break]
+    case RDevUsbcScClient::ERequestWriteDataCancel:
+        direction = KUsbcScIn;
+    case RDevUsbcScClient::ERequestReadDataNotifyCancel:
+        __KTRACE_OPT(KUSB, Kern::Printf("DoCancel Direction %d endpoints: 0x%x",direction, aReqNo));
+
+        if (((TInt)aBuff)==KUsbcScEndpointZero) // EP0 is bi-directional, so pick correct buffer for call type
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("DoCancel Cancel Endpoint 0/%d",direction));
+            iEp0Endpoint->AbortTransfer();
+            if (direction==KUsbcScIn)
+                aBuff=iEP0InBuff;
+            else
+                aBuff=iEP0OutBuff;
+            } 
+        else if ((TInt)aBuff >= iNumBuffers) // check buff no range.
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("DoCancel Error: Bad buffer number"));
+            return KErrArgument;
+            }
+
+        if ((iBuffers[aBuff].iDirection&1)!=direction) // Does direction match call type?
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("DoCancel Error: Bad buffer direction"));
+            return KErrArgument;
+            }    
+        iBuffers[aBuff].iStatusList.CancelQueued();
+        iBuffers[aBuff].Cancel(KErrCancel);
+        
+        return KErrNone;
+
+    case RDevUsbcScClient::ERequestAlternateDeviceStatusNotifyCancel:
+        __KTRACE_OPT(KUSB, Kern::Printf("DoCancel: ERequestAlternateDeviceStatusNotify 0x%x", aReqNo));
+        iDeviceStatusNeeded = EFalse;
+        iStatusFifo->FlushQueue();
+        if (iStatusChangePtr)
+            {
+            TInt deviceState = iController->GetDeviceStatus();
+            r = Kern::ThreadRawWrite(iClient, iStatusChangePtr, &deviceState, sizeof(deviceState), iClient);
+            if (r != KErrNone)
+                PanicClientThread(r);
+            iStatusChangePtr = NULL; 
+            }
+    break;
+
+    case RDevUsbcScClient::ERequestReEnumerateCancel:
+        __KTRACE_OPT(KUSB, Kern::Printf("DoCancel ERequestReEnumerate: 0x%x", aReqNo));
+    break;
+
+    case RDevUsbcScClient::ERequestEndpointStatusNotifyCancel:
+        __KTRACE_OPT(KUSB, Kern::Printf("DoCancel ERequestEndpointStatusNotify: 0x%x", aReqNo));
+        CancelNotifyEndpointStatus();
+    break;
+
+     case RDevUsbcScClient::ERequestOtgFeaturesNotifyCancel:
+        __KTRACE_OPT(KUSB, Kern::Printf("DoCancel ERequestOtgFeaturesNotify: 0x%x", aReqNo));
+        CancelNotifyOtgFeatures();
+    break;
+
+    default:
+        __KTRACE_OPT(KUSB, Kern::Printf("DoCancel Unknown! 0x%x", aReqNo));
+        return KErrArgument;
+        }
+
+    Kern::RequestComplete(iClient,iRequestStatus[aReqNo & ~RDevUsbcScClient::ERequestCancel], KErrCancel);
+    return r;
+    }
+
+
+void DLddUsbcScChannel::CancelNotifyEndpointStatus()
+    {
+    if (iEndpointStatusChangePtr)
+        {
+        TUint epBitmap = 0;
+        for (TInt i = 1; i <= iNumberOfEndpoints; i++)
+            {
+            TInt v = iController->GetEndpointStatus(this, iEndpoint[i]->RealEpNumber());
+            TUint b;
+            (v == EEndpointStateStalled) ? b = 1 : b = 0;
+            epBitmap |= b << i;
+            }
+        TInt r=Kern::ThreadRawWrite(iClient, iEndpointStatusChangePtr, (TUint8*) &epBitmap, sizeof(epBitmap), iClient);
+        if (r != KErrNone)
+            PanicClientThread(r);
+        iEndpointStatusChangePtr = NULL;
+        }
+    }
+
+void DLddUsbcScChannel::CancelNotifyOtgFeatures()
+    {
+    if (iOtgFeatureChangePtr)
+        {
+        TUint8 features;
+        iController->GetCurrentOtgFeatures(features);
+        TInt r=Kern::ThreadRawWrite(iClient, iOtgFeatureChangePtr, (TUint8*)&features, sizeof(features), iClient);
+        if (r != KErrNone)
+            PanicClientThread(r);
+        iOtgFeatureChangePtr = NULL;
+        }
+    }
+
+
+
+//
+// DoControl - Synchronous requests
+//
+// Called from HandleMsg.
+
+TInt DLddUsbcScChannel::DoControl(TInt aFunction, TAny* a1, TAny* a2)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DoControl: %d", aFunction));
+
+    TInt r = KErrNone;
+    TInt ep, param;
+    TUsbcScEndpoint* pEndpoint;
+    TPtrC8 pZeroDesc(NULL, 0);
+    TEndpointDescriptorInfo epInfo;
+    TUsbcScIfcInfo ifcInfo;
+    TCSDescriptorInfo desInfo;
+    TUsbcEndpointResource epRes;
+
+    switch (aFunction)
+        {
+    case RDevUsbcScClient::EControlEndpointZeroRequestError:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlEndpointZeroRequestError"));
+        r = KErrNone;
+        if (iOwnsDeviceControl || (iValidInterface && iDeviceState == UsbShai::EUsbPeripheralStateConfigured))
+            {
+            iController->Ep0Stall(this);
+            }
+        else
+            {
+            if (iDeviceState != UsbShai::EUsbPeripheralStateConfigured)
+                r = KErrUsbDeviceNotConfigured;
+            else
+                r = KErrUsbInterfaceNotReady;
+            }
+        break;
+
+    case RDevUsbcScClient::EControlGetAlternateSetting:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetAlternateSetting"));
+        if (iValidInterface && iDeviceState == UsbShai::EUsbPeripheralStateConfigured)
+            {
+            r = iController->GetInterfaceNumber(this, param);
+            if (r == KErrNone)
+                {
+                r = Kern::ThreadRawWrite(iClient, a1, &param, sizeof(param), iClient);
+                if (r != KErrNone)
+                    PanicClientThread(r);
+                }
+            }
+        else
+            {
+            if (iDeviceState != UsbShai::EUsbPeripheralStateConfigured)
+                r = KErrUsbDeviceNotConfigured;
+            else
+                r = KErrUsbInterfaceNotReady;
+            }
+        break;
+
+    case RDevUsbcScClient::EControlDeviceStatus:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlDeviceStatus"));
+        param = iController->GetDeviceStatus();
+        r = Kern::ThreadRawWrite(iClient, a1, &param, sizeof(param), iClient);
+        if (r != KErrNone)
+            PanicClientThread(r);
+        break;
+
+    case RDevUsbcScClient::EControlEndpointStatus:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlEndpointStatus"));
+        if (iValidInterface && ValidEndpoint((TInt) a1))
+            {
+            pEndpoint = iEndpoint[(TInt)a1];
+            if (pEndpoint == NULL)
+                r = KErrNotSupported;
+            else
+                {
+                param = iController->GetEndpointStatus(this, iEndpoint[(TInt)a1]->RealEpNumber());
+                r = Kern::ThreadRawWrite(iClient, a2, &param, sizeof(param), iClient);
+                if (r != KErrNone)
+                    PanicClientThread(r);
+                }
+            }
+        else
+            {
+            if (iDeviceState != UsbShai::EUsbPeripheralStateConfigured)
+                r = KErrUsbDeviceNotConfigured;
+            else
+                r = KErrUsbInterfaceNotReady;
+            }
+        break;
+
+    case RDevUsbcScClient::EControlEndpointCaps:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlEndpointCaps"));
+        r = Kern::ThreadDesWrite(iClient, a1, pZeroDesc, 0, 0, iClient);
+        if (r != KErrNone)
+            PanicClientThread(r);
+        iController->EndpointCaps(this, *((TDes8*) a1));
+        break;
+
+    case RDevUsbcScClient::EControlDeviceCaps:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlDeviceCaps"));
+        r = Kern::ThreadDesWrite(iClient, a1, pZeroDesc, 0, 0, iClient);
+        if (r != KErrNone)
+            PanicClientThread(r);
+        iController->DeviceCaps(this, *((TDes8*) a1));
+        break;
+
+    case RDevUsbcScClient::EControlSendEp0StatusPacket:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSendEp0StatusPacket"));
+        iController->SendEp0StatusPacket(this);
+        break;
+
+    case RDevUsbcScClient::EControlHaltEndpoint:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlHaltEndpoint"));
+        if (iValidInterface && ValidEndpoint((TInt) a1))
+            {
+            r = iController->HaltEndpoint(this, iEndpoint[(TInt)a1]->RealEpNumber());
+            }
+        else
+            {
+            if (iDeviceState != UsbShai::EUsbPeripheralStateConfigured)
+                r = KErrUsbDeviceNotConfigured;
+            else
+                r = KErrUsbInterfaceNotReady;
+            }
+        break;
+
+    case RDevUsbcScClient::EControlClearHaltEndpoint:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlClearHaltEndpoint"));
+        if (iValidInterface && ValidEndpoint((TInt) a1))
+            {
+            r = iController->ClearHaltEndpoint(this, iEndpoint[(TInt)a1]->RealEpNumber());
+            }
+        else
+            {
+            if (iDeviceState != UsbShai::EUsbPeripheralStateConfigured)
+                r = KErrUsbDeviceNotConfigured;
+            else
+                r = KErrUsbInterfaceNotReady;
+            }
+        break;
+
+    case RDevUsbcScClient::EControlDumpRegisters:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlDumpRegisters"));
+        iController->DumpRegisters();
+        break;
+
+    case RDevUsbcScClient::EControlReleaseDeviceControl:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlReleaseDeviceControl"));
+        iController->ReleaseDeviceControl(this);
+        iOwnsDeviceControl = EFalse;
+        break;
+
+    case RDevUsbcScClient::EControlEndpointZeroMaxPacketSizes:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlEndpointZeroMaxPacketSizes"));
+        r = iController->EndpointZeroMaxPacketSizes();
+        break;
+
+    case RDevUsbcScClient::EControlSetEndpointZeroMaxPacketSize:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetEndpointZeroMaxPacketSize"));
+        r = iController->SetEndpointZeroMaxPacketSize(reinterpret_cast<TInt>(a1));
+        break;
+
+    case RDevUsbcScClient::EControlGetEndpointZeroMaxPacketSize:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetEndpointZeroMaxPacketSize"));
+        r = iController->Ep0PacketSize();
+        break;
+
+    case RDevUsbcScClient::EControlGetDeviceDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetDeviceDescriptor"));
+        r = Kern::ThreadDesWrite(iClient, a1, pZeroDesc, 0, 0, iClient);
+        if (r != KErrNone)
+            PanicClientThread(r);
+        r = iController->GetDeviceDescriptor(iClient, *((TDes8*) a1));
+        break;
+
+    case RDevUsbcScClient::EControlSetDeviceDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetDeviceDescriptor"));
+        BREAK_IF_NULL_ARG(a1,r);
+        r = iController->SetDeviceDescriptor(iClient, *((TDes8*) a1));
+        break;
+
+    case RDevUsbcScClient::EControlGetDeviceDescriptorSize:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetDeviceDescriptorSize"));
+        BREAK_IF_NULL_ARG(a1,r);
+        r = iController->GetDeviceDescriptorSize(iClient, *((TDes8*) a1));
+        break;
+
+    case RDevUsbcScClient::EControlGetConfigurationDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetConfigurationDescriptor"));
+        r = Kern::ThreadDesWrite(iClient, a1, pZeroDesc, 0 , 0, iClient);
+        if (r != KErrNone)
+            PanicClientThread(r);
+        r = iController->GetConfigurationDescriptor(iClient, *((TDes8*) a1));
+        break;
+
+    case RDevUsbcScClient::EControlGetConfigurationDescriptorSize:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetConfigurationDescriptorSize"));
+        if (a1 != NULL)
+            {
+            r = iController->GetConfigurationDescriptorSize(iClient, *((TDes8*) a1));
+            }
+        else
+            r = KErrArgument;
+        break;
+
+    case RDevUsbcScClient::EControlSetConfigurationDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetConfigurationDescriptor"));
+        r = iController->SetConfigurationDescriptor(iClient, *((TDes8*) a1));
+        break;
+
+    case RDevUsbcScClient::EControlGetInterfaceDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetInterfaceDescriptor"));
+        r = iController->GetInterfaceDescriptor(iClient, this, (TInt) a1, *((TDes8*) a2));
+        break;
+
+    case RDevUsbcScClient::EControlGetInterfaceDescriptorSize:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetInterfaceDescriptorSize"));
+        r = iController->GetInterfaceDescriptorSize(iClient, this, (TInt) a1, *(TDes8*) a2);
+        break;
+
+    case RDevUsbcScClient::EControlSetInterfaceDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetInterfaceDescriptor"));
+        r = iController->SetInterfaceDescriptor(iClient, this, (TInt) a1, *((TDes8*) a2));
+        break;
+
+    case RDevUsbcScClient::EControlGetEndpointDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetEndpointDescriptor"));
+        r = Kern::ThreadRawRead(iClient, a1, &epInfo, sizeof(epInfo));
+        if (r != KErrNone)
+            PanicClientThread(r);
+        ep = EpFromAlternateSetting(epInfo.iSetting, epInfo.iEndpoint);
+        r = (ep<0)?ep:iController->GetEndpointDescriptor(iClient, this, epInfo.iSetting,
+                                               ep, *(TDes8*) epInfo.iArg);
+        break;
+
+    case RDevUsbcScClient::EControlGetEndpointDescriptorSize:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetEndpointDescriptorSize"));
+        r = Kern::ThreadRawRead(iClient, a1, &epInfo, sizeof(epInfo));
+        if (r != KErrNone)
+            PanicClientThread(r);
+        ep = EpFromAlternateSetting(epInfo.iSetting, epInfo.iEndpoint);
+        r = iController->GetEndpointDescriptorSize(iClient, this, epInfo.iSetting,
+                                                   ep, *(TDes8*) epInfo.iArg);
+        break;
+
+    case RDevUsbcScClient::EControlSetEndpointDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetEndpointDescriptor"));
+        r = Kern::ThreadRawRead(iClient, a1, &epInfo, sizeof(epInfo));
+        if (r != KErrNone)
+            PanicClientThread(r);
+        ep = EpFromAlternateSetting(epInfo.iSetting, epInfo.iEndpoint);
+        r = iController->SetEndpointDescriptor(iClient, this, epInfo.iSetting,
+                                               ep, *(TDes8*)epInfo.iArg);
+        break;
+
+    case RDevUsbcScClient::EControlGetDeviceQualifierDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetDeviceQualifierDescriptor"));
+        r = Kern::ThreadDesWrite(iClient, a1, pZeroDesc, 0, 0, iClient);
+        if (r != KErrNone)
+            PanicClientThread(r);
+        r = iController->GetDeviceQualifierDescriptor(iClient, *((TDes8*) a1));
+        break;
+
+    case RDevUsbcScClient::EControlSetDeviceQualifierDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetDeviceQualifierDescriptor"));
+        BREAK_IF_NULL_ARG(a1,r);
+        r = iController->SetDeviceQualifierDescriptor(iClient, *((TDes8*) a1));
+        break;
+
+    case RDevUsbcScClient::EControlGetOtherSpeedConfigurationDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetOtherSpeedConfigurationDescriptor"));
+        r = Kern::ThreadDesWrite(iClient, a1, pZeroDesc, 0 , 0, iClient);
+        if (r != KErrNone)
+            PanicClientThread(r);
+        r = iController->GetOtherSpeedConfigurationDescriptor(iClient, *((TDes8*) a1));
+        break;
+
+    case RDevUsbcScClient::EControlSetOtherSpeedConfigurationDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetOtherSpeedConfigurationDescriptor"));
+        r = iController->SetOtherSpeedConfigurationDescriptor(iClient, *((TDes8*) a1));
+        break;
+
+
+    case RDevUsbcScClient::EControlGetCSInterfaceDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetCSInterfaceDescriptor"));
+        r = iController->GetCSInterfaceDescriptorBlock(iClient, this, (TInt) a1, *((TDes8*) a2));
+        break;
+
+    case RDevUsbcScClient::EControlGetCSInterfaceDescriptorSize:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetCSInterfaceDescriptorSize"));
+        r = iController->GetCSInterfaceDescriptorBlockSize(iClient, this, (TInt) a1, *(TDes8*) a2);
+        break;
+
+    case RDevUsbcScClient::EControlGetCSEndpointDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetCSEndpointDescriptor"));
+        r = Kern::ThreadRawRead(iClient, a1, &epInfo, sizeof(epInfo));
+        if (r != KErrNone)
+            PanicClientThread(r);
+        ep = EpFromAlternateSetting(epInfo.iSetting, epInfo.iEndpoint);
+        r = iController->GetCSEndpointDescriptorBlock(iClient, this, epInfo.iSetting,
+                                                      ep, *(TDes8*) epInfo.iArg);
+        break;
+
+    case RDevUsbcScClient::EControlGetCSEndpointDescriptorSize:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetCSEndpointDescriptorSize"));
+        r = Kern::ThreadRawRead(iClient, a1, &epInfo, sizeof(epInfo));
+        if (r != KErrNone)
+            PanicClientThread(r);
+        ep = EpFromAlternateSetting(epInfo.iSetting, epInfo.iEndpoint);
+        r = iController->GetCSEndpointDescriptorBlockSize(iClient, this, epInfo.iSetting,
+                                                          ep, *(TDes8*) epInfo.iArg);
+        break;
+
+    case RDevUsbcScClient::EControlSignalRemoteWakeup:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSignalRemoteWakeup"));
+        r = iController->SignalRemoteWakeup();
+        break;
+
+    case RDevUsbcScClient::EControlDeviceDisconnectFromHost:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlDeviceDisconnectFromHost"));
+        r = iController->UsbDisconnect();
+        break;
+
+    case RDevUsbcScClient::EControlDeviceConnectToHost:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlDeviceConnectToHost"));
+        r = iController->UsbConnect();
+        break;
+
+    case RDevUsbcScClient::EControlDevicePowerUpUdc:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlDevicePowerUpUdc"));
+        r = iController->PowerUpUdc();
+        break;
+
+    case RDevUsbcScClient::EControlSetDeviceControl:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetDeviceControl"));
+        r = iController->SetDeviceControl(this);
+        if (r == KErrNone)
+            {
+            iOwnsDeviceControl = ETrue;
+            if (iEp0Endpoint == NULL)
+                {
+                __KTRACE_OPT(KUSB, Kern::Printf("EControlSetDeviceControl"));
+                r = SetupEp0();
+                if (r != KErrNone)
+                    {
+                    __KTRACE_OPT(KPANIC, Kern::Printf("  Error: SetupEp0() failed"));
+                    iController->ReleaseDeviceControl(this);
+                    iOwnsDeviceControl=EFalse;
+                    DestroyEp0();
+                    }
+                }
+            }
+        else
+            r = KErrInUse;
+        break;
+
+    case RDevUsbcScClient::EControlCurrentlyUsingHighSpeed:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlCurrentlyUsingHighSpeed"));
+        r = iController->CurrentlyUsingHighSpeed();
+        break;
+
+    case RDevUsbcScClient::EControlSetInterface:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetInterface"));
+        r = Kern::ThreadRawRead(iClient, a2, &ifcInfo, sizeof(ifcInfo));
+        if (r != KErrNone)
+            PanicClientThread(r);
+        r = SetInterface((TInt) a1, &ifcInfo);
+        break;
+
+    case RDevUsbcScClient::EControlReleaseInterface: 
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlReleaseInterface"));
+        if (!iRealizeCalled)
+            {
+            r = iController->ReleaseInterface(this, (TInt) a1);
+            if (r == KErrNone)
+                {
+                DestroyInterface((TUint) a1);
+                }
+            else
+                {
+                __KTRACE_OPT(KPANIC, Kern::Printf("  Error in PIL: LDD interface won't be released."));
+                }
+            }
+        else
+            r = KErrUsbAlreadyRealized;
+        break;
+
+    case RDevUsbcScClient::EControlSetCSInterfaceDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetCSInterfaceDescriptor"));
+        r = Kern::ThreadRawRead(iClient, a1, &desInfo, sizeof(desInfo));
+        if (r != KErrNone)
+            PanicClientThread(r);
+        r = iController->SetCSInterfaceDescriptorBlock(iClient, this, desInfo.iSetting,
+                                                       *reinterpret_cast<const TDes8*>(desInfo.iArg),
+                                                       desInfo.iSize);
+        break;
+
+    case RDevUsbcScClient::EControlSetCSEndpointDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetCSEndpointDescriptor"));
+        r = Kern::ThreadRawRead(iClient, a1, &desInfo, sizeof(desInfo));
+        if (r != KErrNone)
+            PanicClientThread(r);
+        ep = EpFromAlternateSetting(desInfo.iSetting, desInfo.iEndpoint);
+        r = iController->SetCSEndpointDescriptorBlock(iClient, this, desInfo.iSetting, ep,
+                                                      *reinterpret_cast<const TDes8*>(desInfo.iArg),
+                                                      desInfo.iSize);
+        break;
+
+    case RDevUsbcScClient::EControlGetStringDescriptorLangId:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetStringDescriptorLangId"));
+        r = iController->GetStringDescriptorLangId(iClient, *((TDes8*) a1));
+        break;
+
+    case RDevUsbcScClient::EControlSetStringDescriptorLangId:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetStringDescriptorLangId"));
+        r = iController->SetStringDescriptorLangId(reinterpret_cast<TUint>(a1));
+        break;
+
+    case RDevUsbcScClient::EControlGetManufacturerStringDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetManufacturerStringDescriptor"));
+        r = iController->GetManufacturerStringDescriptor(iClient, *((TPtr8*) a1));
+        break;
+
+    case RDevUsbcScClient::EControlSetManufacturerStringDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetManufacturerStringDescriptor"));
+        r = iController->SetManufacturerStringDescriptor(iClient, *((TPtr8*) a1));
+        break;
+
+    case RDevUsbcScClient::EControlRemoveManufacturerStringDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlRemoveManufacturerStringDescriptor"));
+        r = iController->RemoveManufacturerStringDescriptor();
+        break;
+
+    case RDevUsbcScClient::EControlGetProductStringDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetProductStringDescriptor"));
+        r = iController->GetProductStringDescriptor(iClient, *((TPtr8*) a1));
+        break;
+
+    case RDevUsbcScClient::EControlSetProductStringDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetProductStringDescriptor"));
+        r = iController->SetProductStringDescriptor(iClient, *((TPtr8*) a1));
+        break;
+
+    case RDevUsbcScClient::EControlRemoveProductStringDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlRemoveProductStringDescriptor"));
+        r = iController->RemoveProductStringDescriptor();
+        break;
+
+    case RDevUsbcScClient::EControlGetSerialNumberStringDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetSerialNumberStringDescriptor"));
+        r = iController->GetSerialNumberStringDescriptor(iClient, *((TPtr8*) a1));
+        break;
+
+    case RDevUsbcScClient::EControlSetSerialNumberStringDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetSerialNumberStringDescriptor"));
+        r = iController->SetSerialNumberStringDescriptor(iClient, *((TPtr8*) a1));
+        break;
+
+    case RDevUsbcScClient::EControlRemoveSerialNumberStringDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlRemoveSerialNumberStringDescriptor"));
+        r = iController->RemoveSerialNumberStringDescriptor();
+        break;
+
+    case RDevUsbcScClient::EControlGetConfigurationStringDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetConfigurationStringDescriptor"));
+        r = iController->GetConfigurationStringDescriptor(iClient, *((TPtr8*) a1));
+        break;
+
+    case RDevUsbcScClient::EControlSetConfigurationStringDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetConfigurationStringDescriptor"));
+        r = iController->SetConfigurationStringDescriptor(iClient, *((TPtr8*) a1));
+        break;
+
+    case RDevUsbcScClient::EControlRemoveConfigurationStringDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlRemoveConfigurationStringDescriptor"));
+        r = iController->RemoveConfigurationStringDescriptor();
+        break;
+
+    case RDevUsbcScClient::EControlGetStringDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetStringDescriptor"));
+        r = iController->GetStringDescriptor(iClient, (TUint8) (TInt) a1, *((TPtr8*) a2));
+        break;
+
+    case RDevUsbcScClient::EControlSetStringDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetStringDescriptor"));
+        r = iController->SetStringDescriptor(iClient, (TUint8) (TInt) a1, *((TPtr8*) a2));
+        break;
+
+    case RDevUsbcScClient::EControlRemoveStringDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlRemoveStringDescriptor"));
+        r = iController->RemoveStringDescriptor((TUint8) (TInt) a1);
+        break;
+
+    case RDevUsbcScClient::EControlQueryEndpointResourceUse:
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlQueryEndpointResourceUse"));
+        epRes = (TUsbcEndpointResource)((TInt) a2);
+        TInt realEp=-1;
+        r = GetRealEpForEpResource((TInt)a1, realEp);
+        if (r==KErrNone)
+            r = iController->QueryEndpointResource(this, realEp, epRes);
+        break;
+        }
+    case RDevUsbcScClient::EControlSetOtgDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlSetOtgDescriptor"));
+        r = iController->SetOtgDescriptor(iClient, *((const TDesC8*)a1));
+        break;
+
+    case RDevUsbcScClient::EControlGetOtgDescriptor:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetOtgDescriptor"));
+        r = iController->GetOtgDescriptor(iClient, *((TDes8*)a1));
+        break;
+
+    case RDevUsbcScClient::EControlGetOtgFeatures:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlGetOtgFeatures"));
+        r = iController->GetOtgFeatures(iClient, *((TDes8*)a1));
+        break;
+
+    case RDevUsbcScClient::EControlRealizeInterface:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlRealizeInterface"));
+        r = RealizeInterface();
+        break;
+    case RDevUsbcScClient::EControlStartNextInAlternateSetting:
+        __KTRACE_OPT(KUSB, Kern::Printf("EControlStartNextInAlternateSetting"));
+        r = StartNextInAlternateSetting();
+        break;
+
+    default:
+        __KTRACE_OPT(KUSB, Kern::Printf("Function code not supported"));
+        r = KErrNotSupported;
+        }
+
+    return r;
+    }
+// end DoControl.
+
+
+
+//
+// Overriding DObject virtual
+//
+TInt DLddUsbcScChannel::RequestUserHandle(DThread* aThread, TOwnerType /*aType*/)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcScChannel::RequestUserHandle"));
+    // The USB client LDD is not designed for a channel to be shared between
+    // threads. It saves a pointer to the current thread when it is opened, and
+    // uses this to complete any asynchronous requests.
+    // It is therefore not acceptable for the handle to be duplicated and used
+    // by another thread:
+    if (aThread == iClient)
+        {
+        return KErrNone;
+        }
+    else
+        {
+        return KErrAccessDenied;
+        }
+    }
+
+inline TInt DLddUsbcScChannel::GetRealEpForEpResource(TInt aEndpoint, TInt& aRealEp)
+    {
+    if (iEndpoint) // if we've enumerated at least once, proceed as normal.
+        {
+        if  (aEndpoint <= iNumberOfEndpoints && aEndpoint >= 0)
+            {
+            aRealEp=iEndpoint[aEndpoint]->RealEpNumber();
+            return KErrNone;
+            }
+        }
+    else // Assume alternate setting 0.
+        {
+        if (iAlternateSettingList)   // Check it has been set up.
+            {
+            TUsbcScAlternateSetting* alt = iAlternateSettingList->iHead;
+            if (alt &&  (aEndpoint <= alt->iNumberOfEndpoints && aEndpoint >= 0))
+                {
+                aRealEp= alt->iEndpoint[aEndpoint]->RealEpNumber();
+                return KErrNone;
+                }
+            }
+        }
+    return KErrUsbDeviceNotConfigured;
+    }
+
+
+TUsbcEndpointInfoArray::TUsbcEndpointInfoArray(const TUsbcScEndpointInfo* aData, TInt aDataSize)
+    {
+    iType = EUsbcScEndpointInfo;
+    iData = (TUint8*) aData;    
+    if (aDataSize>0)
+        iDataSize = aDataSize;
+    else
+        iDataSize = sizeof(TUsbcScEndpointInfo);
+    }
+
+
+//
+// SetInterface
+//
+// Called from DoControl.  Sets the configuration of a given Interface.                    // Needs changing
+// All interfaces must be configured before one can be used.  
+//
+
+TInt DLddUsbcScChannel::SetInterface(TInt aInterfaceNumber, TUsbcScIfcInfo* aInfoBuf)
+    {
+    // Copy interface description.
+
+    if (iRealizeCalled)
+        return KErrUsbAlreadyRealized;
+
+    if (!iAlternateSettingList)
+        {
+        iAlternateSettingList = new TUsbcScAlternateSettingList;
+        if (iAlternateSettingList==NULL)
+            {
+            return KErrNoMemory;
+            }
+        }
+
+    // Read descriptor in
+    TUsbcScInterfaceInfoBuf ifc_info_buf;
+    TUsbcScInterfaceInfoBuf* const ifc_info_buf_ptr = aInfoBuf->iInterfaceData;
+    const TInt srcLen = Kern::ThreadGetDesLength(iClient, ifc_info_buf_ptr);
+
+    __KTRACE_OPT(KUSB, Kern::Printf("SetInterface srcLen = %d len = %d", srcLen, ifc_info_buf.Length() ));
+
+    if (srcLen < ifc_info_buf.Length())
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("SetInterface can't copy"));
+        PanicClientThread(EDesOverflow);
+        }
+
+    TInt r = Kern::ThreadDesRead(iClient, ifc_info_buf_ptr, ifc_info_buf, 0, KChunkShiftBy0);
+    if (r != KErrNone)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("SetInterface Copy failed reason=%d", r));
+        PanicClientThread(r);
+        }
+
+    // The list of endpoints is within the interface info.
+    TUsbcScEndpointInfo* pEndpointData = ifc_info_buf().iEndpointData;
+
+    const TInt num_endpoints = ifc_info_buf().iTotalEndpointsUsed;
+    __KTRACE_OPT(KUSB, Kern::Printf("SetInterface num_endpoints=%d", num_endpoints));
+    if (num_endpoints>KMaxEndpointsPerClient)
+        return KErrOverflow;
+
+
+    // Initialize real ep numbers list.
+    TInt i;
+    TInt real_ep_numbers[KMaxEndpointsPerClient+1]; // range 1->KMaxEndpointsPerClient (0 not used)
+    for (i=0; i<=KMaxEndpointsPerClient; i++)
+        real_ep_numbers[i] = -1;
+
+
+    // See if PIL will accept this interface
+    __KTRACE_OPT(KUSB, Kern::Printf("SetInterface Calling controller"));
+    TUsbcEndpointInfoArray endpointData = TUsbcEndpointInfoArray(ifc_info_buf().iEndpointData);
+
+    r = iController->SetInterface(this,
+                                  iClient,
+                                  aInterfaceNumber,
+                                  ifc_info_buf().iClass,
+                                  aInfoBuf->iString,
+                                  (TInt) ifc_info_buf().iTotalEndpointsUsed,
+                                  endpointData,
+                                  &real_ep_numbers[0],
+                                  ifc_info_buf().iFeatureWord);
+
+    __KTRACE_OPT(KUSB, Kern::Printf("SetInterface controller returned %d", r));
+    if (r != KErrNone)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("SetInterface failed reason=%d", r));
+        return r;
+        }
+
+    // create alternate setting record
+    TUsbcScAlternateSetting* alternateSettingListRec = new TUsbcScAlternateSetting;
+    if (!alternateSettingListRec)
+        {
+        r = KErrNoMemory;
+        goto ReleaseInterface;
+        }
+    
+    // other endpoints
+    for (TInt i = 1; i <= num_endpoints; i++, pEndpointData++)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("SetInterface for ep=%d", i));
+
+        if ((pEndpointData->iType==UsbShai::KUsbEpTypeControl)
+            || (pEndpointData->iDir != UsbShai::KUsbEpDirIn && pEndpointData->iDir != UsbShai::KUsbEpDirOut)
+            || (pEndpointData->iSize > 1024) || (pEndpointData->iSize<=0))
+            {
+            r = KErrUsbBadEndpoint;
+            goto CleanUp;
+            }
+        // Check data
+
+        TUint* bufferSize = &(pEndpointData->iBufferSize);
+        if (*bufferSize==0)
+            *bufferSize= KUsbcScDefaultBufferSize;
+
+        TInt pageSize = Kern::RoundToPageSize(1);
+        // Round buffersize up to nearest pagesize.
+        *bufferSize = (*bufferSize+pageSize-1) & ~(pageSize-1);
+
+        TUsbcScEndpoint* ep = new TUsbcScEndpoint(this, iController, pEndpointData, i);
+        alternateSettingListRec->iEndpoint[i] = ep;
+        if (!ep)
+            {
+            r = KErrNoMemory;
+            goto CleanUp;
+            }
+        if (ep->Construct() != KErrNone)
+            {
+            r = KErrNoMemory;
+            goto CleanUp;
+            }
+
+    
+        __KTRACE_OPT(KUSB, Kern::Printf("SetInterface for ep=%d rec=0x%08x ep==0x%08x",
+                                        i, alternateSettingListRec, ep));
+        }
+
+    if (iAlternateSettingList->iHead)
+        {
+        iAlternateSettingList->iTail->iNext = alternateSettingListRec;
+        alternateSettingListRec->iPrevious = iAlternateSettingList->iTail;
+        iAlternateSettingList->iTail = alternateSettingListRec;    
+        }
+    else
+        {
+        iAlternateSettingList->iHead = alternateSettingListRec;    
+        iAlternateSettingList->iTail = alternateSettingListRec;    
+        }    
+    
+    alternateSettingListRec->iNext = NULL;
+    alternateSettingListRec->iSetting = aInterfaceNumber;
+    alternateSettingListRec->iNumberOfEndpoints = num_endpoints;
+
+    // Record the 'real' endpoint number used by the PDD in both the Ep and
+    // the Req callback:
+    for (TInt i = 1; i <= num_endpoints; i++)
+        {
+        alternateSettingListRec->iEndpoint[i]->SetRealEpNumber(real_ep_numbers[i]);
+        }
+
+    return KErrNone;
+
+ CleanUp:
+    delete alternateSettingListRec;
+    //Fall Through
+
+ ReleaseInterface:
+#if _DEBUG
+    TInt r1 = iController->ReleaseInterface(this, aInterfaceNumber);
+    __KTRACE_OPT(KUSB, Kern::Printf("Release Interface controller returned %d", r1));
+#else
+    (void)    iController->ReleaseInterface(this, aInterfaceNumber);
+#endif
+    return r;
+    }
+// end SetInterface
+
+
+
+#ifdef _DEBUG
+void RealizeInterface_Dump(TUint* aMem)
+    {
+    TUint *mem= NULL;
+    __KTRACE_OPT(KUSB, mem = aMem);
+    if (mem!=NULL)
+        {
+        TInt j;
+         Kern::Printf("Final chunk header State:");
+        for (j=0; j<30; j+=8)
+             Kern::Printf("%2x: %8x %8x %8x %8x %8x %8x %8x %8x", j, mem[j], mem[j+1], mem[j+2], mem[j+3], mem[j+4], mem[j+5], mem[j+6], mem[j+7] );
+        };
+    };
+#endif
+
+
+/*
+Chunk Created, filled with structure, and passed back to userside.
+*/
+TInt DLddUsbcScChannel::RealizeInterface(void)
+{
+    if (iRealizeCalled) 
+        return KErrUsbAlreadyRealized;
+
+    TRealizeInfo bufInfo;
+    
+    TInt errorOrChunk = KErrNone;
+    TBool openedCS = EFalse;
+    TInt offset =0;
+        
+    // Start by creating a temporary scratchpad for endpoint calculations.
+    bufInfo.Init(iAlternateSettingList);
+
+    // Fill in our scratchpad with all the required endpoints, sorting them
+    // in order of size required.
+    errorOrChunk = bufInfo.CopyAndSortEndpoints();
+    if (errorOrChunk!=KErrNone)
+        {
+        goto realize_end;
+        }
+
+    // We now have endpoints sorted in order of size for each altsetting.
+    // The very largest for each endpoint will share the first buffer, and all of
+    // the second largest ends points will share the second buffer, and so on.
+    // Find the highest buffer size for each row, to determine the buffer size,
+    // and keep a total of total space needed. 
+    bufInfo.CalcBuffSizes();
+
+    // We now have the max sizes wanted for each endpoint buffer.
+    // we also have to total size for all endpoints.
+    // and finally we have the total number of buffers.
+
+    // Add on size for header, then add on size for guard pages.
+    bufInfo.iTotalSize+= KHeaderSize + bufInfo.iTotalBuffers * KGuardSize;
+
+    // Create shared Chunk .  .  .  .  .  .  .  .  .  . 
+    if (iChunkInfo==NULL)
+        {
+            NKern::ThreadEnterCS();
+            openedCS = ETrue;
+            errorOrChunk = TUsbcScChunkInfo::New(iChunkInfo, bufInfo.iTotalSize, (DLogicalDevice*) iDevice);
+            if (errorOrChunk!=KErrNone)
+                {
+                goto realize_end;
+                }
+        }
+    else
+        {
+        // As of writing, the was no way for iChunk to be anything other then NULL.  
+        // You cannot 'unrealise' and iChunk cannot be set any other way.
+        Kern::Fault("DLddUsbcScChannel::RealizeInterface", __LINE__);
+        }
+
+    // Populate the shared chunk . .  . . . . . 
+
+
+    // First create chunk header.
+    errorOrChunk = iChunkInfo->ChunkAlloc(offset, KHeaderSize);
+    if (errorOrChunk!=KErrNone)
+        {
+        if (errorOrChunk==-KErrNoMemory)
+            errorOrChunk=KErrNoMemory;
+        goto realize_end;
+        } 
+
+
+    offset+=KHeaderSize + KGuardSize; // Also any more for EP0?
+
+    // Next, lay out the geometry of the chunk header.
+
+    bufInfo.LayoutChunkHeader(iChunkInfo);        
+
+
+    { // Scope ep0Size
+    TInt ep0Size=0;
+    
+    // Create K-side buffer table
+    if (!iBuffers)
+        iBuffers = (TUsbcScBuffer *) Kern::AllocZ(sizeof(TUsbcScBuffer) * (bufInfo.iTotalBuffers+2)); // +2 is for ep0.
+    if (!iBuffers)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("Realize: Error: Alloc iBufers failed!"));
+        errorOrChunk = KErrNoMemory;
+        goto realize_end;
+        }
+
+
+    errorOrChunk = SetupEp0();
+    if (errorOrChunk)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("Realize: SetupEp0 . ERROR %d",errorOrChunk));
+        goto realize_end;
+        }
+
+    ep0Size = iEp0Endpoint->EndpointInfo()->iSize;
+    __KTRACE_OPT(KUSB, Kern::Printf("Realize: Setup EP0. max packet size %d", ep0Size));
+
+    // Create EP0 buffers
+    iEP0OutBuff=bufInfo.iTotalBuffers;
+    errorOrChunk = iBuffers[iEP0OutBuff].Construct(KUsbcScBiOut,  this,   KUsbScEP0OutBufPos, KUsbScEP0OutBufEnd, ep0Size, ep0Size, ep0Size);
+    if (errorOrChunk)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("Realize: Setup EP0 Out. ERROR %d",errorOrChunk));
+        goto realize_end;
+        }
+
+    iBuffers[iEP0OutBuff].CreateChunkBufferHeader();
+    iBuffers[iEP0OutBuff].iCallback =  iEp0Endpoint->iRequestCallbackInfo;
+    ((TUsbcScBufferRecord*) &(
+                            bufInfo.iChunkStuct->iBufferOffset[KUsbcScEp0OutBuff*sizeof(TUsbcScBufferRecord)]
+                            )) ->Set(KUsbScEP0OutBufPos, KUsbScEP0OutBufEnd);
+
+
+    iEP0InBuff=bufInfo.iTotalBuffers+1;
+    errorOrChunk = iBuffers[iEP0InBuff].Construct( KUsbcScBiIn ,  this,   KUsbScEP0InBufPos , KUsbScEP0InBufEnd , ep0Size, ep0Size, ep0Size);    
+    if (errorOrChunk)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("Realize: Setup EP0 In. ERROR %d",errorOrChunk));
+        goto realize_end;
+        }
+    
+    iBuffers[iEP0InBuff].iCallback =  iEp0Endpoint->iRequestCallbackInfo;
+
+      ((TUsbcScBufferRecord*) &(
+                                  bufInfo.iChunkStuct->iBufferOffset[KUsbcScEp0InBuff*sizeof(TUsbcScBufferRecord)]
+                                ))->Set(KUsbScEP0InBufPos, KUsbScEP0InBufEnd);
+
+
+    } // end ep0Size scope
+
+    // Create resources and tables.  .   .   .   .   .
+    __KTRACE_OPT(KUSB, Kern::Printf("Realize: Create resources tables"));
+
+    { // scope of bufNum
+    // For each EP buffer
+    TInt buffNum=0;
+    TInt buffMinSize;
+    TInt endpointNumber;
+    TUsbcScEndpoint* endpointRecord;
+    TInt endpoint;
+    TInt inout;
+    TEndpointSortBufs* bufsd;
+    TUsbcScHdrEndpointRecord* epRecord;
+    for (endpoint=0; endpoint<bufInfo.iMaxEndpoints; endpoint++)  // endpoint = buf row.
+        {
+        for (inout=KUsbcScIn; inout<KUsbcScDirections; inout++)
+            {
+            buffMinSize = KUsbSc_BigBuff_MinimumRamRun;
+
+            TInt needed =  bufInfo.iBufs[inout].iSizes[endpoint];
+            if (needed) 
+                {
+                TInt bufStart = offset;
+
+                __KTRACE_OPT(KUSB, Kern::Printf("Realize:    buf row:%d inout %d, iBufferOffset[%d+2]=%x",endpoint, inout, buffNum, bufStart));
+
+                bufsd =  &(bufInfo.iBufs[inout]);
+                // and then point all endpoints that use it, towards it.
+                TInt altSetting;    
+                TUint maxReadSize = ~0;
+                for (altSetting=0; altSetting < bufInfo.iAltSettings; altSetting++)
+                    {
+                    endpointRecord =bufsd->iEp[altSetting*bufInfo.iMaxEndpoints + endpoint];
+                    if (endpointRecord)
+                        {
+                        endpointNumber = endpointRecord->EpNumber();
+                        endpointRecord->SetBuffer(&iBuffers[buffNum]);
+                
+                        epRecord = (TUsbcScHdrEndpointRecord*) &iChunkInfo->iChunkMem[
+                                                                (bufInfo.iAltSettingsTbl->iAltTableOffset[altSetting])     // i.e. Just after altSettingsTbl
+                                                                +sizeof(TInt)                                    // after number of endpoints field
+                                                                +(endpointNumber-1)*sizeof(TUsbcScHdrEndpointRecord)
+                                                                ];
+                        epRecord->iBufferNo = (TUint8) buffNum;
+
+                    TInt epType=(endpointRecord->EndpointInfo()->iType);
+                    epType= (epType& UsbShai::KUsbEpTypeControl)?KUsbScHdrEpTypeControl:
+                            (epType& UsbShai::KUsbEpTypeIsochronous)?KUsbScHdrEpTypeIsochronous:
+                            (epType& UsbShai::KUsbEpTypeBulk)?KUsbScHdrEpTypeBulk:
+                            (epType& UsbShai::KUsbEpTypeInterrupt)?KUsbScHdrEpTypeInterrupt:KUsbScHdrEpTypeUnknown;
+
+                    epRecord->iType = (inout+1) | (epType<<2);
+
+                    if (endpointRecord->EndpointInfo()->iReadSize)
+                        maxReadSize = (maxReadSize <= endpointRecord->EndpointInfo()->iReadSize) ? maxReadSize : endpointRecord->EndpointInfo()->iReadSize;
+                    
+                    __KTRACE_OPT(KUSB, Kern::Printf("Realize:      endpointNum %d in altSetting %d, alt table @ %d",
+                                                     endpointNumber, altSetting,bufInfo.iAltSettingsTbl->iAltTableOffset[altSetting]));
+                        }
+                    else
+                        {
+                        __KTRACE_OPT(KUSB, Kern::Printf("Realize:      endpointNum NA in altSetting %d", altSetting));
+                        }
+
+                    } // end for
+
+
+                // Alloc memory for buffer.
+                TInt grabSize = needed;
+                // Generally, a buffer fragmented into smaller memory regions will reduce the efficiency 
+                // of reading or writing data, and so avoiding the allocation of very small sections
+                // is advantageous.
+                // However, if only a small amount is being allocated to start with, it is likely
+                // smaller amounts of data are to be sent (reducing this advantage), and 1 memory page 
+                // is a much bigger proportion of the buffer, and so more worth allocating individually.
+
+                TInt minimumGrab;
+                if (needed<KUsbScBigBuffIs)
+                    {
+                    minimumGrab=Kern::RoundToPageSize(1);
+                    buffMinSize = KUsbSc_SmallBuff_MinimumRamRun; // 1k
+                    }
+                else
+                    {
+                    minimumGrab = buffMinSize+Kern::RoundToPageSize(1);
+                    }
+
+                // Grab required memory, in bits as big as possible, down to the minimum size. 
+                while (needed >= minimumGrab)
+                    {
+                    TInt r;
+                    r = iChunkInfo->ChunkAlloc(offset, grabSize);
+                    if (r==KErrNone)
+                        {
+                        offset+=grabSize;    
+                        needed-=grabSize;
+                        }
+                    else
+                        {
+                        if (r==-KErrNoMemory)
+                            {
+                            grabSize>>=1;
+                            }
+                        if ((grabSize<minimumGrab) || (r!=-KErrNoMemory))
+                            {
+                            errorOrChunk = r;
+                            goto realize_end;
+                            }
+                        }
+                    } // end while needed
+                
+                // Initialize buffer
+                iBuffers[buffNum].Construct(inout,  this,   bufStart, offset, buffMinSize, 0, maxReadSize);
+                iBuffers[buffNum].CreateChunkBufferHeader();
+                ((TUsbcScBufferRecord*) &(
+                                        bufInfo.iChunkStuct->iBufferOffset[(buffNum+2)*sizeof(TUsbcScBufferRecord)]
+                                        ))->Set(bufStart, offset);
+
+
+                // inc pointers for next buffer
+                buffNum++;
+                offset+=KGuardSize;
+                } // end if needed
+
+            } // end for inout
+        } // end for each buffer
+    } // scope of bufNum 
+
+#ifdef _DEBUG
+ RealizeInterface_Dump((TUint*) iChunkInfo->iChunkMem); // Debug only tracing
+#endif
+
+realize_end:
+    __KTRACE_OPT(KUSB, Kern::Printf("Realize: cleanup.  Err=%d", errorOrChunk));
+    // Here we clean up after either success, or after bailing out early.
+
+    bufInfo.Free();
+    
+    if (iChunkInfo)
+        {
+        if (errorOrChunk==KErrNone)
+            { 
+            // Everything is looking good - create RChunk for Userside.
+            errorOrChunk = Kern::MakeHandleAndOpen(iClient, iChunkInfo->iChunk);
+            iRealizeCalled = (errorOrChunk>=0);
+            } // endif errorOrChunk
+
+        if (errorOrChunk<0)  // If error, destroy the chunk.
+            {
+            iChunkInfo->Close();
+            // ChunkInfo will delete itself with DFC, but the pointer here is no longer needed.
+            iChunkInfo=NULL;
+
+            // Destroy iBuffers
+            if (iBuffers)
+                {
+                TInt i;
+                for (i=0; i<(iNumBuffers+2); i++) 
+                    {
+                    iBuffers[i].iStatusList.Destroy();
+                    }
+                Kern::Free(iBuffers);
+                iBuffers=NULL;
+                }
+
+            }
+        else
+            {
+            iNumBuffers = bufInfo.iTotalBuffers;
+            iValidInterface = ETrue;  // Let the games commence!
+            }
+
+        } // endif iChunkInfo
+    if (openedCS)
+        NKern::ThreadLeaveCS();
+
+    __KTRACE_OPT(KUSB, Kern::Printf("Realize: returning %x (%d)", errorOrChunk, errorOrChunk));
+    return errorOrChunk;
+} // End RealizeInterface
+
+
+//
+// DestroyAllInterfaces
+//
+
+void DLddUsbcScChannel::DestroyAllInterfaces()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcScChannel::DestroyAllInterfaces"));
+    // Removes all interfaces
+    if (iAlternateSettingList)
+        {
+        if (iAlternateSettingList->iHead != NULL)
+            {
+            TUsbcScAlternateSetting* alternateSettingListRec = iAlternateSettingList->iTail;
+            while (alternateSettingListRec)
+                {
+                iAlternateSettingList->iTail = alternateSettingListRec->iPrevious; 
+                // If this contains NULL now that is only possible if the record to be deleted was at the head
+                __KTRACE_OPT(KUSB, Kern::Printf("Release interface %d \n", alternateSettingListRec->iSetting));
+                iController->ReleaseInterface(this, alternateSettingListRec->iSetting);
+                delete alternateSettingListRec;
+                if (iAlternateSettingList->iTail == NULL) //No more interfaces left 
+                    break;
+                else
+                    {
+                    iAlternateSettingList->iTail->iNext = NULL;
+                    alternateSettingListRec = iAlternateSettingList->iTail;
+                    }
+                }
+            }
+        delete iAlternateSettingList;    
+        }
+
+    iNumberOfEndpoints = 0;
+    iAlternateSettingList = NULL;
+    iValidInterface = EFalse;
+
+    __KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcScChannel::DestroyAllInterfaces done"));
+    }
+
+
+        
+
+
+//
+// DestroyInterface
+//
+
+void DLddUsbcScChannel::DestroyInterface(TUint aInterfaceNumber)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcScChannel::DestroyInterface \n"));
+    
+    if (iAlternateSetting == aInterfaceNumber)
+        {
+        ResetInterface(KErrUsbInterfaceNotReady);
+        iValidInterface = EFalse;
+        iNumberOfEndpoints = 0;
+        }
+    if (iAlternateSettingList)
+        {
+        TUsbcScAlternateSetting* alternateSettingListRec = iAlternateSettingList->iTail;
+        TUsbcScAlternateSetting* alternateSettingListRecFound = NULL;
+        while (alternateSettingListRec)
+            {
+            if (alternateSettingListRec->iSetting == aInterfaceNumber)
+                {
+                alternateSettingListRecFound = alternateSettingListRec;
+                if (alternateSettingListRec->iPrevious == NULL)    //Interface is at HEAD OF List, Should only be if Interface is also at Tail of list
+                    {
+                    iAlternateSettingList->iHead = alternateSettingListRec->iNext;    // Should be NULL
+                    if (alternateSettingListRec->iNext)
+                        iAlternateSettingList->iHead->iPrevious = NULL;
+                    }
+                else if (alternateSettingListRec->iNext == NULL) //Interface is at TAIL OF List
+                    {
+                    iAlternateSettingList->iTail = alternateSettingListRecFound->iPrevious;
+                    iAlternateSettingList->iTail->iNext = NULL;
+                    }
+                else    //Somewhere in the middle (would not expect this in normal operation, but here for completeness)
+                    {
+                    __KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcScChannel::DestroyInterface Middle interface!\n"));
+                    alternateSettingListRec->iPrevious->iNext = alternateSettingListRec->iNext;
+                    alternateSettingListRec->iNext->iPrevious = alternateSettingListRec->iPrevious;
+                    }    
+
+                delete alternateSettingListRecFound;
+                break;
+                }
+             alternateSettingListRec = alternateSettingListRec->iPrevious;
+            }
+        }
+    }
+
+//
+// SetupEp0
+//
+
+TInt DLddUsbcScChannel::SetupEp0()
+    {
+    __ASSERT_ALWAYS(iEp0Endpoint==NULL, Kern::Fault("DLddUsbcScChannel::SetupEp0", __LINE__));
+
+    TUsbcScEndpointInfo ep0Info = TUsbcScEndpointInfo(UsbShai::KUsbEpTypeControl, UsbShai::KUsbEpDirBidirect);
+    ep0Info.iSize =  iController->Ep0PacketSize();
+
+    TUsbcScEndpoint* ep0 = new TUsbcScEndpoint(this, iController, &ep0Info, 0);
+    if (ep0 == NULL)
+        {
+        return KErrNoMemory;
+        }
+
+    TInt r = ep0->Construct();
+    if (r != KErrNone)
+        {
+        delete ep0;
+        return KErrNoMemory;
+        }
+
+    ep0->SetRealEpNumber(0);
+    ep0->SetBuffer(NULL); // Cannot find it this way.
+
+    iEp0Endpoint = ep0;
+    return KErrNone;
+    }
+
+//
+// DestroyEp0
+//
+
+void DLddUsbcScChannel::DestroyEp0()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf(" DLddUsbcScChannel::DestroyEp0"));
+    delete iEp0Endpoint;
+    iEp0Endpoint = NULL;
+    }
+
+
+void DLddUsbcScChannel::RequestCallbackEp0(TAny* aDLddUsbcScChannel)
+    {
+    DLddUsbcScChannel* channel = (DLddUsbcScChannel*) aDLddUsbcScChannel;
+
+    __KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcScChannel::RequestCallbackEp0"));
+
+    if (channel->ChannelClosing())
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("Channel Closing: Completion not accepted!"));
+        return;
+        }
+
+    switch (channel->iEp0Endpoint->iRequestCallbackInfo->iTransferDir)
+        {
+    case UsbShai::EControllerWrite:
+        channel->iBuffers[channel->iEP0InBuff].CompleteWrite();
+        return;
+    case UsbShai::EControllerRead:
+        channel->iBuffers[channel->iEP0OutBuff].CompleteRead();
+        return;
+    default:
+        Kern::Printf("DLddUsbcScChannel::RequestCallbackEp0 - Unexpected completion direction %d",channel->iEp0Endpoint->iRequestCallbackInfo->iTransferDir);
+        Kern::Fault("DLddUsbcScChannel::RequestCallbackEp0", __LINE__);
+        } 
+    }
+
+
+
+
+
+
+//
+// EndpointStatusChangeCallback
+//
+
+void DLddUsbcScChannel::EndpointStatusChangeCallback(TAny* aDLddUsbcScChannel)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("EndpointStatusChangeCallback"));
+    DLddUsbcScChannel* dUsbc = (DLddUsbcScChannel*) aDLddUsbcScChannel;
+    if (dUsbc->iChannelClosing)
+        return;
+    TUint endpointState = dUsbc->iEndpointStatusCallbackInfo.State();
+    const TInt reqNo = (TInt) RDevUsbcScClient::ERequestEndpointStatusNotify;
+    if (dUsbc->iRequestStatus[reqNo])
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("EndpointStatusChangeCallback Notify status"));
+        DThread* client = dUsbc->iClient;
+        // set client descriptor length to zero
+        TInt r = Kern::ThreadRawWrite(client, dUsbc->iEndpointStatusChangePtr, &endpointState,
+                                      sizeof(TUint), client);
+        if (r != KErrNone)
+            dUsbc->PanicClientThread(r);
+        Kern::RequestComplete(dUsbc->iClient, dUsbc->iRequestStatus[reqNo], r);
+        dUsbc->iEndpointStatusChangePtr = NULL;
+        }
+    }
+
+
+//
+// StatusChangeCallback
+//
+
+void DLddUsbcScChannel::StatusChangeCallback(TAny* aDLddUsbcScChannel)
+    {
+    DLddUsbcScChannel* dUsbc = (DLddUsbcScChannel*) aDLddUsbcScChannel;
+    if (dUsbc->iChannelClosing)
+        return;
+
+    TUsbcDeviceState deviceState;
+    TInt i;
+     for (i = 0;
+          (i < KUsbcDeviceStateRequests) && ((deviceState = dUsbc->iStatusCallbackInfo.State(i)) != UsbShai::EUsbPeripheralNoState);
+          ++i)
+        {
+         __KTRACE_OPT(KUSB, Kern::Printf("StatusChangeCallBack status=%d", deviceState));
+        if (deviceState & KUsbAlternateSetting)
+            {
+            dUsbc->ProcessAlternateSetting(deviceState);
+            }
+        else
+            {
+            dUsbc->ProcessDeviceState(deviceState);
+            // Send Status to EP0 buffer.        
+            // Before the client calls RDevUsbcScClient::FinalizeInterface(),
+            // this function might be called.
+            // So we add a guard for dUsbc->iBuffers
+            if( dUsbc->iBuffers )
+                {
+                dUsbc->iBuffers[dUsbc->iEP0OutBuff].SendEp0StatusPacket(deviceState);
+                }
+            }
+
+        // Only queue if userside is interested
+        if (dUsbc->iDeviceStatusNeeded)
+            {
+            dUsbc->iStatusFifo->AddStatusToQueue(deviceState);
+            const TInt reqNo = (TInt) RDevUsbcScClient::ERequestAlternateDeviceStatusNotify;
+            if (dUsbc->AlternateDeviceStateTestComplete())
+                Kern::RequestComplete(dUsbc->iClient, dUsbc->iRequestStatus[reqNo], KErrNone);
+            }
+        }
+     // We don't want to be interrupted in the middle of this:
+    const TInt irqs = NKern::DisableInterrupts(2);
+     dUsbc->iStatusCallbackInfo.ResetState();
+    NKern::RestoreInterrupts(irqs);
+    }
+
+
+void DLddUsbcScChannel::OtgFeatureChangeCallback(TAny* aDLddUsbcScChannel)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("OtgFeatureChangeCallback"));
+    DLddUsbcScChannel* dUsbc = (DLddUsbcScChannel*) aDLddUsbcScChannel;
+    if (dUsbc->iChannelClosing)
+        return;
+
+    TUint8 features;
+    // No return value check. Assume OTG always supported here
+    dUsbc->iController->GetCurrentOtgFeatures(features);
+
+    const TInt reqNo = (TInt) RDevUsbcScClient::ERequestOtgFeaturesNotify;
+    if (dUsbc->iRequestStatus[reqNo])
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("OtgFeatureChangeCallback Notify status"));
+        TInt r = Kern::ThreadRawWrite(dUsbc->iClient, dUsbc->iOtgFeatureChangePtr,
+                                      &features, sizeof(TUint8), dUsbc->iClient);
+        if (r != KErrNone)
+            dUsbc->PanicClientThread(r);
+        Kern::RequestComplete(dUsbc->iClient, dUsbc->iRequestStatus[reqNo], r);
+        dUsbc->iOtgFeatureChangePtr = NULL;
+        }
+    }
+
+
+//
+// SelectAlternateSetting
+//
+
+TInt DLddUsbcScChannel::SelectAlternateSetting(TUint aAlternateSetting)
+    {
+    TUsbcScEndpoint* ep;
+
+    // First, find the alt setting record, which corresponds to the alt setting number.
+    TUsbcScAlternateSetting* alternateSettingListRec;
+    if(iAlternateSettingList)
+        {
+        for (alternateSettingListRec = iAlternateSettingList->iHead; alternateSettingListRec; alternateSettingListRec = alternateSettingListRec->iNext)
+            if (alternateSettingListRec->iSetting == aAlternateSetting)
+                {
+                // Record has been located.
+
+                // Update current ep setting vars 
+                iEndpoint = alternateSettingListRec->iEndpoint;
+                iNumberOfEndpoints = alternateSettingListRec->iNumberOfEndpoints;
+
+
+
+                // Reset buffers for new ep set
+                for (TInt i = 1; i <= KMaxEndpointsPerClient; i++)
+                    {
+                    ep = alternateSettingListRec->iEndpoint[i];
+                    if (ep!=NULL)
+                        ep->StartBuffer(); // Buffer::StartEndpoint(...)   sets the necessary parameters to the buffer, for use for a perticular endpoint.
+                    }
+
+                return KErrNone;
+                }
+        }
+    return KErrGeneral;
+    }
+
+/* The user calls this to move into the next alternate setting.  After this call, it is assumed the user wants to
+Transmit using endpoints belonging to this alternate Setting.  Writes to the IN endpoints will be allowed until
+the host changed the alternate setting again
+Returns a 32 int with the top 16 bits represents the sequance, and the botten, the alternatre setting no.
+*/
+TInt32 DLddUsbcScChannel::StartNextInAlternateSetting()
+    {
+    iUserKnowsAltSetting = ETrue;
+    return iAsSeq<<16 | iAlternateSetting;
+    } 
+
+
+//
+// EpFromAlternateSetting
+//
+
+TInt DLddUsbcScChannel::EpFromAlternateSetting(TUint aAlternateSetting, TInt aEndpoint)
+    {
+    TUsbcScAlternateSetting* alternateSettingListRec = iAlternateSettingList->iHead;
+    while (alternateSettingListRec)
+        {
+        if (alternateSettingListRec->iSetting == aAlternateSetting)
+            {
+            if ((aEndpoint <= alternateSettingListRec->iNumberOfEndpoints) &&
+                (aEndpoint > 0))
+                {
+                return alternateSettingListRec->iEndpoint[aEndpoint]->RealEpNumber();
+                }
+            else
+                {
+                __KTRACE_OPT(KPANIC, Kern::Printf("  Error: aEndpoint %d wrong for aAlternateSetting %d",
+                                                  aEndpoint, aAlternateSetting));
+                return KErrNotFound;
+                }
+            }
+        alternateSettingListRec = alternateSettingListRec->iNext;
+        }
+    __KTRACE_OPT(KPANIC, Kern::Printf("  Error: no aAlternateSetting %d found", aAlternateSetting));
+    return KErrNotFound;
+    }
+
+//
+// ProcessAlternateSetting
+//
+
+TInt DLddUsbcScChannel::ProcessAlternateSetting(TUint aAlternateSetting)
+    {
+
+    TUint newSetting = aAlternateSetting&(~KUsbAlternateSetting);
+    __KTRACE_OPT(KUSB, Kern::Printf("ProcessAlternateSetting 0x%08x selecting alternate setting 0x%08x", aAlternateSetting, newSetting));
+    iUserKnowsAltSetting=EFalse;
+    iAlternateSetting = newSetting;
+    iAsSeq++; 
+    
+    ResetInterface(KErrUsbInterfaceChange);                    // kill any outstanding IN transfers
+
+    TInt r = SelectAlternateSetting(newSetting);
+    if (r != KErrNone)
+        return r;
+
+
+    StartEpReads();
+    return KErrNone;
+    }
+
+
+//
+//  ProcessDeviceState
+//
+// Called from StatusChangeCallback.
+
+TInt DLddUsbcScChannel::ProcessDeviceState(TUsbcDeviceState aDeviceState)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcScChannel::ProcessDeviceState(%d -> %d)", iDeviceState, aDeviceState));
+    if (iDeviceState == aDeviceState)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  No state change => nothing to be done."));
+        return KErrNone;
+        }
+    if (iDeviceState == UsbShai::EUsbPeripheralStateSuspended)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  Coming out of Suspend: old state = %d", iOldDeviceState));
+        iDeviceState = iOldDeviceState;
+        if (iDeviceState == aDeviceState)
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  New state same as before Suspend => nothing to be done."));
+            return KErrNone;
+            }
+        }
+    TBool renumerateState = (aDeviceState == UsbShai::EUsbPeripheralStateConfigured);
+    TBool deconfigured = EFalse;
+    TInt cancellationCode = KErrNone;
+    if (aDeviceState == UsbShai::EUsbPeripheralStateSuspended)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  Suspending..."));
+        iOldDeviceState = iDeviceState;
+        // Put PSL into low power mode here
+        }
+    else
+        {
+        deconfigured = (iDeviceState == UsbShai::EUsbPeripheralStateConfigured &&
+                        aDeviceState != UsbShai::EUsbPeripheralStateConfigured);
+        if (iDeviceState == UsbShai::EUsbPeripheralStateConfigured)
+            {
+            if (aDeviceState == UsbShai::EUsbPeripheralStateUndefined)
+                cancellationCode = KErrUsbCableDetached;
+            else if (aDeviceState == UsbShai::EUsbPeripheralStateAddress)
+                cancellationCode = KErrUsbDeviceNotConfigured;
+            else if (aDeviceState == UsbShai::EUsbPeripheralStateDefault)
+                cancellationCode = KErrUsbDeviceBusReset;
+            else
+                cancellationCode = KErrUsbDeviceNotConfigured;
+            }
+        }
+    iDeviceState = aDeviceState;
+    if (iValidInterface || iOwnsDeviceControl)
+        {
+
+        // This LDD may not own an interface. It could be some manager reenumerating
+        // after its subordinate LDDs have setup their interfaces.
+        if (deconfigured)
+            {
+            DeConfigure(cancellationCode);
+            }
+        else if (renumerateState)
+            {
+             __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScChannel:: Reumerated!"));
+            // Select main interface & latch in new endpoint set
+            SelectAlternateSetting(0);
+            __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScChannel:: StartReads!"));
+            StartEpReads();
+            }
+        }
+
+    const TInt reqNo = (TInt) RDevUsbcScClient::ERequestReEnumerate;
+    if (renumerateState && iRequestStatus[reqNo])
+        {
+        // This lot must be done if we are reenumerated
+        Kern::RequestComplete(iClient, iRequestStatus[reqNo], KErrNone);
+        }
+
+    return KErrNone;
+    }
+
+
+TBool DLddUsbcScChannel::AlternateDeviceStateTestComplete()
+    {
+    TBool completeNow = EFalse;
+    const TInt reqNo = (TInt) RDevUsbcScClient::ERequestAlternateDeviceStatusNotify;
+    if (iRequestStatus[reqNo])
+        {
+        // User req is outstanding
+        TUint32 deviceState;
+        if (iStatusFifo->GetDeviceQueuedStatus(deviceState) == KErrNone)
+            {
+            // Device state waiting to be sent userside
+            completeNow = ETrue;
+            __KTRACE_OPT(KUSB, Kern::Printf("StatusChangeCallback Notify status"));
+            // set client descriptor length to zero
+            TInt r = Kern::ThreadRawWrite(iClient, iStatusChangePtr, &deviceState,
+                                          sizeof(TUint32), iClient);
+            if (r != KErrNone)
+                PanicClientThread(r);
+            iStatusChangePtr = NULL;
+            }
+        }
+    return completeNow;
+    }
+
+
+void DLddUsbcScChannel::DeConfigure(TInt aErrorCode)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcScChannel::DeConfigure()"));
+    // Called after deconfiguration. Cancels transfers on all endpoints.
+    ResetInterface(aErrorCode);
+    // Cancel the endpoint status notify request if it is outstanding.
+    const TInt KEpNotReq = RDevUsbcScClient::ERequestEndpointStatusNotify;
+    if (iRequestStatus[KEpNotReq])
+        {
+        CancelNotifyEndpointStatus();
+        Kern::RequestComplete(iClient, iRequestStatus[KEpNotReq], aErrorCode);
+        }
+    // We have to reset the alternate setting number when the config goes away.
+     SelectAlternateSetting(0);
+    iAlternateSetting = 0;
+    }
+
+
+void DLddUsbcScChannel::StartEpReads()
+    {
+    // Queued after enumeration. Starts reads on all endpoints.
+    // The endpoint itself decides if it can do a read
+    __KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcScChannel::StartEpReads - 1"));
+    
+    TInt i;
+    TInt8 needsPacket;
+
+    for (i=0; i<iNumBuffers; i++)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcScChannel::StartEpReads - 2 %d",i));
+
+        needsPacket = iBuffers[i].iNeedsPacket;
+        if (needsPacket)
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcScChannel::StartEpReads - 3"));
+            iBuffers[i].UpdateBufferList(0,0,(needsPacket==TUsbcScBuffer::KEpIsStarting));
+            }
+        }
+
+    __KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcScChannel::StartEpReads - 4"));
+
+        // now update ep0
+        iBuffers[iEP0OutBuff].Ep0CancelLddRead();
+        iBuffers[iEP0OutBuff].UpdateBufferList(0,0);
+    __KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcScChannel::StartEpReads - 5"));
+
+    }
+
+
+void DLddUsbcScChannel::ResetInterface(TInt aErrorCode)
+    {
+    if (!iValidInterface && !iOwnsDeviceControl)
+            return;
+        
+    TInt i;
+    for (i=0; i<iNumBuffers; i++)
+        {
+        iBuffers[i].iNeedsPacket=TUsbcScBuffer::KNoEpAssigned;
+        }
+
+    TUsbcScBuffer* buffer;
+
+    for (i = 1; i <= iNumberOfEndpoints; i++)
+        {
+        // Firstly, cancel ('garbge collect') any stale reads/writes into PIL.
+
+        __KTRACE_OPT(KUSB, Kern::Printf("Cancelling transfer ep=%d", i));
+        iEndpoint[i]->AbortTransfer();
+
+        // All OUT endpoints need a packet sent, to indicate the termination of the current ep 'pipe'.
+        // This will complete any current read, or will be read later.
+        // All IN endpoints must be simply cancelled, including anything queued.
+        // Ep0 operates outside alt settings, and so we don't cancel anything.
+
+        buffer=iEndpoint[i]->GetBuffer();
+        if (buffer->iDirection==KUsbcScIn)
+            {
+            buffer->iStatusList.Complete(KErrCancel);    //aErrorCode 
+            buffer->iStatusList.CancelQueued();            //aErrorCode
+            }
+        else
+            buffer->iNeedsPacket=TUsbcScBuffer::KEpIsEnding;    // We will send a packet on re-start, which doubles as a 'cancel'
+                                                                 // for the old alt setting.
+        }
+    }
+
+
+
+void DLddUsbcScChannel::EmergencyCompleteDfc(TAny* aDLddUsbcScChannel)
+    {
+    ((DLddUsbcScChannel*) aDLddUsbcScChannel)->DoEmergencyComplete();
+    }
+
+TInt DLddUsbcScChannel::DoEmergencyComplete()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcScChannel::DoEmergencyComplete"));
+    // cancel any pending DFCs
+    // complete all client requests
+
+    TUsbcScBuffer* buffer;
+    TInt i;    
+    // Complete EP0 request
+
+    TInt direction=iEp0Endpoint->iRequestCallbackInfo->iTransferDir;
+    if (direction==UsbShai::EControllerWrite)
+        {
+        iBuffers[iEP0InBuff].iStatusList.CancelQueued();
+        iBuffers[iEP0InBuff].iStatusList.Complete(KErrDisconnected);
+        }
+    else if (direction==UsbShai::EControllerRead)
+        {
+        iBuffers[iEP0OutBuff].iStatusList.CancelQueued();
+        iBuffers[iEP0OutBuff].iStatusList.Complete(KErrDisconnected);
+        }
+        
+    // Complete other Eps request
+    for (i = 1; i <= iNumberOfEndpoints; i++)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("Cancelling transfer ep=%d", i));
+        buffer=iEndpoint[i]->GetBuffer();
+        buffer->iStatusList.CancelQueued();
+        buffer->iStatusList.Complete(KErrDisconnected);
+        }
+
+    // Complete remaining requests
+
+    for (TInt i = 0; i < KUsbcMaxRequests; i++)
+        {
+        if (iRequestStatus[i])
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("Complete request 0x%x", iRequestStatus[i]));
+            Kern::RequestComplete(iClient, iRequestStatus[i], KErrDisconnected);
+            }
+        }
+    iStatusCallbackInfo.Cancel();
+    iEndpointStatusCallbackInfo.Cancel();
+    iOtgFeatureCallbackInfo.Cancel();
+
+    return KErrNone;
+    }
+
+
+void DLddUsbcScChannel::PanicClientThread(TInt aReason)
+    {
+    Kern::ThreadKill(iClient, EExitPanic, aReason, KUsbLDDKillCat);
+    }
+
+// End DLddUsbcScChannel
+
+/*****************************************************************************\
+*    TUsbcScEndpoint                                                          *
+*                                                                             *
+*                                                                             *
+*                                                                             *
+\*****************************************************************************/
+
+
+// Constructor
+TUsbcScEndpoint::TUsbcScEndpoint(DLddUsbcScChannel* aLDD, DUsbClientController* aController,
+                             const TUsbcScEndpointInfo* aEndpointInfo, TInt aEndpointNum
+                             )
+    : iRequestCallbackInfo(NULL),
+      iController(aController),
+      iEndpointInfo(*aEndpointInfo),
+      iClientReadPending(EFalse),
+      iClientWritePending(EFalse),
+      iEndpointNumber(aEndpointNum),
+      iRealEpNumber(-1),
+      iLdd(aLDD),
+      iError(KErrNone),
+      iBytesTransferred(0),
+      iBuffer(NULL)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScEndpoint::TUsbcScEndpoint"));
+    }
+
+
+TInt TUsbcScEndpoint::Construct()
+    {
+    __KTRACE_OPT(KUSB,Kern::Printf("TUsbcScEndpoint::TUsbcScEndpoint iEndpointNumber %d\n",iEndpointNumber));
+
+    iRequestCallbackInfo = new TUsbcRequestCallback(iLdd,
+                                                    iEndpointNumber,
+                                                    (iEndpointNumber==0)?DLddUsbcScChannel::RequestCallbackEp0:TUsbcScEndpoint::RequestCallback,
+                                                    (iEndpointNumber==0)?  (TAny*) iLdd:  (TAny*) this,
+                                                    iLdd->iDfcQ,
+                                                    KUsbRequestCallbackPriority);
+
+    return (iRequestCallbackInfo == NULL)?KErrNoMemory:KErrNone;
+    }
+
+
+TUsbcScEndpoint::~TUsbcScEndpoint()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScEndpoint::~TUsbcScEndpoint(%d)", iEndpointNumber));
+    AbortTransfer();
+    delete iRequestCallbackInfo;
+    }
+
+// This is called by the PIL, on return from a read or write.
+// Inturn it calls either the read or write function for that buffer.
+
+void TUsbcScEndpoint::RequestCallback(TAny* aTUsbcScEndpoint)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScEndpoint::RequestCallback"));
+
+    if (((TUsbcScEndpoint*)aTUsbcScEndpoint)->iLdd->ChannelClosing())
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("Channel Closing: Completion not accepted!"));
+        return;
+        }
+
+    switch (((TUsbcScEndpoint*) aTUsbcScEndpoint)->iRequestCallbackInfo->iTransferDir)
+    {
+    case UsbShai::EControllerWrite:
+        ((TUsbcScEndpoint*) aTUsbcScEndpoint)->iBuffer->CompleteWrite();
+        return;
+    case UsbShai::EControllerRead:
+        ((TUsbcScEndpoint*) aTUsbcScEndpoint)->iBuffer->CompleteRead();
+        return;
+    default:
+        Kern::Printf("TUsbcScEndpoint::RequestCallback - Unexpected compleation direction %d",((TUsbcScEndpoint*) aTUsbcScEndpoint)->iRequestCallbackInfo->iTransferDir);
+        Kern::Fault("TUsbcScEndpoint::RequestCallback", __LINE__);
+    } 
+    }
+
+
+/*
+
+This is used to tidy up cancel calls into the PIL, regardless of them being reads or writes
+
+*/
+
+void TUsbcScEndpoint::AbortTransfer()
+    {
+    if (!iLdd->iRealizeCalled)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScEndpoint::AbortTransfer Ep# %d Real Ep # %d - N.R.",iEndpointNumber, iRealEpNumber));
+        return;
+        } 
+    else
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScEndpoint::AbortTransfer Ep# %d Real Ep # %d",iEndpointNumber, iRealEpNumber));
+        }
+
+    
+    if (iBuffer && (iBuffer->iStatusList.iState) || (!iRealEpNumber))
+        {
+        if (iRequestCallbackInfo->iTransferDir==UsbShai::EControllerWrite)
+            iController->CancelWriteBuffer(iLdd, iRealEpNumber);
+        else if (iRequestCallbackInfo->iTransferDir==UsbShai::EControllerRead)
+            iController->CancelReadBuffer(iLdd, iRealEpNumber);
+        else
+            {
+            if (iEndpointNumber!=0) // endpoint zero starts off not sent in any direction, then keeps changing.
+                {
+                __KTRACE_OPT(KUSB,Kern::Printf("\nTUsbcScEndpoint::AbortTransfer WARNING: Invalid Direction %d on (%d,%d)!\n",iRequestCallbackInfo->iTransferDir,iEndpointNumber, iRealEpNumber));
+                }
+            else
+                {
+                __KTRACE_OPT(KUSB, Kern::Printf("\nTUsbcScEndpoint::AbortTransfer Can't stop direction %d on (%d,%d)!\n",iRequestCallbackInfo->iTransferDir,iEndpointNumber, iRealEpNumber));
+                }
+            }
+        }
+    else if (!iBuffer)
+        {
+        __KTRACE_OPT(KUSB,Kern::Printf("\nTUsbcScEndpoint::AbortTransfer WARNING: iBuffer is NULL on (%d,%d)\n",iEndpointNumber, iRealEpNumber));
+        return;
+        }
+    
+    if (iRequestCallbackInfo)
+        iRequestCallbackInfo->iDfc.Cancel();
+    else
+        {
+        __KTRACE_OPT(KUSB,Kern::Printf("\nTUsbcScEndpoint::AbortTransfer WARNING: iRequestCallbackInfo is NULL\n"));
+        }
+        
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScEndpoint Done."));
+    }
+
+// End TUsbcScEndpoint
+
+
+/*****************************************************************************\
+*    TUsbcScAlternateSettingList                                              *
+*                                                                             *
+*                                                                             *
+*                                                                             *
+\*****************************************************************************/
+
+
+TUsbcScAlternateSetting::TUsbcScAlternateSetting()
+    : iNext(NULL),
+      iPrevious(NULL),
+      iNumberOfEndpoints(0),
+      iSetting(0)
+    {
+    for (TInt i = 0; i <= KMaxEndpointsPerClient; i++)
+        {
+        iEndpoint[i] = NULL;
+        }
+    }
+
+
+TUsbcScAlternateSetting::~TUsbcScAlternateSetting()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScAlternateSetting::~TUsbcScAlternateSetting()"));
+    for (TInt i = 0; i <= KMaxEndpointsPerClient; i++)
+        {
+        delete iEndpoint[i];
+        }
+    }
+
+// End TUsbcScAlternateSettingList
+
+
+
+TUsbcScAlternateSettingList::TUsbcScAlternateSettingList()
+    : iHead(NULL),
+      iTail(NULL)
+    {
+    }
+
+TUsbcScAlternateSettingList::~TUsbcScAlternateSettingList()
+    {
+    }
+
+
+
+/*****************************************************************************\
+*   TUsbcDeviceStatusQueue                                                    *
+*                                                                             *
+*                                                                             *
+*                                                                             *
+\*****************************************************************************/
+
+
+TUsbcDeviceStatusQueue::TUsbcDeviceStatusQueue()
+    {
+    FlushQueue();
+    }
+
+
+void TUsbcDeviceStatusQueue::FlushQueue()
+    {
+    for (TInt i = 0; i < KUsbDeviceStatusQueueDepth; i++)
+        {
+        iDeviceStatusQueue[i] = KUsbDeviceStatusNull;
+        }
+    iStatusQueueHead = 0;
+    }
+
+
+void TUsbcDeviceStatusQueue::AddStatusToQueue(TUint32 aDeviceStatus)
+    {
+    // Only add a new status if it is not a duplicate of the one at the head of the queue
+    if (!(iStatusQueueHead != 0 &&
+          iDeviceStatusQueue[iStatusQueueHead - 1] == aDeviceStatus))
+        {
+        if (iStatusQueueHead == KUsbDeviceStatusQueueDepth)
+            {
+            // Discard item at tail of queue
+            TUint32 status;
+            GetDeviceQueuedStatus(status);
+            }
+        iDeviceStatusQueue[iStatusQueueHead] = aDeviceStatus;
+        iStatusQueueHead++;
+        }
+    }
+
+
+TInt TUsbcDeviceStatusQueue::GetDeviceQueuedStatus(TUint32& aDeviceStatus)
+    {
+    TInt r = KErrNone;
+    if (iStatusQueueHead <= 0)
+        {
+        r = KErrGeneral;
+        aDeviceStatus = KUsbDeviceStatusNull;
+        }
+    else
+        {
+        aDeviceStatus = iDeviceStatusQueue[0];
+        for(TInt i = 1; i < KUsbDeviceStatusQueueDepth; i++)
+            {
+            TUint32 s = iDeviceStatusQueue[i];
+            iDeviceStatusQueue[i - 1] = s;
+            }
+        iStatusQueueHead--;
+        iDeviceStatusQueue[KUsbDeviceStatusQueueDepth - 1] = KUsbDeviceStatusNull;
+        }
+    return r;
+    }
+
+// End TUsbcDeviceStatusQueue
+
+//---
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/pdd/pil/eabi/usbperipheralpilu.def	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,95 @@
+EXPORTS
+	_ZN20DUsbClientController10PowerUpUdcEv @ 1 NONAME
+	_ZN20DUsbClientController10UsbConnectEv @ 2 NONAME
+	_ZN20DUsbClientController11ReEnumerateEv @ 3 NONAME
+	_ZN20DUsbClientController12HaltEndpointEPK5DBasei @ 4 NONAME
+	_ZN20DUsbClientController12SetInterfaceEPK5DBaseP7DThreadiR14TUsbcClassInfoP6TDesC8i22TUsbcEndpointInfoArrayPim @ 5 NONAME
+	_ZN20DUsbClientController12SetInterfaceEPK5DBaseP7DThreadiR14TUsbcClassInfoP6TDesC8iPK17TUsbcEndpointInfoPA6_im @ 6 NONAME
+	_ZN20DUsbClientController13DumpRegistersEv @ 7 NONAME
+	_ZN20DUsbClientController13UsbDisconnectEv @ 8 NONAME
+	_ZN20DUsbClientController15SetupReadBufferER20TUsbcRequestCallback @ 9 NONAME
+	_ZN20DUsbClientController16CancelReadBufferEPK5DBasei @ 10 NONAME
+	_ZN20DUsbClientController16DeRegisterClientEPK5DBase @ 11 NONAME
+	_ZN20DUsbClientController16ReleaseInterfaceEPK5DBasei @ 12 NONAME
+	_ZN20DUsbClientController16SetDeviceControlEPK5DBase @ 13 NONAME
+	_ZN20DUsbClientController16SetOtgDescriptorEP7DThreadRK6TDesC8 @ 14 NONAME
+	_ZN20DUsbClientController16SetupWriteBufferER20TUsbcRequestCallback @ 15 NONAME
+	_ZN20DUsbClientController17CancelWriteBufferEPK5DBasei @ 16 NONAME
+	_ZN20DUsbClientController17ClearHaltEndpointEPK5DBasei @ 17 NONAME
+	_ZN20DUsbClientController17EnableClientStackEv @ 18 NONAME
+	_ZN20DUsbClientController18DisableClientStackEv @ 19 NONAME
+	_ZN20DUsbClientController18EndpointPacketSizeEPK5DBasei @ 20 NONAME
+	_ZN20DUsbClientController18SignalRemoteWakeupEv @ 21 NONAME
+	_ZN20DUsbClientController19GetDeviceDescriptorEP7DThreadR5TDes8 @ 22 NONAME
+	_ZN20DUsbClientController19GetStringDescriptorEP7DThreadhR5TDes8 @ 23 NONAME
+	_ZN20DUsbClientController19SendEp0StatusPacketEPK5DBase @ 24 NONAME
+	_ZN20DUsbClientController19SetDeviceDescriptorEP7DThreadRK5TDes8 @ 25 NONAME
+	_ZN20DUsbClientController19SetStringDescriptorEP7DThreadhRK5TDes8 @ 26 NONAME
+	_ZN20DUsbClientController20ReleaseDeviceControlEPK5DBase @ 27 NONAME
+	_ZN20DUsbClientController21GetEndpointDescriptorEP7DThreadPK5DBaseiiR5TDes8 @ 28 NONAME
+	_ZN20DUsbClientController21QueryEndpointResourceEPK5DBasei21TUsbcEndpointResource @ 29 NONAME
+	_ZN20DUsbClientController21SetEndpointDescriptorEP7DThreadPK5DBaseiiRK5TDes8 @ 30 NONAME
+	_ZN20DUsbClientController21UsbcControllerPointerEi @ 31 NONAME
+	_ZN20DUsbClientController22GetInterfaceDescriptorEP7DThreadPK5DBaseiR5TDes8 @ 32 NONAME
+	_ZN20DUsbClientController22RegisterClientCallbackER19TUsbcClientCallback @ 33 NONAME
+	_ZN20DUsbClientController22RemoveStringDescriptorEh @ 34 NONAME
+	_ZN20DUsbClientController22SetInterfaceDescriptorEP7DThreadPK5DBaseiRK5TDes8 @ 35 NONAME
+	_ZN20DUsbClientController23CurrentlyUsingHighSpeedEv @ 36 NONAME
+	_ZN20DUsbClientController23GetDeviceDescriptorSizeEP7DThreadR5TDes8 @ 37 NONAME
+	_ZN20DUsbClientController23RegisterForStatusChangeER19TUsbcStatusCallback @ 38 NONAME
+	_ZN20DUsbClientController25DeRegisterForStatusChangeEPK5DBase @ 39 NONAME
+	_ZN20DUsbClientController25GetEndpointDescriptorSizeEP7DThreadPK5DBaseiiR5TDes8 @ 40 NONAME
+	_ZN20DUsbClientController25GetStringDescriptorLangIdEP7DThreadR5TDes8 @ 41 NONAME
+	_ZN20DUsbClientController25SetStringDescriptorLangIdEt @ 42 NONAME
+	_ZN20DUsbClientController26GetConfigurationDescriptorEP7DThreadR5TDes8 @ 43 NONAME
+	_ZN20DUsbClientController26GetInterfaceDescriptorSizeEP7DThreadPK5DBaseiR5TDes8 @ 44 NONAME
+	_ZN20DUsbClientController26GetProductStringDescriptorEP7DThreadR5TDes8 @ 45 NONAME
+	_ZN20DUsbClientController26SetConfigurationDescriptorEP7DThreadRK5TDes8 @ 46 NONAME
+	_ZN20DUsbClientController26SetProductStringDescriptorEP7DThreadRK5TDes8 @ 47 NONAME
+	_ZN20DUsbClientController27RegisterForOtgFeatureChangeER23TUsbcOtgFeatureCallback @ 48 NONAME
+	_ZN20DUsbClientController28GetCSEndpointDescriptorBlockEP7DThreadPK5DBaseiiR5TDes8 @ 49 NONAME
+	_ZN20DUsbClientController28GetDeviceQualifierDescriptorEP7DThreadR5TDes8 @ 50 NONAME
+	_ZN20DUsbClientController28SetCSEndpointDescriptorBlockEP7DThreadPK5DBaseiiRK5TDes8i @ 51 NONAME
+	_ZN20DUsbClientController28SetDeviceQualifierDescriptorEP7DThreadRK5TDes8 @ 52 NONAME
+	_ZN20DUsbClientController28SetEndpointZeroMaxPacketSizeEi @ 53 NONAME
+	_ZN20DUsbClientController29DeRegisterForOtgFeatureChangeEPK5DBase @ 54 NONAME
+	_ZN20DUsbClientController29GetCSInterfaceDescriptorBlockEP7DThreadPK5DBaseiR5TDes8 @ 55 NONAME
+	_ZN20DUsbClientController29RemoveProductStringDescriptorEv @ 56 NONAME
+	_ZN20DUsbClientController29SetCSInterfaceDescriptorBlockEP7DThreadPK5DBaseiRK5TDes8i @ 57 NONAME
+	_ZN20DUsbClientController30GetConfigurationDescriptorSizeEP7DThreadR5TDes8 @ 58 NONAME
+	_ZN20DUsbClientController31GetManufacturerStringDescriptorEP7DThreadR5TDes8 @ 59 NONAME
+	_ZN20DUsbClientController31GetSerialNumberStringDescriptorEP7DThreadR5TDes8 @ 60 NONAME
+	_ZN20DUsbClientController31RegisterForEndpointStatusChangeER27TUsbcEndpointStatusCallback @ 61 NONAME
+	_ZN20DUsbClientController31SetManufacturerStringDescriptorEP7DThreadRK5TDes8 @ 62 NONAME
+	_ZN20DUsbClientController31SetSerialNumberStringDescriptorEP7DThreadRK5TDes8 @ 63 NONAME
+	_ZN20DUsbClientController32GetCSEndpointDescriptorBlockSizeEP7DThreadPK5DBaseiiR5TDes8 @ 64 NONAME
+	_ZN20DUsbClientController32GetConfigurationStringDescriptorEP7DThreadR5TDes8 @ 65 NONAME
+	_ZN20DUsbClientController32SetConfigurationStringDescriptorEP7DThreadRK5TDes8 @ 66 NONAME
+	_ZN20DUsbClientController33DeRegisterForEndpointStatusChangeEPK5DBase @ 67 NONAME
+	_ZN20DUsbClientController33GetCSInterfaceDescriptorBlockSizeEP7DThreadPK5DBaseiR5TDes8 @ 68 NONAME
+	_ZN20DUsbClientController34RemoveManufacturerStringDescriptorEv @ 69 NONAME
+	_ZN20DUsbClientController34RemoveSerialNumberStringDescriptorEv @ 70 NONAME
+	_ZN20DUsbClientController35RemoveConfigurationStringDescriptorEv @ 71 NONAME
+	_ZN20DUsbClientController36GetOtherSpeedConfigurationDescriptorEP7DThreadR5TDes8 @ 72 NONAME
+	_ZN20DUsbClientController36SetOtherSpeedConfigurationDescriptorEP7DThreadRK5TDes8 @ 73 NONAME
+	_ZN20DUsbClientController4DfcQEi @ 74 NONAME
+	_ZN20DUsbClientController6CreateERN7UsbShai23MPeripheralControllerIfERKNS0_31TPeripheralControllerPropertiesEi @ 75 NONAME
+	_ZN20DUsbClientController8Ep0StallEPK5DBase @ 76 NONAME
+	_ZN20DUsbClientController8IsActiveEv @ 77 NONAME
+	_ZN20TUsbcRequestCallback15SetRxBufferInfoEPhmPmS1_i @ 78 NONAME
+	_ZN20TUsbcRequestCallback15SetTxBufferInfoEPhmi @ 79 NONAME
+	_ZN7UsbShai16UsbPeripheralPil28RegisterPeripheralControllerERNS_23MPeripheralControllerIfERKNS_31TPeripheralControllerPropertiesE @ 80 NONAME
+	_ZN7UsbShai21TUsbPeripheralRequestC1Ei @ 81 NONAME
+	_ZN7UsbShai21TUsbPeripheralRequestC2Ei @ 82 NONAME
+	_ZN7UsbShai22UsbChargerDetectionPil23RegisterChargerDetectorERNS_18MChargerDetectorIfERNS_26TChargerDetectorPropertiesE @ 83 NONAME
+	_ZNK20DUsbClientController10DeviceCapsEPK5DBaseR5TDes8 @ 84 NONAME
+	_ZNK20DUsbClientController12EndpointCapsEPK5DBaseR5TDes8 @ 85 NONAME
+	_ZNK20DUsbClientController13Ep0PacketSizeEv @ 86 NONAME
+	_ZNK20DUsbClientController14GetOtgFeaturesEP7DThreadR5TDes8 @ 87 NONAME
+	_ZNK20DUsbClientController15GetDeviceStatusEv @ 88 NONAME
+	_ZNK20DUsbClientController16GetOtgDescriptorEP7DThreadR5TDes8 @ 89 NONAME
+	_ZNK20DUsbClientController17GetEndpointStatusEPK5DBasei @ 90 NONAME
+	_ZNK20DUsbClientController18GetInterfaceNumberEPK5DBaseRi @ 91 NONAME
+	_ZNK20DUsbClientController21GetCurrentOtgFeaturesERh @ 92 NONAME
+	_ZNK20DUsbClientController26EndpointZeroMaxPacketSizesEv @ 93 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/pdd/pil/group/bld.inf	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,21 @@
+/*
+  Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
+  All rights reserved.
+
+  This program and the accompanying materials are made available 
+  under the terms of the Eclipse Public License v1.0 which accompanies 
+  this distribution, and is available at 
+  http://www.eclipse.org/legal/epl-v10.html
+
+  Initial Contributors:
+  Nokia Corporation - initial contribution.
+
+  Contributors:
+*/
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+ARMV5
+
+PRJ_MMPFILES
+usbperipheralpil
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/pdd/pil/group/usbperipheralpil.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,45 @@
+/*
+  Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
+  All rights reserved.
+
+  This program and the accompanying materials are made available 
+  under the terms of the Eclipse Public License v1.0 which accompanies 
+  this distribution, and is available at 
+  http://www.eclipse.org/legal/epl-v10.html
+
+  Initial Contributors:
+  Nokia Corporation - initial contribution.
+
+  Contributors:
+*/
+
+#include <platform_paths.hrh>
+
+#include        "kernel/kern_ext.mmh"
+
+target          usbperipheralpil.dll
+targettype      kext
+linkas          usbperipheralpil.dll
+deffile         ../~/usbperipheralpil.def
+VENDORID        0x70000001
+uid             0x00000000  0x2002E6DB
+capability      all
+epocallowdlldata
+
+// The sytem include paths are declared by using the following macros
+
+OS_LAYER_SYSTEMINCLUDE
+
+
+
+// Include dirs of the HS-USB component
+userinclude     ../inc
+
+// PIL layer source files
+sourcepath   ../src
+source       chapter9.cpp
+source       descriptors.cpp
+source       misc.cpp
+source       ps_usbc.cpp
+source       queue.cpp
+source       controltransfersm.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/pdd/pil/src/chapter9.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,1599 @@
+// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// 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:
+// e32/drivers/usbcc/chapter9.cpp
+// Platform independent layer (PIL) of the USB Device controller driver:
+// Processing of USB spec chapter 9 standard requests.
+// 
+//
+
+/**
+ @file chapter9.cpp
+ @internalTechnology
+*/
+
+#include <usb/usbc.h>
+
+#include "controltransfersm.h"
+
+//#define ENABLE_EXCESSIVE_DEBUG_OUTPUT
+//
+// === USB Controller member function implementation - PSL API (protected) ========================
+//
+
+/** Used to synchronize the Ep0 state machine between the PSL and PIL.
+    Accepts a SETUP packet and returns the next Ep0 state.
+
+    @param aSetupBuf The SETUP packet just received by the PSL.
+    @return The next Ep0 state.
+
+    @publishedPartner @released
+*/
+UsbShai::TControlStage DUsbClientController::EnquireEp0NextStage(const TUint8* aSetupBuf) const
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::EnquireEp0NextState()"));
+
+    // This function may be called by the PSL from within an ISR -- so we have
+    // to take care what we do here (and also in all functions that get called
+    // from here).
+
+    if (SWAP_BYTES_16((reinterpret_cast<const TUint16*>(aSetupBuf)[3])) == 0) // iLength
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  --> EControlTransferStageStatusIn"));
+        return UsbShai::EControlTransferStageStatusIn;                            // No-data Control => Status_IN
+        }
+    else if ((aSetupBuf[0] & KUsbRequestType_DirMask) == KUsbRequestType_DirToDev)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  --> EControlTransferStageDataOut"));
+        return UsbShai::EControlTransferStageDataOut;                            // Control Write => Data_OUT
+        }
+    else
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  --> EControlTransferStageDataIn"));
+        return UsbShai::EControlTransferStageDataIn;                                // Control Read => Data_IN
+        }
+    }
+
+//
+// About iLastError.
+// This member is used to remember the last error happend during a
+// processXXX likewise function.
+//
+// Before entry of each ProcessXXX, iLastError will be cleared to KErrNone.
+//
+
+// --- The USB Spec Chapter 9 Standard Endpoint Zero Device Requests ---
+// Record error happend with iLastError, the value already been set to zero
+// before entering ProcessSetupPacket call.
+void DUsbClientController::ProcessGetDeviceStatus(const TUsbcSetup& aPacket)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessGetDeviceStatus()"));
+    if ( iDeviceState < UsbShai::EUsbPeripheralStateAddress)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Invalid device state"));
+        iLastError = KErrGeneral;
+        }
+    else
+        {
+        // We always assume Device is bus-powered, even though mobile phone almost always
+        // has a battry there, because self-powered device can not required more then 100ma current
+        // which is not acceptable for Usb charging.
+        TBool selfPowered = EFalse;         
+        
+        /*  FIXME: modify selfPowered to make it compilance with following rule.
+           
+             1. If current draw exceeds 100mA, the device must report itself 
+                as bus-powered during enumeration.
+             
+             2. In all cases, the GetStatus(DEVICE) call must accurately report 
+                whether the device is currently operating on self- or bus-power.
+                
+             3. A device that is actively drawing more than 100mA from USB must 
+                report itself as bus-powered in the GetStatus(DEVICE) call.
+             
+             4. Peripherals that return "Self-powered" in the GetStatus(DEVICE) 
+                call are prohibited from drawing more than 100mA at any time.
+        */
+        /*   
+        TBuf8<KUsbDescSize_Config> config;
+        
+        if(iDescriptors.GetConfigurationDescriptorTC(&Kern::CurrentThread(),config) == KErrNone)
+            {
+            TUint8 maxPower = config[8];
+            if(maxPower <= 50)
+                {
+                selfPowered = EFalse;
+                }
+            }
+        */
+        
+        const TUint16 status = ((selfPowered ? KUsbDevStat_SelfPowered : 0) |
+                        (iRmWakeupStatus_Enabled ? KUsbDevStat_RemoteWakeup : 0));
+        __KTRACE_OPT(KUSB, Kern::Printf("  Reporting device status: 0x%02x", status));
+        *reinterpret_cast<TUint16*>(iEp0_TxBuf) = SWAP_BYTES_16(status);
+        if (iConTransferMgr->SetupEndpointZeroWrite(iEp0_TxBuf, sizeof(status)) == KErrNone)
+            {
+            iEp0WritePending = ETrue;
+            }
+        else
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  Wrong: Write to Ep0 Failed"));
+            }
+        }
+    }
+
+void DUsbClientController::ProcessGetInterfaceStatus(const TUsbcSetup& aPacket)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessGetInterfaceStatus()"));
+    if ( iDeviceState < UsbShai::EUsbPeripheralStateConfigured)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Invalid device state"));
+        iLastError = KErrGeneral;
+        }
+    else
+        {
+        if (InterfaceExists(aPacket.iIndex) == EFalse)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Interface does not exist"));
+            iLastError = KErrGeneral;
+            }
+        else
+            {        
+            const TUint16 status = 0x0000;                            // as of USB Spec 2.0
+            __KTRACE_OPT(KUSB, Kern::Printf("  Reporting interface status: 0x%02x", status));
+            *reinterpret_cast<TUint16*>(iEp0_TxBuf) = SWAP_BYTES_16(status);
+            if (iConTransferMgr->SetupEndpointZeroWrite(iEp0_TxBuf, sizeof(status)) == KErrNone)
+                {
+                iEp0WritePending = ETrue;
+                }
+            else
+                {
+                __KTRACE_OPT(KUSB, Kern::Printf("  Wrong: Write to Ep0 Failed"));
+                }
+            }
+        }
+    }
+
+
+void DUsbClientController::ProcessGetEndpointStatus(const TUsbcSetup& aPacket)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessGetEndpointStatus()"));
+    if (
+        ((iDeviceState < UsbShai::EUsbPeripheralStateAddress) ||
+         (iDeviceState == UsbShai::EUsbPeripheralStateAddress && (aPacket.iIndex & KUsbEpAddress_Portmask) != 0)))
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Invalid device state"));
+        iLastError = KErrGeneral;
+        }
+    else
+        {
+        if (EndpointExists(aPacket.iIndex) == EFalse)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Endpoint does not exist"));
+            iLastError = KErrGeneral;
+            }
+        else
+            {
+            const TInt ep = EpAddr2Idx(aPacket.iIndex);
+            const TUint16 status = (iRealEndpoints[ep].iHalt) ?     KUsbEpStat_Halt : 0;
+            __KTRACE_OPT(KUSB, Kern::Printf("  Reporting endpoint status 0x%02x for real endpoint %d",
+                                            status, ep));
+            *reinterpret_cast<TUint16*>(iEp0_TxBuf) = SWAP_BYTES_16(status);
+            if (iConTransferMgr->SetupEndpointZeroWrite(iEp0_TxBuf, 2) == KErrNone)
+                {
+                iEp0WritePending = ETrue;
+                }
+            else
+                {
+                __KTRACE_OPT(KUSB, Kern::Printf("  Wrong: Write to Ep0 Failed"));
+                }
+            }
+        }
+    }
+
+
+void DUsbClientController::ProcessSetClearDevFeature(const TUsbcSetup& aPacket)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessSetClearDevFeature()"));
+    if ( iDeviceState < UsbShai::EUsbPeripheralStateDefault)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Invalid device state"));
+        iLastError = KErrGeneral;
+        return;
+        }
+
+    TInt test_sel = 0;
+
+    if (aPacket.iRequest == KUsbRequest_SetFeature)
+        {
+        switch (aPacket.iValue)
+            {
+            case KUsbFeature_RemoteWakeup:
+                if ( iDeviceState < UsbShai::EUsbPeripheralStateAddress)
+                    {
+                    __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Invalid device state"));
+                    iLastError = KErrGeneral;                
+                    }
+                else
+                    {
+                    iRmWakeupStatus_Enabled = ETrue;
+                    }
+                break;
+                
+            case KUsbFeature_TestMode:
+                if (!iHighSpeed)
+                    {
+                    __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Request only supported in High-Speed mode"));
+                    iLastError = KErrGeneral;
+                    }
+                else if (LowByte(aPacket.iIndex) != 0)
+                    {
+                    __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Lower byte of wIndex must be zero"));
+                    iLastError = KErrGeneral;
+                    }
+                else
+                    {
+                    test_sel = HighByte(aPacket.iIndex);
+                    if ((test_sel < UsbShai::EUsbTestSelector_Test_J) || (test_sel > UsbShai::EUsbTestSelector_Test_Force_Enable))
+                        {
+                        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Invalid test selector: %d", test_sel));
+                        iLastError = KErrGeneral;
+                        }
+                    }
+                break;
+                
+            case KUsbFeature_B_HnpEnable:
+                if (!iOtgSupport)
+                    {
+                    __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Request only supported on a OTG device"));
+                    iLastError = KErrGeneral;
+                    }            
+                else if (!(iOtgFuncMap & KUsbOtgAttr_HnpSupp))
+                    {
+                    __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Request only valid if OTG device supports HNP"));
+                    iLastError = KErrGeneral;
+                    }
+                else
+                    {
+                    iOtgFuncMap |= KUsbOtgAttr_B_HnpEnable;
+                    OtgFeaturesNotify();
+                    }
+                break;
+                
+            case KUsbFeature_A_HnpSupport:
+                if (!iOtgSupport)
+                    {
+                    __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Request only supported on a OTG device"));
+                    iLastError = KErrGeneral;
+                    }
+                else if (!(iOtgFuncMap & KUsbOtgAttr_HnpSupp))
+                    {
+                    __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Request only valid if OTG device supports HNP"));
+                    iLastError = KErrGeneral;
+                    }
+                else
+                    {
+                    iOtgFuncMap |= KUsbOtgAttr_A_HnpSupport;
+                    OtgFeaturesNotify();
+                    }
+                break;
+                
+            case KUsbFeature_A_AltHnpSupport:
+                if (!iOtgSupport)
+                    {
+                    __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Request only supported on a OTG device"));
+                    iLastError = KErrGeneral;
+                    }
+                else if (!(iOtgFuncMap & KUsbOtgAttr_HnpSupp))
+                    {
+                    __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Request only valid if OTG device supports HNP"));
+                    iLastError = KErrGeneral;
+                    }
+                else
+                    {
+                    iOtgFuncMap |= KUsbOtgAttr_A_AltHnpSupport;
+                    OtgFeaturesNotify();
+                    }
+                break;
+                
+            default:
+                __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Unknown feature requested"));
+                iLastError = KErrGeneral;                
+            }
+        }
+    else // KUsbRequest_ClearFeature
+        {
+        switch (aPacket.iValue)
+            {
+            case KUsbFeature_RemoteWakeup:
+                if ( iDeviceState < UsbShai::EUsbPeripheralStateAddress)
+                    {
+                    __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Invalid device state"));
+                    iLastError = KErrGeneral;
+                    }
+                else
+                    {
+                    iRmWakeupStatus_Enabled = EFalse;
+                    }
+                break;
+                
+            default:
+                __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Unknown feature requested"));
+                iLastError = KErrGeneral;
+            }
+        }
+    
+    if(iLastError == KErrNone)
+        {
+        // Sent out status packet if no error found.
+        iConTransferMgr->SendEp0ZeroByteStatusPacket();                            // success: zero bytes data during status stage
+        
+        // 9.4.9: "The transition to test mode of an upstream facing port must not happen until
+        // after the status stage of the request."
+        if (test_sel)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Entering HS Test Mode %d", test_sel));
+            iController.EnterTestMode((UsbShai::TUsbTestModeSelector)test_sel);
+            }
+        }
+    }
+
+
+void DUsbClientController::ProcessSetClearIfcFeature(const TUsbcSetup& aPacket)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessSetClearIfcFeature()"));
+    if ( iDeviceState < UsbShai::EUsbPeripheralStateConfigured)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Invalid device state"));
+        iLastError = KErrGeneral;
+        }
+    else
+        {
+        // No interface features defined in USB spec, thus
+        iLastError = KErrGeneral;
+        }
+    }
+
+
+void DUsbClientController::ProcessSetClearEpFeature(const TUsbcSetup& aPacket)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessSetClearEpFeature()"));
+    if (
+        ((iDeviceState < UsbShai::EUsbPeripheralStateAddress) ||
+         (iDeviceState == UsbShai::EUsbPeripheralStateAddress && (aPacket.iIndex & KUsbEpAddress_Portmask) != 0)))
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Invalid device state"));
+        iLastError = KErrGeneral;
+        }
+    else if (aPacket.iValue != KUsbFeature_EndpointHalt)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Unknown feature requested"));
+        iLastError = KErrGeneral;
+        }
+    else if (EndpointExists(aPacket.iIndex) == EFalse)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Endpoint does not exist"));
+        iLastError = KErrGeneral;
+        }
+    else
+        {
+        const TInt ep = EpAddr2Idx(aPacket.iIndex);
+        if (iRealEndpoints[ep].iLEndpoint->iInfo.iType == UsbShai::KUsbEpTypeControl ||
+            iRealEndpoints[ep].iLEndpoint->iInfo.iType == UsbShai::KUsbEpTypeIsochronous)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Endpoint is Control or Isochronous"));
+            iLastError = KErrGeneral;
+            }
+        else
+            {
+            SetClearHaltFeature(ep, aPacket.iRequest);
+        
+            // success: zero bytes data during status stage
+            iConTransferMgr->SendEp0ZeroByteStatusPacket();
+            }
+        }
+    }
+
+
+void DUsbClientController::ProcessSetAddress(const TUsbcSetup& aPacket)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessSetAddress()"));
+    if ( iDeviceState > UsbShai::EUsbPeripheralStateAddress)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Invalid device state"));
+        iLastError = KErrGeneral;
+        }
+    else
+        {
+        const TUint16 addr = aPacket.iValue;
+        
+        if (addr > 127)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Bad address value: %d (>127)", addr));
+            iLastError = KErrGeneral;
+            }
+        else if (addr == 0)
+            {
+            // Enter Default state (from Default or Address)
+            NextDeviceState(UsbShai::EUsbPeripheralStateDefault);
+            }
+        
+        __KTRACE_OPT(KUSB, Kern::Printf("  USB address: %d", addr));
+        
+        // If controller support hw acceleration,call set address first and then status
+        if(iControllerProperties.iControllerCaps & UsbShai::KDevCapSetAddressAcceleration)
+            {
+            iController.SetDeviceAddress(addr);
+            }
+
+        // The spec says, under section 9.4.6:
+        // "Stages after the initial Setup packet assume the same device address as the Setup packet. The USB
+        // device does not change its device address until after the Status stage of this request is completed
+        // successfully. Note that this is a difference between this request and all other requests. For all other
+        // requests, the operation indicated must be completed before the Status stage."
+        // Therefore, here we first send the status packet and only then actually execute the request.
+        iConTransferMgr->SendEp0ZeroByteStatusPacket();
+        
+        // If controller doesn't support hw acceleration, call set address after status
+        if((iControllerProperties.iControllerCaps & UsbShai::KDevCapSetAddressAcceleration) == 0)
+            {
+            iController.SetDeviceAddress(addr);
+            }
+        }
+    }
+
+
+void DUsbClientController::ProcessGetDescriptor(const TUsbcSetup& aPacket)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessGetDescriptor()"));
+    if ( iDeviceState < UsbShai::EUsbPeripheralStateDefault)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Invalid device state"));
+        iLastError = KErrGeneral;
+        return ;
+        }
+
+    // Make sure we assume the correct speed
+    __ASSERT_DEBUG((iHighSpeed == CurrentlyUsingHighSpeed()), Kern::Fault(KUsbPILPanicCat, __LINE__));
+
+    TInt size = 0;
+    const TInt result = iDescriptors.FindDescriptor(HighByte(aPacket.iValue), // Type
+                                                    LowByte(aPacket.iValue), // Index
+                                                    aPacket.iIndex, // Language ID
+                                                    size);
+
+    if ((result != KErrNone) || (size == 0))
+        {
+        // This doesn't have to be an error - protocol-wise it's OK.
+        __KTRACE_OPT(KUSB, Kern::Printf("  Couldn't retrieve descriptor"));
+        iLastError = KErrGeneral;
+        return;
+        }
+
+    __KTRACE_OPT(KUSB, Kern::Printf("  Descriptor found, size: %d (requested: %d)",
+                                    size, aPacket.iLength));
+    if (size > KUsbcBufSz_Ep0Tx)
+        {
+        // This should actually not be possible (i.e. we should never get here).
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Ep0_Tx buffer too small"));
+        }
+    if (size > aPacket.iLength)
+        {
+        // Send only as much data as requested by the host
+        size = aPacket.iLength;
+        }
+
+#ifdef ENABLE_EXCESSIVE_DEBUG_OUTPUT
+    __KTRACE_OPT(KUSB,
+                 Kern::Printf("  Data: 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x ...",
+                              iEp0_TxBuf[0], iEp0_TxBuf[1], iEp0_TxBuf[2], iEp0_TxBuf[3],
+                              iEp0_TxBuf[4], iEp0_TxBuf[5], iEp0_TxBuf[6], iEp0_TxBuf[7]));
+#endif
+    // If we're about to send less bytes than expected by the host AND our number is a
+    // multiple of the packet size, in order to indicate the end of the control transfer,
+    // we must finally send a zero length data packet (ZLP):
+    const TBool zlp = ((size < aPacket.iLength) && (size % iEp0MaxPacketSize == 0));
+    if (iConTransferMgr->SetupEndpointZeroWrite(iEp0_TxBuf, size, zlp) == KErrNone)
+        {
+        iEp0WritePending = ETrue;
+        }
+    else
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  Wrong: Write to Ep0 Failed"));
+        }
+    }
+
+
+void DUsbClientController::ProcessSetDescriptor(const TUsbcSetup& aPacket)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessSetDescriptor()"));
+#ifndef USB_SUPPORTS_SET_DESCRIPTOR_REQUEST
+    iLastError = KErrGeneral;
+    return;
+#else
+    if ( iDeviceState < UsbShai::EUsbPeripheralStateAddress)
+        {
+        // Error: Invalid device state!
+        iLastError = KErrGeneral;
+        }
+    else if (aPacket.iLength > KUsbcBufSz_Ep0Rx)
+        {
+        // Error: Our Rx buffer is too small! (Raise a defect to make it larger)
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Ep0_Rx buffer too small"));
+        iLastError = KErrGeneral;
+        }
+    else
+        {
+        SetEp0DataOutVars();
+        iConTransferMgr->SetupEndpointZeroRead();
+        }
+#endif
+    }
+
+void DUsbClientController::ProcessGetConfiguration(const TUsbcSetup& aPacket)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessGetConfiguration()"));
+    if ( iDeviceState < UsbShai::EUsbPeripheralStateAddress)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Invalid device state"));
+        iLastError = KErrGeneral;
+        }
+    else if ( iDeviceState == UsbShai::EUsbPeripheralStateAddress && iCurrentConfig != 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: DeviceState Address && Config != 0"));
+        iLastError = KErrGeneral;
+        }
+    else if ( iDeviceState == UsbShai::EUsbPeripheralStateConfigured && iCurrentConfig == 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: DeviceState Configured && Config == 0"));
+        iLastError = KErrGeneral;
+        }
+    else
+        {
+        if (aPacket.iLength != 1)                                // "unspecified behavior"
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  Warning: wLength != 1 (= %d)", aPacket.iLength));
+            }
+        __KTRACE_OPT(KUSB, Kern::Printf("  Reporting configuration value %d", iCurrentConfig));
+        if (iConTransferMgr->SetupEndpointZeroWrite(&iCurrentConfig, sizeof(iCurrentConfig)) == KErrNone)
+            {
+            iEp0WritePending = ETrue;
+            }
+        else
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  Wrong: Write to Ep0 Failed"));
+            }
+        }
+    }
+
+
+/** Changes the device's configuration value, including interface setup and/or
+    teardown and state change notification of higher-layer clients.
+    May also be called by the PSL in special cases - therefore publishedPartner.
+
+    @param aPacket The received Ep0 SET_CONFIGURATION setup request packet.
+    @return KErrGeneral in case of a protocol error, KErrNone otherwise.
+
+    @publishedPartner @released
+*/
+TInt DUsbClientController::ProcessSetConfiguration(const TUsbcSetup& aPacket)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessSetConfiguration()"));
+
+    // This function may be called by the PSL from within an ISR -- so we have
+    // to take care what we do here (and also in all functions that get called
+    // from here).
+    const TInt value = aPacket.iValue;
+    
+    if ( iDeviceState < UsbShai::EUsbPeripheralStateAddress)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Invalid device state"));
+        iLastError = KErrGeneral;
+        }    
+    else if (value > 1)                                            // we support only one configuration
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Configuration value too large: %d", value));
+        iLastError = KErrGeneral;
+        }
+    else
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  Configuration value: %d", value));
+        ChangeConfiguration(value);
+
+        // In 9.4.5 under GET_STATUS we read, that after SET_CONFIGURATION the HALT feature
+        // for all endpoints is reset to zero.
+        TInt num = 0;
+        (TAny) DoForEveryEndpointInUse(&DUsbClientController::ClearHaltFeature, num);
+        __KTRACE_OPT(KUSB, Kern::Printf("  Called ClearHaltFeature() for %d endpoints", num));
+        // success: zero bytes data during status stage
+        iConTransferMgr->SendEp0ZeroByteStatusPacket();
+        }
+        
+    return iLastError;
+    }
+
+void DUsbClientController::ProcessGetInterface(const TUsbcSetup& aPacket)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessGetInterface()"));
+    
+    const TInt number = aPacket.iIndex;
+    
+    if ( iDeviceState < UsbShai::EUsbPeripheralStateConfigured)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Invalid device state"));
+        iLastError = KErrGeneral;
+        }
+    else if (iCurrentConfig == 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Device not configured"));
+        iLastError = KErrGeneral;
+        }    
+    else if (!InterfaceExists(number))
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Bad interface index: %d", number));
+        iLastError = KErrGeneral;
+        }
+    else
+        {
+        // Send alternate setting code of iCurrentInterface of Interface(set) <number> of the current
+        // config (iCurrentConfig).
+        const TUint8 setting = InterfaceNumber2InterfacePointer(number)->iCurrentInterface;
+        __KTRACE_OPT(KUSB, Kern::Printf("  Reporting interface setting %d", setting));
+        if (iConTransferMgr->SetupEndpointZeroWrite(&setting, 1) == KErrNone)
+            {
+            iEp0WritePending = ETrue;
+            }
+        else
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  Wrong: Write to Ep0 Failed"));
+            }
+        }
+    }
+
+
+void DUsbClientController::ProcessSetInterface(const TUsbcSetup& aPacket)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessSetInterface()"));
+    
+    const TInt number = aPacket.iIndex;
+    
+    if ( iDeviceState < UsbShai::EUsbPeripheralStateConfigured)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Invalid device state"));
+        iLastError = KErrGeneral;
+        }
+    else if (iCurrentConfig == 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Device not configured"));
+        iLastError = KErrGeneral;
+        }    
+    else if (!InterfaceExists(number))
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Bad interface index: %d", number));
+        iLastError = KErrGeneral;
+        }
+    else
+        {
+        const TInt setting = aPacket.iValue;
+        TUsbcInterfaceSet* const ifcset_ptr = InterfaceNumber2InterfacePointer(number);
+        RPointerArray<TUsbcInterface>& ifcs = ifcset_ptr->iInterfaces;
+        if (setting >= ifcs.Count())
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Alt Setting >= bNumAltSettings: %d", setting));
+            iLastError = KErrGeneral;
+            }
+        else
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  Interface setting:: %d", setting));
+            // Set iCurrentInterface of Interface(set) <number> of the current config
+            // (iCurrentConfig) to alternate setting <setting>.
+            ChangeInterface(ifcs[setting]);
+            // In 9.4.5 under GET_STATUS we read, that after SET_INTERFACE the HALT feature
+            // for all endpoints (of the now current interface setting) is reset to zero.
+            RPointerArray<TUsbcLogicalEndpoint>& eps = ifcset_ptr->CurrentInterface()->iEndpoints;
+            const TInt num_eps = eps.Count();
+            for (TInt i = 0; i < num_eps; i++)
+                {
+                const TInt ep_num = EpAddr2Idx(eps[i]->iPEndpoint->iEndpointAddr);
+                (TAny) ClearHaltFeature(ep_num);
+                }
+            // success: zero bytes data during status stage
+            iConTransferMgr->SendEp0ZeroByteStatusPacket();    
+            }
+        }
+    }
+
+
+void DUsbClientController::ProcessSynchFrame(const TUsbcSetup& aPacket)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessSynchFrame()"));
+    
+    const TInt ep = aPacket.iIndex;
+    
+    if ( iDeviceState < UsbShai::EUsbPeripheralStateConfigured)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Invalid device state"));
+        iLastError = KErrGeneral;
+        }    
+    else if (EndpointExists(ep) == EFalse)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Endpoint does not exist"));
+        iLastError = KErrGeneral;
+        }
+    else if (iRealEndpoints[EpAddr2Idx(ep)].iLEndpoint->iInfo.iType != UsbShai::KUsbEpTypeIsochronous)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Endpoint is not isochronous"));
+        iLastError = KErrGeneral;
+        }
+    else 
+        {
+        // We always send 0:
+        *reinterpret_cast<TUint16*>(iEp0_TxBuf) = 0x00;
+        if (iConTransferMgr->SetupEndpointZeroWrite(iEp0_TxBuf, 2) == KErrNone)
+            {
+            iEp0WritePending = ETrue;
+            }
+        else
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  Wrong: Write to Ep0 Failed"));
+            }
+        }
+    }
+
+
+#ifdef USB_SUPPORTS_SET_DESCRIPTOR_REQUEST
+void DUsbClientController::ProceedSetDescriptor()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProceedSetDescriptor()"));
+    // iEp0DataReceived already reflects the current buffer state
+    if (iEp0DataReceived < iConTransferMgr->PktParser().DataLength())
+        {
+        // Not yet all data received => proceed
+        return;
+        }
+    if (iEp0DataReceived > iConTransferMgr->PktParser().DataLength())
+        {
+        // Error: more data received than expected
+        // but we don't care...
+        }
+    const TUint8 type = HighByte(iConTransferMgr->PktParser().Value());
+    if (type == KUsbDescType_String)
+        {
+        // set/add new string descriptor
+        }
+    else
+        {
+        // set/add new ordinary descriptor
+        }
+    TUint8 index = LowByte(iConTransferMgr->PktParser().Value());
+    TUint16 langid = iConTransferMgr->PktParser().Index();
+    TUint16 length_total = iConTransferMgr->PktParser().DataLength();
+
+    iConTransferMgr->SendEp0ZeroByteStatusPacket();
+    }
+#endif
+
+
+// --- Secondary (Helper) Functions
+
+void DUsbClientController::SetClearHaltFeature(TInt aRealEndpoint, TUint8 aRequest)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::SetClearHaltFeature()"));
+    if (aRequest == KUsbRequest_SetFeature)
+        {
+        if (iRealEndpoints[aRealEndpoint].iHalt)
+            {
+            // (This condition is not really an error)
+            __KTRACE_OPT(KUSB, Kern::Printf("  Warning: HALT feature already set"));
+            return;
+            }
+        __KTRACE_OPT(KUSB, Kern::Printf("  setting HALT feature for real endpoint %d",
+                                        aRealEndpoint));
+        iController.StallEndpoint(aRealEndpoint);
+        iRealEndpoints[aRealEndpoint].iHalt = ETrue;
+        }
+    else                                                    // KUsbRequest_ClearFeature
+        {
+        if (iRealEndpoints[aRealEndpoint].iHalt == EFalse)
+            {
+            // In this case, before we return, the data toggles are reset to DATA0.
+            __KTRACE_OPT(KUSB, Kern::Printf("  Warning: HALT feature already cleared"));
+            iController.ResetDataToggle(aRealEndpoint);
+            return;
+            }
+        __KTRACE_OPT(KUSB, Kern::Printf("  clearing HALT feature for real endpoint %d",
+                                        aRealEndpoint));
+        iController.ResetDataToggle(aRealEndpoint);
+        iController.ClearStallEndpoint(aRealEndpoint);
+        iRealEndpoints[aRealEndpoint].iHalt = EFalse;
+        }
+    EpStatusNotify(aRealEndpoint);                            // only called if actually something changed
+    }
+
+
+TInt DUsbClientController::ClearHaltFeature(TInt aRealEndpoint)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ClearHaltFeature()"));
+    if (iRealEndpoints[aRealEndpoint].iHalt != EFalse)
+        {
+        iController.ClearStallEndpoint(aRealEndpoint);
+        iRealEndpoints[aRealEndpoint].iHalt = EFalse;
+        }
+    return KErrNone;
+    }
+
+
+void DUsbClientController::ChangeConfiguration(TUint16 aValue)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ChangeConfiguration()"));
+    // New configuration is the same as the old one: 0
+    if (iCurrentConfig == 0 && aValue == 0)
+        {
+        // no-op
+        __KTRACE_OPT(KUSB, Kern::Printf("  Configuration: New == Old == 0 --> exiting"));
+        return;
+        }
+    // New configuration is the same as the old one (but not 0)
+    if (iCurrentConfig == aValue)
+        {
+        // no-op
+        __KTRACE_OPT(KUSB, Kern::Printf("  Configuration: New == Old == %d --> exiting", aValue));
+        return;
+        }
+    // Device is already configured
+    if (iCurrentConfig != 0)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  Device was configured: %d", iCurrentConfig));
+        // Tear down all interface(set)s of the old configuration
+        RPointerArray<TUsbcInterfaceSet>& ifcsets = CurrentConfig()->iInterfaceSets;
+        for (TInt i = 0; i < ifcsets.Count(); ++i)
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  Tearing down InterfaceSet %d", i));
+            InterfaceSetTeardown(ifcsets[i]);
+            }
+        iCurrentConfig = 0;
+        // Enter Address state (from Configured)
+        if (iDeviceState == UsbShai::EUsbPeripheralStateConfigured)
+            NextDeviceState(UsbShai::EUsbPeripheralStateAddress);
+        }
+    // Device gets a new configuration
+    if (aValue != 0)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  Device gets new configuration..."));
+        // Setup all alternate settings 0 of all interfaces
+        // (Don't separate the next two lines of code.)
+        iCurrentConfig = aValue;
+        RPointerArray<TUsbcInterfaceSet>& ifcsets = CurrentConfig()->iInterfaceSets;
+        const TInt n = ifcsets.Count();
+        for (TInt i = 0; i < n; ++i)
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  Setting up InterfaceSet %d", i));
+            InterfaceSetup(ifcsets[i]->iInterfaces[0]);
+            }
+        // Enter Configured state (from Address or Configured)
+        NextDeviceState(UsbShai::EUsbPeripheralStateConfigured);
+        }
+    __KTRACE_OPT(KUSB, Kern::Printf("  New configuration: %d", iCurrentConfig));
+    return;
+    }
+
+
+void DUsbClientController::InterfaceSetup(TUsbcInterface* aIfc)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::InterfaceSetup()"));
+    const TInt num_eps = aIfc->iEndpoints.Count();
+    for (TInt i = 0; i < num_eps; i++)
+        {
+        // Prepare this endpoint for I/O
+        TUsbcLogicalEndpoint* const ep = aIfc->iEndpoints[i];
+        // (TUsbcLogicalEndpoint's FS/HS endpoint sizes and interval values got
+        //  adjusted in its constructor.)
+        if (iHighSpeed)
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  Setting Ep info size to %d (HS)", ep->iEpSize_Hs));
+            ep->iInfo.iSize = ep->iEpSize_Hs;
+            }
+        else
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  Setting Ep info size to %d (FS)", ep->iEpSize_Fs));
+            ep->iInfo.iSize = ep->iEpSize_Fs;
+            }
+        const TInt idx = EpAddr2Idx(ep->iPEndpoint->iEndpointAddr);
+        if (iController.ConfigureEndpoint(idx, ep->iInfo) != KErrNone)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Endpoint %d configuration failed", idx));
+            continue;
+            }
+        // Should there be a problem with it then we could try resetting the ep
+        // data toggle at this point (or before the Configure) as well.
+        __KTRACE_OPT(KUSB, Kern::Printf("  Connecting real ep addr 0x%02x & logical ep #%d",
+                                        ep->iPEndpoint->iEndpointAddr, ep->iLEndpointNum));
+        ep->iPEndpoint->iLEndpoint = ep;
+        }
+    aIfc->iInterfaceSet->iCurrentInterface = aIfc->iSettingCode;
+    return;
+    }
+
+
+void DUsbClientController::InterfaceSetTeardown(TUsbcInterfaceSet* aIfcSet)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::InterfaceSetTeardown()"));
+    if (aIfcSet->iInterfaces.Count() == 0)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  No interfaces exist - returning"));
+        return;
+        }
+    RPointerArray<TUsbcLogicalEndpoint>& eps = aIfcSet->CurrentInterface()->iEndpoints;
+    const TInt num_eps = eps.Count();
+    for (TInt i = 0; i < num_eps; i++)
+        {
+        TUsbcLogicalEndpoint* const ep = eps[i];
+        const TInt idx = EpAddr2Idx(ep->iPEndpoint->iEndpointAddr);
+
+        CancelTransferRequests(idx);
+
+        if (!ep->iPEndpoint->iLEndpoint)
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  real ep %d not configured: skipping", idx));
+            continue;
+            }
+        if (iController.ResetDataToggle(idx) != KErrNone)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Endpoint %d data toggle reset failed", idx));
+            }
+        if (iController.DeConfigureEndpoint(idx) != KErrNone)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Endpoint %d de-configuration failed", idx));
+            }
+
+        __KTRACE_OPT(KUSB, Kern::Printf("  disconnecting real ep & logical ep"));
+        ep->iPEndpoint->iLEndpoint = NULL;
+        }
+    if (aIfcSet->CurrentInterface() != 0)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  Resetting alternate interface setting to 0"));
+        //Add this mutex to protect the interface set data structure
+        if (NKern::CurrentContext() == EThread)
+            {
+            NKern::FMWait(&iMutex);
+            }
+        
+        aIfcSet->iCurrentInterface = 0;
+        if (NKern::CurrentContext() == EThread)
+            {
+            NKern::FMSignal(&iMutex);
+            }        
+        }
+    return;
+    }
+
+
+void DUsbClientController::ChangeInterface(TUsbcInterface* aIfc)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ChangeInterface()"));
+    TUsbcInterfaceSet* ifcset = aIfc->iInterfaceSet;
+    const TUint8 setting = aIfc->iSettingCode;
+    if (ifcset->iCurrentInterface == setting)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  New Ifc == old Ifc: nothing to do"));
+        return;
+        }
+    __KTRACE_OPT(KUSB, Kern::Printf("  Setting new interface setting #%d", setting));
+    InterfaceSetTeardown(ifcset);
+    InterfaceSetup(aIfc);
+    StatusNotify(static_cast<UsbShai::TUsbPeripheralState>(KUsbAlternateSetting | setting), ifcset->iClientId);
+    }
+
+
+// aFunction gets called, successively, with the endpoint index of every ep in-use as its argument.
+// (BTW: The declaration "type (class::*name)(params)" makes <name> a "pointer to element function".)
+//
+TInt DUsbClientController::DoForEveryEndpointInUse(TInt (DUsbClientController::*aFunction)(TInt), TInt& aCount)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::DoForEveryEndpointInUse()"));
+    aCount = 0;
+    TUsbcConfiguration* const config = CurrentConfig();
+    if (!config)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  Device is not configured - returning"));
+        return KErrNone;
+        }
+    RPointerArray<TUsbcInterfaceSet>& ifcsets = config->iInterfaceSets;
+    const TInt num_ifcsets = ifcsets.Count();
+    for (TInt i = 0; i < num_ifcsets; i++)
+        {
+        RPointerArray<TUsbcLogicalEndpoint>& eps = ifcsets[i]->CurrentInterface()->iEndpoints;
+        const TInt num_eps = eps.Count();
+        for (TInt j = 0; j < num_eps; j++)
+            {
+            const TInt ep_num = EpAddr2Idx(eps[j]->iPEndpoint->iEndpointAddr);
+            const TInt result = (this->*aFunction)(ep_num);
+            ++aCount;
+            if (result != KErrNone)
+                {
+                return result;
+                }
+            }
+        }
+    return KErrNone;
+    }
+
+// Data Tx is done.
+void DUsbClientController::ProcessDataInPacket(TInt aCount,TInt aErrCode)
+    {
+    // Clear Error Code
+    iLastError = KErrNone;
+    
+    // For tx, no premature end is allowed.
+    if(aErrCode != KErrNone)
+        {
+        // something wrong in hardware, we can do nothing as remedy
+        // just stall the endpoint.
+        iConTransferMgr->StallEndpoint(KEp0_In);
+        iConTransferMgr->SetupEndpointZeroRead();
+        
+        // set err code to Error general if end point is stalled
+        iLastError = KErrGeneral;
+        }
+    else
+        {
+        // no longer a write pending
+        iEp0WritePending = EFalse;
+        
+        // If it was a client who set up this transmission, we report to that client
+        if (iEp0ClientDataTransmitting)
+            {
+            iEp0ClientDataTransmitting = EFalse;
+            TUsbcRequestCallback* const p = iRequestCallbacks[KEp0_Tx];
+            
+            if (p)
+                {
+                __ASSERT_DEBUG((p->iTransferDir == UsbShai::EControllerWrite), Kern::Fault(KUsbPILPanicCat, __LINE__));
+                p->iError = aErrCode;
+                p->iTxBytes = aCount;
+                
+                // tell the client that the sending is done
+                // later, it is possible that a status out packet comes in,
+                // just ignore it.
+                ProcessDataTransferDone(*p);
+                }
+            else
+                {
+                // we should never goes here
+                iConTransferMgr->StallEndpoint(KEp0_In);
+                
+                // request not found
+                iLastError = KErrNotFound;
+                }
+            }
+        // else
+        //   it is our own who sending the data, no more action needed
+        }
+    }
+
+// Status Rx is done    
+void DUsbClientController::ProcessStatusOutPacket(TInt aErrCode)
+    {
+    // Clear Error Code
+    iLastError = KErrNone;
+    
+    // Dangdang, psl saying a status out packet recieved from
+    // host, but, we already completed user's writting request, just ignore it.
+    
+    // any way, receiving this means no write is pending.
+    iEp0WritePending = EFalse;
+    }
+    
+// Data Rx is (partial) done
+void DUsbClientController::ProcessDataOutPacket(TInt aCount,TInt aErrCode)
+    {
+    // Clear Error Code
+    iLastError = KErrNone;
+    
+    if (aErrCode != KErrNone && aErrCode != KErrPrematureEnd)
+        {
+        // something wrong in hardware, we can do nothing as remedy
+        // just stall the endpoint.
+        iConTransferMgr->StallEndpoint(KEp0_Out);
+        iConTransferMgr->SetupEndpointZeroRead();
+        
+        // set err code to Error general if end point is stalled
+        iLastError = KErrGeneral;       
+        }
+    else
+        {
+        // Trim aCount with iEp0MaxPacketSize per packet
+        if (aCount > iEp0MaxPacketSize)
+            {
+            aCount = iEp0MaxPacketSize;
+            }
+               
+        iEp0DataReceived += aCount;
+        
+        if (iEp0ClientId == NULL)
+            {
+            // it is us( not an app), who owns this transaction
+            switch( iConTransferMgr->PktParser().Request())
+                {
+#ifdef USB_SUPPORTS_SET_DESCRIPTOR_REQUEST                
+                case KUsbRequest_SetDescriptor:
+                    {
+                    memcpy(iEp0_RxCollectionBuf + iEp0DataReceived, iEp0_RxBuf, aCount);                    
+                    
+                    // Status will be sent in side this function
+                    // if we had recieved enough bytes
+                    ProceedSetDescriptor();
+                    }
+                    break;
+#endif                    
+                default:
+                    {
+                    iConTransferMgr->StallEndpoint(KEp0_In);
+                    ResetEp0DataOutVars();
+                    
+                    // set err code to Error general if end point is stalled
+                    iLastError = KErrGeneral;
+                    }
+                    break;
+                }
+            
+            if (iEp0DataReceived >= iConTransferMgr->PktParser().DataLength())
+                {                
+                // all data seems now to be here
+                ResetEp0DataOutVars();
+                }                
+            }
+        else
+            {
+            // it is an application who is requesting this data
+            // pass the data on to a client
+            
+            // it is the client's responsibility of sending a status
+            // packet back to host to indicate the whole transfer is
+            // done
+            
+            // Find the client Request callback
+            TSglQueIter<TUsbcRequestCallback> iter(iEp0ReadRequestCallbacks);
+            TUsbcRequestCallback* p;
+            while ((p = iter++) != NULL)
+                {
+                if (p->Owner() == iEp0ClientId)
+                    {
+                    memcpy(p->iBufferStart, iEp0_RxBuf, aCount);
+                    p->iError = KErrNone;
+                    *(p->iPacketSize) = aCount;
+                    p->iRxPackets = 1;
+                    *(p->iPacketIndex) = 0;
+                    break;
+                    }
+                }
+            
+            // pass data to client if found one.
+            if ( p != NULL)
+                {
+                ProcessDataTransferDone(*p);
+                    
+                if (iEp0DataReceived >= iConTransferMgr->PktParser().DataLength())
+                    {
+                    // all data seems now to be here
+                    ResetEp0DataOutVars();
+                    }
+                
+                iLastError = KErrNone;
+                
+                }
+            else
+                {
+                // that's bad, we found a client is request this data
+                // but no matching request callback found.
+                
+                iEp0_RxExtraCount = aCount;
+                //iEp0_RxExtraData = ETrue;
+                //iEp0_RxExtraError = aErrCode;
+                iEp0DataReceived -= aCount;
+                
+                // No status packet will be send to host since no client is reading this data,
+                // waiting client to send a status packet.
+                
+                iLastError = KErrNotFound;
+                }
+            }
+        }
+    }
+
+// Status Tx is done    
+void DUsbClientController::ProcessStatusInPacket(TInt aErrCode)
+    {
+    // Clear Error Code
+    iLastError = KErrNone; 
+
+    // it is time to start a new read
+    iEp0WritePending = EFalse;
+    }
+
+//
+// Setup Rx is done
+//
+void DUsbClientController::ProcessSetupPacket(TInt aCount,TInt aErrCode)
+    {
+    
+    if (aErrCode != KErrNone)
+        {
+        // something wrong in hardware, we can do nothing as remedy
+        // just stall the endpoint.
+        iConTransferMgr->StallEndpoint(KEp0_Out);
+        iConTransferMgr->SetupEndpointZeroRead();
+        
+        // set err code to Error general if end point is stalled
+        iLastError = KErrGeneral;       
+        }
+    
+    TUsbcSetup packet;
+    Buffer2Setup(iEp0_RxBuf, packet);
+    
+    // Clear Error Code
+    iLastError = KErrNone;
+    
+    // If this is a standard request, we can handle it here
+    // not need to bother app layer
+    if ((packet.iRequestType & KUsbRequestType_TypeMask) == KUsbRequestType_TypeStd)
+        {
+        // Fixme: this may not needed any more
+        iEp0ReceivedNonStdRequest = EFalse;
+        ProcessStandardRequest(aCount,packet);
+        }
+    else
+        {
+        // Fixme: This may not needed anymore
+        iEp0ReceivedNonStdRequest = ETrue;
+        ProcessNonStandardRequest(aCount,packet);
+        }
+    }
+
+#define USB_PROCESS_REQUEST(request,param) \
+    do \
+    { \
+    Process ## request(param); \
+    if (iLastError != KErrNone) \
+        { \
+        __KTRACE_OPT(KUSB, \
+                    Kern::Printf("  ProcessEp0SetupReceived: Stalling Ep0")); \
+        iConTransferMgr->StallEndpoint(KEp0_In); \
+        } \
+    }while(0)
+    
+    
+//
+// Standard request
+// Please note that:Macro USB_PROCESS_REQUEST(xxx) will stall endpoint
+// if anything wrong during the process, in which case status packet is 
+// not needed.
+//
+void DUsbClientController::ProcessStandardRequest(TInt /*aCount*/,const TUsbcSetup& aPacket)
+    {
+    switch (aPacket.iRequest)
+        {
+        case KUsbRequest_GetStatus:
+            switch (aPacket.iRequestType & KUsbRequestType_DestMask)
+                { // Recipient
+                case KUsbRequestType_DestDevice:
+                    USB_PROCESS_REQUEST(GetDeviceStatus,aPacket);
+                    break;
+                    
+                case KUsbRequestType_DestIfc:
+                    USB_PROCESS_REQUEST(GetInterfaceStatus,aPacket);
+                    break;
+                    
+                case KUsbRequestType_DestEp:
+                    USB_PROCESS_REQUEST(GetEndpointStatus,aPacket);
+                    break;
+                    
+                default:
+                    __KTRACE_OPT(KPANIC, Kern::Printf("  Error: GET STATUS - Other or Unknown recipient"));
+                    __KTRACE_OPT(KPANIC, Kern::Printf("  -> DUsbClientController::ProcessEp0SetupReceived: "
+                                                      "Stalling Ep0"));
+                    iConTransferMgr->StallEndpoint(KEp0_In);
+                    iLastError = KErrGeneral;
+                    break;
+                }
+                break;
+        
+        case KUsbRequest_ClearFeature:
+        case KUsbRequest_SetFeature:
+            switch (aPacket.iRequestType & KUsbRequestType_DestMask)
+                { // Recipient
+                case KUsbRequestType_DestDevice:
+                    USB_PROCESS_REQUEST(SetClearDevFeature,aPacket);
+                    break;
+                case KUsbRequestType_DestIfc:
+                    // will 100% stall endpoint
+                    USB_PROCESS_REQUEST(SetClearIfcFeature,aPacket);
+                    break;
+                case KUsbRequestType_DestEp:
+                    USB_PROCESS_REQUEST(SetClearEpFeature,aPacket);
+                    break;
+                default:
+                    __KTRACE_OPT(KPANIC, Kern::Printf("  Error: SET/CLEAR FEATURE - "
+                                                      "Other or Unknown recipient"));
+                    __KTRACE_OPT(KPANIC, Kern::Printf("  -> Stalling Ep0"));
+                    iConTransferMgr->StallEndpoint(KEp0_In);
+                    iLastError = KErrGeneral;
+                    break;
+                }
+                break;
+                
+        case KUsbRequest_SetAddress:
+            USB_PROCESS_REQUEST(SetAddress,aPacket);
+            break;
+            
+        case KUsbRequest_GetDescriptor:
+            USB_PROCESS_REQUEST(GetDescriptor,aPacket);
+            break;
+            
+        case KUsbRequest_SetDescriptor:
+            USB_PROCESS_REQUEST(SetDescriptor,aPacket);
+            break;
+            
+        case KUsbRequest_GetConfig:
+            USB_PROCESS_REQUEST(GetConfiguration,aPacket);
+            break;
+            
+        case KUsbRequest_SetConfig:
+            USB_PROCESS_REQUEST(SetConfiguration,aPacket);
+            break;
+            
+        case KUsbRequest_GetInterface:
+            USB_PROCESS_REQUEST(GetInterface,aPacket);
+            break;
+            
+        case KUsbRequest_SetInterface:
+            USB_PROCESS_REQUEST(SetInterface,aPacket);
+            break;
+            
+        case KUsbRequest_SynchFrame:
+            USB_PROCESS_REQUEST(SynchFrame,aPacket);
+            break;
+            
+        default:
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Unknown/unsupported Std Setup Request"));
+            __KTRACE_OPT(KPANIC, Kern::Printf("  -> Stalling Ep0"));
+            iConTransferMgr->StallEndpoint(KEp0_In);
+            iLastError = KErrGeneral;
+            break;
+        }       
+    }
+
+#undef USB_PROCESS_REQUEST
+    
+//
+// class- or vendor-specific request    
+// we dont send back any status to host in PIL for class- or vendor-specific request
+// if no client is waiting, stall the endpoint
+// if client is not ready, just record them and waiting for client to read them
+// (and, send a status packet)
+//
+void DUsbClientController::ProcessNonStandardRequest(TInt aCount,const TUsbcSetup& aPacket)
+    {
+    // Find out which client can handle this request
+    const DBase* client = FindNonStandardRequestClient(aPacket.iRequestType & KUsbRequestType_DestMask,aPacket);
+        
+    // If client is valide
+    if (client != NULL)
+        {
+        // Try to relay aPacket to the real recipient
+        TSglQueIter<TUsbcRequestCallback> iter(iEp0ReadRequestCallbacks);
+        TUsbcRequestCallback* p;
+        
+        // Find out the request callback with match the client 
+        // returned from last FindNonStandardRequestClient().
+        while ((p = iter++) != NULL)
+            {
+            if (p->Owner() == client)
+                {
+                __ASSERT_DEBUG((p->iEndpointNum == 0), Kern::Fault(KUsbPILPanicCat, __LINE__));
+                __ASSERT_DEBUG((p->iTransferDir == UsbShai::EControllerRead), Kern::Fault(KUsbPILPanicCat, __LINE__));
+                __KTRACE_OPT(KUSB, Kern::Printf("  Found Ep0 read request"));
+                if (aPacket.iLength != 0)
+                    {
+                    if ((aPacket.iRequestType & KUsbRequestType_DirMask) == KUsbRequestType_DirToDev)
+                        {
+                        // Data transfer & direction OUT => there'll be a DATA_OUT stage
+                        __KTRACE_OPT(KUSB, Kern::Printf("  Next is DATA_OUT: setting up DataOutVars"));
+                        SetEp0DataOutVars(client);
+                        }
+                    else if ((aPacket.iRequestType & KUsbRequestType_DirMask) == KUsbRequestType_DirToHost)
+                        {
+                        // For possible later use (ZLP).
+                        iEp0_TxNonStdCount = aPacket.iLength;
+                        }
+                    }
+                    
+                // Found the request callback, jump out now
+                break;                
+                }
+            }
+            
+        // if a request callback matching the client is found,
+        // complete the request
+        if( p != NULL)
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  Ep0 read request completed to client"));
+            memcpy(p->iBufferStart, iEp0_RxBuf, aCount);
+            p->iError = KErrNone;
+            *(p->iPacketSize) = aCount;
+            p->iRxPackets = 1;
+            *(p->iPacketIndex) = 0;
+            ProcessDataTransferDone(*p);            
+            }
+        else
+            {            
+            __KTRACE_OPT(KUSB, Kern::Printf("  Ep0 read request not found: setting RxExtra vars (Setup)"));
+            iEp0_RxExtraCount = aCount;
+            //iEp0_RxExtraData = ETrue;
+            //iEp0_RxExtraError = aErrCode;
+            iSetupPacketPending = ETrue;
+            
+            // For setup packet,a zero bytes status is always needed
+            iLastError = KErrNotFound;           
+            }
+        }
+    else // if (client == NULL)
+        {
+        // Pil don't know how to deal with non-standard request, stall endpoint
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Ep0 request error: Stalling Ep0"));
+        iConTransferMgr->StallEndpoint(KEp0_In);
+        iLastError = KErrGeneral;
+        }
+    }
+    
+const DBase* DUsbClientController::FindNonStandardRequestClient(TUint8 aPacketTypeDestination,const TUsbcSetup& aPacket)
+    {
+    const DBase* client = NULL;
+    
+    switch (aPacketTypeDestination)
+        { // Recipient
+        case KUsbRequestType_DestDevice:
+            {
+            client = iEp0DeviceControl;
+            }
+            break;
+            
+        case KUsbRequestType_DestIfc:
+            {
+            //Add this mutex to protect the interface set data structure
+            if (NKern::CurrentContext() == EThread)
+                {
+                NKern::FMWait(&iMutex);
+                }
+                
+            if ( iDeviceState < UsbShai::EUsbPeripheralStateConfigured)
+                {
+                __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Invalid device state"));
+                }
+            else
+                {
+                const TUsbcInterfaceSet* const ifcset_ptr =
+                    InterfaceNumber2InterfacePointer(aPacket.iIndex);
+                    
+                //In some rare case, ifcset_ptr is not NULL but the ifcset_ptr->iInterfaces.Count() is 0,
+                //so panic will happen when excute the following line. so I add the conditon
+                //0 != ifcset_ptr->iInterfaces.Count() here.
+                if (ifcset_ptr && 0 != ifcset_ptr->iInterfaces.Count())
+                    {
+                    if (ifcset_ptr->CurrentInterface()->iNoEp0Requests)
+                        {
+                        __KTRACE_OPT(KUSB, Kern::Printf("  Recipient says: NoEp0RequestsPlease"));
+                        }
+                    else
+                        {
+                        client = ifcset_ptr->iClientId;
+                        }
+                    }
+                else
+                    {
+                    __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Interface 0x%02x does not exist",
+                                                      aPacket.iIndex));
+                    }
+                }
+                
+            if (NKern::CurrentContext() == EThread)
+                {
+                NKern::FMSignal(&iMutex);
+                }
+            }
+            break;
+                        
+        case KUsbRequestType_DestEp:
+            {
+            //Add this mutex to protect the interface set data structure
+            if (NKern::CurrentContext() == EThread)
+                {
+                NKern::FMWait(&iMutex);
+                }
+            if ( iDeviceState < UsbShai::EUsbPeripheralStateConfigured)
+                {
+                __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Invalid device state"));
+                }
+            else if (EndpointExists(aPacket.iIndex) == EFalse)
+                {
+                __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Endpoint 0x%02x does not exist",
+                                                  aPacket.iIndex));
+                }
+            else
+                {
+                const TInt idx = EpAddr2Idx(aPacket.iIndex);
+                const TUsbcInterfaceSet* const ifcset_ptr =
+                    iRealEndpoints[idx].iLEndpoint->iInterface->iInterfaceSet;
+                if (ifcset_ptr->CurrentInterface()->iNoEp0Requests)
+                    {
+                    __KTRACE_OPT(KUSB, Kern::Printf("  Recipient says: NoEp0RequestsPlease"));
+                    }
+                else
+                    {
+                    client = ifcset_ptr->iClientId;
+                    }
+                }
+            if (NKern::CurrentContext() == EThread)
+                {
+                NKern::FMSignal(&iMutex);
+                }
+            }
+            break;
+            
+        default:
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Other or Unknown recipient"));
+            break;
+            }
+        }
+        
+    return client;
+    }
+
+TInt DUsbClientController::ProcessSetupEndpointZeroRead()
+    {
+    __KTRACE_OPT(KPANIC, Kern::Printf("DUsbClientController:: Read EP0 Issued"));
+    return iController.SetupEndpointZeroRead();
+    }
+    
+TInt DUsbClientController::ProcessSetupEndpointZeroWrite(const TUint8* aBuffer, TInt aLength, TBool aZlpReqd)
+    {
+    __KTRACE_OPT(KPANIC, Kern::Printf("DUsbClientController:: Write EP0 Issued"));
+    return iController.SetupEndpointZeroWrite(aBuffer,aLength,aZlpReqd);
+    }
+    
+TInt DUsbClientController::ProcessSendEp0ZeroByteStatusPacket()
+    {
+    __KTRACE_OPT(KPANIC, Kern::Printf("DUsbClientController:: Zero Status to EP0 Issued"));
+    return iController.SendEp0ZeroByteStatusPacket();
+    }
+    
+TInt DUsbClientController::ProcessStallEndpoint(TInt aRealEndpoint)
+    {
+    __KTRACE_OPT(KPANIC, Kern::Printf("DUsbClientController:: EP0(%d) Stall Issued",aRealEndpoint));
+    return iController.StallEndpoint(aRealEndpoint);
+    }
+
+void DUsbClientController::ProcessEp0SetupPacketProceed()
+    {
+    __KTRACE_OPT(KPANIC, Kern::Printf("DUsbClientController:: Missed setup packet procced"));
+    iController.Ep0ReadSetupPktProceed();
+    }
+    
+void DUsbClientController::ProcessEp0DataPacketProceed()
+    {
+    __KTRACE_OPT(KPANIC, Kern::Printf("DUsbClientController:: Missed data packet procced"));
+    iController.Ep0ReadDataPktProceed();
+    }
+    
+// -eof-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/pdd/pil/src/controltransfersm.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,604 @@
+/*
+  Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
+  All rights reserved.
+
+  This program and the accompanying materials are made available 
+  under the terms of the Eclipse Public License v1.0 which accompanies 
+  this distribution, and is available at 
+  http://www.eclipse.org/legal/epl-v10.html
+
+  Initial Contributors:
+  Nokia Corporation - initial contribution.
+
+  Contributors:
+*/
+
+#include "controltransfersm.h"
+
+// Bitmap of setup packet
+/*
+Offset 0, bmRequestType, 1 bytes
+    1 Bit-Map
+        D7 Data Phase Transfer Direction
+        0 = Host to Device
+        1 = Device to Host
+    
+        D6..5 Type
+        0 = Standard
+        1 = Class
+        2 = Vendor
+        3 = Reserved
+    
+        D4..0 Recipient
+        0 = Device
+        1 = Interface
+        2 = Endpoint
+        3 = Other
+        4..31 = Reserved
+
+Offset 1, bRequest
+
+Offset 6, Count, 2 bytes
+        Number of bytes to transfer if there is a data phase
+*/
+
+#if defined(_DEBUG)
+
+#define CTSM_ID "ControlTransferSM "
+
+char* DebugName[] = 
+    {
+    "Setup",
+    "Data Out",
+    "Status In",
+    "Data In",
+    "Status Out"
+    };
+    
+#endif
+
+// Static data instance
+TUsbcSetup TSetupPkgParser::iSetupPkt;
+
+TSetupPkgParser::TSetupPkgParser()
+    {
+    iSetupPkt.iRequestType = 0;
+    iSetupPkt.iRequest = 0;
+    
+    iSetupPkt.iValue  = 0;
+    iSetupPkt.iIndex  = 0;
+    iSetupPkt.iLength = 0;
+    }
+
+// Code for TSetupPkgParser
+// we do a bitwise copy here.
+void TSetupPkgParser::Set(const TUint8* aSetupBuf)
+    {
+    // TUint8 index
+    iSetupPkt.iRequestType = static_cast<const TUint8*>(aSetupBuf)[0];
+    iSetupPkt.iRequest = static_cast<const TUint8*>(aSetupBuf)[1];
+    // TUint16 index from here!
+    iSetupPkt.iValue = SWAP_BYTES_16((reinterpret_cast<const TUint16*>(aSetupBuf))[1]);
+    iSetupPkt.iIndex = SWAP_BYTES_16((reinterpret_cast<const TUint16*>(aSetupBuf))[2]);
+    iSetupPkt.iLength = SWAP_BYTES_16((reinterpret_cast<const TUint16*>(aSetupBuf))[3]);
+    
+    __KTRACE_OPT(KUSB, Kern::Printf(CTSM_ID "TSetupPkgParser::Set"));
+    }
+
+// return the next stage by decoding the setup packet 
+// the possible stage followed by a setup packet are:
+//      StatusIn (no data stage)
+//      DataOut  (host sent to peripheral)
+//      DataIn   (peripheral to host)
+UsbShai::TControlStage TSetupPkgParser::NextStage()
+    {
+    UsbShai::TControlStage ret = UsbShai::EControlTransferStageMax;
+    
+    // Take the data length out, 0 length means no data stage
+    if (iSetupPkt.iLength == 0)
+        {
+        ret = UsbShai::EControlTransferStageStatusIn;
+        }
+    else if ((iSetupPkt.iRequestType & KUsbRequestType_DirMask) == KUsbRequestType_DirToDev)
+        {
+        // Dir to device means host will send data out
+        ret = UsbShai::EControlTransferStageDataOut;
+        }
+    else
+        {
+        // Otherwise, there must be a datain stage follows
+        ret = UsbShai::EControlTransferStageDataIn;
+        } 
+    
+    __KTRACE_OPT(KUSB, Kern::Printf(CTSM_ID "TSetupPkgParser::NextStage %d", ret));
+    
+    return ret;
+    }
+
+// Base class of stage sm
+TControlStageSm::TControlStageSm(DControlTransferManager& aTransferMgr):
+    iTransferMgr(aTransferMgr)
+    {    
+    }
+
+void TControlStageSm::ChangeToStage(UsbShai::TControlStage aToStage)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf(CTSM_ID "<> TControlStageSm::ChangeToStage: %s",DebugName[aToStage]));
+    iTransferMgr.iCurrentStage = aToStage;
+    }
+
+void TControlStageSm::ClearPendingRead()
+    {
+    iTransferMgr.iReadPending = EFalse;
+    }
+    
+// Code for DControlTransferManager
+// 
+
+DControlTransferManager::DControlTransferManager(MControlTransferIf& aCtrTransIf):
+    iCtrTransferIf(aCtrTransIf)
+    {    
+    for(int i=0; i<UsbShai::EControlTransferStageMax; i++)
+        {
+        iState[i] = NULL;
+        }
+    
+    Reset();
+    }
+
+TInt DControlTransferManager::SetupEndpointZeroRead()
+    {
+    if(iState[iCurrentStage]->IsRequstAllowed(TControlTransferRequestRead))
+        {
+        if(!iReadPending)
+            {
+            iReadPending = ETrue;
+            return CtrTransferIf().ProcessSetupEndpointZeroRead();
+            }
+        else
+            {
+            // A read operation already on going, ignore this request
+            return KErrNone;
+            }
+        }
+    else
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf(CTSM_ID " !! SetupEndpointZeroRead discard"));
+        return KErrNotReady;
+        }
+    }
+    
+TInt DControlTransferManager::SetupEndpointZeroWrite(const TUint8* aBuffer, TInt aLength, TBool aZlpReqd)
+    {
+    if(iState[iCurrentStage]->IsRequstAllowed(TControlTransferRequestWrite))
+        {
+        return CtrTransferIf().ProcessSetupEndpointZeroWrite(aBuffer,aLength,aZlpReqd);
+        }
+    else
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf(CTSM_ID " !! SetupEndpointZeroWrite discard"));
+        return KErrNotReady;
+        }    
+    }
+    
+TInt DControlTransferManager::SendEp0ZeroByteStatusPacket()
+    {
+     if(iState[iCurrentStage]->IsRequstAllowed(TControlTransferRequestSendStatus))
+        {
+        iCurrentStage = UsbShai::EControlTransferStageSetup;
+        return CtrTransferIf().ProcessSendEp0ZeroByteStatusPacket();
+        }
+    else
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf(CTSM_ID " !! SendEp0ZeroByteStatusPacket discard"));
+        return KErrNotReady;
+        }
+    }
+    
+TInt DControlTransferManager::StallEndpoint(TInt aRealEndpoint)
+    {
+    // Endpoint is stalled, we need to reset our state machine.
+    Reset();
+    return CtrTransferIf().ProcessStallEndpoint(aRealEndpoint);
+    }
+
+void DControlTransferManager::Ep0SetupPacketProceed()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf(CTSM_ID " !! Missed setup packet processed"));
+    CtrTransferIf().ProcessEp0SetupPacketProceed();
+    }
+        
+void DControlTransferManager::Ep0DataPacketProceed()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf(CTSM_ID " !! Missed data packet processed")); 
+    CtrTransferIf().ProcessEp0DataPacketProceed();
+    }
+    
+void DControlTransferManager::Reset()
+    {
+    iCurrentStage = UsbShai::EControlTransferStageSetup;
+    iReadPending = EFalse;
+    }
+    
+void DControlTransferManager::Ep0RequestComplete(TUint8* aBuf, 
+                                             TInt aCount, 
+                                             TInt aError, 
+                                             UsbShai::TControlPacketType aPktType)
+    {   
+    __KTRACE_OPT(KUSB, Kern::Printf(CTSM_ID "> DControlTransferManager::Ep0RequestComplete, packet type: %s", DebugName[aPktType])); 
+    // If a setup packet comes, update our local setup packet buffer first
+    if(aPktType == UsbShai::EControlPacketTypeSetup)
+        {
+        iPacketParser.Set(aBuf);
+        // This is the only place this variable to be reset.
+        iDataTransfered = 0;
+        }
+    
+    // RequestComplete will return ETrue if it can not handle a packet
+    // And it knows that some other sm can handle it.
+    // It will update the state to the one which can hanlde that packet first.        
+    TBool furtherProcessNeeded = ETrue;
+    while(furtherProcessNeeded)
+        {        
+        __KTRACE_OPT(KUSB, Kern::Printf("   We're at Stage:         %s", DebugName[iCurrentStage]));
+        furtherProcessNeeded = iState[iCurrentStage]->RequestComplete(aCount,aError,aPktType);
+        __KTRACE_OPT(KUSB, Kern::Printf("   We're moved to stage:   %s", DebugName[iCurrentStage]));
+        }    
+    
+    __KTRACE_OPT(KUSB, Kern::Printf(CTSM_ID "< DControlTransferManager::Ep0RequestComplete")); 
+    }
+
+// setup the state machine for a state
+void DControlTransferManager::AddState(UsbShai::TControlStage aStage,TControlStageSm& aStageSm)
+    {
+    if( (aStage >= UsbShai::EControlTransferStageSetup) && (aStage < UsbShai::EControlTransferStageMax))
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf(CTSM_ID " AddState(), Stage: %s", DebugName[aStage]));
+        iState[aStage] = &aStageSm;
+        }
+    }
+        
+// *************** Code for SETUP state machines **************************************
+//
+DSetupStageSm::DSetupStageSm(DControlTransferManager& aTransferMgr):
+    TControlStageSm(aTransferMgr)
+    {
+    }
+
+// WE are waiting a SETUP packet
+TBool DSetupStageSm::RequestComplete(TInt aPktSize, TInt aError, UsbShai::TControlPacketType aPktType)
+    {
+    TBool ret = EFalse;
+    
+    __KTRACE_OPT(KUSB, Kern::Printf(CTSM_ID "DSetupStageSm::RequestComplete"));
+    
+    if(aPktType != UsbShai::EControlPacketTypeSetup)
+        {
+        // we just discard any non-setup packet
+        __KTRACE_OPT(KUSB, Kern::Printf(CTSM_ID "ALERT: DSetupStageSm - Non-Setup recieved"));
+        return ret;
+        }
+    
+    // change state to whatever returned from this call.
+    ChangeToStage(iTransferMgr.PktParser().NextStage());
+    
+    // We're going to complete User's read request, consume the previous
+    // read operation
+    ClearPendingRead();
+    
+    // Setup packet are always need to be processed
+    iTransferMgr.CtrTransferIf().ProcessSetupPacket(aPktSize,aError);
+    
+    return EFalse;
+    }
+
+TBool DSetupStageSm::IsRequstAllowed(TControlTransferRequest aRequest)
+    {
+    // Allow user to read, No other operation is allowed
+    TBool ret = (aRequest == TControlTransferRequestRead)?ETrue:EFalse;
+    
+    if( ! ret)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf(CTSM_ID "Warning: request %d was blocked at DSetupStageSm",aRequest));
+        }
+        
+    return ret;
+    }
+
+    
+// *************** Code for DATA IN state machines **************************************
+
+DDataInStageSm::DDataInStageSm(DControlTransferManager& aTransferMgr):
+    TControlStageSm(aTransferMgr)
+    {
+    }
+
+// We are waiting for a competion of DATA IN packet
+TBool DDataInStageSm::RequestComplete(TInt aPktSize, TInt aError, UsbShai::TControlPacketType aPktType)
+    {
+    TInt completionCode = aError;
+    TBool furtherRequest = EFalse;
+    
+    switch(aPktType)
+        {
+        case UsbShai::EControlPacketTypeSetup:
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf(CTSM_ID "ALERT: DDataInStageSm - Setup recieved"));
+            // Something goes wrong, host is abandoning the unfinished control transfer
+            completionCode = KErrGeneral;
+            
+            // Force SM restart at setup stage
+            ChangeToStage(UsbShai::EControlTransferStageSetup);
+            
+            // this packet is partially processed here
+            // need another SM to continue
+            furtherRequest = ETrue;
+            }
+            break;
+            
+        case UsbShai::EControlPacketTypeDataIn:
+            {
+            // PSL notifing us that the data had been sent to host
+            // next step is to wait for the status from Host
+            ChangeToStage(UsbShai::EControlTransferStageStatusOut);
+             
+            // In USB spec, a compete control transfer must inclue a status stage
+            // which is not case in reality,some PSL/Hardware will swallow the
+            // Status out report, so, we just complete client normally.
+            }
+            break;
+            
+        default:
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf(CTSM_ID "ALERT: DDataInStageSm -  %s recieved",DebugName[aPktType]));
+            
+            // Unexpected packet will be discard, and lead us reset state machine
+            // so that we can wait for next SETUP packet.
+            // Of course error will be report to any client if any there.
+            ChangeToStage(UsbShai::EControlTransferStageSetup);
+            completionCode = KErrGeneral;
+            }
+            break;
+        }
+    
+    iTransferMgr.CtrTransferIf().ProcessDataInPacket(aPktSize,completionCode);
+
+    return furtherRequest;
+    }
+
+TBool DDataInStageSm::IsRequstAllowed(TControlTransferRequest aRequest)
+    {
+    // Only write is possible because host is waiting for data from us
+    TBool ret = (aRequest == TControlTransferRequestWrite)?ETrue:EFalse;
+    
+    if( ! ret)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf(CTSM_ID "Warning: request %d was blocked at DDataInStageSm",aRequest));
+        }
+        
+    return ret;
+    };
+    
+// *************** Code for STATUS OUT state machines **************************************
+DStatusOutStageSm::DStatusOutStageSm(DControlTransferManager& aTransferMgr):
+    TControlStageSm(aTransferMgr)
+    {
+    }
+
+// We are waiting for a competion of STATUS OUT or a SETUP packet if PSL or hardware don't
+// complete a status in packet
+TBool DStatusOutStageSm::RequestComplete(TInt aPktSize, TInt aError, UsbShai::TControlPacketType aPktType)
+    {
+    TBool furtherRequest = EFalse;
+    TInt completionCode = aError;
+    
+    switch(aPktType)
+        {
+        case UsbShai::EControlPacketTypeSetup:
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf(CTSM_ID "ALERT: DStatusOutStageSm - Setup recieved"));
+            // hw or PSL may not send back the status packet for a DATA OUT
+            // and we're ok for this, just back to EControlTransferStageSetup stage           
+            
+            // Force SM restart at setup stage
+            ChangeToStage(UsbShai::EControlTransferStageSetup);
+            
+            // this packet is partially processed here
+            // need another SM to continue
+            furtherRequest = ETrue;
+            }
+            break;
+
+        case UsbShai::EControlPacketTypeStatusOut:
+            {
+            // Force SM restart at setup stage
+            ChangeToStage(UsbShai::EControlTransferStageSetup);
+            }
+            break;
+        
+        default:
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf(CTSM_ID "ALERT: DStatusOutStageSm -  %s recieved",DebugName[aPktType]));
+
+            // Unexpected packet will be discard, and lead us reset state machine
+            // so that we can wait for next SETUP packet.
+            // Of course error will be report to any client if any there.            
+            ChangeToStage(UsbShai::EControlTransferStageSetup);
+            completionCode = KErrGeneral;
+            }
+            break;
+        }
+
+    iTransferMgr.CtrTransferIf().ProcessStatusOutPacket(completionCode);
+        
+    return furtherRequest;
+    
+    }
+
+TBool DStatusOutStageSm::IsRequstAllowed(TControlTransferRequest aRequest)
+    {
+    // Read is ok since client don't care the status out stage.
+    // and this lead no hurt to anybody.
+    TBool ret = (aRequest == TControlTransferRequestRead)?ETrue:EFalse;
+    
+    if( ! ret)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf(CTSM_ID "Warning: request %d was blocked at DStatusOutStageSm",aRequest));
+        }
+        
+    return ret;
+    };
+
+// *************** Code for DATA OUT state machines **************************************
+//
+DDataOutStageSm::DDataOutStageSm(DControlTransferManager& aTransferMgr):
+    TControlStageSm(aTransferMgr)
+    {
+    }
+
+TBool DDataOutStageSm::RequestComplete(TInt aPktSize, TInt aError, UsbShai::TControlPacketType aPktType)
+    {
+    TBool furtherRequest = EFalse;
+    TInt completionCode = aError;
+    
+    switch(aPktType)
+        {
+        case UsbShai::EControlPacketTypeSetup:
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf(CTSM_ID "ALERT: DDataOutStageSm - Setup recieved"));
+            // Host is abandon the previous Transfer 
+            completionCode = KErrGeneral;
+            
+            // Force SM restart at setup stage
+            ChangeToStage(UsbShai::EControlTransferStageSetup);
+
+            // this packet is partially processed here
+            // need another SM to continue
+            furtherRequest = ETrue;
+            }
+            break;
+            
+        case UsbShai::EControlPacketTypeDataOut:
+            {
+            iTransferMgr.DataReceived(aPktSize);
+            
+            if(!iTransferMgr.IsMoreBytesNeeded())
+                {
+                // We had recieved enough bytes as indicated by the setup
+                // packet, Data stage is finished. enter STATUS IN state
+                ChangeToStage(UsbShai::EControlTransferStageStatusIn);       
+                }            
+            }
+            break;
+        
+        case UsbShai::EControlPacketTypeStatusIn:
+            {
+            // Status in had been sent to host
+            // return and waiting for new SETUP
+            ChangeToStage(UsbShai::EControlTransferStageSetup);
+            }
+            break;
+            
+        default:
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf(CTSM_ID "ALERT: DDataOutStageSm -  %s recieved",DebugName[aPktType]));
+            
+            // Unexpected packet will be discard, and lead us reset state machine
+            // so that we can wait for next SETUP packet.
+            // Of course error will be report to any client if any there.
+            ChangeToStage(UsbShai::EControlTransferStageSetup);
+            completionCode = KErrGeneral;
+            }
+            break;
+        }
+    
+    ClearPendingRead();
+    iTransferMgr.CtrTransferIf().ProcessDataOutPacket(aPktSize,completionCode);
+    
+    return furtherRequest;
+    }
+
+TBool DDataOutStageSm::IsRequstAllowed(TControlTransferRequest aRequest)
+    {
+    // only read operation is allowed in data out stage.
+    TBool ret = (aRequest == TControlTransferRequestRead)?ETrue:EFalse;
+    
+    if( ! ret)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf(CTSM_ID "Warning: request %d was blocked at DDataOutStageSm",aRequest));
+        }
+        
+    return ret;
+    };
+
+// *************** Code for DATA OUT state machines **************************************
+//
+DStatusInStageSm::DStatusInStageSm(DControlTransferManager& aTransferMgr):
+    TControlStageSm(aTransferMgr)
+    {
+    }
+
+TBool DStatusInStageSm::RequestComplete(TInt aPktSize, TInt aError, UsbShai::TControlPacketType aPktType)
+    {
+    TBool furtherRequest = EFalse;
+    TInt completionCode = KErrNone;
+    
+    switch(aPktType)
+        {
+        case UsbShai::EControlPacketTypeSetup:
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf(CTSM_ID "ALERT: DStatusInStageSm - Setup recieved"));
+            // Status in is an optional for PSL
+            // If we received a setup packet here, we assume the previous
+            // status in packet had been successfully sent to host.
+            
+            // Force SM restart at setup stage
+            ChangeToStage(UsbShai::EControlTransferStageSetup);
+            
+            // this packet is partially processed here
+            // need another SM to continue
+            furtherRequest = ETrue;
+            }
+            break;
+            
+        case UsbShai::EControlPacketTypeStatusIn:
+            {
+            // Status in had been recieved, monitor setup packet then.
+            ChangeToStage(UsbShai::EControlTransferStageSetup);
+            }
+            break;
+            
+        default:
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf(CTSM_ID "ALERT: DStatusInStageSm -  %s recieved",DebugName[aPktType]));
+
+            // Unexpected packet will be discard, and lead us reset state machine
+            // so that we can wait for next SETUP packet.
+            // Of course error will be report to any client if any there.
+            ChangeToStage(UsbShai::EControlTransferStageSetup);
+            completionCode = KErrGeneral;
+            }
+            break;
+        }
+    
+    iTransferMgr.CtrTransferIf().ProcessStatusInPacket(completionCode);
+    
+    return furtherRequest;
+    }
+
+TBool DStatusInStageSm::IsRequstAllowed(TControlTransferRequest aRequest)
+    {
+    // Read is ok even we are wait for the client to send a zero status packet
+    TBool ret = ((aRequest == TControlTransferRequestSendStatus) || 
+                (aRequest == TControlTransferRequestRead))?ETrue:EFalse;
+    
+    if( ! ret)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf(CTSM_ID "Warning: request %d was blocked at DStatusInStageSm",aRequest));
+        }
+        
+    return ret;
+    }
+    
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/pdd/pil/src/descriptors.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,2362 @@
+// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// 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:
+// e32/drivers/usbcc/descriptors.cpp
+// Platform independent layer (PIL) of the USB Device controller driver:
+// USB descriptor handling and management.
+// 
+//
+
+/**
+ @file descriptors.cpp
+ @internalTechnology
+*/
+
+#include <kernel/kern_priv.h>
+// #include <drivers/usbc.h>
+#include <usb/usbc.h>
+
+
+// Debug Support
+static const char KUsbPanicCat[] = "USB PIL";
+
+
+// --- TUsbcDescriptorBase
+
+TUsbcDescriptorBase::TUsbcDescriptorBase()
+    :
+#ifdef USB_SUPPORTS_SET_DESCRIPTOR_REQUEST
+    iIndex(0),
+#endif
+    iBufPtr(NULL, 0)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorBase::TUsbcDescriptorBase()"));
+    }
+
+
+TUsbcDescriptorBase::~TUsbcDescriptorBase()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorBase::~TUsbcDescriptorBase()"));
+    }
+
+
+void TUsbcDescriptorBase::SetByte(TInt aPosition, TUint8 aValue)
+    {
+    iBufPtr[aPosition] = aValue;
+    }
+
+
+void TUsbcDescriptorBase::SetWord(TInt aPosition, TUint16 aValue)
+    {
+    *reinterpret_cast<TUint16*>(&iBufPtr[aPosition]) = SWAP_BYTES_16(aValue);
+    }
+
+
+TUint8 TUsbcDescriptorBase::Byte(TInt aPosition) const
+    {
+    return iBufPtr[aPosition];
+    }
+
+
+TUint16 TUsbcDescriptorBase::Word(TInt aPosition) const
+    {
+    return SWAP_BYTES_16(*reinterpret_cast<const TUint16*>(&iBufPtr[aPosition]));
+    }
+
+
+void TUsbcDescriptorBase::GetDescriptorData(TDes8& aBuffer) const
+    {
+    aBuffer = iBufPtr;
+    }
+
+
+TInt TUsbcDescriptorBase::GetDescriptorData(TUint8* aBuffer) const
+    {
+    memcpy(aBuffer, iBufPtr.Ptr(), Size());
+    return Size();
+    }
+
+
+TInt TUsbcDescriptorBase::GetDescriptorData(TUint8* aBuffer, TUint aMaxSize) const
+    {
+    if (aMaxSize < Size())
+        {
+        // No use to copy only half a descriptor
+        return 0;
+        }
+    return GetDescriptorData(aBuffer);
+    }
+
+
+const TDes8& TUsbcDescriptorBase::DescriptorData() const
+    {
+    return iBufPtr;
+    }
+
+
+TDes8& TUsbcDescriptorBase::DescriptorData()
+    {
+    return iBufPtr;
+    }
+
+
+TUint TUsbcDescriptorBase::Size() const
+    {
+    return iBufPtr.Size();
+    }
+
+
+TUint8 TUsbcDescriptorBase::Type() const
+    {
+    return iBufPtr[1];
+    }
+
+
+void TUsbcDescriptorBase::UpdateFs()
+    {
+    // virtual function can be overridden in derived classes.
+    return;
+    }
+
+
+void TUsbcDescriptorBase::UpdateHs()
+    {
+    // virtual function can be overridden in derived classes.
+    return;
+    }
+
+
+void TUsbcDescriptorBase::SetBufferPointer(const TDesC8& aDes)
+    {
+    iBufPtr.Set(const_cast<TUint8*>(aDes.Ptr()), aDes.Size(), aDes.Size());
+    }
+
+
+// --- TUsbcDeviceDescriptor
+
+TUsbcDeviceDescriptor::TUsbcDeviceDescriptor()
+    : iBuf()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDeviceDescriptor::TUsbcDeviceDescriptor()"));
+    }
+
+
+TUsbcDeviceDescriptor* TUsbcDeviceDescriptor::New(TUint8 aDeviceClass, TUint8 aDeviceSubClass,
+                                                  TUint8 aDeviceProtocol, TUint8 aMaxPacketSize0,
+                                                  TUint16 aVendorId, TUint16 aProductId,
+                                                  TUint16 aDeviceRelease, TUint8 aNumConfigurations)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDeviceDescriptor::New()"));
+    TUsbcDeviceDescriptor* self = new TUsbcDeviceDescriptor();
+    if (self)
+        {
+        if (self->Construct(aDeviceClass, aDeviceSubClass, aDeviceProtocol, aMaxPacketSize0, aVendorId,
+                            aProductId, aDeviceRelease, aNumConfigurations) != KErrNone)
+            {
+            delete self;
+            return NULL;
+            }
+        }
+    return self;
+    }
+
+
+TInt TUsbcDeviceDescriptor::Construct(TUint8 aDeviceClass, TUint8 aDeviceSubClass, TUint8 aDeviceProtocol,
+                                      TUint8 aMaxPacketSize0, TUint16 aVendorId, TUint16 aProductId,
+                                      TUint16 aDeviceRelease, TUint8 aNumConfigurations)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDeviceDescriptor::Construct()"));
+    iBuf.SetMax();
+    SetBufferPointer(iBuf);
+    iBuf[0] = iBuf.Size();                                    // bLength
+    iBuf[1] = KUsbDescType_Device;                            // bDescriptorType
+    SetWord(2, KUsbcUsbVersion);                            // bcdUSB
+    iBuf[4] = aDeviceClass;                                    // bDeviceClass
+    iBuf[5] = aDeviceSubClass;                                // bDeviceSubClass
+    iBuf[6] = aDeviceProtocol;                                // bDeviceProtocol
+    iBuf[7] = aMaxPacketSize0;                                // bMaxPacketSize0
+    SetWord(8, aVendorId);                                    // idVendor
+    SetWord(10, aProductId);                                // idProduct
+    SetWord(12, aDeviceRelease);                            // bcdDevice
+    iBuf[14] = 0;                                            // iManufacturer
+    iBuf[15] = 0;                                            // iProduct
+    iBuf[16] = 0;                                            // iSerialNumber
+    iBuf[17] = aNumConfigurations;                            // bNumConfigurations
+    iEp0Size_Fs = aMaxPacketSize0;
+    return KErrNone;
+    }
+
+
+void TUsbcDeviceDescriptor::UpdateFs()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDeviceDescriptor::UpdateFs()"));
+    SetByte(7, iEp0Size_Fs);                                // bMaxPacketSize0
+    }
+
+
+void TUsbcDeviceDescriptor::UpdateHs()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDeviceDescriptor::UpdateHs()"));
+    SetByte(7, 64);                                            // bMaxPacketSize0
+    }
+
+
+// --- TUsbcDeviceQualifierDescriptor
+
+TUsbcDeviceQualifierDescriptor::TUsbcDeviceQualifierDescriptor()
+    : iBuf()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDeviceDescriptor::TUsbcDeviceQualifierDescriptor()"));
+    }
+
+
+TUsbcDeviceQualifierDescriptor* TUsbcDeviceQualifierDescriptor::New(TUint8 aDeviceClass,
+                                                                    TUint8 aDeviceSubClass,
+                                                                    TUint8 aDeviceProtocol,
+                                                                    TUint8 aMaxPacketSize0,
+                                                                    TUint8 aNumConfigurations,
+                                                                    TUint8 aReserved)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDeviceQualifierDescriptor::New()"));
+    TUsbcDeviceQualifierDescriptor* self = new TUsbcDeviceQualifierDescriptor();
+    if (self)
+        {
+        if (self->Construct(aDeviceClass, aDeviceSubClass, aDeviceProtocol, aMaxPacketSize0,
+                            aNumConfigurations, aReserved) != KErrNone)
+            {
+            delete self;
+            return NULL;
+            }
+        }
+    return self;
+    }
+
+
+TInt TUsbcDeviceQualifierDescriptor::Construct(TUint8 aDeviceClass, TUint8 aDeviceSubClass,
+                                               TUint8 aDeviceProtocol, TUint8 aMaxPacketSize0,
+                                               TUint8 aNumConfigurations, TUint8 aReserved)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDeviceQualifierDescriptor::Construct()"));
+    iBuf.SetMax();
+    SetBufferPointer(iBuf);
+    iBuf[0] = iBuf.Size();                                    // bLength
+    iBuf[1] = KUsbDescType_DeviceQualifier;                    // bDescriptorType
+    SetWord(2, KUsbcUsbVersion);                            // bcdUSB
+    iBuf[4] = aDeviceClass;                                    // bDeviceClass
+    iBuf[5] = aDeviceSubClass;                                // bDeviceSubClass
+    iBuf[6] = aDeviceProtocol;                                // bDeviceProtocol
+    iBuf[7] = aMaxPacketSize0;                                // bMaxPacketSize0
+    iBuf[8] = aNumConfigurations;                            // bNumConfigurations
+    if (aReserved) aReserved = 0;
+    iBuf[9] = aReserved;                                    // Reserved for future use, must be zero
+    iEp0Size_Fs = aMaxPacketSize0;
+    return KErrNone;
+    }
+
+
+void TUsbcDeviceQualifierDescriptor::UpdateFs()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDeviceQualifierDescriptor::UpdateFs()"));
+    // Here we do exactly the opposite of what's done in the Device descriptor (as this one's
+    // documenting the 'other than the current speed').
+    SetByte(7, 64);                                            // bMaxPacketSize0
+    }
+
+
+void TUsbcDeviceQualifierDescriptor::UpdateHs()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDeviceQualifierDescriptor::UpdateHs()"));
+    // Here we do exactly the opposite of what's done in the Device descriptor (as this one's
+    // documenting the 'other than the current speed').
+    SetByte(7, iEp0Size_Fs);                                // bMaxPacketSize0
+    }
+
+
+// --- TUsbcConfigDescriptor
+
+TUsbcConfigDescriptor::TUsbcConfigDescriptor()
+    : iBuf()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcConfigDescriptor::TUsbcConfigDescriptor()"));
+    }
+
+
+TUsbcConfigDescriptor* TUsbcConfigDescriptor::New(TUint8 aConfigurationValue, TBool aSelfPowered,
+                                                  TBool aRemoteWakeup, TUint16 aMaxPower)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcConfigDescriptor::New()"));
+    TUsbcConfigDescriptor* self = new TUsbcConfigDescriptor();
+    if (self)
+        {
+        if (self->Construct(aConfigurationValue, aSelfPowered, aRemoteWakeup, aMaxPower) != KErrNone)
+            {
+            delete self;
+            return NULL;
+            }
+        }
+    return self;
+    }
+
+
+TInt TUsbcConfigDescriptor::Construct(TUint8 aConfigurationValue, TBool aSelfPowered,
+                                       TBool aRemoteWakeup, TUint16 aMaxPower)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcConfigDescriptor::Construct()"));
+    iBuf.SetMax();
+    SetBufferPointer(iBuf);
+    iBuf[0] = iBuf.Size();                                    // bLength
+    iBuf[1] = KUsbDescType_Config;                            // bDescriptorType
+    SetWord(2, KUsbDescSize_Config);                        // wTotalLength
+    iBuf[4] = 0;                                            // bNumInterfaces
+    iBuf[5] = aConfigurationValue;                            // bConfigurationValue
+    iBuf[6] = 0;                                            // iConfiguration
+    iBuf[7] = 0x80 |
+        (aSelfPowered ? KUsbDevAttr_SelfPowered : 0) |
+        (aRemoteWakeup ? KUsbDevAttr_RemoteWakeup : 0);        // bmAttributes (bit 7 always 1)
+    if (aMaxPower > 510)
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Invalid value for bMaxPower: %d", aMaxPower));
+    iBuf[8] = aMaxPower / 2;                                // bMaxPower (2mA units!)
+    return KErrNone;
+    }
+
+
+// --- TUsbcInterfaceDescriptor
+
+TUsbcInterfaceDescriptor::TUsbcInterfaceDescriptor()
+    : iBuf()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcInterfaceDescriptor::TUsbcInterfaceDescriptor()"));
+    }
+
+
+TUsbcInterfaceDescriptor* TUsbcInterfaceDescriptor::New(TUint8 aInterfaceNumber, TUint8 aAlternateSetting,
+                                                        TInt aNumEndpoints, const TUsbcClassInfo& aClassInfo)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcInterfaceDescriptor::New()"));
+    TUsbcInterfaceDescriptor* self = new TUsbcInterfaceDescriptor();
+    if (self)
+        {
+        if (self->Construct(aInterfaceNumber, aAlternateSetting, aNumEndpoints, aClassInfo) != KErrNone)
+            {
+            delete self;
+            return NULL;
+            }
+        }
+    return self;
+    }
+
+
+TInt TUsbcInterfaceDescriptor::Construct(TUint8 aInterfaceNumber, TUint8 aAlternateSetting,
+                                         TInt aNumEndpoints, const TUsbcClassInfo& aClassInfo)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcInterfaceDescriptor::Construct()"));
+    iBuf.SetMax();
+    SetBufferPointer(iBuf);
+    iBuf[0] = iBuf.Size();                                    // bLength
+    iBuf[1] = KUsbDescType_Interface;                        // bDescriptorType
+    iBuf[2] = aInterfaceNumber;                                // bInterfaceNumber
+    iBuf[3] = aAlternateSetting;                            // bAlternateSetting
+    iBuf[4] = aNumEndpoints;                                // bNumEndpoints
+    iBuf[5] = aClassInfo.iClassNum;                            // bInterfaceClass
+    iBuf[6] = aClassInfo.iSubClassNum;                        // bInterfaceSubClass
+    iBuf[7] = aClassInfo.iProtocolNum;                        // bInterfaceProtocol
+    iBuf[8] = 0;                                            // iInterface
+    return KErrNone;
+    }
+
+
+// --- TUsbcEndpointDescriptorBase
+
+TUsbcEndpointDescriptorBase::TUsbcEndpointDescriptorBase()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcEndpointDescriptorBase::TUsbcEndpointDescriptorBase()"));
+    }
+
+
+TInt TUsbcEndpointDescriptorBase::Construct(const TUsbcEndpointInfo& aEpInfo)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcEndpointDescriptorBase::Construct()"));
+    //  Adjust FS/HS endpoint sizes
+    if (aEpInfo.AdjustEpSizes(iEpSize_Fs, iEpSize_Hs) != KErrNone)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Unknown endpoint type: %d", aEpInfo.iType));
+        }
+    __KTRACE_OPT(KUSB, Kern::Printf("  Now set: iEpSize_Fs=%d iEpSize_Hs=%d (aEpInfo.iSize=%d)",
+                                    iEpSize_Fs, iEpSize_Hs, aEpInfo.iSize));
+
+    //  Adjust HS endpoint size for additional transactions
+    if ((aEpInfo.iType == UsbShai::KUsbEpTypeIsochronous) || (aEpInfo.iType == UsbShai::KUsbEpTypeInterrupt))
+        {
+        if ((aEpInfo.iTransactions > 0) && (aEpInfo.iTransactions < 3))
+            {
+            // Bits 12..11 specify the number of additional transactions per microframe
+            iEpSize_Hs |= (aEpInfo.iTransactions << 12);
+            __KTRACE_OPT(KUSB, Kern::Printf("  Adjusted for add. transact.: iEpSize_Hs=0x%02x "
+                                            "(aEpInfo.iTransactions=%d)",
+                                            iEpSize_Hs, aEpInfo.iTransactions));
+            }
+        else if (aEpInfo.iTransactions != 0)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Warning: Invalid iTransactions value: %d (ignored)",
+                                              aEpInfo.iTransactions));
+            }
+        }
+
+    //  Adjust HS polling interval
+    TUsbcEndpointInfo info(aEpInfo);                        // create local writeable copy
+    if (info.AdjustPollInterval() != KErrNone)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Unknown ep type (%d) or invalid interval value (%d)",
+                                          info.iType, info.iInterval));
+        }
+    iInterval_Fs = info.iInterval;
+    iInterval_Hs = info.iInterval_Hs;
+    __KTRACE_OPT(KUSB, Kern::Printf("  Now set: iInterval_Fs=%d iInterval_Hs=%d",
+                                    iInterval_Fs, iInterval_Hs));
+    return KErrNone;
+    }
+
+
+void TUsbcEndpointDescriptorBase::UpdateFs()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcEndpointDescriptorBase::UpdateFs()"));
+    // (TUsbcEndpointDescriptorBase's FS/HS endpoint sizes and interval values got
+    //  adjusted in its Construct() method.)
+    SetWord(4, iEpSize_Fs);                                    // wMaxPacketSize
+    SetByte(6, iInterval_Fs);                                // bInterval
+    }
+
+
+void TUsbcEndpointDescriptorBase::UpdateHs()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcEndpointDescriptorBase::UpdateHs()"));
+    // (TUsbcEndpointDescriptorBase's FS/HS endpoint sizes and interval values get
+    //  adjusted in its Construct() method.)
+    SetWord(4, iEpSize_Hs);                                    // wMaxPacketSize
+    SetByte(6, iInterval_Hs);                                // bInterval
+    }
+
+
+// --- TUsbcEndpointDescriptor
+
+TUsbcEndpointDescriptor::TUsbcEndpointDescriptor()
+    : iBuf()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcEndpointDescriptor::TUsbcEndpointDescriptor()"));
+    }
+
+
+TUsbcEndpointDescriptor* TUsbcEndpointDescriptor::New(TUint8 aEndpointAddress,
+                                                      const TUsbcEndpointInfo& aEpInfo)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcEndpointDescriptor::New()"));
+    TUsbcEndpointDescriptor* self = new TUsbcEndpointDescriptor();
+    if (self)
+        {
+        if (self->Construct(aEndpointAddress, aEpInfo) != KErrNone)
+            {
+            delete self;
+            return NULL;
+            }
+        }
+    return self;
+    }
+
+
+TInt TUsbcEndpointDescriptor::Construct(TUint8 aEndpointAddress, const TUsbcEndpointInfo& aEpInfo)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcEndpointDescriptor::Construct()"));
+    (void) TUsbcEndpointDescriptorBase::Construct(aEpInfo);    // Init Base class
+    iBuf.SetMax();
+    SetBufferPointer(iBuf);
+    iBuf[0] = iBuf.Size();                                    // bLength
+    iBuf[1] = KUsbDescType_Endpoint;                        // bDescriptorType
+    iBuf[2] = aEndpointAddress;                                // bEndpointAddress
+    iBuf[3] = EpTypeMask2Value(aEpInfo.iType);                // bmAttributes
+    SetWord(4, iEpSize_Fs);                                    // wMaxPacketSize (default is FS)
+    iBuf[6] = iInterval_Fs;                                    // bInterval (default is FS)
+    return KErrNone;
+    }
+
+
+// --- TUsbcAudioEndpointDescriptor
+
+TUsbcAudioEndpointDescriptor::TUsbcAudioEndpointDescriptor()
+    : iBuf()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcAudioEndpointDescriptor::TUsbcAudioEndpointDescriptor()"));
+    }
+
+
+TUsbcAudioEndpointDescriptor* TUsbcAudioEndpointDescriptor::New(TUint8 aEndpointAddress,
+                                                                const TUsbcEndpointInfo& aEpInfo)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcAudioEndpointDescriptor::New()"));
+    TUsbcAudioEndpointDescriptor* self = new TUsbcAudioEndpointDescriptor();
+    if (self)
+        {
+        if (self->Construct(aEndpointAddress, aEpInfo) != KErrNone)
+            {
+            delete self;
+            return NULL;
+            }
+        }
+    return self;
+    }
+
+
+TInt TUsbcAudioEndpointDescriptor::Construct(TUint8 aEndpointAddress, const TUsbcEndpointInfo& aEpInfo)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcAudioEndpointDescriptor::Construct()"));
+    (void) TUsbcEndpointDescriptorBase::Construct(aEpInfo);    // Init Base class
+    iBuf.SetMax();
+    SetBufferPointer(iBuf);
+    iBuf[0] = iBuf.Size();                                    // bLength
+    iBuf[1] = KUsbDescType_Endpoint;                        // bDescriptorType
+    iBuf[2] = aEndpointAddress;                                // bEndpointAddress
+    iBuf[3] = EpTypeMask2Value(aEpInfo.iType);                // bmAttributes
+    SetWord(4, iEpSize_Fs);                                    // wMaxPacketSize (default is FS)
+    iBuf[6] = iInterval_Fs;                                    // bInterval (default is FS)
+    iBuf[7] = 0;
+    iBuf[8] = 0;
+    return KErrNone;
+    }
+
+
+// --- TUsbcOtgDescriptor
+
+TUsbcOtgDescriptor* TUsbcOtgDescriptor::New(TBool aHnpSupport, TBool aSrpSupport)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcOtgDescriptor::New()"));
+    TUsbcOtgDescriptor* self = new TUsbcOtgDescriptor();
+    if (self && (self->Construct(aHnpSupport, aSrpSupport) != KErrNone))
+        {
+        delete self;
+        return NULL;
+        }
+    return self;
+    }
+
+
+TUsbcOtgDescriptor::TUsbcOtgDescriptor()
+    : iBuf()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcOtgDescriptor::TUsbcOtgDescriptor()"));
+    }
+
+
+TInt TUsbcOtgDescriptor::Construct(TBool aHnpSupport, TBool aSrpSupport)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcOtgDescriptor::Construct()"));
+    iBuf.SetMax();
+    SetBufferPointer(iBuf);
+    iBuf[0] = iBuf.Size();                                    // bLength
+    iBuf[1] = KUsbDescType_Otg;                                // bDescriptorType
+    iBuf[2] = (aHnpSupport ? KUsbOtgAttr_HnpSupp : 0) |
+        (aSrpSupport ? KUsbOtgAttr_SrpSupp : 0);            // bmAttributes
+    return KErrNone;
+    }
+
+
+// --- TUsbcClassSpecificDescriptor
+
+TUsbcClassSpecificDescriptor::TUsbcClassSpecificDescriptor()
+    : iBuf(NULL)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcClassSpecificDescriptor::TUsbcClassSpecificDescriptor()"));
+    }
+
+
+TUsbcClassSpecificDescriptor::~TUsbcClassSpecificDescriptor()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcClassSpecificDescriptor::~TUsbcClassSpecificDescriptor()"));
+    delete iBuf;
+    }
+
+
+TUsbcClassSpecificDescriptor* TUsbcClassSpecificDescriptor::New(TUint8 aType, TInt aSize)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcClassSpecificDescriptor::New()"));
+    TUsbcClassSpecificDescriptor* self = new TUsbcClassSpecificDescriptor();
+    if (self)
+        {
+        if (self->Construct(aType, aSize) != KErrNone)
+            {
+            delete self;
+            return NULL;
+            }
+        }
+    return self;
+    }
+
+
+TInt TUsbcClassSpecificDescriptor::Construct(TUint8 aType, TInt aSize)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcClassSpecificDescriptor::Construct()"));
+    iBuf = HBuf8::New(aSize);
+    if (!iBuf)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Allocation of CS desc buffer failed"));
+        return KErrNoMemory;
+        }
+    iBuf->SetMax();
+    SetBufferPointer(*iBuf);
+    SetByte(1, aType);                                        // bDescriptorType
+    return KErrNone;
+    }
+
+
+// --- TUsbcStringDescriptorBase
+
+TUsbcStringDescriptorBase::TUsbcStringDescriptorBase()
+    : /*iIndex(0),*/ iSBuf(0), iBufPtr(NULL, 0)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcStringDescriptorBase::TUsbcStringDescriptorBase()"));
+    }
+
+
+TUsbcStringDescriptorBase::~TUsbcStringDescriptorBase()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcStringDescriptorBase::~TUsbcStringDescriptorBase()"));
+    }
+
+
+TUint16 TUsbcStringDescriptorBase::Word(TInt aPosition) const
+    {
+    if (aPosition <= 1)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Word(%d) in string descriptor "
+                                          "(TUsbcStringDescriptorBase::Word)", aPosition));
+        return 0;
+        }
+    else
+        {
+        // since iBufPtr[0] is actually string descriptor byte index 2,
+        // we have to subtract 2 from the absolute position.
+        return SWAP_BYTES_16(*reinterpret_cast<const TUint16*>(&iBufPtr[aPosition - 2]));
+        }
+    }
+
+
+void TUsbcStringDescriptorBase::SetWord(TInt aPosition, TUint16 aValue)
+    {
+    if (aPosition <= 1)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: SetWord(%d) in string descriptor "
+                                          "(TUsbcStringDescriptorBase::SetWord)", aPosition));
+        return;
+        }
+    else
+        {
+        // since iBufPtr[0] is actually string descriptor byte index 2,
+        // we have to subtract 2 from the absolute position.
+        *reinterpret_cast<TUint16*>(&iBufPtr[aPosition - 2]) = SWAP_BYTES_16(aValue);
+        }
+    }
+
+
+TInt TUsbcStringDescriptorBase::GetDescriptorData(TUint8* aBuffer) const
+    {
+    aBuffer[0] = iSBuf[0];
+    aBuffer[1] = iSBuf[1];
+    memcpy(&aBuffer[2], iBufPtr.Ptr(), iBufPtr.Size());
+    return Size();
+    }
+
+
+TInt TUsbcStringDescriptorBase::GetDescriptorData(TUint8* aBuffer, TUint aMaxSize) const
+    {
+    if (aMaxSize < Size())
+        {
+        // No use to copy only half a string
+        return 0;
+        }
+    return GetDescriptorData(aBuffer);
+    }
+
+
+const TDes8& TUsbcStringDescriptorBase::StringData() const
+    {
+    return iBufPtr;
+    }
+
+
+TDes8& TUsbcStringDescriptorBase::StringData()
+    {
+    return iBufPtr;
+    }
+
+
+TUint TUsbcStringDescriptorBase::Size() const
+    {
+    return iSBuf[0];
+    }
+
+
+void TUsbcStringDescriptorBase::SetBufferPointer(const TDesC8& aDes)
+    {
+    iBufPtr.Set(const_cast<TUint8*>(aDes.Ptr()), aDes.Size(), aDes.Size());
+    }
+
+
+// --- TUsbcStringDescriptor
+
+TUsbcStringDescriptor::TUsbcStringDescriptor()
+    : iBuf(NULL)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcStringDescriptor::TUsbcStringDescriptor()"));
+    }
+
+
+TUsbcStringDescriptor::~TUsbcStringDescriptor()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcStringDescriptor::~TUsbcStringDescriptor()"));
+    delete iBuf;
+    }
+
+
+TUsbcStringDescriptor* TUsbcStringDescriptor::New(const TDesC8& aString)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcStringDescriptor::New"));
+    TUsbcStringDescriptor* self = new TUsbcStringDescriptor();
+    if (self)
+        {
+        if (self->Construct(aString) != KErrNone)
+            {
+            delete self;
+            return NULL;
+            }
+        }
+    return self;
+    }
+
+
+TInt TUsbcStringDescriptor::Construct(const TDesC8& aString)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcStringDescriptor::Construct"));
+    iBuf = HBuf8::New(aString.Size());                        // bytes, not UNICODE chars
+    if (!iBuf)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Allocation of string buffer failed"));
+        return KErrNoMemory;
+        }
+    iBuf->SetMax();
+    SetBufferPointer(*iBuf);
+    iBufPtr.Copy(aString);
+    iSBuf.SetMax();
+    iSBuf[0] = iBuf->Size() + 2;                            // Bytes
+    iSBuf[1] = KUsbDescType_String;
+    return KErrNone;
+    }
+
+
+// --- TUsbcLangIdDescriptor
+
+TUsbcLangIdDescriptor::TUsbcLangIdDescriptor()
+    : iBuf(NULL)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcLangIdDescriptor::TUsbcLangIdDescriptor()"));
+    }
+
+
+TUsbcLangIdDescriptor::~TUsbcLangIdDescriptor()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcLangIdDescriptor::~TUsbcLangIdDescriptor()"));
+    }
+
+
+TUsbcLangIdDescriptor* TUsbcLangIdDescriptor::New(TUint16 aLangId)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcLangIdDescriptor::New"));
+    TUsbcLangIdDescriptor* self = new TUsbcLangIdDescriptor();
+    if (self)
+        {
+        if (self->Construct(aLangId) != KErrNone)
+            {
+            delete self;
+            return NULL;
+            }
+        }
+    return self;
+    }
+
+
+TInt TUsbcLangIdDescriptor::Construct(TUint16 aLangId)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcLangIdDescriptor::Construct"));
+    iBuf.SetMax();
+    SetBufferPointer(iBuf);
+    iBufPtr[0] = LowByte(SWAP_BYTES_16(aLangId));            // Language ID value
+    iBufPtr[1] = HighByte(SWAP_BYTES_16(aLangId));
+    iSBuf.SetMax();
+    iSBuf[0] = iBuf.Size() + 2;                                // Bytes
+    iSBuf[1] = KUsbDescType_String;
+    return KErrNone;
+    }
+
+
+// --- TUsbcDescriptorPool
+
+TUsbcDescriptorPool::TUsbcDescriptorPool(TUint8* aEp0_TxBuf)
+//
+//    The constructor for this class.
+//
+    : iDescriptors(), iStrings(), iIfcIdx(0), iEp0_TxBuf(aEp0_TxBuf), iHighSpeed(EFalse)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::TUsbcDescriptorPool()"));
+    }
+
+
+TUsbcDescriptorPool::~TUsbcDescriptorPool()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::~TUsbcDescriptorPool()"));
+    // The destructor of each <class T> object is called before the objects themselves are destroyed.
+    __KTRACE_OPT(KUSB, Kern::Printf("  iDescriptors.Count(): %d", iDescriptors.Count()));
+    iDescriptors.ResetAndDestroy();
+    __KTRACE_OPT(KUSB, Kern::Printf("  iStrings.Count(): %d", iStrings.Count()));
+    iStrings.ResetAndDestroy();
+    }
+
+
+TInt TUsbcDescriptorPool::Init(TUsbcDeviceDescriptor* aDeviceDesc, TUsbcConfigDescriptor* aConfigDesc,
+                               TUsbcLangIdDescriptor* aLangId, TUsbcStringDescriptor* aManufacturer,
+                               TUsbcStringDescriptor* aProduct, TUsbcStringDescriptor* aSerialNum,
+                               TUsbcStringDescriptor* aConfig, TUsbcOtgDescriptor* aOtgDesc)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::Init()"));
+    if (!aDeviceDesc || !aConfigDesc)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: No Device or Config descriptor specified"));
+        return KErrArgument;
+        }
+    for (TInt n = 0; n < KDescPosition_FirstAvailable; n++)
+        {
+        iDescriptors.Append(NULL);
+        }
+    __ASSERT_DEBUG((iDescriptors.Count() == KDescPosition_FirstAvailable),
+                   Kern::Printf("  Error: iDescriptors.Count() (%d) != KDescPosition_FirstAvailable (%d)",
+                                iDescriptors.Count(), KDescPosition_FirstAvailable));
+    iDescriptors[KDescPosition_Device] = aDeviceDesc;
+    iDescriptors[KDescPosition_Config] = aConfigDesc;
+    if (aOtgDesc)
+        {
+        iDescriptors[KDescPosition_Otg] = aOtgDesc;
+        // Update the config descriptor's wTotalLength field
+        UpdateConfigDescriptorLength(KUsbDescSize_Otg);
+        }
+    if (!aLangId)
+        {
+        // USB spec 9.6.7 says: "String index zero for all languages returns a string descriptor
+        // that contains an array of two-byte LANGID codes supported by the device. ...
+        // USB devices that omit all string descriptors must not return an array of LANGID codes."
+        // So if we have at least one string descriptor, we must also have a LANGID descriptor.
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: No LANGID string descriptor specified"));
+        return KErrArgument;
+        }
+    iStrings.Insert(aLangId, KStringPosition_Langid);
+    iStrings.Insert(aManufacturer, KStringPosition_Manufact);
+    iStrings.Insert(aProduct, KStringPosition_Product);
+    iStrings.Insert(aSerialNum, KStringPosition_Serial);
+    iStrings.Insert(aConfig, KStringPosition_Config);
+    __ASSERT_DEBUG((iStrings.Count() == 5),
+                   Kern::Printf("  Error: iStrings.Count() != 5 (%d)", iStrings.Count()));
+#ifdef _DEBUG
+    for (TInt i = KStringPosition_Langid; i <= KStringPosition_Config; i++)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool.iStrings[%d] = 0x%x", i, iStrings[i]));
+        }
+#endif
+    // Set string indices
+    if (aManufacturer)
+        iDescriptors[KDescPosition_Device]->SetByte(KUsbDescStringIndex_Manufact,
+                                                    KStringPosition_Manufact);
+    if (aProduct)
+        iDescriptors[KDescPosition_Device]->SetByte(KUsbDescStringIndex_Product,
+                                                    KStringPosition_Product);
+    if (aSerialNum)
+        iDescriptors[KDescPosition_Device]->SetByte(KUsbDescStringIndex_Serial,
+                                                    KStringPosition_Serial);
+    if (aConfig)
+        iDescriptors[KDescPosition_Config]->SetByte(KUsbDescStringIndex_Config,
+                                                    KStringPosition_Config);
+    return KErrNone;
+    }
+
+
+TInt TUsbcDescriptorPool::InitHs()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::InitHs()"));
+    __ASSERT_DEBUG((iDescriptors.Count() >= KDescPosition_FirstAvailable),
+                   Kern::Printf("  Error: Call Init() first)"));
+
+    TUsbcDeviceQualifierDescriptor* const dq_desc = TUsbcDeviceQualifierDescriptor::New(
+        iDescriptors[KDescPosition_Device]->Byte(4),        // aDeviceClass
+        iDescriptors[KDescPosition_Device]->Byte(5),        // aDeviceSubClass
+        iDescriptors[KDescPosition_Device]->Byte(6),        // aDeviceProtocol
+        iDescriptors[KDescPosition_Device]->Byte(7),        // aMaxPacketSize0
+        iDescriptors[KDescPosition_Device]->Byte(17));        // aNumConfigurations
+    if (!dq_desc)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Memory allocation for dev qualif desc failed."));
+        return KErrGeneral;
+        }
+    iDescriptors[KDescPosition_DeviceQualifier] = dq_desc;
+
+    TUsbcOtherSpeedConfigDescriptor* const osc_desc = TUsbcOtherSpeedConfigDescriptor::New(
+        iDescriptors[KDescPosition_Config]->Byte(5),        // aConfigurationValue
+        iDescriptors[KDescPosition_Config]->Byte(7) & KUsbDevAttr_SelfPowered, // aSelfPowered
+        iDescriptors[KDescPosition_Config]->Byte(7) & KUsbDevAttr_RemoteWakeup,    // aRemoteWakeup
+        iDescriptors[KDescPosition_Config]->Byte(8) * 2);    // aMaxPower (mA)
+    if (!osc_desc)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Memory allocation for other speed conf desc failed."));
+        return KErrGeneral;
+        }
+
+    // We need to set the bDescriptorType field manually, as that's the only one
+    // that differs from a Configuration descriptor.
+    osc_desc->SetByte(1, KUsbDescType_OtherSpeedConfig);
+
+    // Also, initially we set the iConfiguration string index to the same value as
+    // in the Configuration descriptor.
+    osc_desc->SetByte(KUsbDescStringIndex_Config,
+                      iDescriptors[KDescPosition_Config]->Byte(KUsbDescStringIndex_Config));
+
+    iDescriptors[KDescPosition_OtherSpeedConfig] = osc_desc;
+
+    return KErrNone;
+    }
+
+
+TInt TUsbcDescriptorPool::UpdateDescriptorsFs()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::UpdateDescriptorsFs()"));
+    const TInt count = iDescriptors.Count();
+    for (TInt i = KDescPosition_FirstAvailable; i < count; i++)
+        {
+        TUsbcDescriptorBase* const ptr = iDescriptors[i];
+        ptr->UpdateFs();
+        }
+    iHighSpeed = EFalse;
+    return KErrNone;
+    }
+
+
+TInt TUsbcDescriptorPool::UpdateDescriptorsHs()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::UpdateDescriptorsHs()"));
+    const TInt count = iDescriptors.Count();
+    for (TInt i = KDescPosition_FirstAvailable; i < count; i++)
+        {
+        TUsbcDescriptorBase* const ptr = iDescriptors[i];
+        ptr->UpdateHs();
+        }
+    iHighSpeed = ETrue;
+    return KErrNone;
+    }
+
+
+//
+// An error can be indicated by either a return value != KErrNone or by a descriptor size == 0.
+//
+TInt TUsbcDescriptorPool::FindDescriptor(TUint8 aType, TUint8 aIndex, TUint16 aLangid, TInt& aSize) const
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::FindDescriptor()"));
+    TInt result = KErrGeneral;
+    switch (aType)
+        {
+    case KUsbDescType_Device:
+        if (aLangid != 0)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: bad langid: 0x%04x", aLangid));
+            }
+        else if (aIndex > 0)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: bad device index: %d", aIndex));
+            }
+        else
+            {
+            aSize = GetDeviceDescriptor(KDescPosition_Device);
+            result = KErrNone;
+            }
+        break;
+    case KUsbDescType_Config:
+        if (aLangid != 0)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: bad langid: 0x%04x", aLangid));
+            }
+        else if (aIndex > 0)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: bad config index: %d", aIndex));
+            }
+        else
+            {
+            aSize = GetConfigurationDescriptor(KDescPosition_Config);
+            result = KErrNone;
+            }
+        break;
+    case KUsbDescType_DeviceQualifier:
+        if (aLangid != 0)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: bad langid: 0x%04x", aLangid));
+            }
+        else if (aIndex > 0)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: bad device index: %d", aIndex));
+            }
+        else
+            {
+            aSize = GetDeviceDescriptor(KDescPosition_DeviceQualifier);
+            result = KErrNone;
+            }
+        break;
+    case KUsbDescType_OtherSpeedConfig:
+        if (aLangid != 0)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: bad langid: 0x%04x", aLangid));
+            }
+        else if (aIndex > 0)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: bad config index: %d", aIndex));
+            }
+        else
+            {
+            aSize = GetConfigurationDescriptor(KDescPosition_OtherSpeedConfig);
+            result = KErrNone;
+            }
+        break;
+    case KUsbDescType_Otg:
+        aSize = GetOtgDescriptor();
+        result = KErrNone;
+        break;
+    case KUsbDescType_String:
+        if (aIndex == 0)                                    // 0 addresses the LangId array
+            {
+            if (AnyStringDescriptors())
+                {
+                aSize = GetStringDescriptor(aIndex);
+                result = KErrNone;
+                }
+            else
+                {
+                __KTRACE_OPT(KUSB, Kern::Printf("  No string descriptors: not returning LANGID array"));
+                }
+            }
+        else
+            {
+               if (!aLangid)
+                   {
+                   __KTRACE_OPT(KUSB,
+                              Kern::Printf("  Strange: LANGID=0 for a $ descriptor (ignoring LANGID)"));
+                // The USB spec doesn't really say what to do in this case, but as there are host apps
+                // that fail if we return an error here, we choose to ignore the issue.
+                   }
+            else if (aLangid != iStrings[KStringPosition_Langid]->Word(2))
+                {
+                // We have only one (this) language
+                __KTRACE_OPT(KUSB,
+                             Kern::Printf("  Bad LANGID: 0x%04X requested, 0x%04X supported (ignoring LANGID)",
+                                          aLangid, iStrings[KStringPosition_Langid]->Word(2)));
+                // We could return an error here, but rather choose to ignore the discrepancy
+                // (the USB spec is not very clear what to do in such a case anyway).
+                }
+            aSize = GetStringDescriptor(aIndex);
+            result = KErrNone;
+            }
+        break;
+    case KUsbDescType_CS_Interface:
+        /* fall through */
+    case KUsbDescType_CS_Endpoint:
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Warning: finding of class specific descriptors not supported"));
+        break;
+    default:
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: unknown descriptor type requested: %d", aType));
+        break;
+        }
+    return result;
+    }
+
+
+void TUsbcDescriptorPool::InsertDescriptor(TUsbcDescriptorBase* aDesc)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::InsertDescriptor()"));
+    switch (aDesc->Type())
+        {
+    case KUsbDescType_Interface:
+        InsertIfcDesc(aDesc);
+        break;
+    case KUsbDescType_Endpoint:
+        InsertEpDesc(aDesc);
+        break;
+    default:
+        __KTRACE_OPT(KUSB, Kern::Printf("  Error: unsupported descriptor type"));
+        }
+    }
+
+
+void TUsbcDescriptorPool::SetIfcStringDescriptor(TUsbcStringDescriptor* aDesc, TInt aNumber, TInt aSetting)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::SetIfcDescriptor(%d, %d)", aNumber, aSetting));
+    const TInt i = FindIfcDescriptor(aNumber, aSetting);
+    if (i < 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Ifc descriptor not found (%d, %d)",
+                                          aNumber, aSetting));
+        return;
+        }
+    // Try to find available NULL postition
+    TInt str_idx = FindAvailableStringPos();
+    if (str_idx >= 0)
+        {
+        // Insert string descriptor for specified interface
+        ExchangeStringDescriptor(str_idx, aDesc);
+        }
+    else
+        {
+        // No NULL found - expand array
+        str_idx = iStrings.Count();
+        if (str_idx > 0xff)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: $ descriptor array full (idx=%d)", str_idx));
+            return;
+            }
+        while (str_idx < KStringPosition_FirstAvailable)
+            {
+            iStrings.Append(NULL);
+            str_idx = iStrings.Count();
+            }
+        // Append string descriptor for specified interface
+        iStrings.Append(aDesc);
+        }
+    // Update this ifc descriptor's string index field
+    iDescriptors[i]->SetByte(8, str_idx);
+    __KTRACE_OPT(KUSB, Kern::Printf("  String for ifc %d/%d (@ pos %d): \"%S\"", aNumber, aSetting, str_idx,
+                                    &iStrings[str_idx]->StringData()));
+    }
+
+
+void TUsbcDescriptorPool::DeleteIfcDescriptor(TInt aNumber, TInt aSetting)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::DeleteIfcDescriptor(%d, %d)", aNumber, aSetting));
+    const TInt i = FindIfcDescriptor(aNumber, aSetting);
+    if (i < 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: DeleteIfcDescriptor - descriptor not found (%d, %d)",
+                                          aNumber, aSetting));
+        return;
+        }
+    // Delete (if necessary) specified interface's string descriptor
+    const TInt si = iDescriptors[i]->Byte(8);
+    if (si != 0)
+        {
+        ExchangeStringDescriptor(si, NULL);
+        }
+    // Delete specified ifc setting + all its cs descriptors + all its endpoints + all their cs descriptors:
+    // find position of the next interface descriptor: we need to delete everything in between
+    const TInt count = iDescriptors.Count();
+    TInt j = i, n = 1;
+    while (++j < count && iDescriptors[j]->Type() != KUsbDescType_Interface)
+        ++n;
+    DeleteDescriptors(i, n);
+    // Update all the following interfaces' bInterfaceNumber field if required
+    // (because those descriptors might have moved down by one position)
+    UpdateIfcNumbers(aNumber);
+    iIfcIdx = 0;                                            // ifc index no longer valid
+    }
+
+
+// The TC in many of the following functions stands for 'ThreadCopy',
+// because that's what's happening there.
+
+TInt TUsbcDescriptorPool::GetDeviceDescriptorTC(DThread* aThread, TDes8& aBuffer) const
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::GetDeviceDescriptorTC()"));
+    return Kern::ThreadDesWrite(aThread, &aBuffer, iDescriptors[KDescPosition_Device]->DescriptorData(), 0);
+    }
+
+
+TInt TUsbcDescriptorPool::SetDeviceDescriptorTC(DThread* aThread, const TDes8& aBuffer)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::SetDeviceDescriptorTC()"));
+    TBuf8<KUsbDescSize_Device> device;
+    const TInt r = Kern::ThreadDesRead(aThread, &aBuffer, device, 0);
+    if (r != KErrNone)
+        {
+        return r;
+        }
+    iDescriptors[KDescPosition_Device]->SetByte(2, device[2]); // bcdUSB
+    iDescriptors[KDescPosition_Device]->SetByte(3, device[3]); // bcdUSB (part II)
+    iDescriptors[KDescPosition_Device]->SetByte(4, device[4]); // bDeviceClass
+    iDescriptors[KDescPosition_Device]->SetByte(5, device[5]); // bDeviceSubClass
+    iDescriptors[KDescPosition_Device]->SetByte(6, device[6]); // bDeviceProtocol
+    iDescriptors[KDescPosition_Device]->SetByte(8, device[8]); // idVendor
+    iDescriptors[KDescPosition_Device]->SetByte(9, device[9]); // idVendor (part II)
+    iDescriptors[KDescPosition_Device]->SetByte(10, device[10]); // idProduct
+    iDescriptors[KDescPosition_Device]->SetByte(11, device[11]); // idProduct (part II)
+    iDescriptors[KDescPosition_Device]->SetByte(12, device[12]); // bcdDevice
+    iDescriptors[KDescPosition_Device]->SetByte(13, device[13]); // bcdDevice (part II)
+    return KErrNone;
+    }
+
+
+TInt TUsbcDescriptorPool::GetConfigurationDescriptorTC(DThread* aThread, TDes8& aBuffer) const
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::GetConfigurationDescriptorTC()"));
+    return Kern::ThreadDesWrite(aThread, &aBuffer, iDescriptors[KDescPosition_Config]->DescriptorData(), 0);
+    }
+
+
+TInt TUsbcDescriptorPool::SetConfigurationDescriptorTC(DThread* aThread, const TDes8& aBuffer)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::SetConfigurationDescriptorTC()"));
+    TBuf8<KUsbDescSize_Config> config;
+    const TInt r = Kern::ThreadDesRead(aThread, &aBuffer, config, 0);
+    if (r != KErrNone)
+        {
+        return r;
+        }
+    iDescriptors[KDescPosition_Config]->SetByte(7, config[7]); // bmAttributes
+    iDescriptors[KDescPosition_Config]->SetByte(8, config[8]); // bMaxPower
+    return KErrNone;
+    }
+
+
+TInt TUsbcDescriptorPool::GetOtgDescriptorTC(DThread* aThread, TDes8& aBuffer) const
+    {
+    return Kern::ThreadDesWrite(aThread, &aBuffer, iDescriptors[KDescPosition_Otg]->DescriptorData(), 0);
+    }
+
+
+TInt TUsbcDescriptorPool::SetOtgDescriptor(const TDesC8& aBuffer)
+    {
+    iDescriptors[KDescPosition_Otg]->SetByte(2, aBuffer[2]); // bmAttributes
+    return KErrNone;
+    }
+
+
+TInt TUsbcDescriptorPool::GetInterfaceDescriptorTC(DThread* aThread, TDes8& aBuffer,
+                                                   TInt aInterface, TInt aSetting) const
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::GetInterfaceDescriptorTC()"));
+    const TInt i = FindIfcDescriptor(aInterface, aSetting);
+    if (i < 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: no such interface"));
+        return KErrNotFound;
+        }
+    return Kern::ThreadDesWrite(aThread, &aBuffer, iDescriptors[i]->DescriptorData(), 0);
+    }
+
+
+TInt TUsbcDescriptorPool::SetInterfaceDescriptor(const TDes8& aBuffer, TInt aInterface, TInt aSetting)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::SetInterfaceDescriptor()"));
+    const TInt i = FindIfcDescriptor(aInterface, aSetting);
+    if (i < 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: no such interface"));
+        return KErrNotFound;
+        }
+    iDescriptors[i]->SetByte(2, aBuffer[2]);                // bInterfaceNumber
+    iDescriptors[i]->SetByte(5, aBuffer[5]);                // bInterfaceClass
+    iDescriptors[i]->SetByte(6, aBuffer[6]);                // bInterfaceSubClass
+    iDescriptors[i]->SetByte(7, aBuffer[7]);                // bInterfaceProtocol
+    return KErrNone;
+    }
+
+
+TInt TUsbcDescriptorPool::GetEndpointDescriptorTC(DThread* aThread, TDes8& aBuffer,
+                                                  TInt aInterface, TInt aSetting, TUint8 aEndpointAddress) const
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::GetEndpointDescriptorTC()"));
+    const TInt i = FindEpDescriptor(aInterface, aSetting, aEndpointAddress);
+    if (i < 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: no such endpoint"));
+        return KErrNotFound;
+        }
+    return Kern::ThreadDesWrite(aThread, &aBuffer, iDescriptors[i]->DescriptorData(), 0);
+    }
+
+
+TInt TUsbcDescriptorPool::SetEndpointDescriptorTC(DThread* aThread, const TDes8& aBuffer,
+                                                  TInt aInterface, TInt aSetting, TUint8 aEndpointAddress)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::SetEndpointDescriptorTC()"));
+    const TInt i = FindEpDescriptor(aInterface, aSetting, aEndpointAddress);
+    if (i < 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: no such endpoint"));
+        return KErrNotFound;
+        }
+    TBuf8<KUsbDescSize_AudioEndpoint> ep;                    // it could be an audio endpoint
+    const TInt r = Kern::ThreadDesRead(aThread, &aBuffer, ep, 0);
+    if (r != KErrNone)
+        {
+        return r;
+        }
+    iDescriptors[i]->SetByte(3, ep[3]);                        // bmAttributes
+    iDescriptors[i]->SetByte(6, ep[6]);                        // bInterval
+    if (iDescriptors[i]->Size() == KUsbDescSize_AudioEndpoint)
+        {
+        iDescriptors[i]->SetByte(7, ep[7]);                    // bRefresh
+        iDescriptors[i]->SetByte(8, ep[8]);                    // bSynchAddress
+        }
+    return KErrNone;
+    }
+
+
+TInt TUsbcDescriptorPool::GetEndpointDescriptorSize(TInt aInterface, TInt aSetting, TUint8 aEndpointAddress,
+                                                    TInt& aSize) const
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::GetEndpointDescriptorSize()"));
+    const TInt i = FindEpDescriptor(aInterface, aSetting, aEndpointAddress);
+    if (i < 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: no such endpoint"));
+        return KErrNotFound;
+        }
+    aSize = iDescriptors[i]->Size();
+    return KErrNone;
+    }
+
+
+TInt TUsbcDescriptorPool::GetDeviceQualifierDescriptorTC(DThread* aThread, TDes8& aBuffer) const
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::GetDeviceQualifierDescriptorTC()"));
+    if (iDescriptors[KDescPosition_DeviceQualifier] == NULL)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Warning: Device_Qualifier descriptor not supported"));
+        return KErrNotSupported;
+        }
+    return Kern::ThreadDesWrite(aThread, &aBuffer,
+                                iDescriptors[KDescPosition_DeviceQualifier]->DescriptorData(), 0);
+    }
+
+
+TInt TUsbcDescriptorPool::SetDeviceQualifierDescriptorTC(DThread* aThread, const TDes8& aBuffer)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::SetDeviceQualifierDescriptorTC()"));
+    if (iDescriptors[KDescPosition_DeviceQualifier] == NULL)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Warning: Device_Qualifier descriptor not supported"));
+        return KErrNotSupported;
+        }
+    TBuf8<KUsbDescSize_DeviceQualifier> device;
+    const TInt r = Kern::ThreadDesRead(aThread, &aBuffer, device, 0);
+    if (r != KErrNone)
+        {
+        return r;
+        }
+    iDescriptors[KDescPosition_DeviceQualifier]->SetByte(2, device[2]); // bcdUSB
+    iDescriptors[KDescPosition_DeviceQualifier]->SetByte(3, device[3]); // bcdUSB (part II)
+    iDescriptors[KDescPosition_DeviceQualifier]->SetByte(4, device[4]); // bDeviceClass
+    iDescriptors[KDescPosition_DeviceQualifier]->SetByte(5, device[5]); // bDeviceSubClass
+    iDescriptors[KDescPosition_DeviceQualifier]->SetByte(6, device[6]); // bDeviceProtocol
+    return KErrNone;
+    }
+
+
+TInt TUsbcDescriptorPool::GetOtherSpeedConfigurationDescriptorTC(DThread* aThread, TDes8& aBuffer) const
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::GetOtherSpeedConfigurationDescriptorTC()"));
+    if (iDescriptors[KDescPosition_OtherSpeedConfig] == NULL)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Warning: Other_Speed_Configuration descriptor not supported"));
+        return KErrNotSupported;
+        }
+    return Kern::ThreadDesWrite(aThread, &aBuffer,
+                                iDescriptors[KDescPosition_OtherSpeedConfig]->DescriptorData(), 0);
+    }
+
+
+TInt TUsbcDescriptorPool::SetOtherSpeedConfigurationDescriptorTC(DThread* aThread, const TDes8& aBuffer)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::SetOtherSpeedConfigurationDescriptorTC()"));
+    if (iDescriptors[KDescPosition_OtherSpeedConfig] == NULL)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Warning: Other_Speed_Configuration descriptor not supported"));
+        return KErrNotSupported;
+        }
+    TBuf8<KUsbDescSize_OtherSpeedConfig> config;
+    const TInt r = Kern::ThreadDesRead(aThread, &aBuffer, config, 0);
+    if (r != KErrNone)
+        {
+        return r;
+        }
+    iDescriptors[KDescPosition_OtherSpeedConfig]->SetByte(7, config[7]); // bmAttributes
+    iDescriptors[KDescPosition_OtherSpeedConfig]->SetByte(8, config[8]); // bMaxPower
+    return KErrNone;
+    }
+
+
+TInt TUsbcDescriptorPool::GetCSInterfaceDescriptorTC(DThread* aThread, TDes8& aBuffer,
+                                                     TInt aInterface, TInt aSetting) const
+    {
+    // first find the interface
+    TInt i = FindIfcDescriptor(aInterface, aSetting);
+    if (i < 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: no such interface"));
+        return KErrNotFound;
+        }
+    TInt r = KErrNotFound;
+    TInt offset = 0;
+    const TInt count = iDescriptors.Count();
+    while (++i < count && iDescriptors[i]->Type() == KUsbDescType_CS_Interface)
+        {
+        r = Kern::ThreadDesWrite(aThread, &aBuffer,
+                                 iDescriptors[i]->DescriptorData(), offset);
+        if (r != KErrNone)
+            break;
+        offset += iDescriptors[i]->Size();
+        }
+    return r;
+    }
+
+
+TInt TUsbcDescriptorPool::SetCSInterfaceDescriptorTC(DThread* aThread, const TDes8& aBuffer,
+                                                     TInt aInterface, TInt aSetting, TInt aSize)
+    {
+    // First find the interface
+    TInt i = FindIfcDescriptor(aInterface, aSetting);
+    if (i < 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: no such interface"));
+        return KErrNotFound;
+        }
+    // Find a position where to insert the new class specific interface descriptor(s)
+    const TInt count = iDescriptors.Count();
+    while (++i < count && iDescriptors[i]->Type() == KUsbDescType_CS_Interface)
+        ;
+    // Create a new cs descriptor
+    TUsbcClassSpecificDescriptor* desc = TUsbcClassSpecificDescriptor::New(KUsbDescType_CS_Interface, aSize);
+    if (!desc)
+        {
+        return KErrNoMemory;
+        }
+    __KTRACE_OPT(KUSB, Kern::Printf("  inserting descriptor at position %d", i));
+    iDescriptors.Insert(desc, i);
+
+    // Update the config descriptor's wTotalLength field
+    UpdateConfigDescriptorLength(aSize);
+
+    // Copy contents from the user side
+    return Kern::ThreadDesRead(aThread, &aBuffer, iDescriptors[i]->DescriptorData(), 0);
+    }
+
+
+TInt TUsbcDescriptorPool::GetCSInterfaceDescriptorSize(TInt aInterface, TInt aSetting, TInt& aSize) const
+    {
+    // first find the interface
+    TInt i = FindIfcDescriptor(aInterface, aSetting);
+    if (i < 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: no such interface"));
+        return KErrNotFound;
+        }
+    TInt r = KErrNotFound;
+    TInt size = 0;
+    const TInt count = iDescriptors.Count();
+    while (++i < count && iDescriptors[i]->Type() == KUsbDescType_CS_Interface)
+        {
+        size += iDescriptors[i]->Size();
+        r = KErrNone;
+        }
+    if (r == KErrNone)
+        aSize = size;
+    return r;
+    }
+
+
+TInt TUsbcDescriptorPool::GetCSEndpointDescriptorTC(DThread* aThread, TDes8& aBuffer, TInt aInterface,
+                                                    TInt aSetting, TUint8 aEndpointAddress) const
+    {
+    // first find the endpoint
+    TInt i = FindEpDescriptor(aInterface, aSetting, aEndpointAddress);
+    if (i < 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: no such endpoint"));
+        return KErrNotFound;
+        }
+    TInt r = KErrNotFound;
+    TInt offset = 0;
+    const TInt count = iDescriptors.Count();
+    while (++i < count && iDescriptors[i]->Type() == KUsbDescType_CS_Endpoint)
+        {
+        r = Kern::ThreadDesWrite(aThread, &aBuffer,
+                                 iDescriptors[i]->DescriptorData(), offset);
+        if (r != KErrNone)
+            break;
+        offset += iDescriptors[i]->Size();
+        }
+    return r;
+    }
+
+
+TInt TUsbcDescriptorPool::SetCSEndpointDescriptorTC(DThread* aThread, const TDes8& aBuffer, TInt aInterface,
+                                                    TInt aSetting, TUint8 aEndpointAddress, TInt aSize)
+    {
+    // first find the endpoint
+    TInt i = FindEpDescriptor(aInterface, aSetting, aEndpointAddress);
+    if (i < 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: no such endpoint"));
+        return KErrNotFound;
+        }
+    // find a position where to insert the new class specific endpoint descriptor(s)
+    const TInt count = iDescriptors.Count();
+    while (++i < count && iDescriptors[i]->Type() == KUsbDescType_CS_Endpoint)
+        ;
+    // create a new cs descriptor
+    TUsbcClassSpecificDescriptor* desc = TUsbcClassSpecificDescriptor::New(KUsbDescType_CS_Endpoint, aSize);
+    if (!desc)
+        {
+        return KErrNoMemory;
+        }
+    iDescriptors.Insert(desc, i);
+    // update the config descriptor's wTotalLength field
+    UpdateConfigDescriptorLength(aSize);
+    // copy contents from user side
+    return Kern::ThreadDesRead(aThread, &aBuffer, iDescriptors[i]->DescriptorData(), 0);
+    }
+
+
+TInt TUsbcDescriptorPool::GetCSEndpointDescriptorSize(TInt aInterface, TInt aSetting,
+                                                      TUint8 aEndpointAddress, TInt& aSize) const
+    {
+    // first find the endpoint
+    TInt i = FindEpDescriptor(aInterface, aSetting, aEndpointAddress);
+    if (i < 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: no such endpoint"));
+        return KErrNotFound;
+        }
+    TInt r = KErrNotFound;
+    TInt size = 0;
+    const TInt count = iDescriptors.Count();
+    while (++i < count && iDescriptors[i]->Type() == KUsbDescType_CS_Endpoint)
+        {
+        size += iDescriptors[i]->Size();
+        r = KErrNone;
+        }
+    if (r == KErrNone)
+        aSize = size;
+    return r;
+    }
+
+
+TInt TUsbcDescriptorPool::GetStringDescriptorLangIdTC(DThread* aThread, TDes8& aLangId) const
+    {
+    const TUint16 id = iStrings[KStringPosition_Langid]->Word(2);
+    const TPtrC8 id_des(reinterpret_cast<const TUint8*>(&id), sizeof(id));
+    return Kern::ThreadDesWrite(aThread, &aLangId, id_des, 0);
+    }
+
+
+TInt TUsbcDescriptorPool::SetStringDescriptorLangId(TUint16 aLangId)
+    {
+    iStrings[KStringPosition_Langid]->SetWord(2, aLangId);
+    return KErrNone;
+    }
+
+
+TInt TUsbcDescriptorPool::GetManufacturerStringDescriptorTC(DThread* aThread, TDes8& aString) const
+    {
+    return GetDeviceStringDescriptorTC(aThread, aString, KUsbDescStringIndex_Manufact,
+                                       KStringPosition_Manufact);
+    }
+
+
+TInt TUsbcDescriptorPool::SetManufacturerStringDescriptorTC(DThread* aThread, const TDes8& aString)
+    {
+    return SetDeviceStringDescriptorTC(aThread, aString, KUsbDescStringIndex_Manufact,
+                                       KStringPosition_Manufact);
+    }
+
+
+TInt TUsbcDescriptorPool::RemoveManufacturerStringDescriptor()
+    {
+    return RemoveDeviceStringDescriptor(KUsbDescStringIndex_Manufact, KStringPosition_Manufact);
+    }
+
+
+TInt TUsbcDescriptorPool::GetProductStringDescriptorTC(DThread* aThread, TDes8& aString) const
+    {
+    return GetDeviceStringDescriptorTC(aThread, aString, KUsbDescStringIndex_Product,
+                                       KStringPosition_Product);
+    }
+
+
+TInt TUsbcDescriptorPool::SetProductStringDescriptorTC(DThread* aThread, const TDes8& aString)
+    {
+    return SetDeviceStringDescriptorTC(aThread, aString, KUsbDescStringIndex_Product,
+                                       KStringPosition_Product);
+    }
+
+
+TInt TUsbcDescriptorPool::RemoveProductStringDescriptor()
+    {
+    return RemoveDeviceStringDescriptor(KUsbDescStringIndex_Product, KStringPosition_Product);
+    }
+
+
+TInt TUsbcDescriptorPool::GetSerialNumberStringDescriptorTC(DThread* aThread, TDes8& aString) const
+    {
+    return GetDeviceStringDescriptorTC(aThread, aString, KUsbDescStringIndex_Serial,
+                                       KStringPosition_Serial);
+    }
+
+
+TInt TUsbcDescriptorPool::SetSerialNumberStringDescriptorTC(DThread* aThread, const TDes8& aString)
+    {
+    return SetDeviceStringDescriptorTC(aThread, aString, KUsbDescStringIndex_Serial,
+                                       KStringPosition_Serial);
+    }
+
+
+TInt TUsbcDescriptorPool::RemoveSerialNumberStringDescriptor()
+    {
+    return RemoveDeviceStringDescriptor(KUsbDescStringIndex_Serial, KStringPosition_Serial);
+    }
+
+
+TInt TUsbcDescriptorPool::GetConfigurationStringDescriptorTC(DThread* aThread, TDes8& aString) const
+    {
+    const TInt str_idx = iDescriptors[KDescPosition_Config]->Byte(KUsbDescStringIndex_Config);
+    if (str_idx)
+        {
+        __ASSERT_ALWAYS((str_idx == KStringPosition_Config), Kern::Fault(KUsbPanicCat, __LINE__));
+        __KTRACE_OPT(KUSB, Kern::Printf("  String @ pos %d (conf $): \"%S\"",
+                                        str_idx, &iStrings[str_idx]->StringData()));
+        return Kern::ThreadDesWrite(aThread, &aString,
+                                    iStrings[str_idx]->StringData(), 0);
+        }
+    else
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  No config string descriptor @ pos %d", str_idx));
+        return KErrNotFound;
+        }
+    }
+
+
+TInt TUsbcDescriptorPool::SetConfigurationStringDescriptorTC(DThread* aThread, const TDes8& aString)
+    {
+    // we don't know the length of the string, so we have to allocate memory dynamically
+    TUint strlen = Kern::ThreadGetDesLength(aThread, &aString);
+    if (strlen > KUsbStringDescStringMaxSize)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Warning: config $ descriptor too long - will be truncated"));
+        strlen = KUsbStringDescStringMaxSize;
+        }
+    HBuf8* const strbuf = HBuf8::New(strlen);
+    if (!strbuf)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Memory allocation for config $ desc string failed (1)"));
+        return KErrNoMemory;
+        }
+    strbuf->SetMax();
+    // the aString points to data that lives in user memory, so we have to copy it:
+    const TInt r = Kern::ThreadDesRead(aThread, &aString, *strbuf, 0);
+    if (r != KErrNone)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Thread read error"));
+        delete strbuf;
+        return r;
+        }
+    TUsbcStringDescriptor* sd = TUsbcStringDescriptor::New(*strbuf);
+    if (!sd)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Memory allocation for config $ desc failed (2)"));
+        delete strbuf;
+        return KErrNoMemory;
+        }
+    // Delete old string, put in new one
+    ExchangeStringDescriptor(KStringPosition_Config, sd);
+    // Update Config descriptor string index field
+    iDescriptors[KDescPosition_Config]->SetByte(KUsbDescStringIndex_Config, KStringPosition_Config);
+    // Update Other_Speed_Config descriptor string index field as well, if applicable
+    if (iDescriptors[KDescPosition_OtherSpeedConfig])
+        iDescriptors[KDescPosition_OtherSpeedConfig]->SetByte(KUsbDescStringIndex_Config,
+                                                              KStringPosition_Config);
+    delete strbuf;
+    return KErrNone;
+    }
+
+
+TInt TUsbcDescriptorPool::RemoveConfigurationStringDescriptor()
+    {
+    if (iDescriptors[KDescPosition_Config]->Byte(KUsbDescStringIndex_Config) == 0)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  RemoveConfigurationStringDescriptor: no $ desc @ index %d",
+                                        KUsbDescStringIndex_Config));
+        return KErrNotFound;
+        }
+    // Delete old string, put in NULL pointer
+    ExchangeStringDescriptor(KStringPosition_Config, NULL);
+    // Update Config descriptor string index field
+    iDescriptors[KDescPosition_Config]->SetByte(KUsbDescStringIndex_Config, 0);
+    // Update Other_Speed_Config descriptor string index field as well, if applicable
+    if (iDescriptors[KDescPosition_OtherSpeedConfig])
+        iDescriptors[KDescPosition_OtherSpeedConfig]->SetByte(KUsbDescStringIndex_Config, 0);
+    return KErrNone;
+    }
+
+
+TInt TUsbcDescriptorPool::GetStringDescriptorTC(DThread* aThread, TInt aIndex, TDes8& aString) const
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::GetStringDescriptorTC()"));
+    if (!StringDescriptorExists(aIndex))
+        {
+        return KErrNotFound;
+        }
+    __KTRACE_OPT(KUSB, Kern::Printf("  String @ pos %d: \"%S\"",
+                                    aIndex, &iStrings[aIndex]->StringData()));
+    return Kern::ThreadDesWrite(aThread, &aString, iStrings[aIndex]->StringData(), 0);
+    }
+
+
+TInt TUsbcDescriptorPool::SetStringDescriptorTC(DThread* aThread, TInt aIndex, const TDes8& aString)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::SetStringDescriptorTC()"));
+    // we don't know the length of the string, so we have to allocate memory dynamically
+    TUint strlen = Kern::ThreadGetDesLength(aThread, &aString);
+    if (strlen > KUsbStringDescStringMaxSize)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Warning: $ descriptor too long - will be truncated"));
+        strlen = KUsbStringDescStringMaxSize;
+        }
+    HBuf8* strbuf = HBuf8::New(strlen);
+    if (!strbuf)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Mem alloc for $ desc string failed (1)"));
+        return KErrNoMemory;
+        }
+    strbuf->SetMax();
+    // the aString points to data that lives in user memory, so we have to copy it over:
+    const TInt r = Kern::ThreadDesRead(aThread, &aString, *strbuf, 0);
+    if (r != KErrNone)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Thread read error"));
+        delete strbuf;
+        return r;
+        }
+    TUsbcStringDescriptor* const sd = TUsbcStringDescriptor::New(*strbuf);
+    if (!sd)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Mem alloc for $ desc failed (2)"));
+        delete strbuf;
+        return KErrNoMemory;
+        }
+    if (aIndex < iStrings.Count())
+        {
+        ExchangeStringDescriptor(aIndex, sd);
+        }
+    else // if (aIndex >= iStrings.Count())
+        {
+        while (aIndex > iStrings.Count())
+            {
+            iStrings.Append(NULL);
+            }
+        iStrings.Append(sd);
+        }
+    delete strbuf;
+    return KErrNone;
+    }
+
+
+TInt TUsbcDescriptorPool::RemoveStringDescriptor(TInt aIndex)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::RemoveStringDescriptor()"));
+    if (!StringDescriptorExists(aIndex))
+        {
+        return KErrNotFound;
+        }
+    __KTRACE_OPT(KUSB, Kern::Printf("  Removing string @ pos %d: \"%S\"",
+                                    aIndex, &iStrings[aIndex]->StringData()));
+    ExchangeStringDescriptor(aIndex, NULL);
+
+    // Make sure there's no $ after aIndex.
+    const TInt n = iStrings.Count();
+    for (TInt i = aIndex; i < n; i++)
+        {
+        if (iStrings[i] != NULL)
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  Found $ @ idx %d - not compressing", i));
+            return KErrNone;
+            }
+        }
+
+    __KTRACE_OPT(KUSB, Kern::Printf("  No $ found after idx %d - compressing array", aIndex));
+    // Move aIndex back just before the first !NULL element.
+    while (iStrings[--aIndex] == NULL)
+        ;
+    // Let aIndex point to first NULL.
+    aIndex++;
+    __KTRACE_OPT(KUSB, Kern::Printf("  Starting at index %d", aIndex));
+    // Now remove NULL pointers until (Count() == aIndex).
+    __KTRACE_OPT(KUSB, Kern::Printf("  iStrings.Count() before: %d", iStrings.Count()));
+    do
+        {
+        iStrings.Remove(aIndex);
+        __KTRACE_OPT(KUSB, Kern::Printf("  Removing $"));
+        }
+    while (iStrings.Count() > aIndex);
+    __KTRACE_OPT(KUSB, Kern::Printf("  iStrings.Count() after: %d", iStrings.Count()));
+
+    // Regain some memory.
+    iStrings.Compress();
+
+    return KErrNone;
+    }
+
+
+// ===================================================================
+// --- private ---
+// ===================================================================
+
+//
+// Insert an Interface descriptor into the descriptor array at the appropriate index.
+//
+void TUsbcDescriptorPool::InsertIfcDesc(TUsbcDescriptorBase* aDesc)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::InsertIfcDesc()"));
+
+    const TInt count = iDescriptors.Count();
+    TBool ifc_exists = EFalse;                                // set to 'true' if we're adding an alternate
+                                                            // setting to an already existing interface
+    TInt i = KDescPosition_FirstAvailable;
+    while (i < count)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  already descriptors there (%d)...", count));
+        if (iDescriptors[i]->Type() == KUsbDescType_Interface)
+            {
+            if (iDescriptors[i]->Byte(2) > aDesc->Byte(2))
+                {
+                // our interface number is less than the one's just found => insert before it (= here)
+                break;
+                }
+            else if (iDescriptors[i]->Byte(2) == aDesc->Byte(2))
+                {
+                ifc_exists = ETrue;
+                // same interface number => look at settings number
+                if (iDescriptors[i]->Byte(3) > aDesc->Byte(3))
+                    {
+                    // our setting number is less than the one's found => insert before (= here)
+                    break;
+                    }
+                else if (iDescriptors[i]->Byte(3) == aDesc->Byte(3))
+                    {
+                    __KTRACE_OPT(KPANIC, Kern::Printf("  Error: first delete old desc "
+                                                      "(TUsbcDescriptorPool::InsertIfcDesc)"));
+                    return;
+                    }
+                }
+            }
+        ++i;
+        }
+    // In any case: put the new descriptor at position i.
+    __KTRACE_OPT(KUSB, Kern::Printf("  inserting descriptor at position %d", i));
+    iDescriptors.Insert(aDesc, i);
+
+    // Update the config descriptor's wTotalLength field.
+    UpdateConfigDescriptorLength(KUsbDescSize_Interface);
+
+    if (!ifc_exists)
+        {
+        // If this is the first setting for the interface, increment bNumInterfaces.
+        UpdateConfigDescriptorNumIfcs(1);
+        }
+
+    iIfcIdx = i;
+    }
+
+
+//
+// Insert an Endpoint descriptor into the descriptor array at the appropriate index.
+//
+void TUsbcDescriptorPool::InsertEpDesc(TUsbcDescriptorBase* aDesc)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::InsertEpDesc()"));
+    if (iIfcIdx == 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: only after interface "
+                                          "(TUsbcDescriptorPool::InsertEpDesc)"));
+        return;
+        }
+    const TInt count = iDescriptors.Count();
+    TInt i = iIfcIdx + 1;
+    while (i < count)
+        {
+        if (iDescriptors[i]->Type() != KUsbDescType_Endpoint)
+            break;
+        ++i;
+        }
+    // put the new descriptor at position i
+    iDescriptors.Insert(aDesc, i);
+    // update the config descriptor's wTotalLength field
+    UpdateConfigDescriptorLength(aDesc->Size());
+    }
+
+
+//
+// Find the index of the Interface descriptor for a given interface setting.
+//
+TInt TUsbcDescriptorPool::FindIfcDescriptor(TInt aIfcNumber, TInt aIfcSetting) const
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::FindIfcDescriptor(%d, %d)",
+                                    aIfcNumber, aIfcSetting));
+    const TInt count = iDescriptors.Count();
+    for (TInt i = KDescPosition_FirstAvailable; i < count; i++)
+        {
+        if ((iDescriptors[i]->Type() == KUsbDescType_Interface) &&
+            (iDescriptors[i]->Byte(2) == aIfcNumber) &&
+            (iDescriptors[i]->Byte(3) == aIfcSetting))
+            {
+            return i;
+            }
+        }
+    __KTRACE_OPT(KPANIC, Kern::Printf("  Error: no such interface"));
+    return -1;
+    }
+
+
+//
+// Find the index of the Endpoint descriptor for a given endpoint on a given interface setting.
+//
+TInt TUsbcDescriptorPool::FindEpDescriptor(TInt aIfcNumber, TInt aIfcSetting, TUint8 aEpAddress) const
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::FindEpDescriptor(%d, %d, 0x%02x)",
+                                    aIfcNumber, aIfcSetting, aEpAddress));
+    // first find the interface
+    const TInt ifc = FindIfcDescriptor(aIfcNumber, aIfcSetting);
+    if (ifc < 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: no such interface"));
+        return ifc;
+        }
+    const TInt count = iDescriptors.Count();
+    // then, before the next interface, try to locate the endpoint
+    for (TInt i = ifc + 1; i < count; i++)
+        {
+        if (iDescriptors[i]->Type() == KUsbDescType_Interface)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: no such endpoint before next interface"));
+            return -1;
+            }
+        else if ((iDescriptors[i]->Type() == KUsbDescType_Endpoint) &&
+                 (iDescriptors[i]->Byte(2) == aEpAddress))
+            {
+            // found
+            return i;
+            }
+        }
+    __KTRACE_OPT(KPANIC, Kern::Printf("  Error: no such endpoint"));
+    return -1;
+    }
+
+
+//
+// Delete n descriptors starting from aIndex and remove their pointers from the array.
+//
+void TUsbcDescriptorPool::DeleteDescriptors(TInt aIndex, TInt aCount)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::DeleteDescriptors()"));
+    if (aIndex < KDescPosition_FirstAvailable)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: aIndex < KDescPosition_FirstAvailable"));
+        return;
+        }
+    if (aCount <= 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: aCount <= 0"));
+        return;
+        }
+    __KTRACE_OPT(KUSB, Kern::Printf("  Removing descriptors at index %d:", aIndex));
+    // Try to update wTotalLength field in Config descriptor
+    while (aCount--)
+        {
+        // In this loop we don't decrement aIndex, because after deleting an element
+        // aIndex is already indexing the next one.
+        TUsbcDescriptorBase* const ptr = iDescriptors[aIndex];
+        switch (ptr->Type())
+            {
+        case KUsbDescType_Interface:
+            __KTRACE_OPT(KUSB, Kern::Printf("  - an interface descriptor"));
+            UpdateConfigDescriptorLength(-KUsbDescSize_Interface);
+            break;
+        case KUsbDescType_Endpoint:
+            __KTRACE_OPT(KUSB, Kern::Printf("  - an endpoint descriptor"));
+            UpdateConfigDescriptorLength(-ptr->Size());
+            break;
+        case KUsbDescType_CS_Interface:
+            /* fall through */
+        case KUsbDescType_CS_Endpoint:
+            __KTRACE_OPT(KUSB, Kern::Printf("  - a class specific descriptor"));
+            UpdateConfigDescriptorLength(-ptr->Size());
+            break;
+        default:
+            __KTRACE_OPT(KUSB, Kern::Printf("  - an unknown descriptor"));
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: unknown descriptor type"));
+            }
+        iDescriptors.Remove(aIndex);
+        delete ptr;
+        }
+    }
+
+
+//
+// Update the wTotalLength field in the Configuration descriptor (aLength can be negative).
+//
+void TUsbcDescriptorPool::UpdateConfigDescriptorLength(TInt aLength)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::UpdateConfigDescriptorLength(%d)", aLength));
+    TUsbcDescriptorBase* const cnf = iDescriptors[KDescPosition_Config];
+    __KTRACE_OPT(KUSB, Kern::Printf("  wTotalLength old: %d", cnf->Word(2)));
+    // Update Config descriptor
+    cnf->SetWord(2, cnf->Word(2) + aLength);
+    __KTRACE_OPT(KUSB, Kern::Printf("  wTotalLength new: %d", cnf->Word(2)));
+    // Update Other_Speed_Config descriptor as well, if applicable
+    if (iDescriptors[KDescPosition_OtherSpeedConfig])
+        iDescriptors[KDescPosition_OtherSpeedConfig]->SetWord(2, cnf->Word(2));
+    }
+
+
+//
+// Update the bNumInterfaces field in the Configuration descriptor (aNumber can be negative).
+//
+void TUsbcDescriptorPool::UpdateConfigDescriptorNumIfcs(TInt aNumber)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::UpdateConfigDescriptorNumIfcs(%d)", aNumber));
+    TUsbcDescriptorBase* const cnf = iDescriptors[KDescPosition_Config];
+    __KTRACE_OPT(KUSB, Kern::Printf("  bNumInterfaces old: %d", cnf->Byte(4)));
+    const TInt n = cnf->Byte(4) + aNumber;
+    if (n < 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: bNumInterfaces + aNumber < 0"));
+        return;
+        }
+    // Update Config descriptor
+    cnf->SetByte(4, n);
+    __KTRACE_OPT(KUSB, Kern::Printf("  bNumInterfaces new: %d", cnf->Byte(4)));
+    // Update Other_Speed_Config descriptor as well, if applicable
+    if (iDescriptors[KDescPosition_OtherSpeedConfig])
+        iDescriptors[KDescPosition_OtherSpeedConfig]->SetByte(4, n);
+    }
+
+
+//
+// Update the bNumInterfaces field in the Configuration descriptor if necessary.
+//
+void TUsbcDescriptorPool::UpdateIfcNumbers(TInt aNumber)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::UpdateIfcNumbers(%d)", aNumber));
+    const TInt count = iDescriptors.Count();
+    for (TInt i = KDescPosition_FirstAvailable; i < count; i++)
+        {
+        if ((iDescriptors[i]->Type() == KUsbDescType_Interface) &&
+            (iDescriptors[i]->Byte(2) == aNumber))
+            {
+            // there's still an interface with 'number' so we don't need to update anything
+            return;
+            }
+        }
+    // if we haven't returned yet, we decrement bNumInterfaces
+    UpdateConfigDescriptorNumIfcs(-1);
+    }
+
+
+//
+// Put the current Device or Device_Qualifier descriptor in the Ep0 Tx buffer.
+// Only used for Ep0 standard requests, so target buffer can be hard-wired.
+//
+TInt TUsbcDescriptorPool::GetDeviceDescriptor(TInt aIndex) const
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::GetDeviceDescriptor()"));
+    __ASSERT_DEBUG((aIndex == KDescPosition_Device) || (aIndex == KDescPosition_DeviceQualifier),
+                   Kern::Printf("  Error: invalid descriptor index: %d", aIndex));
+    if (iDescriptors[aIndex] == NULL)
+        {
+        // This doesn't have to be an error - we might get asked here for the Device_Qualifier descriptor
+        // on a FS-only device.
+        __KTRACE_OPT(KUSB, Kern::Printf("  Descriptor #%d requested but not available", aIndex));
+        return 0;
+        }
+    return iDescriptors[aIndex]->GetDescriptorData(iEp0_TxBuf, KUsbcBufSz_Ep0Tx);
+    }
+
+
+//
+// Put the current Configuration or Other_Speed_Configuration descriptor + all the following
+// descriptors in the Ep0 Tx buffer.
+// Only used for Ep0 standard requests, so target buffer can be hard-wired.
+//
+TInt TUsbcDescriptorPool::GetConfigurationDescriptor(TInt aIndex) const
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::GetConfigDescriptor(%d)", aIndex));
+    __ASSERT_DEBUG((aIndex == KDescPosition_Config) || (aIndex == KDescPosition_OtherSpeedConfig),
+                   Kern::Printf("  Error: invalid descriptor index: %d", aIndex));
+    if (iDescriptors[aIndex] == NULL)
+        {
+        // This is always an error: We should always have a Configuration descriptor and we should never
+        // get asked for the Other_Speed_Configuration descriptor if we don't have one (9.6.2).
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Warning: Descriptor %d requested but not available", aIndex));
+        return 0;
+        }
+    const TInt count = iDescriptors.Count();
+    TInt copied = 0;
+    TUint8* buf = iEp0_TxBuf;
+    for (TInt i = aIndex; i < count; i++)
+        {
+        TUsbcDescriptorBase* const ptr = iDescriptors[i];
+        if ((aIndex == KDescPosition_OtherSpeedConfig) && (i == KDescPosition_Config))
+            {
+            // Skip Config descriptor when returning Other_Speed_Config
+            continue;
+            }
+        if ((i == KDescPosition_Otg) && (iDescriptors[i] == NULL))
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  no OTG descriptor -> next"));
+            continue;
+            }
+        // We need to edit endpoint descriptors on the fly because we have only one copy
+        // of each and that copy has to contain different information, depending on the
+        // current speed and the type of descriptor requested.
+        if (ptr->Type() == KUsbDescType_Endpoint)
+            {
+            if ((iHighSpeed && (aIndex == KDescPosition_Config)) ||
+                (!iHighSpeed && (aIndex == KDescPosition_OtherSpeedConfig)))
+                {
+                ptr->UpdateHs();
+                }
+            else
+                {
+                ptr->UpdateFs();
+                }
+            }
+        __KTRACE_OPT(KUSB, Kern::Printf("  desc[%02d]: type = 0x%02x size = %d ",
+                                        i, ptr->Type(), ptr->Size()));
+        const TInt size = ptr->GetDescriptorData(buf, KUsbcBufSz_Ep0Tx - copied);
+        if (size == 0)
+            {
+            __KTRACE_OPT(KPANIC,
+                         Kern::Printf("  Error: No Tx buffer space to copy this descriptor -> exiting"));
+            break;
+            }
+        copied += size;
+        if (copied >= KUsbcBufSz_Ep0Tx)
+            {
+            __KTRACE_OPT(KPANIC,
+                         Kern::Printf("  Error: No Tx buffer space left -> stopping here"));
+            break;
+            }
+        buf += size;
+        }
+    __KTRACE_OPT(KUSB, Kern::Printf("  copied %d bytes", copied));
+    return copied;
+    }
+
+
+//
+// Put the current OTG descriptor in the Ep0 Tx buffer.
+// Only used for Ep0 standard requests, so target buffer can be hard-wired.
+//
+TInt TUsbcDescriptorPool::GetOtgDescriptor() const
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::GetOtgDescriptor()"));
+    if (iDescriptors[KDescPosition_Otg] == NULL)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  OTG Descriptor not set"));
+        return 0;
+        }
+    return iDescriptors[KDescPosition_Otg]->GetDescriptorData(iEp0_TxBuf, KUsbcBufSz_Ep0Tx);
+    }
+
+
+//
+// Put a specific String descriptor in the Ep0 Tx buffer.
+// Only used for Ep0 standard requests, so target buffer can be hard-wired.
+//
+TInt TUsbcDescriptorPool::GetStringDescriptor(TInt aIndex) const
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::GetStringDescriptor(%d)", aIndex));
+    // I really would have liked to display the descriptor contents here, but without trailing zero
+    // we got a problem: how can we tell printf where the string ends? We would have to
+    // dynamically allocate memory (since we don't know the size in advance), copy the descriptor
+    // contents there, append a zero, and give this to printf. That's a bit too much effort...
+    if (!StringDescriptorExists(aIndex))
+        {
+        return 0;
+        }
+    return iStrings[aIndex]->GetDescriptorData(iEp0_TxBuf, KUsbcBufSz_Ep0Tx);
+    }
+
+
+//
+// Write a String descriptor pointed to by the Device descriptor to the user side
+// (one of Manufacturer, Product, SerialNumber).
+//
+TInt TUsbcDescriptorPool::GetDeviceStringDescriptorTC(DThread* aThread, TDes8& aString,
+                                                      TInt aIndex, TInt aPosition) const
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::GetDeviceStringDescriptorTC()"));
+    const TInt str_idx = iDescriptors[KDescPosition_Device]->Byte(aIndex);
+    if (str_idx)
+        {
+        __ASSERT_ALWAYS((str_idx == aPosition), Kern::Fault(KUsbPanicCat, __LINE__));
+        __KTRACE_OPT(KUSB, Kern::Printf("  String @ pos %d (device $): \"%S\"",
+                                        str_idx, &iStrings[str_idx]->StringData()));
+        return Kern::ThreadDesWrite(aThread, &aString,
+                                    iStrings[str_idx]->StringData(), 0);
+        }
+    else
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  No string descriptor @ pos %d", aIndex));
+        return KErrNotFound;
+        }
+    }
+
+
+//
+// Read a Device String descriptor from the user side and put in the descriptor arrays
+// (one of Manufacturer, Product, SerialNumber).
+//
+TInt TUsbcDescriptorPool::SetDeviceStringDescriptorTC(DThread* aThread, const TDes8& aString,
+                                                      TInt aIndex, TInt aPosition)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::SetDeviceStringDescriptorTC()"));
+    // we don't know the length of the string, so we have to allocate memory dynamically
+    TUint strlen = Kern::ThreadGetDesLength(aThread, &aString);
+    if (strlen > KUsbStringDescStringMaxSize)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Warning: $ descriptor too long - will be truncated"));
+        strlen = KUsbStringDescStringMaxSize;
+        }
+    HBuf8* const strbuf = HBuf8::New(strlen);
+    if (!strbuf)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Memory allocation for dev $ desc string failed (1)"));
+        return KErrNoMemory;
+        }
+    strbuf->SetMax();
+    // the aString points to data that lives in user memory, so we have to copy it:
+    const TInt r = Kern::ThreadDesRead(aThread, &aString, *strbuf, 0);
+    if (r != KErrNone)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Thread read error"));
+        delete strbuf;
+        return r;
+        }
+    TUsbcStringDescriptor* const sd = TUsbcStringDescriptor::New(*strbuf);
+    if (!sd)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Memory allocation for dev $ desc failed (2)"));
+        delete strbuf;
+        return KErrNoMemory;
+        }
+    ExchangeStringDescriptor(aPosition, sd);
+    iDescriptors[KDescPosition_Device]->SetByte(aIndex, aPosition);
+    delete strbuf;
+    return r;
+    }
+
+
+//
+// Remove a Device String descriptor from the descriptor arrays
+// (one of Manufacturer, Product, SerialNumber).
+//
+TInt TUsbcDescriptorPool::RemoveDeviceStringDescriptor(TInt aIndex, TInt aPosition)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::RemoveDeviceStringDescriptor()"));
+    if (iDescriptors[KDescPosition_Device]->Byte(aIndex) == 0)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  RemoveDeviceStringDescriptor: no $ desc @ index %d", aIndex));
+        return KErrNotFound;
+        }
+    ExchangeStringDescriptor(aPosition, NULL);
+    iDescriptors[KDescPosition_Device]->SetByte(aIndex, 0);
+    return KErrNone;
+    }
+
+
+//
+// Puts aDesc at postion aIndex in the string descriptor array, after deleting what was (possibly) there.
+//
+void TUsbcDescriptorPool::ExchangeStringDescriptor(TInt aIndex, const TUsbcStringDescriptor* aDesc)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::ExchangeStringDescriptor()"));
+    TUsbcStringDescriptorBase* const ptr = iStrings[aIndex];
+    __KTRACE_OPT(KUSB, Kern::Printf("  Deleting string descriptor at index %d: 0x%x", aIndex, ptr));
+    iStrings.Remove(aIndex);
+    delete ptr;
+    __KTRACE_OPT(KUSB, Kern::Printf("  Inserting string descriptor at index %d: 0x%x", aIndex, aDesc));
+    iStrings.Insert(aDesc, aIndex);
+    }
+
+
+//
+// Checks whether there are any string descriptors in the array (apart from LangID).
+//
+TBool TUsbcDescriptorPool::AnyStringDescriptors() const
+    {
+    const TInt n = iStrings.Count();
+    for (TInt i = 1; i < n; i++)
+        {
+        if (iStrings[i] != NULL)
+            return ETrue;
+        }
+    return EFalse;
+    }
+
+
+//
+// Returns true if aIndex exists and what is at that positition is not a NULL pointer.
+//
+TBool TUsbcDescriptorPool::StringDescriptorExists(TInt aIndex) const
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::StringDescriptorExists()"));
+    if (aIndex >= iStrings.Count())
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Bad string index: %d", aIndex));
+        return EFalse;
+        }
+    else if (iStrings[aIndex] == NULL)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: No $ descriptor @ pos %d", aIndex));
+        return EFalse;
+        }
+    return ETrue;
+    }
+
+
+//
+//
+//
+TInt TUsbcDescriptorPool::FindAvailableStringPos() const
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcDescriptorPool::FindAvailableStringPos()"));
+    const TInt n = iStrings.Count();
+    // We don't start from 0 because the first few locations are 'reserved'.
+    for (TInt i = KStringPosition_FirstAvailable; i < n; i++)
+        {
+        if (iStrings[i] == NULL)
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf(" Found available NULL position: %d", i));
+            return i;
+            }
+        }
+    return -1;
+    }
+
+
+// -eof-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/pdd/pil/src/misc.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,413 @@
+// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// 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:
+// e32/drivers/usbcc/misc.cpp
+// Platform independent layer (PIL) of the USB Device controller driver:
+// Implementations of misc. classes defined in usbc.h.
+// 
+//
+
+/**
+ @file misc.cpp
+ @internalTechnology
+*/
+// #include <drivers/usbc.h>
+#include <usb/usbc.h>
+
+
+/** Helper function for logical endpoints and endpoint descriptors:
+    Split single Ep size into separate FS/HS sizes.
+    This function modifies its arguments.
+ */
+TInt TUsbcEndpointInfo::AdjustEpSizes(TInt& aEpSize_Fs, TInt& aEpSize_Hs) const
+    {
+    if (iType == UsbShai::KUsbEpTypeBulk)
+        {
+        // FS: [8|16|32|64] HS: 512
+        if (iSize < 64)
+            {
+            aEpSize_Fs = iSize;
+            }
+        else
+            {
+            aEpSize_Fs = 64;
+            }
+        aEpSize_Hs = 512;
+        }
+    else if (iType == UsbShai::KUsbEpTypeInterrupt)
+        {
+        // FS: [0..64] HS: [0..1024]
+        if (iSize < 64)
+            {
+            aEpSize_Fs = iSize;
+            }
+        else
+            {
+            aEpSize_Fs = 64;
+            }
+        aEpSize_Hs = iSize;
+        }
+    else if (iType == UsbShai::KUsbEpTypeIsochronous)
+        {
+        // FS: [0..1023] HS: [0..1024]
+        if (iSize < 1023)
+            {
+            aEpSize_Fs = iSize;
+            }
+        else
+            {
+            aEpSize_Fs = 1023;
+            }
+        aEpSize_Hs = iSize;
+        }
+    else if (iType == UsbShai::KUsbEpTypeControl)
+        {
+        // FS: [8|16|32|64] HS: 64
+        if (iSize < 64)
+            {
+            aEpSize_Fs = iSize;
+            }
+        else
+            {
+            aEpSize_Fs = 64;
+            }
+        aEpSize_Hs = 64;
+        }
+    else
+        {
+        aEpSize_Fs = aEpSize_Hs = 0;
+        return KErrGeneral;
+        }
+
+    // For the reason of the following checks see Table 9-14. "Allowed wMaxPacketSize
+    // Values for Different Numbers of Transactions per Microframe".
+    if ((iType == UsbShai::KUsbEpTypeInterrupt) || (iType == UsbShai::KUsbEpTypeIsochronous))
+        {
+        if (iTransactions == 1)
+            {
+            if (aEpSize_Hs < 513)
+                {
+                __KTRACE_OPT(KPANIC, Kern::Printf("  Warning: Ep size too small: %d < 513. Correcting...",
+                                                  aEpSize_Hs));
+                aEpSize_Hs = 513;
+                }
+            }
+        else if (iTransactions == 2)
+            {
+            if (aEpSize_Hs < 683)
+                {
+                __KTRACE_OPT(KPANIC, Kern::Printf("  Warning: Ep size too small: %d < 683. Correcting...",
+                                                  aEpSize_Hs));
+                aEpSize_Hs = 683;
+                }
+            }
+        }
+    return KErrNone;
+    }
+
+
+/** Helper function for logical endpoints and endpoint descriptors:
+    If not set, assign a valid and meaningful value to iInterval_Hs, deriving from iInterval.
+    This function modifies the objects's data member(s).
+ */
+TInt TUsbcEndpointInfo::AdjustPollInterval()
+    {
+    if (iInterval_Hs != -1)
+        {
+        // Already done.
+        return KErrNone;
+        }
+    if ((iType == UsbShai::KUsbEpTypeBulk) || (iType == UsbShai::KUsbEpTypeControl))
+        {
+        // Valid range: 0..255 (maximum NAK rate).
+        // (The host controller will probably ignore this value though -
+        //  see the last sentence of section 9.6.6 for details.)
+        iInterval_Hs = 255;
+        }
+    else if (iType == UsbShai::KUsbEpTypeInterrupt)
+        {
+        // HS interval = 2^(iInterval_Hs-1) with a valid iInterval_Hs range of 1..16.
+        // The following table shows the mapping of HS values to actual intervals (and
+        // thus FS values) for the range of possible FS values (1..255).
+        // There is not always a 1:1 mapping possible, but we want at least to make sure
+        // that the HS polling interval is never longer than the FS one (except for 255).
+        //
+        // 1 = 1
+        // 2 = 2
+        // 3 = 4
+        // 4 = 8
+        // 5 = 16
+        // 6 = 32
+        // 7 = 64
+        // 8 = 128
+        // 9 = 256
+        if (iInterval == 255)
+            iInterval_Hs = 9;
+        else if (iInterval >= 128)
+            iInterval_Hs = 8;
+        else if (iInterval >= 64)
+            iInterval_Hs = 7;
+        else if (iInterval >= 32)
+            iInterval_Hs = 6;
+        else if (iInterval >= 16)
+            iInterval_Hs = 5;
+        else if (iInterval >= 8)
+            iInterval_Hs = 4;
+        else if (iInterval >= 4)
+            iInterval_Hs = 3;
+        else if (iInterval >= 2)
+            iInterval_Hs = 2;
+        else if (iInterval == 1)
+            iInterval_Hs = 1;
+        else
+            {
+            // iInterval wasn't set properly by the user
+            iInterval_Hs = 1;
+            return KErrGeneral;
+            }
+        }
+    else if (iType == UsbShai::KUsbEpTypeIsochronous)
+        {
+        // Interpretation is the same for FS and HS.
+        iInterval_Hs = iInterval;
+        }
+    else
+        {
+        // '1' is a valid value for all endpoint types...
+        iInterval_Hs = 1;
+        return KErrGeneral;
+        }
+    return KErrNone;
+    }
+
+
+TUsbcPhysicalEndpoint::TUsbcPhysicalEndpoint()
+    : iEndpointAddr(0), iIfcNumber(NULL), iLEndpoint(NULL), iSettingReserve(EFalse), iHalt(EFalse)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcPhysicalEndpoint::TUsbcPhysicalEndpoint"));
+    }
+
+
+TInt TUsbcPhysicalEndpoint::TypeAvailable(TUint aType) const
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcPhysicalEndpoint::TypeAvailable"));
+    switch (aType)
+        {
+    case UsbShai::KUsbEpTypeControl:
+        return (iCaps.iTypesAndDir & UsbShai::KUsbEpTypeControl);
+    case UsbShai::KUsbEpTypeIsochronous:
+        return (iCaps.iTypesAndDir & UsbShai::KUsbEpTypeIsochronous);
+    case UsbShai::KUsbEpTypeBulk:
+        return (iCaps.iTypesAndDir & UsbShai::KUsbEpTypeBulk);
+    case UsbShai::KUsbEpTypeInterrupt:
+        return (iCaps.iTypesAndDir & UsbShai::KUsbEpTypeInterrupt);
+    default:
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: invalid EP type: %d", aType));
+        return 0;
+        }
+    }
+
+
+TInt TUsbcPhysicalEndpoint::DirAvailable(TUint aDir) const
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcPhysicalEndpoint::DirAvailable"));
+    switch (aDir)
+        {
+    case UsbShai::KUsbEpDirIn:
+        return (iCaps.iTypesAndDir & UsbShai::KUsbEpDirIn);
+    case UsbShai::KUsbEpDirOut:
+        return (iCaps.iTypesAndDir & UsbShai::KUsbEpDirOut);
+    default:
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: invalid EP direction: %d", aDir));
+        return 0;
+        }
+    }
+
+
+TInt TUsbcPhysicalEndpoint::EndpointSuitable(const TUsbcEndpointInfo* aEpInfo, TInt aIfcNumber) const
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcPhysicalEndpoint::EndpointSuitable"));
+    __KTRACE_OPT(KUSB, Kern::Printf("  looking for EP: type=0x%x dir=0x%x size=%d (ifc_num=%d)",
+                                    aEpInfo->iType, aEpInfo->iDir, aEpInfo->iSize, aIfcNumber));
+    if (iSettingReserve)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  -> setting conflict"));
+        return 0;
+        }
+    // (aIfcNumber == -1) means the ep is for a new default interface setting
+    else if (iIfcNumber && (*iIfcNumber != aIfcNumber))
+        {
+        // If this endpoint has already been claimed (iIfcNumber != NULL),
+        // but by a different interface(-set) than the currently looking one
+        // (*iIfcNumber != aIfcNumber), then it's not available.
+        // This works because we can assign the same physical endpoint
+        // to different alternate settings of the *same* interface, and
+        // because we check for available endpoints for every alternate setting
+        // as a whole.
+        __KTRACE_OPT(KUSB, Kern::Printf("  -> ifc conflict"));
+        return 0;
+        }
+    else if (!TypeAvailable(aEpInfo->iType))
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  -> type conflict"));
+        return 0;
+        }
+    else if (!DirAvailable(aEpInfo->iDir))
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  -> direction conflict"));
+        return 0;
+        }
+    else if (!(iCaps.iSizes & PacketSize2Mask(aEpInfo->iSize)) && !(iCaps.iSizes & UsbShai::KUsbEpSizeCont))
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  -> size conflict"));
+        return 0;
+        }
+    else
+        return 1;
+    }
+
+
+TUsbcPhysicalEndpoint::~TUsbcPhysicalEndpoint()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcPhysicalEndpoint::~TUsbcPhysicalEndpoint()"));
+    iLEndpoint = NULL;
+    }
+
+
+TUsbcLogicalEndpoint::TUsbcLogicalEndpoint(DUsbClientController* aController, TUint aEndpointNum,
+                                           const TUsbcEndpointInfo& aEpInfo, TUsbcInterface* aInterface,
+                                           TUsbcPhysicalEndpoint* aPEndpoint)
+    : iController(aController), iLEndpointNum(aEndpointNum), iInfo(aEpInfo), iInterface(aInterface),
+      iPEndpoint(aPEndpoint)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcLogicalEndpoint::TUsbcLogicalEndpoint()"));
+    //  Adjust FS/HS endpoint sizes
+    if (iInfo.AdjustEpSizes(iEpSize_Fs, iEpSize_Hs) != KErrNone)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Unknown endpoint type: %d", iInfo.iType));
+        }
+    __KTRACE_OPT(KUSB, Kern::Printf("  Now set: iEpSize_Fs=%d iEpSize_Hs=%d (iInfo.iSize=%d)",
+                                    iEpSize_Fs, iEpSize_Hs, iInfo.iSize));
+    //  Adjust HS polling interval
+    if (iInfo.AdjustPollInterval() != KErrNone)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Unknown ep type (%d) or invalid interval value (%d)",
+                                          iInfo.iType, iInfo.iInterval));
+        }
+    __KTRACE_OPT(KUSB, Kern::Printf("  Now set: iInfo.iInterval=%d iInfo.iInterval_Hs=%d",
+                                    iInfo.iInterval, iInfo.iInterval_Hs));
+    // Additional transactions requested on a non High Bandwidth ep?
+    if ((iInfo.iTransactions > 0) && !aPEndpoint->iCaps.iHighBandwidth)
+        {
+        __KTRACE_OPT(KPANIC,
+                     Kern::Printf("  Warning: Additional transactions requested but not a High Bandwidth ep"));
+        }
+    }
+
+
+TUsbcLogicalEndpoint::~TUsbcLogicalEndpoint()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcLogicalEndpoint::~TUsbcLogicalEndpoint: #%d", iLEndpointNum));
+    // If the real endpoint this endpoint points to is also used by
+    // any other logical endpoint in any other setting of this interface
+    // then we leave the real endpoint marked as used. Otherwise we mark
+    // it as available (set its ifc number pointer to NULL).
+    const TInt n = iInterface->iInterfaceSet->iInterfaces.Count();
+    for (TInt i = 0; i < n; ++i)
+        {
+        const TUsbcInterface* const ifc = iInterface->iInterfaceSet->iInterfaces[i];
+        const TInt m = ifc->iEndpoints.Count();
+        for (TInt j = 0; j < m; ++j)
+            {
+            const TUsbcLogicalEndpoint* const ep = ifc->iEndpoints[j];
+            if ((ep->iPEndpoint == iPEndpoint) && (ep != this))
+                {
+                __KTRACE_OPT(KUSB, Kern::Printf("  Physical endpoint still in use -> we leave it as is"));
+                return;
+                }
+            }
+        }
+    __KTRACE_OPT(KUSB, Kern::Printf("  Closing DMA channel"));
+    const TInt idx = iController->EpAddr2Idx(iPEndpoint->iEndpointAddr);
+    // If the endpoint doesn't support DMA (now or ever) the next operation will be a no-op.
+    // iController->CloseDmaChannel(idx);
+    __KTRACE_OPT(KUSB, Kern::Printf("  Setting physical ep 0x%02x ifc number to NULL (was %d)",
+                                    iPEndpoint->iEndpointAddr, *iPEndpoint->iIfcNumber));
+    iPEndpoint->iIfcNumber = NULL;
+    }
+
+
+TUsbcInterface::TUsbcInterface(TUsbcInterfaceSet* aIfcSet, TUint8 aSetting, TBool aNoEp0Requests)
+    : iEndpoints(2), iInterfaceSet(aIfcSet), iSettingCode(aSetting), iNoEp0Requests(aNoEp0Requests)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcInterface::TUsbcInterface()"));
+    }
+
+
+TUsbcInterface::~TUsbcInterface()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcInterface::~TUsbcInterface()"));
+    iEndpoints.ResetAndDestroy();
+    }
+
+
+TUsbcInterfaceSet::TUsbcInterfaceSet(const DBase* aClientId, TUint8 aIfcNum)
+    : iInterfaces(2), iClientId(aClientId), iInterfaceNumber(aIfcNum), iCurrentInterface(0)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcInterfaceSet::TUsbcInterfaceSet()"));
+    }
+
+
+TUsbcInterfaceSet::~TUsbcInterfaceSet()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcInterfaceSet::~TUsbcInterfaceSet()"));
+    iInterfaces.ResetAndDestroy();
+    }
+
+
+TUsbcConfiguration::TUsbcConfiguration(TUint8 aConfigVal)
+    : iInterfaceSets(1), iConfigValue(aConfigVal)            // iInterfaceSets(1): granularity
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcConfiguration::TUsbcConfiguration()"));
+    }
+
+
+TUsbcConfiguration::~TUsbcConfiguration()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("TUsbcConfiguration::~TUsbcConfiguration()"));
+    iInterfaceSets.ResetAndDestroy();
+    }
+
+
+_LIT(KDriverName, "Usbcc");
+
+DUsbcPowerHandler::DUsbcPowerHandler(DUsbClientController* aController)
+    : DPowerHandler(KDriverName), iController(aController)
+    {}
+
+
+void DUsbcPowerHandler::PowerUp()
+    {
+    if (iController)
+        iController->iPowerUpDfc.Enque();
+    }
+
+
+void DUsbcPowerHandler::PowerDown(TPowerState)
+    {
+    if (iController)
+        iController->iPowerDownDfc.Enque();
+    }
+
+
+// -eof-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/pdd/pil/src/ps_usbc.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,4832 @@
+// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// 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:
+// e32/drivers/usbcc/ps_usbc.cpp
+// Platform independent layer (PIL) of the USB Device controller driver (PDD).
+// Interface to the USB LDD.
+// 
+//
+
+/**
+ @file ps_usbc.cpp
+ @internalTechnology
+*/
+//#include <drivers/usbc.h>
+#include <usb/usbc.h>
+
+#include "controltransfersm.h"
+/**
+    TUsbcInterfaceSet and TUsbcInterface
+    ====================================
+
+    TUsbcInterfaceSet represents a 'USB Interface' and TUsbcInterface
+    represents an 'Alternate Setting of a USB Interface'.
+
+    Since every LDD governs exactly one interface, the above distinction is
+    made only within the USB implementation. At the LDD API, there is/are
+    simply one or more settings for this single interface, numbered from '0'
+    (the default) to 'n', and specified by the parameter 'TInt aInterfaceNum'.
+
+    Within the PDD implementation, for a TUsbcInterfaceSet number the parameter
+    'TInt aIfcSet' is used (local variable ifcset); for a TUsbcInterface number
+    the parameter 'TInt aIfc' is used (local variable ifc).
+
+
+    iConfigs[0] and CurrentConfig()
+    ===============================
+
+    One problem with this file is that it always uses iConfigs[0] and not
+    CurrentConfig(). This is mainly because the API to the LDD doesn't know
+    about the concept of multiple configurations, and thus always assumes one
+    single configuration (which is also always active: a further problem).
+
+    In the file chapter9.cpp this issue doesn't exist, since there we always
+    have to obey the USB protocol, and in this way will use the configuration
+    which is selected by the host (which will then again currently always be
+    iConfigs[0].)
+
+    iEp0ClientId
+    ==================================
+
+    The purpose of these two members of class DUsbClientController is the
+    following.
+
+    They are used only during Ep0 control transactions which have an OUT (Rx)
+    data stage. We cannot deduce from the received data itself to whom
+    it is addressed (that's because of the shared nature of Ep0).
+
+    In order to be able to tell whether received Ep0 data is to be processed by
+    the PIL or a LDD, we use iEp0ClientId. iEp0ClientId is usually NULL, which
+    means it is our data. However it is set to the client ID of an LDD in case
+    2) above. That way we can subsequently hand over received data to the
+    correct client LDD.
+
+    iEp0DataReceived tracks the amount of data already received - it is used to
+    determine the end of the DATA_OUT phase, irrespective of the owner of the
+    data. The total amount that is to be received can be obtained via
+    iConTransferMgr->PktParser().Length(). (iConTransferMgr->PktParser() holds in 
+    that case the Setup packet of the current Control transfer.)
+
+    iEp0ClientDataTransmitting is only set to TRUE if a client sets up an Ep0
+    write. After that transmission has completed we use this value to decide
+    whether we have to report the completion to a client or not. (If this
+    variable is FALSE, we did set up the write and thus no client notification
+    is necessary.)
+
+*/
+
+//
+// === Global and Local Variables ==================================================================
+//
+
+// Currently we support at most 2 peripheral stack
+GLDEF_D DUsbClientController* DUsbClientController::UsbClientController[] = {NULL, NULL};
+
+static const TInt KUsbReconnectDelay   = 500;                // milliseconds
+
+// Charger detector is the guy(PSL) who can detect the charger type and report 
+// it via a charger type observer
+static UsbShai::MChargerDetectorIf* gChargerDetector = NULL;
+
+// Charger observer is the guy who want to monitor the chager type event.
+static UsbShai::MChargerDetectorObserverIf* gChargerObsever = NULL;
+
+
+// Those const variables are used to construct the default 
+// Usb descriptors, Upper layer can change them later.
+/** Default vendor ID to set in device descriptor */
+static const TUint16 KUsbVendorId   = KUsbVendorId_Symbian;
+/** Default product ID to set in device descriptor */
+static const TUint16 KUsbProductId  = 0x1111;
+/** Default language ID (US English) to set in device descriptor */
+static const TUint16 KUsbLangId     = 0x0409;
+static const TUint8 KUsbNumberOfConfiguration = 0x01;
+/** Default manufacturer string */
+static const wchar_t KStringManufacturer[] = L"Nokia Corporation";
+/** Default product name string */
+static const wchar_t KStringProduct[]      = L"Nokia USB Driver";
+/** Default configuration name string */
+static const wchar_t KStringConfig[]       = L"Bulk transfer method configuration";
+/** Default configuration name string */
+static const wchar_t KStringSerial[]       = L"Serial Not defined";
+
+
+//
+// === USB Controller member function implementations - LDD API (public) ===========================
+//
+
+DECLARE_STANDARD_EXTENSION()//lint !e1717 !e960 defined by symbian
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("> Peripheral PIL Extension entry"));
+    // Don't need to do anything here, using extension just to make sure
+    // we're loaded when peripheral PSL trying to register itself to us.
+    __KTRACE_OPT(KUSB, Kern::Printf("< Peripheral PIL Extension exit"));
+    return KErrNone;
+    }
+    
+/** The class destructor.
+
+    This rarely gets called, except, for example when something goes
+    wrong during construction.
+
+    It's not exported because it is virtual.
+*/
+DUsbClientController::~DUsbClientController()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("> DUsbClientController::~DUsbClientController()"));
+    if (iPowerHandler)
+        {
+        iPowerHandler->Remove();
+        delete iPowerHandler;
+        }
+
+    // ResetAndDestroy() will call for every array element the destructor of the pointed-to object,
+    // before deleting the element itself, and closing the array.
+    iConfigs.ResetAndDestroy();
+    __KTRACE_OPT(KUSB, Kern::Printf("< DUsbClientController::~DUsbClientController(): Done."));
+    }
+
+EXPORT_C DUsbClientController* DUsbClientController::Create(UsbShai::MPeripheralControllerIf&               aPeripheralControllerIf, 
+                                                            const UsbShai::TPeripheralControllerProperties& aProperties,
+                                                            TBool                                  aIsOtgPort)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("> DUsbClientController::Create"));
+        // Attempt to create the object
+    DUsbClientController* usbcc = new DUsbClientController(aPeripheralControllerIf, 
+                                                           aProperties,
+                                                           aIsOtgPort);
+    
+    __ASSERT_DEBUG( (usbcc != NULL), Kern::Fault( "  USB PSL Out of memory, DUsbClientController", __LINE__ ) );
+    
+    if (usbcc != NULL)
+        {
+        // Second phase constructor
+        TInt err = usbcc->Construct();
+        __ASSERT_DEBUG( (err == KErrNone), Kern::Fault( "DUsbClientController::Construct failed", err) );
+        
+        if (err != KErrNone)
+            {
+            delete usbcc;
+            usbcc = NULL;
+            }
+        }
+    
+    __KTRACE_OPT(KUSB, Kern::Printf("< DUsbClientController::Create instance = %d",usbcc));
+    
+    return usbcc;
+    }
+
+/**
+ * FIXME: This function used to be called by the dummy DCD to disable
+ * the peripheral stack. It has been deprecated and we currently use
+ * DisablePeripheralStack() to achieve the same effect.
+ */
+EXPORT_C void DUsbClientController::DisableClientStack()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("CALL TO OBSOLETE FUNCTION: DUsbClientController::DisableClientStack()"));
+    }
+
+
+/**
+ * FIXME: This function used to be called by the dummy DCD to enable
+ * the peripheral stack. It has been deprecated and we currently use
+ * EnablePeripheralStack() to achieve the same effect.
+ */
+EXPORT_C void DUsbClientController::EnableClientStack()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("CALL TO OBSOLETE FUNCTION: DUsbClientController::EnableClientStack()"));
+    }
+
+
+/** Called by LDD to see if controller is usable.
+
+    @return ETrue if controller is in normal state, EFalse if it is disabled.
+*/
+EXPORT_C TBool DUsbClientController::IsActive()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::IsActive = %d",iStackIsActive));
+    return iStackIsActive;
+    }
+
+
+/** Called by LDD to register client callbacks.
+
+    @return KErrNone if successful, KErrAlreadyExists callback exists.
+*/
+EXPORT_C TInt DUsbClientController::RegisterClientCallback(TUsbcClientCallback& aCallback)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("> DUsbClientController::RegisterClientCallback()"));
+    if (iClientCallbacks.Elements() == KUsbcMaxListLength)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Maximum list length reached: %d",
+                                          KUsbcMaxListLength));
+        return KErrGeneral;
+        }
+    TSglQueIter<TUsbcClientCallback> iter(iClientCallbacks);
+    TUsbcClientCallback* p;
+    while ((p = iter++) != NULL)
+        if (p == &aCallback)
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("     Error: ClientCallback @ 0x%x already registered", &aCallback));
+            return KErrAlreadyExists;
+            }
+    iClientCallbacks.AddLast(aCallback);
+    __KTRACE_OPT(KUSB, Kern::Printf("< DUsbClientController::RegisterClientCallback()"));
+    return KErrNone;
+    }
+
+
+/** Returns a pointer to the USB client controller object.
+
+    This function is static.
+
+    @param aUdc The number of the UDC (0..n) for which the pointer is to be returned.
+
+    @return A pointer to the USB client controller object.
+*/
+EXPORT_C DUsbClientController* DUsbClientController::UsbcControllerPointer(TInt aUdc)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("> DUsbClientController::UsbcControllerPointer()"));
+    
+    if (aUdc < 0 || aUdc > 1)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: aUdc out of range (%d)", aUdc));
+        return NULL;
+        }
+        
+    __KTRACE_OPT(KUSB, Kern::Printf("< DUsbClientController::UsbcControllerPointer()"));
+    
+    return UsbClientController[aUdc];
+    }
+
+
+/** Fills the buffer passed in as an argument with endpoint capability information.
+
+     @see DUsbClientController::DeviceCaps()
+    @see TUsbcEndpointData
+    @see TUsbDeviceCaps
+
+    @param aClientId A pointer to the LDD making the enquiry.
+    @param aCapsBuf A reference to a descriptor buffer, which, on return, contains an array of
+    TUsbcEndpointData elements; there are TUsbDeviceCaps::iTotalEndpoints elements in the array;
+    call DeviceCaps() to get the number of elements required.
+*/
+EXPORT_C void DUsbClientController::EndpointCaps(const DBase* aClientId, TDes8& aCapsBuf) const
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("> DUsbClientController::EndpointCaps()"));
+    // Here we do not simply call DUsbClientController::DeviceEndpointCaps(),
+    // because that function fills an array which comprises of _all_ endpoints,
+    // whereas this function omits ep0 and all unusable endpoints.
+    // Apart from that, we have to fill an array of TUsbcEndpointData, not TUsbcEndpointCaps.
+    TUsbcEndpointData data[KUsbcMaxEndpoints];
+    const TInt ifcset_num = ClientId2InterfaceNumber(aClientId);
+    for (TInt i = 2, j = 0; i < iDeviceTotalEndpoints; ++i)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  DUsbClientController::Caps: RealEndpoint #%d", i));
+        if (iRealEndpoints[i].iCaps.iTypesAndDir != UsbShai::KUsbEpNotAvailable)
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  DUsbClientController::Caps: --> UsableEndpoint #%d", j));
+
+            data[j].iCaps.iSizes = iRealEndpoints[i].iCaps.iSizes;
+            data[j].iCaps.iTypesAndDir = iRealEndpoints[i].iCaps.iTypesAndDir;
+            data[j].iCaps.iHighBandwidth = iRealEndpoints[i].iCaps.iHighBandwidth;
+            data[j].iCaps.iReserved[0] = iRealEndpoints[i].iCaps.iReserved[0];
+            data[j].iCaps.iReserved[1] = iRealEndpoints[i].iCaps.iReserved[1];
+            
+            if (ifcset_num < 0)
+                {
+                // If this LDD doesn't own an interface, but the Ep points to one,
+                // then that must be the interface of a different LDD. Hence the Ep
+                // is not available for this LDD.
+                data[j].iInUse = (iRealEndpoints[i].iIfcNumber != NULL);
+                }
+            else
+                {
+                // If this LDD does already own an interface, and the Ep also points to one,
+                // then the Ep is not available for this LDD only if that interface is owned
+                // by a different LDD (i.e. if the interface number is different).
+                // Reason: Even though the endpoint might already be part of an interface setting,
+                // it is still available for a different alternate setting of the same interface.
+                data[j].iInUse = ((iRealEndpoints[i].iIfcNumber != NULL) &&
+                                  (*(iRealEndpoints[i].iIfcNumber) != ifcset_num));
+                }
+
+            j++;
+            }
+        }
+    // aCapsBuf resides in userland
+    TPtrC8 des((TUint8*)data, sizeof(data));
+    const TInt r = Kern::ThreadDesWrite((reinterpret_cast<const DLddUsbcChannel*>(aClientId))->Client(),
+                                        &aCapsBuf, des, 0, KChunkShiftBy0, NULL);
+    if (r != KErrNone)
+        {
+        Kern::ThreadKill((reinterpret_cast<const DLddUsbcChannel*>(aClientId))->Client(),
+                         EExitPanic, r, KUsbPILKillCat);
+        }
+        
+    __KTRACE_OPT(KUSB, Kern::Printf("< DUsbClientController::EndpointCaps()"));
+    }
+
+
+/** Fills the buffer passed in as an argument with device capability information.
+
+    @see TUsbDeviceCaps
+    @see TUsbDeviceCapsV01
+
+    @param aClientId A pointer to the LDD making the enquiry.
+    @param aCapsBuf A reference to a descriptor buffer which, on return, contains
+    a TUsbDeviceCaps structure.
+*/
+EXPORT_C void DUsbClientController::DeviceCaps(const DBase* aClientId, TDes8& aCapsBuf) const
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("> DUsbClientController::DeviceCaps()"));
+    TUsbDeviceCaps caps;
+    caps().iTotalEndpoints = iDeviceUsableEndpoints;        // not DeviceTotalEndpoints()!
+    
+    caps().iSelfPowered = iSelfPowered;
+    caps().iRemoteWakeup = iRemoteWakeup;
+    caps().iHighSpeed = (iControllerProperties.iControllerCaps & UsbShai::KDevCapHighSpeed)?ETrue:EFalse;
+    
+    // PIL always assume controller support this caps, see explaination in peripheral shai header
+    caps().iFeatureWord1 = caps().iFeatureWord1 | KUsbDevCapsFeatureWord1_CableDetectWithoutPower;
+    
+    caps().iFeatureWord1 = caps().iFeatureWord1 | KUsbDevCapsFeatureWord1_EndpointResourceAllocV2;
+    caps().iReserved = 0;
+
+    // aCapsBuf resides in userland
+    const TInt r = Kern::ThreadDesWrite((reinterpret_cast<const DLddUsbcChannel*>(aClientId))->Client(),
+                                        &aCapsBuf, caps, 0, KChunkShiftBy0, NULL);
+    if (r != KErrNone)
+        {
+        Kern::ThreadKill((reinterpret_cast<const DLddUsbcChannel*>(aClientId))->Client(),
+                         EExitPanic, r, KUsbPILKillCat);
+        }
+    __KTRACE_OPT(KUSB, Kern::Printf("< DUsbClientController::DeviceCaps()"));
+    }
+
+
+TUsbcEndpointInfoArray::TUsbcEndpointInfoArray(const TUsbcEndpointInfo* aData, TInt aDataSize)
+    {
+    iType = EUsbcEndpointInfo;
+    iData = (TUint8*) aData;
+    if (aDataSize > 0)
+        iDataSize = aDataSize;
+    else
+        iDataSize = sizeof(TUsbcEndpointInfo);
+    }
+
+
+inline TUsbcEndpointInfo& TUsbcEndpointInfoArray::operator[](TInt aIndex) const
+    {
+    return *(TUsbcEndpointInfo*) &iData[aIndex * iDataSize];
+    }
+
+
+EXPORT_C TInt DUsbClientController::SetInterface(const DBase* aClientId, DThread* aThread,
+                                                 TInt aInterfaceNum, TUsbcClassInfo& aClass,
+                                                 TDesC8* aString, TInt aTotalEndpointsUsed,
+                                                 const TUsbcEndpointInfo aEndpointData[],
+                                                 TInt (*aRealEpNumbers)[6], TUint32 aFeatureWord)
+    {
+    TUsbcEndpointInfoArray endpointData = TUsbcEndpointInfoArray(aEndpointData);
+    return SetInterface(aClientId, aThread, aInterfaceNum, aClass, aString, aTotalEndpointsUsed,
+                        endpointData, (TInt*) aRealEpNumbers, aFeatureWord);
+    }
+
+
+/** Creates a new USB interface (one setting), complete with endpoints, descriptors, etc.,
+    and chains it into the internal device configuration tree.
+
+    @param aClientId A pointer to the LDD owning the new interface.
+    @param aThread A pointer to the thread the owning LDD is running in.
+    @param aInterfaceNum The interface setting number of the new interface setting. This must be 0
+    if it is the first setting of the interface that gets created, or 1 more than the last setting
+    that was created for this interface.
+    @param aClass Contains information about the device class this interface might belong to.
+    @param aString A pointer to a string that is used for the string descriptor of this interface.
+    @param aTotalEndpointsUsed The number of endpoints used by this interface (and also the number of
+    elements of the following array).
+    @param aEndpointData An array with aTotalEndpointsUsed elements, containing information about the
+    endpoints of this interface.
+
+    @return KErrNotSupported if Control endpoints are requested by the LDD but aren't supported by the PIL,
+    KErrInUse if at least one requested endpoint is - temporarily or permanently - not available for use,
+    KErrNoMemory if (endpoint, interface, string) descriptor allocation fails, KErrGeneral if something else
+    goes wrong during endpoint or interface or descriptor creation, KErrNone if interface successfully set up.
+*/
+EXPORT_C TInt DUsbClientController::SetInterface(const DBase* aClientId, DThread* aThread,
+                                                 TInt aInterfaceNum, TUsbcClassInfo& aClass,
+                                                 TDesC8* aString, TInt aTotalEndpointsUsed,
+                                                 const TUsbcEndpointInfoArray aEndpointData,
+                                                 TInt aRealEpNumbers[], TUint32 aFeatureWord)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("> DUsbClientController::SetInterface()"));
+    if (aInterfaceNum != 0)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  alternate interface setting request: #%d", aInterfaceNum));
+        }
+
+#ifndef USB_SUPPORTS_CONTROLENDPOINTS
+    for (TInt i = 0; i < aTotalEndpointsUsed; ++i)
+        {
+        if (aEndpointData[i].iType == UsbShai::KUsbEpTypeControl)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: control endpoints not supported"));
+            return KErrNotSupported;
+            }
+        }
+#endif
+
+    // Check for endpoint availability & check those endpoint's capabilities
+    const TInt ifcset_num = ClientId2InterfaceNumber(aClientId);
+    
+    // The passed-in ifcset_num may be -1 now, but that's intended.
+    if (!CheckEpAvailability(aTotalEndpointsUsed, aEndpointData, ifcset_num))
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: endpoints not (all) available"));
+        return KErrInUse;
+        }
+    
+    // Create & setup new interface
+    TUsbcInterface* ifc = CreateInterface(aClientId, aInterfaceNum, aFeatureWord);
+    if (ifc == NULL)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: ifc == NULL"));
+        return KErrGeneral;
+        }
+    
+    // Create logical endpoints
+    TInt r = CreateEndpoints(ifc, aTotalEndpointsUsed, aEndpointData, aRealEpNumbers);
+    if (r != KErrNone)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: CreateEndpoints() err = %d ",r));
+        DeleteInterface(ifc->iInterfaceSet->iInterfaceNumber, aInterfaceNum);
+        return r;
+        }
+    
+    // Create & setup interface, string, and endpoint descriptors
+    r = SetupIfcDescriptor(ifc, aClass, aThread, aString, aEndpointData);
+    if (r != KErrNone)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: SetupIfcDescriptor() err = %d",r));
+        return r;
+        }
+    
+    __KTRACE_OPT(KUSB, Kern::Printf("> DUsbClientController::SetInterface()"));
+    return KErrNone;
+    }
+
+
+/** Releases an existing USB interface (one setting), complete with endpoints, descriptors, etc.,
+    and removes it from the internal device configuration tree.
+
+    @param aClientId A pointer to the LDD owning the interface.
+    @param aInterfaceNum The setting number of the interface setting to be deleted. This must be
+    the highest numbered (or 'last') setting for this interface.
+
+    @return KErrNotFound if interface (not setting) for some reason cannot be found, KErrArgument if an
+    invalid interface setting number is specified (not existing or existing but too small), KErrNone if
+    interface successfully released or if this client doesn't own any interface.
+*/
+EXPORT_C TInt DUsbClientController::ReleaseInterface(const DBase* aClientId, TInt aInterfaceNum)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("> DUsbClientController::ReleaseInterface(..., %d)", aInterfaceNum));
+    const TInt ifcset = ClientId2InterfaceNumber(aClientId);
+    if (ifcset < 0)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  interface not found")); // no error
+        return KErrNone;
+        }
+    TUsbcInterfaceSet* const ifcset_ptr = InterfaceNumber2InterfacePointer(ifcset);
+    if (!ifcset_ptr)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  Error: interface number %d doesn't exist", ifcset));
+        return KErrNotFound;
+        }
+    const TInt setting_count = ifcset_ptr->iInterfaces.Count();
+    if ((setting_count - 1) != aInterfaceNum)
+        {
+        __KTRACE_OPT(KUSB,
+                     Kern::Printf("  Error: interface settings must be released in descending order:\n\r"
+                                  "   %d setting(s) exist, #%d was requested to be released.\n\r"
+                                  "   (#%d has to be released first)",
+                                  setting_count, aInterfaceNum, setting_count - 1));
+        return KErrArgument;
+        }
+    // Tear down current setting (invalidate configured state)
+    __KTRACE_OPT(KUSB, Kern::Printf("  tearing down InterfaceSet %d", ifcset));
+    // Cancel all transfers on the current setting of this interface and deconfigure all its endpoints.
+    InterfaceSetTeardown(ifcset_ptr);
+    // 'Setting 0' means: delete all existing settings.
+    if (aInterfaceNum == 0)
+        {
+        TInt m = ifcset_ptr->iInterfaces.Count();
+        while (m > 0)
+            {
+            m--;
+            // Ground the physical endpoints' logical_endpoint_pointers
+            const TInt n = ifcset_ptr->iInterfaces[m]->iEndpoints.Count();
+            for (TInt i = 0; i < n; ++i)
+                {
+                TUsbcPhysicalEndpoint* ptr = const_cast<TUsbcPhysicalEndpoint*>
+                    (ifcset_ptr->iInterfaces[m]->iEndpoints[i]->iPEndpoint);
+                ptr->iLEndpoint = NULL;
+                }
+            // Delete the setting itself + its ifc & ep descriptors
+            DeleteInterface(ifcset, m);
+            iDescriptors.DeleteIfcDescriptor(ifcset, m);
+            }
+        }
+    else
+        {
+        // Ground the physical endpoints' logical_endpoint_pointers
+        const TInt n = ifcset_ptr->iInterfaces[aInterfaceNum]->iEndpoints.Count();
+        for (TInt i = 0; i < n; ++i)
+            {
+            TUsbcPhysicalEndpoint* ptr = const_cast<TUsbcPhysicalEndpoint*>
+                (ifcset_ptr->iInterfaces[aInterfaceNum]->iEndpoints[i]->iPEndpoint);
+            ptr->iLEndpoint = NULL;
+            }
+        // Delete the setting itself + its ifc & ep descriptors
+        DeleteInterface(ifcset, aInterfaceNum);
+        iDescriptors.DeleteIfcDescriptor(ifcset, aInterfaceNum);
+        }
+    // Delete the whole interface if all settings are gone
+    if (ifcset_ptr->iInterfaces.Count() == 0)
+        {
+        DeleteInterfaceSet(ifcset);
+        }
+    // We now no longer have a valid current configuration
+    iCurrentConfig = 0;
+    if (iDeviceState == UsbShai::EUsbPeripheralStateConfigured)
+        {
+        NextDeviceState(UsbShai::EUsbPeripheralStateAddress);
+        }
+    // If it was the last interface(set)...
+    if (iConfigs[0]->iInterfaceSets.Count() == 0)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  No ifc left -> turning off UDC"));
+        // First disconnect the device from the bus
+        UsbDisconnect();
+        DeActivateHardwareController();
+        // (this also disables endpoint zero; we cannot have a USB device w/o interface, see 9.6.3)
+        }
+    __KTRACE_OPT(KUSB, Kern::Printf("< DUsbClientController::ReleaseInterface"));
+    return KErrNone;
+    }
+
+
+/** Enforces a USB re-enumeration by disconnecting the UDC from the bus (if it is currently connected) and
+    re-connecting it.
+
+    This only works if the PSL supports it, i.e. if SoftConnectCaps() returns ETrue.
+*/
+EXPORT_C TInt DUsbClientController::ReEnumerate()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("> DUsbClientController::ReEnumerate()"));
+    
+    // ReEnumerate is possible only when stack is enabled
+    if (!iStackIsActive)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  Client stack disabled -> returning here"));
+        return KErrNotReady;
+        }
+    
+    // If no interfaces setup, there is no point to reenumerate
+    if (iConfigs[0]->iInterfaceSets.Count() == 0)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  > No interface registered -> no need to re-enumerate"));
+        return KErrNone;;
+        }
+    
+    if (!iHardwareActivated)
+        {
+        // If the UDC is still off, we switch it on here.
+        const TInt r = ActivateHardwareController();
+        if (r != KErrNone)
+                {
+                __KTRACE_OPT(KPANIC, Kern::Printf("  Error: ActivateHardwareController() failed: %d", r));
+                return r;
+                }
+        
+        // Finally connect the device to the bus
+        UsbConnect();
+        }
+    else
+        {
+        UsbDisconnect();
+        
+        // Now we have to wait a certain amount of time, in order to give the host the opportunity
+        // to come to terms with the new situation.
+        // (The ETrue parameter makes the callback get called in DFC instead of in ISR context.)
+        iReconnectTimer.OneShot(KUsbReconnectDelay, ETrue);
+        }
+        
+    __KTRACE_OPT(KUSB, Kern::Printf("< DUsbClientController::ReEnumerate()"));
+    return KErrNone;;
+    }
+
+
+/** Powers up the UDC if one or more interfaces exist.
+
+    @return KErrNone if UDC successfully powered up, KErrNotReady if no
+    interfaces have been registered yet, KErrHardwareNotAvailable if UDC
+    couldn't be activated.
+*/
+EXPORT_C TInt DUsbClientController::PowerUpUdc()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("> DUsbClientController::PowerUpUdc()"));
+    
+    // we need to check whether Stack is activate or not(can be done by otg sw in otg setup
+    // or by vBus risen/fallen event in a non-otg env)
+    if (!iStackIsActive)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  Client stack disabled -> returning here"));
+        return KErrNotReady;
+        }
+    
+    if (iConfigs[0]->iInterfaceSets.Count() == 0)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  No interface registered -> won't power up UDC"));
+        return KErrNotReady;
+        }
+    
+    // If the UDC is still off, we switch it on here.
+    const TInt r = ActivateHardwareController();
+    if (r != KErrNone)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: ActivateHardwareController() failed: %d", r));
+        }
+    
+    __KTRACE_OPT(KUSB, Kern::Printf("< DUsbClientController::PowerUpUdc() returns %d",r));
+    return r;
+    }
+
+
+/** Connects the UDC to the bus.
+
+    @return KErrNone if UDC successfully connected, 
+            KErrNotSupported if KDevCapSoftConnect not supported
+            KErrGeneral if there was an error.
+            
+*/
+EXPORT_C TInt DUsbClientController::UsbConnect()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("> DUsbClientController::UsbConnect()"));
+    iClientSupportReady = ETrue;
+    
+    // If a deferred reset is pending, service it now
+    const TInt irq = __SPIN_LOCK_IRQSAVE(iUsbLock);
+    if (iUsbResetDeferred)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  Resetting USB Reset 'defer' flag"));
+        iUsbResetDeferred = EFalse;
+        (void) ProcessResetEvent(EFalse);
+        }
+    __SPIN_UNLOCK_IRQRESTORE(iUsbLock, irq);
+
+    // Indicate readiness to connect to the PSL
+    const TInt r = iController.PeripheralConnect();
+    
+    // Check whether Stack is activated by OTG controller
+    // or Vbus Risen had been detected.
+    // If either of them is true and HW is not activated yet, do it here.
+    if (iStackIsActive &&  !iHardwareActivated )
+        {
+        // PowerUpUdc only do Activating Hardware when there are at least 1
+        // Iterface registered            
+        PowerUpUdc();
+        }
+    
+    __KTRACE_OPT(KUSB, Kern::Printf("< DUsbClientController::UsbConnect()"));
+    return r;
+    }
+
+
+/** Disconnects the UDC from the bus.
+
+    This only works if the PSL supports it, i.e. if SoftConnectCaps() returns ETrue.
+
+    @return KErrNone if UDC successfully disconnected, KErrGeneral if there was an error.
+*/
+EXPORT_C TInt DUsbClientController::UsbDisconnect()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::UsbDisconnect()"));
+    iClientSupportReady = EFalse;
+
+    // Indicate to PSL that we are no longer ready to connect
+    const TInt r = iController.PeripheralDisconnect();
+
+    // There won't be any notification by the PSL about this,
+    // so we have to notify the LDD/user ourselves:
+    if ((r == KErrNone) && (iDeviceState != UsbShai::EUsbPeripheralStateUndefined))
+        {
+        // Not being in state UNDEFINED implies that the cable is inserted.
+        if (iHardwareActivated)
+            {
+            NextDeviceState(UsbShai::EUsbPeripheralStatePowered);
+            }
+        // (If the hardware is NOT activated at this point, we can only be in
+        //    state UsbShai::EUsbPeripheralStateAttached, so we don't have to move to it.)
+        }
+    return r;
+    }
+
+
+/** Registers a notification callback for changes of the USB device state.
+
+    In the event of a device state change, the callback's state member gets updated (using SetState) with a
+    new UsbShai::TUsbPeripheralState value, and then the callback is executed (DoCallback). 'USB device state' here refers
+    to the Visible Device States as defined in chapter 9 of the USB specification.
+
+    @param aCallback A reference to a properly filled in status callback structure.
+
+    @return KErrNone if callback successfully registered, KErrGeneral if this callback is already registered
+    (it won't be registered twice).
+*/
+EXPORT_C TInt DUsbClientController::RegisterForStatusChange(TUsbcStatusCallback& aCallback)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::RegisterForStatusChange()"));
+    if (iStatusCallbacks.Elements() == KUsbcMaxListLength)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Maximum list length reached: %d",
+                                          KUsbcMaxListLength));
+        return KErrGeneral;
+        }
+    if (IsInTheStatusList(aCallback))
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  Error: StatusCallback @ 0x%x already registered", &aCallback));
+        return KErrGeneral;
+        }
+    const TInt irq = __SPIN_LOCK_IRQSAVE(iUsbLock);
+    iStatusCallbacks.AddLast(aCallback);
+    __SPIN_UNLOCK_IRQRESTORE(iUsbLock, irq);
+    return KErrNone;
+    }
+
+
+/** De-registers (removes from the list of pending requests) a notification callback for the USB device
+    status.
+
+    @param aClientId A pointer to the LDD owning the status change callback.
+
+    @return KErrNone if callback successfully unregistered, KErrNotFound if the callback couldn't be found.
+*/
+EXPORT_C TInt DUsbClientController::DeRegisterForStatusChange(const DBase* aClientId)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::DeRegisterForStatusChange()"));
+    __ASSERT_DEBUG((aClientId != NULL), Kern::Fault(KUsbPILPanicCat, __LINE__));
+    const TInt irq = __SPIN_LOCK_IRQSAVE(iUsbLock);
+    TSglQueIter<TUsbcStatusCallback> iter(iStatusCallbacks);
+    TUsbcStatusCallback* p;
+    while ((p = iter++) != NULL)
+        {
+        if (p->Owner() == aClientId)
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  removing StatusCallback @ 0x%x", p));
+            iStatusCallbacks.Remove(*p);
+            __SPIN_UNLOCK_IRQRESTORE(iUsbLock, irq);
+            return KErrNone;
+            }
+        }
+    __KTRACE_OPT(KUSB, Kern::Printf("  client not found"));
+    __SPIN_UNLOCK_IRQRESTORE(iUsbLock, irq);
+    return KErrNotFound;
+    }
+
+
+/** Registers a notification callback for changes of the state of endpoints.
+
+    In the event of a state change of an endpoint that is spart of an interface which is owned by the LDD
+    specified in the callback structure, the callback's state member gets updated (using SetState) with a new
+    value, and the callback is executed (DoCallback). 'Endpoint state' here refers to the state of the
+    ENDPOINT_HALT feature of an endpoint as described in chapter 9 of the USB specification. The contents of
+    the state variable reflects the state of the halt features for all endpoints of the current interface
+    setting: bit 0 represents endpoint 1, bit 1 endpoint 2, etc. A set bit means 'endpoint halted', a cleared
+    bit 'endpoint not halted'.
+
+    @param aCallback A reference to a properly filled in endpoint status callback structure.
+
+    @return KErrNone if callback successfully registered, KErrGeneral if this callback is already registered
+    (it won't be registered twice).
+*/
+EXPORT_C TInt DUsbClientController::RegisterForEndpointStatusChange(TUsbcEndpointStatusCallback& aCallback)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::RegisterForEndpointStatusChange()"));
+    if (iEpStatusCallbacks.Elements() == KUsbcMaxListLength)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Maximum list length reached: %d",
+                                          KUsbcMaxListLength));
+        return KErrGeneral;
+        }
+    if (IsInTheEpStatusList(aCallback))
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  Error: EpStatusCallback @ 0x%x already registered", &aCallback));
+        return KErrGeneral;
+        }
+    const TInt irq = __SPIN_LOCK_IRQSAVE(iUsbLock);
+    iEpStatusCallbacks.AddLast(aCallback);
+    __SPIN_UNLOCK_IRQRESTORE(iUsbLock, irq);
+    return KErrNone;
+    }
+
+
+/** De-registers (removes from the list of pending requests) a notification callback for changes of the state
+    of endpoints.
+
+    @param aClientId A pointer to the LDD owning the endpoint status change callback.
+
+    @return KErrNone if callback successfully unregistered, KErrNotFound if the callback couldn't be found.
+*/
+EXPORT_C TInt DUsbClientController::DeRegisterForEndpointStatusChange(const DBase* aClientId)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::DeRegisterForEndpointStatusChange()"));
+    __ASSERT_DEBUG((aClientId != NULL), Kern::Fault(KUsbPILPanicCat, __LINE__));
+    const TInt irq = __SPIN_LOCK_IRQSAVE(iUsbLock);
+    TSglQueIter<TUsbcEndpointStatusCallback> iter(iEpStatusCallbacks);
+    TUsbcEndpointStatusCallback* p;
+    while ((p = iter++) != NULL)
+        {
+        if (p->Owner() == aClientId)
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  removing EpStatusCallback @ 0x%x", p));
+            iEpStatusCallbacks.Remove(*p);
+            __SPIN_UNLOCK_IRQRESTORE(iUsbLock, irq);
+            return KErrNone;
+            }
+        }
+    __KTRACE_OPT(KUSB, Kern::Printf("  client not found"));
+    __SPIN_UNLOCK_IRQRESTORE(iUsbLock, irq);
+    return KErrNotFound;
+    }
+
+
+/** Returns the number of the currently active alternate interface setting for this interface.
+
+    @param aClientId A pointer to the LDD owning the interface.
+    @param aInterfaceNum Here the interface gets written to.
+
+    @return KErrNotFound if an interface for this client couldn't be found, KErrNone if setting value was
+    successfully written.
+*/
+EXPORT_C TInt DUsbClientController::GetInterfaceNumber(const DBase* aClientId, TInt& aInterfaceNum) const
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::GetInterfaceNumber()"));
+    const TInt ifcset = ClientId2InterfaceNumber(aClientId);
+    if (ifcset < 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error (ifc < 0)"));
+        return KErrNotFound;
+        }
+    const TUsbcInterfaceSet* const ifcset_ptr = InterfaceNumber2InterfacePointer(ifcset);
+    if (!ifcset_ptr)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: interface number %d doesn't exist", ifcset));
+        return KErrNotFound;
+        }
+    aInterfaceNum = ifcset_ptr->iCurrentInterface;
+    return KErrNone;
+    }
+
+
+/** This is normally called once by an LDD's destructor, either after a Close() on the user side,
+    or during general cleanup.
+
+    It might also be called by the LDD when some internal unrecoverable error occurs.
+
+    This function
+    - de-registers a possibly pending device state change notification request,
+    - de-registers a possibly pending endpoint state change notification request,
+    - releases all interfaces + settings owned by this LDD,
+    - cancels all remaining (if any) read/write requests.
+
+    @param aClientId A pointer to the LDD to be unregistered.
+
+    @return KErrNone.
+*/
+EXPORT_C TInt DUsbClientController::DeRegisterClient(const DBase* aClientId)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::DeRegisterClient(0x%x)", aClientId));
+    // Cancel all device state notification requests
+    DeRegisterForStatusChange(aClientId);
+    // Cancel all endpoint state notification requests
+    DeRegisterForEndpointStatusChange(aClientId);
+    DeRegisterForOtgFeatureChange(aClientId);
+    DeRegisterClientCallback(aClientId);
+    // Delete the interface including all its alternate settings which might exist.
+    // (If we release the default setting (0), all alternate settings are deleted as well.)
+    const TInt r = ReleaseInterface(aClientId, 0);
+    // Cancel all remaining (if any) read/write requests
+    DeleteRequestCallbacks(aClientId);
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::DeRegisterClient: Done."));
+    return r;
+    }
+
+
+/** Returns the currently used Ep0 max packet size.
+
+    @return The currently used Ep0 max packet size.
+*/
+EXPORT_C TInt DUsbClientController::Ep0PacketSize() const
+    {
+    const TUsbcLogicalEndpoint* const ep = iRealEndpoints[0].iLEndpoint;
+    if (iHighSpeed)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  Ep0 size = %d (HS)", ep->iEpSize_Hs));
+        return ep->iEpSize_Hs;
+        }
+    else
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  Ep0 size = %d (FS)", ep->iEpSize_Fs));
+        return ep->iEpSize_Fs;
+        }
+    }
+
+
+/** Stalls Ep0.
+
+    @param aClientId A pointer to the LDD wishing to stall Ep0 (this is for PIL internal purposes only).
+
+    @return KErrNone if endpoint zero successfully stalled, KErrGeneral otherwise.
+*/
+EXPORT_C TInt DUsbClientController::Ep0Stall(const DBase* aClientId)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::Ep0Stall()"));
+    if (aClientId == iEp0ClientId)
+        {
+        ResetEp0DataOutVars();
+        }
+    const TInt err = iConTransferMgr->StallEndpoint(KEp0_Out);
+    if (err < 0)
+        {
+        return err;
+        }
+    else
+        return iConTransferMgr->StallEndpoint(KEp0_In);
+    }
+
+
+/** Sends a zero-byte status packet on Ep0.
+
+    @param aClientId A pointer to the LDD wishing to send the status packet (not used at present).
+*/
+EXPORT_C void DUsbClientController::SendEp0StatusPacket(const DBase* /* aClientId */)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::SendEp0StatusPacket()"));
+    iConTransferMgr->SendEp0ZeroByteStatusPacket();
+    }
+
+
+/** Returns the current USB device state.
+
+    'USB device state' here refers to the Visible Device States as defined in chapter 9 of the USB
+    specification.
+
+    @return The current USB device state, or UsbShai::EUsbPeripheralStateUndefined
+*/
+EXPORT_C UsbShai::TUsbPeripheralState DUsbClientController::GetDeviceStatus() const
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::GetDeviceStatus()"));
+    return iDeviceState;
+    }
+
+
+/** Returns the state of an endpoint.
+
+    'Endpoint state' here refers to the state of the ENDPOINT_HALT feature of
+    an endpoint as described in chapter 9 of the USB specification.
+
+    @param aClientId A pointer to the LDD owning the interface which contains the endpoint to be queried.
+    @param aEndpointNum The number of the endpoint to be queried.
+
+    @return The current endpoint state, or EEndpointStateUnknown if the endpoint couldn't be found.
+*/
+EXPORT_C TEndpointState DUsbClientController::GetEndpointStatus(const DBase* aClientId, TInt aEndpointNum) const
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("> DUsbClientController::GetEndpointStatus()"));
+    
+    TEndpointState ret = (iRealEndpoints[aEndpointNum].iHalt)?EEndpointStateStalled : EEndpointStateNotStalled;
+    
+    __KTRACE_OPT(KUSB, Kern::Printf("< DUsbClientController::GetEndpointStatus() %d",ret));
+    
+    return  ret;
+    }
+
+
+/** Sets up a data read request for an endpoint.
+
+    @param aCallback A reference to a properly filled in data transfer request callback structure.
+
+    @return KErrNone if callback successfully registered or if this callback is already registered
+    (but it won't be registered twice), KErrNotFound if the endpoint couldn't be found, KErrArgument if
+    endpoint number invalid (PSL), KErrGeneral if something else goes wrong.
+*/
+EXPORT_C TInt DUsbClientController::SetupReadBuffer(TUsbcRequestCallback& aCallback)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::SetupReadBuffer()"));
+    const TInt ep = aCallback.iRealEpNum;
+    __KTRACE_OPT(KUSB, Kern::Printf("  logical ep: #%d", aCallback.iEndpointNum));
+    __KTRACE_OPT(KUSB, Kern::Printf("  real ep:    #%d", ep));
+    TInt err = KErrGeneral;
+    if (ep != 0)
+        {
+        if (iRequestCallbacks[ep])
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Warning: RequestCallback already registered for that ep"));
+            if (iRequestCallbacks[ep] == &aCallback)
+                {
+                __KTRACE_OPT(KPANIC, Kern::Printf("  (this same RequestCallback @ 0x%x)", &aCallback));
+                }
+            else
+                {
+                __KTRACE_OPT(KPANIC, Kern::Printf("  (a different RequestCallback @ 0x%x)", &aCallback));
+                }
+            return KErrNone;
+            }
+        // This may seem awkward:
+        // First we add a callback, and then, in case of an error, we remove it again.
+        // However this is necessary because the transfer request might complete (through
+        // an ISR) _before_ the SetupEndpointRead function returns. Since we don't know the
+        // outcome, we have to provide the callback before making the setup call.
+        //
+        __KTRACE_OPT(KUSB, Kern::Printf("  adding RequestCallback[%d] @ 0x%x", ep, &aCallback));
+        iRequestCallbacks[ep] = &aCallback;
+        if ((err = iController.SetupEndpointRead(ep, aCallback)) != KErrNone)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  removing RequestCallback @ 0x%x (due to error)",
+                                              &aCallback));
+            iRequestCallbacks[ep] = NULL;
+            }
+        }
+    else                                                    // (ep == 0)
+        {
+        if (iEp0ReadRequestCallbacks.Elements() == KUsbcMaxListLength)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Maximum list length reached: %d",
+                                              KUsbcMaxListLength));
+            return KErrGeneral;
+            }
+        if (IsInTheRequestList(aCallback))
+            {       
+            __KTRACE_OPT(KUSB, Kern::Printf("  RequestCallback @ 0x%x already registered", &aCallback));
+            return KErrNone;
+            }
+        // Ep0 reads don't need to be prepared - there's always one pending
+        __KTRACE_OPT(KUSB, Kern::Printf("  adding RequestCallback @ 0x%x (ep0)", &aCallback));
+        const TInt irq = __SPIN_LOCK_IRQSAVE(iUsbLock);
+        iEp0ReadRequestCallbacks.AddLast(aCallback);
+        __SPIN_UNLOCK_IRQRESTORE(iUsbLock, irq);
+        err = KErrNone;
+        if (iEp0_RxExtraCount != 0)
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  iEp0_RxExtraData: trying again..."));
+            
+            const TInt irq = __SPIN_LOCK_IRQSAVE(iUsbLock);
+            
+            // Extra data is either a setup packet or a data packet
+            // They are not possible to be both
+            // And, the error code must be KErrNone, otherwise, we can not arrive here
+            if( iSetupPacketPending )
+                {
+                ProcessSetupPacket(iEp0_RxExtraCount,KErrNone);
+                }
+            else
+                {
+                ProcessDataOutPacket(iEp0_RxExtraCount,KErrNone);
+                }
+            
+            // clear it since already completed to client
+            iEp0_RxExtraCount = 0;
+            
+            err = iLastError;
+            
+            __SPIN_UNLOCK_IRQRESTORE(iUsbLock, irq);
+            if (err == KErrNone)
+                {
+                //iEp0_RxExtraData = EFalse;
+                // Queue a new Ep0 read (because xxxProceed only re-enables the interrupt)
+                iConTransferMgr->SetupEndpointZeroRead();
+                if (iSetupPacketPending)
+                    {
+                    iConTransferMgr->Ep0SetupPacketProceed();
+                    iSetupPacketPending = EFalse;
+                    }
+                else
+                    {
+                    iConTransferMgr->Ep0DataPacketProceed();
+                    }
+                
+                __KTRACE_OPT(KUSB, Kern::Printf("  :-)"));
+                }
+            else
+                {
+                __KTRACE_OPT(KPANIC, Kern::Printf("  Error: :-("));
+                err = KErrGeneral;
+                }
+            return err;
+            }
+        }
+    return err;
+    }
+
+
+/** Sets up a data write request for an endpoint.
+
+    @param aCallback A reference to a properly filled in data transfer request callback structure.
+
+    @return KErrNone if callback successfully registered or if this callback is already registered
+    (but it won't be registered twice), KErrNotFound if the endpoint couldn't be found, KErrArgument if
+    endpoint number invalid (PSL), KErrGeneral if something else goes wrong.
+*/
+EXPORT_C TInt DUsbClientController::SetupWriteBuffer(TUsbcRequestCallback& aCallback)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::SetupWriteBuffer()"));
+    TInt ep = aCallback.iRealEpNum;
+    __KTRACE_OPT(KUSB, Kern::Printf("  logical ep: #%d", aCallback.iEndpointNum));
+    __KTRACE_OPT(KUSB, Kern::Printf("  real ep:       #%d", ep));
+    if (iRequestCallbacks[ep])
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Warning: RequestCallback already registered for that ep"));
+        if (iRequestCallbacks[ep] == &aCallback)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  (this same RequestCallback @ 0x%x)", &aCallback));
+            return KErrNone;
+            }
+        else
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  (a different RequestCallback @ 0x%x - poss. error)",
+                                              &aCallback));
+            return KErrGeneral;
+            }
+        }
+    if (ep == 0)
+        {
+        if (iEp0_TxNonStdCount)
+            {
+            if (iEp0_TxNonStdCount > aCallback.iLength)
+                {
+                __KTRACE_OPT(KPANIC, Kern::Printf("  Warning: Ep0 is sending less data than requested"));
+                if ((aCallback.iLength % iEp0MaxPacketSize == 0) && !aCallback.iZlpReqd)
+                    {
+                    __KTRACE_OPT(KPANIC, Kern::Printf("  Warning: Zlp should probably be requested"));
+                    }
+                }
+            else if (iEp0_TxNonStdCount < aCallback.iLength)
+                {
+                __KTRACE_OPT(KPANIC, Kern::Printf("  Warning: Ep0 is sending more data than requested"));
+                }
+            iEp0_TxNonStdCount = 0;
+            }
+        // Ep0 IN needs to be adjusted: the LDD uses 0 for both Ep0 directions.
+        ep = KEp0_Tx;
+        }
+    // This may seem awkward:
+    // First we add a callback, and then, in case of an error, we remove it again.
+    // However this is necessary because the transfer request might complete (through
+    // an ISR) _before_ the SetupEndpointWrite function returns. Since we don't know the
+    // outcome, we have to provide the callback before making the setup call.
+    //
+    __KTRACE_OPT(KUSB, Kern::Printf("  adding RequestCallback[%d] @ 0x%x", ep, &aCallback));
+    iRequestCallbacks[ep] = &aCallback;
+    if (ep == KEp0_Tx)
+        {
+        iEp0ClientDataTransmitting = ETrue;             // this must be set before calling SetupEndpointZeroWrite
+        TInt ret = iConTransferMgr->SetupEndpointZeroWrite(aCallback.iBufferStart, aCallback.iLength, aCallback.iZlpReqd);
+        if (ret != KErrNone)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  removing RequestCallback @ 0x%x (due to error)", &aCallback));
+            iRequestCallbacks[ep] = NULL;
+            iEp0ClientDataTransmitting = EFalse;
+            return ret;
+            }
+        }
+    else if (iController.SetupEndpointWrite(ep, aCallback) != KErrNone)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  removing RequestCallback @ 0x%x (due to error)", &aCallback));
+        iRequestCallbacks[ep] = NULL;
+        }
+    return KErrNone;
+    }
+
+
+/** Cancels a data read request for an endpoint.
+
+    The request callback will be removed from the queue and the
+    callback function won't be executed.
+
+    @param aClientId A pointer to the LDD owning the interface which contains the endpoint.
+    @param aRealEndpoint The number of the endpoint for which the transfer request is to be cancelled.
+*/
+EXPORT_C void DUsbClientController::CancelReadBuffer(const DBase* aClientId, TInt aRealEndpoint)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::CancelReadBuffer(%d)", aRealEndpoint));
+    if (aRealEndpoint < 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: ep # < 0: %d", aRealEndpoint));
+        return;
+        }
+    // Note that we here don't cancel Ep0 read requests at the PSL level!
+    if (aRealEndpoint > 0)
+        {
+        iController.CancelEndpointRead(aRealEndpoint);
+        }
+    DeleteRequestCallback(aClientId, aRealEndpoint, UsbShai::EControllerRead);
+    }
+
+
+/** Cancels a data write request for an endpoint.
+
+    It cannot be guaranteed that the data is not sent nonetheless, as some UDCs don't permit a flushing of a
+    TX FIFO once it has been filled. The request callback will be removed from the queue in any case and the
+    callback function won't be executed.
+
+    @param aClientId A pointer to the LDD owning the interface which contains the endpoint.
+    @param aRealEndpoint The number of the endpoint for which the transfer request is to be cancelled.
+*/
+EXPORT_C void DUsbClientController::CancelWriteBuffer(const DBase* aClientId, TInt aRealEndpoint)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::CancelWriteBuffer(%d)", aRealEndpoint));
+    if (aRealEndpoint < 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: ep # < 0: %d", aRealEndpoint));
+        return;
+        }
+    if (aRealEndpoint == 0)
+        {
+        // Ep0 IN needs to be adjusted: the LDD uses 0 for both Ep0 directions.
+        aRealEndpoint = KEp0_Tx;
+        }
+    iController.CancelEndpointWrite(aRealEndpoint);
+    if (aRealEndpoint == KEp0_Tx)
+        {
+        // Since Ep0 is shared among clients, we don't have to care about the client id.
+        iEp0WritePending = EFalse;
+        }
+    DeleteRequestCallback(aClientId, aRealEndpoint, UsbShai::EControllerWrite);
+    }
+
+
+/** Halts (stalls) an endpoint (but not Ep0).
+
+    @param aClientId A pointer to the LDD owning the interface which contains the endpoint to be stalled.
+    @param aEndpointNum The number of the endpoint.
+
+    @return KErrNotFound if endpoint couldn't be found (includes Ep0), KErrNone if endpoint successfully
+    stalled, KErrGeneral otherwise.
+*/
+EXPORT_C TInt DUsbClientController::HaltEndpoint(const DBase* aClientId, TInt aEndpointNum)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::HaltEndpoint(%d)", aEndpointNum));
+    const TInt r = iController.StallEndpoint(aEndpointNum);
+    if (r == KErrNone)
+        {
+        iRealEndpoints[aEndpointNum].iHalt = ETrue;
+        }
+    else if (r == KErrArgument)
+        {
+        return KErrNotFound;
+        }
+    return r;
+    }
+
+
+/** Clears the halt condition of an endpoint (but not Ep0).
+
+    @param aClientId A pointer to the LDD owning the interface which contains the endpoint to be un-stalled.
+    @param aEndpointNum The number of the endpoint.
+
+    @return KErrNotFound if endpoint couldn't be found (includes Ep0), KErrNone if endpoint successfully
+    stalled, KErrGeneral otherwise.
+*/
+EXPORT_C TInt DUsbClientController::ClearHaltEndpoint(const DBase* aClientId, TInt aEndpointNum)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ClearHaltEndpoint(%d)", aEndpointNum));
+    const TInt r = iController.ClearStallEndpoint(aEndpointNum);
+    if (r == KErrNone)
+        {
+        iRealEndpoints[aEndpointNum].iHalt = EFalse;
+        }
+    else if (r == KErrArgument)
+        {
+        return KErrNotFound;
+        }
+    return r;
+    }
+
+
+/** This function requests 'device control' for an LDD.
+
+    Class or vendor specific Ep0 requests addressed to the USB device as a whole (Recipient field in
+    bmRequestType byte of a Setup packet set to zero) are delivered to the LDD that owns device control. For
+    obvious reasons only one USB LDD can have device control at any given time.
+
+    @param aClientId A pointer to the LDD requesting device control.
+
+    @return KErrNone if device control successfully claimed or if this LDD already owns it, KErrGeneral if
+    device control already owned by a different client.
+*/
+EXPORT_C TInt DUsbClientController::SetDeviceControl(const DBase* aClientId)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::SetDeviceControl()"));
+    if (iEp0DeviceControl)
+        {
+        if (iEp0DeviceControl == aClientId)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Warning: Device Control already owned by this client"));
+            return KErrNone;
+            }
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Device Control already claimed by a different client"));
+        return KErrGeneral;
+        }
+    iEp0DeviceControl = aClientId;
+    return KErrNone;
+    }
+
+
+/** This function releases device control for an LDD.
+
+    @see DUsbClientController::SetDeviceControl()
+
+    @param aClientId A pointer to the LDD releasing device control.
+
+    @return KErrNone if device control successfully released, KErrGeneral if device control owned by a
+    different client or by no client at all.
+*/
+EXPORT_C TInt DUsbClientController::ReleaseDeviceControl(const DBase* aClientId)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ReleaseDeviceControl()"));
+    if (iEp0DeviceControl)
+        {
+        if (iEp0DeviceControl == aClientId)
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  Releasing Device Control"));
+            iEp0DeviceControl = NULL;
+            return KErrNone;
+            }
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Device Control owned by a different client"));
+        }
+    else
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Device Control not owned by any client"));
+        }
+    return KErrGeneral;
+    }
+
+
+/** Returns all available (configurable) max packet sizes for Ep0.
+
+    The information is coded as bitwise OR'ed values of KUsbEpSizeXXX constants (the bitmap format used for
+    TUsbcEndpointCaps.iSupportedSizes).
+
+    @return All available (configurable) max packet sizes for Ep0.
+*/
+EXPORT_C TUint DUsbClientController::EndpointZeroMaxPacketSizes() const
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::EndpointZeroMaxPacketSizes()"));
+    return iRealEndpoints[0].iCaps.iSizes;
+    }
+
+
+/** Sets (configures) the max packet size for Ep0.
+
+    For available sizes as returned by DUsbClientController::EndpointZeroMaxPacketSizes()
+
+    Note that for HS operation the Ep0 size cannot be chosen, but is fixed at 64 bytes.
+
+    @return KErrNotSupported if invalid size specified, KErrNone if new max packet size successfully set or
+    requested size was already set.
+*/
+EXPORT_C TInt DUsbClientController::SetEndpointZeroMaxPacketSize(TInt aMaxPacketSize)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::SetEndpointZeroMaxPacketSize(%d)",
+                                    aMaxPacketSize));
+
+    if (iControllerProperties.iControllerCaps & UsbShai::KDevCapHighSpeed)
+        {
+        // We're not going to mess with this on a HS device.
+        return KErrNone;
+        }
+
+    if (!(iRealEndpoints[0].iCaps.iSizes & PacketSize2Mask(aMaxPacketSize)))
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: invalid size"));
+        return KErrNotSupported;
+        }
+    if (iRealEndpoints[0].iLEndpoint->iEpSize_Fs == aMaxPacketSize)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  this packet size already set -> returning"));
+        return KErrNone;
+        }
+    const TUsbcLogicalEndpoint* const ep0_0 = iRealEndpoints[0].iLEndpoint;
+    const TUsbcLogicalEndpoint* const ep0_1 = iRealEndpoints[1].iLEndpoint;
+    const_cast<TUsbcLogicalEndpoint*>(ep0_0)->iEpSize_Fs = aMaxPacketSize;
+    const_cast<TUsbcLogicalEndpoint*>(ep0_1)->iEpSize_Fs = aMaxPacketSize;
+
+    // @@@ We should probably modify the device descriptor here as well...
+
+    if (iHardwareActivated)
+        {
+        // De-configure endpoint zero
+        iController.DeConfigureEndpoint(KEp0_Out);
+        iController.DeConfigureEndpoint(KEp0_In);
+        // Re-configure endpoint zero
+        const_cast<TUsbcLogicalEndpoint*>(ep0_0)->iInfo.iSize = ep0_0->iEpSize_Fs;
+        const_cast<TUsbcLogicalEndpoint*>(ep0_1)->iInfo.iSize = ep0_1->iEpSize_Fs;
+        iController.ConfigureEndpoint(0, ep0_0->iInfo);
+        iController.ConfigureEndpoint(1, ep0_1->iInfo);
+        iEp0MaxPacketSize = ep0_0->iInfo.iSize;
+        }
+    return KErrNone;
+    }
+
+
+/** Returns the current USB Device descriptor.
+
+    @param aThread A pointer to the thread the LDD requesting the descriptor is running in.
+    @param aDeviceDescriptor A reference to a buffer into which the requested descriptor should be written
+    (most likely located user-side).
+
+    @return The return value of the thread write operation, Kern::ThreadWrite(), when writing to the target
+    buffer.
+*/
+EXPORT_C TInt DUsbClientController::GetDeviceDescriptor(DThread* aThread, TDes8& aDeviceDescriptor)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::GetDeviceDescriptor()"));
+    return iDescriptors.GetDeviceDescriptorTC(aThread, aDeviceDescriptor);
+    }
+
+
+/** Sets a new USB Device descriptor.
+
+    @param aThread A pointer to the thread the LDD requesting the setting of the descriptor is running in.
+    @param aDeviceDescriptor A reference to a buffer which contains the descriptor to be set (most likely
+    located user-side).
+
+    @return The return value of the thread read operation, Kern::ThreadRead(), when reading from the source
+    buffer in case of a failure, KErrNone if the new descriptor was successfully set.
+*/
+EXPORT_C TInt DUsbClientController::SetDeviceDescriptor(DThread* aThread, const TDes8& aDeviceDescriptor)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::SetDeviceDescriptor()"));
+    return iDescriptors.SetDeviceDescriptorTC(aThread, aDeviceDescriptor);
+    }
+
+
+/** Returns the current USB Device descriptor size.
+
+    @param aThread A pointer to the thread the LDD requesting the descriptor size is running in.
+    @param aSize A reference to a buffer into which the requested descriptor size should be written
+    (most likely located user-side).
+
+    @return The return value of the thread write operation, Kern::ThreadWrite(), when writing to the target
+    buffer.
+*/
+EXPORT_C TInt DUsbClientController::GetDeviceDescriptorSize(DThread* aThread, TDes8& aSize)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::GetDeviceDescriptorSize()"));
+    // We do not really enquire here....
+    const TPtrC8 size(reinterpret_cast<const TUint8*>(&KUsbDescSize_Device), sizeof(KUsbDescSize_Device));
+    return Kern::ThreadDesWrite(aThread, &aSize, size, 0);
+    }
+
+
+/** Returns the current USB configuration descriptor.
+
+    @param aThread A pointer to the thread the LDD requesting the descriptor is running in.
+    @param aConfigurationDescriptor A reference to a buffer into which the requested descriptor should be
+    written (most likely located user-side).
+
+    @return The return value of the thread write operation, Kern::ThreadWrite(), when writing to the target
+    buffer.
+*/
+EXPORT_C TInt DUsbClientController::GetConfigurationDescriptor(DThread* aThread, TDes8& aConfigurationDescriptor)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::GetConfigurationDescriptor()"));
+    return iDescriptors.GetConfigurationDescriptorTC(aThread, aConfigurationDescriptor);
+    }
+
+
+/** Sets a new USB configuration descriptor.
+
+    @param aThread A pointer to the thread the LDD requesting the setting of the descriptor is running in.
+    @param aConfigurationDescriptor A reference to a buffer which contains the descriptor to be set (most
+    likely located user-side).
+
+    @return The return value of the thread read operation, Kern::ThreadRead() when reading from the source
+    buffer in case of a failure, KErrNone if the new descriptor was successfully set.
+*/
+EXPORT_C TInt DUsbClientController::SetConfigurationDescriptor(DThread* aThread,
+                                                               const TDes8& aConfigurationDescriptor)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::SetConfigurationDescriptor()"));
+    return iDescriptors.SetConfigurationDescriptorTC(aThread, aConfigurationDescriptor);
+    }
+
+
+/** Returns the current USB configuration descriptor size.
+
+    @param aThread A pointer to the thread the LDD requesting the descriptor size is running in.
+    @param aSize A reference to a buffer into which the requested descriptor size should be written
+    (most likely located user-side).
+
+    @return The return value of the thread write operation, Kern::ThreadWrite(), when writing to the target
+    buffer.
+*/
+EXPORT_C TInt DUsbClientController::GetConfigurationDescriptorSize(DThread* aThread, TDes8& aSize)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::GetConfigurationDescriptorSize()"));
+    // We do not really enquire here....
+    const TPtrC8 size(reinterpret_cast<const TUint8*>(&KUsbDescSize_Config), sizeof(KUsbDescSize_Config));
+    return Kern::ThreadDesWrite(aThread, &aSize, size, 0);
+    }
+
+
+/** Returns the current USB OTG descriptor.
+
+    @param aThread A pointer to the thread the LDD requesting the descriptor size is running in.
+    @param aOtgDesc A reference to a buffer into which the requested descriptor should be
+    written (most likely located user-side).
+
+    @return KErrNotSupported or the return value of the thread write operation, Kern::ThreadDesWrite(),
+    when writing to the target buffer.
+*/
+EXPORT_C TInt DUsbClientController::GetOtgDescriptor(DThread* aThread, TDes8& aOtgDesc) const
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::GetOtgDescriptor()"));
+    if (!iOtgSupport)
+        {
+        return KErrNotSupported;
+        }
+    return iDescriptors.GetOtgDescriptorTC(aThread, aOtgDesc);
+    }
+
+
+/** Sets a new OTG descriptor.
+
+    @param aThread A pointer to the thread the LDD requesting the descriptor size is running in.
+    @param aOtgDesc A reference to a buffer which contains new OTG descriptor.
+
+    @return KErrNotSupported or the return value of the thread read operation, Kern::ThreadDesRead().
+*/
+EXPORT_C TInt DUsbClientController::SetOtgDescriptor(DThread* aThread, const TDesC8& aOtgDesc)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::SetOtgDescriptor()"));
+    if (!iOtgSupport)
+        {
+        return KErrNotSupported;
+        }
+    TBuf8<KUsbDescSize_Otg> otg;
+    const TInt r = Kern::ThreadDesRead(aThread, &aOtgDesc, otg, 0);
+    if (r != KErrNone)
+        {
+        return r;
+        }
+    // Check descriptor validity
+    if (otg[0] != KUsbDescSize_Otg || otg[1] != KUsbDescType_Otg || otg[2] > 3)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Invalid OTG descriptor"));
+        return KErrGeneral;
+        }
+    __KTRACE_OPT(KUSB, Kern::Printf("  iOtgFuncMap before: 0x%x", iOtgFuncMap));
+    // Update value in controller as well
+    const TUint8 hnp = otg[2] & KUsbOtgAttr_HnpSupp;
+    const TUint8 srp = otg[2] & KUsbOtgAttr_SrpSupp;
+    if (hnp && !srp)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Warning: Invalid OTG attribute combination (HNP && !SRP"));
+        }
+    if (hnp && !(iOtgFuncMap & KUsbOtgAttr_HnpSupp))
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  Setting attribute KUsbOtgAttr_HnpSupp"));
+        iOtgFuncMap |= KUsbOtgAttr_HnpSupp;
+        }
+    else if (!hnp && (iOtgFuncMap & KUsbOtgAttr_HnpSupp))
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  Removing attribute KUsbOtgAttr_HnpSupp"));
+        iOtgFuncMap &= ~KUsbOtgAttr_HnpSupp;
+        }
+    if (srp && !(iOtgFuncMap & KUsbOtgAttr_SrpSupp))
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  Setting attribute KUsbOtgAttr_SrpSupp"));
+        iOtgFuncMap |= KUsbOtgAttr_SrpSupp;
+        }
+    else if (!srp && (iOtgFuncMap & KUsbOtgAttr_SrpSupp))
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  Removing attribute KUsbOtgAttr_SrpSupp"));
+        iOtgFuncMap &= ~KUsbOtgAttr_SrpSupp;
+        }
+    __KTRACE_OPT(KUSB, Kern::Printf("  iOtgFuncMap after:  0x%x", iOtgFuncMap));
+    return iDescriptors.SetOtgDescriptor(otg);
+    }
+
+
+/** Returns current OTG features of USB device.
+
+    @param aThread A pointer to the thread the LDD requesting the descriptor size is running in.
+    @param aFeatures A reference to a buffer into which the requested OTG features should be written.
+
+    @return KErrNotSupported or the return value of the thread write operation, Kern::ThreadDesWrite().
+*/
+EXPORT_C TInt DUsbClientController::GetOtgFeatures(DThread* aThread, TDes8& aFeatures) const
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::GetOtgFeatures()"));
+    if (!iOtgSupport)
+        {
+        return KErrNotSupported;
+        }
+    TBuf8<1> features(1);
+    features[0] = iOtgFuncMap & 0x1C;
+    return Kern::ThreadDesWrite(aThread, &aFeatures, features, 0);
+    }
+
+
+/** Returns current OTG features of USB device. This function is intended to be
+    called only from kernel side.
+
+    @param aFeatures The reference to which the current features should be set at.
+    @return KErrNone if successful, KErrNotSupported if OTG is unavailable.
+*/
+EXPORT_C TInt DUsbClientController::GetCurrentOtgFeatures(TUint8& aFeatures) const
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::GetCurrentOtgFeatures()"));
+    if (!iOtgSupport)
+        {
+        return KErrNotSupported;
+        }
+    aFeatures = iOtgFuncMap & 0x1C;
+    return KErrNone;
+    }
+
+
+/** Registers client request for OTG feature change. Client is notified when any OTG
+    feature is changed.
+
+    @see KUsbOtgAttr_B_HnpEnable, KUsbOtgAttr_A_HnpSupport, KUsbOtgAttr_A_AltHnpSupport
+
+    @param aCallback Callback function. Gets called when OTG features change
+
+    @return KErrNone if successful, KErrAlreadyExists if aCallback is already in the queue.
+*/
+EXPORT_C TInt DUsbClientController::RegisterForOtgFeatureChange(TUsbcOtgFeatureCallback& aCallback)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::RegisterForOtgFeatureChange()"));
+    if (iOtgCallbacks.Elements() == KUsbcMaxListLength)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Maximum list length reached: %d",
+                                          KUsbcMaxListLength));
+        return KErrGeneral;
+        }
+    if (IsInTheOtgFeatureList(aCallback))
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  Error: OtgFeatureCallback @ 0x%x already registered", &aCallback));
+        return KErrAlreadyExists;
+        }
+    const TInt irq = __SPIN_LOCK_IRQSAVE(iUsbLock);
+    iOtgCallbacks.AddLast(aCallback);
+    __SPIN_UNLOCK_IRQRESTORE(iUsbLock, irq);
+    return KErrNone;
+    }
+
+
+/** De-registers (removes from the list of pending requests) a notification callback for
+    OTG feature change.
+
+    @param aClientId A pointer to the LDD owning the endpoint status change callback.
+
+    @return KErrNone if callback successfully unregistered, KErrNotFound if the callback couldn't be found.
+*/
+EXPORT_C TInt DUsbClientController::DeRegisterForOtgFeatureChange(const DBase* aClientId)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::DeRegisterForOtgFeatureChange()"));
+    __ASSERT_DEBUG((aClientId != NULL), Kern::Fault(KUsbPILPanicCat, __LINE__));
+    const TInt irq = __SPIN_LOCK_IRQSAVE(iUsbLock);
+    TSglQueIter<TUsbcOtgFeatureCallback> iter(iOtgCallbacks);
+    TUsbcOtgFeatureCallback* p;
+    while ((p = iter++) != NULL)
+        {
+        if (!aClientId || p->Owner() == aClientId)
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  removing OtgFeatureCallback @ 0x%x", p));
+            iOtgCallbacks.Remove(*p);
+            __SPIN_UNLOCK_IRQRESTORE(iUsbLock, irq);
+            return KErrNone;
+            }
+        }
+    __KTRACE_OPT(KUSB, Kern::Printf("  client not found"));
+    __SPIN_UNLOCK_IRQRESTORE(iUsbLock, irq);
+    return KErrNotFound;
+    }
+
+
+/** Returns a specific standard USB interface descriptor.
+
+    @param aThread A pointer to the thread the LDD requesting the descriptor is running in.
+    @param aClientId A pointer to the LDD requesting the descriptor.
+    @param aSettingNum The setting number of the interface for which the descriptor is requested.
+    @param aInterfaceDescriptor A reference to a buffer into which the requested descriptor should be written
+    (most likely located user-side).
+
+    @return KErrNotFound if the specified interface couldn't be found, otherwise the return value of the thread
+    write operation, Kern::ThreadWrite(), when writing to the target buffer.
+*/
+EXPORT_C TInt DUsbClientController::GetInterfaceDescriptor(DThread* aThread, const DBase* aClientId,
+                                                           TInt aSettingNum, TDes8& aInterfaceDescriptor)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::GetInterfaceDescriptor(x, 0x%08x, %d, y)",
+                                    aClientId, aSettingNum));
+    const TInt ifcset = ClientId2InterfaceNumber(aClientId);
+    if (ifcset < 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Interface not found from client ID"));
+        return KErrNotFound;
+        }
+    return iDescriptors.GetInterfaceDescriptorTC(aThread, aInterfaceDescriptor, ifcset, aSettingNum);
+    }
+
+
+/** Sets a new standard USB interface descriptor.
+
+    This function can also be used, by the user, and under certain conditions, to change an interface's number
+    (reported as bInterfaceNumber in the descriptor). The conditions are: 1) We cannot accept a number that is
+    already used by another interface, 2) We allow the interface number to be changed only when it's still the
+    only setting, and 3) We allow the interface number to be changed only for the default setting (0). (All
+    alternate settings created for that interface thereafter will inherit the new, changed number.)
+
+    @param aThread A pointer to the thread the LDD requesting the setting of the descriptor is running in.
+    @param aClientId A pointer to the LDD requesting the setting of the descriptor.
+    @param aSettingNum The setting number of the interface for which the descriptor is to be set.
+    @param aInterfaceDescriptor A reference to a buffer which contains the descriptor to be set (most
+    likely located user-side).
+
+    @return KErrNotFound if the specified interface couldn't be found, the return value of the thread read
+    operation, Kern::ThreadRead(), when reading from the source buffer in case of a failure, KErrArgument if the
+    interface  number is to be changed (via bInterfaceNumber in the descriptor) and either the requested
+    interface number is already used by another interface or the interface has more than one setting. KErrNone
+    if the new descriptor was successfully set.
+*/
+EXPORT_C TInt DUsbClientController::SetInterfaceDescriptor(DThread* aThread, const DBase* aClientId,
+                                                           TInt aSettingNum, const TDes8& aInterfaceDescriptor)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::SetInterfaceDescriptor(x, 0x%08x, %d, y)",
+                                    aClientId, aSettingNum));
+    const TInt ifcset = ClientId2InterfaceNumber(aClientId);
+    if (ifcset < 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Interface not found from client ID"));
+        return KErrNotFound;
+        }
+    TBuf8<KUsbDescSize_Interface> new_ifc;
+    TInt r = Kern::ThreadDesRead(aThread, &aInterfaceDescriptor, new_ifc, 0);
+    if (r != KErrNone)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Copying interface descriptor buffer failed (%d)", r));
+        return r;
+        }
+    const TInt ifcset_new = new_ifc[2];
+    const TBool ifc_num_changes = (ifcset != ifcset_new);
+    TUsbcInterfaceSet* const ifcset_ptr = InterfaceNumber2InterfacePointer(ifcset);
+    if (!ifcset_ptr)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: interface number %d doesn't exist", ifcset));
+        return KErrNotFound;
+        }
+    if (ifc_num_changes)
+        {
+        // If the user wants to change the interface number, we need to do some sanity checks:
+        if (InterfaceExists(ifcset_new))
+            {
+            // Obviously we cannot accept a number that is already used by another interface.
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: interface number %d already in use", ifcset_new));
+            return KErrArgument;
+            }
+        if (ifcset_ptr->iInterfaces.Count() > 1)
+            {
+            // We allow the interface number to be changed only when it's the only setting.
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: interface has more than one alternate setting"));
+            return KErrArgument;
+            }
+        if (aSettingNum != 0)
+            {
+            // We allow the interface number to be changed only when it's the default setting.
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: interface number can only be changed for setting 0"));
+            return KErrArgument;
+            }
+        }
+    if ((r = iDescriptors.SetInterfaceDescriptor(new_ifc, ifcset, aSettingNum)) != KErrNone)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: iDescriptors.SetInterfaceDescriptorfailed"));
+        return r;
+        }
+    if (ifc_num_changes)
+        {
+        // Alright then, let's do it...
+        __KTRACE_OPT(KUSB, Kern::Printf("  about to change interface number from %d to %d",
+                                        ifcset, ifcset_new));
+        ifcset_ptr->iInterfaceNumber = ifcset_new;
+        }
+    return KErrNone;
+    }
+
+
+/** Returns the size of a specific standard USB interface descriptor.
+
+    @param aThread A pointer to the thread the LDD requesting the descriptor size is running in.
+    @param aClientId A pointer to the LDD requesting the descriptor size.
+    @param aSettingNum The setting number of the interface for which the descriptor size is requested.
+    @param aSize A reference to a buffer into which the requested descriptor size should be written (most
+    likely located user-side).
+
+    @return KErrNotFound if the specified interface couldn't be found, otherwise the return value of the thread
+    write operation, Kern::ThreadWrite(), when writing to the target buffer.
+*/
+EXPORT_C TInt DUsbClientController::GetInterfaceDescriptorSize(DThread* aThread, const DBase* aClientId,
+                                                               TInt /*aSettingNum*/, TDes8& aSize)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::GetInterfaceDescriptorSize()"));
+    const TInt ifcset = ClientId2InterfaceNumber(aClientId);
+    if (ifcset < 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Interface not found from client ID"));
+        return KErrNotFound;
+        }
+    // Actually, we do not really enquire here....
+    const TPtrC8 size(reinterpret_cast<const TUint8*>(&KUsbDescSize_Interface), sizeof(KUsbDescSize_Interface));
+    Kern::ThreadDesWrite(aThread, &aSize, size, 0);
+    return KErrNone;
+    }
+
+
+/** Returns a specific standard USB endpoint descriptor.
+
+    @param aThread A pointer to the thread the LDD requesting the descriptor is running in.
+    @param aClientId A pointer to the LDD requesting the descriptor.
+    @param aSettingNum The setting number of the interface that contains the endpoint for which the
+    descriptor is requested.
+    @param aEndpointNum The endpoint for which the descriptor is requested.
+    @param aEndpointDescriptor A reference to a buffer into which the requested descriptor should be written
+    (most likely located user-side).
+
+    @return KErrNotFound if the specified interface or endpoint couldn't be found, otherwise the return value
+    of the thread write operation, Kern::ThreadWrite(), when writing to the target buffer.
+*/
+EXPORT_C TInt DUsbClientController::GetEndpointDescriptor(DThread* aThread, const DBase* aClientId,
+                                                          TInt aSettingNum, TInt aEndpointNum,
+                                                          TDes8& aEndpointDescriptor)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::GetEndpointDescriptor(x, 0x%08x, %d, %d, y)",
+                                    aClientId, aSettingNum, aEndpointNum));
+    const TInt ifcset = ClientId2InterfaceNumber(aClientId);
+    if (ifcset < 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Interface not found from client ID"));
+        return KErrNotFound;
+        }
+    return iDescriptors.GetEndpointDescriptorTC(aThread, aEndpointDescriptor, ifcset,
+                                                aSettingNum, EpIdx2Addr(aEndpointNum));
+    }
+
+
+/** Sets a new standard USB endpoint descriptor.
+
+    @param aThread A pointer to the thread the LDD requesting the setting of the descriptor is running in.
+    @param aClientId A pointer to the LDD requesting the setting of the descriptor.
+    @param aSettingNum The setting number of the interface that contains the endpoint for which the
+    descriptor is to be set.
+    @param aEndpointNum The endpoint for which the descriptor is to be set.
+    @param aEndpointDescriptor A reference to a buffer which contains the descriptor to be set (most
+    likely located user-side).
+
+    @return KErrNotFound if the specified interface or endpoint couldn't be found, the return value of the
+    thread read operation, Kern::ThreadRead(), when reading from the source buffer in case of a read failure,
+    KErrNone if the new descriptor was successfully set.
+*/
+EXPORT_C TInt DUsbClientController::SetEndpointDescriptor(DThread* aThread, const DBase* aClientId,
+                                                          TInt aSettingNum, TInt aEndpointNum,
+                                                          const TDes8& aEndpointDescriptor)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::SetEndpointDescriptor(x, 0x%08x, %d, %d, y)",
+                                    aClientId, aSettingNum, aEndpointNum));
+    const TInt ifcset = ClientId2InterfaceNumber(aClientId);
+    if (ifcset < 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Interface not found from client ID"));
+        return KErrNotFound;
+        }
+    return iDescriptors.SetEndpointDescriptorTC(aThread, aEndpointDescriptor, ifcset,
+                                                aSettingNum, EpIdx2Addr(aEndpointNum));
+    }
+
+
+/** Returns the size of a specific standard USB endpoint descriptor.
+
+    @param aThread A pointer to the thread the LDD requesting the descriptor size is running in.
+    @param aClientId A pointer to the LDD requesting the descriptor size.
+    @param aSettingNum The setting number of the interface that contains the endpoint for which the
+    descriptor size is requested.
+    @param aEndpointNum The endpoint for which the descriptor size is requested.
+    @param aEndpointDescriptor A reference to a buffer into which the requested descriptor size should be
+    written (most likely located user-side).
+
+    @return KErrNotFound if the specified interface or endpoint couldn't be found, otherwise the return value
+    of the thread write operation, kern::ThreadWrite(), when writing to the target buffer.
+*/
+EXPORT_C TInt DUsbClientController::GetEndpointDescriptorSize(DThread* aThread, const DBase* aClientId,
+                                                              TInt aSettingNum, TInt aEndpointNum,
+                                                              TDes8& aSize)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::GetEndpointDescriptorSize(x, 0x%08x, %d, %d, y)",
+                                    aClientId, aSettingNum, aEndpointNum));
+    const TInt ifcset = ClientId2InterfaceNumber(aClientId);
+    if (ifcset < 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Interface not found from client ID"));
+        return KErrNotFound;
+        }
+    TInt s;
+    TInt r = iDescriptors.GetEndpointDescriptorSize(ifcset, aSettingNum,
+                                                    EpIdx2Addr(aEndpointNum), s);
+    if (r == KErrNone)
+        {
+        TPtrC8 size(reinterpret_cast<const TUint8*>(&s), sizeof(s));
+        r = Kern::ThreadDesWrite(aThread, &aSize, size, 0);
+        }
+    else
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: endpoint descriptor not found"));
+        }
+    return r;
+    }
+
+
+/** Returns the current Device_Qualifier descriptor. On a USB device which doesn't support high-speed
+    operation this function will return an error. Note that the contents of the descriptor depend on
+    the current device speed (full-speed or high-speed).
+
+    @param aThread A pointer to the thread the LDD requesting the descriptor is running in.
+    @param aDeviceQualifierDescriptor A reference to a buffer into which the requested descriptor
+    should be written (most likely located user-side).
+
+    @return KErrNotSupported if this descriptor is not supported, otherwise the return value of the thread
+    write operation, Kern::ThreadWrite(), when writing to the target buffer.
+*/
+EXPORT_C TInt DUsbClientController::GetDeviceQualifierDescriptor(DThread* aThread,
+                                                                 TDes8& aDeviceQualifierDescriptor)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::GetDeviceQualifierDescriptor()"));
+    return iDescriptors.GetDeviceQualifierDescriptorTC(aThread, aDeviceQualifierDescriptor);
+    }
+
+
+/** Sets a new Device_Qualifier descriptor. On a USB device which doesn't support high-speed
+    operation this function will return an error. Note that the contents of the descriptor should take
+    into account the current device speed (full-speed or high-speed) as it is dependent on it.
+
+    @param aThread A pointer to the thread the LDD requesting the setting of the descriptor is running in.
+    @param aDeviceQualifierDescriptor A reference to a buffer which contains the descriptor to be set (most
+    likely located user-side).
+
+    @return KErrNotSupported if this descriptor is not supported, otherwise the return value of the thread
+    read operation, Kern::ThreadRead(), when reading from the source buffer in case of a failure, KErrNone if
+    the new descriptor was successfully set.
+*/
+EXPORT_C TInt DUsbClientController::SetDeviceQualifierDescriptor(DThread* aThread,
+                                                                 const TDes8& aDeviceQualifierDescriptor)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::SetDeviceQualifierDescriptor()"));
+    return iDescriptors.SetDeviceQualifierDescriptorTC(aThread, aDeviceQualifierDescriptor);
+    }
+
+
+/** Returns the current Other_Speed_Configuration descriptor. On a USB device which doesn't support high-speed
+    operation this function will return an error. Note that the contents of the descriptor depend on the
+    current device speed (full-speed or high-speed).
+
+    @param aThread A pointer to the thread the LDD requesting the descriptor is running in.
+    @param aConfigurationDescriptor A reference to a buffer into which the requested descriptor
+    should be written (most likely located user-side).
+
+    @return KErrNotSupported if this descriptor is not supported, otherwise the return value of the thread
+    write operation, Kern::ThreadWrite(), when writing to the target buffer.
+*/
+EXPORT_C TInt DUsbClientController::GetOtherSpeedConfigurationDescriptor(DThread* aThread,
+                                                                         TDes8& aConfigurationDescriptor)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::GetOtherSpeedConfigurationDescriptor()"));
+    return iDescriptors.GetOtherSpeedConfigurationDescriptorTC(aThread, aConfigurationDescriptor);
+    }
+
+
+/** Sets a new Other_Speed_Configuration descriptor. On a USB device which doesn't support high-speed
+    operation this function will return an error. Note that the contents of the descriptor should take
+    into account the current device speed (full-speed or high-speed) as it is dependent on it.
+
+    @param aThread A pointer to the thread the LDD requesting the setting of the descriptor is running in.
+    @param aConfigurationDescriptor A reference to a buffer which contains the descriptor to be set (most
+    likely located user-side).
+
+    @return KErrNotSupported if this descriptor is not supported, otherwise the return value of the thread
+    read operation, Kern::ThreadRead(), when reading from the source buffer in case of a failure, KErrNone if
+    the new descriptor was successfully set.
+*/
+EXPORT_C TInt DUsbClientController::SetOtherSpeedConfigurationDescriptor(DThread* aThread,
+                                                                         const TDes8& aConfigurationDescriptor)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::SetOtherSpeedConfigurationDescriptor()"));
+    return iDescriptors.SetOtherSpeedConfigurationDescriptorTC(aThread, aConfigurationDescriptor);
+    }
+
+
+/** Returns a block of all available non-standard (class-specific) interface descriptors for a specific
+    interface.
+
+    @param aThread A pointer to the thread the LDD requesting the descriptor block is running in.
+    @param aClientId A pointer to the LDD requesting the descriptor block.
+    @param aSettingNum The setting number of the interface for which the descriptor block is requested.
+    @param aInterfaceDescriptor A reference to a buffer into which the requested descriptor(s) should be
+    written (most likely located user-side).
+
+    @return KErrNotFound if the specified interface couldn't be found, otherwise the return value of the thread
+    write operation, Kern::ThreadWrite(), when writing to the target buffer.
+*/
+EXPORT_C TInt DUsbClientController::GetCSInterfaceDescriptorBlock(DThread* aThread, const DBase* aClientId,
+                                                                  TInt aSettingNum,
+                                                                  TDes8& aInterfaceDescriptor)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::GetCSInterfaceDescriptorBlock(x, 0x%08x, %d, y)",
+                                    aClientId, aSettingNum));
+    const TInt ifcset = ClientId2InterfaceNumber(aClientId);
+    if (ifcset < 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Interface not found from client ID"));
+        return KErrNotFound;
+        }
+    return iDescriptors.GetCSInterfaceDescriptorTC(aThread, aInterfaceDescriptor, ifcset, aSettingNum);
+    }
+
+
+/** Sets a block of (i.e. one or more) non-standard (class-specific) interface descriptors for a specific
+    interface.
+
+    @param aThread A pointer to the thread the LDD requesting the setting of the descriptor block is running
+    in.
+    @param aClientId A pointer to the LDD requesting the setting of the descriptor block.
+    @param aSettingNum The setting number of the interface for which the setting of the descriptor block is
+    requested.
+    @param aInterfaceDescriptor A reference to a buffer which contains the descriptor block to be set (most
+    likely located user-side).
+    @param aSize The size of the descriptor block to be set.
+
+    @return KErrNotFound if the specified interface couldn't be found, KErrArgument if aSize is less than 2,
+    KErrNoMemory if enough memory for the new descriptor(s) couldn't be allocated, otherwise the return value
+    of the thread read operation, Kern::ThreadRead(), when reading from the source buffer.
+*/
+EXPORT_C TInt DUsbClientController::SetCSInterfaceDescriptorBlock(DThread* aThread, const DBase* aClientId,
+                                                                  TInt aSettingNum,
+                                                                  const TDes8& aInterfaceDescriptor, TInt aSize)
+    {
+    __KTRACE_OPT(KUSB,
+                 Kern::Printf("DUsbClientController::SetCSInterfaceDescriptorBlock(x, 0x%08x, %d, y, %d)",
+                              aClientId, aSettingNum, aSize));
+    const TInt ifcset = ClientId2InterfaceNumber(aClientId);
+    if (ifcset < 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Interface not found from client ID"));
+        return KErrNotFound;
+        }
+    if (aSize < 2)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: aSize < 2 (%d)", aSize));
+        return KErrArgument;
+        }
+    return iDescriptors.SetCSInterfaceDescriptorTC(aThread, aInterfaceDescriptor, ifcset, aSettingNum, aSize);
+    }
+
+
+/** Returns the total size all non-standard (class-specific) interface descriptors for a specific interface.
+
+    @param aThread A pointer to the thread the LDD requesting the descriptor block size is running in.
+    @param aClientId A pointer to the LDD requesting the descriptor block size.
+    @param aSettingNum The setting number of the interface for which the descriptor block size is
+    requested.
+    @param aSize A reference to a buffer into which the requested descriptor block size should be written (most
+    likely located user-side).
+
+    @return KErrNotFound if the specified interface couldn't be found, otherwise the return value of the thread
+    write operation, Kern::ThreadWrite(), when writing to the target buffer.
+*/
+EXPORT_C TInt DUsbClientController::GetCSInterfaceDescriptorBlockSize(DThread* aThread, const DBase* aClientId,
+                                                                      TInt aSettingNum, TDes8& aSize)
+    {
+    __KTRACE_OPT(KUSB,
+                 Kern::Printf("DUsbClientController::GetCSInterfaceDescriptorBlockSize(x, 0x%08x, %d, y)",
+                              aClientId, aSettingNum));
+    const TInt ifcset = ClientId2InterfaceNumber(aClientId);
+    if (ifcset < 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Interface not found from client ID"));
+        return KErrNotFound;
+        }
+    TInt s;
+    const TInt r = iDescriptors.GetCSInterfaceDescriptorSize(ifcset, aSettingNum, s);
+    if (r == KErrNone)
+        {
+        const TPtrC8 size(reinterpret_cast<const TUint8*>(&s), sizeof(s));
+        Kern::ThreadDesWrite(aThread, &aSize, size, 0);
+        }
+    else
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: cs interface descriptor not found"));
+        }
+    return r;
+    }
+
+
+/** Returns a block of all available non-standard (class-specific) endpoint descriptors for a specific endpoint.
+
+    @param aThread A pointer to the thread the LDD requesting the descriptor block is running in.
+    @param aClientId A pointer to the LDD requesting the descriptor block.
+    @param aSettingNum The setting number of the interface that contains the endpoint for which the
+    descriptor block is requested.
+    @param aEndpointNum The endpoint for which the descriptor block is requested.
+    @param aEndpointDescriptor A reference to a buffer into which the requested descriptor(s) should be written
+    (most likely located user-side).
+
+    @return KErrNotFound if the specified interface or endpoint couldn't be found, otherwise the return value
+    of the thread write operation, Kern::ThreadWrite(), when writing to the target buffer.
+*/
+EXPORT_C TInt DUsbClientController::GetCSEndpointDescriptorBlock(DThread* aThread, const DBase* aClientId,
+                                                                 TInt aSettingNum, TInt aEndpointNum,
+                                                                 TDes8& aEndpointDescriptor)
+    {
+    __KTRACE_OPT(KUSB,
+                 Kern::Printf("DUsbClientController::GetCSEndpointDescriptorBlock(x, 0x%08x, %d, %d, y)",
+                              aClientId, aSettingNum, aEndpointNum));
+    const TInt ifcset = ClientId2InterfaceNumber(aClientId);
+    if (ifcset < 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Interface not found from client ID"));
+        return KErrNotFound;
+        }
+    return iDescriptors.GetCSEndpointDescriptorTC(aThread, aEndpointDescriptor, ifcset,
+                                                  aSettingNum, EpIdx2Addr(aEndpointNum));
+    }
+
+
+/** Sets a block of (i.e. one or more) non-standard (class-specific) endpoint descriptors for a specific
+    endpoint.
+
+    @param aThread A pointer to the thread the LDD requesting the setting of the descriptor block is running
+    in.
+    @param aClientId A pointer to the LDD requesting the setting of the descriptor block.
+    @param aSettingNum The setting number of the interface that contains the endpoint for which the
+    descriptor block is to be set.
+    @param aEndpointNum The endpoint for which the descriptor block is to be set.
+    @param aEndpointDescriptor A reference to a buffer which contains the descriptor block to be set (most
+    likely located user-side).
+    @param aSize The size of the descriptor block to be set.
+
+    @return KErrNotFound if the specified interface or endpoint couldn't be found, KErrArgument if aSize is
+    less than 2, KErrNoMemory if enough memory for the new descriptor(s) couldn't be allocated, otherwise the
+    return value of the thread read operation, Kern::ThreadRead(), when reading from the source buffer.
+*/
+EXPORT_C TInt DUsbClientController::SetCSEndpointDescriptorBlock(DThread* aThread, const DBase* aClientId,
+                                                                 TInt aSettingNum, TInt aEndpointNum,
+                                                                 const TDes8& aEndpointDescriptor, TInt aSize)
+    {
+    __KTRACE_OPT(KUSB,
+                 Kern::Printf("DUsbClientController::SetCSEndpointDescriptorBlock(x, 0x%08x, %d, %d, y)",
+                              aClientId, aSettingNum, aEndpointNum));
+    const TInt ifcset = ClientId2InterfaceNumber(aClientId);
+    if (ifcset < 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Interface not found from client ID"));
+        return KErrNotFound;
+        }
+    if (aSize < 2)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: aSize < 2 (%d)", aSize));
+        return KErrArgument;
+        }
+    return iDescriptors.SetCSEndpointDescriptorTC(aThread, aEndpointDescriptor, ifcset,
+                                                  aSettingNum, EpIdx2Addr(aEndpointNum), aSize);
+    }
+
+
+/** Returns the total size all non-standard (class-specific) endpoint descriptors for a specific endpoint.
+
+    @param aThread A pointer to the thread the LDD requesting the descriptor block size is running in.
+    @param aClientId A pointer to the LDD requesting the descriptor block size.
+    @param aSettingNum The setting number of the interface for which the descriptor block size is
+    requested.
+    @param aEndpointNum The endpoint for which the descriptor block size is requested.
+    @param aSize A reference to a buffer into which the requested descriptor block size should be written (most
+    likely located user-side).
+
+    @return KErrNotFound if the specified interface or endpoint couldn't be found, otherwise the return value
+    of the thread write operation, Kern::ThreadWrite(), when writing to the target buffer.
+*/
+EXPORT_C TInt DUsbClientController::GetCSEndpointDescriptorBlockSize(DThread* aThread, const DBase* aClientId,
+                                                                     TInt aSettingNum, TInt aEndpointNum,
+                                                                     TDes8& aSize)
+    {
+    __KTRACE_OPT(KUSB,
+                 Kern::Printf("DUsbClientController::GetCSEndpointDescriptorBlockSize(x, 0x%08x, %d, %d, y)",
+                              aClientId, aSettingNum, aEndpointNum));
+    const TInt ifcset = ClientId2InterfaceNumber(aClientId);
+    if (ifcset < 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Interface not found from client ID"));
+        return KErrNotFound;
+        }
+    TInt s;
+    const TInt r = iDescriptors.GetCSEndpointDescriptorSize(ifcset, aSettingNum,
+                                                            EpIdx2Addr(aEndpointNum), s);
+    if (r == KErrNone)
+        {
+        const TPtrC8 size(reinterpret_cast<const TUint8*>(&s), sizeof(s));
+        Kern::ThreadDesWrite(aThread, &aSize, size, 0);
+        }
+    else
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: cs endpoint descriptor not found"));
+        }
+    return r;
+    }
+
+
+/** Returns the currently set string descriptor language ID (LANGID) code.
+
+    @param aThread A pointer to the thread the LDD requesting the LANGID is running in.
+    @param aLangId A reference to a buffer into which the requested code should be written (most likely
+    located user-side).
+
+    @return The return value of the thread write operation, Kern::ThreadDesWrite(),
+    when writing to the target buffer.
+*/
+EXPORT_C TInt DUsbClientController::GetStringDescriptorLangId(DThread* aThread, TDes8& aLangId)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::GetStringDescriptorLangId()"));
+    return iDescriptors.GetStringDescriptorLangIdTC(aThread, aLangId);
+    }
+
+
+/** Sets the string descriptor language ID (LANGID) code.
+
+    @param aLangId The langauge ID code to be written.
+
+    @return KErrNone.
+*/
+EXPORT_C TInt DUsbClientController::SetStringDescriptorLangId(TUint16 aLangId)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::GetStringDescriptorLangId()"));
+    return iDescriptors.SetStringDescriptorLangId(aLangId);
+    }
+
+
+/** Returns the currently set Manufacturer string (which is referenced by the iManufacturer field in the device
+    descriptor).
+
+    (Thus, the function should actually be called either 'GetManufacturerString'
+    or 'GetManufacturerStringDescriptorString'.)
+
+    @param aThread A pointer to the thread the LDD requesting the string is running in.
+    @param aString A reference to a buffer into which the requested string should be written (most likely
+    located user-side).
+
+    @return KErrNotFound if the string descriptor couldn't be found (PIL internal error), otherwise the return
+    value of the thread write operation, Kern::ThreadWrite(), when writing to the target buffer.
+*/
+EXPORT_C TInt DUsbClientController::GetManufacturerStringDescriptor(DThread* aThread, TDes8& aString)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::GetManufacturerStringDescriptor()"));
+    return iDescriptors.GetManufacturerStringDescriptorTC(aThread, aString);
+    }
+
+
+/** Sets a new Manufacturer string in the Manufacturer string descriptor (which is referenced by the
+    iManufacturer field in the device descriptor).
+
+    (Thus, the function should actually be called either
+    'SetManufacturerString' or 'SetManufacturerStringDescriptorString'.)
+
+    @param aThread A pointer to the thread the LDD requesting the setting of the string is running in.
+    @param aString A reference to a buffer which contains the string to be set (most likely located
+    user-side).
+
+    @return KErrNoMemory if not enough memory for the new descriptor or the string could be allocated, the
+    return value of the thread read operation, Kern::ThreadRead(), if reading from the source buffer goes wrong,
+    KErrNone if new string descriptor successfully set.
+*/
+EXPORT_C TInt DUsbClientController::SetManufacturerStringDescriptor(DThread* aThread, const TDes8& aString)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::SetManufacturerStringDescriptor()"));
+    return iDescriptors.SetManufacturerStringDescriptorTC(aThread, aString);
+    }
+
+
+/** Removes (deletes) the Manufacturer string descriptor (which is referenced by the
+    iManufacturer field in the device descriptor).
+
+    @return KErrNone if successful, KErrNotFound if the string descriptor couldn't be found
+*/
+EXPORT_C TInt DUsbClientController::RemoveManufacturerStringDescriptor()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::RemoveManufacturerStringDescriptor()"));
+    return iDescriptors.RemoveManufacturerStringDescriptor();
+    }
+
+
+/** Returns the currently set Product string (which is referenced by the iProduct field in the device
+    descriptor).
+
+    (Thus, the function should actually be called either 'GetProductString' or
+    'GetProductStringDescriptorString'.)
+
+    @param aThread A pointer to the thread the LDD requesting the string is running in.
+    @param aString A reference to a buffer into which the requested string should be written (most likely
+    located user-side).
+
+    @return KErrNotFound if the string descriptor couldn't be found (PIL internal error), otherwise the return
+    value of the thread write operation, Kern::ThreadWrite(), when writing to the target buffer.
+*/
+EXPORT_C TInt DUsbClientController::GetProductStringDescriptor(DThread* aThread, TDes8& aString)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::GetProductStringDescriptor()"));
+    return iDescriptors.GetProductStringDescriptorTC(aThread, aString);
+    }
+
+
+/** Sets a new Product string in the Product string descriptor (which is referenced by the iProduct field in
+    the device descriptor).
+
+    (Thus, the function should actually be called either 'SetProductString' or
+    'SetProductStringDescriptorString'.)
+
+    @param aThread A pointer to the thread the LDD requesting the setting of the string is running in.
+    @param aString A reference to a buffer which contains the string to be set (most likely located
+    user-side).
+
+    @return KErrNoMemory if not enough memory for the new descriptor or the string could be allocated, the
+    return value of the thread read operation, Kern::ThreadRead(), if reading from the source buffer goes wrong,
+    KErrNone if new string descriptor successfully set.
+*/
+EXPORT_C TInt DUsbClientController::SetProductStringDescriptor(DThread* aThread, const TDes8& aString)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::SetProductStringDescriptor()"));
+    return iDescriptors.SetProductStringDescriptorTC(aThread, aString);
+    }
+
+
+/** Removes (deletes) the Product string descriptor (which is referenced by the
+    iProduct field in the device descriptor).
+
+    @return KErrNone if successful, KErrNotFound if the string descriptor couldn't be found
+*/
+EXPORT_C TInt DUsbClientController::RemoveProductStringDescriptor()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::RemoveProductStringDescriptor()"));
+    return iDescriptors.RemoveProductStringDescriptor();
+    }
+
+
+/** Returns the currently set SerialNumber string (which is referenced by the iSerialNumber field in the device
+    descriptor).
+
+    (Thus, the function should actually be called either 'GetSerialNumberString' or
+    'GetSerialNumberStringDescriptorString'.)
+
+    @param aThread A pointer to the thread the LDD requesting the string is running in.
+    @param aString A reference to a buffer into which the requested string should be written (most likely
+    located user-side).
+
+    @return KErrNotFound if the string descriptor couldn't be found (PIL internal error), otherwise the return
+    value of the thread write operation, Kern::ThreadWrite(), when writing to the target buffer.
+*/
+EXPORT_C TInt DUsbClientController::GetSerialNumberStringDescriptor(DThread* aThread, TDes8& aString)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::GetSerialNumberStringDescriptor()"));
+    return iDescriptors.GetSerialNumberStringDescriptorTC(aThread, aString);
+    }
+
+
+/** Sets a new SerialNumber string in the SerialNumber string descriptor (which is referenced by the
+    iSerialNumber field in the device descriptor).
+
+    (Thus, the function should actually be called either
+    'SetSerialNumberString' or 'SetSerialNumberStringDescriptorString'.)
+
+    @param aThread A pointer to the thread the LDD requesting the setting of the string is running in.
+    @param aString A reference to a buffer which contains the string to be set (most likely located
+    user-side).
+
+    @return KErrNoMemory if not enough memory for the new descriptor or the string could be allocated, the
+    return value of the thread read operation, Kern::ThreadRead(), if reading from the source buffer goes wrong,
+    KErrNone if new string descriptor successfully set.
+*/
+EXPORT_C TInt DUsbClientController::SetSerialNumberStringDescriptor(DThread* aThread, const TDes8& aString)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::SetSerialNumberStringDescriptor()"));
+    return iDescriptors.SetSerialNumberStringDescriptorTC(aThread, aString);
+    }
+
+
+/** Removes (deletes) the Serial Number string descriptor (which is referenced by the
+    iSerialNumber field in the device descriptor).
+
+    @return KErrNone if successful, KErrNotFound if the string descriptor couldn't be found
+*/
+EXPORT_C TInt DUsbClientController::RemoveSerialNumberStringDescriptor()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::RemoveSerialNumberStringDescriptor()"));
+    return iDescriptors.RemoveSerialNumberStringDescriptor();
+    }
+
+
+/** Returns the currently set Configuration string (which is referenced by the iConfiguration field in the
+    configuration descriptor).
+
+    (Thus, the function should actually be called either 'GetConfigurationString' or
+    'GetConfigurationStringDescriptorString'.)
+
+    @param aThread A pointer to the thread the LDD requesting the string is running in.
+    @param aString A reference to a buffer into which the requested string should be written (most likely
+    located user-side).
+
+    @return KErrNotFound if the string descriptor couldn't be found (PIL internal error), otherwise the return
+    value of the thread write operation, Kern::ThreadWrite(), when writing to the target buffer.
+*/
+EXPORT_C TInt DUsbClientController::GetConfigurationStringDescriptor(DThread* aThread, TDes8& aString)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::GetConfigurationStringDescriptor()"));
+    return iDescriptors.GetConfigurationStringDescriptorTC(aThread, aString);
+    }
+
+
+/** Sets a new Configuration string in the Configuration string descriptor (which is referenced by the
+    iConfiguration field in the configuration descriptor).
+
+    (Thus, the function should actually be called either
+    'SetConfigurationString' or 'SetConfigurationStringDescriptorString'.)
+
+    @param aThread A pointer to the thread the LDD requesting the setting of the string is running in.
+    @param aString A reference to a buffer which contains the string to be set (most likely located
+    user-side).
+
+    @return KErrNoMemory if not enough memory for the new descriptor or the string could be allocated, the
+    return value of the thread read operation, Kern::ThreadRead(), if reading from the source buffer goes wrong,
+    KErrNone if new string descriptor successfully set.
+*/
+EXPORT_C TInt DUsbClientController::SetConfigurationStringDescriptor(DThread* aThread, const TDes8& aString)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::SetConfigurationStringDescriptor()"));
+    return iDescriptors.SetConfigurationStringDescriptorTC(aThread, aString);
+    }
+
+
+/** Removes (deletes) the Configuration string descriptor (which is referenced by the
+    iConfiguration field in the configuration descriptor).
+
+    @return KErrNone if successful, KErrNotFound if the string descriptor couldn't be found.
+*/
+EXPORT_C TInt DUsbClientController::RemoveConfigurationStringDescriptor()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::RemoveConfigurationStringDescriptor()"));
+    return iDescriptors.RemoveConfigurationStringDescriptor();
+    }
+
+
+/** Copies the string descriptor at the specified index in the string descriptor array into
+    the aString argument.
+
+    @param aIndex The position of the string descriptor in the string descriptor array.
+    @param aThread A pointer to the thread the LDD requesting the string is running in.
+    @param aString A reference to a buffer into which the requested string should be written (most likely
+    located user-side).
+
+    @return KErrNone if successful, KErrNotFound if no string descriptor exists at the specified index, or the
+    return value of the thread write operation, Kern::ThreadWrite(), when writing to the target buffer.
+*/
+EXPORT_C TInt DUsbClientController::GetStringDescriptor(DThread* aThread, TUint8 aIndex, TDes8& aString)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::GetStringDescriptor(%d)", aIndex));
+    return iDescriptors.GetStringDescriptorTC(aThread, aIndex, aString);
+    }
+
+
+/** Sets the aString argument to be a string descriptor at the specified index in the string
+    descriptor array. If a string descriptor already exists at that position then it will be replaced.
+
+    @param aIndex The position of the string descriptor in the string descriptor array.
+    @param aThread A pointer to the thread the LDD requesting the setting of the string is running in.
+    @param aString A reference to a buffer which contains the string to be set (most likely located
+    user-side).
+
+    @return KErrNone if successful, KErrArgument if aIndex is invalid, KErrNoMemory if no memory is available
+    to store the new string (an existing descriptor at that index will be preserved), or the return value of
+    the thread read operation, Kern::ThreadRead(), if reading from the source buffer goes wrong.
+*/
+EXPORT_C TInt DUsbClientController::SetStringDescriptor(DThread* aThread, TUint8 aIndex, const TDes8& aString)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::SetStringDescriptor(%d)", aIndex));
+    return iDescriptors.SetStringDescriptorTC(aThread, aIndex, aString);
+    }
+
+
+/** Removes (deletes) the string descriptor at the specified index in the string descriptor array.
+
+    @param aIndex The position of the string descriptor in the string descriptor array.
+
+    @return KErrNone if successful, KErrNotFound if no string descriptor exists at the specified index.
+*/
+EXPORT_C TInt DUsbClientController::RemoveStringDescriptor(TUint8 aIndex)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::RemoveStringDescriptor(%d)", aIndex));
+    return iDescriptors.RemoveStringDescriptor(aIndex);
+    }
+
+
+/** Queries the use of and endpoint resource.
+
+    If the resource gets successfully allocated, it will be used from when the current bus transfer
+    has been completed.
+
+    @param aClientId A pointer to the LDD querying the endpoint resource.
+    @param aEndpointNum The number of the endpoint.
+    @param aResource The endpoint resource to be queried.
+
+    @return ETrue if the specified resource is in use at the endpoint, EFalse if not or if there was any error
+    during the execution of the function.
+*/
+EXPORT_C TBool DUsbClientController::QueryEndpointResource(const DBase* /*aClientId*/, TInt aEndpointNum,
+                                                           TUsbcEndpointResource aResource)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::QueryEndpointResource()"));
+    return iController.QueryEndpointResource(aEndpointNum, aResource);
+    }
+
+
+EXPORT_C TInt DUsbClientController::EndpointPacketSize(const DBase* aClientId, TInt aEndpointNum)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::EndpointPacketSize(0x%08x, %d)",
+                                    aClientId, aEndpointNum));
+
+    const TUsbcInterfaceSet* const ifcset_ptr = ClientId2InterfacePointer(aClientId);
+    if (!ifcset_ptr)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: interface or clientid not found"));
+        return -1;
+        }
+    const TUsbcInterface* const ifc_ptr = ifcset_ptr->iInterfaces[ifcset_ptr->iCurrentInterface];
+    const RPointerArray<TUsbcLogicalEndpoint>& ep_array = ifc_ptr->iEndpoints;
+    const TInt n = ep_array.Count();
+    for (TInt i = 0; i < n; i++)
+        {
+        const TUsbcLogicalEndpoint* const ep = ep_array[i];
+        if (EpAddr2Idx(ep->iPEndpoint->iEndpointAddr) == static_cast<TUint>(aEndpointNum))
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  Endpoint packet sizes: FS = %d  HS = %d",
+                                            ep->iEpSize_Fs, ep->iEpSize_Hs));
+            const TInt size = iHighSpeed ? ep->iEpSize_Hs : ep->iEpSize_Fs;
+            __KTRACE_OPT(KUSB, Kern::Printf("  Returning %d", size));
+            return size;
+            }
+        }
+    __KTRACE_OPT(KPANIC, Kern::Printf("  Error: endpoint not found"));
+    return -1;
+    }
+    
+EXPORT_C TDfcQue*  DUsbClientController::DfcQ(TInt /*aIndex*/)
+    {
+    return iControllerProperties.iDfcQueue;
+    }
+    
+EXPORT_C void DUsbClientController::DumpRegisters()
+    {
+    return;
+    }
+    
+EXPORT_C TInt DUsbClientController::SignalRemoteWakeup()
+    {
+    return iController.SignalRemoteWakeup();
+    }
+    
+EXPORT_C TBool DUsbClientController::CurrentlyUsingHighSpeed()
+    {
+    UsbShai::TSpeed speed = iController.DeviceOperatingSpeed();
+    
+    return (speed == UsbShai::EHighSpeed)?ETrue:EFalse;
+    }
+
+//
+// === USB Controller member function implementations - PSL API (public) ===========================
+//
+
+/** Gets called by the PSL to register a newly created derived class controller object.
+
+    @param aUdc The number of the new UDC. It should be 0 for the first (or only) UDC in the system, 1 for the
+    second one, and so forth. KUsbcMaxUdcs determines how many UDCs are supported.
+
+    @return A pointer to the controller if successfully registered, NULL if aUdc out of (static) range.
+
+    @publishedPartner @released
+*/
+TInt DUsbClientController::RegisterUdc(TInt aUdc)
+    {
+    TInt err = KErrNone;
+    
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::RegisterUdc()"));
+    
+    if (aUdc < 0 || aUdc > (KUsbcMaxUdcs - 1))
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: aUdc out of range (%d)", aUdc));
+        return KErrInUse;
+        }
+    else
+        {
+        UsbClientController[aUdc] = this;
+        }
+        
+    return err;
+    }
+
+
+//
+// === USB Controller member function implementations - PSL API (protected) ========================
+//
+
+/** Initialises an instance of this class, which is the base class of the derived class (= PSL, which is
+    supposed to call this function).
+
+    It does the following things:
+
+    - disconnects the UDC from the bus,
+    - initialises the USB descriptor pool, uses data from the PSL (see function argument list)
+    - creates and initialises the basic USB device configuration
+    - initialises the array of physical endpoints
+    - initialises Ep0 structures (but doesn't configure & enable Ep0 yet)
+    - creates and installs the USB power handler
+
+    @param aDeviceDesc A pointer to a valid standard USB device descriptor or NULL. The values initially
+    required in the descriptor follow from its constructor. The descriptor is not copied over, but rather this
+    pointer is queued directly into the descriptor pool. Must be writable memory.
+
+    @param aConfigDesc A pointer to a valid standard USB configuration descriptor or NULL. The values
+    initially required in the descriptor follow from its constructor. The descriptor is not copied over, but
+    rather this pointer is queued directly into the descriptor pool. Must be writable memory.
+
+    @param aLangId A pointer to a valid USB language ID (string) descriptor. The values initially required in
+    the descriptor follow from its constructor. The descriptor is not copied over, but rather this pointer is
+    queued directly into the descriptor pool. Must be writable memory. Other than the remaining four string
+    descriptors, this one is not optional. The reason is that the USB spec mandates a LangId descriptor as
+    soon as a single string descriptor gets returned by the device. So, even though the device might omit the
+    Manufacturer, Product, SerialNumber, and Configuration string descriptors, it is at this point not known
+    whether there will be any Interface string descriptors. Since any USB API user can create an interface
+    with an Interface string descriptor, we have to insist here on the provision of a LangId string
+    descriptor. (The PIL decides at run-time whether or not to return the LangId string descriptor to the
+    host, depending on whether there exist any string descriptors at that time.)
+
+    @param aManufacturer A pointer to a valid USB string descriptor or NULL. The values initially required in
+    the descriptor follow from its constructor. The descriptor is not copied over, but rather this pointer is
+    queued directly into the descriptor pool. Must be writable memory. This descriptor will be referenced by
+    the iManufacturer field in the device descriptor.
+
+    @param aProduct A pointer to a valid USB string descriptor or NULL. The values initially required in the
+    descriptor follow from its constructor. The descriptor is not copied over, but rather this pointer is
+    queued directly into the descriptor pool. Must be writable memory. This descriptor will be referenced by
+    the iProduct field in the device descriptor.
+
+    @param aSerialNum A pointer to a valid USB string descriptor or NULL. The values initially required in the
+    descriptor follow from its constructor. The descriptor is not copied over, but rather this pointer is
+    queued directly into the descriptor pool. Must be writable memory. This descriptor will be referenced by
+    the iSerialNumber field in the device descriptor.
+
+    @param aConfig A pointer to a valid USB string descriptor or NULL. The values initially required in the
+    descriptor follow from its constructor. The descriptor is not copied over, but rather this pointer is
+    queued directly into the descriptor pool. Must be writable memory. This descriptor will be referenced by
+    the iConfiguration field in the configuration descriptor.
+
+    @param aOtgDesc A pointer to a valid USB OTG descriptor (if OTG is supported by this device and is to be
+    supported by the driver) or NULL. The values initially required in the descriptor follow from its
+    constructor. The descriptor is not copied over, but rather this pointer is queued directly into the
+    descriptor pool. Must be writable memory.
+
+    @return EFalse, if USB descriptor pool initialisation fails, or if configuration creation fails, or if the
+    PSL reports more endpoints than the constant KUsbcMaxEndpoints permits, or if the Ep0 logical endpoint
+    creation fails, or if the creation of the power handler fails; ETrue, if base class object successfully
+    initialised.
+
+    @publishedPartner @released
+*/
+TBool DUsbClientController::Initialise(TUsbPeripheralDescriptorPool& aDescPool,
+                                       const UsbShai::TUsbPeripheralEndpointCaps* aEndpointCaps,
+                                       TInt aTotalEndpoints)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::InitialiseBaseClass()"));
+    
+    // We don't want the host to see us (at least not yet):
+    UsbDisconnect();
+    
+    iDeviceTotalEndpoints = aTotalEndpoints;    
+    
+    // Initialise USB descriptor pool
+    if (iDescriptors.Init(aDescPool.iDeviceDesc, 
+                          aDescPool.iConfigDesc, 
+                          aDescPool.iLangId, 
+                          aDescPool.iManufacturer, 
+                          aDescPool.iProduct,
+                          aDescPool.iSerialNum, 
+                          aDescPool.iConfig, 
+                          aDescPool.iOtgDesc) != KErrNone)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  Error: Descriptor initialization failed"));
+        return EFalse;
+        }
+
+    if (aDescPool.iOtgDesc)
+        {
+        iOtgSupport = ETrue;
+        iOtgFuncMap = aDescPool.iOtgDesc->DescriptorData()[2];
+        }
+
+    // Some member variables
+    iSelfPowered  = aDescPool.iConfigDesc->Byte(7) & (1 << 6);        // Byte 7: bmAttributes
+    iRemoteWakeup = aDescPool.iConfigDesc->Byte(7) & (1 << 5);
+
+    if (iControllerProperties.iControllerCaps & UsbShai::KDevCapHighSpeed)
+        {
+        if (iDescriptors.InitHs() != KErrNone)
+            {
+            return EFalse;
+            }
+        }
+
+    // Create and initialise our first (and only) configuration
+    TUsbcConfiguration* config = new TUsbcConfiguration(1);
+    if (!config)
+        {
+        return EFalse;
+        }
+    iConfigs.Append(config);
+
+    // Initialise the array of physical endpoints    
+    __KTRACE_OPT(KUSB, Kern::Printf("  DeviceTotalEndpoints: %d", aTotalEndpoints));
+    
+    // KUsbcMaxEndpoints doesn't include ep 0
+    if ((aTotalEndpoints > (KUsbcMaxEndpoints + 2)) ||
+        ((aTotalEndpoints * sizeof(TUsbcPhysicalEndpoint)) > sizeof(iRealEndpoints)))
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: too many endpoints! (change KUsbcMaxEndpoints: %d)",
+                                          KUsbcMaxEndpoints));
+        return EFalse;
+        }      
+    
+    for (TInt i = 0; i < aTotalEndpoints; ++i)
+        {
+        iRealEndpoints[i].iEndpointAddr = EpIdx2Addr(i);
+        
+        __KTRACE_OPT(KUSB, Kern::Printf("  aEndpointCaps[%02d] - iTypes: 0x%08x iSizes: 0x%08x",
+                                        i, aEndpointCaps[i].iTypesAndDir, aEndpointCaps[i].iSizes));
+                                                                                
+        iRealEndpoints[i].iCaps = aEndpointCaps[i];
+        
+        // Reset revered bytes to zero
+        iRealEndpoints[i].iCaps.iReserved[0] = 0;
+        iRealEndpoints[i].iCaps.iReserved[1] = 0;
+        
+        if ((i > 1) && (aEndpointCaps[i].iTypesAndDir != UsbShai::KUsbEpNotAvailable))
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  --> UsableEndpoint: #%d", i));
+            iDeviceUsableEndpoints++;
+            }
+        }
+
+    // Initialise Ep0 structures (logical endpoints are numbered 1..KMaxEndpointsPerClient,
+    // and virtual 0 is real 0):
+    // -- Ep0 OUT
+    iEp0MaxPacketSize = MaxEndpointPacketSize(aEndpointCaps[0].iSizes);
+    __KTRACE_OPT(KUSB, Kern::Printf("  using Ep0 maxpacketsize of %d bytes", iEp0MaxPacketSize));
+    
+    TUsbcEndpointInfo info(UsbShai::KUsbEpTypeControl, UsbShai::KUsbEpDirOut, 0);
+    TUsbcLogicalEndpoint* ep = NULL;
+    
+    info.iSize = iEp0MaxPacketSize;
+    ep = new TUsbcLogicalEndpoint(this, 0, info, NULL, &iRealEndpoints[KEp0_Out]);
+    if (!ep)
+        {
+        return EFalse;
+        }
+        
+    __KTRACE_OPT(KUSB, Kern::Printf("  creating ep: mapping real ep %d --> logical ep 0", KEp0_Out));
+    iRealEndpoints[KEp0_Out].iLEndpoint = ep;
+    
+    // -- Ep0 IN
+    info.iDir = UsbShai::KUsbEpDirIn;
+    ep = new TUsbcLogicalEndpoint(this, 0, info, NULL, &iRealEndpoints[KEp0_In]);
+    if (!ep)
+        {
+        delete iRealEndpoints[KEp0_Out].iLEndpoint;
+        iRealEndpoints[KEp0_Out].iLEndpoint = NULL;
+        return EFalse;
+        }
+    __KTRACE_OPT(KUSB, Kern::Printf("  creating ep: mapping real ep %d --> logical ep 0", KEp0_In));
+    iRealEndpoints[KEp0_In].iLEndpoint = ep;    
+    
+    iPowerHandler = new DUsbcPowerHandler(this);
+    if (!iPowerHandler)
+        {
+        delete iRealEndpoints[KEp0_Out].iLEndpoint;
+        iRealEndpoints[KEp0_Out].iLEndpoint = NULL;
+        delete iRealEndpoints[KEp0_In].iLEndpoint;
+        iRealEndpoints[KEp0_In].iLEndpoint = NULL;
+        return EFalse;
+        }
+    iPowerHandler->Add();
+
+    return ETrue;    
+    }
+
+/** The standard constructor for this class.
+
+    @publishedPartner @released
+ */
+DUsbClientController::DUsbClientController(UsbShai::MPeripheralControllerIf&               aPeripheralControllerIf, 
+                                           const UsbShai::TPeripheralControllerProperties& aProperties,
+                                           TBool                                  aIsOtgPort)
+    : iEp0ReceivedNonStdRequest(EFalse),
+      iRmWakeupStatus_Enabled(EFalse),
+      iEp0_RxBuf(),
+      iDeviceTotalEndpoints(0),
+      iDeviceUsableEndpoints(0),
+      iDeviceState(UsbShai::EUsbPeripheralStateUndefined),
+      iDeviceStateB4Suspend(UsbShai::EUsbPeripheralStateUndefined),
+      iSelfPowered(EFalse),
+      iRemoteWakeup(EFalse),
+      iHardwareActivated(EFalse),
+      iOtgSupport(EFalse),
+      iOtgFuncMap(0),
+      iHighSpeed(EFalse),
+      iEp0MaxPacketSize(0),
+      iEp0ClientId(NULL),
+      iEp0DataReceived(0),
+      iEp0WritePending(EFalse),
+      iEp0ClientDataTransmitting(EFalse),
+      iEp0DeviceControl(NULL),
+      iDescriptors(iEp0_TxBuf),
+      iCurrentConfig(0),
+      iConfigs(1),
+      iRealEndpoints(),
+      iEp0_TxBuf(),
+      iEp0_RxExtraCount(0),
+      iEp0_TxNonStdCount(0),
+      iEp0ReadRequestCallbacks(_FOFF(TUsbcRequestCallback, iLink)),
+      iClientCallbacks(_FOFF(TUsbcClientCallback, iLink)),
+      iStatusCallbacks(_FOFF(TUsbcStatusCallback, iLink)),
+      iEpStatusCallbacks(_FOFF(TUsbcEndpointStatusCallback, iLink)),
+      iOtgCallbacks(_FOFF(TUsbcOtgFeatureCallback, iLink)),
+      iReconnectTimer(ReconnectTimerCallback, this),
+      iUsbLock(TSpinLock::EOrderGenericIrqLow3),      
+      iController(aPeripheralControllerIf),
+      iControllerProperties(aProperties),
+      iIsOtgPort(aIsOtgPort),
+      iOtgObserver(NULL),
+      iConTransferMgr(NULL),
+      iLastError(EFalse),
+      iSetupPacketPending(EFalse),
+      iCommonDfcQThread(NULL),
+      iPowerUpDfc(PowerUpDfc, this, 3),
+      iPowerDownDfc(PowerDownDfc, this, 3),
+      iDeviceEventNotifyDfc(DeviceEventNotifyDfc,this,3),
+      iThreadContextFinder(ThreadContextFinderDfc,this,3),
+      iStandby(EFalse),
+      iStackIsActive(EFalse),
+      iClientSupportReady(EFalse),
+      iUsbResetDeferred(EFalse),
+      iEnablePullUpOnDPlus(NULL),
+      iDisablePullUpOnDPlus(NULL),
+      iOtgContext(NULL)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::DUsbClientController()"));
+    
+    iLastError = KErrNone;
+    
+#ifndef SEPARATE_USB_DFC_QUEUE
+    iPowerUpDfc.SetDfcQ(Kern::DfcQue0());
+    iPowerDownDfc.SetDfcQ(Kern::DfcQue0());
+#endif // SEPARATE_USB_DFC_QUEUE
+
+    for (TInt i = 0; i < KUsbcEpArraySize; i++)
+        iRequestCallbacks[i] = NULL;
+    }
+
+TInt DUsbClientController::Construct()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::Construct"));
+    
+    // Setup the state machines of ep0
+    TInt err = SetupEp0StateMachine();
+    if( err != KErrNone)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("    Can not setup state machines, exit"));
+        return err;
+        }
+        
+#ifdef SEPARATE_USB_DFC_QUEUE
+    iPowerUpDfc.SetDfcQ(iControllerProperties.iDfcQueue);
+    iPowerDownDfc.SetDfcQ(iControllerProperties.iDfcQueue);
+#endif  // SEPARATE_USB_DFC_QUEUE
+    
+    iDeviceEventNotifyDfc.SetDfcQ(iControllerProperties.iDfcQueue);
+    iThreadContextFinder.SetDfcQ(iControllerProperties.iDfcQueue);
+    
+    // Register 
+    if( RegisterUdc(0) != KErrNone)
+        {
+        // This is the only reason.
+        return KErrInUse;
+        }
+        
+    __KTRACE_OPT(KUSB, Kern::Printf("    peripheral controller registered"));
+    TUsbPeripheralDescriptorPool descPool;       
+    
+    if( CreateDescriptors(descPool) == KErrNone)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("    descriptors created"));
+        
+        // Initialise the array of physical endpoints 
+        __KTRACE_OPT(KUSB, Kern::Printf("    initialising PIL "));
+        TBool initOk = Initialise(descPool,
+                                  iControllerProperties.iDeviceEndpointCaps,
+                                  iControllerProperties.iDeviceTotalEndpoints);
+        
+        // Let UDC has a changes to know the callback interface is ready.
+        // Any further initialization/startup/preparation etc can be performed now.
+        if  ( initOk )
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("    Initializing PSL "));
+            
+            // Set Rx buffer for endpoint zero
+            iController.SetEp0RxBuffer(iEp0_RxBuf,KUsbcBufSzControl);
+            
+            // Set pil callback interface for PSL.
+            iController.SetPilCallbackInterface(*this);
+            
+            }
+        else
+            {
+            return KErrNoMemory;
+            }
+        }
+    
+    // Register ourself as the ONLY one client of charger detection observer
+    gChargerObsever = this;
+    
+    // In case the charger detector already registered, start monitor
+    // Charger type notifications
+    if( gChargerDetector != NULL )
+        {
+        gChargerDetector->SetChargerDetectorObserver(*gChargerObsever);
+        }
+    
+    iThreadContextFinder.Enque();
+    
+    return KErrNone;
+    }
+
+// This function doesn't consider the situation of OOM.
+// Because, this function will be call during extension's entry point,
+// There is no way to start up phone successfully if anything failed anyway...
+TInt DUsbClientController::SetupEp0StateMachine()
+    {
+	// Create the state machine first
+	__ASSERT_DEBUG((iConTransferMgr == NULL), Kern::Fault(KUsbPILPanicCat, __LINE__));
+	iConTransferMgr = new DControlTransferManager(*this);
+	if(iConTransferMgr == 0)
+		{
+		return KErrNoMemory;
+		}
+		
+    // Add UsbShai::EControlTransferStageSetup stage machine
+    TControlStageSm* stageSm = new DSetupStageSm(*iConTransferMgr);    
+    __ASSERT_DEBUG((stageSm != NULL), Kern::Fault(KUsbPILPanicCat, __LINE__));
+    if(stageSm != NULL)
+        {
+        iConTransferMgr->AddState(UsbShai::EControlTransferStageSetup,*stageSm);
+        }
+    else
+        {
+        return KErrNoMemory;
+        }
+        
+    // Add EControlTransferStageDataOut stage state machine        
+    stageSm = new DDataOutStageSm(*iConTransferMgr);
+    __ASSERT_DEBUG((stageSm != NULL), Kern::Fault(KUsbPILPanicCat, __LINE__));
+    if(stageSm != NULL)
+        {
+        iConTransferMgr->AddState(UsbShai::EControlTransferStageDataOut,*stageSm);
+        }
+    else
+        {
+        // we don't need bother to delete the previous allocated memory
+        // system can not bootup if we return error
+        return KErrNoMemory;
+        }
+        
+    // Add EControlTransferStageStatusIn stage state machine     
+    stageSm = new DStatusInStageSm(*iConTransferMgr);
+    __ASSERT_DEBUG((stageSm != NULL), Kern::Fault(KUsbPILPanicCat, __LINE__));
+    if(stageSm != NULL)
+        {
+        iConTransferMgr->AddState(UsbShai::EControlTransferStageStatusIn,*stageSm); 
+        }
+    else
+        {
+        return KErrNoMemory;
+        }
+            
+    // Add EControlTransferStageDataIn stage state machine    
+    stageSm = new DDataInStageSm(*iConTransferMgr);
+    __ASSERT_DEBUG((stageSm != NULL), Kern::Fault(KUsbPILPanicCat, __LINE__));
+   if(stageSm != NULL)
+        {
+        iConTransferMgr->AddState(UsbShai::EControlTransferStageDataIn,*stageSm);
+        }
+    else
+        {
+        return KErrNoMemory;
+        }
+    
+    // Add EControlTransferStageStatusOut stage state machine    
+    stageSm = new DStatusOutStageSm(*iConTransferMgr);
+    __ASSERT_DEBUG((stageSm != NULL), Kern::Fault(KUsbPILPanicCat, __LINE__));
+    if(stageSm != NULL)
+        {
+        iConTransferMgr->AddState(UsbShai::EControlTransferStageStatusOut,*stageSm);
+        }    
+    else
+        {
+        return KErrNoMemory;
+        }
+        
+    return KErrNone;
+    }
+    
+// ---------------------------------------------------------------------------
+// From MUsbPeripheralPilCallbackIf.
+// Enable the peripheral stack
+// ---------------------------------------------------------------------------
+//
+void DUsbClientController::EnablePeripheralStack()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::EnablePeripheralStack"));
+
+    if (iStackIsActive)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  Already enabled - returning"));
+        return;
+        }
+
+    // Mark stack is enabled, Waiting upper application to power controller
+    // Anyway, this will lead us to attached state
+    iStackIsActive = ETrue;    
+    NextDeviceState(UsbShai::EUsbPeripheralStateAttached);
+    
+    // If hardware is not activated yet, do it here.
+    if(iClientSupportReady && !iHardwareActivated)
+        {
+        // PowerUpUdc only do Activating Hardware when there are at least 1
+        // Iterface registered.
+        PowerUpUdc();
+        }
+    
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MUsbPeripheralPilCallbackIf.
+// Disable the peripheral stack
+// ---------------------------------------------------------------------------
+//
+void DUsbClientController::DisablePeripheralStack()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::DisablePeripheralStack"));
+
+    if (!iStackIsActive)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  Already disabled - returning"));
+        return;
+        }
+
+    // Reset OTG features, leave attributes as is (just as in USB Reset case)
+    // (OTG spec 1.3 sections 6.5.x all say "... on a bus reset or at the end
+    //  of a session." VBus drop is the end of a session.)
+    iOtgFuncMap &= KUsbOtgAttr_SrpSupp | KUsbOtgAttr_HnpSupp;
+    OtgFeaturesNotify();
+    // Tear down the current configuration (if any)
+    ChangeConfiguration(0);
+
+    if (iDeviceState != UsbShai::EUsbPeripheralStateUndefined)
+        {
+        // Not being in state UNDEFINED implies that the cable is inserted.
+        if (iHardwareActivated)
+            {
+            NextDeviceState(UsbShai::EUsbPeripheralStatePowered);
+            }
+        // (If the hardware is NOT activated at this point, we can only be in
+        //    state UsbShai::EUsbPeripheralStateAttached, so we don't have to move to it.)
+        }
+    DeActivateHardwareController();                     // turn off UDC altogether
+    iStackIsActive = EFalse;
+    // Notify registered clients on the user side about a USB device state
+    // change event and a transition to the "Undefined" state.
+    // Note: the state should be changed to "Undefined" before calling RunClientCallbacks(), 
+    //       otherwise the "Undefined" state will probably be lost.
+    NextDeviceState(UsbShai::EUsbPeripheralStateUndefined);
+    // Complete all pending requests, returning KErrDisconnected
+    RunClientCallbacks();
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MUsbPeripheralPilCallbackIf.
+// Set the OTG Observer
+// ---------------------------------------------------------------------------
+//
+void DUsbClientController::SetOtgObserver(MUsbOtgPeripheralObserverIf* aObserver)
+    {
+    iOtgObserver = aObserver;
+    }
+
+
+/** This function gets called by the PSL upon detection of either of the following events:
+    - USB Reset,
+    - USB Suspend event,
+    - USB Resume signalling,
+    - The USB cable has been attached (inserted) or detached (removed).
+
+    @param anEvent An enum denoting the event that has occured.
+
+    @return KErrArgument if the event is not recognized, otherwise KErrNone.
+
+    @publishedPartner @released
+*/
+TInt DUsbClientController::DeviceEventNotification(UsbShai::TUsbPeripheralEvent anEvent)
+    {
+    TInt err = KErrNone;
+    
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::DeviceEventNotification(anEvent=%d)", anEvent));
+    
+    switch (anEvent)
+        {
+        case UsbShai::EUsbEventSuspend:
+        case UsbShai::EUsbEventResume:
+        case UsbShai::EUsbEventReset:
+        case UsbShai::EUsbEventVbusRisen:
+        case UsbShai::EUsbEventVbusFallen:
+            {
+            TInt nkern_curr_ctx= NKern::CurrentContext();
+            
+            if( (nkern_curr_ctx != NKern::EInterrupt) && (nkern_curr_ctx != NKern::EIDFC))
+                {
+                // Normal context
+                __ASSERT_DEBUG((iCommonDfcQThread != NULL), Kern::Fault(KUsbPILPanicCat, __LINE__));
+                if(iCommonDfcQThread == &(Kern::CurrentThread().iNThread))
+                    {
+                    // we already in the correct context, just run processes here directly.
+                    __KTRACE_OPT(KUSB, Kern::Printf("  Correct thread context"));
+                    ProcessDeviceEventNotification(anEvent);
+                    }
+                else
+                    {
+                    // we're in a normal thread, but it is not the same as the DfcQ context
+                    // passed by PSL, queue it
+                    __KTRACE_OPT(KUSB, Kern::Printf("  Incorrect thread context"));
+                    iDevEventQueue.FifoAdd(anEvent);
+                    iDeviceEventNotifyDfc.Enque();
+                    }
+                }
+            else
+                {                
+                // We're in a ISR or IDFC context
+                __KTRACE_OPT(KUSB, Kern::Printf("  ISR|IDFC context"));
+                iDevEventQueue.FifoAdd(anEvent);
+                iDeviceEventNotifyDfc.Add();
+                }
+            }
+            break;
+            
+        default:
+            err = KErrArgument;
+        }
+    
+    return err;    
+    }
+
+
+/** This function gets called by the PSL upon completion of a pending data transfer request.
+
+    This function is not to be used for endpoint zero completions (use Ep0RequestComplete instead).
+
+    @param aCallback A pointer to a data transfer request callback structure which was previously passed to
+    the PSL in a SetupReadBuffer() or SetupWriteBuffer() call.
+
+    @publishedPartner @released
+*/
+void DUsbClientController::EndpointRequestComplete(UsbShai::TUsbPeripheralRequest* aCallback)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::EndpointRequestComplete(%p)", aCallback));
+    
+    TUsbcRequestCallback* cb = static_cast<TUsbcRequestCallback*>(aCallback);
+    // This function may be called by the PSL from within an ISR -- so we have
+    // to take care what we do here (and also in all functions that get called
+    // from here).
+
+    // We don't test aCallback for NULL here (and therefore risk a crash)
+    // because the PSL should never give us a NULL argument. If it does it
+    // means the PSL is buggy and ought to be fixed.
+    ProcessDataTransferDone(*cb);
+    }
+
+
+/** This function should be called by the PSL after reception of an Ep0
+    SET_FEATURE request with a feature selector of either {b_hnp_enable,
+    a_hnp_support, a_alt_hnp_support}, but only when that Setup packet is not
+    handed up to the PIL (for instance because it is auto-decoded and
+    'swallowed' by the UDC hardware).
+
+    @param aHnpState A bitmask indicating the present state of the three OTG
+    feature selectors as follows:
+
+    bit.0 == a_alt_hnp_support
+    bit.1 == a_hnp_support
+    bit.2 == b_hnp_enable
+
+    @see DUsbClientController::ProcessSetClearDevFeature()
+
+    @publishedPartner @released
+*/
+void DUsbClientController::HandleHnpRequest(TInt aHnpState)
+// This function is called by the PSL from within an ISR -- so we have to take care what we do here
+// (and also in all functions that get called from here).
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::HandleHnpRequest(%d)", aHnpState));
+
+    if (!iOtgSupport)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Request only supported on a OTG device"));
+        return;
+        }
+    if (!(iOtgFuncMap & KUsbOtgAttr_HnpSupp))
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Request only valid if OTG device supports HNP"));
+        return;
+        }
+    //    (case KUsbFeature_B_HnpEnable:)
+    if (aHnpState & 0x04)
+        {
+        iOtgFuncMap |= KUsbOtgAttr_B_HnpEnable;
+        }
+    // (case KUsbFeature_A_HnpSupport:)
+    if (aHnpState & 0x02)
+        {
+        iOtgFuncMap |= KUsbOtgAttr_A_HnpSupport;
+        }
+    // (case KUsbFeature_A_AltHnpSupport:)
+    if (aHnpState & 0x01)
+        {
+        iOtgFuncMap |= KUsbOtgAttr_A_AltHnpSupport;
+        }
+    OtgFeaturesNotify();
+    }
+
+void DUsbClientController::GetEp0RxBufferInfo(TUint8*& aBuffer, TInt& aBufferLen)
+    {
+    aBuffer = iEp0_RxBuf;
+    aBufferLen = KUsbcBufSzControl;
+    }
+    
+UsbShai::TUsbPeripheralState DUsbClientController::DeviceStatus() const
+    {
+    return iDeviceState;
+    }
+
+TBool DUsbClientController::Ep0ReceivedNonStdRequest()
+    {
+    return iEp0ReceivedNonStdRequest;
+    }
+    
+/** This function gets called by the PSL upon completion of a pending endpoint zero data transfer request.
+
+    @param aRealEndpoint Either 0 for Ep0 OUT (= Read), or 1 for Ep0 IN (= Write).
+    @param aCount The number of bytes received or transmitted, respectively.
+    @param aError The error status of the completed transfer request. Can be KErrNone if no error, KErrCancel
+    if transfer was cancelled, or KErrPrematureEnd if a premature status end was encountered.
+
+    @return KErrNone if no error during transfer completion processing, KErrGeneral if the request was a read &
+    a Setup packet was received & the recipient for that packet couldn't be found (invalid packet: Ep0 has been
+    stalled), KErrNotFound if the request was a read & the recipient for that packet (Setup or data) _was_
+    found - however no read had been set up by that recipient (this case should be used by the PSL to disable
+    the Ep0 interrupt at that point and give the LDD time to set up a new Ep0 read; once the 'missing' read
+    was set up either Ep0ReceiveProceed or Ep0ReadSetupPktProceed will be called by the PIL).
+
+    @publishedPartner @released
+*/
+TInt DUsbClientController::Ep0RequestComplete(TInt aRealEndpoint,
+                                              TInt aCount, 
+                                              TInt aError, 
+                                              UsbShai::TControlPacketType aPktType)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("> DUsbClientController::Ep0RequestComplete(%d)", aRealEndpoint));
+    
+    iLastError = KErrNone;
+    
+    iConTransferMgr->Ep0RequestComplete(iEp0_RxBuf,aCount,aError,aPktType);
+    
+    __KTRACE_OPT(KUSB, Kern::Printf("    iLastError(%d)", iLastError));
+    
+    if(iEp0WritePending == EFalse)
+        {
+        iConTransferMgr->SetupEndpointZeroRead();
+        }
+        
+    __KTRACE_OPT(KUSB, Kern::Printf("< DUsbClientController::Ep0RequestComplete"));
+    return iLastError;
+    }    
+
+/** This function should be called by the PSL once the UDC (and thus the USB device) is in the Address state.
+
+    @publishedPartner @released
+*/
+void DUsbClientController::MoveToAddressState()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::MoveToAddressState()"));
+
+    // This function may be called by the PSL from within an ISR -- so we have
+    // to take care what we do here (and also in all functions that get called
+    // from here).
+
+    NextDeviceState(UsbShai::EUsbPeripheralStateAddress);
+    }
+
+
+TBool DUsbClientController::CreateDescriptors(TUsbPeripheralDescriptorPool& aOutput)
+    {
+    TInt errCode = KErrNone;
+    
+    // Create all the string descriptors
+    TUsbcDeviceDescriptor* deviceDesc = TUsbcDeviceDescriptor::New(
+                                                0,     // aDeviceClass, will be changed later by upper app
+                                                0,     // aDeviceSubClass, will be changed later by upper app
+                                                0,     // aDeviceProtocol, will be changed later by upper app
+                                                iControllerProperties.iMaxEp0Size  ,   // aMaxPacketSize0
+                                                KUsbVendorId,           // aVendorId
+                                                KUsbProductId ,         // aProductId
+                                                iControllerProperties.iDeviceRelease,         // aDeviceRelease
+                                                KUsbNumberOfConfiguration);// aNumConfigurations
+    __ASSERT_DEBUG( (deviceDesc != NULL), Kern::Fault( "USB PSL Out of memory, deviceDesc", __LINE__ ));    
+    
+    TUsbcConfigDescriptor* configDesc = TUsbcConfigDescriptor::New(
+                                            1,       // Only one configruation is supported current.
+                                            EFalse,  // at here, we always mark it as bus powered.
+                                            (iControllerProperties.iControllerCaps & UsbShai::KDevCapRemoteWakeupSupport)?ETrue:EFalse,  // remote wakeup
+                                            100);    // 100 is a default value, thise value will be changed by
+    
+    __ASSERT_DEBUG( (configDesc != NULL), Kern::Fault( "USB PSL Out of memory, configDesc", __LINE__ ));
+        
+    TUsbcLangIdDescriptor* stringDescLang = TUsbcLangIdDescriptor::New(KUsbLangId);
+    __ASSERT_DEBUG( (stringDescLang != NULL), Kern::Fault( "USB PSL Out of memory, stringDescLang", __LINE__ ));
+    
+    // Default manufacturer string
+    TPtrC8 aString;
+    aString.Set(reinterpret_cast<const TUint8*>(KStringManufacturer), sizeof(KStringManufacturer) - 2);
+    TUsbcStringDescriptor* stringDescManu = TUsbcStringDescriptor::New(aString);
+    __ASSERT_DEBUG( (stringDescManu != NULL), Kern::Fault( "USB PSL Out of memory, stringDescManu", __LINE__ ));
+    
+    // Default product name string
+    aString.Set(reinterpret_cast<const TUint8*>(KStringProduct), sizeof(KStringProduct) - 2);
+    TUsbcStringDescriptor* stringDescProd = TUsbcStringDescriptor::New(aString);
+    __ASSERT_DEBUG( (stringDescProd != NULL), Kern::Fault( "USB PSL Out of memory, stringDescProd", __LINE__ ));
+    
+    // Default configuration name string
+    aString.Set(reinterpret_cast<const TUint8*>(KStringConfig), sizeof(KStringConfig) - 2);
+    TUsbcStringDescriptor* stringDescConf = TUsbcStringDescriptor::New(aString);
+    __ASSERT_DEBUG( (stringDescConf != NULL), Kern::Fault( "USB PSL Out of memory, stringDescConf", __LINE__ ));
+    
+    // Default serial bumber string
+    aString.Set(reinterpret_cast<const TUint8*>(KStringSerial), sizeof(KStringSerial) - 2);
+    TUsbcStringDescriptor* stringSerial = TUsbcStringDescriptor::New(aString);
+    __ASSERT_DEBUG( (stringSerial != NULL), Kern::Fault( "USB PSL Out of memory, stringDescConf", __LINE__ ));
+   
+    TUsbcOtgDescriptor* otgDesc = NULL;
+
+    // In an OTG-environment, we also need to create the OTG
+    // descriptor. The PSL supports both HNP and SRP and hence we
+    // report support for them. Upper layers will override the
+    // descriptors anyway.
+    if (iIsOtgPort)
+        {
+        TBool srpSupported = (iControllerProperties.iControllerCaps & UsbShai::KDevCapSrpSupport)?ETrue:EFalse;
+        TBool hnpSupported = (iControllerProperties.iControllerCaps & UsbShai::KDevCapHnpSupport)?ETrue:EFalse;
+        
+        otgDesc = TUsbcOtgDescriptor::New(srpSupported,
+                                          hnpSupported);
+        
+        __ASSERT_DEBUG( (otgDesc != NULL), Kern::Fault( "USB PSL Out of memory, otgDesc", __LINE__ ));     
+        }
+    
+    if( (deviceDesc != NULL) && 
+        (configDesc != NULL) && 
+        (stringDescLang != NULL) &&
+        (stringDescManu != NULL) && 
+        (stringDescProd != NULL) && 
+        (stringDescConf != NULL) &&
+        ((!iIsOtgPort) || (iIsOtgPort && (otgDesc != NULL))))
+        {    
+        aOutput.iDeviceDesc = deviceDesc;
+        aOutput.iConfigDesc = configDesc;
+        aOutput.iLangId = stringDescLang;
+        aOutput.iManufacturer = stringDescManu;
+        aOutput.iProduct = stringDescProd;
+        aOutput.iConfig = stringDescConf;
+        aOutput.iSerialNum = stringSerial;
+        aOutput.iOtgDesc = otgDesc;
+        }
+    else
+        {
+        if( deviceDesc != NULL )
+            {
+            delete deviceDesc;
+            }
+        
+        if( configDesc != NULL )
+            {
+            delete configDesc;
+            }
+            
+        if( stringDescLang != NULL )
+            {
+            delete stringDescLang;
+            }
+            
+        if( stringDescManu != NULL )
+            {
+            delete stringDescManu;
+            }
+            
+        if( stringDescProd != NULL )
+            {
+            delete stringDescProd;
+            }
+            
+        if( stringDescConf != NULL )
+            {
+            delete stringDescConf;
+            }
+            
+        if( stringSerial != NULL )
+            {
+            delete stringSerial;
+            }
+            
+        if( otgDesc != NULL )
+            {
+            delete otgDesc;
+            }
+        
+        errCode = KErrNoMemory;
+        }
+    
+    // We don't support serial number 
+    aOutput.iSerialNum = NULL;
+    
+    return errCode;    
+    }
+    
+//
+// === USB Controller member function implementations - Internal utility functions (private) =======
+//
+
+TInt DUsbClientController::DeRegisterClientCallback(const DBase* aClientId)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::DeRegisterClientCallback()"));
+    __ASSERT_DEBUG((aClientId != NULL), Kern::Fault(KUsbPILPanicCat, __LINE__));
+    TSglQueIter<TUsbcClientCallback> iter(iClientCallbacks);
+    TUsbcClientCallback* p;
+    while ((p = iter++) != NULL)
+        if (p->Owner() == aClientId)
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  removing ClientCallback @ 0x%x", p));
+            iClientCallbacks.Remove(*p);
+            return KErrNone;
+            }
+    __KTRACE_OPT(KUSB, Kern::Printf("  Client not found"));
+    return KErrNotFound;
+    }
+
+
+TBool DUsbClientController::CheckEpAvailability(TInt aEndpointsUsed,
+                                                const TUsbcEndpointInfoArray& aEndpointData,
+                                                TInt aIfcNumber) const
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::CheckEpAvailability()"));
+    if (aEndpointsUsed > KMaxEndpointsPerClient)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: too many endpoints claimed (%d)", aEndpointsUsed));
+        return EFalse;
+        }
+    TBool reserve[KUsbcEpArraySize]; // iDeviceTotalEndpoints can be equal to 32
+    memset(reserve, EFalse, sizeof(reserve));                // reset the array
+    for (TInt i = 0; i < aEndpointsUsed; ++i)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  checking for (user) endpoint #%d availability...", i + 1));
+        TInt j = 2;
+        while (j < iDeviceTotalEndpoints)
+            {
+            if ((iRealEndpoints[j].EndpointSuitable(&aEndpointData[i], aIfcNumber)) &&
+                (reserve[j] == EFalse))
+                {
+                __KTRACE_OPT(KUSB, Kern::Printf("  ---> found suitable endpoint: RealEndpoint #%d", j));
+                reserve[j] = ETrue;                            // found one: mark this ep as reserved
+                break;
+                }
+            __KTRACE_OPT(KUSB, Kern::Printf("  -> endpoint not suitable: RealEndpoint #%d", j));
+            j++;
+            }
+        if (j == iDeviceTotalEndpoints)
+            {
+            return EFalse;
+            }
+        }
+    return ETrue;
+    }
+
+
+TUsbcInterface* DUsbClientController::CreateInterface(const DBase* aClientId, TInt aIfc, TUint32 aFeatureWord)
+// We know that 9.2.3 says: "Interfaces are numbered from zero to one less than the number of
+// concurrent interfaces supported by the configuration."  But since we permit the user to
+// change interface numbers, we can neither assume nor enforce anything about them here.
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::CreateInterface(x, aIfc=%d)", aIfc));
+    TUsbcInterfaceSet* ifcset_ptr = NULL;
+    TInt ifcset = ClientId2InterfaceNumber(aClientId);
+    TBool new_ifc;
+    if (ifcset < 0)
+        {
+        // New interface(set), so we need to find a number for it.
+        new_ifc = ETrue;
+        const TInt num_ifcsets = iConfigs[0]->iInterfaceSets.Count();
+        if (num_ifcsets == 255)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Too many interfaces already exist: 255"));
+            return NULL;
+            }
+        // Find the smallest interface number that has not yet been used.
+        for (ifcset = 0; ifcset < 256; ++ifcset)
+            {
+            TBool n_used = EFalse;
+            for (TInt i = 0; i < num_ifcsets; ++i)
+                {
+                if ((iConfigs[0]->iInterfaceSets[i]->iInterfaceNumber) == ifcset)
+                    {
+                    __KTRACE_OPT(KUSB, Kern::Printf("  interface number %d already used", ifcset));
+                    n_used = ETrue;
+                    break;
+                    }
+                }
+            if (!n_used)
+                {
+                break;
+                }
+            }
+        if (ifcset == 256)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: no available interface number found"));
+            return NULL;
+            }
+        // append the ifcset
+        __KTRACE_OPT(KUSB, Kern::Printf("  creating new InterfaceSet %d first", ifcset));
+        if (aIfc != 0)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: invalid interface setting number (1): %d", aIfc));
+            return NULL;
+            }
+        if ((ifcset_ptr = new TUsbcInterfaceSet(aClientId, ifcset)) == NULL)
+            {
+            __KTRACE_OPT(KPANIC,
+                         Kern::Printf("  Error: new TUsbcInterfaceSet(aClientId, ifcset_num) failed"));
+            return NULL;
+            }
+        iConfigs[0]->iInterfaceSets.Append(ifcset_ptr);
+        }
+    else /* if (ifcset_num >= 0) */
+        {
+        // use an existent ifcset
+        new_ifc = EFalse;
+        __KTRACE_OPT(KUSB, Kern::Printf("  using existing InterfaceSet %d", ifcset));
+        ifcset_ptr = InterfaceNumber2InterfacePointer(ifcset);
+        if (aIfc != ifcset_ptr->iInterfaces.Count())
+            {
+            // 9.2.3: "Alternate settings range from zero to one less than the number of alternate
+            // settings for a specific interface." (Thus we can here only append a setting.)
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: invalid interface setting number (2): %d", aIfc));
+            return NULL;
+            }
+        // Check whether the existing interface belongs indeed to this client
+        if (ifcset_ptr->iClientId != aClientId)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: iClientId (%p) != aClientId (%p)",
+                                              ifcset_ptr->iClientId, aClientId));
+            return NULL;
+            }
+        }
+    const TBool no_ep0_requests = aFeatureWord & KUsbcInterfaceInfo_NoEp0RequestsPlease;
+    TUsbcInterface* const ifc_ptr = new TUsbcInterface(ifcset_ptr, aIfc, no_ep0_requests);
+    if (!ifc_ptr)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: new TUsbcInterface(ifcset, aIfc) failed"));
+        if (new_ifc)
+            {
+            DeleteInterfaceSet(ifcset);
+            }
+        return NULL;
+        }
+    ifcset_ptr->iInterfaces.Append(ifc_ptr);
+    return ifc_ptr;
+    }
+
+
+#define RESET_SETTINGRESERVE \
+    for (TInt i = start_ep; i < iDeviceTotalEndpoints; i++) \
+        { \
+        if (iRealEndpoints[i].iSettingReserve) \
+            iRealEndpoints[i].iSettingReserve = EFalse; \
+        } \
+
+TInt DUsbClientController::CreateEndpoints(TUsbcInterface* aIfc, TInt aEndpointsUsed,
+                                           const TUsbcEndpointInfoArray& aEndpointData,
+                                           TInt aRealEpNumbers[])
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::CreateEndpoints()"));
+    const TInt ifc_num = aIfc->iInterfaceSet->iInterfaceNumber;
+    const TInt start_ep = 2;
+    for (TInt i = 0; i < aEndpointsUsed; ++i)
+        {
+        for (TInt j = start_ep; j < iDeviceTotalEndpoints; ++j)
+            {
+            if (iRealEndpoints[j].EndpointSuitable(&aEndpointData[i], ifc_num))
+                {
+                // Logical endpoints are numbered 1..KMaxEndpointsPerClient (virtual 0 is real 0 and 1)
+                TUsbcLogicalEndpoint* const ep = new TUsbcLogicalEndpoint(this, i + 1, aEndpointData[i],
+                                                                          aIfc, &iRealEndpoints[j]);
+                if (!ep)
+                    {
+                    __KTRACE_OPT(KPANIC, Kern::Printf("  Error: new TUsbcLogicalEndpoint() failed"));
+                    aIfc->iEndpoints.ResetAndDestroy();
+                    RESET_SETTINGRESERVE;
+                    return KErrNoMemory;
+                    }
+                aIfc->iEndpoints.Append(ep);
+                // Check on logical endpoint's sizes for compliance with special restrictions.
+                if (aIfc->iSettingCode == 0)
+                    {
+                    // For details see last paragraph of 5.7.3 "Interrupt Transfer Packet Size Constraints".
+                    if ((ep->iInfo.iType == UsbShai::KUsbEpTypeInterrupt) && (ep->iEpSize_Hs > 64))
+                        {
+                        __KTRACE_OPT(KPANIC, Kern::Printf("  Warning: INT ep HS size = %d on default ifc setting",
+                                                          ep->iEpSize_Hs));
+                        __KTRACE_OPT(KPANIC, Kern::Printf("           (should be <= 64)"));
+                        }
+                    // For details see last paragraph of 5.6.3 "Isochronous Transfer Packet Size Constraints".
+                    else if ((ep->iInfo.iType == UsbShai::KUsbEpTypeIsochronous) && (ep->iInfo.iSize > 0))
+                        {
+                        __KTRACE_OPT(KPANIC, Kern::Printf("  Warning: ISO ep size = %d on default ifc setting",
+                                                          ep->iInfo.iSize));
+                        __KTRACE_OPT(KPANIC, Kern::Printf("           (should be zero or ep non-existent)"));
+                        }
+                    }
+                // If the endpoint doesn't support DMA (now or never) the next operation
+                // will be a successful no-op.
+                /*
+                const TInt r = OpenDmaChannel(j);
+                if (r != KErrNone)
+                    {
+                    __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Opening of DMA channel failed"));
+                    aIfc->iEndpoints.ResetAndDestroy();
+                    RESET_SETTINGRESERVE;
+                    return r;
+                    }
+                */
+                __KTRACE_OPT(KUSB, Kern::Printf("  creating ep: mapping real ep %d -> logical ep %d",
+                                                j, i + 1));
+                iRealEndpoints[j].iIfcNumber = &aIfc->iInterfaceSet->iInterfaceNumber;
+                iRealEndpoints[j].iSettingReserve = ETrue;
+                __KTRACE_OPT(KUSB,
+                             Kern::Printf("  ep->iInfo: iType=0x%x iDir=0x%x iSize=%d iInterval=%d",
+                                          ep->iInfo.iType, ep->iInfo.iDir, ep->iInfo.iSize,
+                                          ep->iInfo.iInterval));
+                __KTRACE_OPT(KUSB,
+                             Kern::Printf("  ep->iInfo: iInterval_Hs=%d iTransactions=%d iExtra=%d",
+                                          ep->iInfo.iInterval_Hs, ep->iInfo.iTransactions,
+                                          ep->iInfo.iExtra));
+                // Store real endpoint numbers:
+                // array[x] holds the number for logical ep x.
+                aRealEpNumbers[i + 1] = j;
+                break;
+                }
+            }
+        }
+    aRealEpNumbers[0] = 0;                                // ep0: 0.
+    __KTRACE_OPT(KUSB,{
+        Kern::Printf("  Endpoint Mapping for Interface %d / Setting %d:", ifc_num, aIfc->iSettingCode);
+        Kern::Printf("Logical  | Real");
+        Kern::Printf("Endpoint | Endpoint");
+        for (TInt ep = 0; ep <= aEndpointsUsed; ++ep) Kern::Printf("   %2d       %3d",ep, aRealEpNumbers[ep]);
+        });
+    RESET_SETTINGRESERVE;
+    return KErrNone;
+    }
+
+
+TInt DUsbClientController::SetupIfcDescriptor(TUsbcInterface* aIfc, TUsbcClassInfo& aClass, DThread* aThread,
+                                              TDesC8* aString, const TUsbcEndpointInfoArray& aEndpointData)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::SetupIfcDescriptor()"));
+
+    // Interface descriptor
+    TUsbcDescriptorBase* d = TUsbcInterfaceDescriptor::New(aIfc->iInterfaceSet->iInterfaceNumber,
+                                                           aIfc->iSettingCode,
+                                                           aIfc->iEndpoints.Count(),
+                                                           aClass);
+    if (!d)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Memory allocation for ifc desc failed."));
+        return KErrNoMemory;
+        }
+    iDescriptors.InsertDescriptor(d);
+
+    // Interface string descriptor
+    if (aString)
+        {
+        // we don't know the length of the string, so we have to allocate memory dynamically
+        TUint strlen = Kern::ThreadGetDesLength(aThread, aString);
+        if (strlen > KUsbStringDescStringMaxSize)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Warning: $ descriptor too long - string will be truncated"));
+            strlen = KUsbStringDescStringMaxSize;
+            }
+        HBuf8* const stringbuf = HBuf8::New(strlen);
+        if (!stringbuf)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Memory allocation for ifc $ desc string failed."));
+            iDescriptors.DeleteIfcDescriptor(aIfc->iInterfaceSet->iInterfaceNumber,
+                                             aIfc->iSettingCode);
+            return KErrNoMemory;
+            }
+        stringbuf->SetMax();
+        // the aString points to data that lives in user memory, so we have to copy it:
+        TInt r = Kern::ThreadDesRead(aThread, aString, *stringbuf, 0);
+        if (r != KErrNone)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Thread read error"));
+            iDescriptors.DeleteIfcDescriptor(aIfc->iInterfaceSet->iInterfaceNumber,
+                                             aIfc->iSettingCode);
+            delete stringbuf;
+            return r;
+            }
+        TUsbcStringDescriptor* const sd = TUsbcStringDescriptor::New(*stringbuf);
+        if (!sd)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Memory allocation for ifc $ desc failed."));
+            iDescriptors.DeleteIfcDescriptor(aIfc->iInterfaceSet->iInterfaceNumber,
+                                             aIfc->iSettingCode);
+            delete stringbuf;
+            return KErrNoMemory;
+            }
+        iDescriptors.SetIfcStringDescriptor(sd, aIfc->iInterfaceSet->iInterfaceNumber, aIfc->iSettingCode);
+        delete stringbuf;                                    // the (EPOC) descriptor was copied by New()
+        }
+
+    // Endpoint descriptors
+    for (TInt i = 0; i < aIfc->iEndpoints.Count(); ++i)
+        {
+        // The reason for using another function argument for Endpoint Info
+        // (and not possibly - similar to the Endpoint Address -
+        // "aIfc->iEndpoints[i]->iPEndpoint->iLEndpoint->iInfo") is that this time
+        // there are no logical endpoints associated with our real endpoints,
+        // i.e. iLEndpoint is NULL!.
+        if (aEndpointData[i].iExtra)
+            {
+            // if a non-standard endpoint descriptor is requested...
+            if (aEndpointData[i].iExtra != 2)
+                {
+                // ...then it must be a Audio Class endpoint descriptor. Else...
+                __KTRACE_OPT(KPANIC, Kern::Printf("  Error: EP desc extension > 2 bytes (%d)",
+                                                  aEndpointData[i].iExtra));
+                iDescriptors.DeleteIfcDescriptor(aIfc->iInterfaceSet->iInterfaceNumber,
+                                                 aIfc->iSettingCode);
+                return KErrArgument;
+                }
+            d = TUsbcAudioEndpointDescriptor::New(aIfc->iEndpoints[i]->iPEndpoint->iEndpointAddr,
+                                                  aEndpointData[i]);
+            }
+        else
+            {
+            d = TUsbcEndpointDescriptor::New(aIfc->iEndpoints[i]->iPEndpoint->iEndpointAddr,
+                                             aEndpointData[i]);
+            }
+        if (!d)
+            {
+            __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Memory allocation for ep desc #%d failed.", i));
+            iDescriptors.DeleteIfcDescriptor(aIfc->iInterfaceSet->iInterfaceNumber,
+                                             aIfc->iSettingCode);
+            return KErrNoMemory;
+            }
+        iDescriptors.InsertDescriptor(d);
+        }
+
+    return KErrNone;
+    }
+
+
+TInt DUsbClientController::ClientId2InterfaceNumber(const DBase* aClientId) const
+    {
+    const TInt num_ifcsets = iConfigs[0]->iInterfaceSets.Count();
+    for (TInt i = 0; i < num_ifcsets; ++i)
+        {
+        if (iConfigs[0]->iInterfaceSets[i]->iClientId == aClientId)
+            {
+            return iConfigs[0]->iInterfaceSets[i]->iInterfaceNumber;
+            }
+        }
+    return -1;
+    }
+
+
+TUsbcInterfaceSet* DUsbClientController::ClientId2InterfacePointer(const DBase* aClientId) const
+    {
+    const TInt num_ifcsets = iConfigs[0]->iInterfaceSets.Count();
+    for (TInt i = 0; i < num_ifcsets; ++i)
+        {
+        if (iConfigs[0]->iInterfaceSets[i]->iClientId == aClientId)
+            {
+            return iConfigs[0]->iInterfaceSets[i];
+            }
+        }
+    return NULL;
+    }
+
+
+const DBase* DUsbClientController::InterfaceNumber2ClientId(TInt aIfcSet) const
+    {
+    if (!InterfaceExists(aIfcSet))
+        {
+        return NULL;
+        }
+    return InterfaceNumber2InterfacePointer(aIfcSet)->iClientId;
+    }
+
+
+TUsbcInterfaceSet* DUsbClientController::InterfaceNumber2InterfacePointer(TInt aIfcSet) const
+    {
+    const TInt num_ifcsets = iConfigs[0]->iInterfaceSets.Count();
+    for (TInt i = 0; i < num_ifcsets; ++i)
+        {
+        if ((iConfigs[0]->iInterfaceSets[i]->iInterfaceNumber) == aIfcSet)
+            {
+            return iConfigs[0]->iInterfaceSets[i];
+            }
+        }
+    return NULL;
+    }
+
+
+TInt DUsbClientController::ActivateHardwareController()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("> DUsbClientController::ActivateHardwareController()"));
+    
+    // iStackIsActive must be ETrue at this time
+    // the caller of this function shall checked that iStackIsActive is ETrue
+    __ASSERT_DEBUG(iStackIsActive, Kern::Fault(KUsbPILPanicCat, __LINE__));   
+    
+    if (iHardwareActivated)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  already active -> returning"));
+        return KErrNone;
+        }
+    // Initialise HW
+    TInt r = iController.StartPeripheralController();
+    if (r != KErrNone)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: StartPeripheralController() failed"));
+        return KErrHardwareNotAvailable;
+        }
+    
+    iHardwareActivated = ETrue;
+
+    // Configure & enable endpoint zero
+    const TUsbcLogicalEndpoint* const ep0_0 = iRealEndpoints[0].iLEndpoint;
+    const TUsbcLogicalEndpoint* const ep0_1 = iRealEndpoints[1].iLEndpoint;
+    if (iHighSpeed)
+        {
+        const_cast<TUsbcLogicalEndpoint*>(ep0_0)->iInfo.iSize = ep0_0->iEpSize_Hs;
+        const_cast<TUsbcLogicalEndpoint*>(ep0_1)->iInfo.iSize = ep0_1->iEpSize_Hs;
+        }
+    else
+        {
+        const_cast<TUsbcLogicalEndpoint*>(ep0_0)->iInfo.iSize = ep0_0->iEpSize_Fs;
+        const_cast<TUsbcLogicalEndpoint*>(ep0_1)->iInfo.iSize = ep0_1->iEpSize_Fs;
+        }
+    iController.ConfigureEndpoint(0, ep0_0->iInfo);
+    iController.ConfigureEndpoint(1, ep0_1->iInfo);
+    iEp0MaxPacketSize = ep0_0->iInfo.iSize;
+
+    __KTRACE_OPT(KUSB, Kern::Printf("  Controller activated."));
+    
+    // Controller is powered up, changes device state to powered
+    NextDeviceState(UsbShai::EUsbPeripheralStatePowered);
+    
+    __KTRACE_OPT(KUSB, Kern::Printf("< DUsbClientController::ActivateHardwareController()"));
+    return  KErrNone;;
+    }
+
+
+void DUsbClientController::DeActivateHardwareController()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::DeActivateHardwareController()"));
+    if (!iHardwareActivated)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  not active -> returning"));
+        return;
+        }
+    // Deconfigure & disable endpoint zero
+    iController.DeConfigureEndpoint(KEp0_Out);
+    iController.DeConfigureEndpoint(KEp0_In);
+    // Stop HW
+    iController.StopPeripheralController();
+    iHardwareActivated = EFalse;
+    __KTRACE_OPT(KUSB, Kern::Printf("  Controller deactivated."));
+    
+    // Always go to attached state, until statck is disabled
+    NextDeviceState(UsbShai::EUsbPeripheralStateAttached);
+    
+    return;
+    }
+
+
+void DUsbClientController::DeleteInterfaceSet(TInt aIfcSet)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::DeleteInterfaceSet(%d)", aIfcSet));
+    TUsbcInterfaceSet* const ifcset_ptr = InterfaceNumber2InterfacePointer(aIfcSet);
+    if (!ifcset_ptr)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: invalid interface number: %d", aIfcSet));
+        return;
+        }
+    const TInt idx = iConfigs[0]->iInterfaceSets.Find(ifcset_ptr);
+    if (idx == KErrNotFound)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: interface not found in array"));
+        return;
+        }
+    //Add this mutex to protect the interface set data structure
+    if (NKern::CurrentContext() == EThread)
+        {
+        NKern::FMWait(&iMutex);
+        }
+    
+    iConfigs[0]->iInterfaceSets.Remove(idx);
+    if (NKern::CurrentContext() == EThread)
+        {
+        NKern::FMSignal(&iMutex);    
+        }
+    delete ifcset_ptr;
+    }
+
+
+void DUsbClientController::DeleteInterface(TInt aIfcSet, TInt aIfc)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::DeleteInterface(%d, %d)", aIfcSet, aIfc));
+    TUsbcInterfaceSet* const ifcset_ptr = InterfaceNumber2InterfacePointer(aIfcSet);
+    if (!ifcset_ptr)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: invalid interface number: %d", aIfcSet));
+        return;
+        }
+    if (ifcset_ptr->iInterfaces.Count() <= aIfc)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: invalid interface setting: %d", aIfc));
+        return;
+        }
+    //Add this mutex to protect the interface set data structure
+    if (NKern::CurrentContext() == EThread)
+        {
+        NKern::FMWait(&iMutex);
+        }    
+    TUsbcInterface* const ifc_ptr = ifcset_ptr->iInterfaces[aIfc];
+    // Always first remove, then delete (see ~TUsbcLogicalEndpoint() for the reason why)
+    ifcset_ptr->iInterfaces.Remove(aIfc);
+
+    if (aIfc == ifcset_ptr->iCurrentInterface)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf(" > Warning: deleting current interface setting"));
+        ifcset_ptr->iCurrentInterface = 0;
+        }
+    if (NKern::CurrentContext() == EThread)
+        {
+        NKern::FMSignal(&iMutex);
+        }    
+    delete ifc_ptr;
+    }
+
+
+void DUsbClientController::CancelTransferRequests(TInt aRealEndpoint)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::CancelTransferRequests(aRealEndpoint=%d)",
+                                    aRealEndpoint));
+    const DBase* const clientId = PEndpoint2ClientId(aRealEndpoint);
+    if (EpIdx2Addr(aRealEndpoint) & KUsbEpAddress_In)
+        {
+        CancelWriteBuffer(clientId, aRealEndpoint);
+        }
+    else
+        {
+        CancelReadBuffer(clientId, aRealEndpoint);
+        }
+    }
+
+
+void DUsbClientController::DeleteRequestCallback(const DBase* aClientId, TInt aEndpointNum,
+                                                 UsbShai::TTransferDirection aTransferDir)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::DeleteRequestCallback()"));
+    // Ep0 OUT
+    if (aEndpointNum == 0)
+        {
+        const TInt irq = __SPIN_LOCK_IRQSAVE(iUsbLock);
+        TSglQueIter<TUsbcRequestCallback> iter(iEp0ReadRequestCallbacks);
+        TUsbcRequestCallback* p;
+        while ((p = iter++) != NULL)
+            {
+            if (p->Owner() == aClientId)
+                {
+                __ASSERT_DEBUG((p->iRealEpNum == 0), Kern::Fault(KUsbPILPanicCat, __LINE__));
+                __ASSERT_DEBUG((p->iTransferDir == UsbShai::EControllerRead), Kern::Fault(KUsbPILPanicCat, __LINE__));
+                __KTRACE_OPT(KUSB, Kern::Printf("  removing RequestCallback @ 0x%x (ep0)", p));
+                iEp0ReadRequestCallbacks.Remove(*p);
+                }
+            }
+        __SPIN_UNLOCK_IRQRESTORE(iUsbLock, irq);
+        return;
+        }
+    // Other endpoints
+    TUsbcRequestCallback* const p = iRequestCallbacks[aEndpointNum];
+    if (p)
+        {
+         __ASSERT_DEBUG((p->Owner() == aClientId), Kern::Fault(KUsbPILPanicCat, __LINE__));
+        __ASSERT_DEBUG((p->iTransferDir == aTransferDir), Kern::Fault(KUsbPILPanicCat, __LINE__));
+        __KTRACE_OPT(KUSB, Kern::Printf("  removing RequestCallback @ 0x%x", p));
+        iRequestCallbacks[aEndpointNum] = NULL;
+        }
+    }
+
+
+void DUsbClientController::DeleteRequestCallbacks(const DBase* aClientId)
+    {
+    // aClientId being NULL means: delete all requests for *all* clients.
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::DeleteRequestCallbacks()"));
+    // Ep0 OUT
+    const TInt irq = __SPIN_LOCK_IRQSAVE(iUsbLock);
+    TSglQueIter<TUsbcRequestCallback> iter(iEp0ReadRequestCallbacks);
+    TUsbcRequestCallback* p;
+    while ((p = iter++) != NULL)
+        {
+        if (!aClientId || p->Owner() == aClientId)
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  removing RequestCallback @ 0x%x (ep0)", p));
+            iEp0ReadRequestCallbacks.Remove(*p);
+            }
+        }
+    __SPIN_UNLOCK_IRQRESTORE(iUsbLock, irq);
+    // Other endpoints
+    for (TInt i = 1; i < KUsbcEpArraySize; i++)
+        {
+        TUsbcRequestCallback* const p = iRequestCallbacks[i];
+        if (p && (!aClientId || p->Owner() == aClientId))
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  removing RequestCallback @ 0x%x", p));
+            iRequestCallbacks[i] = NULL;
+            }
+        }
+    }
+
+
+void DUsbClientController::StatusNotify(UsbShai::TUsbPeripheralState aState, const DBase* aClientId)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::StatusNotify()"));
+
+    // This function may be called by the PSL (via chapter9.cpp) from within an
+    // ISR -- so we have to take care what we do here (and also in all
+    // functions that get called from here).
+
+    TSglQueIter<TUsbcStatusCallback> iter(iStatusCallbacks);
+    TUsbcStatusCallback* p;
+    while ((p = iter++) != NULL)
+        {
+        if (!aClientId || aClientId == p->Owner())
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  notifying LDD @ 0x%x about %d", p->Owner(), aState));
+            p->SetState(aState);
+            p->DoCallback();
+            }
+        }
+    }
+
+
+void DUsbClientController::EpStatusNotify(TInt aRealEndpoint)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::EpStatusNotify()"));
+
+    // This function may be called by the PSL (via chapter9.cpp) from within an
+    // ISR -- so we have to take care what we do here (and also in all
+    // functions that get called from here).
+
+    const DBase* const client_id = PEndpoint2ClientId(aRealEndpoint);
+    if (!client_id)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Client not found for real ep %d", aRealEndpoint));
+        return;
+        }
+    // Check if there is a notification request queued for that client (if not, we can return here).
+    TSglQueIter<TUsbcEndpointStatusCallback> iter(iEpStatusCallbacks);
+    TUsbcEndpointStatusCallback* p;
+    while ((p = iter++) != NULL)
+        {
+        if (p->Owner() == client_id)
+            {
+            break;
+            }
+        }
+    if (!p)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  No notification request for that client, returning"));
+        return;
+        }
+    const TInt ifcset = ClientId2InterfaceNumber(client_id);
+    if (ifcset < 0)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Ifcset not found for clientid %d", client_id));
+        return;
+        }
+    const TUsbcInterfaceSet* const ifcset_ptr = InterfaceNumber2InterfacePointer(ifcset);
+    if (!ifcset_ptr)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Ifcset pointer not found for ifcset %d", ifcset));
+        return;
+        }
+    const TUsbcInterface* const ifc_ptr = ifcset_ptr->CurrentInterface();
+    if (!ifc_ptr)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Current ifc pointer not found for ifcset %d", ifcset));
+        return;
+        }
+    TUint state = 0;
+    const TInt eps = ifc_ptr->iEndpoints.Count();
+    for (TInt i = 0; i < eps; i++)
+        {
+        const TUsbcLogicalEndpoint* const ep_ptr = ifc_ptr->iEndpoints[i];
+        __KTRACE_OPT(KUSB, Kern::Printf("  checking logical ep #%d for stall state...",
+                                        ep_ptr->iLEndpointNum));
+        if (ep_ptr->iPEndpoint->iHalt)
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  -- stalled"));
+            // set the bit n to 1, where n is the logical endpoint number minus one
+            state |= (1 << (ep_ptr->iLEndpointNum - 1));
+            }
+        else
+            {
+            __KTRACE_OPT(KUSB, Kern::Printf("  -- not stalled"));
+            }
+        }
+    __KTRACE_OPT(KUSB, Kern::Printf(" passing ep state 0x%x on to LDD @ 0x%x", state, client_id));
+    p->SetState(state);
+    p->DoCallback();
+    }
+
+
+void DUsbClientController::OtgFeaturesNotify()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::OtgFeaturesNotify()"));
+
+    // This function may be called from the PSL (via PIL's chapter9.cpp) from
+    // within an ISR -- so we have to take care what we do here (and also in
+    // all functions that get called from here).
+
+    TSglQueIter<TUsbcOtgFeatureCallback> iter(iOtgCallbacks);
+    TUsbcOtgFeatureCallback* p;
+    while ((p = iter++) != NULL)
+        {
+        p->SetFeatures(iOtgFuncMap & 0x1C);
+        p->DoCallback();
+        }
+    }
+
+
+void DUsbClientController::RunClientCallbacks()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::RunClientCallbacks()"));
+    TSglQueIter<TUsbcClientCallback> iter(iClientCallbacks);
+    TUsbcClientCallback* p;
+    while ((p = iter++) != NULL)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("Callback 0x%x", p));
+        p->DoCallback();
+        }
+    }
+
+
+void DUsbClientController::ProcessDataTransferDone(TUsbcRequestCallback& aRcb)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessDataTransferDone()"));
+    // This piece can only be called in thread context from ProcessEp0DataReceived() /
+    // ProcessEp0SetupReceived() via the call to ProcessEp0ReceiveDone() in
+    // SetupReadBuffer(), which is guarded by an interrupt lock.
+    TInt ep = aRcb.iRealEpNum;
+    if (ep == 0)
+        {
+        if (aRcb.iTransferDir == UsbShai::EControllerRead)
+            {
+            // Ep0 OUT is special
+            iEp0ReadRequestCallbacks.Remove(aRcb);
+            }
+        else                                                // UsbShai::EControllerWrite
+            {
+            // Ep0 IN needs to be adjusted: it's '1' within the PIL.
+            ep = KEp0_Tx;
+            }
+        }
+    if (ep > 0)                                                // not 'else'!
+        {
+        __ASSERT_DEBUG((iRequestCallbacks[ep] == &aRcb), Kern::Fault(KUsbPILPanicCat, __LINE__));
+        __KTRACE_OPT(KUSB, Kern::Printf(" > removing RequestCallback[%d] @ 0x%x", ep, &aRcb));
+        iRequestCallbacks[ep] = NULL;
+        }
+    aRcb.DoCallback();
+    }
+
+
+void DUsbClientController::NextDeviceState(UsbShai::TUsbPeripheralState aNextState)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::NextDeviceState()"));
+#ifdef _DEBUG
+    const char* const states[] = {"Undefined", "Attached", "Powered", "Default",
+                                  "Address", "Configured", "Suspended"};
+    if ((aNextState >= UsbShai::EUsbPeripheralStateUndefined) &&
+        (aNextState <= UsbShai::EUsbPeripheralStateSuspended))
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  next device state: %s", states[aNextState]));
+        }
+    else
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Unknown next device state: %d", aNextState));
+        }
+    // Print a warning when an invalid state transition is detected
+    // 'Undefined' is not a state that is mentioned in the USB spec, but
+    // that's what we're in once the cable gets pulled (for instance).
+    switch (iDeviceState)
+        {
+    case UsbShai::EUsbPeripheralStateUndefined:
+        // valid: Undefined -> Attached
+        if (aNextState != UsbShai::EUsbPeripheralStateAttached)
+            break;
+        goto OK;
+    case UsbShai::EUsbPeripheralStateAttached:
+        // valid: Attached -> {Undefined, Powered}
+        if ((aNextState != UsbShai::EUsbPeripheralStateUndefined) &&
+            (aNextState != UsbShai::EUsbPeripheralStatePowered))
+            break;
+        goto OK;
+    case UsbShai::EUsbPeripheralStatePowered:
+        // valid: Powered -> {Undefined, Attached, Default, Suspended}
+        if ((aNextState != UsbShai::EUsbPeripheralStateUndefined) &&
+            (aNextState != UsbShai::EUsbPeripheralStateAttached) &&
+            (aNextState != UsbShai::EUsbPeripheralStateDefault)     &&
+            (aNextState != UsbShai::EUsbPeripheralStateSuspended))
+            break;
+        goto OK;
+    case UsbShai::EUsbPeripheralStateDefault:
+        // valid: Default -> {Undefined, Powered, Default, Address, Suspended}
+        if ((aNextState != UsbShai::EUsbPeripheralStateUndefined) &&
+            (aNextState != UsbShai::EUsbPeripheralStatePowered) &&
+            (aNextState != UsbShai::EUsbPeripheralStateDefault) &&
+            (aNextState != UsbShai::EUsbPeripheralStateAddress) &&
+            (aNextState != UsbShai::EUsbPeripheralStateSuspended))
+            break;
+        goto OK;
+    case UsbShai::EUsbPeripheralStateAddress:
+        // valid: Address -> {Undefined, Powered, Default, Configured, Suspended}
+        if ((aNextState != UsbShai::EUsbPeripheralStateUndefined) &&
+            (aNextState != UsbShai::EUsbPeripheralStatePowered) &&
+            (aNextState != UsbShai::EUsbPeripheralStateDefault) &&
+            (aNextState != UsbShai::EUsbPeripheralStateConfigured) &&
+            (aNextState != UsbShai::EUsbPeripheralStateSuspended))
+            break;
+        goto OK;
+    case UsbShai::EUsbPeripheralStateConfigured:
+        // valid: Configured -> {Undefined, Powered, Default, Address, Suspended}
+        if ((aNextState != UsbShai::EUsbPeripheralStateUndefined) &&
+            (aNextState != UsbShai::EUsbPeripheralStatePowered) &&
+            (aNextState != UsbShai::EUsbPeripheralStateDefault) &&
+            (aNextState != UsbShai::EUsbPeripheralStateAddress) &&
+            (aNextState != UsbShai::EUsbPeripheralStateSuspended))
+            break;
+        goto OK;
+    case UsbShai::EUsbPeripheralStateSuspended:
+        // valid: Suspended -> {Undefined, Powered, Default, Address, Configured}
+        if ((aNextState != UsbShai::EUsbPeripheralStateUndefined) &&
+            (aNextState != UsbShai::EUsbPeripheralStatePowered) &&
+            (aNextState != UsbShai::EUsbPeripheralStateDefault) &&
+            (aNextState != UsbShai::EUsbPeripheralStateAddress) &&
+            (aNextState != UsbShai::EUsbPeripheralStateConfigured))
+            break;
+        goto OK;
+    default:
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: Unknown current device state: %d", iDeviceState));
+        goto OK;
+        }
+    // KUSB only (instead of KPANIC) so as not to worry people too much where
+    // a particular h/w regularly enforces invalid (but harmless) transitions
+    __KTRACE_OPT(KUSB, Kern::Printf("  Warning: Invalid next state from %s", states[iDeviceState]));
+OK:
+#endif // _DEBUG
+
+    iDeviceState = aNextState;
+    StatusNotify(iDeviceState);
+    }
+
+
+TInt DUsbClientController::ProcessSuspendEvent()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessSuspendEvent()"));
+    // A suspend interrupt has been received and needs attention.
+    iDeviceStateB4Suspend = iDeviceState;
+    
+    // We have to move to the Suspend state immediately (in case it's a genuine Suspend)
+    // because 7.1.7.6 says: "The device must actually be suspended, [...] after no more
+    // than 10ms of bus inactivity [...]." Assuming we got the interrupt 3ms after the
+    // Suspend condition arose, we have now 7ms left.
+    NextDeviceState(UsbShai::EUsbPeripheralStateSuspended);
+    iController.Suspend();
+    
+    return KErrNone;
+    }
+
+TInt DUsbClientController::ProcessResumeEvent()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessResumeEvent()"));
+    if (iDeviceState == UsbShai::EUsbPeripheralStateSuspended)
+        {
+        NextDeviceState(iDeviceStateB4Suspend);
+        }
+    iController.Resume();
+    return KErrNone;
+    }
+
+
+TInt DUsbClientController::ProcessResetEvent(TBool aPslUpcall)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessResetEvent()"));
+
+    if (aPslUpcall)
+        {
+        // Call back into PSL if we're coming from there.
+        // Also, do it always, even when PIL processing will be deferred.
+        iController.Reset();
+        }
+
+    // In an OTG-environment, some OTG controllers have implemented
+    // the OTG state machine in HW and connect to the bus
+    // automatically already before the SW has indicated
+    // readiness. Peripheral PSL operating on top of such controller
+    // may report a reset event already before the upper layers are
+    // ready. In this case we defer the reset processing to after the
+    // upper layers have indicated their readiness.
+    if (iUsbResetDeferred)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  User-side (still) not ready -> returning"));
+        return KErrNone;
+        }
+    else if (!iClientSupportReady)
+        {
+        // Wait with the PIL Reset processing until user-side is ready
+        __KTRACE_OPT(KUSB, Kern::Printf("  User-side not ready -> deferring"));
+        iUsbResetDeferred = ETrue;
+        return KErrNone;
+        }
+
+    if (iDeviceState == UsbShai::EUsbPeripheralStateAttached)
+        {
+        NextDeviceState(UsbShai::EUsbPeripheralStatePowered);
+        }
+    // Notify the world. (This will just queue a DFC, so users won't actually be
+    // notified before we return. But we change the device state already here so
+    // ChangeConfiguration will see the correct one.)
+    NextDeviceState(UsbShai::EUsbPeripheralStateDefault);
+    // Tear down the current configuration (never called from thread)
+    ChangeConfiguration(0);
+    // Reset essential vars
+    ResetEp0DataOutVars();
+    //iEp0_RxExtraData = EFalse;
+    iEp0WritePending = EFalse;
+    iEp0ClientDataTransmitting = EFalse;
+    
+    iLastError = KErrNone;
+    iSetupPacketPending = EFalse;
+    //iEp0_RxExtraError = 0;
+    iConTransferMgr->Reset();
+    
+    // Reset OTG features, leave attributes as is
+    iOtgFuncMap &= KUsbOtgAttr_SrpSupp | KUsbOtgAttr_HnpSupp;
+    if (iOtgSupport)
+        {
+        OtgFeaturesNotify();
+        }
+
+    // Check whether there's a speed change
+    const TBool was_hs = iHighSpeed;
+    iHighSpeed = CurrentlyUsingHighSpeed();
+    if (!was_hs && iHighSpeed)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  Moving to High-speed"));
+        EnterHighSpeed();
+        }
+    else if (was_hs && !iHighSpeed)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  Moving to Full-speed"));
+        EnterFullSpeed();
+        }
+
+    // Setup initial Ep0 read (SetupEndpointZeroRead never called from thread)
+    if (iConTransferMgr->SetupEndpointZeroRead() != KErrNone)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: while setting up Ep0 read"));
+        return KErrGeneral;
+        }
+
+    return KErrNone;
+    }
+
+
+TInt DUsbClientController::ProcessVbusRisenEvent()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessVbusRisenEvent()"));
+    if (iIsOtgPort)
+        {
+        // In an OTG environment, this notification is not expected
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: EUsbEventVbusRisen shouldn't be sent by an OTG Client PSL"));
+        return KErrArgument;
+        }
+    else
+        {
+        // In a non-OTG environment, seeing VBUS rising causes the
+        // peripheral stack to be enabled
+        EnablePeripheralStack();
+        return KErrNone;
+        }
+    }
+
+
+TInt DUsbClientController::ProcessVbusFallenEvent()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessVbusFallenEvent()"));
+    if (iIsOtgPort)
+        {
+        // In an OTG environment, this notification is not expected
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: EUsbEventVbusFallen shouldn't be sent by an OTG Client PSL"));
+        return KErrArgument;
+        }
+    else
+        {
+        // In a non-OTG environment, seeing VBUS falling causes the
+        // peripheral stack to be disabled
+        DisablePeripheralStack();
+        return KErrNone;
+        }
+    }
+
+
+void DUsbClientController::EnterFullSpeed()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::EnterFullSpeed()"));
+    iDescriptors.UpdateDescriptorsFs();
+    }
+
+
+void DUsbClientController::EnterHighSpeed()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::EnterHighSpeed()"));
+    iDescriptors.UpdateDescriptorsHs();
+    }
+
+
+//
+// DFC (static), we are runing in a DFC context.
+//
+void DUsbClientController::ReconnectTimerCallback(TAny *aPtr)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ReconnectTimerCallback()"));
+    if (!aPtr)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("  Error: !aPtr"));
+        return;
+        }
+    
+    DUsbClientController* const ptr = static_cast<DUsbClientController*>(aPtr);
+    
+    ptr->UsbConnect();
+    
+    }
+
+//
+// static Dfc function
+//
+void DUsbClientController::PowerUpDfc(TAny* aPtr)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("> DUsbClientController::PowerUpDfc"));
+    if (!aPtr)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("     Error: !aPtr"));
+        return;
+        }
+    
+    DUsbClientController* const ptr = static_cast<DUsbClientController*>(aPtr);
+    
+    __PM_ASSERT(ptr->iStandby);
+    
+    ptr->iStandby = EFalse;
+    
+    // We have nothing to do when powerup
+    ptr->iPowerHandler->PowerUpDone();
+    
+    __KTRACE_OPT(KUSB, Kern::Printf("< DUsbClientController::PowerUpDfc"));
+    return ;
+    }
+
+//
+// static Dfc function
+//
+void DUsbClientController::PowerDownDfc(TAny* aPtr)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("> DUsbClientController::PowerDownDfc"));
+    if (!aPtr)
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("     Error: !aPtr"));
+        return;
+        }
+        
+    DUsbClientController* const ptr = static_cast<DUsbClientController*>(aPtr);
+    __PM_ASSERT(!ptr->iStandby);
+    
+    ptr->iStandby = ETrue;
+    
+    // Disable stack(stop controller inside)
+    ptr->DisablePeripheralStack();
+    
+    ptr->iPowerHandler->PowerDownDone();
+    
+    __KTRACE_OPT(KUSB, Kern::Printf("< DUsbClientController::PowerDownDfc"));
+    return ;
+    }
+
+//
+// Static Dfc function
+//
+void DUsbClientController::DeviceEventNotifyDfc(TAny* aPtr)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("> DUsbClientController::DeviceEventNotifyDfc"));
+    DUsbClientController* const ptr = static_cast<DUsbClientController*>(aPtr);
+    
+    UsbShai::TUsbPeripheralEvent event = ptr->iDevEventQueue.FifoGet();
+    
+    if( event == -1)
+        {
+        // No event queued
+        __KTRACE_OPT(KUSB, Kern::Printf("  Warning, No event found, exit !!!"));
+        return;
+        }
+    
+    ptr->ProcessDeviceEventNotification(event);
+    __KTRACE_OPT(KUSB, Kern::Printf("< DUsbClientController::DeviceEventNotifyDfc"));
+    }
+
+//
+// Static Dfc function
+//    
+void DUsbClientController::ThreadContextFinderDfc(TAny* aPtr)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("> DUsbClientController::ThreadContextFinderDfc"));
+
+    DUsbClientController* const ptr = static_cast<DUsbClientController*>(aPtr);
+    
+    ptr->iCommonDfcQThread = NKern::CurrentThread();
+    __KTRACE_OPT(KUSB, Kern::Printf("  iCommonDfcQThread = %d",ptr->iCommonDfcQThread));
+
+    __KTRACE_OPT(KUSB, Kern::Printf("< DUsbClientController::ThreadContextFinderDfc"));    
+    }
+//
+// 
+//
+void DUsbClientController::ProcessDeviceEventNotification(UsbShai::TUsbPeripheralEvent aEvent)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("> DUsbClientController::ProcessDeviceEventNotification %d",aEvent));    
+    // If an OTG Observer has registered, forward the event
+    // notification to it as well
+    if (iOtgObserver != NULL)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("  Forwarding to OTG Observer"));
+        iOtgObserver->NotifyPeripheralEvent(aEvent);
+        }
+
+    // This function may be called by the PSL from within an ISR -- so we have
+    // to take care what we do here (and also in all functions that get called
+    // from here).
+
+    switch (aEvent)
+        {
+    case UsbShai::EUsbEventSuspend:
+        ProcessSuspendEvent();
+        break;
+    case UsbShai::EUsbEventResume:
+        ProcessResumeEvent();
+        break;
+    case UsbShai::EUsbEventReset:
+        ProcessResetEvent();
+        break;
+    case UsbShai::EUsbEventVbusRisen:
+        ProcessVbusRisenEvent();
+        break;
+    case UsbShai::EUsbEventVbusFallen:
+        ProcessVbusFallenEvent();
+        break;
+        
+    default:
+        break;
+        }
+        
+    __KTRACE_OPT(KUSB, Kern::Printf("< DUsbClientController::ProcessDeviceEventNotification"));    
+    }
+    
+// Functions from UsbShai::MChargerDetectorObserverIf
+void DUsbClientController::NotifyPortType(UsbShai::TPortType aPortType)
+    {
+    // FIXME: Not yet implemented!
+    }
+
+void DUsbClientController::Buffer2Setup(const TAny* aBuf, TUsbcSetup& aSetup) const
+	{
+	// TUint8 index
+	aSetup.iRequestType = static_cast<const TUint8*>(aBuf)[0];
+	aSetup.iRequest		= static_cast<const TUint8*>(aBuf)[1];
+	// TUint16 index from here!
+	aSetup.iValue  = SWAP_BYTES_16((static_cast<const TUint16*>(aBuf))[1]);
+	aSetup.iIndex  = SWAP_BYTES_16((static_cast<const TUint16*>(aBuf))[2]);
+	aSetup.iLength = SWAP_BYTES_16((static_cast<const TUint16*>(aBuf))[3]);
+	}
+    
+TUsbPeriDeviceEventQueue::TUsbPeriDeviceEventQueue()
+    {
+    iDeviceQueueHead = 0;
+    iDeviceQueueTail = 0;
+    }
+
+// FifoAdd will be called from Isr or IDfc context
+// be careful when processing
+void TUsbPeriDeviceEventQueue::FifoAdd(UsbShai::TUsbPeripheralEvent aDeviceEvent)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("> TUsbPeriDeviceEventQueue::FifoAdd %d , %d",iDeviceQueueHead,iDeviceQueueTail));
+    iDeviceEventQueue[iDeviceQueueTail] = aDeviceEvent;
+    
+    iDeviceQueueTail ++;
+    iDeviceQueueTail %= KUsbDeviceEventQueueDepth;
+    if(iDeviceQueueTail == iDeviceQueueHead)
+        {
+        __KTRACE_OPT(KUSB, Kern::Printf("TUsbPeriDeviceEventQueue::FifoAdd overflow, oldest event missed"));
+        iDeviceQueueHead ++;
+        iDeviceQueueHead %= KUsbDeviceEventQueueDepth;
+        }
+    __KTRACE_OPT(KUSB, Kern::Printf("< TUsbPeriDeviceEventQueue::FifoAdd %d , %d",iDeviceQueueHead,iDeviceQueueTail));
+    }
+
+// FifoAdd will be called from thread context
+UsbShai::TUsbPeripheralEvent TUsbPeriDeviceEventQueue::FifoGet()
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("> TUsbPeriDeviceEventQueue::FifoGet %d , %d",iDeviceQueueHead,iDeviceQueueTail));    
+    UsbShai::TUsbPeripheralEvent ret = (UsbShai::TUsbPeripheralEvent)-1;
+    
+    if(iDeviceQueueHead != iDeviceQueueTail)
+        {
+        ret = iDeviceEventQueue[iDeviceQueueHead];    
+        iDeviceQueueHead++;
+        iDeviceQueueHead %= KUsbDeviceEventQueueDepth;
+        }
+    __KTRACE_OPT(KUSB, Kern::Printf("< TUsbPeriDeviceEventQueue::FifoGet %d , %d",iDeviceQueueHead,iDeviceQueueTail));
+    return ret;
+    }
+    
+/** Sets some data members of this request for a read request.
+
+    @param aBufferStart The start of the data buffer to be filled.
+    @param aBufferAddr The physical address of the buffer (used for DMA).
+    @param aPacketIndex A pointer to the packet index values array.
+    @param aPacketSize A pointer to the packet size values array.
+    @param aLength The number of bytes to be received.
+*/
+EXPORT_C void TUsbcRequestCallback::SetRxBufferInfo(TUint8* aBufferStart, TUintPtr aBufferAddr,
+                                           TUint32* aPacketIndex,
+                                           TUint32* aPacketSize,
+                                           TInt aLength)
+    {
+    iTransferDir = UsbShai::EControllerRead;
+    iBufferStart = aBufferStart;
+    iBufferAddr = aBufferAddr;
+    iPacketIndex = aPacketIndex;
+    iPacketSize = aPacketSize;
+    iLength = aLength;
+    }
+
+
+/** Sets some data members of this request for a write request.
+
+    @param aBufferStart The start of the buffer that contains the data to be sent.
+    @param aBufferAddr The physical address of the buffer (used for DMA).
+    @param aLength The number of bytes to be transmitted.
+*/
+EXPORT_C void TUsbcRequestCallback::SetTxBufferInfo(TUint8* aBufferStart, TUintPtr aBufferAddr, TInt aLength)
+    {
+    iTransferDir = UsbShai::EControllerWrite;
+    iBufferStart = aBufferStart;
+    iBufferAddr = aBufferAddr;
+    iLength = aLength;
+    }
+
+EXPORT_C UsbShai::TUsbPeripheralRequest::TUsbPeripheralRequest(TInt aRealEpNum):
+    iRealEpNum(aRealEpNum),
+    iBufferStart(NULL), 
+    iBufferAddr(0),
+    iLength(0),
+    iTxBytes(0),
+    iRxPackets(0),   
+    iPacketIndex(NULL),          // actually TUint16 (*)[]
+    iPacketSize(NULL),           // actually TUint16 (*)[]
+    iTransferDir(EControllerNone),
+    iZlpReqd(EFalse),
+    iError(KErrNone)
+    {
+    }
+
+// Peripheral PSL use this interface to register itself to PIL layer, in our case, 
+// DUsbClientController instance
+//
+// param aPeripheralControllerIf point to an implementation of 
+// UsbShai::MPeripheralControllerIf which represent a peripheral controller hardware.
+EXPORT_C void UsbShai::UsbPeripheralPil::RegisterPeripheralController( UsbShai::MPeripheralControllerIf& aPeripheralControllerIf, 
+                                                              const UsbShai::TPeripheralControllerProperties& aProperties)
+    {
+    __KTRACE_OPT(KUSB, Kern::Printf("> UsbPeripheralPil::RegisterPeripheralController enter."));
+    
+    DUsbClientController* usbcc = DUsbClientController::Create(aPeripheralControllerIf,
+                                                               aProperties,
+                                                               /*aIsOtgPort=*/EFalse);
+    __ASSERT_DEBUG( (usbcc != NULL),
+                    Kern::Fault( "DUsbClientController extension entry point: USB PSL Out of memory", __LINE__ ) );
+    }
+
+// The way for charger detector(PSL) to make it known to us.
+EXPORT_C void UsbShai::UsbChargerDetectionPil::RegisterChargerDetector(UsbShai::MChargerDetectorIf&         aChargerDetector,
+                                                                       UsbShai::TChargerDetectorProperties& aProperties)
+    {
+    // Only on charger detector is allowed per system.
+    if( gChargerDetector != NULL)
+        {
+        return ;
+        }
+        
+    gChargerDetector = &aChargerDetector;
+    
+    if(gChargerObsever != NULL)
+        {
+        // Register to charger detector to listen to any charger type change
+        // events.
+        gChargerDetector->SetChargerDetectorObserver(*gChargerObsever);
+        }
+    }
+
+// -EOF-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/pdd/pil/src/queue.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,124 @@
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// 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:
+// e32\drivers\usbcc\queue.cpp
+// Platform independent layer (PIL) of the USB Device controller driver:
+// Simple singly linked list + its iterator.
+// 
+//
+
+/**
+ @file queue.cpp
+ @internalTechnology
+*/
+//#include <drivers/usbc.h>
+#include <usb/usbc.h>
+
+
+void TSglQueLink::Enque(TSglQueLink* aLink)
+//
+// Enque this after aLink.
+//
+    {
+    iNext = aLink->iNext;
+    aLink->iNext = this;
+    }
+
+
+TSglQueBase::TSglQueBase(TInt aOffset)
+//
+// Constructor
+//
+    : iHead(NULL), iLast((TSglQueLink*) &iHead), iOffset(aOffset), iElements(0)
+    {
+    // ESQueOffsetNotAligned
+    __ASSERT_ALWAYS((iOffset % 4 == 0), Kern::Fault(KUsbPILPanicCat, __LINE__));
+    }
+
+
+void TSglQueBase::DoAddLast(TAny* aPtr)
+//
+// Add the object at the end of the queue.
+//
+    {
+    TSglQueLink* pL = PtrAdd((TSglQueLink*) aPtr, iOffset);
+    pL->Enque(iLast);
+    iLast = pL;
+    iElements++;
+    __ASSERT_DEBUG((iElements > 0), Kern::Fault(KUsbPILPanicCat, __LINE__));
+    }
+
+
+void TSglQueBase::DoRemove(TAny* aPtr)
+//
+// Remove the object from the queue.
+//
+    {
+    TSglQueLink* pP = (TSglQueLink*) (&iHead);
+    TSglQueLink* pL = PtrAdd((TSglQueLink*) aPtr, iOffset);
+    TSglQueLink* pN = pP->iNext;
+    while (pN)
+        {
+        if (pN == pL)
+            {
+            pP->iNext = pN->iNext;
+            if (iLast == pL)
+                {
+                iLast = pP;
+                if (iLast == NULL)
+                    iLast = (TSglQueLink*) (&iHead);
+                }
+            iElements--;
+            __ASSERT_DEBUG((iElements >= 0), Kern::Fault(KUsbPILPanicCat, __LINE__));
+            return;
+            }
+        pP = pN;
+        pN = pP->iNext;
+        }
+    // This doesn't have to indicate an error (but might):
+    __KTRACE_OPT(KPANIC, Kern::Printf("TSglQueBase::DoRemove: ESQueLinkNotQueued"));
+    }
+
+
+TSglQueIterBase::TSglQueIterBase(TSglQueBase& aQue)
+//
+// Constructor.
+//
+    : iOffset(aQue.iOffset), iHead(aQue.iHead), iNext(aQue.iHead)
+    {
+    }
+
+
+void TSglQueIterBase::SetToFirst()
+//
+// Start from the beginning of the que.
+//
+    {
+    iNext = iHead->iNext;
+    }
+
+
+TAny* TSglQueIterBase::DoPostInc()
+//
+// Return the current pointer and increment.
+//
+    {
+    TAny* pN = iNext;
+    if (pN == NULL)
+        return NULL;
+    iNext = iNext->iNext;
+    return PtrSub(pN, iOffset);
+    }
+
+
+//---
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/public/d32usbc.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,1163 @@
+// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// 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:
+// e32/include/d32usbc.h
+// User side class definitions for USB Device support.
+// 
+//
+
+/**
+ @file d32usbc.h
+ @publishedPartner
+ @released
+*/
+
+#ifndef __D32USBC_H__
+#define __D32USBC_H__
+
+#include <e32ver.h>
+#include <usb/usb.h>
+#include <usb/d32usbcshared.h>
+
+
+
+/** @internalComponent
+*/
+enum TTransferType
+	{
+	ETransferTypeReadData,
+	ETransferTypeReadPacket,
+	ETransferTypeWrite,
+	ETransferTypeNone,
+	ETransferTypeReadOneOrMore,
+	ETransferTypeReadUntilShort
+	};
+
+
+/** Available endpoints. At most only these are available per interface.
+*/
+enum TEndpointNumber
+	{
+	EEndpoint0 = 0,
+	EEndpoint1 = 1,
+	EEndpoint2 = 2,
+	EEndpoint3 = 3,
+	EEndpoint4 = 4,
+	EEndpoint5 = 5
+	};
+
+
+
+
+/** Bandwidth indicators for an Interface
+
+	@see RDevUsbcClient::SetInterface()
+*/
+enum TUsbcBandwidthPriority
+	{
+	/** Economical OUT buffering. */
+	EUsbcBandwidthOUTDefault = 0x00,
+	/** More memory than Default for OUT buffering. */
+	EUsbcBandwidthOUTPlus1   = 0x01,
+	/** More memory than Plus1 for OUT buffering. */
+	EUsbcBandwidthOUTPlus2   = 0x02,
+	/** Maximum memory for OUT buffering.
+		Use this value for high volume USB High-speed
+		data transfers only, otherwise memory will be wasted.
+	*/
+	EUsbcBandwidthOUTMaximum = 0x03,
+	//
+	/** Economical IN buffering */
+	EUsbcBandwidthINDefault  = 0x00,
+	/** More memory than Default for IN buffering */
+	EUsbcBandwidthINPlus1    = 0x10,
+	/** More memory than Plus1 for IN buffering */
+	EUsbcBandwidthINPlus2    = 0x20,
+	/** Maximum memory for IN buffering.
+		Use this value for high volume USB High-speed
+		data transfers only, otherwise memory will be wasted.
+	*/
+	EUsbcBandwidthINMaximum  = 0x30
+	};
+
+
+
+
+
+
+
+/** Bit positions of endpoints.
+
+	@see RDevUsbcClient::EndpointStatusNotify()
+	@see RDevUsbcClient::EndpointTransferCancel()
+
+	Bit position of endpoint0.
+*/
+const TUint KUsbcEndpoint0Bit = 1<<EEndpoint0;
+/** Bit position of endpoint1.
+*/
+const TUint KUsbcEndpoint1Bit = 1<<EEndpoint1;
+/** Bit position of endpoint2.
+*/
+const TUint KUsbcEndpoint2Bit = 1<<EEndpoint2;
+/** Bit position of endpoint3.
+*/
+const TUint KUsbcEndpoint3Bit = 1<<EEndpoint3;
+/** Bit position of endpoint4.
+*/
+const TUint KUsbcEndpoint4Bit = 1<<EEndpoint4;
+/** Bit position of endpoint5.
+*/
+const TUint KUsbcEndpoint5Bit = 1<<EEndpoint5;
+
+
+
+
+
+
+
+
+/** This must be filled in prior to a call to RDevUsbcClient::SetInterface().
+*/
+class TUsbcInterfaceInfo
+	{
+public:
+	TUsbcInterfaceInfo(TInt aClass=0, TInt aSubClass=0, TInt aProtocol=0,
+					   TDesC16* aString=NULL, TUint aTotalEndpoints=0);
+public:
+	/** The class, subclass and protocol that this interface supports. */
+	TUsbcClassInfo iClass;
+	/** The description string for the interface. Used to construct the interface string descriptor. */
+	const TDesC16* iString;
+	/** Total number of endpoints being requested (0-5). Endpoint 0 should not be included in this number. */
+	TUint iTotalEndpointsUsed;
+	/** Desired properties of the endpoints requested.
+		Do NOT include endpoint 0.
+		APIs use endpoint numbers that are offsets into this array.
+	*/
+	TUsbcEndpointInfo iEndpointData[KMaxEndpointsPerClient];
+	/** 32 flag bits used for specifying miscellaneous Interface features.
+		Currently defined are:
+		- KUsbcInterfaceInfo_NoEp0RequestsPlease = 0x00000001
+	*/
+	TUint32 iFeatureWord;
+	};
+
+
+/** Package buffer for a TUsbcInterfaceInfo object.
+
+	@see TUsbcInterfaceInfo
+*/
+typedef TPckgBuf<TUsbcInterfaceInfo> TUsbcInterfaceInfoBuf;
+
+
+/** The user side handle to the USB client driver.
+*/
+class RDevUsbcClient : public RBusLogicalChannel
+	{
+public:
+	/** @internalComponent */
+	enum TVer
+		{
+		EMajorVersionNumber = 0,
+		EMinorVersionNumber = 1,
+		EBuildVersionNumber = KE32BuildVersionNumber
+		};
+
+	enum TRequest
+		{
+		// Positive requests.
+		ERequestEp0 = 0x0,
+		ERequestEp1 = EEndpoint1,
+		ERequestEp2 = EEndpoint2,
+		ERequestEp3 = EEndpoint3,
+		ERequestEp4 = EEndpoint4,
+		ERequestEp5 = EEndpoint5,
+		ERequestUnused = 6,
+		ERequestAlternateDeviceStatusNotify = 7,
+		ERequestReEnumerate = 8,
+		ERequestEndpointStatusNotify = 9,
+		// The cancel TRequest's are interpreted as bitmaps. As they're not mixed
+		// with the previous ones, it doesn't matter if they have the same absolute
+		// value as those.
+		ERequestEp0Cancel = 1<<ERequestEp0,
+		ERequestEp1Cancel = 1<<ERequestEp1,
+		ERequestEp2Cancel = 1<<ERequestEp2,
+		ERequestEp3Cancel = 1<<ERequestEp3,
+		ERequestEp4Cancel = 1<<ERequestEp4,
+		ERequestEp5Cancel = 1<<ERequestEp5,
+		ERequestUnusedCancel = 1<<ERequestUnused,
+        ERequestAllCancel = (ERequestEp0Cancel | ERequestEp1Cancel |
+							 ERequestEp2Cancel | ERequestEp3Cancel |
+							 ERequestEp4Cancel | ERequestEp5Cancel |
+							 ERequestUnusedCancel),
+		ERequestAlternateDeviceStatusNotifyCancel = 1<<ERequestAlternateDeviceStatusNotify,
+		ERequestReEnumerateCancel = 1<<ERequestReEnumerate,
+		ERequestEndpointStatusNotifyCancel = 1<<ERequestEndpointStatusNotify,
+        ERequestOtgFeaturesNotify = 10,
+        ERequestOtgFeaturesNotifyCancel = 1<<ERequestOtgFeaturesNotify,
+		};
+
+	enum TControl
+		{
+		// Changing the order of these enums will break BC.
+		EControlEndpointZeroRequestError,					// 0
+		EControlEndpointCaps,
+		EControlDeviceCaps,
+		EControlGetAlternateSetting,
+		EControlDeviceStatus,
+		EControlEndpointStatus,
+		EControlSetInterface,
+		EControlReleaseInterface,
+		EControlQueryReceiveBuffer,
+		EControlSendEp0StatusPacket,						// 9
+		//
+		EControlHaltEndpoint,								// 10
+		EControlClearHaltEndpoint,
+		EControlSetDeviceControl,
+		EControlReleaseDeviceControl,
+		EControlEndpointZeroMaxPacketSizes,
+		EControlSetEndpointZeroMaxPacketSize,
+		EControlGetDeviceDescriptor,
+		EControlSetDeviceDescriptor,
+		EControlGetDeviceDescriptorSize,
+		EControlGetConfigurationDescriptor,					// 19
+		//
+		EControlSetConfigurationDescriptor,					// 20
+		EControlGetConfigurationDescriptorSize,
+		EControlGetInterfaceDescriptor,
+		EControlSetInterfaceDescriptor,
+		EControlGetInterfaceDescriptorSize,
+		EControlGetEndpointDescriptor,
+		EControlSetEndpointDescriptor,
+		EControlGetEndpointDescriptorSize,
+		EControlGetCSInterfaceDescriptor,
+		EControlSetCSInterfaceDescriptor,					// 29
+		//
+		EControlGetCSInterfaceDescriptorSize,				// 30
+		EControlGetCSEndpointDescriptor,
+		EControlSetCSEndpointDescriptor,
+		EControlGetCSEndpointDescriptorSize,
+		EControlSignalRemoteWakeup,
+		EControlGetStringDescriptorLangId,
+		EControlSetStringDescriptorLangId,
+		EControlGetManufacturerStringDescriptor,
+		EControlSetManufacturerStringDescriptor,
+		EControlRemoveManufacturerStringDescriptor,			// 39
+		//
+		EControlGetProductStringDescriptor,					// 40
+		EControlSetProductStringDescriptor,
+		EControlRemoveProductStringDescriptor,
+		EControlGetSerialNumberStringDescriptor,
+		EControlSetSerialNumberStringDescriptor,
+		EControlRemoveSerialNumberStringDescriptor,
+		EControlGetConfigurationStringDescriptor,
+		EControlSetConfigurationStringDescriptor,
+		EControlRemoveConfigurationStringDescriptor,
+		EControlDeviceDisconnectFromHost,					// 49
+		//
+		EControlDeviceConnectToHost,						// 50
+		EControlDevicePowerUpUdc,
+		EControlDumpRegisters,
+		EControlSetInterface1,								// (not used)
+		EControlAllocateEndpointResource,
+		EControlDeAllocateEndpointResource,
+		EControlQueryEndpointResourceUse,
+		EControlGetEndpointZeroMaxPacketSize,
+		EControlGetDeviceQualifierDescriptor,
+		EControlSetDeviceQualifierDescriptor,				// 59
+		//
+		EControlGetOtherSpeedConfigurationDescriptor,		// 60
+		EControlSetOtherSpeedConfigurationDescriptor,
+		EControlCurrentlyUsingHighSpeed,
+		EControlSetStringDescriptor,
+		EControlGetStringDescriptor,
+		EControlRemoveStringDescriptor,
+        EControlSetOtgDescriptor,
+        EControlGetOtgDescriptor,
+        EControlGetOtgFeatures
+		};
+
+public:
+
+#ifndef __KERNEL_MODE__
+
+	/** Opens a channel.
+
+		@param aUnit This should be 0 (zero).
+
+		@return KErrNone if successful.
+	*/
+	inline TInt Open(TInt aUnit);
+
+	inline TVersion VersionRequired() const;
+
+	/** Stalls ep0 to signal command fault to the host.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt EndpointZeroRequestError();
+
+	/** Retrieves the capabilities of all the endpoints on the device.
+
+		Suggested use is as follows:
+
+		@code
+		TUsbcEndpointData data[KUsbcMaxEndpoints];
+		TPtr8 dataPtr(reinterpret_cast<TUint8*>(data), sizeof(data), sizeof(data));
+		ret = usbPort.EndpointCaps(dataPtr);
+		@endcode
+
+		@param aEpCapsBuf a descriptor encapsulating an array of TUsbcEndpointData.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt EndpointCaps(TDes8& aEpCapsBuf);
+
+	/** Retrieves the capabilities of the USB device.
+
+		@see TUsbDeviceCaps
+
+		@param aDevCapsBuf a TUsbDeviceCaps object.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt DeviceCaps(TUsbDeviceCaps& aDevCapsBuf);
+
+	/** Copies the current alternate setting for this interface into aInterfaceNumber
+		For USB Interfaces whose main interface is active, this will be 0 (zero).
+
+		@param aInterfaceNumber current alternate setting for this interface is copied into this.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt GetAlternateSetting(TInt& aInterfaceNumber);
+
+	/** Copies the current device status into aDeviceStatus.
+
+		@param aDeviceStatus current device status is copied into this.
+
+		@return KErrNone if successful
+	*/
+	inline TInt DeviceStatus(TUsbcDeviceState& aDeviceStatus);
+
+	/** Copies the current endpoint status into aEndpointStatus.
+
+		@param aEndpoint endpoint number valid for the current alternate setting.
+		@param aEndpointStatus the current endpoint status, might be stalled, not stalled or unknown.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt EndpointStatus(TEndpointNumber aEndpoint, TEndpointState& aEndpointStatus);
+
+	/** Copies the number of bytes available in the aEndpoint read buffer into aNumberOfBytes.
+
+		@param aEndpoint endpoint number valid for the current alternate setting.
+		@param aNumberOfBytes number of bytes available in the aEndpoint read buffer.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt QueryReceiveBuffer(TEndpointNumber aEndpoint, TInt& aNumberOfBytes);
+
+	/** Requests that a zero length status packet be sent to the host in response
+		to a class or vendor specific ep0 SETUP packet.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt SendEp0StatusPacket();
+
+	/** Stalls endpoint aEndpoint, usually to indicate an error condition with a previous command.
+		The host will normally send a SET_FEATURE command on ep0 to acknowledge and clear the stall.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt HaltEndpoint(TEndpointNumber aEndpoint);
+
+	/** Clears the stall condition on endpoint aEndpoint. This is inluded for symmetry and test purposes.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt ClearHaltEndpoint(TEndpointNumber aEndpoint);
+
+	/** Requests that device control be allocated to this channel.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt SetDeviceControl();
+
+	/** Relinquishes device control previously allocated to this channel.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt ReleaseDeviceControl();
+
+	/** Returns a bitmap of available ep0 maximum packet sizes.
+
+		@return bitmap of available ep0 maximum packet sizes.
+	*/
+	inline TUint EndpointZeroMaxPacketSizes();
+
+	/** Requests that a maximum packet size of aMaxPacketSize be set on ep0.
+
+		@param aMaxPacketSize The maximum packet size.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt SetEndpointZeroMaxPacketSize(TInt aMaxPacketSize);
+
+	/** Queries the current maximum packet size on ep0.
+
+		@return The currently set maximum packet size on ep0.
+	*/
+	inline TInt GetEndpointZeroMaxPacketSize();
+
+	/** Copies the current device descriptor into aDeviceDescriptor.
+
+		@param aDeviceDescriptor Receives the current device descriptor.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt GetDeviceDescriptor(TDes8& aDeviceDescriptor);
+
+	/** Sets the contents of aDeviceDescriptor to be the current device descriptor.
+
+		@param aDeviceDescriptor contains the device descriptor.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt SetDeviceDescriptor(const TDesC8& aDeviceDescriptor);
+
+	/** Gets the size of the current device descriptor. This is unlikely to be anything other than 9.
+
+		@param aSize receives the size of the current device descriptor.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt GetDeviceDescriptorSize(TInt& aSize);
+
+	/** Copies the current configuration descriptor into aConfigurationDescriptor.
+
+		@param aConfigurationDescriptor Receives the current configuration descriptor.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt GetConfigurationDescriptor(TDes8& aConfigurationDescriptor);
+
+	/** Sets the contents of aConfigurationDescriptor to be the current configuration descriptor.
+
+		@param aConfigurationDescriptor contains the configuration descriptor.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt SetConfigurationDescriptor(const TDesC8& aConfigurationDescriptor);
+
+	/** Gets the size of the current configuration descriptor.
+
+		@param aSize receives the size of the current configuration descriptor.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt GetConfigurationDescriptorSize(TInt& aSize);
+
+	/** Copies the interface descriptor into aInterfaceDescriptor for the interface with alternate
+		setting aSettingNumber, 0 for the main interface.
+
+		@param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
+		@param aInterfaceDescriptor Receives the interface descriptor.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt GetInterfaceDescriptor(TInt aSettingNumber, TDes8& aInterfaceDescriptor);
+
+	/** Sets the interface descriptor contained in aInterfaceDescriptor for the interface with
+		alternate setting aSettingNumber, 0 for the main interface, for transmission to the host
+		during enumeration.
+
+		@param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
+		@param aInterfaceDescriptor Contains the interface descriptor to be set.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt SetInterfaceDescriptor(TInt aSettingNumber, const TDesC8& aInterfaceDescriptor);
+
+	/** Copies the size of the interface descriptor for the interface with alternate
+		setting aSettingNumber, 0 for the main interface, into aSize.
+
+		@param aSettingNumber The alternate setting.
+		@param aSize receives the size of the interface descriptor.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt GetInterfaceDescriptorSize(TInt aSettingNumber, TInt& aSize);
+
+	/** Copies the endpoint descriptor for logical endpoint number aEndpointNumber into aEndpointDescriptor
+		for the interface with alternate setting aSettingNumber, 0 for the main interface.
+
+		@param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
+		@param aEndpointNumber.
+		@param aEndpointDescriptor Receives the endpoint descriptor.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt GetEndpointDescriptor(TInt aSettingNumber, TInt aEndpointNumber, TDes8& aEndpointDescriptor);
+
+	/** Sets the endpoint descriptor for logical endpoint number aEndpointNumber contained in
+		aEndpointDescriptor for the interface with alternate setting aSettingNumber, 0 for the main interface,
+		for transmission to the host during enumeration.
+
+		@param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
+		@param aEndpointNumber Valid endpoint number on this interface.
+		@param aEndpointDescriptor Contains the endpoint descriptor to be set.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt SetEndpointDescriptor(TInt aSettingNumber, TInt aEndpointNumber,
+									  const TDesC8& aEndpointDescriptor);
+
+	/** Copies the size of the endpoint descriptor for logical endpoint number aEndpointNumber for the
+		interface with alternate setting aSettingNumber, 0 for the main interface, into aSize.
+
+		@param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
+		@param aEndpointNumber Valid endpoint number on this interface.
+		@param aSize receives the size of the endpoint descriptor.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt GetEndpointDescriptorSize(TInt aSettingNumber, TInt aEndpointNumber, TInt& aSize);
+
+    /** Get OTG descriptor size
+
+		@param aSize TInt reference which contains OTG descriptor size on return
+    */
+    inline void GetOtgDescriptorSize(TInt& aSize);
+
+    /** Get OTG descriptor of USB on-the-go feature
+
+		@param aOtgDesc User-side buffer to store copy of descriptor
+
+		@return KErrNone if successful
+    */
+    inline TInt GetOtgDescriptor(TDes8& aOtgDesc);
+
+    /** Set OTG descriptor by user to enable/disable USB on-the-go feature
+
+		@param aOtgDesc Descriptor buffer containing OTG features
+
+		@return KErrNone if successful
+    */
+    inline TInt SetOtgDescriptor(const TDesC8& aOtgDesc);
+
+	/** Copies the current device_qualifier descriptor into aDescriptor.
+
+		@param aDescriptor Receives the current device_qualifier descriptor.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt GetDeviceQualifierDescriptor(TDes8& aDescriptor);
+
+	/** Sets the device_qualifier descriptor to the contents of aDescriptor.
+
+		@param aDescriptor contains the new device_qualifier descriptor.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt SetDeviceQualifierDescriptor(const TDesC8& aDescriptor);
+
+	/** Copies the current other_speed_configuration descriptor into aDescriptor.
+
+		@param aDescriptor Receives the current other_speed_configuration descriptor.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt GetOtherSpeedConfigurationDescriptor(TDes8& aDescriptor);
+
+	/** Sets the other_speed_configuration descriptor to the contents of aDescriptor.
+
+		@param aDescriptor contains the new other_speed_configuration descriptor.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt SetOtherSpeedConfigurationDescriptor(const TDesC8& aDescriptor);
+
+	/** Copies the class specific interface descriptor block into aInterfaceDescriptor for the interface
+		with alternate setting aSettingNumber, 0 for the main interface.
+
+		@param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
+		@param aInterfaceDescriptor Contains the interface descriptor to be set.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt GetCSInterfaceDescriptorBlock(TInt aSettingNumber, TDes8& aInterfaceDescriptor);
+
+	/** aSettingNumber is the alternate interface setting, 0 for the main interface, that the descriptor block
+		aDes should be attached to. aDes is a block of data containing at least one class specific descriptor
+		for transmission during enumeration after the class interface descriptor (or alternate interface
+		descriptor) has been sent, but before the endpoint descriptors belonging to this interface are sent.
+		aDes may contain as many descriptors as are necessary or only 1. SetCSInterfaceDescriptorBlock()
+		should be called at any time after SetInterface() has been called to establish a main interface or an
+		alternate interface. More than one call may be made - the data blocks will be concatenated prior to
+		sending. No checking or validation of the contents of aDes will be made and it is the caller's
+		responsibility to ensure that the data supplied is correct and appropriate to the interface identified
+		by aSettingNumber.
+
+		@param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
+		@param aInterfaceDescriptor Contains the interface descriptor to be set.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt SetCSInterfaceDescriptorBlock(TInt aSettingNumber, const TDesC8& aInterfaceDescriptor);
+
+	/** Copies the size of the class specific interface descriptor block for the interface with alternate
+		setting aSettingNumber, 0 for the main interface, into aSize.
+
+		@param aSettingNumber The alternate setting number.
+		@param aSize receives the size of the interface descriptor.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt GetCSInterfaceDescriptorBlockSize(TInt aSettingNumber, TInt& aSize);
+
+	/** Copies the class specific endpoint descriptor for logical endpoint number aEndpointNumber
+		into aEndpointDescriptor for the interface with alternate setting aSettingNumber, 0 for the main
+		interface.
+
+		@param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
+		@param aEndpointNumber Valid endpoint number on this interface.
+		@param aEndpointDescriptor Receives the endpoint descriptor.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt GetCSEndpointDescriptorBlock(TInt aSettingNumber, TInt aEndpointNumber,
+											 TDes8& aEndpointDescriptor);
+
+	/** Sets the class specific endpoint descriptor for logical endpoint number aEndpointNumber contained in
+		aEndpointDescriptor for the interface with alternate setting aSettingNumber, 0 for the main interface,
+		for transmission to the host during enumeration.
+
+		@param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
+		@param aEndpointNumber Valid endpoint number on this interface.
+		@param aEndpointDescriptor Contains the endpoint descriptor to be set.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt SetCSEndpointDescriptorBlock(TInt aSettingNumber, TInt aEndpointNumber,
+											 const TDesC8& aEndpointDescriptor);
+
+	/** Copies the size of the class specific endpoint descriptor block for logical endpoint number
+		aEndpointNumber for the interface with alternate setting aSettingNumber, 0 for the main interface,
+		into aSize.
+
+		@param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
+		@param aEndpointNumber Valid endpoint number on this interface.
+		@param aSize On return, contains the size of the class specific endpoint descriptor block.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt GetCSEndpointDescriptorBlockSize(TInt aSettingNumber, TInt aEndpointNumber, TInt& aSize);
+
+	/** Generates a Remote Wakeup bus condition
+		The capability of the device to generate Remote Wakeup signalling is enquired in
+		RDevUsbcClient::DeviceCaps.
+
+		@return KErrNone if this signalling is possible and the signal has been generated.
+	*/
+	inline TInt SignalRemoteWakeup();
+
+	/** Simulates a physical removal of the USB cable by disabling the D+/- pull-ups.The iConnect member of
+		TUsbDeviceCapsV01, returned by RDevUsbcClient::DeviceCaps(), indicates whether this functionality is
+		supported.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt DeviceDisconnectFromHost();
+
+	/** Simulates a physical insertion of the USB cable by enabling the D+/- pull-ups.The iConnect member
+		of TUsbDeviceCapsV01, returned by RDevUsbcClient::DeviceCaps(),  indicates whether this functionality
+		is supported.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt DeviceConnectToHost();
+
+	/** Powers up the UDC and connects it to the bus if one or more interfaces exist.
+
+		@return KErrNone if UDC successfully powered up, KErrNotReady if no
+		interfaces have been registered yet, KErrHardwareNotAvailable if UDC
+		couldn't be activated.
+	*/
+	inline TInt PowerUpUdc();
+
+	/** Enquires about the current operating speed of the UDC.
+
+		@return ETrue if the UDC is currently operating at High speed, EFalse otherwise.
+	*/
+	inline TBool CurrentlyUsingHighSpeed();
+
+	/** Allocates the use of aResource to aEndpoint. it will be used from when the current bus transfer	has been
+		completed.
+
+		@param aResource is typically some rationed hardware resource or possibly specifies a type of endpoint
+		behaviour. aResource is not a bitmap and TEndpointResource values should not be combined.
+		@param aEndpoint The endpoint number to which the resource is to be allocated.
+
+		@return KErrNone if successful, KErrInUse if the resource is already consumed and cannot be allocated,
+		KErrNotSupported if the endpoint does not support the resource requested.
+
+		@publishedPartner @deprecated
+
+		@see TUsbcEndpointInfo
+	*/
+	inline TInt AllocateEndpointResource(TInt aEndpoint, TUsbcEndpointResource aResource);
+
+	/** Deallocates the use of aResource aEndpoint or ends a specified endpoint behaviour.
+
+		@param aResource is typically some rationed hardware resource or possibly specifies a type of endpoint
+		behaviour. aResource is not a bitmap and TEndpointResource values should not be combined.
+		@param aEndpoint The endpoint number from which the resource is to be removed.
+
+		@return KErrNone if the resource has been successfully deallocated, KErrNotSupported if the endpoint
+		does not support the resource requested.
+
+		@publishedPartner @deprecated
+
+		@see TUsbcEndpointInfo
+	*/
+	inline TInt DeAllocateEndpointResource(TInt aEndpoint, TUsbcEndpointResource aResource);
+
+	/** Queries endpoint resource use.
+
+		@param aResource is typically some rationed hardware resource or possibly specifies a type of endpoint
+		behaviour. aResource is not a bitmap and TEndpointResource values should not be combined.
+		@param aEndpoint The endpoint number at which the resource is to be queried.
+
+		@return ETrue is the specified resource is in use at the endpoint and EFalse if not.
+	*/
+	inline TBool QueryEndpointResourceUse(TInt aEndpoint, TUsbcEndpointResource aResource);
+
+	/** Request (i.e. claim for this channel) up to five endpoints and set the class type for this USB
+		interface. 'aInterfaceData' is a package buffer which describes the interface and all the endpoints
+		being requested by the driver for this interface.
+
+		@param aInterfaceNumber Distinguishes between alternate interfaces. If these are not be used then this
+		should always be zero. If this parameter is used, then its value must be one more than that of the
+		proceeding alternate interface.
+		@param aInterfaceData a package buffer which describes the interface and all the endpoints being
+		requested by the driver for this interface.
+		@param aBandwidthPriority is a bitmap combining the required IN and OUT priorities. Values are in the
+		range [0,3] from the lowest priority bandwidth, 0, to the highest 3 and are separately specified for
+		IN and OUT endpoints. Interfaces requiring higher bandwidth are allocated significantly more buffering
+		than low bandwidth interfaces. Interfaces should not be given a higher bandwidth priority than they
+		require.
+
+		@return KErrInUse if any of the endpoints being requested have already been claimed by another channel
+		KErrNotSupported if an endpoint with all of the specified properties is not supported on this
+		platform. KErrNoMemory if insufficient memory is available to complete the operation.
+	*/
+	inline TInt SetInterface(TInt aInterfaceNumber, TUsbcInterfaceInfoBuf& aInterfaceData,
+							 TUint32 aBandwidthPriority =
+							 (EUsbcBandwidthOUTDefault | EUsbcBandwidthINDefault));
+
+	/** Release an interface previously claimed by this channel. Alternate interfaces need to be released
+		in strict descending order, starting with the last (i.e. highest numbered) one.
+		It is not necessary to release an interface that wasn't successfully requested.
+
+		@param aInterfaceNumber Specifies the alternate setting number 'aInterfaceNum' of the interface to be
+		released.
+
+		@return KErrNone if successful. KErrArgument if the alternate setting doesn't exist or is released out
+		of order.
+	*/
+	inline TInt ReleaseInterface(TInt aInterfaceNumber);
+
+	/** Copies the current string descriptor language ID (LANGID) code into the aLangId argument. Even though
+		the USB spec allows for the existence of a whole array of LANGID codes, we only support one.
+
+		@param aLangId receives the LANGID code.
+
+		@return KErrNone if successful, KErrArgument if problem with argument (memory cannot be written to, etc.).
+	*/
+	inline TInt GetStringDescriptorLangId(TUint16& aLangId);
+
+	/** Sets the string descriptor language ID (LANGID). Even though the USB spec allows for the existence of
+		a whole array of LANGID codes, we only support one.
+
+		@param aLangId the LANGID code to be set.
+
+		@return KErrNone if successful.
+	*/
+	inline TInt SetStringDescriptorLangId(TUint16 aLangId);
+
+	/** Copies the string descriptor identified by the iManufacturer index field of the Standard Device
+		Descriptor into the aString argument.
+
+		@param aString receives manufacturer string.
+
+		@return KErrNone if successful, KErrArgument if MaxLength of aString is too small to hold the entire
+		descriptor, KErrNotFound if the string descriptor couldn't be found.
+	*/
+	inline TInt GetManufacturerStringDescriptor(TDes16& aString);
+
+	/** Sets the string descriptor identified by the iManufacturer index field of the Standard Device
+		Descriptor to the aString argument.
+
+		@param aString Contains the new manufacturer string descriptor.
+
+		@return KErrNone if successful, KErrNoMemory if no memory is available to store the new string from
+		aString (in which case the old string descriptor will be preserved).
+	*/
+	inline TInt SetManufacturerStringDescriptor(const TDesC16& aString);
+
+	/** Removes (deletes) the string descriptor identified by the iManufacturer index field of the Standard
+		Device Descriptor and sets that field to zero.
+
+		@return KErrNone if successful, KErrNotFound if the string descriptor couldn't be found.
+	*/
+	inline TInt RemoveManufacturerStringDescriptor();
+
+	/** Retrieves the string descriptor identified by the iProduct index field of the Standard Device
+		Descriptor into the aString argument.
+
+		@param aString receives product string.
+
+		@return KErrNone if successful, KErrArgument if MaxLength of aString is too small to hold the entire
+		descriptor, KErrNotFound if the string descriptor couldn't be found.
+	*/
+	inline TInt GetProductStringDescriptor(TDes16& aString);
+
+	/** Sets the string descriptor identified by the iProduct index field of the Standard Device Descriptor to
+		the aString argument.
+
+		@param aString Contains the new product string descriptor.
+
+		@return KErrNone if successful, KErrNoMemory if no memory is available to store the new string from
+		aString (in which case the old string descriptor will be preserved).
+	*/
+	inline TInt SetProductStringDescriptor(const TDesC16& aString);
+
+	/** Removes (deletes) the string descriptor identified by the iProduct index field of the Standard Device
+		Descriptor and sets that field to zero.
+
+		@return KErrNone if successful, KErrNotFound if the string descriptor couldn't be found.
+	*/
+	inline TInt RemoveProductStringDescriptor();
+
+	/** Retrieves the string descriptor identified by the iSerialNumber index field of the Standard Device
+		Descriptor into the aString argument.
+
+		@param aString receives product string.
+
+		@return KErrNone if successful, KErrArgument if MaxLength of aString is too small to hold the entire
+		descriptor, KErrNotFound if the string descriptor couldn't be found.
+	*/
+	inline TInt GetSerialNumberStringDescriptor(TDes16& aString);
+
+	/** Sets the string descriptor identified by the iSerialNumber index field of the Standard Device
+		Descriptor to the aString argument.
+
+		@param aString Contains the new serial number string descriptor.
+
+		@return KErrNone if successful, KErrNoMemory if no memory is available to store the new string from
+		aString (in which case the old string descriptor will be preserved).
+	*/
+	inline TInt SetSerialNumberStringDescriptor(const TDesC16& aString);
+
+	/** Removes (deletes) the string descriptor identified by the iSerialNumber index field of the Standard
+		Device Descriptor and sets that field to zero.
+
+		@return KErrNone if successful, KErrNotFound if the string descriptor couldn't be found.
+	*/
+	inline TInt RemoveSerialNumberStringDescriptor();
+
+	/** Retrieves the string descriptor identified by the iConfiguration index field of the (first) Standard
+		Configuration Descriptor into the aString argument.
+
+		@param aString receives configuration string.
+
+		@return KErrNone if successful, KErrArgument if MaxLength of aString is too small to hold the entire
+		descriptor, KErrNotFound if the string descriptor couldn't be found.
+	*/
+	inline TInt GetConfigurationStringDescriptor(TDes16& aString);
+
+	/** Sets the string descriptor identified by the iConfiguration index field of the Standard Configuration
+		Descriptor to the aString argument.
+
+		@param aString Contains the new serial number string descriptor.
+
+		@return KErrNone if successful, KErrNoMemory if no memory is available to store the new string from
+		aString (in which case the old string descriptor will be preserved).
+	*/
+	inline TInt SetConfigurationStringDescriptor(const TDesC16& aString);
+
+	/** Removes (deletes) the string descriptor identified by the iConfiguration index field of the Standard
+		Configuration Descriptor and sets that field to zero.
+
+		@return KErrNone if successful, KErrNotFound if the string descriptor couldn't be found.
+	*/
+	inline TInt RemoveConfigurationStringDescriptor();
+
+	/** Copies the string of the USB string descriptor at the specified index in the string descriptor array
+		into the aString argument.
+
+		Although this function can also be used for it, for querying most standard string descriptors
+		there exists a set of dedicated access functions.
+
+		@see RDevUsbcClient::GetStringDescriptorLangId
+		@see RDevUsbcClient::GetManufacturerStringDescriptor
+		@see RDevUsbcClient::GetProductStringDescriptor
+		@see RDevUsbcClient::GetSerialNumberStringDescriptor
+		@see RDevUsbcClient::GetConfigurationStringDescriptor
+
+		@param aIndex The position of the string descriptor in the string descriptor array.
+		@param aString The target location for the string descriptor copy.
+
+		@return KErrNone if successful, KErrNotFound if no string descriptor exists at the specified index,
+		KErrArgument if MaxLength() of aString is too small to hold the entire descriptor.
+	*/
+	inline TInt GetStringDescriptor(TUint8 aIndex, TDes16& aString);
+
+	/** Sets the aString argument to be the string of a USB string descriptor at the specified index in the
+		string descriptor array. If a string descriptor already exists at that position then its string will
+		be replaced.
+
+		Care should be taken, when choosing aIndex, not to inadvertently overwrite one of the standard
+		string descriptors.	For their manipulation there exists a set of dedicated access functions.
+
+		@see RDevUsbcClient::SetStringDescriptorLangId
+		@see RDevUsbcClient::SetManufacturerStringDescriptor
+		@see RDevUsbcClient::SetProductStringDescriptor
+		@see RDevUsbcClient::SetSerialNumberStringDescriptor
+		@see RDevUsbcClient::SetConfigurationStringDescriptor
+
+		@param aIndex The position of the string descriptor in the string descriptor array.
+		@param aString Contains the string descriptor to be set.
+
+		@return KErrNone if successful, KErrArgument if aIndex is invalid, KErrNoMemory if no memory
+		is available to store the new string (an existing descriptor at that index will be preserved).
+	*/
+	inline TInt SetStringDescriptor(TUint8 aIndex, const TDesC16& aString);
+
+	/** Removes (deletes) the USB string descriptor at the specified index in the string descriptor array.
+		The position in the array of other string descriptors is not affected.
+
+		Care should be taken, when choosing aIndex, not to inadvertently delete a standard string descriptor
+		(also because index references from non-string descriptors would be invalidated). For the deletion
+		of most standard string descriptors there exists a set of dedicated functions.
+
+		@see RDevUsbcClient::RemoveManufacturerStringDescriptor
+		@see RDevUsbcClient::RemoveProductStringDescriptor
+		@see RDevUsbcClient::RemoveSerialNumberStringDescriptor
+		@see RDevUsbcClient::RemoveConfigurationStringDescriptor
+
+		@param aIndex The position of the string descriptor in the string descriptor array.
+
+		@return KErrNone if successful, KErrNotFound if no string descriptor exists at the specified index.
+	*/
+	inline TInt RemoveStringDescriptor(TUint8 aIndex);
+
+	/** Asynchronously read data from endpoint 'aEndpoint' into the descriptor 'aDes'.
+		Request completes when the specified number of bytes is received, length taken from max. length of
+		descriptor.
+
+		@param aStatus The request status.
+		@param aEndpoint The endpoint number to read from.
+		@param aDes	Descriptor to receive the data.
+	*/
+	inline void Read(TRequestStatus& aStatus, TEndpointNumber aEndpoint, TDes8& aDes);
+
+	/** Asynchronously read data from endpoint 'aEndpoint' into the descriptor 'aDes'.
+		Request completes when the specified number of bytes is received.
+
+		@param aStatus The request status.
+		@param aEndpoint The endpoint number to read from.
+		@param aDes	Descriptor to receive the data.
+		@param aLen The number of bytes to read.
+	*/
+	inline void Read(TRequestStatus& aStatus, TEndpointNumber aEndpoint, TDes8& aDes, TInt aLen);
+
+	/** Asynchronously read an entire packet of data from endpoint 'aEndpoint' into the descriptor 'aDes'.
+		If a packet has previously been partly read. then only the remainder of the packet will be returned.
+		The request should be for the maximum packet size of the endpoint. If less data is requested, then
+		after this read completes the remainder of the data in the packet will be discarded and the next read
+		will start from the next available packet.
+		Request completes when either a complete packet is received or the length of the packet currently
+		being received exceeds 'aMaxLen'.
+
+		@param aStatus The request status.
+		@param aEndpoint The endpoint number to read from.
+		@param aDes	Descriptor to receive the data.
+		@param aMaxLen .
+	*/
+	inline void ReadPacket(TRequestStatus& aStatus, TEndpointNumber aEndpoint, TDes8& aDes, TInt aMaxLen);
+
+	/** Asynchronously read data from endpoint 'aEndpoint' into the descriptor 'aDes'.
+		Request completes when the specified number of bytes is received (in first version,
+		length taken from max. length of descriptor).
+
+		@param aStatus The request status.
+		@param aEndpoint The endpoint number to read from.
+		@param aDes	Descriptor to receive the data.
+	*/
+	inline void ReadUntilShort(TRequestStatus& aStatus, TEndpointNumber aEndpoint, TDes8& aDes);
+
+	/** Asynchronously read data from endpoint 'aEndpoint' into the descriptor 'aDes'.
+		Request completes when the specified number of bytes is received (in first version,
+		length taken from max. length of descriptor).
+
+		@param aStatus The request status.
+		@param aEndpoint The endpoint number to read from.
+		@param aDes	Descriptor to receive the data.
+		@param aLen The number of bytes to receive.
+	*/
+	inline void ReadUntilShort(TRequestStatus& aStatus, TEndpointNumber aEndpoint, TDes8& aDes, TInt aLen);
+
+	/** Asynchronously read data from endpoint 'aEndpoint' into the descriptor 'aDes'. The request completes
+		when the specified number of bytes is received, length taken from max. length of descriptor or a
+		packet whose size is smaller than the endpoint's maximum packet size is received.
+
+		@param aStatus The request status.
+		@param aEndpoint The endpoint number to read from.
+		@param aDes	Descriptor to receive the data.
+	*/
+	inline void ReadOneOrMore(TRequestStatus& aStatus, TEndpointNumber aEndpoint, TDes8& aDes);
+
+	/** Asynchronously read data from endpoint 'aEndpoint' into the descriptor 'aDes'. The request completes
+		when the specified number of bytes is received, or a packet whose size is smaller than the endpoint's
+		maximum packet size is received.
+
+		@param aStatus The request status.
+		@param aEndpoint The endpoint number to read from.
+		@param aDes	Descriptor to receive the data.
+		@param aLen The number of bytes to receive.
+	*/
+	inline void ReadOneOrMore(TRequestStatus& aStatus, TEndpointNumber aEndpoint, TDes8& aDes, TInt aLen);
+
+	/** Cancels an outstanding read request. The request will complete with whatever data is available.
+	*/
+	inline void ReadCancel(TEndpointNumber aEndpoint);
+
+	/** Asynchronously write 'aLen' bytes of data to endpoint 'aEndpoint' from descriptor 'aDes'. 'aZlpRequired'
+		(optional) signals that ZLP termination may be required.
+
+		@param aStatus The request status.
+		@param aEndpoint The endpoint number to write to.
+		@param aDes	Descriptor to provide the data.
+		@param aLen The number of bytes of data to be written.
+		@param aZlpRequired True, if ZLP termination is required; false, otherwise.
+	*/
+	inline void Write(TRequestStatus& aStatus, TEndpointNumber aEndpoint, const TDesC8& aDes, TInt aLen,
+					  TBool aZlpRequired=EFalse);
+
+	/** Cancels an outstanding write request on endpoint aEndpoint.
+
+		@param aEndpoint The endpoint number whose write is to be cancelled.
+	*/
+	inline void WriteCancel(TEndpointNumber aEndpoint);
+
+	/** Cancels any transfer on any endpoint specified in aEndpointMask.
+
+		@code
+		// Cancel transfer requests on endpoints 1, 2 & 3
+		usbPort.EndpointTransferCancel(KUsbcEndpoint1Bit | KUsbcEndpoint2Bit | KUsbcEndpoint3Bit);
+		@endcode
+
+		@param aEndpointMask bitmap of the endpoints.
+	*/
+	inline void EndpointTransferCancel(TUint aEndpointMask);
+
+	/**	Register for notification when a change of the Interface alternate setting or the USB Controller's
+		current state occurs. When the alternate setting or the Controller state changes, then the
+		asynchronous function completes and the current alternate setting number or Controller state is
+		written back to aValue. If the KUsbAlternateSetting bit is set then the remaining bits are the
+		alternate setting number. Otherwise aValue is interpreted as a TUsbcDeviceState.
+
+		@see TUsbcDeviceState
+
+		@param aStatus The request status.
+		@param aValue Receives the alternate setting number or Controller state.
+	*/
+	inline void AlternateDeviceStatusNotify(TRequestStatus& aStatus, TUint& aValue);
+
+	/** Completes an AlternateDeviceStatusNotify request. If a request has previously been made then the
+		status variable is updated with the current device state.
+	*/
+	inline void AlternateDeviceStatusNotifyCancel();
+
+	/** If the channel has changed the grouping of endpoints between interfaces or changed the interface class
+		type from the defaults then it is necessary to force a re-enumeration. This will typically involve the
+		Symbian OS device initiating a disconnection and re-connection. This is an asynchronous operation
+		which will complete when the Controller is successfully configured by the host, i.e. has achieved
+		UsbShai::EUsbPeripheralStateConfigured.  Since it is not known if the operation has failed, at the same time that
+		a ReEnumerate request is made, a timer should be set up to complete after approximately 5 seconds. It
+		can be assumed that if the operation has not completed after this time interval then it will not
+		complete.
+
+		@param aStatus The request status.
+	*/
+	inline void ReEnumerate(TRequestStatus& aStatus);
+
+	/** Cancels an outstanding ReEnumerate() request.
+	*/
+	inline void ReEnumerateCancel();
+
+	/**	Register for notification when a change in stall status of any of the interface's endpoints occurs,
+		but not ep0. When a change in stall status occurs, then the asynchronous function completes and the
+		current stall state is written back to 'aEndpointStatus' as a bit map: Only stall state changes caused
+		by SET_FEATURE and CLEAR_FEATURE standard commands on ep0 will be notified when this function
+		completes. After this request completes the request should be re-issued to obtain future
+		notifications.
+
+		@param aStatus The request status.
+		@param aEndpointMask a bitmap of the endpoints stall status. This is filled in when the call completes
+		bit 1 represents the interface's virtual endpoint 1, (KUsbcEndpoint1Bit)
+		bit 2 represents the interface's virtual endpoint 2, (KUsbcEndpoint2Bit) etc.
+		bit value 0 - not stalled,
+		bit value 1 - stalled.
+	*/
+	inline void EndpointStatusNotify(TRequestStatus& aStatus, TUint& aEndpointMask);
+
+	/** Completes an endpoint status notify request.
+	*/
+ 	inline void EndpointStatusNotifyCancel();
+
+    /** Get current on-the-go features relating to the ability of device/host pair to
+        perform OTG role swap.
+
+        @param aFeatures On return it contanis features the device currently has
+                bit 2 represents b_hnp_enable,       (KUsbOtgAttr_B_HnpEnable)
+                bit 3 represents a_hnp_support,      (KUsbOtgAttr_A_HnpSupport)
+                bit 4 represents a_alt_hnp_support,  (KUsbOtgAttr_A_AltHnpSupport)
+        @return KErrNone if successful, KErrNotSupported if OTG is not supported by
+                this device, otherwise system-wide error returns
+    */
+    inline TInt GetOtgFeatures(TUint8& aFeatures);
+
+    /** Register for notification on USB on-the-go features' change. If any OTG feature
+        is changed, request completes and current feature value is filled in aValue.
+
+        @param aStatus Request status object
+        @param aValue On request completion, it contains current OTG feature value
+    */
+    inline void OtgFeaturesNotify(TRequestStatus& aStatus, TUint8& aValue);
+
+    /** Cancel pending OTG feature request.
+    */
+    inline void OtgFeaturesNotifyCancel();
+
+#endif // #ifndef __KERNEL_MODE__
+	};
+
+
+#include <usb/d32usbc.inl>
+
+
+#endif // __D32USBC_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/public/d32usbc.inl	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,702 @@
+// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// 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:
+// e32/include/d32usbc.inl
+// User side class definitions for USB Device support (inline header).
+// 
+//
+
+/**
+ @file d32usbc.inl
+ @publishedPartner
+ @released
+*/
+
+#ifndef __D32USBC_INL__
+#define __D32USBC_INL__
+
+
+/** @internalTechnology
+*/
+struct TUsbcIfcInfo
+	{
+	TUsbcInterfaceInfoBuf* iInterfaceData;
+	TPtr8* iString;
+	TUint32 iBandwidthPriority;
+	};
+
+
+/** @internalTechnology
+*/
+struct TEndpointTransferInfo
+	{
+	TDesC8* iDes;
+	TTransferType iTransferType;
+	TInt iTransferSize;
+	TBool iZlpReqd;
+	};
+
+inline TUsbcInterfaceInfo::TUsbcInterfaceInfo(TInt aClass, TInt aSubClass,
+											  TInt aProtocol, TDesC16* aString,
+											  TUint aTotalEndpoints)
+	: iClass(aClass, aSubClass, aProtocol), iString(aString),
+	  iTotalEndpointsUsed(aTotalEndpoints), iEndpointData(), iFeatureWord(0)
+	{}
+
+
+#ifndef __KERNEL_MODE__
+
+/** @capability CommDD
+*/
+inline TInt RDevUsbcClient::Open(TInt aUnit)
+	{
+	_LIT(KUsbDevName, "Usbc");
+	return (DoCreate(KUsbDevName, VersionRequired(), aUnit, NULL, NULL, EOwnerThread));
+	}
+
+
+inline TVersion RDevUsbcClient::VersionRequired() const
+	{
+	return (TVersion(EMajorVersionNumber, EMinorVersionNumber, EBuildVersionNumber));
+	}
+
+
+inline TInt RDevUsbcClient::EndpointZeroRequestError()
+	{
+	return DoControl(EControlEndpointZeroRequestError);
+	}
+
+
+inline TInt RDevUsbcClient::EndpointCaps(TDes8& aCapsBuf)
+	{
+	return DoControl(EControlEndpointCaps, &aCapsBuf);
+	}
+
+
+inline TInt RDevUsbcClient::DeviceCaps(TUsbDeviceCaps& aCapsBuf)
+	{
+	return DoControl(EControlDeviceCaps, &aCapsBuf);
+	}
+
+
+inline TInt RDevUsbcClient::GetAlternateSetting(TInt &aInterfaceNumber)
+	{
+	return DoControl(EControlGetAlternateSetting, &aInterfaceNumber);
+	}
+
+
+inline TInt RDevUsbcClient::DeviceStatus(TUsbcDeviceState &aDeviceStatus)
+	{
+	return DoControl(EControlDeviceStatus, &aDeviceStatus);
+	}
+
+
+inline TInt RDevUsbcClient::EndpointStatus(TEndpointNumber aEndpoint,TEndpointState &aEndpointStatus)
+	{
+	return DoControl(EControlEndpointStatus,(TAny*) aEndpoint, &aEndpointStatus);
+	}
+
+
+inline TInt RDevUsbcClient::QueryReceiveBuffer(TEndpointNumber aEndpoint,TInt& aNumberOfBytes)
+	{
+	return DoControl(EControlQueryReceiveBuffer, (TAny*) aEndpoint, &aNumberOfBytes);
+	}
+
+
+inline TInt RDevUsbcClient::SendEp0StatusPacket()
+	{
+	return DoControl(EControlSendEp0StatusPacket);
+	}
+
+
+inline TInt RDevUsbcClient::HaltEndpoint(TEndpointNumber aEndpoint)
+	{
+	return DoControl(EControlHaltEndpoint, (TAny*) aEndpoint);
+	}
+
+
+inline TInt RDevUsbcClient::ClearHaltEndpoint(TEndpointNumber aEndpoint)
+	{
+	return DoControl(EControlClearHaltEndpoint, (TAny*) aEndpoint);
+	}
+
+
+inline TUint RDevUsbcClient::EndpointZeroMaxPacketSizes()
+	{
+	return DoControl(EControlEndpointZeroMaxPacketSizes);
+	}
+
+
+inline TInt RDevUsbcClient::SetEndpointZeroMaxPacketSize(TInt aMaxPacketSize)
+	{
+	return DoControl(EControlSetEndpointZeroMaxPacketSize, (TAny*) aMaxPacketSize);
+	}
+
+
+inline TInt RDevUsbcClient::GetEndpointZeroMaxPacketSize()
+	{
+	return DoControl(EControlGetEndpointZeroMaxPacketSize);
+	}
+
+
+inline TInt RDevUsbcClient::GetDeviceDescriptor(TDes8& aDeviceDescriptor)
+	{
+	return DoControl(EControlGetDeviceDescriptor, &aDeviceDescriptor);
+	}
+
+
+inline TInt RDevUsbcClient::SetDeviceDescriptor(const TDesC8& aDeviceDescriptor)
+	{
+	return DoControl(EControlSetDeviceDescriptor, const_cast<TDesC8*>(&aDeviceDescriptor));
+	}
+
+
+inline TInt RDevUsbcClient::GetDeviceDescriptorSize(TInt& aSize)
+	{
+	TPckgBuf<TInt> p;
+	TInt r = DoControl(EControlGetDeviceDescriptorSize, &p);
+	if (r == KErrNone)
+		aSize = p();
+	return r;
+	}
+
+
+inline TInt RDevUsbcClient::GetConfigurationDescriptor(TDes8& aConfigurationDescriptor)
+	{
+	return DoControl(EControlGetConfigurationDescriptor, &aConfigurationDescriptor);
+	}
+
+
+inline TInt RDevUsbcClient::SetConfigurationDescriptor(const TDesC8& aConfigurationDescriptor)
+	{
+	return DoControl(EControlSetConfigurationDescriptor, const_cast<TDesC8*> (&aConfigurationDescriptor));
+	}
+
+
+inline TInt RDevUsbcClient::GetConfigurationDescriptorSize(TInt& aSize)
+	{
+	TPckgBuf<TInt> p;
+	TInt r=DoControl(EControlGetConfigurationDescriptorSize, &p);
+	if (r == KErrNone)
+		aSize = p();
+	return r;
+	}
+
+
+inline TInt RDevUsbcClient::GetInterfaceDescriptor(TInt aSettingNumber, TDes8& aInterfaceDescriptor)
+	{
+	return DoControl(EControlGetInterfaceDescriptor,(TAny*) aSettingNumber, &aInterfaceDescriptor);
+	}
+
+
+inline TInt RDevUsbcClient::SetInterfaceDescriptor(TInt aSettingNumber, const TDesC8& aInterfaceDescriptor)
+	{
+	return DoControl(EControlSetInterfaceDescriptor,(TAny*) aSettingNumber,
+					 const_cast<TDesC8*>(&aInterfaceDescriptor));
+	}
+
+
+inline TInt RDevUsbcClient::GetInterfaceDescriptorSize(TInt aSettingNumber, TInt& aSize)
+	{
+	TPckgBuf<TInt> p;
+	TInt r = DoControl(EControlGetInterfaceDescriptorSize,(TAny*) aSettingNumber, &p);
+	if (r == KErrNone)
+		aSize = p();
+	return r;
+	}
+
+
+inline TInt RDevUsbcClient::GetEndpointDescriptor(TInt aSettingNumber, TInt aEndpointNumber,
+												  TDes8& aEndpointDescriptor)
+	{
+	TEndpointDescriptorInfo info = {aSettingNumber, aEndpointNumber, &aEndpointDescriptor};
+	return DoControl(EControlGetEndpointDescriptor, &info, NULL);
+	}
+
+
+inline TInt RDevUsbcClient::SetEndpointDescriptor(TInt aSettingNumber, TInt aEndpointNumber,
+												  const TDesC8& aEndpointDescriptor)
+	{
+	TEndpointDescriptorInfo info = {aSettingNumber, aEndpointNumber, const_cast<TDesC8*>(&aEndpointDescriptor)};
+	return DoControl(EControlSetEndpointDescriptor, &info, NULL);
+	}
+
+
+inline TInt RDevUsbcClient::GetEndpointDescriptorSize(TInt aSettingNumber, TInt aEndpointNumber, TInt& aSize)
+	{
+	TPckgBuf<TInt> p;
+	TEndpointDescriptorInfo info = {aSettingNumber, aEndpointNumber, &p};
+	TInt r = DoControl(EControlGetEndpointDescriptorSize, &info, NULL);
+	if (r == KErrNone)
+		aSize = p();
+	return r;
+	}
+
+
+inline void RDevUsbcClient::GetOtgDescriptorSize(TInt& aSize)
+	{
+	aSize = KUsbDescSize_Otg;
+	}
+
+
+inline TInt RDevUsbcClient::GetOtgDescriptor(TDes8& aOtgDesc)
+	{
+	return DoControl(EControlGetOtgDescriptor, (TAny*)&aOtgDesc);
+	}
+
+
+inline TInt RDevUsbcClient::SetOtgDescriptor(const TDesC8& aOtgDesc)
+	{
+	return DoControl(EControlSetOtgDescriptor, (TAny*)&aOtgDesc);
+	}
+
+
+inline TInt RDevUsbcClient::GetDeviceQualifierDescriptor(TDes8& aDescriptor)
+	{
+	return DoControl(EControlGetDeviceQualifierDescriptor, &aDescriptor);
+	}
+
+
+inline TInt RDevUsbcClient::SetDeviceQualifierDescriptor(const TDesC8& aDescriptor)
+	{
+	return DoControl(EControlSetDeviceQualifierDescriptor, const_cast<TDesC8*>(&aDescriptor));
+	}
+
+
+inline TInt RDevUsbcClient::GetOtherSpeedConfigurationDescriptor(TDes8& aDescriptor)
+	{
+	return DoControl(EControlGetOtherSpeedConfigurationDescriptor, &aDescriptor);
+	}
+
+
+inline TInt RDevUsbcClient::SetOtherSpeedConfigurationDescriptor(const TDesC8& aDescriptor)
+	{
+	return DoControl(EControlSetOtherSpeedConfigurationDescriptor, const_cast<TDesC8*> (&aDescriptor));
+	}
+
+
+inline TInt RDevUsbcClient::GetCSInterfaceDescriptorBlock(TInt aSettingNumber, TDes8& aInterfaceDescriptor)
+	{
+	return DoControl(EControlGetCSInterfaceDescriptor,(TAny*) aSettingNumber, &aInterfaceDescriptor);
+	}
+
+
+inline TInt RDevUsbcClient::GetCSInterfaceDescriptorBlockSize(TInt aSettingNumber, TInt& aSize)
+	{
+	TPckgBuf<TInt> p;
+	TInt r = DoControl(EControlGetCSInterfaceDescriptorSize,(TAny*) aSettingNumber, &p);
+	if (r == KErrNone)
+		aSize = p();
+	return r;
+	}
+
+
+inline TInt RDevUsbcClient::GetCSEndpointDescriptorBlock(TInt aSettingNumber, TInt aEndpointNumber,
+														 TDes8& aEndpointDescriptor)
+	{
+	TEndpointDescriptorInfo info={aSettingNumber, aEndpointNumber, &aEndpointDescriptor};
+	return DoControl(EControlGetCSEndpointDescriptor,&info,NULL);
+	}
+
+
+inline TInt RDevUsbcClient::GetCSEndpointDescriptorBlockSize(TInt aSettingNumber, TInt aEndpointNumber,
+															 TInt& aSize)
+	{
+	TPckgBuf<TInt> p;
+	TEndpointDescriptorInfo info = {aSettingNumber, aEndpointNumber, &p};
+	TInt r = DoControl(EControlGetCSEndpointDescriptorSize, &info, NULL);
+	if (r == KErrNone)
+		aSize = p();
+	return r;
+	}
+
+
+inline TInt RDevUsbcClient::SignalRemoteWakeup()
+	{
+	return DoControl(EControlSignalRemoteWakeup);
+	}
+
+
+inline TInt RDevUsbcClient::DeviceDisconnectFromHost()
+	{
+	return DoControl(EControlDeviceDisconnectFromHost);
+	}
+
+
+inline TInt RDevUsbcClient::DeviceConnectToHost()
+	{
+	return DoControl(EControlDeviceConnectToHost);
+	}
+
+
+inline TInt RDevUsbcClient::PowerUpUdc()
+	{
+	return DoControl(EControlDevicePowerUpUdc);
+	}
+
+
+inline TBool RDevUsbcClient::CurrentlyUsingHighSpeed()
+	{
+	return DoControl(EControlCurrentlyUsingHighSpeed);
+	}
+
+
+inline TInt RDevUsbcClient::SetInterface(TInt aInterfaceNumber, TUsbcInterfaceInfoBuf& aInterfaceData,
+										 TUint32 aBandwidthPriority)
+	{
+	TPtr8 name_8(NULL,0);
+	TUsbcIfcInfo ifcinfo;
+	ifcinfo.iInterfaceData = const_cast<TUsbcInterfaceInfoBuf*>(&aInterfaceData);
+	if (!aInterfaceData().iString)
+		{
+		ifcinfo.iString = NULL;
+		}
+	else
+		{
+		name_8.Set(const_cast<TUint8*>(reinterpret_cast<const TUint8*>(aInterfaceData().iString->Ptr())),
+				   aInterfaceData().iString->Size(), aInterfaceData().iString->Size());
+		ifcinfo.iString = &name_8;
+		}
+	ifcinfo.iBandwidthPriority = aBandwidthPriority;
+	return DoControl(EControlSetInterface, (TAny*)aInterfaceNumber, &ifcinfo);
+	}
+
+
+inline TInt RDevUsbcClient::ReleaseInterface(TInt aInterfaceNumber)
+	{
+	return DoControl(EControlReleaseInterface, (TAny*)aInterfaceNumber);
+	}
+
+
+inline TInt RDevUsbcClient::SetCSInterfaceDescriptorBlock(TInt aSettingNumber, const TDesC8& aInterfaceDescriptor)
+	{
+	TCSDescriptorInfo info = {aSettingNumber, 0, const_cast<TDesC8*>(&aInterfaceDescriptor),
+							  aInterfaceDescriptor.Size()};
+	return DoControl(EControlSetCSInterfaceDescriptor, &info, NULL);
+	}
+
+
+inline TInt RDevUsbcClient::SetCSEndpointDescriptorBlock(TInt aSettingNumber, TInt aEndpointNumber,
+														 const TDesC8& aEndpointDescriptor)
+	{
+	TCSDescriptorInfo info = {aSettingNumber, aEndpointNumber, const_cast<TDesC8*>(&aEndpointDescriptor),
+							  aEndpointDescriptor.Size()};
+	return DoControl(EControlSetCSEndpointDescriptor, &info, NULL);
+	}
+
+
+inline TInt RDevUsbcClient::SetDeviceControl()
+	{
+	return DoControl(EControlSetDeviceControl);
+	}
+
+
+inline TInt RDevUsbcClient::ReleaseDeviceControl()
+	{
+	return DoControl(EControlReleaseDeviceControl);
+	}
+
+
+inline TInt RDevUsbcClient::GetStringDescriptorLangId(TUint16& aLangId)
+	{
+	TPckgBuf<TUint16> p;
+	const TInt r = DoControl(EControlGetStringDescriptorLangId, &p);
+	if (r == KErrNone)
+		aLangId = p();
+	return r;
+	}
+
+
+inline TInt RDevUsbcClient::SetStringDescriptorLangId(TUint16 aLangId)
+	{
+	return DoControl(EControlSetStringDescriptorLangId, (TAny*)(TUint)aLangId);
+	}
+
+
+inline TInt RDevUsbcClient::GetManufacturerStringDescriptor(TDes16& aString)
+	{
+	TPtr8 name_8(const_cast<TUint8*>(reinterpret_cast<const TUint8*>(aString.Ptr())), aString.MaxSize());
+	const TInt r = DoControl(EControlGetManufacturerStringDescriptor, &name_8);
+	aString.SetLength(name_8.Size()/2);
+	return r;
+	}
+
+
+inline TInt RDevUsbcClient::SetManufacturerStringDescriptor(const TDesC16& aString)
+	{
+	TPtrC8 name_8(reinterpret_cast<const TUint8*>(aString.Ptr()), aString.Size());
+	return DoControl(EControlSetManufacturerStringDescriptor, &name_8);
+	}
+
+
+inline TInt RDevUsbcClient::RemoveManufacturerStringDescriptor()
+	{
+	return DoControl(EControlRemoveManufacturerStringDescriptor);
+	}
+
+
+inline TInt RDevUsbcClient::GetProductStringDescriptor(TDes16& aString)
+	{
+	TPtr8 name_8(const_cast<TUint8*>(reinterpret_cast<const TUint8*>(aString.Ptr())), aString.MaxSize());
+	const TInt r = DoControl(EControlGetProductStringDescriptor, &name_8);
+	aString.SetLength(name_8.Size()/2);
+	return r;
+	}
+
+
+inline TInt RDevUsbcClient::SetProductStringDescriptor(const TDesC16& aString)
+	{
+	TPtrC8 name_8(reinterpret_cast<const TUint8*>(aString.Ptr()), aString.Size());
+	return DoControl(EControlSetProductStringDescriptor, &name_8);
+	}
+
+
+inline TInt RDevUsbcClient::RemoveProductStringDescriptor()
+	{
+	return DoControl(EControlRemoveProductStringDescriptor);
+	}
+
+
+inline TInt RDevUsbcClient::GetSerialNumberStringDescriptor(TDes16& aString)
+	{
+	TPtr8 name_8(const_cast<TUint8*>(reinterpret_cast<const TUint8*>(aString.Ptr())), aString.MaxSize());
+	const TInt r = DoControl(EControlGetSerialNumberStringDescriptor, &name_8);
+	aString.SetLength(name_8.Size()/2);
+	return r;
+	}
+
+
+inline TInt RDevUsbcClient::SetSerialNumberStringDescriptor(const TDesC16& aString)
+	{
+	TPtrC8 name_8(reinterpret_cast<const TUint8*>(aString.Ptr()), aString.Size());
+	return DoControl(EControlSetSerialNumberStringDescriptor, &name_8);
+	}
+
+
+inline TInt RDevUsbcClient::RemoveSerialNumberStringDescriptor()
+	{
+	return DoControl(EControlRemoveSerialNumberStringDescriptor);
+	}
+
+
+inline TInt RDevUsbcClient::GetConfigurationStringDescriptor(TDes16& aString)
+	{
+	TPtr8 name_8(const_cast<TUint8*>(reinterpret_cast<const TUint8*>(aString.Ptr())), aString.MaxSize());
+	const TInt r = DoControl(EControlGetConfigurationStringDescriptor, &name_8);
+	aString.SetLength(name_8.Size() / 2);
+	return r;
+	}
+
+
+inline TInt RDevUsbcClient::SetConfigurationStringDescriptor(const TDesC16& aString)
+	{
+	TPtrC8 name_8(reinterpret_cast<const TUint8*>(aString.Ptr()), aString.Size());
+	return DoControl(EControlSetConfigurationStringDescriptor, &name_8);
+	}
+
+
+inline TInt RDevUsbcClient::RemoveConfigurationStringDescriptor()
+	{
+	return DoControl(EControlRemoveConfigurationStringDescriptor);
+	}
+
+
+inline TInt RDevUsbcClient::GetStringDescriptor(TUint8 aIndex, TDes16& aString)
+	{
+	TPtr8 name_8(const_cast<TUint8*>(reinterpret_cast<const TUint8*>(aString.Ptr())), aString.MaxSize());
+	const TInt r = DoControl(EControlGetStringDescriptor, (TAny*)(TUint)aIndex, &name_8);
+	aString.SetLength(name_8.Size() / 2);
+	return r;
+	}
+
+
+inline TInt RDevUsbcClient::SetStringDescriptor(TUint8 aIndex, const TDesC16& aString)
+	{
+	TPtrC8 name_8(reinterpret_cast<const TUint8*>(aString.Ptr()), aString.Size());
+	return DoControl(EControlSetStringDescriptor, (TAny*)(TUint)aIndex, &name_8);
+	}
+
+
+inline TInt RDevUsbcClient::RemoveStringDescriptor(TUint8 aIndex)
+	{
+	return DoControl(EControlRemoveStringDescriptor, (TAny*)(TUint)aIndex);
+	}
+
+
+inline TInt RDevUsbcClient::AllocateEndpointResource(TInt aEndpoint, TUsbcEndpointResource aResource)
+	{
+	return DoControl(EControlAllocateEndpointResource, (TAny*)aEndpoint, (TAny*)aResource);
+	}
+
+
+inline TInt RDevUsbcClient::DeAllocateEndpointResource(TInt aEndpoint, TUsbcEndpointResource aResource)
+	{
+	return DoControl(EControlDeAllocateEndpointResource, (TAny*)aEndpoint, (TAny*)aResource);
+	}
+
+
+inline TBool RDevUsbcClient::QueryEndpointResourceUse(TInt aEndpoint, TUsbcEndpointResource aResource)
+	{
+	return DoControl(EControlQueryEndpointResourceUse, (TAny*)aEndpoint, (TAny*)aResource);
+	}
+
+
+inline void RDevUsbcClient::ReadUntilShort(TRequestStatus &aStatus, TEndpointNumber aEndpoint, TDes8 &aDes)
+	{
+	TInt ep = (aEndpoint < 0 || aEndpoint > KMaxEndpointsPerClient) ? KInvalidEndpointNumber : aEndpoint;
+	TEndpointTransferInfo info = {&aDes, ETransferTypeReadUntilShort, aDes.MaxLength()};
+	DoRequest(ep, aStatus, &info, NULL);
+	}
+
+
+inline void RDevUsbcClient::ReadUntilShort(TRequestStatus &aStatus, TEndpointNumber aEndpoint, TDes8 &aDes,
+										   TInt aLen)
+	{
+	TInt ep = (aEndpoint < 0 || aEndpoint > KMaxEndpointsPerClient) ? KInvalidEndpointNumber : aEndpoint;
+	TEndpointTransferInfo info = {&aDes, ETransferTypeReadUntilShort, aLen};
+	DoRequest(ep, aStatus, &info, NULL);
+	}
+
+
+inline void RDevUsbcClient::ReadOneOrMore(TRequestStatus &aStatus, TEndpointNumber aEndpoint, TDes8 &aDes)
+	{
+	TInt ep = (aEndpoint < 0 || aEndpoint > KMaxEndpointsPerClient) ? KInvalidEndpointNumber : aEndpoint;
+	TEndpointTransferInfo info = {&aDes, ETransferTypeReadOneOrMore, aDes.MaxLength()};
+	DoRequest(ep, aStatus, &info, NULL);
+	}
+
+
+inline void RDevUsbcClient::ReadOneOrMore(TRequestStatus &aStatus, TEndpointNumber aEndpoint, TDes8 &aDes,
+										  TInt aLen)
+	{
+	TInt ep = (aEndpoint < 0 || aEndpoint > KMaxEndpointsPerClient) ? KInvalidEndpointNumber : aEndpoint;
+	TEndpointTransferInfo info = {&aDes, ETransferTypeReadOneOrMore, aLen};
+	DoRequest(ep, aStatus, &info, NULL);
+	}
+
+
+inline void RDevUsbcClient::Read(TRequestStatus &aStatus, TEndpointNumber aEndpoint, TDes8 &aDes)
+	{
+	TInt ep = (aEndpoint < 0 || aEndpoint > KMaxEndpointsPerClient) ? KInvalidEndpointNumber : aEndpoint;
+	TEndpointTransferInfo info = {&aDes, ETransferTypeReadData, aDes.MaxLength()};
+	DoRequest(ep, aStatus, &info, NULL);
+	}
+
+
+inline void RDevUsbcClient::Read(TRequestStatus &aStatus, TEndpointNumber aEndpoint, TDes8 &aDes, TInt aLen)
+	{
+	TInt ep = (aEndpoint < 0 || aEndpoint > KMaxEndpointsPerClient) ? KInvalidEndpointNumber : aEndpoint;
+	TEndpointTransferInfo info = {&aDes, ETransferTypeReadData, aLen};
+	DoRequest(ep, aStatus, &info, NULL);
+	}
+
+
+inline void RDevUsbcClient::ReadPacket(TRequestStatus &aStatus, TEndpointNumber aEndpoint, TDes8 &aDes,
+									   TInt aMaxLen)
+	{
+	TInt ep = (aEndpoint < 0 || aEndpoint > KMaxEndpointsPerClient) ? KInvalidEndpointNumber : aEndpoint;
+	TEndpointTransferInfo info = {&aDes, ETransferTypeReadPacket, aMaxLen};
+	DoRequest(ep, aStatus, &info, NULL);
+	}
+
+
+inline void RDevUsbcClient::Write(TRequestStatus &aStatus, TEndpointNumber aEndpoint, const TDesC8& aDes,
+								  TInt aLen, TBool aZlpRequired)
+	{
+	TInt ep = (aEndpoint < 0 || aEndpoint > KMaxEndpointsPerClient) ? KInvalidEndpointNumber : aEndpoint;
+	TEndpointTransferInfo info = {const_cast<TDesC8*>(&aDes), ETransferTypeWrite, aLen, aZlpRequired};
+	DoRequest(ep, aStatus, &info, NULL);
+	}
+
+
+inline void RDevUsbcClient::AlternateDeviceStatusNotify(TRequestStatus& aStatus, TUint& aValue)
+	{
+	DoRequest(ERequestAlternateDeviceStatusNotify, aStatus, &aValue);
+	}
+
+
+inline void RDevUsbcClient::ReEnumerate(TRequestStatus& aStatus)
+	{
+	DoRequest(ERequestReEnumerate, aStatus);
+	}
+
+
+inline void RDevUsbcClient::EndpointStatusNotify(TRequestStatus& aStatus, TUint& aEndpointMask)
+	{
+	DoRequest(ERequestEndpointStatusNotify, aStatus, &aEndpointMask);
+	}
+
+
+inline void RDevUsbcClient::ReadCancel(TEndpointNumber aEndpoint)
+	{
+	if (aEndpoint < 0 || aEndpoint > KMaxEndpointsPerClient)
+		return;
+	DoCancel(1 << aEndpoint);
+	}
+
+
+inline void RDevUsbcClient::WriteCancel(TEndpointNumber aEndpoint)
+	{
+	ReadCancel(aEndpoint);
+	}
+
+
+inline void RDevUsbcClient::EndpointTransferCancel(TUint aEndpointMask)
+	{
+	/* Mask off non-endpoint cancels */
+	DoCancel(aEndpointMask & ERequestAllCancel);
+	}
+
+
+inline void RDevUsbcClient::AlternateDeviceStatusNotifyCancel()
+	{
+	DoCancel(ERequestAlternateDeviceStatusNotifyCancel);
+	}
+
+
+inline void RDevUsbcClient::ReEnumerateCancel()
+	{
+	DoCancel(ERequestReEnumerateCancel);
+	}
+
+
+inline void RDevUsbcClient::EndpointStatusNotifyCancel()
+	{
+	DoCancel(ERequestEndpointStatusNotifyCancel);
+	}
+
+inline TInt RDevUsbcClient::GetOtgFeatures(TUint8& aFeatures)
+	{
+	TPckgBuf<TUint8> p;
+	TInt r = DoControl(EControlGetOtgFeatures, &p);
+	if (r == KErrNone)
+		aFeatures = p();
+	return r;
+	}
+
+
+inline void RDevUsbcClient::OtgFeaturesNotify(TRequestStatus& aStatus, TUint8& aValue)
+	{
+	DoRequest(ERequestOtgFeaturesNotify, aStatus, &aValue);
+	}
+
+
+inline void RDevUsbcClient::OtgFeaturesNotifyCancel()
+	{
+	DoCancel(ERequestOtgFeaturesNotifyCancel);
+	}
+
+
+#endif // #ifndef __KERNEL_MODE__
+
+#endif // #ifndef __D32USBC_INL__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/public/d32usbcsc.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,1558 @@
+// 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 the License "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:
+// e32\include\d32usbcsc.h
+// User side class definitions for USB Device support.
+// 
+//
+
+/**
+ @file d32usbcsc.h
+ @publishedPartner
+ @released
+*/
+
+#ifndef __D32USBCSC_H__
+#define __D32USBCSC_H__
+
+#include <e32ver.h>
+#include <usb/usb.h>
+#include <usb/d32usbcshared.h>
+
+
+/** This means that SetInterface was called after RealizeInterface had been called.
+    RealizeInterface is meant to signal that all interfaces have been set.
+*/
+const TInt KErrUsbAlreadyRealized = -6813; //Changed from -6713 for future compatibility with the d32usbcshared.h file
+
+const TInt KErrAlternateSettingChanged = -6814;
+
+
+const TUint KChunkCellSize = 1; //1 32 bit integer
+const TInt KEpDescPacketSizeOffset = 4;
+
+/** The user side enpoint number of Endpoint Zero. */
+const TInt KEp0Number = 0;
+
+/* Used in TUsbcScHdrEndpointRecord to describe the endpoint type
+*/
+
+const TUint8 KUsbScHdrEpDirectionIn=1;
+const TUint8 KUsbScHdrEpDirectionOut=2;
+const TUint8 KUsbScHdrEpDirectionBiDir=3;
+
+
+const TUint8 KUsbScHdrEpTypeControl = 0;
+const TUint8 KUsbScHdrEpTypeIsochronous =1;
+const TUint8 KUsbScHdrEpTypeBulk = 2;
+const TUint8 KUsbScHdrEpTypeInterrupt = 3;
+const TUint8 KUsbScHdrEpTypeUnknown = ~0;
+/** Used in the the Shared Chunk Header, to represent an endpoint.
+*/
+class TUsbcScHdrEndpointRecord
+    {
+public:
+    inline TUsbcScHdrEndpointRecord(TInt aBufferNo, TUint8 aType);
+    inline TUint Direction() const;
+    inline TUint Type() const;
+public:
+    TUint8 iBufferNo;
+    TUint8 iType;
+    TUint16 iReserved;
+    };
+
+
+// This is used to hold the geometry of the shared buffers
+class TUsbcScBufferRecord
+    {
+    friend class DLddUsbcScChannel;
+
+public:
+    inline TUint Offset() const;
+    inline TUint Size() const;
+private:
+    inline void Set(TUint aOffset, TUint aEndOffset);
+    TUint iOffset;
+    TUint iSize;
+    };
+
+struct SUsbcScBufferHeader
+    {
+    TInt iHead;        // Where the LDD will next write a transfer
+    TInt iTail;        // Indicates the fist packet that user side is processing (anything prior is disposable)
+    TInt iBilTail;  // This is not used by LDD at all, but just for the BIL's benifit.
+    };
+
+
+struct SUsbcScAlternateSetting
+    {
+    TUint16 iSetting;
+    TUint16 iSequence;
+    };
+
+/** Endpoint pair information.  This can be used to control pairing of endpoint
+for classes that require explicit pairing of endpoint, such as ADC.
+
+This is currently not used.
+*/
+
+class TEndpointPairInfo
+{
+public:
+    TEndpointPairInfo(TUint8 aType=0, TUint16 aPair=0, TUint8 aSpare=0);
+public:
+    TUint8 iType;
+    TUint8 iSpare;
+    TUint16 iPair;
+}; 
+
+/**
+This is the buffer number reserved for use with endpoint zero with the  ReadDataNotify and WriteData methods.
+*/
+const TInt KUsbcScEndpointZero = -1;
+
+/**
+This flag is reserved in TUsbcscEndpointInfo::iFlags, to indicate that the client driver's client wishes reads to operate in a coupled fashion.
+This behaviour is not currently supported.
+*/
+const TUint KUsbScCoupledRead = 0x1;
+
+/**
+This flag, used in parameter aFlag of WriteData, is used to indicate that a ZLP should be sent.
+*/
+const TUint KUsbcScWriteFlagsZlp = 0x0001;
+
+
+// Bit fields used in iFlags of TUsbcScTransferHeader
+
+const TUint KUsbcScShortPacket = 0x0001;
+const TUint KUsbcScStateChange = 0x0004;
+
+class TUsbcScTransferHeader
+{
+public:
+#ifdef _DEBUG
+    TUint iHashId;
+    TUint iSequence;
+#endif
+    TUint iBytes;
+    TUint iFlags;
+    TUint iNext;
+    TUint16 iAltSettingSeq;
+    TInt16 iAltSetting;
+    union
+    {
+        TUint  i[1]; // Extends
+        TUint8 b[4]; // Extends
+    } iData;
+};
+
+/** The desired endpoint capabilities used in RDevUsbcScClient::SetInterface().
+
+This derived class has additional fields used in the shared chunk USB driver.
+*/
+class TUsbcScEndpointInfo: public TUsbcEndpointInfo
+    {
+public:
+    TUsbcScEndpointInfo(TUint aType=UsbShai::KUsbEpTypeBulk, TUint aDir=UsbShai::KUsbEpDirOut, TInt aInterval=0, TInt aExtra=0,
+                                                TUint aBufferSize=0, TUint aReadSize=0);
+
+
+public:
+    /** This indicates the requested size of the endpoint buffer and must be at
+        least as large as iReadSize.
+    */
+    TUint iBufferSize;
+
+    /** This is the amount of data that the LDD reads from the bus before it sets
+        up another read and is normally intended to read many packets.
+    */
+    TUint iReadSize;
+
+    /** TEndpointPairInfo represents pairing information for isochronous endpoints.
+        Should be zero in other cases.  If this specifies paired endpoints then
+        iExtra (in the base class TUsbcEndpointInfo) also needs to be set to the
+        class specific size for this endpoint descriptor (This is here only for future use).
+    */
+    TEndpointPairInfo iPairing;
+    
+    /** The necessary alignment, in bytes, that needs to be applied to the transfer start points
+        of the data.  This is only observed on OUT endpoints.  Zero can be specified to indicate
+        there are no class side requirements for alignment.   The alignment for OUT endpoints is
+        which ever is greater of this field or the USB hardware requirements.
+    */
+    TUint iAlignment;
+
+    /** Flags to indicate how the endpoint should function. None currently defined,
+        but could be used to allow support for direct read.
+    */
+    TUint iFlags;
+    
+    /** Reserved for future use. */
+    TUint32 iReserved2[2];
+    };
+
+/** This must be filled in prior to a call to RDevUsbcClient::SetInterface().
+*/
+class TUsbcScInterfaceInfo
+    {
+public:
+    TUsbcScInterfaceInfo(TInt aClass=0, TInt aSubClass=0, TInt aProtocol=0,
+                       TDesC16* aString=NULL, TUint aTotalEndpoints=0);
+public:
+    /** The class, subclass and protocol that this interface supports. */
+    TUsbcClassInfo iClass;
+    /** The description string for the interface. Used to construct the interface string descriptor. */
+    const TDesC16* iString;
+    /** Total number of endpoints being requested (0-5). Endpoint 0 should not be included in this number. */
+    TUint iTotalEndpointsUsed;
+    /** Desired properties of the endpoints requested.
+        Do NOT include endpoint 0.
+        APIs use endpoint numbers that are offsets into this array.
+    */
+    TUsbcScEndpointInfo iEndpointData[KMaxEndpointsPerClient];
+    /** 32 flag bits used for specifying miscellaneous Interface features.
+        Currently defined are:
+        - KUsbcInterfaceInfo_NoEp0RequestsPlease = 0x00000001
+    */
+    TUint32 iFeatureWord;
+    };
+
+/** Package buffer for a TUsbcInterfaceInfo object.
+
+    @see TUsbcInterfaceInfo
+*/
+typedef TPckgBuf<TUsbcScInterfaceInfo> TUsbcScInterfaceInfoBuf;
+
+struct TUsbcScChunkHdrOffs
+    {
+    TUint iBuffers;
+    TUint iAltSettings;
+    };
+
+
+class TUsbcScChunkBuffersHeader  // Not instantiable
+    {
+    friend class DLddUsbcScChannel;
+    friend class TRealizeInfo;
+
+public:
+    inline TUsbcScBufferRecord* Ep0Out() const;
+    inline TUsbcScBufferRecord* Ep0In() const;
+    inline TUsbcScBufferRecord* Buffers(TInt aBuffer) const;
+    inline TInt NumberOfBuffers() const;
+
+private:
+    TUsbcScChunkBuffersHeader();
+private:
+    TInt iRecordSize;
+    TInt  iNumOfBufs;
+    TUint8 iBufferOffset[8]; // Extends
+    };
+
+struct TUsbcScChunkAltSettingHeader // Not instantiable
+    {
+    TInt iEpRecordSize;
+    TInt iNumOfAltSettings;
+    TUint iAltTableOffset[1]; // Extends
+    };
+
+class TEndpointBuffer;
+
+
+/** The user side handle to the USB client driver.
+*/
+class RDevUsbcScClient : public RBusLogicalChannel
+    {
+public:
+    /** @internalComponent */
+    enum TVer
+        {
+        EMajorVersionNumber = 0,
+        EMinorVersionNumber = 1,
+        EBuildVersionNumber = KE32BuildVersionNumber
+        };
+
+// Bit pattern. s = Request/Control.  c = Cancel,  m = mode bits, B = Buffer number, R = request number.
+//    scmm mmmm |  mmmm mmmm | mmBB BBBB |RRRR RRRR  
+
+    enum TRequest
+        {
+        ERequestWriteData = 1,
+        ERequestReadDataNotify = 2,     
+        ERequestAlternateDeviceStatusNotify = 3,
+        ERequestReEnumerate = 4,
+        ERequestEndpointStatusNotify = 5,
+         ERequestOtgFeaturesNotify = 6,
+        ERequestMaxRequests, // 7
+
+        ERequestCancel = 0x40000000,
+
+        ERequestWriteDataCancel                        = ERequestWriteData                   | ERequestCancel,
+        ERequestReadDataNotifyCancel                = ERequestReadDataNotify              | ERequestCancel,
+        ERequestAlternateDeviceStatusNotifyCancel     = ERequestAlternateDeviceStatusNotify | ERequestCancel,
+        ERequestReEnumerateCancel                     = ERequestReEnumerate                 | ERequestCancel,
+        ERequestEndpointStatusNotifyCancel             = ERequestEndpointStatusNotify        | ERequestCancel,
+        ERequestOtgFeaturesNotifyCancel             = ERequestOtgFeaturesNotify           | ERequestCancel
+        };
+
+    enum TControl
+        {
+        // Changing the order of these enums will break BC.
+        EControlEndpointZeroRequestError,                    // 00
+        EControlEndpointCaps,
+        EControlDeviceCaps,
+        EControlGetAlternateSetting,
+        EControlDeviceStatus,
+        EControlEndpointStatus,
+        EControlSetInterface,
+        EControlReleaseInterface,
+        EControlSendEp0StatusPacket,
+        EControlHaltEndpoint,                                // 09
+        //
+        EControlClearHaltEndpoint,                            // 10
+        EControlSetDeviceControl,
+        EControlReleaseDeviceControl,
+        EControlEndpointZeroMaxPacketSizes,
+        EControlSetEndpointZeroMaxPacketSize,
+        EControlGetDeviceDescriptor,
+        EControlSetDeviceDescriptor,
+        EControlGetDeviceDescriptorSize,
+        EControlGetConfigurationDescriptor,
+        EControlSetConfigurationDescriptor,                    // 19
+        //
+        EControlGetConfigurationDescriptorSize,                // 20
+        EControlGetInterfaceDescriptor,
+        EControlSetInterfaceDescriptor,
+        EControlGetInterfaceDescriptorSize,
+        EControlGetEndpointDescriptor,
+        EControlSetEndpointDescriptor,
+        EControlGetEndpointDescriptorSize,
+        EControlGetCSInterfaceDescriptor,
+        EControlSetCSInterfaceDescriptor,
+        EControlGetCSInterfaceDescriptorSize,                // 29
+        //
+        EControlGetCSEndpointDescriptor,                    // 30
+        EControlSetCSEndpointDescriptor,
+        EControlGetCSEndpointDescriptorSize,
+        EControlSignalRemoteWakeup,
+        EControlGetStringDescriptorLangId,
+        EControlSetStringDescriptorLangId,
+        EControlGetManufacturerStringDescriptor,
+        EControlSetManufacturerStringDescriptor,
+        EControlRemoveManufacturerStringDescriptor,
+        EControlGetProductStringDescriptor,                    // 39
+        //
+        EControlSetProductStringDescriptor,                    // 40
+        EControlRemoveProductStringDescriptor,
+        EControlGetSerialNumberStringDescriptor,
+        EControlSetSerialNumberStringDescriptor,
+        EControlRemoveSerialNumberStringDescriptor,
+        EControlGetConfigurationStringDescriptor,
+        EControlSetConfigurationStringDescriptor,
+        EControlRemoveConfigurationStringDescriptor,
+        EControlDeviceDisconnectFromHost,
+        EControlDeviceConnectToHost,                        // 49
+        //
+        EControlDevicePowerUpUdc,                            // 50
+        EControlDumpRegisters,
+        EControlAllocateEndpointResource,
+        EControlDeAllocateEndpointResource,
+        EControlQueryEndpointResourceUse,
+        EControlGetEndpointZeroMaxPacketSize,
+        EControlGetDeviceQualifierDescriptor,
+        EControlSetDeviceQualifierDescriptor,
+        EControlGetOtherSpeedConfigurationDescriptor,
+        EControlSetOtherSpeedConfigurationDescriptor,        // 59
+        //
+        EControlCurrentlyUsingHighSpeed,                    // 60
+        EControlSetStringDescriptor,
+        EControlGetStringDescriptor,
+        EControlRemoveStringDescriptor,
+        EControlSetOtgDescriptor,
+        EControlGetOtgDescriptor,
+        EControlGetOtgFeatures, 
+        EControlRealizeInterface,
+        EControlStartNextInAlternateSetting    
+        };
+
+
+ // const static TUint KFieldIdPos     = 0;
+    const static TUint KFieldIdMask    = 0xFF;
+    const static TUint KFieldBuffPos   = 8;
+    const static TUint KFieldBuffMask  = 0x3F;
+    const static TUint KFieldFlagsPos  = 14;
+    const static TUint KFieldFlagsMask = 0xFFFF;
+
+
+public:
+
+#ifndef __KERNEL_MODE__
+
+    /** Opens a channel.
+
+        @param aUnit This should be 0 (zero).
+
+        @return KErrNone if successful.
+    */
+    inline TInt Open(TInt aUnit);
+
+    inline TVersion VersionRequired() const;
+
+    /** Stalls ep0 to signal command fault to the host.
+
+        @return KErrNone if successful.
+    */
+    inline TInt EndpointZeroRequestError();
+
+    /** Retrieves the capabilities of all the endpoints on the device.
+
+        Suggested use is as follows:
+
+        @code
+        TUsbcEndpointData data[KUsbcMaxEndpoints];
+        TPtr8 dataPtr(reinterpret_cast<TUint8*>(data), sizeof(data), sizeof(data));
+        ret = usbPort.EndpointCaps(dataPtr);
+        @endcode
+
+        @param aEpCapsBuf A descriptor encapsulating an array of TUsbcEndpointData.
+
+        @return KErrNone if successful.
+    */
+    inline TInt EndpointCaps(TDes8& aEpCapsBuf);
+
+    /** Retrieves the capabilities of the USB device.
+
+        @see TUsbDeviceCaps
+
+        @param aDevCapsBuf A TUsbDeviceCaps object.
+
+        @return KErrNone if successful.
+    */
+    inline TInt DeviceCaps(TUsbDeviceCaps& aDevCapsBuf);
+
+    /** Copies the current alternate setting for this interface into aInterfaceNumber
+        For USB Interfaces whose main interface is active, this will be 0 (zero).
+
+        @param aInterfaceNumber Current alternate setting for this interface is copied into this.
+
+        @return KErrNone if successful.
+    */
+    inline TInt GetAlternateSetting(TInt& aInterfaceNumber);
+
+    /** Copies the current device status into aDeviceStatus.
+
+        @param aDeviceStatus Current device status is copied into this.
+
+        @return KErrNone if successful
+    */
+    inline TInt DeviceStatus(TUsbcDeviceState& aDeviceStatus);
+
+    /** Copies the current endpoint status into aEndpointStatus.
+
+        @param aEndpoint Endpoint number valid for the current alternate setting.
+        @param aEndpointStatus The current endpoint status, might be stalled, not stalled or unknown.
+
+        @return KErrNone if successful.
+    */
+    inline TInt EndpointStatus(TInt aEndpoint, TEndpointState& aEndpointStatus);
+
+
+    /** Requests that a zero length status packet be sent to the host in response
+        to a class or vendor specific ep0 SETUP packet.
+
+        @return KErrNone if successful.
+    */
+    inline TInt SendEp0StatusPacket();
+
+    /** Stalls endpoint aEndpoint, usually to indicate an error condition with a previous command.
+        The host will normally send a SET_FEATURE command on ep0 to acknowledge and clear the stall.
+
+        @return KErrNone if successful.
+    */
+    inline TInt HaltEndpoint(TInt aEndpoint);
+
+    /** Clears the stall condition on endpoint aEndpoint. This is inluded for symmetry and test purposes.
+
+        @return KErrNone if successful.
+    */
+    inline TInt ClearHaltEndpoint(TInt aEndpoint);
+
+    /** Requests that device control be allocated to this channel.
+
+        @return KErrNone if successful.
+    */
+    inline TInt SetDeviceControl();
+
+    /** Relinquishes device control previously allocated to this channel.
+
+        @return KErrNone if successful.
+    */
+    inline TInt ReleaseDeviceControl();
+
+    /** Returns a bitmap of available ep0 maximum packet sizes.
+
+        @return bitmap of available ep0 maximum packet sizes.
+    */
+    inline TUint EndpointZeroMaxPacketSizes();
+
+    /** Requests that a maximum packet size of aMaxPacketSize be set on ep0.
+
+        @param aMaxPacketSize The maximum packet size.
+
+        @return KErrNone if successful.
+    */
+    inline TInt SetEndpointZeroMaxPacketSize(TInt aMaxPacketSize);
+
+    /** Queries the current maximum packet size on ep0.
+
+        @return The currently set maximum packet size on ep0.
+    */
+    inline TInt GetEndpointZeroMaxPacketSize();
+
+    /** Copies the current device descriptor into aDeviceDescriptor.
+
+        @param aDeviceDescriptor Receives the current device descriptor.
+
+        @return KErrNone if successful.
+    */
+    inline TInt GetDeviceDescriptor(TDes8& aDeviceDescriptor);
+
+    /** Sets the contents of aDeviceDescriptor to be the current device descriptor.
+
+        @param aDeviceDescriptor Contains the device descriptor.
+
+        @return KErrNone if successful.
+    */
+    inline TInt SetDeviceDescriptor(const TDesC8& aDeviceDescriptor);
+
+    /** Gets the size of the current device descriptor. This is unlikely to be anything other than 9.
+
+        @param aSize Receives the size of the current device descriptor.
+
+        @return KErrNone if successful.
+    */
+    inline TInt GetDeviceDescriptorSize(TInt& aSize);
+
+    /** Copies the current configuration descriptor into aConfigurationDescriptor.
+
+        @param aConfigurationDescriptor Receives the current configuration descriptor.
+
+        @return KErrNone if successful.
+    */
+    inline TInt GetConfigurationDescriptor(TDes8& aConfigurationDescriptor);
+
+    /** Sets the contents of aConfigurationDescriptor to be the current configuration descriptor.
+
+        @param aConfigurationDescriptor Contains the configuration descriptor.
+
+        @return KErrNone if successful.
+    */
+    inline TInt SetConfigurationDescriptor(const TDesC8& aConfigurationDescriptor);
+
+    /** Gets the size of the current configuration descriptor.
+
+        @param aSize Receives the size of the current configuration descriptor.
+
+        @return KErrNone if successful.
+    */
+    inline TInt GetConfigurationDescriptorSize(TInt& aSize);
+
+    /** Copies the interface descriptor into aInterfaceDescriptor for the interface with alternate
+        setting aSettingNumber, 0 for the main interface.
+
+        @param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
+        @param aInterfaceDescriptor Receives the interface descriptor.
+
+        @return KErrNone if successful.
+    */
+    inline TInt GetInterfaceDescriptor(TInt aSettingNumber, TDes8& aInterfaceDescriptor);
+
+    /** Sets the interface descriptor contained in aInterfaceDescriptor for the interface with
+        alternate setting aSettingNumber, 0 for the main interface, for transmission to the host
+        during enumeration.
+
+        @param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
+        @param aInterfaceDescriptor Contains the interface descriptor to be set.
+
+        @return KErrNone if successful.
+    */
+    inline TInt SetInterfaceDescriptor(TInt aSettingNumber, const TDesC8& aInterfaceDescriptor);
+
+    /** Copies the size of the interface descriptor for the interface with alternate
+        setting aSettingNumber, 0 for the main interface, into aSize.
+
+        @param aSettingNumber The alternate setting.
+        @param aSize receives the size of the interface descriptor.
+
+        @return KErrNone if successful.
+    */
+    inline TInt GetInterfaceDescriptorSize(TInt aSettingNumber, TInt& aSize);
+
+    /** Copies the endpoint descriptor for logical endpoint number aEndpointNumber into aEndpointDescriptor
+        for the interface with alternate setting aSettingNumber, 0 for the main interface.
+
+        @param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
+        @param aEndpointNumber The endpoint number of the endpoint.
+        @param aEndpointDescriptor Receives the endpoint descriptor.
+
+        @return KErrNone if successful.
+    */
+    inline TInt GetEndpointDescriptor(TInt aSettingNumber, TInt aEndpointNumber, TDes8& aEndpointDescriptor);
+
+    /** Sets the endpoint descriptor for logical endpoint number aEndpointNumber contained in
+        aEndpointDescriptor for the interface with alternate setting aSettingNumber, 0 for the main interface,
+        for transmission to the host during enumeration.
+
+        @param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
+        @param aEndpointNumber Valid endpoint number on this interface.
+        @param aEndpointDescriptor Contains the endpoint descriptor to be set.
+
+        @return KErrNone if successful.
+    */
+    inline TInt SetEndpointDescriptor(TInt aSettingNumber, TInt aEndpointNumber,
+                                      const TDesC8& aEndpointDescriptor);
+
+    /** Copies the size of the endpoint descriptor for logical endpoint number aEndpointNumber for the
+        interface with alternate setting aSettingNumber, 0 for the main interface, into aSize.
+
+        @param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
+        @param aEndpointNumber Valid endpoint number on this interface.
+        @param aSize Receives the size of the endpoint descriptor.
+
+        @return KErrNone if successful.
+    */
+    inline TInt GetEndpointDescriptorSize(TInt aSettingNumber, TInt aEndpointNumber, TInt& aSize);
+
+    /** Get OTG descriptor size
+
+        @param aSize TInt Reference which contains OTG descriptor size on return.
+    */
+    inline void GetOtgDescriptorSize(TInt& aSize);
+
+    /** Get OTG descriptor of USB on-the-go feature.
+
+        @param aOtgDesc User-side buffer to store copy of descriptor.
+
+        @return KErrNone if successful.
+    */
+    inline TInt GetOtgDescriptor(TDes8& aOtgDesc);
+
+    /** Set OTG descriptor by user to enable/disable USB on-the-go feature.
+
+        @param aOtgDesc Descriptor buffer containing OTG features.
+
+        @return KErrNone if successful.
+    */
+    inline TInt SetOtgDescriptor(const TDesC8& aOtgDesc);
+
+    /** Copies the current device_qualifier descriptor into aDescriptor.
+
+        @param aDescriptor Receives the current device_qualifier descriptor.
+
+        @return KErrNone if successful.
+    */
+    inline TInt GetDeviceQualifierDescriptor(TDes8& aDescriptor);
+
+    /** Sets the device_qualifier descriptor to the contents of aDescriptor.
+
+        @param aDescriptor Contains the new device_qualifier descriptor.
+
+        @return KErrNone if successful.
+    */
+    inline TInt SetDeviceQualifierDescriptor(const TDesC8& aDescriptor);
+
+    /** Copies the current other_speed_configuration descriptor into aDescriptor.
+
+        @param aDescriptor Receives the current other_speed_configuration descriptor.
+
+        @return KErrNone if successful.
+    */
+    inline TInt GetOtherSpeedConfigurationDescriptor(TDes8& aDescriptor);
+
+    /** Sets the other_speed_configuration descriptor to the contents of aDescriptor.
+
+        @param aDescriptor Contains the new other_speed_configuration descriptor.
+
+        @return KErrNone if successful.
+    */
+    inline TInt SetOtherSpeedConfigurationDescriptor(const TDesC8& aDescriptor);
+
+    /** Copies the class specific interface descriptor block into aInterfaceDescriptor for the interface
+        with alternate setting aSettingNumber, 0 for the main interface.
+
+        @param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
+        @param aInterfaceDescriptor Contains the interface descriptor to be set.
+
+        @return KErrNone if successful.
+    */
+    inline TInt GetCSInterfaceDescriptorBlock(TInt aSettingNumber, TDes8& aInterfaceDescriptor);
+
+    /** aSettingNumber is the alternate interface setting, 0 for the main interface, that the descriptor block
+        aDes should be attached to. aDes is a block of data containing at least one class specific descriptor
+        for transmission during enumeration after the class interface descriptor (or alternate interface
+        descriptor) has been sent, but before the endpoint descriptors belonging to this interface are sent.
+        aDes may contain as many descriptors as are necessary or only one. SetCSInterfaceDescriptorBlock()
+        should be called at any time after SetInterface() has been called to establish a main interface or an
+        alternate interface. More than one call may be made - the data blocks will be concatenated prior to
+        sending. No checking or validation of the contents of aDes will be made and it is the caller's
+        responsibility to ensure that the data supplied is correct and appropriate to the interface identified
+        by aSettingNumber.
+
+        @param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
+        @param aInterfaceDescriptor Contains the interface descriptor to be set.
+
+        @return KErrNone if successful.
+    */
+    inline TInt SetCSInterfaceDescriptorBlock(TInt aSettingNumber, const TDesC8& aInterfaceDescriptor);
+
+    /** Copies the size of the class specific interface descriptor block for the interface with alternate
+        setting aSettingNumber, 0 for the main interface, into aSize.
+
+        @param aSettingNumber The alternate setting number.
+        @param aSize receives the size of the interface descriptor.
+
+        @return KErrNone if successful.
+    */
+    inline TInt GetCSInterfaceDescriptorBlockSize(TInt aSettingNumber, TInt& aSize);
+
+    /** Copies the class specific endpoint descriptor for logical endpoint number aEndpointNumber
+        into aEndpointDescriptor for the interface with alternate setting aSettingNumber, 0 for the main
+        interface.
+
+        @param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
+        @param aEndpointNumber Valid endpoint number on this interface.
+        @param aEndpointDescriptor Receives the endpoint descriptor.
+
+        @return KErrNone if successful.
+    */
+    inline TInt GetCSEndpointDescriptorBlock(TInt aSettingNumber, TInt aEndpointNumber,
+                                             TDes8& aEndpointDescriptor);
+
+    /** Sets the class specific endpoint descriptor for logical endpoint number aEndpointNumber contained in
+        aEndpointDescriptor for the interface with alternate setting aSettingNumber, 0 for the main interface,
+        for transmission to the host during enumeration.
+
+        @param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
+        @param aEndpointNumber Valid endpoint number on this interface.
+        @param aEndpointDescriptor Contains the endpoint descriptor to be set.
+
+        @return KErrNone if successful.
+    */
+    inline TInt SetCSEndpointDescriptorBlock(TInt aSettingNumber, TInt aEndpointNumber,
+                                             const TDesC8& aEndpointDescriptor);
+
+    /** Copies the size of the class specific endpoint descriptor block for logical endpoint number
+        aEndpointNumber for the interface with alternate setting aSettingNumber, 0 for the main interface,
+        into aSize.
+
+        @param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
+        @param aEndpointNumber Valid endpoint number on this interface.
+        @param aSize On return, contains the size of the class specific endpoint descriptor block.
+
+        @return KErrNone if successful.
+    */
+    inline TInt GetCSEndpointDescriptorBlockSize(TInt aSettingNumber, TInt aEndpointNumber, TInt& aSize);
+
+    /** Generates a Remote Wakeup bus condition.
+        The capability of the device to generate Remote Wakeup signalling is enquired in
+        RDevUsbcClient::DeviceCaps.
+
+        @return KErrNone if this signalling is possible and the signal has been generated.
+    */
+    inline TInt SignalRemoteWakeup();
+
+    /** Simulates a physical removal of the USB cable by disabling the D+/- pull-ups.The iConnect member of
+        TUsbDeviceCapsV01, returned by RDevUsbcClient::DeviceCaps(), indicates whether this functionality is
+        supported.
+
+        @return KErrNone if successful.
+    */
+    inline TInt DeviceDisconnectFromHost();
+
+    /** Simulates a physical insertion of the USB cable by enabling the D+/- pull-ups.The iConnect member
+        of TUsbDeviceCapsV01, returned by RDevUsbcClient::DeviceCaps(),  indicates whether this functionality
+        is supported.
+
+        @return KErrNone if successful.
+    */
+    inline TInt DeviceConnectToHost();
+
+    /** Powers up the UDC and connects it to the bus if one or more interfaces exist.
+
+        @return KErrNone if UDC successfully powered up, KErrNotReady if no
+        interfaces have been registered yet, KErrHardwareNotAvailable if UDC
+        couldn't be activated.
+    */
+    inline TInt PowerUpUdc();
+
+    /** Enquires about the current operating speed of the UDC.
+
+        @return ETrue if the UDC is currently operating at High speed, EFalse otherwise.
+    */
+    inline TBool CurrentlyUsingHighSpeed();
+
+    /** Allocates the use of aResource to aEndpoint. It will be used from when the current bus transfer    has been
+        completed.
+
+        @param aResource is typically some rationed hardware resource or possibly specifies a type of endpoint
+        behaviour. aResource is not a bitmap and TEndpointResource values should not be combined.
+        @param aEndpoint The endpoint number to which the resource is to be allocated.
+
+        @return KErrNone if successful, KErrInUse if the resource is already consumed and cannot be allocated,
+        KErrNotSupported if the endpoint does not support the resource requested.
+
+        @publishedPartner @deprecated
+    */
+    inline TInt AllocateEndpointResource(TInt aEndpoint, TUsbcEndpointResource aResource);
+
+    /** Deallocates the use of aResource aEndpoint or ends a specified endpoint behaviour.
+
+        @param aResource is typically some rationed hardware resource or possibly specifies a type of endpoint
+        behaviour. aResource is not a bitmap and TEndpointResource values should not be combined.
+        @param aEndpoint The endpoint number from which the resource is to be removed.
+
+        @return KErrNone if the resource has been successfully deallocated, KErrNotSupported if the endpoint
+        does not support the resource requested.
+
+        @publishedPartner @deprecated
+    */
+    inline TInt DeAllocateEndpointResource(TInt aEndpoint, TUsbcEndpointResource aResource);
+
+    /** Queries endpoint resource use.
+
+        @param aResource is typically some rationed hardware resource or possibly specifies a type of endpoint
+        behaviour. aResource is not a bitmap and TEndpointResource values should not be combined.
+        @param aEndpoint The endpoint number at which the resource is to be queried.
+
+        @return ETrue is the specified resource is in use at the endpoint and EFalse if not.
+    */
+    inline TBool QueryEndpointResourceUse(TInt aEndpoint, TUsbcEndpointResource aResource);
+
+    /** Request (i.e. claim for this channel) up to five endpoints and set the class type for this USB
+        interface. 'aInterfaceData' is a package buffer which describes the interface and all the endpoints
+        being requested by the driver for this interface.
+
+        @param aInterfaceNumber Distinguishes between alternate interfaces. If these are not be used then this
+        should always be zero. If this parameter is used, then its value must be one more than that of the
+        proceeding alternate interface.
+        @param aInterfaceData A package buffer which describes the interface and all the endpoints being
+        requested by the driver for this interface.
+
+
+        @return KErrInUse if any of the endpoints being requested have already been claimed by another channel.
+        KErrNotSupported if an endpoint with all of the specified properties is not supported on this
+        platform. KErrNoMemory if insufficient memory is available to complete the operation.
+    */
+    inline TInt SetInterface(TInt aInterfaceNumber, TUsbcScInterfaceInfoBuf& aInterfaceData);
+
+
+    /**
+        This method should be called after SetInterface has been called for all possible alternative settings.
+        Calling this invalidates further calls to SetInterface. On success, a chunk handle is created and
+        passed back though aChunk.   This is needed for the user side to access the shared chunk where the
+        data is stored.  Note that if you are using the BIL (described later), then FinalizeInterface (...)
+        should be used instead, which will call this method.
+        
+        @return KErrNone on successful completion, or one of the system wide error codes.
+    */
+    inline TInt RealizeInterface(RChunk& aChunk);
+
+
+    /** Release an interface previously claimed by this channel. Alternate interfaces need to be released
+        in strict descending order, starting with the last (i.e. highest numbered) one.
+        It is not necessary to release an interface that wasn't successfully requested.
+
+        @param aInterfaceNumber Specifies the alternate setting number 'aInterfaceNum' of the interface to be
+        released.
+
+        @return KErrNone if successful. KErrArgument if the alternate setting doesn't exist or is released out
+        of order.
+    */
+    inline TInt ReleaseInterface(TInt aInterfaceNumber);
+
+    /** Copies the current string descriptor language ID (LANGID) code into the aLangId argument. Even though
+        the USB spec allows for the existence of a whole array of LANGID codes, we only support one.
+
+        @param aLangId Receives the LANGID code.
+
+        @return KErrNone if successful, KErrArgument if problem with argument (memory cannot be written to, etc.).
+    */
+    inline TInt GetStringDescriptorLangId(TUint16& aLangId);
+
+    /** Sets the string descriptor language ID (LANGID). Even though the USB spec allows for the existence of
+        a whole array of LANGID codes, we only support one.
+
+        @param aLangId The LANGID code to be set.
+
+        @return KErrNone if successful.
+    */
+    inline TInt SetStringDescriptorLangId(TUint16 aLangId);
+
+    /** Copies the string descriptor identified by the iManufacturer index field of the Standard Device
+        Descriptor into the aString argument.
+
+        @param aString Receives manufacturer string.
+
+        @return KErrNone if successful, KErrArgument if MaxLength of aString is too small to hold the entire
+        descriptor, KErrNotFound if the string descriptor couldn't be found.
+    */
+    inline TInt GetManufacturerStringDescriptor(TDes16& aString);
+
+    /** Sets the string descriptor identified by the iManufacturer index field of the Standard Device
+        Descriptor to the aString argument.
+
+        @param aString Contains the new manufacturer string descriptor.
+
+        @return KErrNone if successful, KErrNoMemory if no memory is available to store the new string from
+        aString (in which case the old string descriptor will be preserved).
+    */
+    inline TInt SetManufacturerStringDescriptor(const TDesC16& aString);
+
+    /** Removes (deletes) the string descriptor identified by the iManufacturer index field of the Standard
+        Device Descriptor and sets that field to zero.
+
+        @return KErrNone if successful, KErrNotFound if the string descriptor couldn't be found.
+    */
+    inline TInt RemoveManufacturerStringDescriptor();
+
+    /** Retrieves the string descriptor identified by the iProduct index field of the Standard Device
+        Descriptor into the aString argument.
+
+        @param aString Receives product string.
+
+        @return KErrNone if successful, KErrArgument if MaxLength of aString is too small to hold the entire
+        descriptor, KErrNotFound if the string descriptor couldn't be found.
+    */
+    inline TInt GetProductStringDescriptor(TDes16& aString);
+
+    /** Sets the string descriptor identified by the iProduct index field of the Standard Device Descriptor to
+        the aString argument.
+
+        @param aString Contains the new product string descriptor.
+
+        @return KErrNone if successful, KErrNoMemory if no memory is available to store the new string from
+        aString (in which case the old string descriptor will be preserved).
+    */
+    inline TInt SetProductStringDescriptor(const TDesC16& aString);
+
+    /** Removes (deletes) the string descriptor identified by the iProduct index field of the Standard Device
+        Descriptor and sets that field to zero.
+
+        @return KErrNone if successful, KErrNotFound if the string descriptor couldn't be found.
+    */
+    inline TInt RemoveProductStringDescriptor();
+
+    /** Retrieves the string descriptor identified by the iSerialNumber index field of the Standard Device
+        Descriptor into the aString argument.
+
+        @param aString Receives product string.
+
+        @return KErrNone if successful, KErrArgument if MaxLength of aString is too small to hold the entire
+        descriptor, KErrNotFound if the string descriptor couldn't be found.
+    */
+    inline TInt GetSerialNumberStringDescriptor(TDes16& aString);
+
+    /** Sets the string descriptor identified by the iSerialNumber index field of the Standard Device
+        Descriptor to the aString argument.
+
+        @param aString Contains the new serial number string descriptor.
+
+        @return KErrNone if successful, KErrNoMemory if no memory is available to store the new string from
+        aString (in which case the old string descriptor will be preserved).
+    */
+    inline TInt SetSerialNumberStringDescriptor(const TDesC16& aString);
+
+    /** Removes (deletes) the string descriptor identified by the iSerialNumber index field of the Standard
+        Device Descriptor and sets that field to zero.
+
+        @return KErrNone if successful, KErrNotFound if the string descriptor couldn't be found.
+    */
+    inline TInt RemoveSerialNumberStringDescriptor();
+
+    /** Retrieves the string descriptor identified by the iConfiguration index field of the (first) Standard
+        Configuration Descriptor into the aString argument.
+
+        @param aString Receives configuration string.
+
+        @return KErrNone if successful, KErrArgument if MaxLength of aString is too small to hold the entire
+        descriptor, KErrNotFound if the string descriptor couldn't be found.
+    */
+    inline TInt GetConfigurationStringDescriptor(TDes16& aString);
+
+    /** Sets the string descriptor identified by the iConfiguration index field of the Standard Configuration
+        Descriptor to the aString argument.
+
+        @param aString Contains the new serial number string descriptor.
+
+        @return KErrNone if successful, KErrNoMemory if no memory is available to store the new string from
+        aString (in which case the old string descriptor will be preserved).
+    */
+    inline TInt SetConfigurationStringDescriptor(const TDesC16& aString);
+
+    /** Removes (deletes) the string descriptor identified by the iConfiguration index field of the Standard
+        Configuration Descriptor and sets that field to zero.
+
+        @return KErrNone if successful, KErrNotFound if the string descriptor couldn't be found.
+    */
+    inline TInt RemoveConfigurationStringDescriptor();
+
+    /** Copies the string of the USB string descriptor at the specified index in the string descriptor array
+        into the aString argument.
+
+        Although this function can also be used for it, for querying most standard string descriptors
+        there exists a set of dedicated access functions.
+
+        @see RDevUsbcClient::GetStringDescriptorLangId
+        @see RDevUsbcClient::GetManufacturerStringDescriptor
+        @see RDevUsbcClient::GetProductStringDescriptor
+        @see RDevUsbcClient::GetSerialNumberStringDescriptor
+        @see RDevUsbcClient::GetConfigurationStringDescriptor
+
+        @param aIndex The position of the string descriptor in the string descriptor array.
+        @param aString The target location for the string descriptor copy.
+
+        @return KErrNone if successful, KErrNotFound if no string descriptor exists at the specified index,
+        KErrArgument if MaxLength() of aString is too small to hold the entire descriptor.
+    */
+    inline TInt GetStringDescriptor(TUint8 aIndex, TDes16& aString);
+
+    /** Sets the aString argument to be the string of a USB string descriptor at the specified index in the
+        string descriptor array. If a string descriptor already exists at that position then its string will
+        be replaced.
+
+        Care should be taken, when choosing aIndex, not to inadvertently overwrite one of the standard
+        string descriptors.    For their manipulation there exists a set of dedicated access functions.
+
+        @see RDevUsbcClient::SetStringDescriptorLangId
+        @see RDevUsbcClient::SetManufacturerStringDescriptor
+        @see RDevUsbcClient::SetProductStringDescriptor
+        @see RDevUsbcClient::SetSerialNumberStringDescriptor
+        @see RDevUsbcClient::SetConfigurationStringDescriptor
+
+        @param aIndex The position of the string descriptor in the string descriptor array.
+        @param aString Contains the string descriptor to be set.
+
+        @return KErrNone if successful, KErrArgument if aIndex is invalid, KErrNoMemory if no memory
+        is available to store the new string (an existing descriptor at that index will be preserved).
+    */
+    inline TInt SetStringDescriptor(TUint8 aIndex, const TDesC16& aString);
+
+    /** Removes (deletes) the USB string descriptor at the specified index in the string descriptor array.
+        The position in the array of other string descriptors is not affected.
+
+        Care should be taken, when choosing aIndex, not to inadvertently delete a standard string descriptor
+        (also because index references from non-string descriptors would be invalidated). For the deletion
+        of most standard string descriptors there exists a set of dedicated functions.
+
+        @see RDevUsbcClient::RemoveManufacturerStringDescriptor
+        @see RDevUsbcClient::RemoveProductStringDescriptor
+        @see RDevUsbcClient::RemoveSerialNumberStringDescriptor
+        @see RDevUsbcClient::RemoveConfigurationStringDescriptor
+
+        @param aIndex The position of the string descriptor in the string descriptor array.
+
+        @return KErrNone if successful, KErrNotFound if no string descriptor exists at the specified index.
+    */
+    inline TInt RemoveStringDescriptor(TUint8 aIndex);
+
+
+
+    /**  Requests notification for when there is data available on the buffer indicated.  If the buffer
+         already has data in it, it will return immediately, otherwise it will block until there is.
+
+    If the BIL methods are being used (recommended), then this method should not be called directly,
+    using TEndpointBuffer::GetBuffer instead.
+
+    @param aBufferNumber Indicates the buffer for which the caller wishes to know about data 
+    additions.  The buffer needed of any given endpoint can be found by inspecting the alternative
+    setting table, in the chunk header.  The location of the buffer can be found by looking at the
+    buffer offset table, also in the chunk header. 
+
+    @param aStatus The request status where notification of completion is directed. KErrCancel is
+    returned if the asynchronous operation was cancelled.
+
+    @param aLength A preference for the quantity of data to be read.  This value is only a 
+    suggestion and my be ignored.  The default value of 0 indicates no preference.
+
+    @return KErrNone on success, or KErrArgument if the buffer number is invalid.    
+    */
+    inline TInt ReadDataNotify(TInt aBufferNumber, TRequestStatus& aStatus, TInt aLength=0);
+
+
+    /**  Requests the LDD to write the contents of the given buffer to the USB hardware.  Notification is
+    given when this is complete.  More then one write request can be queued on any one endpoint, to allow
+    for less Hardware idling between buffers.
+
+    If the BIL methods are being used (recommended), then this method should not be called directly,
+    using TEndpointBuffer::WriteBuffer instead.
+
+    @param aBufferNumber represents the buffer number of the buffer of which the caller has placed the
+    data. As described with ReadDataNotify(...), details of the buffers can be found in the chunk header.
+
+    @param aStart Represents the start offset of the data within the chunk.  This start location must be
+    aligned to a multiple of the maximum packet size for the endpoint, so that the data can be DMAed
+    straight out of the buffer.
+
+    @param aLength Represents the amount of data to be sent to the host in bytes.
+
+    @param aFlags Is a bitfield, where bit 0 should be set if a ZLP is to be sent to the host after the
+    current transaction.  All other bits are reserved for future use.
+*/
+    inline void WriteData(TInt aBufferNumber, TUint aStart, TUint aLength, TUint aFlags, TRequestStatus& aStatus);
+
+
+
+    /** Cancels an outstanding read request on endpoint buffer aBufferNumber.
+
+        @param aBufferNumber The endpoint buffer number whose read is to be cancelled.
+    */
+    inline void ReadCancel(TInt aBufferNumber);
+
+
+    /** Cancels an outstanding write request on endpoint buffer aBufferNumber.
+
+        @param aBufferNumber The endpoint buffer number whose write is to be cancelled.
+    */
+    inline void WriteCancel(TInt aBufferNumber);
+
+    /** Cancels any transfer on any endpoint buffer specified in aBufferMask.
+
+        @code
+        // Cancel transfer requests on buffers 1, 2, 3 & 4
+        usbPort.EndpointTransferCancel(1 | 2 | 4 | 8);
+        @endcode
+
+        @param aBufferMask bitmap of the endpoint buffer numbers.
+    */
+    inline void EndpointTransferCancel(TUint aBufferMask);
+
+    /**    Register for notification when a change of the Interface alternate setting or the USB Controller's
+        current state occurs. When the alternate setting or the Controller state changes, then the
+        asynchronous function completes and the current alternate setting number or Controller state is
+        written back to aValue. If the KUsbAlternateSetting bit is set then the remaining bits are the
+        alternate setting number. Otherwise aValue is interpreted as a TUsbcDeviceState.
+
+        @see TUsbcDeviceState
+
+        @param aStatus The request status.
+        @param aValue Receives the alternate setting number or Controller state.
+    */
+    inline void AlternateDeviceStatusNotify(TRequestStatus& aStatus, TUint& aValue);
+
+    /** Completes an AlternateDeviceStatusNotify request. If a request has previously been made then the
+        status variable is updated with the current device state.
+    */
+    inline void AlternateDeviceStatusNotifyCancel();
+
+    /** If the channel has changed the grouping of endpoints between interfaces or changed the interface class
+        type from the defaults then it is necessary to force a re-enumeration. This will typically involve the
+        Symbian OS device initiating a disconnection and re-connection. This is an asynchronous operation
+        which will complete when the Controller is successfully configured by the host, i.e. has achieved
+        UsbShai::EUsbPeripheralStateConfigured.  Since it is not known if the operation has failed, at the same time that
+        a ReEnumerate request is made, a timer should be set up to complete after approximately 5 seconds. It
+        can be assumed that if the operation has not completed after this time interval then it will not
+        complete.
+
+        @param aStatus The request status.
+    */
+    inline void ReEnumerate(TRequestStatus& aStatus);
+
+    /** Cancels an outstanding ReEnumerate() request.
+    */
+    inline void ReEnumerateCancel();
+
+    /**    Register for notification when a change in stall status of any of the interface's endpoints occurs,
+        but not ep0. When a change in stall status occurs, then the asynchronous function completes and the
+        current stall state is written back to 'aEndpointStatus' as a bit map: Only stall state changes caused
+        by SET_FEATURE and CLEAR_FEATURE standard commands on ep0 will be notified when this function
+        completes. After this request completes the request should be re-issued to obtain future
+        notifications.
+
+        @param aStatus The request status.
+        @param aEndpointMask A bitmap of the endpoints' stall status. This is filled in when the call completes.
+        bit 1 represents the interface's virtual endpoint 1, (KUsbcEndpoint1Bit)
+        bit 2 represents the interface's virtual endpoint 2, (KUsbcEndpoint2Bit) etc.
+        bit value 0 - not stalled,
+        bit value 1 - stalled.
+    */
+    inline void EndpointStatusNotify(TRequestStatus& aStatus, TUint& aEndpointMask);
+
+    /** Completes an endpoint status notify request.
+    */
+     inline void EndpointStatusNotifyCancel();
+
+    /** Get current on-the-go features relating to the ability of device/host pair to
+        perform OTG role swap.
+
+        @param aFeatures On return it contains features the device currently has.
+                bit 2 represents b_hnp_enable,       (KUsbOtgAttr_B_HnpEnable)
+                bit 3 represents a_hnp_support,      (KUsbOtgAttr_A_HnpSupport)
+                bit 4 represents a_alt_hnp_support,  (KUsbOtgAttr_A_AltHnpSupport)
+        @return KErrNone if successful, KErrNotSupported if OTG is not supported by
+                this device, otherwise system-wide error returns.
+    */
+    inline TInt GetOtgFeatures(TUint8& aFeatures);
+
+    /** Register for notification on USB on-the-go features' change. If any OTG feature
+        is changed, request completes and current feature value is filled in aValue.
+
+        @param aStatus Request status object.
+        @param aValue On request completion, contains current OTG feature value.
+    */
+    inline void OtgFeaturesNotify(TRequestStatus& aStatus, TUint8& aValue);
+
+    /** Cancel pending OTG feature request.
+    */
+    inline void OtgFeaturesNotifyCancel();
+
+    /**    This function retrieves the alternate setting that the WriteData function can
+        write to.  After a host sets the alternate setting, writes to the IN endpoint
+        are not permitted by the LDD until this method has been called.
+        This function is not asynchronous nor blocking, and should not be used to
+        detect that an alternate setting has happened.
+
+        If the BIL methods are being used (recommended), then this method should not be called directly. 
+
+        @return The alternative setting number or KErrInUse if the current alternative
+         setting is already in use, that is to say that the alternative setting has not changed.
+    */
+    inline TInt StartNextInAlternateSetting();
+
+
+    /*******************************\
+    *  Buffer Interface Layer (BIL) *
+    \*******************************/
+
+    // This following functions, as well as the ones in TEndpointBuffer (below), 
+    // can be considered the BIL.
+
+
+    /**
+    Finalize the interface, creating a chunk for use with reading/writing to endpoints.
+    FinalizeInterface should be called after all alternate interfaces have been set up with SetInteface.
+    Any attempt to call SetInterface after this stage will fail.
+
+    @return        KErrNone if operation is successfull
+                System wide error codes if chunk creation failed
+    */
+    IMPORT_C TInt FinalizeInterface();
+
+    /**
+    Finalize the interface, creating a chunk for use with reading/writing to endpoints. This 
+    version of the method provides a handle to the chunk, which is needed if the
+    buffer is to be passed and used by other processes. 
+    FinalizeInterface should be called after all alternate interfaces have been set up with SetInteface.
+    Any attempt to call SetInterface after this stage will fail.
+
+    @param    aChunk    On success aChunk points to the created chunk.
+    @return            KErrNone if operation is successfull
+                    System wide error codes if chunk creation failed
+    */
+    IMPORT_C TInt FinalizeInterface(RChunk*& aChunk);
+
+    /**
+    Opens an endpoint, an endpoint should be opened before any operations are attempted on it.
+
+    @param    aEpB    On success aEpB will be filled with the relevant details for that endpoint    
+    @param    aEpI    endpoint number to be opened
+    @return            KErrNone if operation is successfull
+                    KErrNotFound if endpoint number is not valid for current alternate setting
+                    KErrInUse if endpoint is already opened
+                    KErrArgument if endpoint buffer argument passed is already in existence and being used
+    */
+    IMPORT_C TInt OpenEndpoint(TEndpointBuffer & aEpB, TInt aEpI);
+
+    /**
+    Switches to processing from one Alternate setting to the next. All open endpoints (except EP0) must
+    be close before this can be called.
+
+    @param    aFlush    If ETrue, the method will purge the buffers of any data unread for the old setting.
+                    If each endpoint was not read up until KErrEof was reached, then this should be set.
+                     
+    @return        the alternate Setting if operation is successful
+                KErrInUse if any endpoints in present alternate setting is still open (except Ep0)
+                KErrNotReady if there is no change in alternate setting
+                KErrInUse if StartNextInAlternateSetting detects no change in alternate setting.
+                KErrCorrupt if the buffer structure becomes corrupt.
+    */
+    IMPORT_C TInt StartNextOutAlternateSetting(TBool aFlush);
+
+    /**
+    Sets aChunk to RChunk currently in use by BIL.
+
+    @param    aChunk    aChunk will point to RChunk currently in use by BIL
+    @return KErrNone on success otherwise a system wide error code, if an error has occurred.
+    */
+    IMPORT_C TInt GetDataTransferChunk(RChunk*& aChunk);
+
+private:
+    /** @internalTechnology */
+    TInt Drain(TUint aBuffer);
+    /** @internalTechnology */ 
+    TInt Peek(TUint aBuffer);
+    /** @internalTechnology */ 
+    TInt FindNextAlternateSetting();
+
+private:
+    TUint8 iEndpointStatus;    /** @internalTechnology Each bit corresponds to each endpoint's open/close status. */
+    RChunk iSharedChunk;     /** @internalTechnology The shared chunk in use. */
+    TInt iAltSettingSeq;    /** @internalTechnology Used to track alternate setting changes. */
+    TInt iAlternateSetting; /** @internalTechnology The alternate setting used by OUT endpoints, which may lag that of IN endpoints. */
+    TInt iNewAltSetting;     /** @internalTechnology Used to track the next alternate setting change on OUT endpoints,
+                                during transition from one to the next. */ 
+    TInt iInAltSetting;     /** @internalTechnology The alternate setting used by IN endpoints, which may be ahead of OUT endpoints. */
+
+
+    friend class TEndpointBuffer;    
+#endif // #ifndef __KERNEL_MODE__
+    };
+
+#ifndef __KERNEL_MODE__
+
+
+/**
+ This class forms part of the Buffer Interface Layer (BIL), which forms the 
+ user side component of the USB Shared Chunk Client.  Objects of this type
+ represent the shared chunk buffer, for a given endpoint.
+ The method RDevUsbcScClient::OpenEndpoint() should be used to initialise
+ objects of this type.
+*/
+class TEndpointBuffer
+    {
+public:
+ 
+    /**
+    This return value used by GetBuffer indicates that the item pointed to by 
+    aBuffer/aOffset represents a state change, instead of endpoint data.
+    */
+    const static TInt KStateChange = 0x01;
+
+public:
+    IMPORT_C TEndpointBuffer();
+
+    /**
+    Read the next block of data from the Shared chunk buffer. This method should be used if the user wishes to process one block of data at a time. 
+    This method also expires the previously read block, meaning that the memory used by the block of data may be re-used by the system, overwriting it
+    with new data.
+    @param    aBuffer    aBuffer will point to data location in shared chunk    
+    @param    aSize    aSize will hold the number of valid bytes that can be read
+    @param    aZLP    aZLP will indicate whether its a short packet or not
+    @param    aStatus    In case of no data available to be read, aStatus will be passed on to LDD, and user side should wait for 
+                    asynchronous call ReadDataNotify to return
+    @param    aLength    Not used at the moment
+    @return            KErrCompletion if operation is successfull and data is available in the buffer
+                    KErrNone if no data is available to be read
+                    KErrEof if alternate setting has changed
+                    KErrAccessDenied if endpoint is not opened
+                    KErrNotSupported if its an IN endpoint
+                    TEndpointBuffer::KStateChange if the returned data represents a state change (Ep0 only)
+    */
+    IMPORT_C TInt GetBuffer(TAny*& aBuffer,TUint& aSize,TBool& aZLP,TRequestStatus& aStatus,TUint aLength=0);
+
+    /**
+    Read the next block of data from the Shared chunk buffer. This method should be used if the user wishes to process one block of data at a time. 
+    This method also expires the previously read block, meaning that the memory used by the block of data may be re-used by the system, overwriting it
+    with new data. 
+    @param    aOffset    aOffset will point to data offset in shared chunk    
+    @param    aSize    aSize will hold the number of valid bytes that can be read
+    @param    aZLP    aZLP will indicate whether its a short packet or not
+    @param    aStatus    In case of no data available to be read, aStatus will be passed on to LDD, and user side should wait for 
+            asynchronous call ReadDataNotify to return
+    @param    aLength    Not used at the moment
+    @return    KErrCompletion if operation is successfull and data is available in the buffer
+            KErrNone if no data is available to be read
+            KErrEof if alternate setting has changed
+            KErrAccessDenied if endpoint is not opened
+            KErrNotSupported if its an IN endpoint
+            TEndpointBuffer::KStateChange if the returned data represents a state change (Ep0 only)
+    */
+    inline   TInt GetBuffer(TUint& aOffset,TUint& aSize,TBool& aZLP,TRequestStatus& aStatus,TUint aLength=0);
+
+    /**
+    Read the next block of data from the Shared chunk buffer. This method should be used if the user wishes to process more than one block of data
+    simultaneously. The user must call one of the Expire() methods to free the memory used by the block of data, and make it available for new data.
+    @param    aBuffer    aBuffer will point to data location in shared chunk    
+    @param    aSize    aSize will hold the number of valid bytes that can be read
+    @param    aZLP    aZLP will indicate whether its a short packet or not
+    @param    aStatus    In case of no data available to be read, aStatus will be passed on to LDD, and user side should wait for 
+                    asynchronous call ReadDataNotify to return
+    @param    aLength    Not used at the moment
+    @return            KErrCompletion if operation is successfull and data is available in the buffer
+                    KErrNone if no data is available to be read
+                    KErrEof if alternate setting has changed
+                    KErrAccessDenied if endpoint is not opened
+                    KErrNotSupported if its an IN endpoint
+                    TEndpointBuffer::KStateChange if the returned data represents a state change (Ep0 only)
+    */
+    IMPORT_C TInt TakeBuffer(TAny*& aBuffer,TUint& aSize,TBool& aZLP,TRequestStatus& aStatus,TUint aLength=0);
+
+    /**
+    Used in conjunction with TakeBuffer method. This will make the 'oldest' block of data previously read out using the TakeBuffer method, but not
+    already    expired, to be released back to the system. This block can then be overwritten with new data, when it becomes available.
+    @return         KErrNotSupported if its an IN endpoint
+                    KErrNone if iTail is successfully bumped to the next transfer to be read
+    */
+
+    IMPORT_C TInt Expire();
+
+    /**
+    Used in conjunction with TakeBuffer method. This function allows blocks to be expired in a different order from which the user read the data out
+    of the buffer. Note that the system will only reuse blocks up to the point of the oldest non-expired block read. This means that the user must
+    ensure to expire all blocks in a timely manner to prevent the system from running out of usable memory.
+    @param    aAddress aAddress is the start address of the block of data previously read by the user which can be overwritten.    
+    @return            KErrNotSupported if its an IN endpoint
+                    KErrNone if iTail  is successfully bumped to the next transfer to be read
+                    KErrNotFound if a 'transfer' with start address of the data block is aAddress is not found
+    */
+
+    IMPORT_C TInt Expire(TAny* aAddress);
+
+    /**
+    Initiates write operation.
+    @param    aBuffer    aBuffer will point to data in shared chunk to be written out. aBuffer should be aligned    
+    @param    aSize    aSize will hold the number of valid bytes to be written out
+    @param    aZLP    aZLP will indicate whether a ZLP should be transmitted after writing the data out
+    @param    aStatus    This is an asynchronous function and user side should wait on status to know the end of write operation
+    @return            KErrNone if a write is successfully queued
+                    KErrEof if an alternate setting change has occurred, ending this endpoint.
+                    KErrNotSupported if its an OUT endpoint
+                    KErrAccessDenied if endpoint is not opened, or if buffer is out of range
+    */
+    IMPORT_C TInt WriteBuffer(TAny* aBuffer,TUint aSize,TBool aZLP,TRequestStatus& aStatus);
+
+    /**
+    Initiates write operation.
+    @param    aOffset    aOffset will point to offset of data in shared chunk to be written out.     
+    @param    aSize    aSize will hold the number of valid bytes to be written out
+    @param    aZLP    aZLP will indicate whether a ZLP should be transmitted after writing the data out
+    @param    aStatus    This is an asynchronous function and user side should wait on status to know the end of write operation
+    @return            KErrNone if a write is successfully queued
+                    KErrEof if an alternate setting change has occurred, ending this endpoint.
+                    KErrNotSupported if its an OUT endpoint
+                    KErrAccessDenied if endpoint is not opened, or if buffer is out of range
+    */
+    IMPORT_C TInt WriteBuffer(TUint aOffset,TUint aSize,TBool aZLP,TRequestStatus& aStatus);
+    /**
+    For IN endpoints, this method retrieves the geometry for the buffer, for which the
+    caller should stay within, when using the WriteBuffer method.
+
+    @param aStart A pointer, which is set to point to the start of the buffer.
+    @param aSize An TUint for which the size (in bytes) of buffer, is written into.
+
+    @returns KErrNotSupported if the object is on an open IN endpoint, 
+            otherwise it KErrNone is returned on success.
+    */
+    IMPORT_C TInt GetInBufferRange(TAny*& aStart, TUint& aSize);
+
+    /**
+    For IN endpoints, this method retrieves the geometry for the buffer, for which the
+    caller should stay within, when using the WriteBuffer method.
+
+    @param aStart A TUint for which the buffer's start offset from the start of the chunk,
+                    in written into.
+    @param aSize An TUint for which the size (in bytes) of buffer, is written into.
+
+    @returns KErrNotSupported if the object is on an open IN endpoint, 
+            otherwise it KErrNone is returned on success.
+    */
+    IMPORT_C TInt GetInBufferRange(TUint& aStart, TUint& aSize);
+
+    /**
+    This method closes the endpoint, after it was opened with 
+    RDevUsbcScClient::OpenEndpoint(...).
+    No method of this object can be used after this    call, until
+    RDevUsbcScClient::OpenEndpoint(...) is called on it again.
+
+    @return    KErrNone on success, otherwise KErrNotFound, if the current object is not open.
+    */
+    IMPORT_C TInt Close();
+
+    IMPORT_C void Dump();
+
+    /**
+    Used to retrieve the endpoint number for which this object was open on.
+
+    @returns the endpoint number opened by this object.
+    */
+    inline TInt GetEndpointNumber();
+
+private:
+    /** @internalTechnology */
+    void Construct(RDevUsbcScClient* aClient, TUint8* aBaseAddr, const TUsbcScHdrEndpointRecord* aEpType,
+                         TInt aEndpointNumber, SUsbcScBufferHeader* aEndpointHdr=NULL);
+
+private:
+    enum TDir {EValid = KErrNone, ENotValid = KErrNotSupported, EEOF = KErrEof};
+    TDir iInState;                        /** @internalTechnology describes state of endpoint, KErrNone if IN endpoint and ready to use, KErrNotSupportd if not an IN endpoint, KErrEof on alternate setting change */
+    TDir iOutState;                        /** @internalTechnology describes state of endpoint, KErrNone if OUT endpoint and ready to use, KErrNotSupportd if not an OUT endpoint, KErrEoF on alternate setting change */
+    TInt iEndpointNumber;                /** @internalTechnology associated endpoint number */
+    TInt iBufferNum;                    /** @internalTechnology buffer number within shared chunk */
+    RDevUsbcScClient *iClient;            /** @internalTechnology Parent RDevUsbcScClient object */
+    TUint iBaseAddr;                    /** @internalTechnology The address of the beginning of the Ldd's chunk */
+
+    SUsbcScBufferHeader* iEndpointHdr;  /** @internalTechnology Pointer to the buffer Header for OUT/BI endpoints */
+    TUint8* iBufferStartAddr;             /** @internalTechnology IN/BI endpoint buffer start address within shared chunk */
+    TUint iSize;                        /** @internalTechnology IN/BI endpoint buffer size within shared chunk */
+    friend class RDevUsbcScClient;
+    };
+
+/**
+This class can be used to retrieve the geometry of the structures 
+within a shared chunk, as used by RDevUsbcScClient.
+
+@see RDevUsbcScClient
+*/
+
+class TUsbcScChunkHeader
+    {
+public:
+/**
+The constructor for the TUsbcScChunkHeader class takes a RChunk object, 
+containing USBcSc data structures, and initialises itself, so that
+GetNumberOfEndpoints & GetBuffer can be used to interpret the chunk structures.
+
+@param    An RChunk object, which represents an shared chunk, containing the
+        USBcSc data structures to be retrieved.
+*/
+    IMPORT_C TUsbcScChunkHeader(RChunk aChunk);
+/**
+Retrieves the available information in the chunk, about the given endpoint, 
+on the given alternate setting.  The returned TUsbcScBufferRecord, 
+represents the buffer geometry, used for for the endpoint, while
+the filled in TUsbcScHdrEndpointRecord represents additional endpoint
+information.
+
+@param aAltSetting The alternate setting, for which the provided endpoint number, is a member of.
+@param aEndpoint    The endpoint, who's buffer geometry is required.
+@param aEndpointInf    The provided record is filled in with details of the endpoint, who's number was given.
+*/
+    IMPORT_C TUsbcScBufferRecord* GetBuffer(TInt aAltSetting, TInt aEndpoint, TUsbcScHdrEndpointRecord*& aEndpointInf);
+/**
+Retrieves the number of endpoints found in a given alternate setting.
+@param aAltSetting The alternate setting number, for which the number of endpoints contained within, is needed.
+*/
+    IMPORT_C TInt GetNumberOfEndpoints(TInt aAltSetting);
+
+public:
+    TUsbcScChunkBuffersHeader*    iBuffers;        /** A pointer to the TUsbcScChunkBuffersHeader object, within the chunk header */
+    TUsbcScChunkAltSettingHeader* iAltSettings;    /** A pointer to the TUsbcScChunkAltSettingHeader object, within the chunk header */
+private:
+    RChunk iChunk;
+    };
+
+#endif
+
+#include <usb/d32usbcsc.inl>
+
+#endif // __D32USBCSC_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/public/d32usbcsc.inl	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,735 @@
+// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// 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:
+// e32\include\d32usbcsc.inl
+// User side class definitions for USB Device support (inline header).
+// 
+//
+
+/** @file d32usbcsc.inl
+	@publishedPartner
+	@released
+*/
+
+#ifndef __D32USBCSC_INL__
+#define __D32USBCSC_INL__
+
+
+/** @internalTechnology
+*/
+struct TUsbcScIfcInfo
+	{
+	TUsbcScInterfaceInfoBuf* iInterfaceData;
+	TPtr8* iString;
+	TUint32 iBandwidthPriority;
+	};
+
+
+inline TUsbcScHdrEndpointRecord::TUsbcScHdrEndpointRecord(TInt aBufferNo, TUint8 aType)
+:	iBufferNo((TUint8)aBufferNo),
+ 	iType(aType)
+ 	{
+	};
+
+
+inline TUint TUsbcScHdrEndpointRecord::Type() const
+	{
+		return (TUint) (iType>>2);
+	};
+
+inline TUint TUsbcScHdrEndpointRecord::Direction() const
+	{
+		return (TUint) (iType&3);
+	};
+
+
+inline void TUsbcScBufferRecord::Set(TUint aOffset, TUint aEndOffset)
+	{
+	iOffset = aOffset;
+	iSize = aEndOffset-aOffset;
+	};
+
+inline TUint TUsbcScBufferRecord::Offset() const
+	{
+	return iOffset;
+	};
+
+inline TUint TUsbcScBufferRecord::Size() const
+	{
+	return iSize;
+	};
+
+
+inline TEndpointPairInfo::TEndpointPairInfo(TUint8 aType, TUint16 aPair, TUint8 aSpare)
+	: iType(aType), iSpare(aSpare), iPair(aPair)
+	{}
+
+
+inline TUsbcScEndpointInfo::TUsbcScEndpointInfo(TUint aType, TUint aDir, TInt aInterval, TInt aExtra,
+												TUint aBufferSize, TUint aReadSize
+)
+	: TUsbcEndpointInfo(aType, aDir, 0, aInterval, aExtra),
+ 	  iBufferSize(aBufferSize),  iReadSize(aReadSize), iPairing(), iAlignment(0), iFlags(0)
+	{}
+
+
+
+
+inline TUsbcScInterfaceInfo::TUsbcScInterfaceInfo(TInt aClass, TInt aSubClass,
+											  TInt aProtocol, TDesC16* aString,
+											  TUint aTotalEndpoints)
+	: iClass(aClass, aSubClass, aProtocol), iString(aString),
+	  iTotalEndpointsUsed(aTotalEndpoints), iFeatureWord(0)
+	{}
+
+
+inline TUsbcScBufferRecord* TUsbcScChunkBuffersHeader::Ep0Out() const
+	{
+	return (TUsbcScBufferRecord*) &iBufferOffset[0];
+	};
+inline TUsbcScBufferRecord* TUsbcScChunkBuffersHeader::Ep0In() const
+	{
+	return (TUsbcScBufferRecord*) &iBufferOffset[iRecordSize];
+	};
+inline TUsbcScBufferRecord* TUsbcScChunkBuffersHeader::Buffers(TInt aBuffer) const
+	{
+	return (TUsbcScBufferRecord*) &iBufferOffset[(aBuffer+2)*iRecordSize];
+	};
+
+inline TInt TUsbcScChunkBuffersHeader::NumberOfBuffers() const
+	{
+	return iNumOfBufs;
+	};
+
+
+#ifndef __KERNEL_MODE__
+
+
+
+/** @capability CommDD
+*/
+inline TInt RDevUsbcScClient::Open(TInt aUnit)
+	{
+	_LIT(KUsbDevName, "usbcsc");
+	return (DoCreate(KUsbDevName, VersionRequired(), aUnit, NULL, NULL, EOwnerThread));
+	}
+
+
+inline TVersion RDevUsbcScClient::VersionRequired() const
+	{
+	return (TVersion(EMajorVersionNumber, EMinorVersionNumber, EBuildVersionNumber));
+	}
+
+
+inline TInt RDevUsbcScClient::EndpointZeroRequestError()
+	{
+	return DoControl(EControlEndpointZeroRequestError);
+	}
+
+
+inline TInt RDevUsbcScClient::EndpointCaps(TDes8& aCapsBuf)
+	{
+	return DoControl(EControlEndpointCaps, &aCapsBuf);
+	}
+
+
+inline TInt RDevUsbcScClient::DeviceCaps(TUsbDeviceCaps& aCapsBuf)
+	{
+	return DoControl(EControlDeviceCaps, &aCapsBuf);
+	}
+
+
+inline TInt RDevUsbcScClient::GetAlternateSetting(TInt &aInterfaceNumber)
+	{
+	return DoControl(EControlGetAlternateSetting, &aInterfaceNumber);
+	}
+
+
+inline TInt RDevUsbcScClient::DeviceStatus(TUsbcDeviceState &aDeviceStatus)
+	{
+	return DoControl(EControlDeviceStatus, &aDeviceStatus);
+	}
+
+
+inline TInt RDevUsbcScClient::EndpointStatus(TInt aEndpoint,TEndpointState &aEndpointStatus)
+	{
+	return DoControl(EControlEndpointStatus,(TAny*) aEndpoint, &aEndpointStatus);
+	}
+
+/*
+inline TInt RDevUsbcScClient::QueryReceiveBuffer(TInt aEndpoint,TInt& aNumberOfBytes)
+	{
+	return DoControl(EControlQueryReceiveBuffer, (TAny*) aEndpoint, &aNumberOfBytes);
+	}
+
+*/
+inline TInt RDevUsbcScClient::SendEp0StatusPacket()
+	{
+	return DoControl(EControlSendEp0StatusPacket);
+	}
+
+
+inline TInt RDevUsbcScClient::HaltEndpoint(TInt aEndpoint)
+	{
+	return DoControl(EControlHaltEndpoint, (TAny*) aEndpoint);
+	}
+
+
+inline TInt RDevUsbcScClient::ClearHaltEndpoint(TInt aEndpoint)
+	{
+	return DoControl(EControlClearHaltEndpoint, (TAny*) aEndpoint);
+	}
+
+
+inline TUint RDevUsbcScClient::EndpointZeroMaxPacketSizes()
+	{
+	return DoControl(EControlEndpointZeroMaxPacketSizes);
+	}
+
+
+inline TInt RDevUsbcScClient::SetEndpointZeroMaxPacketSize(TInt aMaxPacketSize)
+	{
+	return DoControl(EControlSetEndpointZeroMaxPacketSize, (TAny*) aMaxPacketSize);
+	}
+
+
+inline TInt RDevUsbcScClient::GetEndpointZeroMaxPacketSize()
+	{
+	return DoControl(EControlGetEndpointZeroMaxPacketSize);
+	}
+
+
+inline TInt RDevUsbcScClient::GetDeviceDescriptor(TDes8& aDeviceDescriptor)
+	{
+	return DoControl(EControlGetDeviceDescriptor, &aDeviceDescriptor);
+	}
+
+
+inline TInt RDevUsbcScClient::SetDeviceDescriptor(const TDesC8& aDeviceDescriptor)
+	{
+	return DoControl(EControlSetDeviceDescriptor, const_cast<TDesC8*>(&aDeviceDescriptor));
+	}
+
+
+inline TInt RDevUsbcScClient::GetDeviceDescriptorSize(TInt& aSize)
+	{
+	TPckgBuf<TInt> p;
+	TInt r = DoControl(EControlGetDeviceDescriptorSize, &p);
+	if (r == KErrNone)
+		aSize = p();
+	return r;
+	}
+
+
+inline TInt RDevUsbcScClient::GetConfigurationDescriptor(TDes8& aConfigurationDescriptor)
+	{
+	return DoControl(EControlGetConfigurationDescriptor, &aConfigurationDescriptor);
+	}
+
+
+inline TInt RDevUsbcScClient::SetConfigurationDescriptor(const TDesC8& aConfigurationDescriptor)
+	{
+	return DoControl(EControlSetConfigurationDescriptor, const_cast<TDesC8*> (&aConfigurationDescriptor));
+	}
+
+
+inline TInt RDevUsbcScClient::GetConfigurationDescriptorSize(TInt& aSize)
+	{
+	TPckgBuf<TInt> p;
+	TInt r=DoControl(EControlGetConfigurationDescriptorSize, &p);
+	if (r == KErrNone)
+		aSize = p();
+	return r;
+	}
+
+
+inline TInt RDevUsbcScClient::GetInterfaceDescriptor(TInt aSettingNumber, TDes8& aInterfaceDescriptor)
+	{
+	return DoControl(EControlGetInterfaceDescriptor,(TAny*) aSettingNumber, &aInterfaceDescriptor);
+	}
+
+
+inline TInt RDevUsbcScClient::SetInterfaceDescriptor(TInt aSettingNumber, const TDesC8& aInterfaceDescriptor)
+	{
+	return DoControl(EControlSetInterfaceDescriptor,(TAny*) aSettingNumber,
+					 const_cast<TDesC8*>(&aInterfaceDescriptor));
+	}
+
+
+inline TInt RDevUsbcScClient::GetInterfaceDescriptorSize(TInt aSettingNumber, TInt& aSize)
+	{
+	TPckgBuf<TInt> p;
+	TInt r = DoControl(EControlGetInterfaceDescriptorSize,(TAny*) aSettingNumber, &p);
+	if (r == KErrNone)
+		aSize = p();
+	return r;
+	}
+
+
+inline TInt RDevUsbcScClient::GetEndpointDescriptor(TInt aSettingNumber, TInt aEndpointNumber,
+												  TDes8& aEndpointDescriptor)
+	{
+	TEndpointDescriptorInfo info = {aSettingNumber, aEndpointNumber, &aEndpointDescriptor};
+	return DoControl(EControlGetEndpointDescriptor, &info, NULL);
+	}
+
+
+inline TInt RDevUsbcScClient::SetEndpointDescriptor(TInt aSettingNumber, TInt aEndpointNumber,
+												  const TDesC8& aEndpointDescriptor)
+	{
+	TEndpointDescriptorInfo info = {aSettingNumber, aEndpointNumber, const_cast<TDesC8*>(&aEndpointDescriptor)};
+	return DoControl(EControlSetEndpointDescriptor, &info, NULL);
+	}
+
+
+inline TInt RDevUsbcScClient::GetEndpointDescriptorSize(TInt aSettingNumber, TInt aEndpointNumber, TInt& aSize)
+	{
+	TPckgBuf<TInt> p;
+	TEndpointDescriptorInfo info = {aSettingNumber, aEndpointNumber, &p};
+	TInt r = DoControl(EControlGetEndpointDescriptorSize, &info, NULL);
+	if (r == KErrNone)
+		aSize = p();
+	return r;
+	}
+
+
+inline void RDevUsbcScClient::GetOtgDescriptorSize(TInt& aSize)
+	{
+	aSize = KUsbDescSize_Otg;
+	}
+
+
+inline TInt RDevUsbcScClient::GetOtgDescriptor(TDes8& aOtgDesc)
+	{
+	return DoControl(EControlGetOtgDescriptor, (TAny*)&aOtgDesc);
+	}
+
+
+inline TInt RDevUsbcScClient::SetOtgDescriptor(const TDesC8& aOtgDesc)
+	{
+	return DoControl(EControlSetOtgDescriptor, (TAny*)&aOtgDesc);
+	}
+
+
+inline TInt RDevUsbcScClient::GetDeviceQualifierDescriptor(TDes8& aDescriptor)
+	{
+	return DoControl(EControlGetDeviceQualifierDescriptor, &aDescriptor);
+	}
+
+
+inline TInt RDevUsbcScClient::SetDeviceQualifierDescriptor(const TDesC8& aDescriptor)
+	{
+	return DoControl(EControlSetDeviceQualifierDescriptor, const_cast<TDesC8*>(&aDescriptor));
+	}
+
+
+inline TInt RDevUsbcScClient::GetOtherSpeedConfigurationDescriptor(TDes8& aDescriptor)
+	{
+	return DoControl(EControlGetOtherSpeedConfigurationDescriptor, &aDescriptor);
+	}
+
+
+inline TInt RDevUsbcScClient::SetOtherSpeedConfigurationDescriptor(const TDesC8& aDescriptor)
+	{
+	return DoControl(EControlSetOtherSpeedConfigurationDescriptor, const_cast<TDesC8*> (&aDescriptor));
+	}
+
+
+inline TInt RDevUsbcScClient::GetCSInterfaceDescriptorBlock(TInt aSettingNumber, TDes8& aInterfaceDescriptor)
+	{
+	return DoControl(EControlGetCSInterfaceDescriptor,(TAny*) aSettingNumber, &aInterfaceDescriptor);
+	}
+
+
+inline TInt RDevUsbcScClient::GetCSInterfaceDescriptorBlockSize(TInt aSettingNumber, TInt& aSize)
+	{
+	TPckgBuf<TInt> p;
+	TInt r = DoControl(EControlGetCSInterfaceDescriptorSize,(TAny*) aSettingNumber, &p);
+	if (r == KErrNone)
+		aSize = p();
+	return r;
+	}
+
+
+inline TInt RDevUsbcScClient::GetCSEndpointDescriptorBlock(TInt aSettingNumber, TInt aEndpointNumber,
+														 TDes8& aEndpointDescriptor)
+	{
+	TEndpointDescriptorInfo info={aSettingNumber, aEndpointNumber, &aEndpointDescriptor};
+	return DoControl(EControlGetCSEndpointDescriptor,&info,NULL);
+	}
+
+
+inline TInt RDevUsbcScClient::GetCSEndpointDescriptorBlockSize(TInt aSettingNumber, TInt aEndpointNumber,
+															 TInt& aSize)
+	{
+	TPckgBuf<TInt> p;
+	TEndpointDescriptorInfo info = {aSettingNumber, aEndpointNumber, &p};
+	TInt r = DoControl(EControlGetCSEndpointDescriptorSize, &info, NULL);
+	if (r == KErrNone)
+		aSize = p();
+	return r;
+	}
+
+
+inline TInt RDevUsbcScClient::SignalRemoteWakeup()
+	{
+	return DoControl(EControlSignalRemoteWakeup);
+	}
+
+
+inline TInt RDevUsbcScClient::DeviceDisconnectFromHost()
+	{
+	return DoControl(EControlDeviceDisconnectFromHost);
+	}
+
+
+inline TInt RDevUsbcScClient::DeviceConnectToHost()
+	{
+	return DoControl(EControlDeviceConnectToHost);
+	}
+
+
+inline TInt RDevUsbcScClient::PowerUpUdc()
+	{
+	return DoControl(EControlDevicePowerUpUdc);
+	}
+
+
+inline TBool RDevUsbcScClient::CurrentlyUsingHighSpeed()
+	{
+	return DoControl(EControlCurrentlyUsingHighSpeed);
+	}
+
+
+inline TInt RDevUsbcScClient::SetInterface(TInt aInterfaceNumber, TUsbcScInterfaceInfoBuf& aInterfaceData)
+	{
+	TPtr8 name_8(NULL,0);
+	TUsbcScIfcInfo ifcinfo;
+	ifcinfo.iInterfaceData = const_cast<TUsbcScInterfaceInfoBuf*>(&aInterfaceData);
+	if (!aInterfaceData().iString)
+		{
+		ifcinfo.iString = NULL;
+		}
+	else
+		{
+		name_8.Set(const_cast<TUint8*>(reinterpret_cast<const TUint8*>(aInterfaceData().iString->Ptr())),
+				   aInterfaceData().iString->Size(), aInterfaceData().iString->Size());
+		ifcinfo.iString = &name_8;
+		}
+	return DoControl(EControlSetInterface, (TAny*)aInterfaceNumber, &ifcinfo);
+	}
+
+inline TInt RDevUsbcScClient::RealizeInterface(RChunk& aChunk)
+	{
+	return aChunk.SetReturnedHandle(DoControl(EControlRealizeInterface));
+	}
+
+
+inline TInt RDevUsbcScClient::ReleaseInterface(TInt aInterfaceNumber)
+	{
+	return DoControl(EControlReleaseInterface, (TAny*)aInterfaceNumber);
+	}
+
+
+inline TInt RDevUsbcScClient::SetCSInterfaceDescriptorBlock(TInt aSettingNumber, const TDesC8& aInterfaceDescriptor)
+	{
+	TCSDescriptorInfo info = {aSettingNumber, 0, const_cast<TDesC8*>(&aInterfaceDescriptor),
+							  aInterfaceDescriptor.Size()};
+	return DoControl(EControlSetCSInterfaceDescriptor, &info, NULL);
+	}
+
+
+inline TInt RDevUsbcScClient::SetCSEndpointDescriptorBlock(TInt aSettingNumber, TInt aEndpointNumber,
+														 const TDesC8& aEndpointDescriptor)
+	{
+	TCSDescriptorInfo info = {aSettingNumber, aEndpointNumber, const_cast<TDesC8*>(&aEndpointDescriptor),
+							  aEndpointDescriptor.Size()};
+	return DoControl(EControlSetCSEndpointDescriptor, &info, NULL);
+	}
+
+
+inline TInt RDevUsbcScClient::SetDeviceControl()
+	{
+	return DoControl(EControlSetDeviceControl);
+	}
+
+
+inline TInt RDevUsbcScClient::ReleaseDeviceControl()
+	{
+	return DoControl(EControlReleaseDeviceControl);
+	}
+
+
+inline TInt RDevUsbcScClient::GetStringDescriptorLangId(TUint16& aLangId)
+	{
+	TPckgBuf<TUint16> p;
+	const TInt r = DoControl(EControlGetStringDescriptorLangId, &p);
+	if (r == KErrNone)
+		aLangId = p();
+	return r;
+	}
+
+
+inline TInt RDevUsbcScClient::SetStringDescriptorLangId(TUint16 aLangId)
+	{
+	return DoControl(EControlSetStringDescriptorLangId, (TAny*)(TUint)aLangId);
+	}
+
+
+inline TInt RDevUsbcScClient::GetManufacturerStringDescriptor(TDes16& aString)
+	{
+	TPtr8 name_8(const_cast<TUint8*>(reinterpret_cast<const TUint8*>(aString.Ptr())), aString.MaxSize());
+	const TInt r = DoControl(EControlGetManufacturerStringDescriptor, &name_8);
+	aString.SetLength(name_8.Size()/2);
+	return r;
+	}
+
+
+inline TInt RDevUsbcScClient::SetManufacturerStringDescriptor(const TDesC16& aString)
+	{
+	TPtrC8 name_8(reinterpret_cast<const TUint8*>(aString.Ptr()), aString.Size());
+	return DoControl(EControlSetManufacturerStringDescriptor, &name_8);
+	}
+
+
+inline TInt RDevUsbcScClient::RemoveManufacturerStringDescriptor()
+	{
+	return DoControl(EControlRemoveManufacturerStringDescriptor);
+	}
+
+
+inline TInt RDevUsbcScClient::GetProductStringDescriptor(TDes16& aString)
+	{
+	TPtr8 name_8(const_cast<TUint8*>(reinterpret_cast<const TUint8*>(aString.Ptr())), aString.MaxSize());
+	const TInt r = DoControl(EControlGetProductStringDescriptor, &name_8);
+	aString.SetLength(name_8.Size()/2);
+	return r;
+	}
+
+
+inline TInt RDevUsbcScClient::SetProductStringDescriptor(const TDesC16& aString)
+	{
+	TPtrC8 name_8(reinterpret_cast<const TUint8*>(aString.Ptr()), aString.Size());
+	return DoControl(EControlSetProductStringDescriptor, &name_8);
+	}
+
+
+inline TInt RDevUsbcScClient::RemoveProductStringDescriptor()
+	{
+	return DoControl(EControlRemoveProductStringDescriptor);
+	}
+
+
+inline TInt RDevUsbcScClient::GetSerialNumberStringDescriptor(TDes16& aString)
+	{
+	TPtr8 name_8(const_cast<TUint8*>(reinterpret_cast<const TUint8*>(aString.Ptr())), aString.MaxSize());
+	const TInt r = DoControl(EControlGetSerialNumberStringDescriptor, &name_8);
+	aString.SetLength(name_8.Size()/2);
+	return r;
+	}
+
+
+inline TInt RDevUsbcScClient::SetSerialNumberStringDescriptor(const TDesC16& aString)
+	{
+	TPtrC8 name_8(reinterpret_cast<const TUint8*>(aString.Ptr()), aString.Size());
+	return DoControl(EControlSetSerialNumberStringDescriptor, &name_8);
+	}
+
+
+inline TInt RDevUsbcScClient::RemoveSerialNumberStringDescriptor()
+	{
+	return DoControl(EControlRemoveSerialNumberStringDescriptor);
+	}
+
+
+inline TInt RDevUsbcScClient::GetConfigurationStringDescriptor(TDes16& aString)
+	{
+	TPtr8 name_8(const_cast<TUint8*>(reinterpret_cast<const TUint8*>(aString.Ptr())), aString.MaxSize());
+	const TInt r = DoControl(EControlGetConfigurationStringDescriptor, &name_8);
+	aString.SetLength(name_8.Size() / 2);
+	return r;
+	}
+
+
+inline TInt RDevUsbcScClient::SetConfigurationStringDescriptor(const TDesC16& aString)
+	{
+	TPtrC8 name_8(reinterpret_cast<const TUint8*>(aString.Ptr()), aString.Size());
+	return DoControl(EControlSetConfigurationStringDescriptor, &name_8);
+	}
+
+
+inline TInt RDevUsbcScClient::RemoveConfigurationStringDescriptor()
+	{
+	return DoControl(EControlRemoveConfigurationStringDescriptor);
+	}
+
+
+inline TInt RDevUsbcScClient::GetStringDescriptor(TUint8 aIndex, TDes16& aString)
+	{
+	TPtr8 name_8(const_cast<TUint8*>(reinterpret_cast<const TUint8*>(aString.Ptr())), aString.MaxSize());
+	const TInt r = DoControl(EControlGetStringDescriptor, (TAny*)(TUint)aIndex, &name_8);
+	aString.SetLength(name_8.Size() / 2);
+	return r;
+	}
+
+
+inline TInt RDevUsbcScClient::SetStringDescriptor(TUint8 aIndex, const TDesC16& aString)
+	{
+	TPtrC8 name_8(reinterpret_cast<const TUint8*>(aString.Ptr()), aString.Size());
+	return DoControl(EControlSetStringDescriptor, (TAny*)(TUint)aIndex, &name_8);
+	}
+
+
+inline TInt RDevUsbcScClient::RemoveStringDescriptor(TUint8 aIndex)
+	{
+	return DoControl(EControlRemoveStringDescriptor, (TAny*)(TUint)aIndex);
+	}
+
+
+inline TInt RDevUsbcScClient::AllocateEndpointResource(TInt aEndpoint, TUsbcEndpointResource aResource)
+	{
+	return DoControl(EControlAllocateEndpointResource, (TAny*)aEndpoint, (TAny*)aResource);
+	}
+
+
+inline TInt RDevUsbcScClient::DeAllocateEndpointResource(TInt aEndpoint, TUsbcEndpointResource aResource)
+	{
+	return DoControl(EControlDeAllocateEndpointResource, (TAny*)aEndpoint, (TAny*)aResource);
+	}
+
+
+inline TBool RDevUsbcScClient::QueryEndpointResourceUse(TInt aEndpoint, TUsbcEndpointResource aResource)
+	{
+	return DoControl(EControlQueryEndpointResourceUse, (TAny*)aEndpoint, (TAny*)aResource);
+	}
+
+
+inline TInt RDevUsbcScClient::ReadDataNotify(TInt aBufferNumber, TRequestStatus& aStatus, TInt aLength)
+	{
+	TAny *a[2];
+	a[0]=(TAny*) aBufferNumber;
+	a[1]=(TAny*) aLength;
+	aStatus=KRequestPending;
+	TInt r = DoControl(~ERequestReadDataNotify, &aStatus, &a[0]);
+	if (r)
+		aStatus=r;
+	return r;
+	}
+
+
+
+inline void RDevUsbcScClient::WriteData(TInt aBufferNumber, TUint aStart, TUint aLength, TUint aFlags, TRequestStatus& aStatus)
+	{
+	DoRequest( ERequestWriteData | ((aBufferNumber&KFieldBuffMask) << KFieldBuffPos) | ((aFlags&KFieldFlagsMask) << KFieldFlagsPos),
+			   aStatus, (TAny*) aStart, (TAny*) aLength);
+	}
+
+
+
+inline void RDevUsbcScClient::AlternateDeviceStatusNotify(TRequestStatus& aStatus, TUint& aValue)
+	{
+	DoRequest(ERequestAlternateDeviceStatusNotify, aStatus, &aValue);
+	}
+
+
+inline void RDevUsbcScClient::ReEnumerate(TRequestStatus& aStatus)
+	{
+	DoRequest(ERequestReEnumerate, aStatus);
+	}
+
+
+inline void RDevUsbcScClient::EndpointStatusNotify(TRequestStatus& aStatus, TUint& aEndpointMask)
+	{
+	DoRequest(ERequestEndpointStatusNotify, aStatus, &aEndpointMask);
+	}
+
+
+inline void RDevUsbcScClient::ReadCancel(TInt aBuffer)
+	{
+	DoControl(ERequestReadDataNotifyCancel, (TAny*) aBuffer);
+	}
+
+
+inline void RDevUsbcScClient::WriteCancel(TInt aBuffer)
+	{
+	DoControl(ERequestWriteDataCancel, (TAny*) aBuffer);
+	}
+
+
+inline void RDevUsbcScClient::EndpointTransferCancel(TUint aBufferMask)
+	{
+	DoControl(ERequestCancel, (TAny*) aBufferMask);
+	}
+
+
+inline void RDevUsbcScClient::AlternateDeviceStatusNotifyCancel()
+	{
+	DoControl(ERequestAlternateDeviceStatusNotifyCancel);
+	}
+
+
+inline void RDevUsbcScClient::ReEnumerateCancel()
+	{
+	DoControl(ERequestReEnumerateCancel);
+	}
+
+
+inline void RDevUsbcScClient::EndpointStatusNotifyCancel()
+	{
+	DoControl(ERequestEndpointStatusNotifyCancel);
+	}
+
+inline TInt RDevUsbcScClient::GetOtgFeatures(TUint8& aFeatures)
+	{
+	TPckgBuf<TUint8> p;
+	TInt r = DoControl(EControlGetOtgFeatures, &p);
+	if (r == KErrNone)
+		aFeatures = p();
+	return r;
+	}
+	
+
+inline void RDevUsbcScClient::OtgFeaturesNotify(TRequestStatus& aStatus, TUint8& aValue)
+	{
+	DoRequest(ERequestOtgFeaturesNotify, aStatus, &aValue);
+	}
+
+inline void RDevUsbcScClient::OtgFeaturesNotifyCancel()
+	{
+	DoControl(ERequestOtgFeaturesNotifyCancel);
+	}
+
+inline TInt RDevUsbcScClient::StartNextInAlternateSetting()
+	{
+	return DoControl(EControlStartNextInAlternateSetting);
+	}
+
+//Buffer Interface Layer (BIL) inline functions
+
+
+inline TInt TEndpointBuffer::GetBuffer(TUint& aOffset,TUint& aSize,TBool& aZLP,TRequestStatus& aStatus,TUint aLength)
+	{
+	TInt r = GetBuffer(aOffset,aSize,aZLP,aStatus,aLength);
+	aOffset -= iBaseAddr;
+	return r;
+	};
+
+
+inline TInt TEndpointBuffer::GetEndpointNumber()
+	{
+	return iEndpointNumber;
+	}
+
+#endif // #ifndef __KERNEL_MODE__
+
+#endif // #ifndef __D32USBCSC_INL__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/public/d32usbcshared.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,338 @@
+// 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 the License "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:
+// e32/include/d32usbcshared.h
+// User side class definitions for USB Device support.
+// 
+//
+
+/**
+ @file d32usbcshared.h
+ @publishedPartner
+ @released
+*/
+
+#ifndef __D32USBCSHARED_H__
+#define __D32USBCSHARED_H__
+
+#include <usb/usb_peripheral_shai_shared.h>
+
+// FIXME: for dummy dcd compitible, move this line to usbcshared.h
+// used by shared chunk version LDD's user app interface
+typedef TInt TUsbcDeviceState;
+
+// USB driver error codes
+
+/** USB driver specific error codes start from here
+*/
+const TInt KErrUsbDriverBase = -6701;
+
+/**	Attempt at data transfer, or something interface related,
+	when neither an Interface has been set up nor Device Control is owned by
+	the channel
+*/
+const TInt KErrUsbInterfaceNotReady = -6702;
+
+/**	Attempt at data transfer on an endpoint that does not belong to the active interface
+*/
+const TInt KErrUsbEpNotInInterface = -6703;
+
+/**	Attempt at data transfer in a direction not supported by the endpoint
+*/
+const TInt KErrUsbEpBadDirection = -6704;
+
+/**	The data transfer size specified exceeds that of the source or
+	destination buffer descriptor
+*/
+const TInt KErrUsbTransferSize = -6705;
+
+/**	This has multiple uses:
+	1) User request completed because device is no longer in configured state
+	2) Something endpoint related, stall, unstall, status enquiry etc,
+	   that requires the device to be configured
+*/
+const TInt KErrUsbDeviceNotConfigured = -6706;
+
+/**	Requested endpoint properties inconsistent during Interface setup
+*/
+const TInt KErrUsbBadEndpoint = -6707;
+
+/**	User data request completed because channel is closing (channel destructor called)
+*/
+const TInt KErrUsbDeviceClosing = -6708;
+
+/**	User data request completed because current endpoint set is being
+	replaced since alternate setting is changing
+*/
+const TInt KErrUsbInterfaceChange = -6709;
+
+/**	User data request completed because cable has been detached (or equivalent)
+*/
+const TInt KErrUsbCableDetached = -6710;
+
+/**	User data request completed because cable has been detached (or equivalent)
+*/
+const TInt KErrUsbDeviceBusReset = -6711;
+
+/**	This means that read data is still available when a write request is made.
+	Relates to bidirectional eps only (ep0).
+	A bidirectional ep must consume all of its read data before attempting to write.
+*/
+const TInt KErrUsbEpNotReady = -6712;
+
+// FIXME: REMOVE THIS GUY, ONCE DUMMY DCD is modified according to new SHAI.
+const TInt EUsbcDeviceStateUndefined = UsbShai::EUsbPeripheralStateUndefined; // 0
+const TInt EUsbcDeviceStateAttached = UsbShai::EUsbPeripheralStateAttached; // 1
+const TInt EUsbcDeviceStatePowered = UsbShai::EUsbPeripheralStatePowered;// 2
+const TInt EUsbcDeviceStateDefault = UsbShai::EUsbPeripheralStateDefault;// 3
+const TInt EUsbcDeviceStateAddress = UsbShai::EUsbPeripheralStateAddress; // 4
+const TInt EUsbcDeviceStateConfigured = UsbShai::EUsbPeripheralStateConfigured;// 5
+const TInt EUsbcDeviceStateSuspended = UsbShai::EUsbPeripheralStateSuspended;// 6
+const TInt EUsbcNoState = UsbShai::EUsbPeripheralNoState; // 255 (used as a place holder)
+
+/** The endpoint states.
+
+	@see RDevUsbcClient::EndpointStatus()
+	@see RDevUsbcClient::EndpointStatusNotify()
+*/
+enum TEndpointState
+	{
+	EEndpointStateNotStalled,
+	EEndpointStateStalled,
+	EEndpointStateUnknown
+	};
+
+class TUsbcEndpointCaps : public UsbShai::TUsbPeripheralEndpointCaps
+    {
+    public:
+	/** Returns the greatest available packet size for this endpoint. */
+	TInt MaxPacketSize() const;
+	/** Returns the smallest available packet size for this endpoint. */
+	TInt MinPacketSize() const;    
+    };
+
+/** Endpoint resources/behaviours.
+
+	@see AllocateEndpointResource()
+	@see DeAllocateEndpointResource()
+	@see QueryEndpointResourceUse()
+*/
+enum TUsbcEndpointResource
+	{
+	/** Requests the use of DMA. */
+	EUsbcEndpointResourceDMA = 0,
+	/** Requests the use of double FIFO buffering. */
+	EUsbcEndpointResourceDoubleBuffering = 1
+	};
+
+const TUint KUsbcEndpointInfoFeatureWord1_DMA = UsbShai::KUsbEndpointInfoFeatureWord1_DMA;
+const TUint KUsbcEndpointInfoFeatureWord1_DoubleBuffering = UsbShai::KUsbEndpointInfoFeatureWord1_DoubleBuffering;
+    
+/** The USB client device capability class.
+*/
+class TCapsDevUsbc
+	{
+    public:
+	/** The device version. */
+	TVersion version;
+	};
+
+/** The maximum number of endpoints supported by the device, excluding ep0.
+*/
+const TInt KUsbcMaxEndpoints = 30;
+
+/** The maximum number of endpoints per interface, excluding ep0.
+*/
+const TInt KMaxEndpointsPerClient = 5;
+
+/** @internalComponent
+*/
+const TInt KInvalidEndpointNumber = 31;
+
+/** The alternate setting flag; when this bit is set the state change notified by
+	RDevUsbcClient::AlternateDeviceStatusNotify() is an alternate setting number.
+*/
+const TUint KUsbAlternateSetting = 0x80000000;
+
+/** The USB cable detection feature flag; used by TUsbDeviceCapsV01::iFeatureWord1.
+	When this bit is set then the USB controller hardware (UDC) supports detection
+	of a plugged-in USB cable even when not powered.
+
+	@see TUsbDeviceCapsV01
+*/
+const TUint KUsbDevCapsFeatureWord1_CableDetectWithoutPower = 0x00000001;
+
+/** If this flag is set then the driver supports the new endpoint resource
+	allocation scheme for DMA and Double-buffering via
+	TUsbcEndpointInfo::iFeatureWord1.
+
+	@see TUsbDeviceCapsV01
+*/
+const TUint KUsbDevCapsFeatureWord1_EndpointResourceAllocV2 = 0x00000002;
+
+
+/** Device USB capabilities.
+*/
+class TUsbDeviceCapsV01
+	{
+public:
+	/** The total number of endpoints on the device. */
+	TInt iTotalEndpoints;
+	/** Indicates whether the device supports software connect/disconnect. */
+	TBool iConnect;
+	/** Indicates whether the device is self powered. */
+	TBool iSelfPowered;
+	/** Indicates whether the device can send Remote Wakeup. */
+	TBool iRemoteWakeup;
+	/** Indicates whether the device supports High-speed mode. */
+	TBool iHighSpeed;
+	/** 32 flag bits indicating miscellaneous UDC/device features.
+		Currently defined are:
+		- KUsbDevCapsFeatureWord1_CableDetectWithoutPower = 0x00000001
+		- KUsbDevCapsFeatureWord1_EndpointResourceAllocV2 = 0x00000002
+	*/
+	TUint32 iFeatureWord1;
+	/** Reserved for future use. */
+	TUint32 iReserved;
+	};
+
+/** Package buffer for a TUsbDeviceCapsV01 object.
+
+	@see TUsbDeviceCapsV01
+*/
+typedef TPckgBuf<TUsbDeviceCapsV01> TUsbDeviceCaps;
+
+/** Bitmaps for TUsbcEndpointCaps.iSizes.
+
+	This endpoint is not available (= no size).
+*/
+const TUint KUsbEpNotAvailable = 0x00000000;
+/**	Max packet size is continuously variable up to some size specified.
+	(Interrupt and Isochronous endpoints only.)
+*/
+const TUint KUsbEpSizeCont     = 0x00000001;
+/** Max packet size 8 bytes is supported
+*/
+const TUint KUsbEpSize8        = 0x00000008;
+/** Max packet size 16 bytes is supported
+*/
+const TUint KUsbEpSize16       = 0x00000010;
+/** Max packet size 32 bytes is supported
+*/
+const TUint KUsbEpSize32       = 0x00000020;
+/** Max packet size 64 bytes is supported
+*/
+const TUint KUsbEpSize64       = 0x00000040;
+/** Max packet size 128 bytes is supported
+*/
+const TUint KUsbEpSize128      = 0x00000080;
+/** Max packet size 256 bytes is supported
+*/
+const TUint KUsbEpSize256      = 0x00000100;
+/** Max packet size 512 bytes is supported
+*/
+const TUint KUsbEpSize512      = 0x00000200;
+/** Max packet size 1023 bytes is supported
+*/
+const TUint KUsbEpSize1023     = 0x00000400;
+/** Max packet size 1024 bytes is supported
+*/
+const TUint KUsbEpSize1024     = 0x00000800;
+
+/** Bitmaps for TUsbcEndpointCaps.iSupportedTypesAndDir.
+
+	Endpoint supports Control transfer type.
+*/
+const TUint KUsbEpTypeControl     = UsbShai::KUsbEpTypeControl;
+/** Endpoint supports Isochronous transfer type.
+*/
+const TUint KUsbEpTypeIsochronous = UsbShai::KUsbEpTypeIsochronous;
+/** Endpoint supports Bulk transfer type.
+*/
+const TUint KUsbEpTypeBulk        = UsbShai::KUsbEpTypeBulk;
+/** Endpoint supports Interrupt transfer type.
+*/
+const TUint KUsbEpTypeInterrupt   = UsbShai::KUsbEpTypeInterrupt;
+/** Endpoint supports IN transfers.
+*/
+const TUint KUsbEpDirIn           = UsbShai::KUsbEpDirIn;
+/** Endpoint supports OUT transfers.
+*/
+const TUint KUsbEpDirOut          = UsbShai::KUsbEpDirOut;
+/** Endpoint supports bidirectional (Control) transfers only.
+*/
+const TUint KUsbEpDirBidirect     = UsbShai::KUsbEpDirBidirect;
+
+
+/** Converts an absolute size value into a KUsbEpSize... mask.
+*/
+static inline TUint PacketSize2Mask(TInt aSize);
+
+/** Converts an endpoint type mask KUsbEpType...  into an endpoint attribute
+	value KUsbEpAttr_....
+*/
+static inline TUint EpTypeMask2Value(TInt aType);
+
+
+/** Endpoint capabilities as returned by RDevUsbcClient::EndpointCaps().
+*/
+class TUsbcEndpointData
+	{
+public:
+	/** Detail of endpoint capabilities. */
+	TUsbcEndpointCaps iCaps;
+	/** Indicates whether this endpoint is already claimed. */
+	TBool iInUse;
+	};
+
+class TUsbcEndpointInfo : public UsbShai::TUsbPeripheralEndpointInfo 
+    {
+    public:
+	TUsbcEndpointInfo(TUint aType=UsbShai::KUsbEpTypeBulk, TUint aDir=UsbShai::KUsbEpDirOut,
+					  TInt aSize=0, TInt aInterval=0, TInt aExtra=0);
+	
+	TInt AdjustEpSizes(TInt& aEpSize_Fs, TInt& aEpSize_Hs) const;
+	
+    TInt AdjustPollInterval();
+    };
+    
+/** USB Class information used in RDevUsbcClient::SetInterface().
+*/
+class TUsbcClassInfo
+	{
+public:
+	TUsbcClassInfo(TInt aClass=0, TInt aSubClass=0, TInt aProtocol=0);
+public:
+	/** The class type number. */
+	TInt iClassNum;
+	/** The sub-class type number. */
+	TInt iSubClassNum;
+	/** The protocol number. */
+	TInt iProtocolNum;
+	/** Reserved for future use. */
+	TUint32 iReserved;
+	};
+
+
+/** The Ep0 Setup request 'unsubscribe' flag; used by
+	TUsbcInterfaceInfo::iFeatureWord. When this bit is set then valid vendor-
+	or class-specific Ep0 requests addressed to this interface or any of its
+	endpoints will be stalled by the USB PDD PIL.
+
+	@see TUsbcInterfaceInfo
+*/
+const TUint KUsbcInterfaceInfo_NoEp0RequestsPlease = 0x00000001;
+
+#include <usb/d32usbcshared.inl>
+
+#endif 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/public/d32usbcshared.inl	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,145 @@
+// 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 the License "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:
+// e32/include/d32usbcshared.inl
+// User side class definitions for USB Device support.
+// 
+//
+
+/**
+ @file d32usbcshared.inl
+ @publishedPartner
+ @released
+*/
+
+#ifndef __D32USBCSHARED_INL__
+#define __D32USBCSHARED_INL__
+
+inline TInt MaxEndpointPacketSize(TInt aSizes)
+	{
+	return (aSizes & KUsbEpSize1024) ? 1024 :
+		((aSizes & KUsbEpSize1023) ? 1023 :
+		 ((aSizes & KUsbEpSize512) ? 512 :
+		  ((aSizes & KUsbEpSize256) ? 256 :
+		   ((aSizes & KUsbEpSize128) ? 128 :
+			((aSizes & KUsbEpSize64) ? 64 :
+			 ((aSizes & KUsbEpSize32) ? 32 :
+			  ((aSizes & KUsbEpSize16) ? 16 :
+			   ((aSizes & KUsbEpSize8) ? 8 : 0))))))));
+	}
+
+
+inline TInt MinEndpointPacketSize(TInt aSizes)
+	{
+	return (aSizes & KUsbEpSize8) ? 8 :
+		((aSizes & KUsbEpSize16) ? 16 :
+		 ((aSizes & KUsbEpSize32) ? 32 :
+		  ((aSizes & KUsbEpSize64) ? 64 :
+		   ((aSizes & KUsbEpSize128) ? 128 :
+			((aSizes & KUsbEpSize256) ? 256 :
+			 ((aSizes & KUsbEpSize512) ? 512 :
+			  ((aSizes & KUsbEpSize1023) ? 1023 :
+			   ((aSizes & KUsbEpSize1024) ? 1024 : 0))))))));
+	}
+
+inline TInt TUsbcEndpointCaps::MaxPacketSize() const
+	{
+	return (iSizes & KUsbEpSize1024) ? 1024 :
+		((iSizes & KUsbEpSize1023) ? 1023 :
+		 ((iSizes & KUsbEpSize512) ? 512 :
+		  ((iSizes & KUsbEpSize256) ? 256 :
+		   ((iSizes & KUsbEpSize128) ? 128 :
+			((iSizes & KUsbEpSize64) ? 64 :
+			 ((iSizes & KUsbEpSize32) ? 32 :
+			  ((iSizes & KUsbEpSize16) ? 16 :
+			   ((iSizes & KUsbEpSize8) ? 8 : 0))))))));
+	}
+
+
+inline TInt TUsbcEndpointCaps::MinPacketSize() const
+	{
+	return (iSizes & KUsbEpSize8) ? 8 :
+		((iSizes & KUsbEpSize16) ? 16 :
+		 ((iSizes & KUsbEpSize32) ? 32 :
+		  ((iSizes & KUsbEpSize64) ? 64 :
+		   ((iSizes & KUsbEpSize128) ? 128 :
+			((iSizes & KUsbEpSize256) ? 256 :
+			 ((iSizes & KUsbEpSize512) ? 512 :
+			  ((iSizes & KUsbEpSize1023) ? 1023 :
+			   ((iSizes & KUsbEpSize1024) ? 1024 : 0))))))));
+	}
+    
+static inline TUint PacketSize2Mask(TInt aSize)
+	{
+	return (aSize == 8) ? KUsbEpSize8 :
+		((aSize == 16) ? KUsbEpSize16 :
+		 ((aSize == 32) ? KUsbEpSize32 :
+		  ((aSize == 64) ? KUsbEpSize64 :
+		   ((aSize == 128) ? KUsbEpSize128 :
+			((aSize == 256) ? KUsbEpSize256 :
+			 ((aSize == 512) ? KUsbEpSize512 :
+			  ((aSize == 1023) ? KUsbEpSize1023 :
+			   ((aSize == 1024) ? KUsbEpSize1024 : 0))))))));
+	}
+
+
+static inline TUint EpTypeMask2Value(TInt aType)
+	{
+	return (aType & UsbShai::KUsbEpTypeControl) ? KUsbEpAttr_TransferTypeControl :
+		((aType & UsbShai::KUsbEpTypeIsochronous) ? KUsbEpAttr_TransferTypeIsochronous :
+		 ((aType & UsbShai::KUsbEpTypeBulk) ? KUsbEpAttr_TransferTypeBulk :
+		  ((aType & UsbShai::KUsbEpTypeInterrupt) ? KUsbEpAttr_TransferTypeInterrupt : -1)));
+	}
+
+
+/** @internalTechnology
+*/
+struct TEndpointDescriptorInfo
+	{
+	TInt iSetting;											// alternate setting
+	TInt iEndpoint;											// excludes ep0
+	TAny* iArg;												// address of data
+	};
+
+
+/** @internalTechnology
+*/
+struct TCSDescriptorInfo
+	{
+	TInt iSetting;											// alternate setting
+	TInt iEndpoint;											// excludes ep0, not used for CS ifc desc
+	TAny* iArg;												// address of data
+	TInt iSize;												// size of data (descriptor block)
+	};
+
+inline TUsbcEndpointInfo::TUsbcEndpointInfo(TUint aType, TUint aDir, TInt aSize,
+											TInt aInterval, TInt aExtra)
+	{
+    iType = aType; 
+    iDir = aDir; 
+    iSize = aSize; 
+    iInterval = aInterval;
+	iInterval_Hs = -1; 
+    iTransactions = 0; 
+    iExtra = aExtra; 
+    iFeatureWord1 = 0;
+	iReserved = 0;
+    }
+    
+inline TUsbcClassInfo::TUsbcClassInfo(TInt aClass, TInt aSubClass, TInt aProtocol)
+	: iClassNum(aClass), iSubClassNum(aSubClass), iProtocolNum(aProtocol), iReserved(0)
+	{}
+    
+#endif
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/public/d32usbdescriptors.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,548 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// 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 D32USBDESCRIPTORS_H
+#define D32USBDESCRIPTORS_H
+
+#include <e32base.h>
+
+
+/*****************************************************************************/
+/*                                                                           */
+/* USB descriptors parser framework                                          */
+/*                                                                           */
+/*****************************************************************************/
+
+class TUsbGenericDescriptor;
+
+/**
+The Symbian USB Descriptor Parsing Framework class.
+
+This class is to aid users of USBDI by providing the facilities to parse the
+raw descriptor data into wrapper classes that allow access to the fields in 
+the descriptor bodies, and pointers to map the serial data blob into the tree 
+structure that descriptors logically have.
+
+@publishedPartner Intended to be available to 3rd parties later
+@prototype
+*/
+NONSHARABLE_CLASS(UsbDescriptorParser)
+	{
+public:
+	typedef TUsbGenericDescriptor* (*TUsbDescriptorParserL)(TPtrC8& aUsbDes, TUsbGenericDescriptor* aPreviousDesc);
+
+public:
+	// Main parse function.
+	IMPORT_C static TInt Parse(const TDesC8& aUsbDes, TUsbGenericDescriptor*& aDesc);
+
+	// Custom parsing framework.
+	IMPORT_C static void RegisterCustomParserL(TUsbDescriptorParserL aParserFunc);
+	IMPORT_C static void UnregisterCustomParser(TUsbDescriptorParserL aParserFunc);
+
+private:
+	static TUsbGenericDescriptor* FindParserAndParseAndCheckL(TPtrC8& aUsbDes, TUsbGenericDescriptor* aPreviousDesc);
+	static TUsbGenericDescriptor* FindParserAndParseL(TPtrC8& aUsbDes, TUsbGenericDescriptor* aPreviousDesc);
+	static void ParseDescriptorTreeL(TPtrC8& aUsbDes, TUsbGenericDescriptor& aPreviousDesc);
+	static void BuildTreeL(TUsbGenericDescriptor& aNewDesc, TUsbGenericDescriptor& aPreviousDesc);
+	static TUsbGenericDescriptor& FindSuitableParentL(TUsbGenericDescriptor& aNewDesc, TUsbGenericDescriptor& aTopParent);
+	static TUsbGenericDescriptor* UnknownUsbDescriptorParserL(TPtrC8& aUsbDes, TUsbGenericDescriptor* aPreviousDesc);
+	};
+
+
+/*****************************************************************************/
+/*                                                                           */
+/* USB standard descriptors                                                  */
+/*                                                                           */
+/*****************************************************************************/
+
+
+/**
+Base class for USB descriptors.
+All USB descriptors contain type and length, and may have peers and children.
+
+@publishedPartner Intended to be available to 3rd parties later
+@prototype
+*/
+class TUsbGenericDescriptor
+	{
+public:
+	IMPORT_C TUsbGenericDescriptor();
+	
+	IMPORT_C void DestroyTree();
+
+	IMPORT_C TUint8 TUint8At(TInt aOffset) const;
+	IMPORT_C TUint16 TUint16At(TInt aOffset) const;
+	IMPORT_C TUint32 TUint32At(TInt aOffset) const;
+
+	IMPORT_C TUsbGenericDescriptor& operator=(const TUsbGenericDescriptor& aDescriptor);
+
+	/**
+	Helper function to allow TUsbGenericDescriptor types to be placed on the cleanup stack.
+	*/
+	inline operator TCleanupItem() { return TCleanupItem(Cleanup,this); }
+
+public:
+	virtual TBool IsParent(TUsbGenericDescriptor& aPotentialParent);
+	virtual TBool IsPeer(TUsbGenericDescriptor& aPotentialPeer);
+	virtual TBool IsChild(TUsbGenericDescriptor& aPotentialChild);
+
+private:
+	IMPORT_C static void Cleanup(TAny* aPtr);
+	static void WalkAndDelete(TUsbGenericDescriptor* aDesc);
+
+public:		// USB standard fields
+	/**
+	The offset in a standard USB descriptor to the bLength field.
+	*/
+	static const TInt KbLengthOffset = 0;
+
+	/**
+	The offset in a standard USB descriptor to the bDescriptorType field.
+	*/
+	static const TInt KbDescriptorTypeOffset = 1;
+
+	/**
+	Standard Length field.
+	*/
+	TUint8	ibLength;
+	
+	/**
+	Standard Type field.
+	*/
+	TUint8	ibDescriptorType;
+	
+public:
+	/**
+	The flag to indicate whether the USB descriptor has been recognised
+	and parsed.
+	*/
+	enum TUsbGenericDescriptorFlags
+		{
+		EUnrecognised = 0x00,
+		ERecognised = 0x01,
+		};
+	
+public:		// Symbian generated fields
+	/**
+	Flag to show if the descriptor has been recognised and parsed, or if its data can only be represented as a
+	binary blob.  This field should particularly be checked if writing code which may run on older versions of
+	the operating system, where a (now) known descriptor may not have been parsed, or before parsing a new
+	descriptor from a blob, where later versions of the operating system may have already extracted the fields.
+	*/
+	TUint8	iRecognisedAndParsed;
+
+	/**
+	A pointer to the next peer of this descriptor, or NULL.
+	As an example, an endpoint descriptor will contain pointers to any other endpoint descriptors on the same
+	interface.
+	*/
+	TUsbGenericDescriptor* iNextPeer;
+
+	/**
+	A pointer to the first child of this descriptor, or NULL.
+	As an example, an interface descriptor will contain a pointer to the first endpoint descriptor on the
+	interface. The iNextPeer member can then be used to examine other endpoints on the interface.
+	*/
+	TUsbGenericDescriptor* iFirstChild;
+	
+	/**
+	A pointer to the parent to this descriptor, or NULL.
+	As an example an endpoint descriptor from a configuration bundle will have the interface that it
+	is a member of as it's parent.
+	*/
+	TUsbGenericDescriptor* iParent;
+
+	/**
+	The binary blob that contains this descriptor
+	*/
+	TPtrC8			iBlob;
+	};
+
+enum TUsbDescriptorType
+	{
+	EDevice						= 1,
+	EConfiguration				= 2,
+	EString						= 3,
+	EInterface					= 4,
+	EEndpoint					= 5,
+	EDeviceQualifier			= 6,
+	EOtherSpeedConfiguration	= 7,
+	EInterfacePower				= 8,
+	EOTG						= 9,
+	EDebug						= 10,
+	EInterfaceAssociation		= 11,
+	};
+
+/**
+Device descriptor.
+
+See section 9.6.1 of the USB 2.0 specification.
+
+@publishedPartner Intended to be available to 3rd parties later
+@prototype
+*/
+NONSHARABLE_CLASS(TUsbDeviceDescriptor) : public TUsbGenericDescriptor
+	{
+public:
+	IMPORT_C TUsbDeviceDescriptor();
+	IMPORT_C static TUsbDeviceDescriptor* Cast(TUsbGenericDescriptor* aOriginal);
+
+public:
+	static const TInt KSizeInOctets = 18;
+	enum TFieldOffsets
+		{
+		EbcdUSB				= 2,
+		EbDeviceClass		= 4,
+		EbDeviceSubClass	= 5,
+		EbDeviceProtocol	= 6,
+		EbMaxPacketSize0	= 7,
+		EidVendor			= 8,
+		EidProduct			= 10,
+		EbcdDevice			= 12,
+		EiManufacturer		= 14,
+		EiProduct			= 15,
+		EiSerialNumber		= 16,
+		EbNumConfigurations	= 17
+		};
+
+public:
+	IMPORT_C TUint16 USBBcd() const;
+	IMPORT_C TUint8 DeviceClass() const;
+	IMPORT_C TUint8 DeviceSubClass() const;
+	IMPORT_C TUint8 DeviceProtocol() const;
+	IMPORT_C TUint8 MaxPacketSize0() const;
+	IMPORT_C TUint16 VendorId() const;
+	IMPORT_C TUint16 ProductId() const;
+	IMPORT_C TUint16 DeviceBcd() const;
+	IMPORT_C TUint8 ManufacturerIndex() const;
+	IMPORT_C TUint8 ProductIndex() const;
+	IMPORT_C TUint8 SerialNumberIndex() const;
+	IMPORT_C TUint8 NumConfigurations() const;
+
+public:
+	static TUsbDeviceDescriptor* ParseL(TPtrC8& aUsbDes, TUsbGenericDescriptor* aPreviousDesc);
+	virtual TBool IsParent(TUsbGenericDescriptor& aPotentialParent);
+	virtual TBool IsPeer(TUsbGenericDescriptor& aPotentialPeer);
+	};
+
+
+/**
+Device Qualifier descriptor.
+
+See section 9.6.2 of the USB 2.0 specification.
+
+@publishedPartner Intended to be available to 3rd parties later
+@prototype
+*/
+NONSHARABLE_CLASS(TUsbDeviceQualifierDescriptor) : public TUsbGenericDescriptor
+	{
+public:
+	IMPORT_C TUsbDeviceQualifierDescriptor();
+	IMPORT_C static TUsbDeviceQualifierDescriptor* Cast(TUsbGenericDescriptor* aOriginal);
+	
+public:
+	static const TInt KSizeInOctets = 10;
+	enum TFieldOffsets
+		{
+		EbcdUSB				= 2,
+		EbDeviceClass		= 4,
+		EbDeviceSubClass	= 5,
+		EbDeviceProtocol	= 6,
+		EbMaxPacketSize0	= 7,
+		EbNumConfigurations	= 8,
+		EbReserved			= 9
+		};
+
+public:
+	IMPORT_C TUint16 USBBcd() const;
+	IMPORT_C TUint8 DeviceClass() const;
+	IMPORT_C TUint8 DeviceSubClass() const;
+	IMPORT_C TUint8 DeviceProtocol() const;
+	IMPORT_C TUint8 MaxPacketSize0() const;
+	IMPORT_C TUint8 NumConfigurations() const;
+	IMPORT_C TUint8 Reserved() const;
+	
+public:
+	static TUsbDeviceQualifierDescriptor* ParseL(TPtrC8& aUsbDes, TUsbGenericDescriptor* aPreviousDesc);
+	virtual TBool IsParent(TUsbGenericDescriptor& aPotentialParent);
+	virtual TBool IsPeer(TUsbGenericDescriptor& aPotentialPeer);
+	};
+
+
+/**
+Configuration descriptor.
+
+See section 9.6.3 of the USB 2.0 specification.
+
+@publishedPartner Intended to be available to 3rd parties later
+@prototype
+*/
+NONSHARABLE_CLASS(TUsbConfigurationDescriptor) : public TUsbGenericDescriptor
+	{
+public:
+	IMPORT_C TUsbConfigurationDescriptor();
+	IMPORT_C static TUsbConfigurationDescriptor* Cast(TUsbGenericDescriptor* aOriginal);
+
+public:
+	static const TInt KSizeInOctets = 9;
+	enum TFieldOffsets
+		{
+		EwTotalLength			= 2,
+		EbNumInterfaces			= 4,
+		EbConfigurationValue	= 5,
+		EiConfiguration			= 6,
+		EbmAttributes			= 7,
+		EbMaxPower				= 8
+		};
+
+public:
+	IMPORT_C TUint16 TotalLength() const;
+	IMPORT_C TUint8 NumInterfaces() const;
+	IMPORT_C TUint8 ConfigurationValue() const;
+	IMPORT_C TUint8 ConfigurationIndex() const;
+	IMPORT_C TUint8 Attributes() const;
+	IMPORT_C TUint8 MaxPower() const;
+
+public:
+	static TUsbConfigurationDescriptor* ParseL(TPtrC8& aUsbDes, TUsbGenericDescriptor* aPreviousDesc);
+	virtual TBool IsParent(TUsbGenericDescriptor& aPotentialParent);
+	virtual TBool IsPeer(TUsbGenericDescriptor& aPotentialPeer);
+	};
+
+
+/**
+Other Speed descriptor.
+
+See section 9.6.4 of the USB 2.0 specification.
+
+@publishedPartner Intended to be available to 3rd parties later
+@prototype
+*/
+NONSHARABLE_CLASS(TUsbOtherSpeedDescriptor) : public TUsbGenericDescriptor
+	{
+public:
+	IMPORT_C TUsbOtherSpeedDescriptor();
+	IMPORT_C static TUsbOtherSpeedDescriptor* Cast(TUsbGenericDescriptor* aOriginal);
+
+public:
+	static const TInt KSizeInOctets = 9;
+	enum TFieldOffsets
+		{
+		EwTotalLength 			= 2,
+		EbNumInterfaces			= 4,
+		EbConfigurationValue	= 5,
+		EiConfiguration			= 6,
+		EbmAttributes			= 7,
+		EbMaxPower				= 8
+		};
+
+public:
+	IMPORT_C TUint16 TotalLength() const;
+	IMPORT_C TUint8 NumInterfaces() const;
+	IMPORT_C TUint8 ConfigurationValue() const;
+	IMPORT_C TUint8 ConfigurationIndex() const;
+	IMPORT_C TUint8 Attributes() const;
+	IMPORT_C TUint8 MaxPower() const;
+	
+public:
+	static TUsbOtherSpeedDescriptor* ParseL(TPtrC8& aUsbDes, TUsbGenericDescriptor* aPreviousDesc);
+	virtual TBool IsParent(TUsbGenericDescriptor& aPotentialParent);
+	virtual TBool IsPeer(TUsbGenericDescriptor& aPotentialPeer);
+	};
+
+
+/**
+Interface Association Descriptor
+
+See the USB IAD ECN.
+
+@publishedPartner Intended to be available to 3rd parties later
+@prototype
+*/
+NONSHARABLE_CLASS(TUsbInterfaceAssociationDescriptor) : public TUsbGenericDescriptor
+	{
+public:
+	IMPORT_C TUsbInterfaceAssociationDescriptor();
+	IMPORT_C static TUsbInterfaceAssociationDescriptor* Cast(TUsbGenericDescriptor* aOriginal);
+
+public:
+	static const TInt KSizeInOctets = 8;
+	enum TFieldOffsets
+		{
+		EbFirstInterface	= 2,
+		EbInterfaceCount	= 3,
+		EbFunctionClass		= 4,
+		EbFunctionSubClass	= 5,
+		EbFunctionProtocol	= 6,
+		EiFunction			= 7
+		};
+	
+public:
+	IMPORT_C TUint8 FirstInterface() const;
+	IMPORT_C TUint8 InterfaceCount() const;
+	IMPORT_C TUint8 FunctionClass() const;
+	IMPORT_C TUint8 FunctionSubClass() const;
+	IMPORT_C TUint8 FunctionProtocol() const;
+	IMPORT_C TUint8 FunctionIndex() const;
+	
+public:
+	static TUsbInterfaceAssociationDescriptor* ParseL(TPtrC8& aUsbDes, TUsbGenericDescriptor* aPreviousDesc);
+	virtual TBool IsParent(TUsbGenericDescriptor& aPotentialParent);
+	virtual TBool IsPeer(TUsbGenericDescriptor& aPotentialPeer);
+	virtual TBool IsChild(TUsbGenericDescriptor& aPotentialChild);
+	};
+
+/**
+Interface descriptor.
+
+See section 9.6.5 of the USB 2.0 specification.
+
+@publishedPartner Intended to be available to 3rd parties later
+@prototype
+*/
+NONSHARABLE_CLASS(TUsbInterfaceDescriptor) : public TUsbGenericDescriptor
+	{
+public:
+	IMPORT_C TUsbInterfaceDescriptor();
+	IMPORT_C static TUsbInterfaceDescriptor* Cast(TUsbGenericDescriptor* aOriginal);
+
+public:
+	static const TInt KSizeInOctets = 9;
+	enum TFieldOffsets
+		{
+		EbInterfaceNumber	= 2,
+		EbAlternateSetting	= 3,
+		EbNumEndpoints		= 4,
+		EbInterfaceClass	= 5,
+		EbInterfaceSubClass	= 6,
+		EbInterfaceProtocol	= 7,
+		EiInterface			= 8
+		};
+	
+public:
+	IMPORT_C TUint8 InterfaceNumber() const;
+	IMPORT_C TUint8 AlternateSetting() const;
+	IMPORT_C TUint8 NumEndpoints() const;
+	IMPORT_C TUint8 InterfaceClass() const;
+	IMPORT_C TUint8 InterfaceSubClass() const;
+	IMPORT_C TUint8 InterfaceProtocol() const;
+	IMPORT_C TUint8 Interface() const;
+	
+public:
+	static TUsbInterfaceDescriptor* ParseL(TPtrC8& aUsbDes, TUsbGenericDescriptor* aPreviousDesc);
+	virtual TBool IsParent(TUsbGenericDescriptor& aPotentialParent);
+	virtual TBool IsPeer(TUsbGenericDescriptor& aPotentialPeer);
+	};
+
+/**
+Endpoint descriptor.
+
+See section 9.6.6 of the USB 2.0 specification.
+Note these exclude support support for:
+'Standard AC Interrupt Endpoint Descriptor'
+'Standard AS Isochronous Synch Endpoint Descriptor'
+'Standard AS Isochronous Audio Data Endpoint Descriptor'
+as defined in USB Audio Device Class Spec v1.0 which are all 9 bytes in size.
+To support these custom descriptors may be registered with the
+parser.
+
+@publishedPartner Intended to be available to 3rd parties later
+@prototype
+*/
+NONSHARABLE_CLASS(TUsbEndpointDescriptor) : public TUsbGenericDescriptor
+	{
+public:
+	IMPORT_C TUsbEndpointDescriptor();
+	IMPORT_C static TUsbEndpointDescriptor* Cast(TUsbGenericDescriptor* aOriginal);
+
+public:
+	static const TInt KSizeInOctets = 7;
+	enum TFieldOffsets
+		{
+		EbEndpointAddress	= 2,
+		EbmAttributes		= 3,
+		EwMaxPacketSize		= 4,
+		EbInterval			= 6
+		};
+
+public:
+	IMPORT_C TUint8 EndpointAddress() const;
+	IMPORT_C TUint8 Attributes() const;
+	IMPORT_C TUint16 MaxPacketSize() const;
+	IMPORT_C TUint8 Interval() const;
+	
+public:
+	static TUsbEndpointDescriptor* ParseL(TPtrC8& aUsbDes, TUsbGenericDescriptor* aPreviousDesc);
+	virtual TBool IsParent(TUsbGenericDescriptor& aPotentialParent);
+	virtual TBool IsPeer(TUsbGenericDescriptor& aPotentialPeer);
+	};
+
+/**
+String descriptor
+
+See section 9.6.7 of the USB 2.0 specification.
+
+@publishedPartner Intended to be available to 3rd parties later
+@prototype
+*/
+NONSHARABLE_CLASS(TUsbStringDescriptor) : public TUsbGenericDescriptor
+	{
+public:
+	IMPORT_C TUsbStringDescriptor();
+	IMPORT_C static TUsbStringDescriptor* Cast(TUsbGenericDescriptor* aOriginal);
+
+public:
+	IMPORT_C TInt GetLangId(TInt aIndex) const;
+	IMPORT_C void StringData(TDes16& aString) const;
+
+public:
+	static TUsbStringDescriptor* ParseL(TPtrC8& aUsbDes, TUsbGenericDescriptor* aPreviousDesc);
+	virtual TBool IsParent(TUsbGenericDescriptor& aPotentialParent);
+	virtual TBool IsPeer(TUsbGenericDescriptor& aPotentialPeer);
+	};
+
+/**
+OTG descriptor.
+
+See section 6.4 of the USB 2.0 On-The-Go Supplement Revision 1.3
+
+@publishedPartner Intended to be available to 3rd parties later
+@prototype
+*/
+NONSHARABLE_CLASS(TUsbOTGDescriptor) : public TUsbGenericDescriptor
+	{
+public:
+	IMPORT_C TUsbOTGDescriptor();
+	IMPORT_C static TUsbOTGDescriptor* Cast(TUsbGenericDescriptor* aOriginal);
+
+public:
+	static const TInt KSizeInOctets = 3;
+	enum TFieldOffsets
+		{
+		EbmAttributes		= 2
+		};
+
+public:
+	IMPORT_C TUint8 Attributes() const;
+    IMPORT_C TBool HNPSupported() const;
+    IMPORT_C TBool SRPSupported() const;
+public:
+	static TUsbOTGDescriptor* ParseL(TPtrC8& aUsbDes, TUsbGenericDescriptor* aPreviousDesc);
+	virtual TBool IsParent(TUsbGenericDescriptor& aPotentialParent);
+	virtual TBool IsPeer(TUsbGenericDescriptor& aPotentialPeer);
+	};
+
+
+#endif	// D32USBDESCRIPTORS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/public/d32usbtransfers.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,239 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// 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 __D32USBTRANSFERS_H
+#define __D32USBTRANSFERS_H
+
+#ifdef __KERNEL_MODE__
+#include <kernel/klib.h>
+#else
+#include <e32base.h>
+#endif
+#include <d32usbdi.h>
+
+
+class RUsbTransferStrategy;
+
+/**
+Base class for all transfer descriptors.
+
+@publishedPartner Intended to be available to 3rd parties later
+@prototype
+*/
+NONSHARABLE_CLASS(RUsbTransferDescriptor)
+	{
+public:
+	enum TTransferType
+		{
+		EBulk,
+		EIsochronous,
+		EInterrupt
+		};
+
+	enum TZlpStatus
+		{
+		ESuppressZlp,
+		ESendZlpIfRequired, // Default
+		EAlwaysSendZlp
+		};
+
+#ifndef __KERNEL_MODE__
+friend class RUsbPipe;
+friend class RUsbTransferStrategy;
+
+public:
+	virtual void Close();
+
+protected:
+	RUsbTransferDescriptor(TTransferType aType, TInt aMaxSize, TInt aMaxNumPackets);
+	
+protected:
+	static const TInt KInvalidHandle = -1;
+
+protected:
+	/**
+	A pointer to the transfer strategy the descriptor is registered in.
+	*/
+	RUsbTransferStrategy* iTransferStrategy;
+
+	/**
+	Handle into the transfer strategy for the descriptor.
+	*/
+	TInt iHandle;
+
+public:
+	/**
+	The type of transfer descriptor this instance represents.
+	*/
+	const TTransferType iType;
+
+	/**
+	For isochronous transfers this refers to the maximum packet size packets
+	in this descriptor may be.
+	For other transfers this refers to the maximum size of the transfer.
+	*/
+	const TInt iMaxSize;
+
+	/**
+	Used to specify the maximum number of packets the descriptor will hold.
+	*/
+	const TInt iMaxNumPackets;
+#endif // __KERNEL_MODE__
+	};
+
+
+#ifndef __KERNEL_MODE__
+
+/**
+A class that refers to the list of packet lengths for a isochronous transfer
+descriptor.
+
+@publishedPartner
+@prototype
+*/
+NONSHARABLE_CLASS(TPacketLengths)
+	{
+public:
+	NONSHARABLE_CLASS(TLength)
+		{
+	public:
+		IMPORT_C TUint16 operator=(TUint16 aValue);
+		IMPORT_C operator TUint16() const;
+	public:
+		TLength(TUint16& aRecv, TUint16& aReq);
+	private:
+		TUint16& iRecv;
+		TUint16& iReq;
+		};
+public:
+	IMPORT_C TLength At(TInt aIndex);
+	IMPORT_C const TLength At(TInt aIndex) const;
+	IMPORT_C TLength operator[](TInt aIndex);
+	IMPORT_C const TLength operator[](TInt aIndex) const;
+	IMPORT_C TInt MaxNumPackets();
+
+public:
+	TPacketLengths(TUint16* aRecvPtr, TUint16* aReqPtr, TInt& aMaxNumPackets);
+
+private:
+	TUint16* iRecvPtr;
+	TUint16* iReqPtr;
+	TInt& iMaxNumPackets;
+	};
+
+/**
+A class that refers to the list of packet results for a isochronous transfer
+descriptor.
+
+@publishedPartner
+@prototype
+*/
+NONSHARABLE_CLASS(TPacketResults)
+	{
+public:
+	IMPORT_C TInt At(TInt aIndex) const;
+	IMPORT_C TInt operator[](TInt aIndex) const;
+	IMPORT_C TInt MaxNumPackets();
+
+public:
+	TPacketResults(TInt* aResPtr, TInt& aMaxNumPackets);
+	
+private:
+	TInt* iResPtr;
+	TInt& iMaxNumPackets;
+	};
+
+
+/**
+Provides *SEQUENTIAL* access to the packet slots in an isochronous transfer descriptor.
+As some HCs may pack the buffer space tightly, with one packet starting immediately after the preceeding one,
+random access is not possible -- in this implementation, even replacing the content of a slot with another packet
+of the same size is not 'intentionally' possible.
+Note that reading data is possible in a random access manner -- the sequential constraint only applies to writing.
+@publishedPartner Intended to be available to 3rd parties later
+@prototype
+*/
+NONSHARABLE_CLASS(RUsbIsocTransferDescriptor) : public RUsbTransferDescriptor
+	{
+friend class RUsbTransferStrategy;
+
+public:
+    IMPORT_C RUsbIsocTransferDescriptor(TInt aMaxPacketSize, TInt aMaxNumPackets);
+
+public:
+	IMPORT_C void Reset();
+	IMPORT_C TPacketLengths Lengths();
+	IMPORT_C TPacketResults Results();
+	IMPORT_C TInt MaxPacketSize();
+
+public:		// Sending
+	IMPORT_C TPtr8 WritablePackets(TInt aNumPacketsRequested, TInt& aMaxNumOfPacketsAbleToWrite);
+	IMPORT_C void SaveMultiple(TInt aNumOfPackets);
+
+public:		// Receiving
+	IMPORT_C TPtrC8 Packets(TInt aFirstPacketIndex, TInt aNumPacketsRequested, TInt& aNumOfPacketsReturned) const;
+	IMPORT_C void ReceivePackets(TInt aNumOfPackets);
+
+private:
+	/**
+	The handle to represent the current point in writing an isoc. transfer.
+	*/
+	TInt iWriteHandle;
+	};
+
+
+/**
+Provides buffer management for Bulk transfers
+@publishedPartner Intended to be available to 3rd parties later
+@prototype
+*/
+NONSHARABLE_CLASS(RUsbBulkTransferDescriptor) : public RUsbTransferDescriptor
+	{
+public:
+	IMPORT_C RUsbBulkTransferDescriptor(TInt aMaxSize);
+
+public:		// Setters
+	IMPORT_C TPtr8 WritableBuffer();
+	IMPORT_C void SaveData(TInt aLength);
+	IMPORT_C void SetZlpStatus(TZlpStatus aZlpStatus);
+
+public:		// Getters
+	IMPORT_C TPtrC8 Buffer() const;
+	};
+
+
+
+/**
+Provides buffer management for Interrupt transfers
+@publishedPartner Intended to be available to 3rd parties later
+@prototype
+*/
+NONSHARABLE_CLASS(RUsbIntrTransferDescriptor) : public RUsbTransferDescriptor
+	{
+public:
+	IMPORT_C RUsbIntrTransferDescriptor(TInt aMaxSize);
+
+public:		// Setters
+	IMPORT_C TPtr8 WritableBuffer();
+	IMPORT_C void SaveData(TInt aLength);
+	IMPORT_C void SetZlpStatus(TZlpStatus aZlpStatus);
+
+public:		// Getters
+	IMPORT_C TPtrC8 Buffer() const;
+	};
+
+#endif // __KERNEL_MODE__
+
+#endif	// __D32USBTRANSFERS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/public/usb.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,246 @@
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// 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:
+// e32\include\usb.h
+// Definitions of USB-specific constants and macros.
+// 
+//
+
+/**
+ @file usb.h
+ @publishedPartner
+ @released
+*/
+
+#ifndef __USB_H__
+#define __USB_H__
+
+//
+// 'Chapter 9' Request Types (bmRequestType)
+//
+const TUint8 KUsbRequestType_DirShift   = 7;
+const TUint8 KUsbRequestType_DirMask    = (1 << KUsbRequestType_DirShift);
+
+const TUint8 KUsbRequestType_DirToDev   = (0 << KUsbRequestType_DirShift);
+const TUint8 KUsbRequestType_DirToHost  = (1 << KUsbRequestType_DirShift);
+
+const TUint8 KUsbRequestType_TypeShift  = 5;
+const TUint8 KUsbRequestType_TypeMask   = (3 << KUsbRequestType_TypeShift);
+const TUint8 KUsbRequestType_TypeStd    = (0 << KUsbRequestType_TypeShift);
+const TUint8 KUsbRequestType_TypeClass  = (1 << KUsbRequestType_TypeShift);
+const TUint8 KUsbRequestType_TypeVendor = (2 << KUsbRequestType_TypeShift);
+
+const TUint8 KUsbRequestType_DestShift  = 0;
+const TUint8 KUsbRequestType_DestMask   = (0x1f << KUsbRequestType_DestShift);
+const TUint8 KUsbRequestType_DestDevice = (0x00 << KUsbRequestType_DestShift);
+const TUint8 KUsbRequestType_DestIfc    = (0x01 << KUsbRequestType_DestShift);
+const TUint8 KUsbRequestType_DestEp     = (0x02 << KUsbRequestType_DestShift);
+const TUint8 KUsbRequestType_DestOther  = (0x03 << KUsbRequestType_DestShift);
+
+//
+// 'Chapter 9' Endpoint Zero Requests (bRequest)
+//
+const TUint8 KUsbRequest_GetStatus     = 0;
+const TUint8 KUsbRequest_ClearFeature  = 1;
+const TUint8 KUsbRequest_SetFeature    = 3;
+const TUint8 KUsbRequest_SetAddress    = 5;
+const TUint8 KUsbRequest_GetDescriptor = 6;
+const TUint8 KUsbRequest_SetDescriptor = 7;
+const TUint8 KUsbRequest_GetConfig     = 8;
+const TUint8 KUsbRequest_SetConfig     = 9;
+const TUint8 KUsbRequest_GetInterface  = 10;
+const TUint8 KUsbRequest_SetInterface  = 11;
+const TUint8 KUsbRequest_SynchFrame    = 12;
+
+//
+// Descriptor Types
+//
+const TUint8 KUsbDescType_Device               = 1;
+const TUint8 KUsbDescType_Config               = 2;
+const TUint8 KUsbDescType_String               = 3;
+const TUint8 KUsbDescType_Interface            = 4;
+const TUint8 KUsbDescType_Endpoint             = 5;
+const TUint8 KUsbDescType_DeviceQualifier      = 6;
+const TUint8 KUsbDescType_OtherSpeedConfig     = 7;
+const TUint8 KUsbDescType_InterfacePower       = 8;
+const TUint8 KUsbDescType_Otg                  = 9;
+const TUint8 KUsbDescType_Debug                = 10;
+const TUint8 KUsbDescType_InterfaceAssociation = 11;
+
+//
+// Descriptor Sizes
+//
+const TUint KUsbDescSize_Device               = 18;
+const TUint KUsbDescSize_Config               = 9;
+const TUint KUsbDescSize_Interface            = 9;
+const TUint KUsbDescSize_Endpoint             = 7;
+const TUint KUsbDescSize_Otg                  = 3;
+const TUint KUsbDescSize_DeviceQualifier      = 10;
+const TUint KUsbDescSize_OtherSpeedConfig     = 9;
+const TUint KUsbDescSize_InterfaceAssociation = 8;
+const TUint KUsbDescMaxSize_String            = 255;
+const TUint KUsbStringDescStringMaxSize       = 252;		// it's actually 253, but that's awkward
+
+//
+// Configuration Characteristics (Configuration Descriptor)
+//
+const TUint8 KUsbDevAttr_SelfPowered  = (0x01 << 6);
+const TUint8 KUsbDevAttr_RemoteWakeup = (0x01 << 5);
+
+//
+// Descriptor Indices for String Descriptors
+//
+const TUint KUsbDescStringIndex_Manufact = 14;
+const TUint KUsbDescStringIndex_Product  = 15;
+const TUint KUsbDescStringIndex_Serial   = 16;
+const TUint KUsbDescStringIndex_Config   = 6;
+
+//
+// Endpoint Attributes
+//
+const TUint8 KUsbEpAttr_TransferTypeShift       = 0;
+const TUint8 KUsbEpAttr_TransferTypeMask        = (0x03 << KUsbEpAttr_TransferTypeShift);
+const TUint8 KUsbEpAttr_TransferTypeControl     = (0x00 << KUsbEpAttr_TransferTypeShift);
+const TUint8 KUsbEpAttr_TransferTypeIsochronous = (0x01 << KUsbEpAttr_TransferTypeShift);
+const TUint8 KUsbEpAttr_TransferTypeBulk        = (0x02 << KUsbEpAttr_TransferTypeShift);
+const TUint8 KUsbEpAttr_TransferTypeInterrupt   = (0x03 << KUsbEpAttr_TransferTypeShift);
+
+const TUint8 KUsbEpAttr_SyncTypeShift           = 2;
+const TUint8 KUsbEpAttr_SyncTypeMask            = (0x03 << KUsbEpAttr_SyncTypeShift);
+const TUint8 KUsbEpAttr_SyncTypeNoSync          = (0x00 << KUsbEpAttr_SyncTypeShift);
+const TUint8 KUsbEpAttr_SyncTypeAsync           = (0x01 << KUsbEpAttr_SyncTypeShift);
+const TUint8 KUsbEpAttr_SyncTypeAdaptive        = (0x02 << KUsbEpAttr_SyncTypeShift);
+const TUint8 KUsbEpAttr_SyncTypeSync            = (0x03 << KUsbEpAttr_SyncTypeShift);
+
+const TUint8 KUsbEpAttr_UsageTypeShift          = 4;
+const TUint8 KUsbEpAttr_UsageTypeMask           = (0x03 << KUsbEpAttr_UsageTypeShift);
+const TUint8 KUsbEpAttr_UsageTypeDataEp         = (0x00 << KUsbEpAttr_UsageTypeShift);
+const TUint8 KUsbEpAttr_UsageTypeFeedbackEp     = (0x01 << KUsbEpAttr_UsageTypeShift);
+const TUint8 KUsbEpAttr_UsageTypeImplFbDataEp   = (0x02 << KUsbEpAttr_UsageTypeShift);
+const TUint8 KUsbEpAttr_UsageTypeReserved       = (0x03 << KUsbEpAttr_UsageTypeShift);
+
+//
+// OTG Feature Indicators
+//
+const TUint8 KUsbOtgAttr_SrpSupp         = 0x01;
+const TUint8 KUsbOtgAttr_HnpSupp         = 0x02;
+const TUint8 KUsbOtgAttr_B_HnpEnable     = 0x04;
+const TUint8 KUsbOtgAttr_A_HnpSupport    = 0x08;
+const TUint8 KUsbOtgAttr_A_AltHnpSupport = 0x10;
+
+//
+// Feature Settings
+//
+const TUint KUsbFeature_EndpointHalt    = 0;
+const TUint KUsbFeature_RemoteWakeup    = 1;
+const TUint KUsbFeature_TestMode        = 2;
+const TUint KUsbFeature_B_HnpEnable     = 3;
+const TUint KUsbFeature_A_HnpSupport    = 4;
+const TUint KUsbFeature_A_AltHnpSupport = 5;
+
+//
+// Test Mode Selectors (Set/ClearFeature)
+//
+const TUint KUsbTestSelector_Test_J            = 0x01;
+const TUint KUsbTestSelector_Test_K            = 0x02;
+const TUint KUsbTestSelector_Test_SE0_NAK      = 0x03;
+const TUint KUsbTestSelector_Test_Packet       = 0x04;
+const TUint KUsbTestSelector_Test_Force_Enable = 0x05;
+
+//
+// Address Masks
+//
+const TUint8 KUsbEpAddress_In       = 0x80;
+const TUint8 KUsbEpAddress_Portmask = 0x0f;
+
+//
+// Device Status Values (GET_STATUS)
+//
+const TUint16 KUsbDevStat_SelfPowered  = (1 << 0);
+const TUint16 KUsbDevStat_RemoteWakeup = (1 << 1);
+
+//
+// Endpoint Status Values (GET_STATUS)
+//
+const TUint16 KUsbEpStat_Halt = (1 << 0);
+
+
+//
+// USB Descriptor Handling
+//
+/*------------------------------------------------
+  USB transfers data in little-endian fashion.
+  The following macros swap the byte order in
+  words (16 bit) and longwords (32 bit), such that
+  they are in little-endian order afterwards.
+  ------------------------------------------------*/
+#if defined(__BIG_ENDIAN__)		  // Hitachi SuperH, Motorola 68k
+#define SWAP_BYTES_16(x) \
+  ((((x) >> 8) & 0x00ff) | \
+   (((x) << 8) & 0xff00))
+#define SWAP_BYTES_32(x) \
+  ((((x) >> 24) & 0x000000ff) | \
+   (((x) >> 8)  & 0x0000ff00) | \
+   (((x) << 24) & 0xff000000) | \
+   (((x) << 8)  & 0x00ff0000))
+#else							  // ARM, Intel
+#define SWAP_BYTES_16(x)  (x)
+#define SWAP_BYTES_32(x)  (x)
+#endif // defined(__BIG_ENDIAN__)
+
+
+static inline TUint8 LowByte(TUint16 aWord)
+	{
+	return static_cast<TUint8>(aWord & 0x00ff);
+	}
+
+static inline TUint8 HighByte(TUint16 aWord)
+	{
+	return static_cast<TUint8>((aWord >> 8) & 0x00ff);
+	}
+
+
+//
+// Class-specific Values
+//
+
+// These are from the CDC (valid also for Audio Class)
+const TUint8 KUsbDescType_CS_Interface = 0x24;
+const TUint8 KUsbDescType_CS_Endpoint  = 0x25;
+
+// Audio Device Class
+const TUint KUsbDescSize_AudioEndpoint = KUsbDescSize_Endpoint + 2;
+const TUint KUsbAudioInterfaceClassCode                          = 0x01;
+const TUint KUsbAudioInterfaceSubclassCode_Subclass_Undefined    = 0x00;
+const TUint KUsbAudioInterfaceSubclassCode_Audiocontrol          = 0x01;
+const TUint KUsbAudioInterfaceSubclassCode_Audiostreaming        = 0x02;
+const TUint KUsbAudioInterfaceSubclassCode_Midistreaming         = 0x03;
+const TUint KUsbAudioInterfaceProtocolCode_Pr_Protocol_Undefined = 0x00;
+
+
+//
+// These are defined just for convenience:
+//
+const TUint8 KEp0_Out = 0;
+const TUint8 KEp0_In  = 1;
+const TUint8 KEp0_Rx  = KEp0_Out;
+const TUint8 KEp0_Tx  = KEp0_In;
+
+
+//
+// USB Implementers Forum, Inc (USB-IF) assigned Vendor IDs:
+//
+const TUint16 KUsbVendorId_Symbian = 0x0E22;				// Symbian Ltd. (dec. 3618)
+
+
+#endif // __USB_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/public/usbc.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,359 @@
+// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// 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:
+// e32/include/drivers/usbc.h
+// Kernel side definitions for the USB Device driver stack (PIL + LDD).
+// 
+//
+
+/**
+ @file usbc.h
+ @internalTechnology
+*/
+
+#ifndef __USBC_H__
+#define __USBC_H__
+
+#include <kernel/kernel.h>
+#include <kernel/kern_priv.h>
+#include <kernel/kpower.h>
+#include <platform.h>
+
+#include <usb/d32usbc.h>
+
+//#include <drivers/usbcshared.h>
+#include <usb/usbcshared.h>
+
+
+
+/** LDD Major version, This should agree with the information in RDevUsbcClient::TVer.
+*/
+const TInt KUsbcMajorVersion = 0;
+
+/** LDD Minor version, This should agree with the information in RDevUsbcClient::TVer.
+*/
+const TInt KUsbcMinorVersion = 1;
+
+/** LDD Build version, This should agree with the information in RDevUsbcClient::TVer.
+*/
+const TInt KUsbcBuildVersion = KE32BuildVersionNumber;
+
+/** Must correspond to the max enum of TRequest + 1;
+    currently this is ERequestOtgFeaturesNotify = 10.
+*/
+const TInt KUsbcMaxRequests = 11;
+
+//
+//########################### Logical Device Driver (LDD) #############################
+//
+
+/** USB LDD factory class.
+*/
+class DUsbcLogDevice : public DLogicalDevice
+    {
+public:
+    DUsbcLogDevice();
+    virtual TInt Install();
+    virtual void GetCaps(TDes8& aDes) const;
+    virtual TInt Create(DLogicalChannelBase*& aChannel);
+    };
+
+
+/** OUT buffering is a collection of flat buffers. Each is either fillable or drainable.
+    When one buffer becomes full (notified by the PIL) it is marked as not-fillable and the next
+    fillable buffer is used. When the buffer has finished draining it is marked as fillable.
+*/
+class TDmaBuf
+    {
+public:
+    TDmaBuf();
+     TDmaBuf(TUsbcEndpointInfo* aEndpointInfo, TInt aBandwidthPriority);
+    ~TDmaBuf();
+    TInt Construct(TUsbcEndpointInfo* aEndpointInfo);
+    TInt BufferTotalSize() const;
+    TInt BufferSize() const;
+    TInt SetBufferAddr(TInt aBufInd, TUint8* aBufAddr);
+    TInt BufferNumber() const;
+    void SetMaxPacketSize(TInt aSize);
+    void Flush();
+    // Rx (OUT) variants
+    void RxSetActive();
+    void RxSetInActive();
+    TBool RxIsActive();
+    TBool IsReaderEmpty();
+    void ReadXferComplete(TInt aNoBytesRx, TInt aNoPacketsRx, TInt aErrorCode);
+    TInt RxCopyDataToClient(DThread* aThread, TClientBuffer *aTcb, TInt aLength, TUint32& aDestOffset,
+                            TBool aRUS, TBool& aCompleteNow);
+    TInt RxCopyPacketToClient(DThread* aThread,TClientBuffer *aTcb, TInt aLength);
+    TInt RxGetNextXfer(TUint8*& aBufferAddr, TUsbcPacketArray*& aIndexArray, TUsbcPacketArray*& aSizeArray,
+                       TInt& aLength, TPhysAddr& aBufferPhys);
+    TBool RxIsEnoughSpace(TInt aSize);
+    inline TInt RxBytesAvailable() const;
+    inline void IncrementBufferIndex(TInt& aIndex);
+    inline TInt NoRxPackets() const;
+    TInt SetDrainable(TInt aBufferNum);
+    // Tx (IN) variants
+    void TxSetActive();
+    void TxSetInActive();
+    TBool TxIsActive();
+    TInt TxStoreData(DThread* aThread,TClientBuffer *aTcb, TInt aTxLength, TUint32 aBufferOffset);
+    TInt TxGetNextXfer(TUint8*& aBufferAddr, TInt& aTxLength, TPhysAddr& aBufferPhys);
+    TBool ShortPacketExists();
+
+#if defined(USBC_LDD_BUFFER_TRACE)
+    TInt NoRxPacketsAlt() const;
+    TInt NoRxBytesAlt() const;
+#endif
+
+private:
+    TBool AdvancePacket();
+    inline TInt GetCurrentError();
+    TBool NextDrainableBuffer();
+    TBool NextFillableBuffer();
+    void FreeDrainedBuffers();
+    TInt PeekNextPacketSize();
+    TInt PeekNextDrainableBuffer();
+    void ModifyTotalRxBytesAvail(TInt aVal);
+    void ModifyTotalRxPacketsAvail(TInt aVal);
+    void AddToDrainQueue(TInt aBufferIndex);
+    inline TInt CopyToUser(DThread* aThread, const TUint8* aSourceAddr, TInt aLength,
+                           TClientBuffer *aTcb, TUint32& aDestOffset);
+private:
+    TInt iExtractOffset;                                    // offset into current packet for data read
+    TInt iMaxPacketSize;
+    TInt iNumberofBuffers;
+    TInt iBufSz;
+    TBool iRxActive;
+    TBool iTxActive;
+    TInt iTotalRxBytesAvail;
+    TInt iTotalRxPacketsAvail;
+    //
+    TUint8* iBufBasePtr;
+    TUint8* iCurrentDrainingBuffer;
+    TInt iCurrentDrainingBufferIndex;
+    TInt iCurrentFillingBufferIndex;
+    TUint iCurrentPacket;
+    TUsbcPacketArray* iCurrentPacketIndexArray;
+    TUsbcPacketArray* iCurrentPacketSizeArray;
+    TUint8* iBuffers[KUsbcDmaBufNumMax];
+    TBool iDrainable[KUsbcDmaBufNumMax];
+    TUsbcPacketArray iPacketInfoStorage[KUsbcDmaBufNumMax * KUsbcDmaBufNumArrays * KUsbcDmaBufMaxPkts];
+    TUsbcPacketArray* iPacketIndex[KUsbcDmaBufNumMax];
+    TUsbcPacketArray* iPacketSize[KUsbcDmaBufNumMax];
+    TUint iNumberofBytesRx[KUsbcDmaBufNumMax];
+    TUint iNumberofPacketsRx[KUsbcDmaBufNumMax];
+    TInt iError[KUsbcDmaBufNumMax];
+    TPhysAddr iBufferPhys[KUsbcDmaBufNumMax];
+    TBool iCanBeFreed[KUsbcDmaBufNumMax];
+    TInt iDrainQueue[KUsbcDmaBufNumMax + 1];
+    TInt iDrainQueueIndex;
+    TUint iEndpointType;
+
+#if defined(USBC_LDD_BUFFER_TRACE)
+    TInt iFillingOrder;
+    TInt iFillingOrderArray[KUsbcDmaBufNumMax];
+    TInt iDrainingOrder;
+     TUint iNumberofBytesRxRemain[KUsbcDmaBufNumMax];
+     TUint iNumberofPacketsRxRemain[KUsbcDmaBufNumMax];
+#endif
+    };
+
+
+class DLddUsbcChannel;
+
+/** Endpoint tracking for the LDD buffering etc.
+*/
+class TUsbcEndpoint
+    {
+public:
+    TUsbcEndpoint();
+    TUsbcEndpoint(DLddUsbcChannel* aLDD, DUsbClientController* aController,
+                  const TUsbcEndpointInfo* aEndpointInfo, TInt aEndpointNum,
+                  TInt aBandwidthPriority);
+    ~TUsbcEndpoint();
+    TInt Construct();
+    TInt TryToStartRead(TBool aReEntrant);
+    TInt TryToStartWrite(TEndpointTransferInfo* pTfr);
+    TInt CopyToClient(DThread* aThread, TClientBuffer *aTcb);
+    TInt CopyToClient(DThread* aClient, TBool& aCompleteNow, TClientBuffer *aTcb);
+    TInt ContinueWrite();
+    void SetMaxPacketSize(TInt aSize);
+    void CancelTransfer(DThread* aThread, TClientBuffer *aTcb);
+    void AbortTransfer();
+    inline TUsbcEndpointInfo* EndpointInfo();
+    inline TInt RxBytesAvailable() const;
+
+    inline TInt BufferSize() const;
+    inline TInt SetBufferAddr( TInt aBufInd, TUint8* aAddr);
+    inline TInt BufferNumber() const;
+
+    inline void SetTransferInfo(TEndpointTransferInfo* aTransferInfo);
+    inline void ResetTransferInfo();
+    inline void SetClientReadPending(TBool aVal);
+    inline void SetClientWritePending(TBool aVal);
+    inline TBool ClientWritePending();
+    inline TBool ClientReadPending();
+    inline void SetRealEpNumber(TInt aRealEpNumber);
+    inline TInt RealEpNumber() const;
+
+public:
+    TDmaBuf* iDmaBuffers;
+
+private:
+    static void RequestCallback(TAny* aTUsbcEndpoint);
+    void TxComplete();
+    TInt RxComplete(TBool aReEntrant);
+    void RxCompleteNow();
+    TInt EndpointComplete();
+
+private:
+    DUsbClientController* iController;
+    TUsbcEndpointInfo iEndpointInfo;
+    TEndpointTransferInfo iTransferInfo;
+    TBool iClientReadPending;
+    TBool iClientWritePending;
+    TInt iEndpointNumber;
+    TInt iRealEpNumber;
+    DLddUsbcChannel* iLdd;
+    TInt iError;
+    TUsbcRequestCallback* iRequestCallbackInfo;
+    TUint32 iBytesTransferred;
+    TInt iBandwidthPriority;
+    };
+
+
+/** Linked list of 'alternate setting' info for use by the LDD.
+*/
+class TUsbcAlternateSettingList
+    {
+public:
+    TUsbcAlternateSettingList();
+    ~TUsbcAlternateSettingList();
+
+public:
+    TUsbcAlternateSettingList* iNext;
+    TInt iNumberOfEndpoints;
+    TUint iSetting;
+    TInt iEpNumDeOrderedByBufSize[KMaxEndpointsPerClient + 1];
+    TUsbcEndpoint* iEndpoint[KMaxEndpointsPerClient + 1];
+    };
+
+
+struct TClientAsynchNotify
+    {
+        TClientBufferRequest *iBufferRequest;
+        TClientBuffer *iClientBuffer;
+        void Reset();
+    };
+/** The channel class - the actual USB LDD.
+*/
+class DLddUsbcChannel : public DLogicalChannel
+    {
+public:
+    DLddUsbcChannel();
+    ~DLddUsbcChannel();
+    virtual TInt SendMsg(TMessageBase * aMsg);
+    TInt PreSendRequest(TMessageBase * aMsg,TInt aReqNo, TRequestStatus* aStatus, TAny* a1, TAny* a2);
+    TInt SendControl(TMessageBase* aMsg);
+    virtual void HandleMsg(TMessageBase* aMsg);
+    virtual TInt DoCreate(TInt aUnit, const TDesC8* aInfo, const TVersion& aVer);
+    virtual TInt RequestUserHandle(DThread* aThread, TOwnerType aType);
+    TInt DoRxComplete(TUsbcEndpoint* aTUsbcEndpoint, TInt aEndpoint, TBool aReentrant);
+    void DoRxCompleteNow(TUsbcEndpoint* aTUsbcEndpoint, TInt aEndpoint);
+    void DoTxComplete(TUsbcEndpoint* aTUsbcEndpoint, TInt aEndpoint, TInt aError);
+    inline DThread* Client() const {return iClient;}
+    inline TBool ChannelClosing() const {return iChannelClosing;}
+    inline TUint AlternateSetting() const {return iAlternateSetting;}
+    TClientBuffer *GetClientBuffer(TInt aEndpoint);
+
+private:
+    TInt DoCancel(TInt aReqNo);
+    void DoRequest(TInt aReqNo, TRequestStatus* aStatus, TAny* a1, TAny* a2);
+    TInt DoControl(TInt aFunction, TAny* a1, TAny* a2);
+    TInt DoTransferAsyncReq(TInt aEndpointNum, TAny* a1, TAny* a2, TBool& aNeedsCompletion);
+    TInt DoOtherAsyncReq(TInt aReqNo, TAny* a1, TAny* a2, TBool& aNeedsCompletion);
+    TBool AlternateDeviceStateTestComplete();
+    TInt SetInterface(TInt aInterfaceNum, TUsbcIfcInfo* aUserInterfaceInfoBuf);
+    void StartEpReads();
+    void DestroyAllInterfaces();
+    void DestroyInterface(TUint aInterface);
+    void DestroyEp0();
+    inline TBool ValidEndpoint(TInt aEndpoint);
+    TInt DoEmergencyComplete();
+    void ReadDes8(const TAny* aPtr, TDes8& aDes);
+    TInt SetupEp0();
+    DPlatChunkHw* ReAllocate(TInt aBuffersize, DPlatChunkHw* aHwChunk, TUint32 aCacheAttribs);
+    DPlatChunkHw* Allocate(TInt aBuffersize, TUint32 aCacheAttribs);
+    void ClosePhysicalChunk(DPlatChunkHw* &aHwChunk);
+    void CancelNotifyEndpointStatus();
+    void CancelNotifyOtgFeatures();
+    static void StatusChangeCallback(TAny* aDLddUsbcChannel);
+    static void EndpointStatusChangeCallback(TAny* aDLddUsbcChannel);
+    static void OtgFeatureChangeCallback(TAny* aDLddUsbcChannel);
+    static void EmergencyCompleteDfc(TAny* aDLddUsbcChannel);
+    void DeConfigure(TInt aErrorCode);
+    TInt SelectAlternateSetting(TUint aAlternateSetting);
+    TInt EpFromAlternateSetting(TUint aAlternateSetting, TInt aEndpoint);
+    TInt ProcessAlternateSetting(TUint aAlternateSetting);
+    TInt ProcessDeviceState(TUsbcDeviceState aDeviceState);
+    void ResetInterface(TInt aErrorCode);
+    void AbortInterface();
+    // Set buffer address of the interface
+    void ReSetInterfaceMemory(TUsbcAlternateSettingList* aAlternateSettingListRec,
+            RArray<DPlatChunkHw*> &aHwChunks );
+    void UpdateEndpointSizes();
+    // Check and alloc memory for the interface
+    TInt SetupInterfaceMemory(RArray<DPlatChunkHw*> &aHwChunks, 
+            TUint32 aCacheAttribs );
+    void PanicClientThread(TInt aReason);
+    TInt PinMemory(TDesC8 *aDes, TVirtualPinObject *iPinObj); //Descriptor pinning helper.
+    void CompleteBufferRequest(DThread* aThread, TInt aReqNo, TInt aReason);
+private:
+    DUsbClientController* iController;
+    DThread* iClient;
+    TBool iValidInterface;
+    TUsbcAlternateSettingList* iAlternateSettingList;
+    TUsbcEndpoint* iEndpoint[KMaxEndpointsPerClient + 1];    // include ep0
+    TRequestStatus* iRequestStatus[KUsbcMaxRequests];
+    TClientAsynchNotify* iClientAsynchNotify[KUsbcMaxRequests];
+    TUsbcClientCallback iCompleteAllCallbackInfo;
+    TAny* iStatusChangePtr;
+    TUsbcStatusCallback iStatusCallbackInfo;
+    TAny* iEndpointStatusChangePtr;
+    TUsbcEndpointStatusCallback iEndpointStatusCallbackInfo;
+    TAny* iOtgFeatureChangePtr;
+    TUsbcOtgFeatureCallback iOtgFeatureCallbackInfo;
+    TInt iNumberOfEndpoints;
+    RArray<DPlatChunkHw*> iHwChunksEp0;
+    RArray<DPlatChunkHw*> iHwChunks;
+
+    TUsbcDeviceState iDeviceState;
+    TUsbcDeviceState iOldDeviceState;
+    TBool iOwnsDeviceControl;
+    TUint iAlternateSetting;
+    TBool iDeviceStatusNeeded;
+    TUsbcDeviceStatusQueue* iStatusFifo;
+    TBool iChannelClosing;
+    TVirtualPinObject *iPinObj1;
+    TVirtualPinObject *iPinObj2;
+    TVirtualPinObject *iPinObj3;
+    TClientDataRequest<TUint> *iStatusChangeReq;
+    TClientDataRequest<TUint> *iEndpointStatusChangeReq;
+    TClientDataRequest<TUint> *iOtgFeatureChangeReq;
+    TEndpointTransferInfo iTfrInfo;
+    };
+
+
+#include <usb/usbc.inl>
+
+#endif    // __USBC_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/public/usbc.inl	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,115 @@
+// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// 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:
+// e32\include\drivers\usbc.inl
+// Kernel side inline header file for USB device driver.
+// 
+//
+
+/**
+ @file usbc.inl
+ @internalTechnology
+*/
+
+#ifndef __USBC_INL__
+#define __USBC_INL__
+
+
+// --- USB Logical Device Driver (LDD) ---
+//
+
+TInt TDmaBuf::RxBytesAvailable() const
+	{
+	return iTotalRxBytesAvail;
+	}
+
+
+TUsbcEndpointInfo* TUsbcEndpoint::EndpointInfo()
+	{
+	return &iEndpointInfo;
+	}
+
+
+TInt TUsbcEndpoint::RxBytesAvailable() const
+	{
+	return iDmaBuffers->RxBytesAvailable();
+	}
+
+TInt TUsbcEndpoint::BufferSize() const
+    {
+    return iDmaBuffers->BufferSize();
+    }
+TInt TUsbcEndpoint::SetBufferAddr( TInt aBufInd, TUint8* aBufAddr)
+    {
+    return iDmaBuffers->SetBufferAddr(aBufInd, aBufAddr);
+    }
+TInt TUsbcEndpoint::BufferNumber() const
+    {
+    return iDmaBuffers->BufferNumber();
+    }
+
+void TUsbcEndpoint::SetTransferInfo(TEndpointTransferInfo* aTransferInfo)
+	{
+	iTransferInfo = *aTransferInfo;
+	iBytesTransferred = 0;
+	}
+
+
+void TUsbcEndpoint::ResetTransferInfo()
+	{
+	iTransferInfo.iDes = NULL;
+	iTransferInfo.iTransferType = ETransferTypeNone;
+	iTransferInfo.iTransferSize = 0;
+	iTransferInfo.iZlpReqd = EFalse;
+	iBytesTransferred = 0;
+	}
+
+
+void TUsbcEndpoint::SetClientReadPending(TBool aVal)
+	{
+	iClientReadPending = aVal;
+	}
+
+
+TBool TUsbcEndpoint::ClientReadPending()
+	{
+	return iClientReadPending;
+	}
+
+
+void TUsbcEndpoint::SetClientWritePending(TBool aVal)
+	{
+	iClientWritePending = aVal;
+	}
+
+
+TBool TUsbcEndpoint::ClientWritePending()
+	{
+	return iClientWritePending;
+	}
+
+
+void TUsbcEndpoint::SetRealEpNumber(TInt aRealEpNumber)
+	{
+	iRealEpNumber = aRealEpNumber;
+	iRequestCallbackInfo->iRealEpNum = aRealEpNumber;
+	}
+
+
+TInt TUsbcEndpoint::RealEpNumber() const
+	{
+	return iRealEpNumber;
+	}
+
+
+#endif // __USBC_INL__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/public/usbcdesc.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,360 @@
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// 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:
+// e32/include/drivers/usbcdesc.h
+// USB descriptors and their management.
+// 
+//
+
+/**
+ @file usbcdesc.h
+ @internalTechnology
+*/
+
+#ifndef __USBCDESC_H__
+#define __USBCDESC_H__
+
+#include <kernel/kernel.h>
+
+
+// Hard-wired positions of some descriptors in iDescriptors array (whether present or not):
+static const TInt KDescPosition_Device           = 0;
+static const TInt KDescPosition_DeviceQualifier  = 1;
+static const TInt KDescPosition_OtherSpeedConfig = 2;
+static const TInt KDescPosition_Config           = 3;
+static const TInt KDescPosition_Otg              = 4;
+static const TInt KDescPosition_FirstAvailable   = 5;
+
+// Hard-wired positions of string descriptors in iStrings array (whether present or not):
+static const TInt KStringPosition_Langid           = 0;
+static const TInt KStringPosition_Manufact         = 1;
+static const TInt KStringPosition_Product          = 2;
+static const TInt KStringPosition_Serial           = 3;
+static const TInt KStringPosition_Config           = 4;
+static const TInt KStringPosition_OtherSpeedConfig = 5;
+static const TInt KStringPosition_FirstAvailable   = 6;
+
+
+NONSHARABLE_CLASS(TUsbcDescriptorBase)
+    {
+public:
+    virtual ~TUsbcDescriptorBase();
+    void SetByte(TInt aPosition, TUint8 aValue);
+    void SetWord(TInt aPosition, TUint16 aValue);
+    TUint8 Byte(TInt aPosition) const;
+    TUint16 Word(TInt aPosition) const;
+    void GetDescriptorData(TDes8& aBuffer) const;
+    TInt GetDescriptorData(TUint8* aBuffer) const;
+    TInt GetDescriptorData(TUint8* aBuffer, TUint aMaxSize) const;
+    const TDes8& DescriptorData() const;
+    TDes8& DescriptorData();
+    TUint Size() const;
+    TUint8 Type() const;
+    virtual void UpdateFs();
+    virtual void UpdateHs();
+protected:
+    TUsbcDescriptorBase();
+    void SetBufferPointer(const TDesC8& aDes);
+private:
+#ifdef USB_SUPPORTS_SET_DESCRIPTOR_REQUEST
+    TUint8 iIndex;                                            // only needed for SET_DESCRIPTOR
+#endif
+    TPtr8 iBufPtr;
+    };
+
+
+NONSHARABLE_CLASS(TUsbcDeviceDescriptor) : public TUsbcDescriptorBase
+    {
+public:
+    /** aMaxPacketSize0 should be the Ep0 max packet size for FS operation (as the HS size
+        is fixed and known).
+    */
+    static TUsbcDeviceDescriptor* New(TUint8 aDeviceClass, TUint8 aDeviceSubClass,
+                                      TUint8 aDeviceProtocol, TUint8 aMaxPacketSize0,
+                                      TUint16 aVendorId, TUint16 aProductId,
+                                      TUint16 aDeviceRelease, TUint8 aNumConfigurations);
+    virtual void UpdateFs();
+    virtual void UpdateHs();
+private:
+    TUsbcDeviceDescriptor();
+    TInt Construct(TUint8 aDeviceClass, TUint8 aDeviceSubClass, TUint8 aDeviceProtocol,
+                   TUint8 aMaxPacketSize0, TUint16 aVendorId, TUint16 aProductId,
+                   TUint16 aDeviceRelease, TUint8 aNumConfigurations);
+    TBuf8<KUsbDescSize_Device> iBuf;
+    TUint8 iEp0Size_Fs;                                        // holds Ep0 size for FS (could be < 64)
+    };
+
+
+NONSHARABLE_CLASS(TUsbcDeviceQualifierDescriptor) : public TUsbcDescriptorBase
+    {
+public:
+    /** aMaxPacketSize0 should be the Ep0 max packet size for FS operation (as the HS size
+        is fixed and known).
+    */
+    static TUsbcDeviceQualifierDescriptor* New(TUint8 aDeviceClass, TUint8 aDeviceSubClass,
+                                               TUint8 aDeviceProtocol, TUint8 aMaxPacketSize0,
+                                               TUint8 aNumConfigurations, TUint8 aReserved=0);
+    virtual void UpdateFs();
+    virtual void UpdateHs();
+private:
+    TUsbcDeviceQualifierDescriptor();
+    TInt Construct(TUint8 aDeviceClass, TUint8 aDeviceSubClass, TUint8 aDeviceProtocol,
+                   TUint8 aMaxPacketSize0, TUint8 aNumConfigurations, TUint8 aReserved);
+    TBuf8<KUsbDescSize_DeviceQualifier> iBuf;
+    TUint8 iEp0Size_Fs;                                        // holds Ep0 size for FS (could be < 64)
+    };
+
+
+NONSHARABLE_CLASS(TUsbcConfigDescriptor) : public TUsbcDescriptorBase
+    {
+public:
+    /** aMaxPower should be given here in milliamps (not mA/2). */
+    static TUsbcConfigDescriptor* New(TUint8 aConfigurationValue, TBool aSelfPowered, TBool aRemoteWakeup,
+                                      TUint16 aMaxPower);
+private:
+    TUsbcConfigDescriptor();
+    TInt Construct(TUint8 aConfigurationValue, TBool aSelfPowered, TBool aRemoteWakeup, TUint16 aMaxPower);
+    TBuf8<KUsbDescSize_Config> iBuf;
+    };
+
+
+// The Other_Speed_Configuration descriptor has same size and layout as the
+// standard Configuration descriptor, therefore we don't need a new definition.
+typedef TUsbcConfigDescriptor TUsbcOtherSpeedConfigDescriptor;
+
+
+NONSHARABLE_CLASS(TUsbcInterfaceDescriptor) : public TUsbcDescriptorBase
+    {
+public:
+    static TUsbcInterfaceDescriptor* New(TUint8 aInterfaceNumber, TUint8 aAlternateSetting, TInt NumEndpoints,
+                                         const TUsbcClassInfo& aClassInfo);
+private:
+    TUsbcInterfaceDescriptor();
+    TInt Construct(TUint8 aInterfaceNumber, TUint8 aAlternateSetting, TInt aNumEndpoints,
+                   const TUsbcClassInfo& aClassInfo);
+    TBuf8<KUsbDescSize_Interface> iBuf;
+    };
+
+
+NONSHARABLE_CLASS(TUsbcEndpointDescriptorBase) : public TUsbcDescriptorBase
+    {
+public:
+    virtual void UpdateFs();
+    virtual void UpdateHs();
+protected:
+    TInt Construct(const TUsbcEndpointInfo& aEpInfo);
+    TUsbcEndpointDescriptorBase();
+protected:
+    /** Stores the endpoint size to be used for FS. */
+    TInt iEpSize_Fs;
+    /** Stores the endpoint size to be used for HS. */
+    TInt iEpSize_Hs;
+    /** Stores the endpoint polling interval to be used for FS. */
+    TInt iInterval_Fs;
+    /** Stores the endpoint polling interval to be used for HS. */
+    TInt iInterval_Hs;
+    };
+
+
+NONSHARABLE_CLASS(TUsbcEndpointDescriptor) : public TUsbcEndpointDescriptorBase
+    {
+public:
+    static TUsbcEndpointDescriptor* New(TUint8 aEndpointAddress, const TUsbcEndpointInfo& aEpInfo);
+private:
+    TUsbcEndpointDescriptor();
+    TInt Construct(TUint8 aEndpointAddress, const TUsbcEndpointInfo& aEpInfo);
+    TBuf8<KUsbDescSize_Endpoint> iBuf;
+    };
+
+
+class TUsbcAudioEndpointDescriptor : public TUsbcEndpointDescriptorBase
+    {
+public:
+    static TUsbcAudioEndpointDescriptor* New(TUint8 aEndpointAddress, const TUsbcEndpointInfo& aEpInfo);
+private:
+    TUsbcAudioEndpointDescriptor();
+    TInt Construct(TUint8 aEndpointAddress, const TUsbcEndpointInfo& aEpInfo);
+    TBuf8<KUsbDescSize_AudioEndpoint> iBuf;
+    };
+
+
+NONSHARABLE_CLASS(TUsbcOtgDescriptor) : public TUsbcDescriptorBase
+    {
+public:
+    static TUsbcOtgDescriptor* New(TBool aHnpSupport, TBool aSrpSupport);
+private:
+    TUsbcOtgDescriptor();
+    TInt Construct(TBool aHnpSupport, TBool aSrpSupport);
+    TBuf8<KUsbDescSize_Otg> iBuf;
+    };
+
+
+NONSHARABLE_CLASS(TUsbcClassSpecificDescriptor) : public TUsbcDescriptorBase
+    {
+public:
+    virtual ~TUsbcClassSpecificDescriptor();
+    static TUsbcClassSpecificDescriptor* New(TUint8 aType, TInt aSize);
+private:
+    TUsbcClassSpecificDescriptor();
+    TInt Construct(TUint8 aType, TInt aSize);
+    HBuf8* iBuf;
+    };
+
+
+NONSHARABLE_CLASS(TUsbcStringDescriptorBase)
+    {
+public:
+    virtual ~TUsbcStringDescriptorBase();
+    TUint16 Word(TInt aPosition) const;
+    void SetWord(TInt aPosition, TUint16 aValue);
+    TInt GetDescriptorData(TUint8* aBuffer) const;
+    TInt GetDescriptorData(TUint8* aBuffer, TUint aMaxSize) const;
+    const TDes8& StringData() const;
+    TDes8& StringData();
+    TUint Size() const;
+    void SetBufferPointer(const TDesC8& aDes);
+protected:
+    TUsbcStringDescriptorBase();
+    TBuf8<2> iSBuf;
+    TPtr8 iBufPtr;
+private:
+//    TUint8 iIndex;                                            // not needed in DescriptorPool: position == index
+    };
+
+
+NONSHARABLE_CLASS(TUsbcStringDescriptor) : public TUsbcStringDescriptorBase
+    {
+public:
+    virtual ~TUsbcStringDescriptor();
+    static TUsbcStringDescriptor* New(const TDesC8& aString);
+private:
+    TUsbcStringDescriptor();
+    TInt Construct(const TDesC8& aString);
+    HBuf8* iBuf;
+    };
+
+
+// Currently we support only one language, and thus there's no need to provide
+// a LangId string descriptor with more than one array element.
+NONSHARABLE_CLASS(TUsbcLangIdDescriptor) : public TUsbcStringDescriptorBase
+    {
+public:
+    virtual ~TUsbcLangIdDescriptor();
+    static TUsbcLangIdDescriptor* New(TUint16 aLangId);
+private:
+    TUsbcLangIdDescriptor();
+    TInt Construct(TUint16 aLangId);
+    TBuf8<2> iBuf;
+    };
+
+
+class TUsbcDescriptorPool
+    {
+public:
+    TUsbcDescriptorPool(TUint8* aEp0_TxBuf);
+    ~TUsbcDescriptorPool();
+    TInt Init(TUsbcDeviceDescriptor* aDeviceDesc, TUsbcConfigDescriptor* aConfigDesc,
+              TUsbcLangIdDescriptor* aLangId, TUsbcStringDescriptor* aManufacturer,
+              TUsbcStringDescriptor* aProduct, TUsbcStringDescriptor* aSerialNum,
+              TUsbcStringDescriptor* aConfig, TUsbcOtgDescriptor* aOtgDesc);
+    TInt InitHs();
+    TInt UpdateDescriptorsFs();
+    TInt UpdateDescriptorsHs();
+
+    // Descriptors
+    TInt FindDescriptor(TUint8 aType, TUint8 aIndex, TUint16 aLangid, TInt& aSize) const;
+    void InsertDescriptor(TUsbcDescriptorBase* aDesc);
+    void DeleteIfcDescriptor(TInt aNumber, TInt aSetting=0);
+    // The TC in many of the following functions stands for 'ThreadCopy' because that's what happens there.
+    TInt GetDeviceDescriptorTC(DThread* aThread, TDes8& aBuffer) const;
+    TInt SetDeviceDescriptorTC(DThread* aThread, const TDes8& aBuffer);
+    TInt GetConfigurationDescriptorTC(DThread* aThread, TDes8& aBuffer) const;
+    TInt SetConfigurationDescriptorTC(DThread* aThread, const TDes8& aBuffer);
+    TInt GetOtgDescriptorTC(DThread* aThread, TDes8& aBuffer) const;
+    TInt SetOtgDescriptor(const TDesC8& aBuffer);
+    TInt GetInterfaceDescriptorTC(DThread* aThread, TDes8& aBuffer, TInt aInterface, TInt aSetting) const;
+    TInt SetInterfaceDescriptor(const TDes8& aBuffer, TInt aInterface, TInt aSetting);
+    TInt GetEndpointDescriptorTC(DThread* aThread, TDes8& aBuffer, TInt aInterface, TInt aSetting,
+                                 TUint8 aEndpointAddress) const;
+    TInt SetEndpointDescriptorTC(DThread* aThread, const TDes8& aBuffer, TInt aInterface, TInt aSetting,
+                                 TUint8 aEndpointAddress);
+    TInt GetEndpointDescriptorSize(TInt aInterface, TInt aSetting, TUint8 aEndpointAddress, TInt& aSize) const;
+    TInt GetDeviceQualifierDescriptorTC(DThread* aThread, TDes8& aBuffer) const;
+    TInt SetDeviceQualifierDescriptorTC(DThread* aThread, const TDes8& aBuffer);
+    TInt GetOtherSpeedConfigurationDescriptorTC(DThread* aThread, TDes8& aBuffer) const;
+    TInt SetOtherSpeedConfigurationDescriptorTC(DThread* aThread, const TDes8& aBuffer);
+    TInt GetCSInterfaceDescriptorTC(DThread* aThread, TDes8& aBuffer, TInt aInterface, TInt aSetting) const;
+    TInt SetCSInterfaceDescriptorTC(DThread* aThread, const TDes8& aBuffer, TInt aInterface, TInt aSetting,
+                                    TInt aSize);
+    TInt GetCSInterfaceDescriptorSize(TInt aInterface, TInt aSetting, TInt& aSize) const;
+    TInt GetCSEndpointDescriptorTC(DThread* aThread, TDes8& aBuffer, TInt aInterface, TInt aSetting,
+                                   TUint8 aEndpointAddress) const;
+    TInt SetCSEndpointDescriptorTC(DThread* aThread, const TDes8& aBuffer, TInt aInterface, TInt aSetting,
+                                   TUint8 aEndpointAddress, TInt aSize);
+    TInt GetCSEndpointDescriptorSize(TInt aInterface, TInt aSetting, TUint8 aEndpointAddress, TInt& aSize) const;
+
+    // String descriptors
+    void SetIfcStringDescriptor(TUsbcStringDescriptor* aDesc, TInt aNumber, TInt aSetting=0);
+    TInt GetStringDescriptorLangIdTC(DThread* aThread, TDes8& aLangId) const;
+    TInt SetStringDescriptorLangId(TUint16 aLangId);
+    TInt GetManufacturerStringDescriptorTC(DThread* aThread, TDes8& aString) const;
+    TInt SetManufacturerStringDescriptorTC(DThread* aThread, const TDes8& aString);
+    TInt RemoveManufacturerStringDescriptor();
+    TInt GetProductStringDescriptorTC(DThread* aThread, TDes8& aString) const;
+    TInt SetProductStringDescriptorTC(DThread* aThread, const TDes8& aString);
+    TInt RemoveProductStringDescriptor();
+    TInt GetSerialNumberStringDescriptorTC(DThread* aThread, TDes8& aString) const;
+    TInt SetSerialNumberStringDescriptorTC(DThread* aThread, const TDes8& aString);
+    TInt RemoveSerialNumberStringDescriptor();
+    TInt GetConfigurationStringDescriptorTC(DThread* aThread, TDes8& aString) const;
+    TInt SetConfigurationStringDescriptorTC(DThread* aThread, const TDes8& aString);
+    TInt RemoveConfigurationStringDescriptor();
+    TInt GetStringDescriptorTC(DThread* aThread, TInt aIndex, TDes8& aString) const;
+    TInt SetStringDescriptorTC(DThread* aThread, TInt aIndex, const TDes8& aString);
+    TInt RemoveStringDescriptor(TInt aIndex);
+
+private:
+    // Descriptors
+    void InsertIfcDesc(TUsbcDescriptorBase* aDesc);
+    void InsertEpDesc(TUsbcDescriptorBase* aDesc);
+    TInt FindIfcDescriptor(TInt aIfcNumber, TInt aIfcSetting) const;
+    TInt FindEpDescriptor(TInt aIfcNumber, TInt aIfcSetting, TUint8 aEpAddress) const;
+    void DeleteDescriptors(TInt aIndex, TInt aCount = 1);
+    void UpdateConfigDescriptorLength(TInt aLength);
+    void UpdateConfigDescriptorNumIfcs(TInt aNumber);
+    void UpdateIfcNumbers(TInt aNumber);
+    TInt GetDeviceDescriptor(TInt aIndex) const;
+    TInt GetConfigurationDescriptor(TInt aIndex) const;
+    TInt GetOtgDescriptor() const;
+
+    // String descriptors
+    TInt GetStringDescriptor(TInt aIndex) const;
+    TInt GetDeviceStringDescriptorTC(DThread* aThread, TDes8& aString, TInt aIndex, TInt aPosition) const;
+    TInt SetDeviceStringDescriptorTC(DThread* aThread, const TDes8& aString, TInt aIndex, TInt aPosition);
+    TInt RemoveDeviceStringDescriptor(TInt aIndex, TInt aPosition);
+    void ExchangeStringDescriptor(TInt aIndex, const TUsbcStringDescriptor* aDesc);
+    TBool AnyStringDescriptors() const;
+    TBool StringDescriptorExists(TInt aIndex) const;
+    TInt FindAvailableStringPos() const;
+
+private:
+    // Data members
+    RPointerArray<TUsbcDescriptorBase> iDescriptors;
+    RPointerArray<TUsbcStringDescriptorBase> iStrings;
+    TInt iIfcIdx;
+    TUint8* const iEp0_TxBuf;                                // points to the controller's ep0 TX buffer
+    TBool iHighSpeed;                                        // true if currently operating at high-speed
+    };
+
+
+#endif    // __USBCDESC_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/public/usbcontrolxferif.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,60 @@
+/*
+  Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
+  All rights reserved.
+
+  This program and the accompanying materials are made available 
+  under the terms of the Eclipse Public License v1.0 which accompanies 
+  this distribution, and is available at 
+  http://www.eclipse.org/legal/epl-v10.html
+
+  Initial Contributors:
+  Nokia Corporation - initial contribution.
+
+  Contributors:
+*/
+
+#ifndef USBCONTROLXFERIF_H
+#define USBCONTROLXFERIF_H
+
+#include <e32def.h>                 // General types definition
+
+/** 
+ * Callback interfaces that used to process packet received from Host
+ * and interfaces through which that PIL or app can send request to PSL
+ */
+NONSHARABLE_CLASS(MControlTransferIf)
+    {
+    public:
+        // Interface for RX
+        // Transfer direction from Device to Host
+        // This two interface is saying PSL had finished
+        // sending those data to host.
+        virtual void ProcessDataInPacket(TInt aCount,TInt aErrCode) = 0;
+        virtual void ProcessStatusInPacket(TInt aErrCode) = 0;
+        
+        // Transfer direction from Host to Device
+        // they are saying that some data had been recieved from host
+        virtual void ProcessDataOutPacket(TInt aCount,TInt aErrCode) = 0;
+        virtual void ProcessStatusOutPacket(TInt aErrCode) = 0;
+        virtual void ProcessSetupPacket(TInt aCount,TInt aErrCode) = 0;
+        
+        // Interface for TX and Control
+        // Data/Status transfer function
+        virtual TInt ProcessSetupEndpointZeroRead() = 0;
+        virtual TInt ProcessSetupEndpointZeroWrite(const TUint8* aBuffer, TInt aLength, TBool aZlpReqd=EFalse) = 0;
+        virtual TInt ProcessSendEp0ZeroByteStatusPacket() = 0;
+        virtual TInt ProcessStallEndpoint(TInt aRealEndpoint) = 0;
+        
+        // Flow control interface
+        // In case of we can not deliver received packet(setup or data) to a registered client
+        // (because the request callback is not ready), we need PSL stop reporting more packet
+        // to PIL until the pending packet had been process.
+        // this 2 functions is used to notify PSL: you can continue, the pending packet is proceed.
+        virtual void ProcessEp0SetupPacketProceed() = 0;
+        virtual void ProcessEp0DataPacketProceed() = 0;
+    };
+
+#endif //USBCONTROLXFERIF_H
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/public/usbcque.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,147 @@
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// 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:
+// e32\include\drivers\usbcque.h
+// Simple singly linked list + its iterator for the USB Device driver.
+// 
+//
+
+/**
+ @file usbcque.h
+ @internalTechnology
+*/
+
+#ifndef __USBCQUE_H__
+#define __USBCQUE_H__
+
+#include <kernel/kernel.h>
+
+
+//
+// --- Class definitions ---
+//
+
+class TSglQueLink
+	{
+private:
+	void Enque(TSglQueLink* aLink);
+public:
+	TSglQueLink* iNext;
+	friend class TSglQueBase;
+	};
+
+
+class TSglQueBase
+	{
+protected:
+	TSglQueBase(TInt aOffset);
+	void DoAddLast(TAny* aPtr);
+	void DoRemove(TAny* aPtr);
+protected:
+	TSglQueLink* iHead;
+	TSglQueLink* iLast;
+	TInt iOffset;
+	TInt iElements;
+private:
+	friend class TSglQueIterBase;
+	};
+
+
+template<class T>
+class TSglQue : public TSglQueBase
+	{
+public:
+	inline TSglQue(TInt aOffset);
+	inline void AddLast(T& aRef);
+	inline void Remove(T& aRef);
+	inline TInt Elements() const;
+	};
+
+
+class TSglQueIterBase
+	{
+public:
+	void SetToFirst();
+protected:
+	TSglQueIterBase(TSglQueBase& aQue);
+	TAny* DoPostInc();
+	TAny* DoCurrent();
+protected:
+	TInt iOffset;
+	TSglQueLink*& iHead;
+	TSglQueLink* iNext;
+	};
+
+
+template<class T>
+class TSglQueIter : public TSglQueIterBase
+	{
+public:
+	inline TSglQueIter(TSglQueBase& aQue);
+	inline operator T*();
+	inline T* operator++(TInt);
+	};
+
+//
+// --- Inline implementations ---
+//
+
+// Class TSglQue
+template<class T>
+inline TSglQue<T>::TSglQue(TInt aOffset)
+	: TSglQueBase(aOffset)
+	{}
+
+
+template<class T>
+inline void TSglQue<T>::AddLast(T& aRef)
+	{
+	DoAddLast(&aRef);
+	}
+
+
+template<class T>
+inline void TSglQue<T>::Remove(T& aRef)
+	{
+	DoRemove(&aRef);
+	}
+
+
+template<class T>
+inline TInt TSglQue<T>::Elements() const
+	{
+	return iElements;
+	}
+
+
+// Class TSglQueIter
+template<class T>
+inline TSglQueIter<T>::TSglQueIter(TSglQueBase& aQue)
+	: TSglQueIterBase(aQue)
+	{}
+
+
+template<class T>
+inline TSglQueIter<T>::operator T*()
+	{
+	return ((T*)DoCurrent());
+	}
+
+template<class T>
+inline T* TSglQueIter<T>::operator++(TInt)
+	{
+	return ((T*)DoPostInc());
+	}
+
+
+#endif	// __USBCQUE_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/public/usbcsc.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,500 @@
+// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// 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:
+// e32\include\drivers\usbcsc.h
+// Kernel side definitions for the USB Device driver stack (PIL + LDD).
+// 
+//
+
+/**
+ @file usbcsc.h
+ @internalTechnology
+*/
+
+#ifndef __USBCSC_H__
+#define __USBCSC_H__
+
+#include <kernel/kernel.h>
+#include <kernel/kern_priv.h>
+#include <kernel/kpower.h>
+#include <platform.h>
+
+#include <usb/d32usbcsc.h>
+
+// #include <drivers/usbcshared.h>
+#include <usb/usbcshared.h>
+
+/** LDD Major version, This should agree with the information in RDevUsbcClient::TVer.
+*/
+const TInt KUsbcScMajorVersion = 0;
+
+/** LDD Minor version, This should agree with the information in RDevUsbcClient::TVer.
+*/
+const TInt KUsbcScMinorVersion = 1;
+
+/** LDD Build version, This should agree with the information in RDevUsbcClient::TVer.
+*/
+const TInt KUsbcScBuildVersion = KE32BuildVersionNumber;
+
+/** Must correspond to the max enum of TRequest + 1;
+    currently this is ERequestOtgFeaturesNotify = 10.
+*/
+const TInt KUsbcScMaxRequests = 11;
+
+// Request queue sizes need to be power of 2.
+
+/** The number of requests that can be queued on any IN endpoint */
+const TInt KUsbcScInRequests = 4;
+/** The number of requests that can be queued on any OUT endpoint */
+const TInt KUsbcScOutRequests = 2;
+
+/** In TUsbcScBuffer.iDirection, this indicates that the endpoint is an IN endpoint */
+const TInt KUsbcScIn =  0;
+/** In TUsbcScBuffer.iDirection, this indicates that the endpoint is an OUT endpoint */
+const TInt KUsbcScOut = 1;
+
+
+/** In TUsbcScBuffer.iDirection, this indicates that the endpoint is an Bidirectional endpoint
+currently operating as an IN endpoint */
+const TInt KUsbcScBiIn = 2;
+/** In TUsbcScBuffer.iDirection, this indicates that the endpoint is an Bidirectional endpoint
+currently operating as an OUT endpoint */
+const TInt KUsbcScBiOut = 3;
+
+/** The number of directions supported for endpoints, other then EP0.  Currently 2, IN and OUT. */
+const TInt KUsbcScDirections = 2;
+
+/** In TUsbcScBuffer::iDirection, this indicates that the endpoint direction is Unknown. */
+const TInt KUsbcScUnknown = 4;
+
+const TInt KPageSize = 0x1000;
+
+/** The default buffer size requested for a endpoint, if the user app does not specify a size.*/
+const TInt KUsbcScDefaultBufferSize = 0x10000; // 64k
+
+/** The size of the unmapped region of memory between endpoint buffers.
+This serves as a guard region, making memory over/under runs more obviose.*/
+const TInt KGuardSize = KPageSize;
+
+/** The size put aside for the chunk header structre.*/
+const TInt KHeaderSize = KPageSize;
+
+/** For buffers of size >= KUsbScBigBuffIs, The smallest unit of continiouse memory that will be used.
+No read will be set up smaller then this, to avoid overly fragmenting the data.
+*/
+const TInt KUsbSc_BigBuff_MinimumRamRun = KPageSize;
+
+/** For buffers of size < KUsbScBigBuffIs, The smallest unit of continiouse memory that will be used.
+No read will be set up smaller then this, to avoid overly fragmenting the data.*/
+const TInt KUsbSc_SmallBuff_MinimumRamRun = 1024;
+
+/** The size a buffer request has to be to switch to using KUsbSc_BigBuff_MinimumRamRun.
+If the requested buffer is smaller, then the smallest memory allocated to a buffer is KPageSize*/
+const TInt KUsbScBigBuffIs = KPageSize*6;
+
+
+
+// EP0 is mapped manually, unlike the other endpoints.
+
+/** The position, within the chunk, that the EP0 IN buffer appears*/
+const TInt KUsbScEP0InBufPos = 0x800;
+/** The position, within the chunk, that the EP0 IN buffer ends*/
+const TInt KUsbScEP0InBufEnd = KUsbScEP0InBufPos + 0x400;
+
+// Its better for Out to go 2nd, so gaurd page after it.
+/** The position, within the chunk, that the EP0 OUT buffer appears*/
+const TInt KUsbScEP0OutBufPos = 0xc00;
+/** The position, within the chunk, that the EP0 OUT buffer ends*/
+const TInt KUsbScEP0OutBufEnd = KUsbScEP0OutBufPos + 0x400;
+
+/** The number of the entry within the chunk BufferRecord table, for the OUT ep0 buffer.*/
+const TInt KUsbcScEp0OutBuff = 0;
+/** The number of the entry within the chunk BufferRecord table, for the IN ep0 buffer.*/
+const TInt KUsbcScEp0InBuff = 1;
+
+
+//
+//########################### Logical Device Driver (LDD) #############################
+//
+
+/** USB LDD factory class.
+*/
+class DUsbcScLogDevice : public DLogicalDevice
+    {
+public:
+    DUsbcScLogDevice();
+    virtual TInt Install();
+    virtual void GetCaps(TDes8& aDes) const;
+    virtual TInt Create(DLogicalChannelBase*& aChannel);
+    };
+
+
+class DLddUsbcScChannel;
+class TUsbcScBuffer;
+/** Endpoint tracking for the LDD buffering etc.
+*/
+class TUsbcScEndpoint
+    {
+public:
+    TUsbcScEndpoint(DLddUsbcScChannel* aLDD, DUsbClientController* aController,
+                  const TUsbcScEndpointInfo* aEndpointInfo, TInt aEndpointNum
+                  );
+    ~TUsbcScEndpoint();
+    TInt Construct();
+    void CancelTransfer(DThread* aThread);
+    void AbortTransfer();
+    inline TUsbcScEndpointInfo* EndpointInfo();
+    inline TInt RxBytesAvailable() const;
+    inline void ResetTransferInfo();
+    inline void SetClientReadPending(TBool aVal);
+    inline void SetClientWritePending(TBool aVal);
+    inline TBool ClientWritePending();
+    inline TBool ClientReadPending();
+    inline void SetRealEpNumber(TInt aRealEpNumber);
+    inline TInt RealEpNumber() const;
+    inline TInt EpNumber() const;
+    inline void StartBuffer();
+    inline void SetBuffer(TUsbcScBuffer* aBuffer);
+    inline TUsbcScBuffer* GetBuffer();
+
+
+private:
+    static void RequestCallback(TAny* aTUsbcScEndpoint);
+    void TxComplete();
+    TInt RxComplete(TBool aReEntrant);
+    void RxCompleteNow();
+
+
+
+public:
+    TUsbcRequestCallback* iRequestCallbackInfo;
+
+private:
+    DUsbClientController* iController;
+    TUsbcScEndpointInfo iEndpointInfo;
+    TBool iClientReadPending;
+    TBool iClientWritePending;
+    TInt iEndpointNumber;
+    TInt iRealEpNumber;
+    DLddUsbcScChannel* iLdd;
+    TInt iError;
+    TUint32 iBytesTransferred;
+    TInt iBandwidthPriority;
+    TUsbcScBuffer* iBuffer;
+
+    };
+
+
+/** Linked list of 'alternate setting' info for use by the LDD.
+*/
+class TUsbcScAlternateSetting
+    {
+public:
+    TUsbcScAlternateSetting();
+    ~TUsbcScAlternateSetting();
+
+public:
+    TUsbcScAlternateSetting* iNext;
+    TUsbcScAlternateSetting* iPrevious;
+    TInt iNumberOfEndpoints;
+    TUint iSetting;
+    TUsbcScEndpoint* iEndpoint[KMaxEndpointsPerClient + 1];
+    };
+
+class TUsbcScAlternateSettingList
+    {
+public:
+    TUsbcScAlternateSettingList();
+    ~TUsbcScAlternateSettingList();
+
+public:
+    TUsbcScAlternateSetting* iHead;
+    TUsbcScAlternateSetting* iTail;
+    };
+
+class TUsbcScChunkInfo
+    {
+public:
+    TUsbcScChunkInfo(DLogicalDevice* aLdd);
+    TInt CreateChunk(TInt aTotalSize);
+    void Close();
+    TInt ChunkAlloc(TInt aOffset, TInt aSize);
+    void ChunkCleanup();
+    TInt GetPhysical(TInt aOffset, TPhysAddr* aPhysical);
+    static TInt New(TUsbcScChunkInfo*& aChunk, TInt aSize, DLogicalDevice* aLdd);
+private:
+    TUint* iPhysicalMap;
+public:
+    DChunk* iChunk;
+    TDfc iCleanup;
+
+    TInt8 iPageNtz; // Number of trailing zeros for a page. (Eg 4k page has 12 t.z.)
+    TInt iAllocatedSize;
+    TInt8* iChunkMem;
+    TUint32 iChunkMapAttr;
+    DLogicalDevice* iLdd;
+    };
+
+
+// Used to represent a matrix of endpoints with a column of sizes.
+// Used by TRealizeInfo
+
+class TEndpointSortBufs
+    {
+    public:
+        TUsbcScEndpoint** iEp;
+        TInt* iSizes;
+        TInt iEps;
+    };
+
+// This is used to calculate the layout of the shared chunk
+// based on a list of alternative settings / endpoints provided.
+ 
+class TRealizeInfo
+    {
+    public:
+        void Init(TUsbcScAlternateSettingList* aAlternateSettingList);
+        TInt CopyAndSortEndpoints();
+        void CalcBuffSizes();
+        void Free();
+
+        void LayoutChunkHeader(TUsbcScChunkInfo* aChunkInfo);
+    public:
+        TInt iMaxEndpoints;
+        TInt iTotalSize;
+        TInt iTotalBuffers;
+        TInt iAltSettings;
+        TEndpointSortBufs iBufs[KUsbcScDirections];
+        TUsbcScAlternateSettingList* iAlternateSettingList;
+
+        // Chunk layout info.
+        TUsbcScChunkBuffersHeader* iChunkStuct;
+        TUsbcScChunkAltSettingHeader* iAltSettingsTbl;
+    };
+
+
+
+/** The channel class - the actual USB LDD.
+*/
+class DLddUsbcScChannel : public DLogicalChannel
+    {
+public:
+    DLddUsbcScChannel();
+    ~DLddUsbcScChannel();
+    virtual void HandleMsg(TMessageBase* aMsg);
+    virtual TInt DoCreate(TInt aUnit, const TDesC8* aInfo, const TVersion& aVer);
+    virtual TInt RequestUserHandle(DThread* aThread, TOwnerType aType);
+    inline DThread* Client() const {return iClient;}
+    inline TBool ChannelClosing() const {return iChannelClosing;}
+    inline TUint AlternateSetting() const {return iAlternateSetting;}
+    
+    static void RequestCallbackEp0(TAny* aTUsbcScChannel);
+
+private:
+
+    TInt DoCancel(TInt aReqNo, TUint aMask, TUint a1);
+    TInt DoRequest(TInt aReqNo, TRequestStatus* aStatus, TAny* a1, TAny* a2);
+    TInt DoControl(TInt aFunction, TAny* a1, TAny* a2);
+    TInt DoReadDataNotify(TRequestStatus* aStatus, TInt aBufferNum, TInt aLength);
+    void StartDataRead(TInt aBufferNum);
+    TInt DoWriteData(TRequestStatus* aStatus,TInt aBufferNum, TUint aStart, TUint aLength, TUint aFlags);
+    TBool AlternateDeviceStateTestComplete();
+    TInt SetInterface(TInt aInterfaceNum, TUsbcScIfcInfo* aUserInterfaceInfoBuf);
+    void StartEpReads();
+    void DestroyAllInterfaces();
+    void DestroyInterface(TUint aInterface);
+    void DestroyEp0();
+    inline TBool ValidEndpoint(TInt aEndpoint);
+    TInt GetRealEpForEpResource(TInt aEndpoint, TInt& aRealEp);
+    inline TBool Configured();
+    TInt DoEmergencyComplete();
+    void ReadDes8(const TAny* aPtr, TDes8& aDes);
+    TInt SetupEp0();
+    void CancelNotifyEndpointStatus();
+    void CancelNotifyOtgFeatures();
+    static void StatusChangeCallback(TAny* aDLddUsbcChannel);
+    static void EndpointStatusChangeCallback(TAny* aDLddUsbcChannel);
+    static void OtgFeatureChangeCallback(TAny* aDLddUsbcChannel);
+    static void EmergencyCompleteDfc(TAny* aDLddUsbcChannel);
+    void DeConfigure(TInt aErrorCode);
+    TInt SelectAlternateSetting(TUint aAlternateSetting);
+    TInt EpFromAlternateSetting(TUint aAlternateSetting, TInt aEndpoint);
+    TInt ProcessAlternateSetting(TUint aAlternateSetting);
+    TInt32 StartNextInAlternateSetting();
+    TInt ProcessDeviceState(TUsbcDeviceState aDeviceState);
+    void ResetInterface(TInt aErrorCode);
+    void PanicClientThread(TInt aReason);
+
+    TInt RealizeInterface(void);
+
+private:
+    DUsbClientController* iController;
+    DThread* iClient;
+    TBool iValidInterface;
+    
+    TUsbcScAlternateSettingList* iAlternateSettingList;
+    TUsbcScEndpoint** iEndpoint;  // Pointer to the current endpoint set.
+
+    static const TInt KUsbcMaxRequests = RDevUsbcScClient::ERequestMaxRequests;
+    TRequestStatus* iRequestStatus[KUsbcMaxRequests];
+    TUsbcClientCallback iCompleteAllCallbackInfo;
+    TAny* iStatusChangePtr;
+    TUsbcStatusCallback iStatusCallbackInfo;
+    TAny* iEndpointStatusChangePtr;
+    TUsbcEndpointStatusCallback iEndpointStatusCallbackInfo;
+    TAny* iOtgFeatureChangePtr;
+    TUsbcOtgFeatureCallback iOtgFeatureCallbackInfo;
+    TUint8* iBufferBaseEp0;
+    TInt iBufferSizeEp0;
+    TInt iNumberOfEndpoints;
+    TUsbcDeviceState iDeviceState;
+    TUsbcDeviceState iOldDeviceState;
+    TBool iOwnsDeviceControl;
+    TUint16 iAlternateSetting;
+    TUint16 iAsSeq;
+
+    TUsbcDeviceStatusQueue* iStatusFifo;
+    TBool iUserKnowsAltSetting;
+    TBool iDeviceStatusNeeded;
+    TBool iChannelClosing;
+    TBool iRealizeCalled;
+
+    TUsbcScChunkInfo* iChunkInfo;
+    TInt iNumBuffers;
+    TUsbcScBuffer *iBuffers;
+
+    TUsbcScEndpoint* iEp0Endpoint;
+    TInt iEP0InBuff;
+    TInt iEP0OutBuff;
+
+    friend class TUsbcScBuffer;
+    friend void TUsbcScEndpoint::AbortTransfer();
+    };
+
+/**
+This class is used by TUsbcScStatusList to form a queue of status requests.
+These requests are on a buffer basis, so that all buffers can have at least two requests
+pending, at the same time. (i.e. buffer 1 could have two requests outstanding, as well as 2 on buffer 2.)
+*/
+
+class TUsbcScStatusElement
+{
+public:
+    TRequestStatus* iStatus;
+    TInt iLength;
+    TUint iStart;
+    TUint iFlags;    
+};
+
+enum TUsbcScStatusState
+{
+    ENotRunning,
+    EInProgress,
+    EReadingAhead,
+    EFramgementInProgress
+};
+
+class TUsbcScStatusList
+{
+public:
+    TInt Construct(TInt aSize, DThread* aThread);
+    void Destroy();
+
+    TUsbcScStatusElement* Next();
+    void Pop();
+    TInt Add(TRequestStatus* aStatus, TInt aLength, TUint aStart, TUint aFlags);
+    void CancelQueued(TInt aErrorCode=KErrCancel);
+    TInt Complete(TInt aError);
+    void Complete();
+public:
+    TUsbcScStatusState iState;
+
+private:
+    DThread* iClient;
+    TInt iHead;   // The element at the head of the queue, ie, the earliest added, and next to be removed.
+    TInt iLength; // Length of queue, ie number of elements within
+    TInt iSize;   // size of array, ie, max # of requests at a time.
+    TUsbcScStatusElement* iElements;
+
+};
+
+
+
+/**
+This class holds the kernel's copy of all the details related to a shared endpoint buffer,
+and provides methods for the LDD to manipulate it.
+*/
+class TUsbcScBuffer
+{
+public:
+    static const TInt8 KNoEpAssigned=0;
+    static const TInt8 KEpIsEnding=1;
+    static const TInt8 KEpIsStarting=2;
+
+public:
+    TInt Construct(TInt aDirection, DLddUsbcScChannel* aLdd, TInt aBufferOffset, TInt aBufferEndOffset, TInt aMinReadSize, TInt aMaxPacketSize, TInt aMaxReadSize);
+    void CreateChunkBufferHeader();
+    void StartEndpoint(TUsbcRequestCallback* iRequestInfo, TUint iFlags);
+
+    void Destroy();
+
+    TInt StartDataRead();
+    void CompleteRead(TBool aStartNextRead=ETrue);
+    void PopStall();
+    void StartDataWrite();
+    void CompleteWrite();
+    void Cancel(TInt aErrorCode);
+
+    void UpdateBufferList(TInt aByteCount,TUint aFlags, TBool aStartNextRead=ETrue);
+    void Ep0CancelLddRead();
+    void SendEp0StatusPacket(TInt aState);
+
+public:
+    
+    TInt8 iDirection;
+    TInt8 iMode;
+    TInt8 iNeedsPacket;
+    TInt8 iReserved;
+    DLddUsbcScChannel* iLdd;
+    TLinAddr iChunkAddr;
+    SUsbcScBufferHeader* iBufferStart;
+    TUint iBufferEnd; // One word on from the last word in the buffer.
+    TUint iAlignMask;
+    TUsbcScStatusList iStatusList;
+    TUsbcRequestCallback* iCallback;
+    union 
+    {
+        TInt iHead; // Out endpoints only;
+        TUint iSent; // In endpoints only
+    };
+    TUsbcScChunkInfo* iChunkInfo;
+    TInt iMinReadSize;
+    TInt iMaxReadSize;
+    TInt iMaxPacketSize;  // 0 indicates unconfiured.
+    TInt iFirstPacket;
+    TInt iStalled;
+
+    // needed for backwards compatibility
+    TUsbcPacketArray iIndexArray[KUsbcDmaBufNumMax]; // Has 2 elements
+    TUsbcPacketArray iSizeArray[KUsbcDmaBufNumMax];  // Has 2 elements
+#ifdef _DEBUG
+    TUint iSequence;
+#endif
+
+};
+
+
+
+#include <usb/usbcsc.inl>
+
+#endif    // __USBCSC_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/public/usbcsc.inl	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,107 @@
+// 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 the License "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:
+// e32\include\drivers\usbcsc.inl
+// Kernel side inline header file for USB device driver.
+// 
+//
+
+/**
+ @file usbcsc.inl
+ @internalTechnology
+*/
+
+#ifndef __USBCSC_INL__
+#define __USBCSC_INL__
+ 
+
+//
+// --- USB Logical Device Driver (LDD) ---
+//
+
+TUsbcScEndpointInfo* TUsbcScEndpoint::EndpointInfo()
+	{
+	return &iEndpointInfo;
+	}
+
+
+void TUsbcScEndpoint::SetClientReadPending(TBool aVal)
+	{
+	iClientReadPending = aVal;
+	}
+
+
+TBool TUsbcScEndpoint::ClientReadPending()
+	{
+	return iClientReadPending;
+	}
+
+
+void TUsbcScEndpoint::SetClientWritePending(TBool aVal)
+	{
+	iClientWritePending = aVal;
+	}
+
+
+TBool TUsbcScEndpoint::ClientWritePending()
+	{
+	return iClientWritePending;
+	}
+
+
+void TUsbcScEndpoint::SetRealEpNumber(TInt aRealEpNumber)
+	{
+	iRealEpNumber = aRealEpNumber;
+	iRequestCallbackInfo->iRealEpNum = aRealEpNumber;
+	}
+
+
+TInt TUsbcScEndpoint::RealEpNumber() const
+	{
+	return iRealEpNumber;
+	}
+TInt TUsbcScEndpoint::EpNumber() const
+	{
+	return iEndpointNumber;
+	}
+void TUsbcScEndpoint::StartBuffer()
+	{
+	iBuffer->StartEndpoint(iRequestCallbackInfo, iEndpointInfo.iFlags);
+	}
+
+void TUsbcScEndpoint::SetBuffer(TUsbcScBuffer* aBuffer)
+	{
+		__ASSERT_ALWAYS(iBuffer==NULL, Kern::Fault("TUsbcScEndpoint::SetBuffer", __LINE__));
+		iBuffer = aBuffer;
+	}
+
+TUsbcScBuffer* TUsbcScEndpoint::GetBuffer()
+	{
+		__ASSERT_DEBUG(iBuffer!=NULL, Kern::Fault("TUsbcScEndpoint::GetBuffer", __LINE__));
+	return iBuffer;
+	}
+
+inline TBool DLddUsbcScChannel::ValidEndpoint(TInt aEndpoint)
+	{
+	return (aEndpoint <= iNumberOfEndpoints && aEndpoint >= 0);
+	}
+
+inline TBool DLddUsbcScChannel::Configured()
+	{
+	if (iValidInterface && 
+		(iDeviceState == UsbShai::EUsbPeripheralStateConfigured || iDeviceState == UsbShai::EUsbPeripheralStateSuspended))
+		return ETrue;
+	return EFalse;
+	}
+
+#endif // __USBCSC_INL__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/public/usbcshared.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,997 @@
+// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// 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:
+// e32\include\drivers\usbcshared.h
+// Kernel side definitions for the USB Device driver stack (PIL + LDD).
+// 
+//
+
+/**
+ @file usbcshared.h
+ @internalTechnology
+*/
+
+#ifndef __USBCSHARED_H__
+#define __USBCSHARED_H__
+
+//#include <drivers/usbcque.h>
+#include <usb/usbcque.h>
+
+// Define here what options are required:
+// (USB_SUPPORTS_CONTROLENDPOINTS and USB_SUPPORTS_SET_DESCRIPTOR_REQUEST
+//  have never been tested though...)
+//#define USB_SUPPORTS_CONTROLENDPOINTS
+//#define USB_SUPPORTS_SET_DESCRIPTOR_REQUEST
+
+//#include <drivers/usbcdesc.h>
+#include <usb/usbcdesc.h>
+//#include <drivers/usbotgperipheralcontrolif.h>
+#include <usb/usbotgperipheralcontrolif.h>
+
+#include <usb/usb_peripheral_shai.h>
+#include <usb/usb_charger_detection_shai.h>
+
+#include <usb/usbcontrolxferif.h>
+
+// FIXME: Remove this typedef once PIL and LDD are ready for SHAI
+typedef UsbShai::TUsbPeripheralEvent TUsbcDeviceEvent;
+typedef UsbShai::TUsbPeripheralPacketArray TUsbcPacketArray;
+
+// Forward declaration
+class DControlTransferManager;
+class TUsbcSetup;
+
+// Debug Support
+
+// Use for debugging purposes only (commented out for normal operation):
+//#define USBC_LDD_BUFFER_TRACE
+
+static const char KUsbPILPanicCat[] = "USB PIL FAULT"; // kernel fault category
+_LIT(KUsbPILKillCat, "USB PIL KILL");                    // thread kill category
+_LIT(KUsbLDDKillCat, "USB LDD KILL");                    // thread kill category
+
+/** Error code for stalled endpoint.
+*/
+const TInt KErrEndpointStall = KErrLocked;
+
+/** Error code for Ep0 write prematurely ended by a host OUT token.
+*/
+const TInt KErrPrematureEnd = KErrDiskFull;
+
+/** The following constants control the buffer arrangement for OUT transfers (IN transfers have only 1
+    buffer). The total size of buffering for an OUT endpoint will be number of buffers * buffersize,
+    so that, for example, a Bulk OUT endpoint will have KUsbcDmaBufNumBulk * KUsbcDmaBufSzBulk bytes of
+    buffering.
+    These buffers will be physically contiguous, so that DMA may be used.
+    The number of buffers MUST be >=2 - otherwise the buffering scheme won't work.
+    The buffer sizes should be an exact fraction of 4kB and the number of buffers such that the
+    buffersize * number of buffers is an exact multiple of 4kB, otherwise memory will be wasted.
+*/
+/** Size of a Control ep buffer.
+*/
+const TInt KUsbcDmaBufSzControl = 1024;
+
+/** Size of a Bulk ep buffer.
+*/
+const TInt KUsbcDmaBufSzBulk = 4096;
+
+/** Size of an Interrupt ep buffer.
+*/
+const TInt KUsbcDmaBufSzInterrupt = 4096;
+
+/** Size of an Isochronous ep buffer.
+*/
+const TInt KUsbcDmaBufSzIsochronous = 4096;
+
+/** Number of buffers for Control OUT endpoints.
+*/
+const TInt KUsbcDmaBufNumControl = 2;
+
+/** Number of buffers for Isochronous OUT endpoints.
+*/
+const TInt KUsbcDmaBufNumIsochronous = 2;
+
+/** Number of buffers for Bulk OUT endpoints.
+*/
+const TInt KUsbcDmaBufNumBulk = 2;
+
+/** Number of buffers for Interrupt OUT endpoints.
+*/
+const TInt KUsbcDmaBufNumInterrupt = 2;
+
+/** Maximum buffer number.
+*/
+const TInt KUsbcDmaBufNumMax = MAX4(KUsbcDmaBufNumControl, KUsbcDmaBufNumIsochronous,
+                                    KUsbcDmaBufNumBulk, KUsbcDmaBufNumInterrupt);
+
+/** Maximum number of recorded packets possible.
+*/
+const TUint KUsbcDmaBufMaxPkts = 2;
+
+/** Number of arrays.
+*/
+const TInt KUsbcDmaBufNumArrays = 2;
+
+/** Max size that Ep0 packets might have.
+*/
+const TInt KUsbcBufSzControl = 64;
+
+/** The Ep0 RX data collection buffer area.
+    (Arbitrary size, judged to be sufficient for SET_DESCRIPTOR requests)
+*/
+const TInt KUsbcBufSz_Ep0Rx = 1024;
+
+/** The Ep0 TX buffer area.
+    (Size sufficient to hold as much data as can be requested via GET_DESCRIPTOR)
+*/
+const TInt KUsbcBufSz_Ep0Tx = 1024 * 64; 
+
+
+/** The USB version the stack is compliant with: 2.0 (BCD).
+*/
+const TUint16 KUsbcUsbVersion = 0x0200;
+
+/** Maximum number of endpoints an interface (i.e. LDD) may have.
+*/
+const TInt KUsbcMaxEpNumber = 5;
+
+/** Status FIFO depth; enough for 2 complete configs.
+*/
+const TInt KUsbDeviceStatusQueueDepth = 15;
+
+/** = 'no status info'.
+*/
+const TUint32 KUsbDeviceStatusNull = 0xffffffffu;
+
+/** = 'no buffer available'.
+*/
+const TInt KUsbcInvalidBufferIndex = -1;
+
+/** = 'no packet available'.
+*/
+const TUint KUsbcInvalidPacketIndex = (TUint)(-1);
+
+/** = 'no drainable buffers'.
+*/
+const TInt KUsbcInvalidDrainQueueIndex = -1;
+
+/** Number of possible bandwidth priorities.
+*/
+const TInt KUsbcDmaBufMaxPriorities = 4;
+
+// The following buffer sizes are used within the LDD for the different
+// user-selectable endpoint bandwidth priorities
+// (EUsbcBandwidthOUTDefault/Plus1/Plus2/Maximum + the same for 'IN').
+// These values, in particular those for the Maximum setting, were obtained
+// empirically.
+
+/** Bulk IN buffer sizes for different priorities (4K, 16K, 64K, 512K).
+*/
+const TInt KUsbcDmaBufSizesBulkIN[KUsbcDmaBufMaxPriorities] =
+    {KUsbcDmaBufSzBulk, 0x4000, 0x10000, 0x80000};
+
+/** Bulk OUT buffer sizes for different priorities (4K, 16K, 64K, 512K).
+*/
+const TInt KUsbcDmaBufSizesBulkOUT[KUsbcDmaBufMaxPriorities] =
+    {KUsbcDmaBufSzBulk, 0x4000, 0x10000, 0x80000};
+
+/** Number of UDCs supported in the system.
+    (Support for more than one UDC is preliminary.)
+*/
+const TInt KUsbcMaxUdcs = 2;
+
+/** Number of endpoints a USB device can have.
+    (30 regular endpoints + 2 x Ep0)
+*/
+const TInt KUsbcEpArraySize = KUsbcMaxEndpoints + 2;
+
+/** Number of notification requests of the same kind that can be registered at
+    a time. As normally not more than one request per kind per LDD is
+    permitted, this number is roughly equivalent to the maximum number of LDDs
+    that can be operating at the same time.
+    This constant is used by the PIL while maintaining its request lists
+    (iClientCallbacks, iStatusCallbacks, iEpStatusCallbacks, iOtgCallbacks) to
+    ensure that the lists are of a finite length and thus the list traverse
+    time is bounded.
+    This value is chosen with the maximum number of USB interfaces (not
+    settings) allowed by the spec for a single device in mind.
+*/
+const TInt KUsbcMaxListLength = 256;
+
+/**
+ * device event FIFO depth, there are 5 different event define currently,
+ * 10 should be enough
+ */
+const TInt KUsbDeviceEventQueueDepth = 10;
+
+/** USB LDD client callback.
+*/
+class TUsbcClientCallback
+    {
+public:
+    inline TUsbcClientCallback(DBase* aOwner, TDfcFn aCallback, TInt aPriority);
+    inline DBase* Owner() const;
+    inline TInt DoCallback();
+    inline void Cancel();
+    inline void SetDfcQ(TDfcQue* aDfcQ);
+public:
+    /** Used by the PIL to queue callback objects into a TSglQue. */
+    TSglQueLink iLink;
+private:
+    DBase* iOwner;
+    TDfc iDfc;
+    };
+
+
+/** The endpoint halt/clear_halt status.
+*/
+class TUsbcEndpointStatusCallback
+    {
+public:
+    inline TUsbcEndpointStatusCallback(DBase* aOwner, TDfcFn aCallback, TInt aPriority);
+    inline void SetState(TUint aState);
+    inline TUint State() const;
+    inline DBase* Owner() const;
+    inline TInt DoCallback();
+    inline void Cancel();
+    inline void SetDfcQ(TDfcQue* aDfcQ);
+public:
+    /** Used by the PIL to queue callback objects into a TSglQue. */
+    TSglQueLink iLink;
+private:
+    DBase* iOwner;
+    TDfc iDfc;
+    TUint iState;
+    };
+
+
+/** Maximum number of device status requests that can be queued at a time.
+    The value chosen is thought to be sufficient in all situations.
+*/
+const TInt KUsbcDeviceStateRequests = 8;
+
+        
+/** The USB device status.
+*/
+class TUsbcStatusCallback
+    {
+public:
+    inline TUsbcStatusCallback(DBase* aOwner, TDfcFn aCallback, TInt aPriority);
+    inline void SetState(UsbShai::TUsbPeripheralState aState);
+    inline UsbShai::TUsbPeripheralState State(TInt aIndex) const;
+    inline void ResetState();
+    inline DBase* Owner() const;
+    inline TInt DoCallback();
+    inline void Cancel();
+    inline void SetDfcQ(TDfcQue* aDfcQ);
+public:
+    /** Used by the PIL to queue callback objects into a TSglQue. */
+    TSglQueLink iLink;
+private:
+    DBase* iOwner;
+    TDfc iDfc;
+    UsbShai::TUsbPeripheralState iState[KUsbcDeviceStateRequests];
+    };
+
+
+/** A USB transfer request.
+
+    @publishedPartner
+    @released
+*/
+class TUsbcRequestCallback : public UsbShai::TUsbPeripheralRequest
+    {
+public:
+    /** @internalTechnology */
+    inline TUsbcRequestCallback(const DBase* aOwner, TInt aEndpointNum, TDfcFn aDfcFunc,
+                         TAny* aEndpoint, TDfcQue* aDfcQ, TInt aPriority);
+    /** @internalTechnology    */
+    inline ~TUsbcRequestCallback();
+    
+    IMPORT_C void SetRxBufferInfo(TUint8* aBufferStart,
+                                      TUintPtr aBufferAddr,
+                                      TUint32* aPacketIndex,
+                                      TUint32* aPacketSize, 
+                                      TInt aLength);
+                                    
+    IMPORT_C void SetTxBufferInfo(TUint8* aBufferStart, 
+                                      TUintPtr aBufferAddr,
+                                      TInt aLength);
+                                        
+    /** @internalTechnology    */
+    inline void SetTransferDirection(UsbShai::TTransferDirection aTransferDir);
+    /** @internalTechnology    */
+    inline const DBase* Owner() const;
+    /** @internalTechnology    */
+    inline TInt DoCallback();
+    /** @internalTechnology    */
+    inline void Cancel();
+public:
+    /** Used by the PIL to queue callback objects into a TSglQue.
+        @internalTechnology
+    */
+    TSglQueLink iLink;
+public:
+    /** The endpoint number. */
+    const TInt iEndpointNum;
+
+    /** Indicates the LDD client for this transfer. */
+    const DBase* const iOwner;
+    /** DFC, used by PIL to call back the LDD when transfer completes to the LDD. */
+    TDfc iDfc;
+    };
+
+/** USB On-The-Go feature change callback.
+*/
+class TUsbcOtgFeatureCallback
+    {
+public:
+    inline TUsbcOtgFeatureCallback(DBase* aOwner, TDfcFn aCallback, TInt aPriority);
+    inline void SetFeatures(TUint8 aFeatures);
+    inline TUint8 Features() const;
+    inline DBase* Owner() const;
+    inline TInt DoCallback();
+    inline void Cancel();
+    inline void SetDfcQ(TDfcQue* aDfcQ);
+public:
+    /** Used by the PIL to queue callback objects into a TSglQue. */
+    TSglQueLink iLink;
+private:
+    DBase* iOwner;
+    TDfc iDfc;
+    TUint8 iValue;
+    };
+
+//
+//########################### Physical Device Driver (PIL + PSL) ######################
+//
+
+class TUsbcLogicalEndpoint;
+
+/** This models a physical (real) endpoint of the UDC.
+*/
+class TUsbcPhysicalEndpoint
+    {
+public:
+    TUsbcPhysicalEndpoint();
+    ~TUsbcPhysicalEndpoint();
+    TBool EndpointSuitable(const TUsbcEndpointInfo* aEpInfo, TInt aIfcNumber) const; // Check Todo, SC will pass pointer to derived class
+    TInt TypeAvailable(TUint aType) const;
+    TInt DirAvailable(TUint aDir) const;
+public:
+    /** This endpoint's capabilities. */
+    UsbShai::TUsbPeripheralEndpointCaps iCaps;
+    /** USB address: 0x00, 0x80, 0x01, 0x81, etc. */
+    TUint8 iEndpointAddr;
+    /** Pointer to interface # this endpoint has been assigned to. */
+    const TUint8* iIfcNumber;
+    /** Pointer to corresponding logical endpoint or NULL. */
+    const TUsbcLogicalEndpoint* iLEndpoint;
+    /** Only used when searching for available endpoints. */
+    TBool iSettingReserve;
+    /** True if endpoint is halted (i.e. issues STALL handshakes), false otherwise. */
+    TBool iHalt;
+    };
+
+
+class DUsbClientController;
+class TUsbcInterface;
+
+/** This is a 'logical' endpoint, as used by our device configuration model.
+*/
+class TUsbcLogicalEndpoint
+    {
+public:
+    TUsbcLogicalEndpoint(DUsbClientController* aController, TUint aEndpointNum,
+                         const TUsbcEndpointInfo& aEpInfo, TUsbcInterface* aInterface,
+                         TUsbcPhysicalEndpoint* aPEndpoint);        // Check Todo, SC will pass pointer to derived class
+    ~TUsbcLogicalEndpoint();
+public:
+    /** Pointer to controller object. */
+    DUsbClientController* iController;
+    /** The virtual (logical) endpoint number. */
+    const TInt iLEndpointNum;
+    /** This endpoint's info structure. */
+    TUsbcEndpointInfo iInfo;                                        // Check Todo, SC will pass pointer to derived class
+    /** Stores the endpoint size to be used for FS. */
+    TInt iEpSize_Fs;
+    /** Stores the endpoint size to be used for HS. */
+    TInt iEpSize_Hs;
+    /** 'Back' pointer. */
+    const TUsbcInterface* iInterface;
+    /** Pointer to corresponding physical endpoint, never NULL. */
+    TUsbcPhysicalEndpoint* const iPEndpoint;
+    };
+
+
+class TUsbcInterfaceSet;
+
+/** This is an 'alternate setting' of an interface.
+*/
+class TUsbcInterface
+    {
+public:
+    TUsbcInterface(TUsbcInterfaceSet* aIfcSet, TUint8 aSetting, TBool aNoEp0Requests);
+    ~TUsbcInterface();
+public:
+    /** Array of endpoints making up (belonging to) this setting. */
+    RPointerArray<TUsbcLogicalEndpoint> iEndpoints;
+    /** 'Back' pointer. */
+    TUsbcInterfaceSet* const iInterfaceSet;
+    /** bAlternateSetting (zero-based). */
+    const TUint8 iSettingCode;
+    /** KUsbcInterfaceInfo_NoEp0RequestsPlease: stall non-std Setup requests. */
+    const TBool iNoEp0Requests;
+    };
+
+
+/** This is an 'interface' (owning 1 or more alternate settings).
+
+    @see TUsbcInterface
+*/
+class TUsbcInterfaceSet
+    {
+public:
+    TUsbcInterfaceSet(const DBase* aClientId, TUint8 aIfcNum);
+    ~TUsbcInterfaceSet();
+    inline const TUsbcInterface* CurrentInterface() const;
+    inline TUsbcInterface* CurrentInterface();
+public:
+    /** Array of alternate settings provided by (belonging to) this interface. */
+    RPointerArray<TUsbcInterface> iInterfaces;
+    /** Pointer to the LDD which created and owns this interface. */
+    const DBase* const iClientId;
+    /** bInterfaceNumber (zero-based). */
+    TUint8 iInterfaceNumber;
+    /** bAlternateSetting (zero-based). */
+    TUint8 iCurrentInterface;
+    };
+
+
+/** This is a 'configuration' of the USB device.
+    Currently we support only one configuration.
+*/
+class TUsbcConfiguration
+    {
+public:
+    TUsbcConfiguration(TUint8 aConfigVal);
+    ~TUsbcConfiguration();
+public:
+    /** Array of interfaces making up (belonging to) this configuration. */
+    RPointerArray<TUsbcInterfaceSet> iInterfaceSets;
+    /** bConfigurationValue (one-based). */
+    const TUint8 iConfigValue;
+    };
+
+
+/** The USB controller's power handler class.
+*/
+NONSHARABLE_CLASS(DUsbcPowerHandler) : public DPowerHandler
+    {
+public:
+    void PowerUp();
+    void PowerDown(TPowerState);
+public:
+    DUsbcPowerHandler(DUsbClientController* aController);
+private:
+    DUsbClientController* iController;
+    };
+
+
+/*
+This is the EndpointInfo class used by the usb shared chunk client driver. 
+*/
+
+class TUsbcScEndpointInfo;
+
+
+/**
+Used to represent an array of (or inheriting from) TUsbcEndpointInfo objects.
+
+@see DUsbClientController::SetInterface
+*/
+
+class TUsbcEndpointInfoArray
+    {
+public:
+    typedef enum {EUsbcEndpointInfo, EUsbcScEndpointInfo} TArrayType;
+
+    TUsbcEndpointInfoArray(const TUsbcEndpointInfo* aData, TInt aDataSize=0);
+    TUsbcEndpointInfoArray(const TUsbcScEndpointInfo* aData, TInt aDataSize=0);
+    inline TUsbcEndpointInfo& operator[](TInt aIndex) const; 
+
+    TArrayType iType;
+private:
+    TUint8* iData;
+    TInt iDataSize;
+    };
+
+class TUsbPeriDeviceEventQueue
+    {
+public:
+    TUsbPeriDeviceEventQueue();
+    
+    void FifoAdd(TUsbcDeviceEvent aDeviceStatus);
+    TUsbcDeviceEvent FifoGet();
+
+private:
+    TUsbcDeviceEvent iDeviceEventQueue[KUsbDeviceEventQueueDepth];
+    TInt iDeviceQueueHead;
+    TInt iDeviceQueueTail;
+    };
+    
+class TUsbcRequestCallback; // todo?? required only for class below
+
+/** The USB Device software controller class.
+
+    Implements the platform-independent layer (PIL), and defines the interface to the
+    platform-specific layer PSL).
+
+    The implementation of the platform-specific layer interfaces with the hardware.
+*/
+NONSHARABLE_CLASS(DUsbClientController) : public DBase, 
+                                          public MUsbOtgPeripheralControlIf,
+                                          public UsbShai::MUsbPeripheralPilCallbackIf, 
+                                          public MControlTransferIf, 
+                                          public UsbShai::MChargerDetectorObserverIf
+    {   
+    friend class UsbShai::UsbPeripheralPil;
+    friend class TUsbHostWrapperEntry;
+    friend class DUsbcPowerHandler;
+    friend TUsbcLogicalEndpoint::~TUsbcLogicalEndpoint();
+    //
+    // --- Platform Independent Layer (PIL) ---
+    //
+
+
+private:
+    /**
+     * Two-phase constructor used by the friend classes that receive
+     * the registration calls for peripheral controllers.
+     *
+     * @param aPeripheralControllerIf Reference to the Peripheral
+     *   Controller interface implemented by the registering PSL.
+     *
+     * @param aProperties Reference to an object describing the
+     *   static properties of the Peripheral Controller. The PIL
+     *   layer requires that the supplied reference remains valid
+     *   indefinitely, as a Peripheral Controller cannot unregister.
+     *
+     * @param aIsOtgPort ETrue if this Peripheral Controller is part
+     *   of an OTG port. EFalse otherwise.
+     *
+     * @return Pointer to a new instance or NULL if failed
+     */
+    IMPORT_C static DUsbClientController* Create(UsbShai::MPeripheralControllerIf& aPeripheralControllerIf, 
+                                                 const UsbShai::TPeripheralControllerProperties& aProperties,
+                                                 TBool aIsOtgPort);
+    
+
+public:
+
+    //
+    // --- The following functions constitute the PIL interface to the LDD ---
+    //
+    virtual ~DUsbClientController();
+    IMPORT_C void DisableClientStack();
+    IMPORT_C void EnableClientStack();
+    IMPORT_C TBool IsActive();
+    IMPORT_C TInt RegisterClientCallback(TUsbcClientCallback& aCallback);
+    IMPORT_C static DUsbClientController* UsbcControllerPointer(TInt aUdc=0);
+    IMPORT_C void EndpointCaps(const DBase* aClientId, TDes8 &aCapsBuf) const;
+    IMPORT_C void DeviceCaps(const DBase* aClientId, TDes8 &aCapsBuf) const;
+    IMPORT_C TInt SetInterface(const DBase* aClientId, DThread* aThread, TInt aInterfaceNum,
+                               TUsbcClassInfo& aClass, TDesC8* aString, TInt aTotalEndpointsUsed,
+                               const TUsbcEndpointInfo aEndpointData[], TInt (*aRealEpNumbers)[6],
+                               TUint32 aFeatureWord);
+    IMPORT_C TInt SetInterface(const DBase* aClientId, DThread* aThread,
+                                                 TInt aInterfaceNum, TUsbcClassInfo& aClass,
+                                                 TDesC8* aString, TInt aTotalEndpointsUsed,
+                                                 const TUsbcEndpointInfoArray aEndpointData,
+                                                 TInt aRealEpNumbers[], TUint32 aFeatureWord);
+    IMPORT_C TInt ReleaseInterface(const DBase* aClientId, TInt aInterfaceNum);
+    IMPORT_C TInt ReEnumerate();
+    IMPORT_C TInt PowerUpUdc();
+    IMPORT_C TInt UsbConnect();
+    IMPORT_C TInt UsbDisconnect();
+    IMPORT_C TInt RegisterForStatusChange(TUsbcStatusCallback& aCallback);
+    IMPORT_C TInt DeRegisterForStatusChange(const DBase* aClientId);
+    IMPORT_C TInt RegisterForEndpointStatusChange(TUsbcEndpointStatusCallback& aCallback);
+    IMPORT_C TInt DeRegisterForEndpointStatusChange(const DBase* aClientId);
+    IMPORT_C TInt GetInterfaceNumber(const DBase* aClientId, TInt& aInterfaceNum) const;
+    IMPORT_C TInt DeRegisterClient(const DBase* aClientId);
+    IMPORT_C TInt Ep0PacketSize() const;
+    IMPORT_C TInt Ep0Stall(const DBase* aClientId);
+    IMPORT_C void SendEp0StatusPacket(const DBase* aClientId);
+    IMPORT_C UsbShai::TUsbPeripheralState GetDeviceStatus() const;
+    IMPORT_C TEndpointState GetEndpointStatus(const DBase* aClientId, TInt aEndpointNum) const;
+    IMPORT_C TInt SetupReadBuffer(TUsbcRequestCallback& aCallback);
+    IMPORT_C TInt SetupWriteBuffer(TUsbcRequestCallback& aCallback);
+    IMPORT_C void CancelReadBuffer(const DBase* aClientId, TInt aRealEndpoint);
+    IMPORT_C void CancelWriteBuffer(const DBase* aClientId, TInt aRealEndpoint);
+    IMPORT_C TInt HaltEndpoint(const DBase* aClientId, TInt aEndpointNum);
+    IMPORT_C TInt ClearHaltEndpoint(const DBase* aClientId, TInt aEndpointNum);
+    IMPORT_C TInt SetDeviceControl(const DBase* aClientId);
+    IMPORT_C TInt ReleaseDeviceControl(const DBase* aClientId);
+    IMPORT_C TUint EndpointZeroMaxPacketSizes() const;
+    IMPORT_C TInt SetEndpointZeroMaxPacketSize(TInt aMaxPacketSize);
+    IMPORT_C TInt GetDeviceDescriptor(DThread* aThread, TDes8& aDeviceDescriptor);
+    IMPORT_C TInt SetDeviceDescriptor(DThread* aThread, const TDes8& aDeviceDescriptor);
+    IMPORT_C TInt GetDeviceDescriptorSize(DThread* aThread, TDes8& aSize);
+    IMPORT_C TInt GetConfigurationDescriptor(DThread* aThread, TDes8& aConfigurationDescriptor);
+    IMPORT_C TInt SetConfigurationDescriptor(DThread* aThread, const TDes8& aConfigurationDescriptor);
+    IMPORT_C TInt GetConfigurationDescriptorSize(DThread* aThread, TDes8& aSize);
+    IMPORT_C TInt SetOtgDescriptor(DThread* aThread, const TDesC8& aOtgDesc);
+    IMPORT_C TInt GetOtgDescriptor(DThread* aThread, TDes8& aOtgDesc) const;
+    IMPORT_C TInt GetOtgFeatures(DThread* aThread, TDes8& aFeatures) const;
+    IMPORT_C TInt GetCurrentOtgFeatures(TUint8& aFeatures) const;
+    IMPORT_C TInt RegisterForOtgFeatureChange(TUsbcOtgFeatureCallback& aCallback);
+    IMPORT_C TInt DeRegisterForOtgFeatureChange(const DBase* aClientId);
+    IMPORT_C TInt GetInterfaceDescriptor(DThread* aThread, const DBase* aClientId, TInt aSettingNum,
+                                         TDes8& aInterfaceDescriptor);
+    IMPORT_C TInt SetInterfaceDescriptor(DThread* aThread, const DBase* aClientId, TInt aSettingNum,
+                                         const TDes8& aInterfaceDescriptor);
+    IMPORT_C TInt GetInterfaceDescriptorSize(DThread* aThread, const DBase* aClientId, TInt aSettingNum,
+                                             TDes8& aSize);
+    IMPORT_C TInt GetEndpointDescriptor(DThread* aThread, const DBase* aClientId, TInt aSettingNum,
+                                        TInt aEndpointNum, TDes8& aEndpointDescriptor);
+    IMPORT_C TInt SetEndpointDescriptor(DThread* aThread, const DBase* aClientId, TInt aSettingNum,
+                                        TInt aEndpointNum, const TDes8& aEndpointDescriptor);
+    IMPORT_C TInt GetEndpointDescriptorSize(DThread* aThread, const DBase* aClientId, TInt aSettingNum,
+                                            TInt aEndpointNum, TDes8& aSize);
+    IMPORT_C TInt GetDeviceQualifierDescriptor(DThread* aThread, TDes8& aDeviceQualifierDescriptor);
+    IMPORT_C TInt SetDeviceQualifierDescriptor(DThread* aThread, const TDes8& aDeviceQualifierDescriptor);
+    IMPORT_C TInt GetOtherSpeedConfigurationDescriptor(DThread* aThread, TDes8& aConfigurationDescriptor);
+    IMPORT_C TInt SetOtherSpeedConfigurationDescriptor(DThread* aThread, const TDes8& aConfigurationDescriptor);
+    IMPORT_C TInt GetCSInterfaceDescriptorBlock(DThread* aThread, const DBase* aClientId, TInt aSettingNum,
+                                                TDes8& aInterfaceDescriptor);
+    IMPORT_C TInt SetCSInterfaceDescriptorBlock(DThread* aThread, const DBase* aClientId, TInt aSettingNum,
+                                                const TDes8& aInterfaceDescriptor, TInt aSize);
+    IMPORT_C TInt GetCSInterfaceDescriptorBlockSize(DThread* aThread, const DBase* aClientId,
+                                                    TInt aSettingNum, TDes8& aSize);
+    IMPORT_C TInt GetCSEndpointDescriptorBlock(DThread* aThread, const DBase* aClientId, TInt aSettingNum,
+                                               TInt aEndpointNum, TDes8& aEndpointDescriptor);
+    IMPORT_C TInt SetCSEndpointDescriptorBlock(DThread* aThread, const DBase* aClientId, TInt aSettingNum,
+                                               TInt aEndpointNum, const TDes8& aEndpointDescriptor,
+                                               TInt aSize);
+    IMPORT_C TInt GetCSEndpointDescriptorBlockSize(DThread* aThread, const DBase* aClientId, TInt aSettingNum,
+                                                   TInt aEndpointNum, TDes8& aSize);
+    IMPORT_C TInt GetStringDescriptorLangId(DThread* aThread, TDes8& aLangId);
+    IMPORT_C TInt SetStringDescriptorLangId(TUint16 aLangId);
+    IMPORT_C TInt GetManufacturerStringDescriptor(DThread* aThread, TDes8& aString);
+    IMPORT_C TInt SetManufacturerStringDescriptor(DThread* aThread, const TDes8& aString);
+    IMPORT_C TInt RemoveManufacturerStringDescriptor();
+    IMPORT_C TInt GetProductStringDescriptor(DThread* aThread, TDes8& aString);
+    IMPORT_C TInt SetProductStringDescriptor(DThread* aThread, const TDes8& aString);
+    IMPORT_C TInt RemoveProductStringDescriptor();
+    IMPORT_C TInt GetSerialNumberStringDescriptor(DThread* aThread, TDes8& aString);
+    IMPORT_C TInt SetSerialNumberStringDescriptor(DThread* aThread, const TDes8& aString);
+    IMPORT_C TInt RemoveSerialNumberStringDescriptor();
+    IMPORT_C TInt GetConfigurationStringDescriptor(DThread* aThread, TDes8& aString);
+    IMPORT_C TInt SetConfigurationStringDescriptor(DThread* aThread, const TDes8& aString);
+    IMPORT_C TInt RemoveConfigurationStringDescriptor();
+    IMPORT_C TInt GetStringDescriptor(DThread* aThread, TUint8 aIndex, TDes8& aString);
+    IMPORT_C TInt SetStringDescriptor(DThread* aThread, TUint8 aIndex, const TDes8& aString);
+    IMPORT_C TInt RemoveStringDescriptor(TUint8 aIndex);
+    IMPORT_C TBool QueryEndpointResource(const DBase* aClientId, TInt aEndpointNum,
+                                         TUsbcEndpointResource aResource);
+    IMPORT_C TInt EndpointPacketSize(const DBase* aClientId, TInt aEndpointNum);
+    
+    // Called by LDD
+    IMPORT_C TDfcQue*  DfcQ(TInt aIndex);
+    IMPORT_C void DumpRegisters();
+    IMPORT_C TInt SignalRemoteWakeup();
+    IMPORT_C TBool CurrentlyUsingHighSpeed();
+    
+    TInt RegisterUdc(TInt aUdc);
+
+protected:
+
+    // From base class MUsbPeripheralPilCallbackIf
+    void EnablePeripheralStack();
+    void DisablePeripheralStack();
+    void SetOtgObserver(MUsbOtgPeripheralObserverIf* aObserver);
+
+    // Function derived from MUsbPeripheralPilCallbackIf
+    UsbShai::TControlStage EnquireEp0NextStage(const TUint8* aSetupBuf) const;
+    TInt Ep0RequestComplete(TInt aRealEndpoint, TInt aCount, TInt aError,UsbShai::TControlPacketType aPktType);
+    void EndpointRequestComplete(UsbShai::TUsbPeripheralRequest* aCallback);
+    TInt DeviceEventNotification(TUsbcDeviceEvent aEvent);
+    void MoveToAddressState();
+    TInt ProcessSetConfiguration(const TUsbcSetup& aPacket);
+    void HandleHnpRequest(TInt aHnpState);
+    void GetEp0RxBufferInfo(TUint8*& aBuffer, TInt& aBufferLen); 
+    void SetRmWakeupStatusEnabled(TBool aRmEnabled);
+    UsbShai::TUsbPeripheralState DeviceStatus() const;
+    TBool Ep0ReceivedNonStdRequest();
+    
+    // Functions derived from MControlTransferIf
+    // PSL -> PIL
+    void ProcessDataInPacket(TInt aCount,TInt aErrCode);
+    void ProcessStatusInPacket(TInt aErrCode);
+    void ProcessDataOutPacket(TInt aCount,TInt aErrCode);
+    void ProcessStatusOutPacket(TInt aErrCode);
+    void ProcessSetupPacket(TInt aCount,TInt aErrCode);
+    
+    // Request from PIL -> PSL
+    TInt ProcessSetupEndpointZeroRead();
+    TInt ProcessSetupEndpointZeroWrite(const TUint8* aBuffer, TInt aLength, TBool aZlpReqd=EFalse);
+    TInt ProcessSendEp0ZeroByteStatusPacket();
+    TInt ProcessStallEndpoint(TInt aRealEndpoint);
+    
+    // Flow control PIL <--> PSL
+    void ProcessEp0SetupPacketProceed();
+    void ProcessEp0DataPacketProceed();
+    
+    // Functions from MChargerDetectorObserverIf
+    void NotifyPortType(UsbShai::TPortType aPortType);
+    //
+    //
+    // --- Functions and data members provided by PIL, called by PSL ---
+    //
+private:
+    struct TUsbPeripheralDescriptorPool
+        {
+        TUsbcDeviceDescriptor* iDeviceDesc;
+        TUsbcConfigDescriptor* iConfigDesc;
+        TUsbcLangIdDescriptor* iLangId;
+        TUsbcStringDescriptor* iManufacturer;
+        TUsbcStringDescriptor* iProduct;
+        TUsbcStringDescriptor* iSerialNum;
+        TUsbcStringDescriptor* iConfig;
+        TUsbcOtgDescriptor* iOtgDesc;
+        };
+        
+private:
+    // Internal functions that used in Construct only
+    // This function will new a set of descriptors
+    TBool CreateDescriptors(TUsbPeripheralDescriptorPool& aOutput);
+    
+    TBool Initialise(TUsbPeripheralDescriptorPool& aDescPool,
+                     const UsbShai::TUsbPeripheralEndpointCaps* aEndpointCaps,
+                     TInt aTotalEndpoint);                    
+
+    DUsbClientController(UsbShai::MPeripheralControllerIf&               aPeripheralControllerIf, 
+                         const UsbShai::TPeripheralControllerProperties& aProperties,
+                         TBool                                  aIsOtgPort);
+    
+    TInt Construct();
+    
+    void ProcessStandardRequest(TInt aCount,const TUsbcSetup& aPacket);    
+    void ProcessNonStandardRequest(TInt aCount,const TUsbcSetup& aPacket);
+    
+    const DBase* FindNonStandardRequestClient(TUint8 aPacketTypeDestination,const TUsbcSetup& aPacket);
+    
+    TInt SetupEp0StateMachine();
+    
+private:
+    
+    /** This info can be used by the PSL before sending ZLPs.
+
+        @publishedPartner @released
+    */
+    TBool iEp0ReceivedNonStdRequest;
+
+    /** True if RMW is currently enabled (set by either PIL or PSL).
+
+        @publishedPartner @released
+    */
+    TBool iRmWakeupStatus_Enabled;
+
+    /** Ep0 incoming (rx) data is placed here (one packet).
+
+        @publishedPartner @released
+    */
+    TUint8 iEp0_RxBuf[KUsbcBufSzControl];
+
+private:
+
+    //
+    // --- Private member functions (used by PIL) ---
+    //
+    TInt DeRegisterClientCallback(const DBase* aClientId);
+    TBool CheckEpAvailability(TInt aEndpointsUsed, const TUsbcEndpointInfoArray& aEndpointData, TInt aIfcNumber)
+        const;
+    TUsbcInterface* CreateInterface(const DBase* aClientId, TInt aIfc, TUint32 aFeatureWord);
+    TInt CreateEndpoints(TUsbcInterface* aIfc, TInt aEndpointsUsed, const TUsbcEndpointInfoArray& aEndpointData,
+                         TInt *aRealEpNumbers);
+    TInt SetupIfcDescriptor(TUsbcInterface* aIfc, TUsbcClassInfo& aClass, DThread* aThread, TDesC8* aString,
+                            const TUsbcEndpointInfoArray& aEndpointData);
+    TInt ClientId2InterfaceNumber(const DBase* aClientId) const;
+    TUsbcInterfaceSet* ClientId2InterfacePointer(const DBase* aClientId) const;
+    const DBase* InterfaceNumber2ClientId(TInt aIfcSet) const;
+    TUsbcInterfaceSet* InterfaceNumber2InterfacePointer(TInt aIfcSet) const;
+    inline const DBase* PEndpoint2ClientId(TInt aRealEndpoint) const;
+    inline TInt PEndpoint2LEndpoint(TInt aRealEndpoint) const;
+    TInt ActivateHardwareController();
+    void DeActivateHardwareController();
+    void DeleteInterfaceSet(TInt aIfcSet);
+    void DeleteInterface(TInt aIfcSet, TInt aIfc);
+    void CancelTransferRequests(TInt aRealEndpoint);
+    void DeleteRequestCallback(const DBase* aClientId, TInt aEndpointNum, UsbShai::TTransferDirection aTransferDir);
+    void DeleteRequestCallbacks(const DBase* aClientId);
+    void StatusNotify(UsbShai::TUsbPeripheralState aState, const DBase* aClientId=NULL);
+    void EpStatusNotify(TInt aRealEndpoint);
+    void OtgFeaturesNotify();
+    void RunClientCallbacks();
+    void ProcessDataTransferDone(TUsbcRequestCallback& aRcb);
+    void NextDeviceState(UsbShai::TUsbPeripheralState aNextState);
+    TInt ProcessSuspendEvent();
+    TInt ProcessSuspendEventProceed();
+    TInt ProcessResumeEvent();
+    TInt ProcessResetEvent(TBool aPslUpcall=ETrue);
+    TInt ProcessVbusRisenEvent();
+    TInt ProcessVbusFallenEvent();
+    
+    void ProcessGetDeviceStatus(const TUsbcSetup& aPacket);
+    void ProcessGetInterfaceStatus(const TUsbcSetup& aPacket);
+    void ProcessGetEndpointStatus(const TUsbcSetup& aPacket);
+    void ProcessSetClearDevFeature(const TUsbcSetup& aPacket);
+    void ProcessSetClearIfcFeature(const TUsbcSetup& aPacket);
+    void ProcessSetClearEpFeature(const TUsbcSetup& aPacket);
+    void ProcessSetAddress(const TUsbcSetup& aPacket);
+    void ProcessGetDescriptor(const TUsbcSetup& aPacket);
+    void ProcessSetDescriptor(const TUsbcSetup& aPacket);
+    void ProcessGetConfiguration(const TUsbcSetup& aPacket);
+    void ProcessGetInterface(const TUsbcSetup& aPacket);
+    void ProcessSetInterface(const TUsbcSetup& aPacket);
+    void ProcessSynchFrame(const TUsbcSetup& aPacket);
+    
+    void ProceedSetDescriptor();
+    void ProcessDeviceEventNotification(TUsbcDeviceEvent aEvent);
+    
+    void SetClearHaltFeature(TInt aRealEndpoint, TUint8 aRequest);
+    TInt ClearHaltFeature(TInt aRealEndpoint);
+    void ChangeConfiguration(TUint16 aValue);
+    void InterfaceSetup(TUsbcInterface* aIfc);
+    void InterfaceSetTeardown(TUsbcInterfaceSet* aIfc);
+    void ChangeInterface(TUsbcInterface* aIfc);
+    TInt DoForEveryEndpointInUse(TInt (DUsbClientController::*aFunction)(TInt), TInt& aCount);
+    void EnterFullSpeed();
+    void EnterHighSpeed();
+    TInt EvaluateOtgConnectFlags();
+    inline const TUsbcConfiguration* CurrentConfig() const;
+    inline TUsbcConfiguration* CurrentConfig();
+    inline TBool InterfaceExists(TInt aNumber) const;
+    inline TBool EndpointExists(TUint aAddress) const;
+    void Buffer2Setup(const TAny* aBuf, TUsbcSetup& aSetup) const;
+    inline TUint EpIdx2Addr(TUint aRealEndpoint) const;
+    inline TUint EpAddr2Idx(TUint aAddress) const;
+    inline void SetEp0DataOutVars(const DBase* aClientId = NULL);
+    inline void ResetEp0DataOutVars();
+    inline TBool IsInTheStatusList(const TUsbcStatusCallback& aCallback);
+    inline TBool IsInTheEpStatusList(const TUsbcEndpointStatusCallback& aCallback);
+    inline TBool IsInTheOtgFeatureList(const TUsbcOtgFeatureCallback& aCallback);
+    inline TBool IsInTheRequestList(const TUsbcRequestCallback& aCallback);
+    static void ReconnectTimerCallback(TAny* aPtr);
+    static void CableStatusTimerCallback(TAny* aPtr);
+    static void PowerUpDfc(TAny* aPtr);
+    static void PowerDownDfc(TAny* aPtr);
+    static void DeviceEventNotifyDfc(TAny* aPtr);
+    static void ThreadContextFinderDfc(TAny* aPtr);
+
+private:
+
+    //
+    // --- Private data members ---
+    //
+
+    static DUsbClientController* UsbClientController[KUsbcMaxUdcs];
+
+    TInt iDeviceTotalEndpoints;                                 // number of endpoints reported by PSL
+    TInt iDeviceUsableEndpoints;                                // number of endpoints reported to LDD
+    
+    UsbShai::TUsbPeripheralState iDeviceState;                              // states as of USB spec chapter 9.1
+    UsbShai::TUsbPeripheralState iDeviceStateB4Suspend;                     // state before entering suspend state
+
+    TBool iSelfPowered;                                         // true if device is capable of beeing self-powered
+    TBool iRemoteWakeup;                                        // true if device is capable of signalling rmwakeup
+    TBool iHardwareActivated;                                   // true if controller silicon is in operating state
+    TBool iOtgSupport;                                          // true if OTG is supported by this device
+    TUint8 iOtgFuncMap;                                         // bitmap indicating OTG extension features
+    TBool iHighSpeed;                                           // true if currently operating at high-speed
+    
+    TInt iEp0MaxPacketSize;                                     // currently configured max packet size for Ep0    
+    const DBase* iEp0ClientId;                                  // see comment at the begin of ps_usbc.cpp
+    TUint16 iEp0DataReceived;                                   // indicates how many bytes have already been received
+    TBool iEp0WritePending;                                     // true if a write on ep0 has been set up
+    TBool iEp0ClientDataTransmitting;                           // true if ep0's in DATA_IN on behalf of a client
+    const DBase* iEp0DeviceControl;                             // Device Ep0 requests are delivered to this LDD
+    
+    TUsbcDescriptorPool iDescriptors;                           // the descriptors as of USB spec chapter 9.5
+    TUint8 iCurrentConfig;                                      // bConfigurationValue of current Config (1-based!)
+    RPointerArray<TUsbcConfiguration> iConfigs;                 // the root of the modelled USB device
+    TUsbcPhysicalEndpoint iRealEndpoints[KUsbcEpArraySize];     // array will be filled once at startup
+    TUint8 iEp0_TxBuf[KUsbcBufSz_Ep0Tx];                        // ep0 outgoing (tx) data is placed here
+#ifdef USB_SUPPORTS_SET_DESCRIPTOR_REQUEST
+    TUint8 iEp0_RxCollectionBuf[KUsbcBufSz_Ep0Rx];              // used for (optional) SET_DESCRIPTOR request
+#endif
+    TInt iEp0_RxExtraCount;                                     // number of bytes received but not yet delivered
+    TBool iEp0_RxExtraData;                                     // true if iEp0_RxExtraCount is valid
+    TInt iEp0_TxNonStdCount;                                    // number of bytes requested by non-std Ep0 request
+    
+    TUsbcRequestCallback* iRequestCallbacks[KUsbcEpArraySize];  // xfer requests; indexed by real ep number
+    TSglQue<TUsbcRequestCallback> iEp0ReadRequestCallbacks;     // list of ep0 read requests
+    TSglQue<TUsbcClientCallback> iClientCallbacks;              // registered LDD clients and their callback functions
+    TSglQue<TUsbcStatusCallback> iStatusCallbacks;              // list of device state notification requests
+    TSglQue<TUsbcEndpointStatusCallback> iEpStatusCallbacks;    // list of endpoint state notification requests
+    TSglQue<TUsbcOtgFeatureCallback> iOtgCallbacks;             // list of OTG feature change requests
+    
+    NTimer iReconnectTimer;                                     // implements USB re-enumeration delay
+    NTimer iCableStatusTimer;                                   // implements USB cable status detection delay
+    DUsbcPowerHandler* iPowerHandler;                           // pointer to USB power handler object
+    TSpinLock iUsbLock;                                         // implement SMP for USB PDD and LDD
+    NFastMutex iMutex;                                          // To pretect interface set with NFastMutex
+    UsbShai::MPeripheralControllerIf& iController;              // PSL code
+    
+    const UsbShai::TPeripheralControllerProperties& iControllerProperties;   // Static configuration from PSL
+    TBool iIsOtgPort;                                               // Is this instance a driver for otg port,
+                                                                    // Set at construction time.
+
+    /**
+     * Pointer to the currently set OTG Observer, if any. Not owned.
+     */
+	MUsbOtgPeripheralObserverIf* iOtgObserver;  // Otg interface which is used to listen event from DeviceEventNotification
+    
+    DControlTransferManager* iConTransferMgr;    // Usb Control transfer manager, responsible for chaptor9
+    
+    TInt iLastError;                            // Used by chaptor9 sm. No else.
+    TBool iSetupPacketPending;                  // Indicate whether the no-req-callback data is a setup packet
+                                                            
+    TUsbPeriDeviceEventQueue iDevEventQueue;    // PSL can call DeviceEventNotification(...) at any context, 
+                                                // but for PIL, we want to serialize the execution of each event
+    
+    // The thread context for the DfcQ pass by PSL to us.
+    NThread* iCommonDfcQThread;
+    
+protected:
+    TDfc iPowerUpDfc;                         // queued by power handler upon power-up
+    TDfc iPowerDownDfc;                       // queued by power handler upon power-down
+    TDfc iDeviceEventNotifyDfc;               // queued by device event notification
+    TDfc iThreadContextFinder;                // this is used to find which thread does the DfcQ passed by PSL
+                                              // is runing.
+
+private:
+    TBool iStandby;                           // toggled by power handler as appropriate
+    TBool iStackIsActive;                     // client stack's function is usable
+    TBool iClientSupportReady;                // user-side USB Client support is loaded & active
+    TBool iUsbResetDeferred;                  // set when user-side wasn't ready yet
+
+public:
+    // FIXME: These used to be filled by the OTG component Dummy DCD
+    // so that the PIL layer can call it to enable and disable the D+
+    // pull-up. This mechanism is no longer used
+    TInt (*iEnablePullUpOnDPlus)(TAny* aOtgContext);
+    TInt (*iDisablePullUpOnDPlus)(TAny* aOtgContext);
+    TAny* iOtgContext;
+    };
+    
+/** Simple queue of status changes to be recorded.
+    Items are fetched by userside when able.
+*/
+class TUsbcDeviceStatusQueue
+    {
+public:
+    TUsbcDeviceStatusQueue();
+    void AddStatusToQueue(TUint32 aDeviceStatus);
+    TInt GetDeviceQueuedStatus(TUint32& aDeviceStatus);
+    void FlushQueue();
+
+private:
+    TUint32 iDeviceStatusQueue[KUsbDeviceStatusQueueDepth];
+    TInt iStatusQueueHead;
+    };
+    
+#include <usb/usbcshared.inl>
+
+#endif    // __USBCSHARED_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/public/usbcshared.inl	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,571 @@
+// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// 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:
+// e32\include\drivers\usbcshared.inl
+// Kernel side definitions for the USB Device driver stack (PIL + LDD).
+// 
+//
+
+/**
+ @file usbcshared.inl
+ @internalTechnology
+*/
+
+#ifndef __USBCSHARED_INL__
+#define __USBCSHARED_INL__
+
+//
+// --- DUsbClientController (USB PDD) ---
+//
+
+// --- Private member functions, used by controller itself ---
+
+const DBase* DUsbClientController::PEndpoint2ClientId(TInt aRealEndpoint) const
+	{
+	if (iRealEndpoints[aRealEndpoint].iLEndpoint)
+		return iRealEndpoints[aRealEndpoint].iLEndpoint->iInterface->iInterfaceSet->iClientId;
+	else
+		return NULL;
+	}
+
+
+TInt DUsbClientController::PEndpoint2LEndpoint(TInt aRealEndpoint) const
+	{
+	if (iRealEndpoints[aRealEndpoint].iLEndpoint)
+		return iRealEndpoints[aRealEndpoint].iLEndpoint->iLEndpointNum;
+	else
+		return -1;
+	}
+
+
+const TUsbcConfiguration* DUsbClientController::CurrentConfig() const
+	{
+	return (iCurrentConfig ? iConfigs[iCurrentConfig - 1] : NULL);
+	}
+
+
+TUsbcConfiguration* DUsbClientController::CurrentConfig()
+	{
+	return (iCurrentConfig ? iConfigs[iCurrentConfig - 1] : NULL);
+	}
+
+
+TBool DUsbClientController::InterfaceExists(TInt aNumber) const
+	{
+	const TInt num_ifcsets = iConfigs[0]->iInterfaceSets.Count();
+	RPointerArray<TUsbcInterfaceSet>& ifcsets = iConfigs[0]->iInterfaceSets;
+	for (TInt i = 0; i < num_ifcsets; i++)
+		{
+		if (ifcsets[i]->iInterfaceNumber == aNumber)
+			{
+			return ETrue;
+			}
+		}
+	return EFalse;
+	}
+
+
+TBool DUsbClientController::EndpointExists(TUint aAddress) const
+	{
+	// Ep0 doesn't have a "logical ep" pointer (there's no virtual endpoint zero);
+	// that's why this pointer being non-NULL is not a sufficient criterion for
+	// endpoint-existence. (Apart from that, ep0 always exists.)
+	const TInt idx = EpAddr2Idx(aAddress);
+	return ((idx < iDeviceTotalEndpoints) &&
+			((iRealEndpoints[idx].iLEndpoint != NULL) ||
+			 ((aAddress & KUsbEpAddress_Portmask) == 0)));
+	}
+
+TUint DUsbClientController::EpIdx2Addr(TUint aRealEndpoint) const
+	{
+	return ((aRealEndpoint << 7) & 0x80) | ((aRealEndpoint >> 1) & 0x0f);
+	}
+
+
+TUint DUsbClientController::EpAddr2Idx(TUint aAddress) const
+	{
+	return ((aAddress & 0x80) >> 7) | ((aAddress & 0x0f) << 1);
+	}
+
+
+void DUsbClientController::SetEp0DataOutVars(const DBase* aClientId)
+	{
+	__KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::SetEp0DataOutVars()"));
+	//iSetup = aPacket;
+	iEp0DataReceived = 0;
+	iEp0ClientId = aClientId;
+	}
+
+
+void DUsbClientController::ResetEp0DataOutVars()
+	{
+	__KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ResetEp0DataOutVars()"));
+	iEp0DataReceived = 0;
+	iEp0ClientId = NULL;
+	}
+
+
+TBool DUsbClientController::IsInTheRequestList(const TUsbcRequestCallback& aCallback)
+	{
+    	const TInt irq = __SPIN_LOCK_IRQSAVE(iUsbLock);
+	TSglQueIter<TUsbcRequestCallback> iter(iEp0ReadRequestCallbacks);
+	TUsbcRequestCallback* p;
+	while ((p = iter++) != NULL)
+		{
+		if (p == &aCallback)
+			{
+			__SPIN_UNLOCK_IRQRESTORE(iUsbLock, irq);
+			return ETrue;
+			}
+		}
+    	__SPIN_UNLOCK_IRQRESTORE(iUsbLock, irq);
+	return EFalse;
+	}
+
+
+TBool DUsbClientController::IsInTheStatusList(const TUsbcStatusCallback& aCallback)
+	{
+    	const TInt irq = __SPIN_LOCK_IRQSAVE(iUsbLock);
+	TSglQueIter<TUsbcStatusCallback> iter(iStatusCallbacks);
+	TUsbcStatusCallback* p;
+	while ((p = iter++) != NULL)
+		{
+		if (p == &aCallback)
+			{
+            		__SPIN_UNLOCK_IRQRESTORE(iUsbLock, irq);
+			return ETrue;
+			}
+		}
+    	__SPIN_UNLOCK_IRQRESTORE(iUsbLock, irq);
+	return EFalse;
+	}
+
+
+TBool DUsbClientController::IsInTheEpStatusList(const TUsbcEndpointStatusCallback& aCallback)
+	{
+    	const TInt irq = __SPIN_LOCK_IRQSAVE(iUsbLock);
+	TSglQueIter<TUsbcEndpointStatusCallback> iter(iEpStatusCallbacks);
+	TUsbcEndpointStatusCallback* p;
+	while ((p = iter++) != NULL)
+		{
+		if (p == &aCallback)
+			{
+		    	__SPIN_UNLOCK_IRQRESTORE(iUsbLock, irq);
+			return ETrue;
+			}
+		}
+    	__SPIN_UNLOCK_IRQRESTORE(iUsbLock, irq);
+	return EFalse;
+	}
+
+
+TBool DUsbClientController::IsInTheOtgFeatureList(const TUsbcOtgFeatureCallback& aCallback)
+	{
+    	const TInt irq = __SPIN_LOCK_IRQSAVE(iUsbLock);
+	TSglQueIter<TUsbcOtgFeatureCallback> iter(iOtgCallbacks);
+	TUsbcOtgFeatureCallback* p;
+	while ((p = iter++) != NULL)
+		{
+		if (p == &aCallback)
+			{
+		    	__SPIN_UNLOCK_IRQRESTORE(iUsbLock, irq);
+			return ETrue;
+			}
+		}
+    	__SPIN_UNLOCK_IRQRESTORE(iUsbLock, irq);
+	return EFalse;
+	}
+
+//
+// --- Misc classes ---
+//
+
+// --- TUsbcClientCallback
+
+/** Constructor.
+ */
+TUsbcClientCallback::TUsbcClientCallback(DBase* aOwner, TDfcFn aCallback, TInt aPriority)
+	: iOwner(aOwner),
+	  iDfc(aCallback, aOwner, aPriority)
+	{}
+
+
+/** Returns a pointer to the owner of this request.
+
+	@return A pointer to the owner of this request.
+*/
+DBase* TUsbcClientCallback::Owner() const
+	{
+	return iOwner;
+	}
+
+
+/** Executes the callback function set by the owner of this request.
+
+	@return KErrNone.
+*/
+TInt TUsbcClientCallback::DoCallback()
+	{
+	__ASSERT_DEBUG((NKern::CurrentContext() == EThread), Kern::Fault(KUsbPILPanicCat, __LINE__));
+	iDfc.Enque();
+	return KErrNone;
+	}
+
+
+/** Cancels the callback function set by the owner of this request.
+ */
+void TUsbcClientCallback::Cancel()
+	{
+	iDfc.Cancel();
+	}
+
+
+/** Sets the DFC queue used by the callback function.
+	@param aDfcQ DFC queue to be set
+ */
+void TUsbcClientCallback::SetDfcQ(TDfcQue* aDfcQ)
+	{
+	iDfc.SetDfcQ(aDfcQ);
+	}
+
+
+// --- TUsbcEndpointStatusCallback
+
+/** Constructor.
+ */
+TUsbcEndpointStatusCallback::TUsbcEndpointStatusCallback(DBase* aOwner, TDfcFn aCallback,
+														 TInt aPriority)
+	: iOwner(aOwner),
+	  iDfc(aCallback, aOwner, aPriority),
+	  iState(0)
+	{}
+
+
+/** Sets the state of this request to aState.
+
+	@param aState The new state to be set.
+*/
+void TUsbcEndpointStatusCallback::SetState(TUint aState)
+	{
+	iState = aState;
+	}
+
+
+/** Returns the state value of this request.
+
+	@return The state value of this request.
+*/
+TUint TUsbcEndpointStatusCallback::State() const
+	{
+	return iState;
+	}
+
+
+/** Returns a pointer to the owner of this request.
+
+	@return A pointer to the owner of this request.
+*/
+DBase* TUsbcEndpointStatusCallback::Owner() const
+	{
+	return iOwner;
+	}
+
+
+/** Executes the callback function set by the owner of this request.
+
+	@return KErrNone.
+*/
+TInt TUsbcEndpointStatusCallback::DoCallback()
+	{
+	if (NKern::CurrentContext() == EThread)
+		iDfc.Enque();
+	else
+		iDfc.Add();
+	return KErrNone;
+	}
+
+
+/** Cancels the callback function set by the owner of this request.
+*/
+void TUsbcEndpointStatusCallback::Cancel()
+	{
+	iDfc.Cancel();
+	}
+
+
+/** Sets the DFC queue used by the callback function.
+*/
+void TUsbcEndpointStatusCallback::SetDfcQ(TDfcQue* aDfcQ)
+	{
+	iDfc.SetDfcQ(aDfcQ);
+	}
+
+
+// --- TUsbcStatusCallback
+
+/** Constructor.
+ */
+TUsbcStatusCallback::TUsbcStatusCallback(DBase* aOwner, TDfcFn aCallback, TInt aPriority)
+	: iOwner(aOwner),
+	  iDfc(aCallback, aOwner, aPriority)
+	{
+ 	ResetState();
+	}
+
+
+/** Sets the state of this request to aState (at the first available position
+	in the state value array).
+
+	@param aState The new state to be set.
+*/
+void TUsbcStatusCallback::SetState(UsbShai::TUsbPeripheralState aState)
+	{
+	for (TInt i = 0; i < KUsbcDeviceStateRequests; i++)
+		{
+		if (iState[i] == UsbShai::EUsbPeripheralNoState)
+			{
+			iState[i] = aState;
+			return;
+			}
+		}
+	__KTRACE_OPT(KPANIC, Kern::Printf("  Error: KUsbcDeviceStateRequests too small (%d)!",
+									  KUsbcDeviceStateRequests));
+	}
+
+
+/** Returns the state value of this request at a certain index.
+
+	@param aIndex The index to be used for referencing the state array.
+
+	@return The state value of this request at aIndex.
+*/
+UsbShai::TUsbPeripheralState TUsbcStatusCallback::State(TInt aIndex) const
+	{
+	if (aIndex >= 0 && aIndex < KUsbcDeviceStateRequests)
+		{
+		return iState[aIndex];
+		}
+	else
+		{
+		__KTRACE_OPT(KPANIC, Kern::Printf("  Error: aIndex too large (%d)!", aIndex));
+		return UsbShai::EUsbPeripheralNoState;
+		}
+	}
+
+
+/** Resets the entire state value array of this request.
+*/
+void TUsbcStatusCallback::ResetState()
+	{
+	for (TInt i = 0; i < KUsbcDeviceStateRequests; ++i)
+		{
+		iState[i] = UsbShai::EUsbPeripheralNoState;
+		}
+	}
+
+
+/** Returns a pointer to the owner of this request.
+
+	@return A pointer to the owner of this request.
+*/
+DBase* TUsbcStatusCallback::Owner() const
+	{
+	return iOwner;
+	}
+
+
+/** Executes the callback function set by the owner of this request.
+
+	@return KErrNone.
+*/
+TInt TUsbcStatusCallback::DoCallback()
+	{
+	if (NKern::CurrentContext() == EThread)
+		iDfc.Enque();
+	else
+		iDfc.Add();
+	return KErrNone;
+	}
+
+
+/** Cancels the callback function set by the owner of this request.
+*/
+void TUsbcStatusCallback::Cancel()
+	{
+	iDfc.Cancel();
+	}
+
+
+/** Sets the DFC queue used by the callback function.
+*/
+void TUsbcStatusCallback::SetDfcQ(TDfcQue* aDfcQ)
+	{
+	iDfc.SetDfcQ(aDfcQ);
+	}
+
+// --- TUsbcRequestCallback
+
+/** Constructor.
+ */
+TUsbcRequestCallback::TUsbcRequestCallback(const DBase* aOwner, TInt aEndpointNum, TDfcFn aDfcFunc,
+										   TAny* aEndpoint, TDfcQue* aDfcQ, TInt aPriority)
+	: TUsbPeripheralRequest(-1),
+      iEndpointNum(aEndpointNum),
+	  iOwner(aOwner),
+	  iDfc(aDfcFunc, aEndpoint, aDfcQ, aPriority)
+	{
+	}
+
+
+/** Destructor.
+ */
+TUsbcRequestCallback::~TUsbcRequestCallback()
+	{
+	__KTRACE_OPT(KUSB, Kern::Printf("TUsbcRequestCallback::~TUsbcRequestCallback()"));
+	iDfc.Cancel();
+	}
+
+/** Sets the transfer direction for this request.
+
+	@param aTransferDir The new transfer direction.
+*/
+void TUsbcRequestCallback::SetTransferDirection(UsbShai::TTransferDirection aTransferDir)
+	{
+	iTransferDir = aTransferDir;
+	}
+
+
+/** Returns a pointer to the owner of this request.
+
+	@return A pointer to the owner of this request.
+*/
+const DBase* TUsbcRequestCallback::Owner() const
+	{
+	return iOwner;
+	}
+
+
+/** Executes the callback function set by the owner of this request.
+
+	@return KErrNone.
+*/
+TInt TUsbcRequestCallback::DoCallback()
+	{
+	if (NKern::CurrentContext() == NKern::EThread)
+		iDfc.Enque();
+	else
+		iDfc.Add();
+	return KErrNone;
+	}
+
+
+/** Cancels the callback function set by the owner of this request.
+*/
+void TUsbcRequestCallback::Cancel()
+	{
+	iDfc.Cancel();
+	}
+
+// --- TUsbcOtgFeatureCallback
+
+/** Constructor.
+ */
+TUsbcOtgFeatureCallback::TUsbcOtgFeatureCallback(DBase* aOwner, TDfcFn aCallback,
+												 TInt aPriority)
+	: iOwner(aOwner),
+	  iDfc(aCallback, aOwner, aPriority),
+	  iValue(0)
+	{}
+
+
+/** Returns a pointer to the owner of this request.
+	@return A pointer to the owner of this request.
+*/
+DBase* TUsbcOtgFeatureCallback::Owner() const
+	{
+	return iOwner;
+	}
+
+
+/** Set feature value which is to be notified to client.
+	@param OTG feature value to be set
+*/
+void TUsbcOtgFeatureCallback::SetFeatures(TUint8 aFeatures)
+	{
+	iValue = aFeatures;
+	}
+
+
+/** Set feature value which is to be notified to client.
+	@return Value of OTG features
+*/
+TUint8 TUsbcOtgFeatureCallback::Features() const
+	{
+	return iValue;
+	}
+
+
+/** Set DFC queue.
+	@param aDfcQ  DFC queue to be set
+*/ 
+void TUsbcOtgFeatureCallback::SetDfcQ(TDfcQue* aDfcQ)
+	{
+	iDfc.SetDfcQ(aDfcQ);
+	}
+
+
+/** Executes the callback function set by the owner of this request.
+	@return KErrNone.
+*/
+TInt TUsbcOtgFeatureCallback::DoCallback()
+	{
+	if (NKern::CurrentContext() == EThread)
+		iDfc.Enque();
+	else
+		iDfc.Add();
+	return KErrNone;
+	}
+
+
+/** Cancels the callback function set by the owner of this request.
+ */
+void TUsbcOtgFeatureCallback::Cancel()
+	{
+	iDfc.Cancel();
+	}
+
+
+/** Returns a pointer to the currently selected (active) setting of this interface.
+
+	@return A pointer to the currently selected (active) setting of this interface.
+*/
+const TUsbcInterface* TUsbcInterfaceSet::CurrentInterface() const
+	{
+	return iInterfaces[iCurrentInterface];
+	}
+
+
+/** Returns a pointer to the currently selected (active) setting of this interface.
+
+	@return A pointer to the currently selected (active) setting of this interface.
+*/
+
+TUsbcInterface* TUsbcInterfaceSet::CurrentInterface()
+	{
+	return iInterfaces[iCurrentInterface];
+	}
+
+#endif // __USBCSHARED_INL__
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbdrv/peripheral/public/usbotgperipheralcontrolif.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,80 @@
+// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// 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:
+// e32\include\drivers\usbcshared.h
+// Kernel side definitions for the USB Device driver stack (PIL + LDD).
+// 
+//
+
+/**
+ @file usbotgperipheralcontrolif.h
+ @internalTechnology
+*/
+
+#ifndef USBOTGPERIPHERALCONTROLIF_H
+#define USBOTGPERIPHERALCONTROLIF_H
+
+#include <usb/usb_peripheral_shai.h> // For UsbShai::TUsbPeripheralEvent
+
+/**
+ * This M-class specifies the observer interface that the OTG state
+ * machine implements to listen to events of the peripheral stack.
+ */
+NONSHARABLE_CLASS(MUsbOtgPeripheralObserverIf)
+    {
+    public:
+    /**
+     * Called by the peripheral stack to report a peripheral event to
+     * the OTG stack.
+     *
+     * @param aEvent An enumeration value specifying the type of event
+     *   that has occurred
+     */
+    virtual void NotifyPeripheralEvent(UsbShai::TUsbPeripheralEvent aEvent) = 0;
+    };
+
+
+/**
+ * This M-class specifies the control interface that the OTG state
+ * machine uses to control the peripheral stack and register for
+ * peripheral events.
+ */
+NONSHARABLE_CLASS(MUsbOtgPeripheralControlIf)
+    {
+    public:
+    /**
+     * Called by the OTG state machine to enable the peripheral stack.
+     * When called, the peripheral stack must activate the controller
+     * and connect to the bus as soon as possible.
+     */
+    virtual void EnablePeripheralStack() = 0;
+
+    /**
+     * Called by the OTG state machine to disable the peripheral
+     * stack. When called, the peripheral stack must immediately
+     * disconnect from the bus and deactivate the controller.
+     */
+    virtual void DisablePeripheralStack() = 0;
+
+    /**
+     * Called by the OTG state machine to set the peripheral event
+     * observer.
+     *
+     * @param aObserver Pointer to the OTG Observer, or NULL when the
+     *   OTG stack is being shutdown.
+     */
+    virtual void SetOtgObserver(MUsbOtgPeripheralObserverIf* aObserver) = 0;
+    };
+
+
+#endif    // USBOTGPERIPHERALCONTROLIF_H
Binary file usbmgmt/usbmgr/conf/usbmanager.confml has changed
--- a/usbmgmt/usbmgr/device/classcontroller/SRC/CUsbClassControllerIterator.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classcontroller/SRC/CUsbClassControllerIterator.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -24,10 +24,12 @@
 
 #include <cusbclasscontrolleriterator.h>
 #include <usb/usblogger.h>
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "CUsbClassControllerIteratorTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "USBSVR");
-#endif
+
 
 // Panic category only used in debug builds
 #ifdef _DEBUG
@@ -130,10 +132,13 @@
  */
 EXPORT_C CUsbClassControllerBase* CUsbClassControllerIterator::Current()
 	{
-	__ASSERT_DEBUG((iClassControllerIndex >= 0) &&
-		(iClassControllerIndex < iClassControllerArray.Count()),
-		_USB_PANIC(KUsbCcIteratorPanicCategory, EIndexOutOfRange));
-
+#ifdef _DEBUG
+    if(!((iClassControllerIndex >= 0) && (iClassControllerIndex < iClassControllerArray.Count())))
+        {
+        OstTrace1( TRACE_FATAL, CUSBCLASSCONTROLLERITERATOR_CURRENT, "CUsbClassControllerIterator::Current;panic reason=%d", EIndexOutOfRange );
+        User::Panic(KUsbCcIteratorPanicCategory, EIndexOutOfRange );
+        }
+#endif
 	return iClassControllerArray[iClassControllerIndex];
 	}
 
--- a/usbmgmt/usbmgr/device/classcontroller/SRC/CUsbClassControllerPlugIn.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classcontroller/SRC/CUsbClassControllerPlugIn.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -24,11 +24,11 @@
 
 #include <cusbclasscontrollerplugin.h>
 #include <ecom/ecom.h>
-#include <usb/usblogger.h>
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "CUsbClassControllerPlugInTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "USBSVR");
-#endif
 	
 /**
  * Constructor.
@@ -50,7 +50,7 @@
 EXPORT_C CUsbClassControllerPlugIn* CUsbClassControllerPlugIn::NewL(TUid aImplementationId, 
 	MUsbClassControllerNotify& aOwner) 
 	{
-	LOG_STATIC_FUNC_ENTRY
+	OstTraceFunctionEntry0( CUSBCLASSCONTROLLERPLUGIN_NEWL_ENTRY ); 
 
 	return (reinterpret_cast<CUsbClassControllerPlugIn*>(REComSession::CreateImplementationL
 		(aImplementationId, _FOFF(CUsbClassControllerPlugIn, iPrivateEComUID),
--- a/usbmgmt/usbmgr/device/classcontroller/group/UsbClassController.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classcontroller/group/UsbClassController.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -38,4 +38,4 @@
 library			euser.lib
 library			ecom.lib
 
-#include <usb/usblogger.mmh>
+USERINCLUDE		../traces
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classcontroller/traces/OstTraceDefinitions.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,7 @@
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <opensystemtrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classcontroller/traces/fixed_id.definitions	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,6 @@
+#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt.
+[GROUP]TRACE_FATAL=0x81
+[GROUP]TRACE_FLOW=0x8a
+[TRACE]TRACE_FATAL[0x81]_CUSBCLASSCONTROLLERITERATOR_CURRENT=0x1
+[TRACE]TRACE_FLOW[0x8A]_CUSBCLASSCONTROLLERPLUGIN_NEWL_ENTRY=0x1
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBCLASSCONTROLLERITERATOR_CURRENT=0x1
--- a/usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/SRC/CUsbACMClassController.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/SRC/CUsbACMClassController.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -22,24 +22,23 @@
  @file
 */
 
-#include "CUsbACMClassController.h"
 #include <usb_std.h>
 #include <acminterface.h>
-#include <usb/acmserver.h>		
+#include <usb/acmserver.h>
+#include "CUsbACMClassController.h"
 #include "UsbmanInternalConstants.h"
-#include <usb/usblogger.h>
 #include "acmserverconsts.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "CUsbACMClassControllerTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "ACMCC");
-
+#ifdef _DEBUG
 // Panic category 
 _LIT( KAcmCcPanicCategory, "UsbAcmCc" );
-
 #endif
 
 
-
 /**
  * Panic codes for the USB ACM Class Controller.
  */
@@ -67,12 +66,13 @@
  */
 CUsbACMClassController* CUsbACMClassController::NewL(MUsbClassControllerNotify& aOwner)
 	{
-	LOG_STATIC_FUNC_ENTRY
+	OstTraceFunctionEntry0( CUSBACMCLASSCONTROLLER_NEWL_ENTRY );
 
 	CUsbACMClassController* self = new (ELeave) CUsbACMClassController(aOwner);
 	CleanupStack::PushL(self);
 	self->ConstructL();
 	CleanupStack::Pop(self);
+	OstTraceFunctionExit0( CUSBACMCLASSCONTROLLER_NEWL_EXIT );
 	return self;
 	}
 
@@ -81,6 +81,7 @@
  */
 CUsbACMClassController::~CUsbACMClassController()
 	{
+	OstTraceFunctionEntry0( CUSBACMCLASSCONTROLLER_CUSBACMCLASSCONTROLLER_DES_ENTRY );
 	Cancel();
 
 #ifdef USE_ACM_REGISTRATION_PORT
@@ -89,6 +90,7 @@
 #else
     iAcmServer.Close();
 #endif // USE_ACM_REGISTRATION_PORT
+	OstTraceFunctionExit0( CUSBACMCLASSCONTROLLER_CUSBACMCLASSCONTROLLER_DES_EXIT );
 	}
 
 /**
@@ -101,6 +103,8 @@
     : CUsbClassControllerPlugIn(aOwner, KAcmStartupPriority),
     iNumberOfAcmFunctions(KDefaultNumberOfAcmFunctions)
     {
+	OstTraceFunctionEntry0( CUSBACMCLASSCONTROLLER_CUSBACMCLASSCONTROLLER_CONS_ENTRY );
+    OstTraceFunctionExit0( CUSBACMCLASSCONTROLLER_CUSBACMCLASSCONTROLLER_CONS_EXIT );
     }
 
 /**
@@ -108,6 +112,8 @@
  */
 void CUsbACMClassController::ConstructL()
     {
+	OstTraceFunctionEntry0( CUSBACMCLASSCONTROLLER_CONSTRUCTL_ENTRY );
+	
     iNumberOfAcmFunctions = KUsbAcmNumberOfAcmFunctions;
 
     iAcmProtocolNum[0] = KUsbAcmProtocolNumAcm1;
@@ -118,21 +124,45 @@
 
 	// Prepare to use whichever mechanism is enabled to control bringing ACM 
 	// functions up and down.
+    TInt	err;
 #ifdef USE_ACM_REGISTRATION_PORT
+    
+    err = iCommServer.Connect();
+    if (err < 0)
+    	{
+		OstTrace1( TRACE_ERROR, CUSBACMCLASSCONTROLLER_CONSTRUCTL, "CUsbACMClassController::ConstructL;leave err=%d", err );
+		User::Leave(err);
+    	}
+	
+    err = iCommServer.LoadCommModule(KAcmCsyName);
+	if (err < 0)
+		{
+		OstTrace1( TRACE_ERROR, CUSBACMCLASSCONTROLLER_CONSTRUCTL_DUP1, "CUsbACMClassController::ConstructL;leave err=%d", err );
+		User::Leave(err);
+		}
 
-	LEAVEIFERRORL(iCommServer.Connect());
-	LEAVEIFERRORL(iCommServer.LoadCommModule(KAcmCsyName));
 	TName portName(KAcmSerialName);
 	portName.AppendFormat(_L("::%d"), 666);
 	// Open the registration port in shared mode in case other ACM CCs want to 
 	// open it.
-	LEAVEIFERRORL(iComm.Open(iCommServer, portName, ECommShared)); 
+	err = iComm.Open(iCommServer, portName, ECommShared);
+	if (err < 0)
+		{
+		OstTrace1( TRACE_ERROR, CUSBACMCLASSCONTROLLER_CONSTRUCTL_DUP2, "CUsbACMClassController::ConstructL;leave err=%d", err );
+		User::Leave(err);
+		}
 
 #else
-
-    LEAVEIFERRORL(iAcmServer.Connect());
+	
+	err = iAcmServer.Connect();
+	if (err < 0)
+		{
+		OstTrace1( TRACE_ERROR, CUSBACMCLASSCONTROLLER_CONSTRUCTL_DUP3, "CUsbACMClassController::ConstructL;leave err=%d", err );
+		User::Leave(err);
+		}
 
 #endif // USE_ACM_REGISTRATION_PORT
+    OstTraceFunctionExit0( CUSBACMCLASSCONTROLLER_CONSTRUCTL_EXIT );
     }
 
 /**
@@ -143,24 +173,30 @@
  */
 void CUsbACMClassController::Start(TRequestStatus& aStatus)
 	{
-	LOG_FUNC;
+	OstTraceFunctionEntry0( CUSBACMCLASSCONTROLLER_START_ENTRY );	
 
 	// We should always be idle when this function is called (guaranteed by
 	// CUsbSession).
-	__ASSERT_DEBUG( iState == EUsbServiceIdle, _USB_PANIC(KAcmCcPanicCategory, EBadApiCallStart) );
+	if (iState != EUsbServiceIdle)
+		{
+		OstTrace1( TRACE_FATAL, CUSBACMCLASSCONTROLLER_START, "CUsbACMClassController::Start;iState=%d", (TInt)iState );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmCcPanicCategory, EBadApiCallStart) );
+		}
 
 	TRequestStatus* reportStatus = &aStatus;
 	TRAPD(err, DoStartL());
 	iState = (err == KErrNone) ? EUsbServiceStarted : EUsbServiceIdle;
 	User::RequestComplete(reportStatus, err);
+	OstTraceFunctionExit0( CUSBACMCLASSCONTROLLER_START_EXIT );
 	}
 
 void CUsbACMClassController::DoStartL()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBACMCLASSCONTROLLER_DOSTARTL_ENTRY );
+	
 
 	iState = EUsbServiceStarting;
-	LOGTEXT2(_L8("    iNumberOfAcmFunctions = %d"), iNumberOfAcmFunctions);
+	OstTrace1( TRACE_NORMAL, CUSBACMCLASSCONTROLLER_DOSTARTL, "CUsbACMClassController::DoStartL;iNumberOfAcmFunctions=%d", iNumberOfAcmFunctions );
 
 #ifdef USE_ACM_REGISTRATION_PORT
 
@@ -168,21 +204,22 @@
     TUint acmSetting;
     for (TUint i = 0; i < iNumberOfAcmFunctions; i++)
         {
-        LOGTEXT2(_L8("    iAcmProtocolNum[i] = %d"), iAcmProtocolNum[i]);
+		OstTrace1( TRACE_NORMAL, CUSBACMCLASSCONTROLLER_DOSTARTL_DUP1, "CUsbACMClassController::DoStartL;iAcmProtocolNum[i]=%u", iAcmProtocolNum[i] );
 
         // indicate the number of ACMs to create, and its protocol number (in the 3rd-lowest byte)
         acmSetting = 1 | (static_cast<TUint> (iAcmProtocolNum[i]) << 16);
         TInt err = iComm.SetSignalsToMark(acmSetting);
         if (err != KErrNone)
             {
-            LOGTEXT2(_L8("    SetSignalsToMark error = %d"), err);
+			OstTrace1( TRACE_NORMAL, CUSBACMCLASSCONTROLLER_DOSTARTL_DUP2, "CUsbACMClassController::DoStartL;SetSignalsToMark error = %d", err );
             if (i != 0)
                 {
                 // Must clear any ACMs that have completed.
                 // only other than KErrNone if C32 Server fails
                 (void) iComm.SetSignalsToSpace(i);
                 }
-            LEAVEL(err);
+            OstTrace1( TRACE_ERROR, CUSBACMCLASSCONTROLLER_DOSTARTL_DUP6, "CUsbACMClassController::DoStartL;leave err=%d", err );
+            User::Leave(err);
             }
         }
 
@@ -198,20 +235,23 @@
 
         if ( err != KErrNone )
             {
-            LOGTEXT2(_L8("\tFailed to create ACM function. Error: %d"), err);
+			OstTrace1( TRACE_NORMAL, CUSBACMCLASSCONTROLLER_DOSTARTL_DUP3, "CUsbACMClassController::DoStartL;\tFailed to create ACM function. Error: %d", err);
+			
             if (i != 0)
                 {
                 //Must clear any ACMs that have been completed
                 iAcmServer.DestroyFunctions(i);
-                LOGTEXT2(_L8("\tDestroyed %d Interfaces"), i);
+                OstTrace1( TRACE_NORMAL, CUSBACMCLASSCONTROLLER_DOSTARTL_DUP4, "CUsbACMClassController::DoStartL;\tDestroyed %d Interfaces", i );
                 }
-            LEAVEL(err);
+            OstTrace1( TRACE_NORMAL, CUSBACMCLASSCONTROLLER_DOSTARTL_DUP7, "CUsbACMClassController::DoStartL; leave Error: %d", err);
+            User::Leave(err);
             }
         }
 
 #endif // USE_ACM_REGISTRATION_PORT
 	
-	LOGTEXT2(_L8("\tCreated %d ACM Interfaces"), iNumberOfAcmFunctions);
+	OstTrace1( TRACE_NORMAL, CUSBACMCLASSCONTROLLER_DOSTARTL_DUP5, "CUsbACMClassController::DoStartL;\tCreated %d ACM Interfaces", iNumberOfAcmFunctions );
+	OstTraceFunctionExit0( CUSBACMCLASSCONTROLLER_DOSTARTL_EXIT );
 	}
 
 /**
@@ -221,15 +261,21 @@
  */
 void CUsbACMClassController::Stop(TRequestStatus& aStatus)
 	{
-	LOG_FUNC;
+	OstTraceFunctionEntry0( CUSBACMCLASSCONTROLLER_STOP_ENTRY );
 
 	// We should always be started when this function is called (guaranteed by
 	// CUsbSession).
-	__ASSERT_DEBUG( iState == EUsbServiceStarted, _USB_PANIC(KAcmCcPanicCategory, EBadApiCallStop) );
+	//User::Panic(KAcmCcPanicCategory, EBadApiCallStop);
+	if (iState != EUsbServiceStarted)
+		{
+		OstTrace1( TRACE_FATAL, CUSBACMCLASSCONTROLLER_STOP, "CUsbACMClassController::Stop;iState=%d", (TInt)iState );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmCcPanicCategory, EBadApiCallStop) );
+		}
 
 	TRequestStatus* reportStatus = &aStatus;
 	DoStop();
 	User::RequestComplete(reportStatus, KErrNone);
+	OstTraceFunctionExit0( CUSBACMCLASSCONTROLLER_STOP_EXIT );
 	}
 
 /**
@@ -239,10 +285,10 @@
  */
 void CUsbACMClassController::GetDescriptorInfo(TUsbDescriptor& aDescriptorInfo) const
 	{
-	LOG_FUNC;
-
+	OstTraceFunctionEntry0( CUSBACMCLASSCONTROLLER_GETDESCRIPTORINFO_ENTRY );
 	aDescriptorInfo.iLength = KAcmDescriptorLength;
 	aDescriptorInfo.iNumInterfaces = KAcmNumberOfInterfacesPerAcmFunction*(iNumberOfAcmFunctions);
+	OstTraceFunctionExit0( CUSBACMCLASSCONTROLLER_GETDESCRIPTORINFO_EXIT );
 	}
 
 /**
@@ -250,13 +296,16 @@
  */
 void CUsbACMClassController::DoStop()
 	{
-	LOG_FUNC;
-
+	OstTraceFunctionEntry0( CUSBACMCLASSCONTROLLER_DOSTOP_ENTRY );
 	if (iState == EUsbServiceStarted)
 		{
 #ifdef USE_ACM_REGISTRATION_PORT
 		TInt err = iComm.SetSignalsToSpace(iNumberOfAcmFunctions);
-		__ASSERT_DEBUG(err == KErrNone, User::Invariant());
+		if (err != KErrNone)
+			{
+			OstTrace1( TRACE_FATAL, CUSBACMCLASSCONTROLLER_DOSTOP_DUP1, "CUsbACMClassController::DoStop;err=%d", err );
+			User::Invariant();
+			}
 		//the implementation in CRegistrationPort always return KErrNone
 		(void)err;
 		// If there is an error here, USBSVR will just ignore it, but 
@@ -268,11 +317,10 @@
 		// Destroy interfaces. Can't do anything with an error here.
 		static_cast<void>(iAcmServer.DestroyFunctions(iNumberOfAcmFunctions));
 #endif // USE_ACM_REGISTRATION_PORT
-		
-		LOGTEXT2(_L8("\tDestroyed %d Interfaces"), iNumberOfAcmFunctions);
-
+		OstTrace1( TRACE_NORMAL, CUSBACMCLASSCONTROLLER_DOSTOP, "CUsbACMClassController::DoStop;\tDestroyed %d Interfaces", iNumberOfAcmFunctions );
 		iState = EUsbServiceIdle;
 		}
+	OstTraceFunctionExit0( CUSBACMCLASSCONTROLLER_DOSTOP_EXIT );
 	}
 
 /**
@@ -281,7 +329,10 @@
  */
 void CUsbACMClassController::RunL()
 	{
-	__ASSERT_DEBUG( EFalse, _USB_PANIC(KAcmCcPanicCategory, EUnusedFunction) );
+	OstTraceFunctionEntry0( CUSBACMCLASSCONTROLLER_RUNL_ENTRY );
+	OstTrace0( TRACE_FATAL, CUSBACMCLASSCONTROLLER_RUNL, "CUsbACMClassController::RunL;EUnusedFunction" );
+	__ASSERT_DEBUG( EFalse, User::Panic(KAcmCcPanicCategory, EUnusedFunction) );
+	OstTraceFunctionExit0( CUSBACMCLASSCONTROLLER_RUNL_EXIT );
 	}
 
 /**
@@ -290,7 +341,10 @@
  */
 void CUsbACMClassController::DoCancel()
 	{
-	__ASSERT_DEBUG( EFalse, _USB_PANIC(KAcmCcPanicCategory, EUnusedFunction) );
+	OstTraceFunctionEntry0( CUSBACMCLASSCONTROLLER_DOCANCEL_ENTRY );
+	OstTrace0( TRACE_FATAL, CUSBACMCLASSCONTROLLER_DOCANCEL, "CUsbACMClassController::DoCancel;EUnusedFunction" );
+	__ASSERT_DEBUG( EFalse, User::Panic(KAcmCcPanicCategory, EUnusedFunction) );
+	OstTraceFunctionExit0( CUSBACMCLASSCONTROLLER_DOCANCEL_EXIT );
 	}
 
 /**
@@ -302,6 +356,9 @@
  */
 TInt CUsbACMClassController::RunError(TInt /*aError*/)
 	{
-	__ASSERT_DEBUG( EFalse, _USB_PANIC(KAcmCcPanicCategory, EUnusedFunction) );
+	OstTraceFunctionEntry0( CUSBACMCLASSCONTROLLER_RUNERROR_ENTRY );
+	OstTrace0( TRACE_FATAL, CUSBACMCLASSCONTROLLER_RUNERROR, "CUsbACMClassController::RunError;EUnusedFunction" );
+	__ASSERT_DEBUG( EFalse, User::Panic(KAcmCcPanicCategory, EUnusedFunction) );
+	OstTraceFunctionExit0( CUSBACMCLASSCONTROLLER_RUNERROR_EXIT );
 	return KErrNone;
 	}
--- a/usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/SRC/CUsbAcmClassImpCollection.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/SRC/CUsbAcmClassImpCollection.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -25,6 +25,11 @@
 #include <ecom/ecom.h>
 #include <ecom/implementationproxy.h>
 #include "CUsbACMClassController.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "CUsbAcmClassImpCollectionTraces.h"
+#endif
+
 
 // Define the private interface UIDs
 const TImplementationProxy UsbCCImplementationTable[] =
@@ -34,8 +39,9 @@
 
 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
     {
+	OstTraceFunctionEntry0( USBACMCLASSIMPCONTROLLER_IMPLEMENTATIONGROUPPROXY_ENTRY );
     aTableCount = sizeof(UsbCCImplementationTable) / sizeof(TImplementationProxy);
-
+    OstTraceFunctionExit0( USBACMCLASSIMPCONTROLLER_IMPLEMENTATIONGROUPPROXY_EXIT );
     return UsbCCImplementationTable;
     }
 
--- a/usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/group/AcmClassController.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/group/AcmClassController.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -29,4 +29,4 @@
 
 LIBRARY acmserver.lib
 
-#include "AcmClassControllerBase.mmp"
+#include "AcmClassControllerBase.mmp"
\ No newline at end of file
--- a/usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/group/AcmClassControllerBase.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/group/AcmClassControllerBase.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -30,12 +30,11 @@
 
 USERINCLUDE		../INC
 USERINCLUDE		../../classimplementation/ecacm/public
-USERINCLUDE		../../../../../usbman/server/public
+USERINCLUDE		../../../../../usbman/server/public 
+USERINCLUDE		../traces
 
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
 LIBRARY			euser.lib 
 LIBRARY			usbclasscontroller.lib
 LIBRARY			efsrv.lib
-
-#include <usb/usblogger.mmh>
--- a/usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/group/t_regport_AcmClassController.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/group/t_regport_AcmClassController.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -33,4 +33,4 @@
 
 LIBRARY c32.lib
 
-#include "AcmClassControllerBase.mmp"
+#include "AcmClassControllerBase.mmp"
\ No newline at end of file
--- a/usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/group/usbacmconfiguration.hby	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/group/usbacmconfiguration.hby	Tue Aug 31 17:01:47 2010 +0300
@@ -19,9 +19,7 @@
 #ifndef USBACMCONFIGURATION_HBY
 #define USBACMCONFIGURATION_HBY
 
-
-#define USBACM_PATCHDATA_KUSBACMNUMBEROFACMFUNCTIONS  1
-
+#define USBACM_PATCHDATA_KUSBACMNUMBEROFACMFUNCTIONS  2
 
 // USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM[X] is referring to the Xth ACM *function*
 // which is accessed by the (X-1)th ACM *port*
@@ -29,7 +27,7 @@
 #define USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM1  1
 //0x01 - code taken from USBCDC 1.1 Table 17- Hayes compatible modem
 
-//#define USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM2  255
+#define USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM2  255
 //0xFF - Vendor-specific
 
 //#define USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM3  1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/traces/OstTraceDefinitions.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,7 @@
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <opensystemtrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classcontroller/traces/fixed_id.definitions	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,50 @@
+#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt.
+[GROUP]TRACE_ERROR=0x82
+[GROUP]TRACE_FATAL=0x81
+[GROUP]TRACE_FLOW=0x8a
+[GROUP]TRACE_NORMAL=0x86
+[TRACE]TRACE_ERROR[0x82]_CUSBACMCLASSCONTROLLER_CONSTRUCTL=0x1
+[TRACE]TRACE_ERROR[0x82]_CUSBACMCLASSCONTROLLER_CONSTRUCTL_DUP1=0x2
+[TRACE]TRACE_ERROR[0x82]_CUSBACMCLASSCONTROLLER_CONSTRUCTL_DUP2=0x3
+[TRACE]TRACE_ERROR[0x82]_CUSBACMCLASSCONTROLLER_CONSTRUCTL_DUP3=0x4
+[TRACE]TRACE_ERROR[0x82]_CUSBACMCLASSCONTROLLER_DOSTARTL_DUP6=0x5
+[TRACE]TRACE_FATAL[0x81]_CUSBACMCLASSCONTROLLER_DOCANCEL=0x5
+[TRACE]TRACE_FATAL[0x81]_CUSBACMCLASSCONTROLLER_DOSTOP_DUP1=0x3
+[TRACE]TRACE_FATAL[0x81]_CUSBACMCLASSCONTROLLER_RUNERROR=0x6
+[TRACE]TRACE_FATAL[0x81]_CUSBACMCLASSCONTROLLER_RUNL=0x4
+[TRACE]TRACE_FATAL[0x81]_CUSBACMCLASSCONTROLLER_START=0x1
+[TRACE]TRACE_FATAL[0x81]_CUSBACMCLASSCONTROLLER_STOP=0x2
+[TRACE]TRACE_FLOW[0x8A]_CUSBACMCLASSCONTROLLER_CONSTRUCTL_ENTRY=0x7
+[TRACE]TRACE_FLOW[0x8A]_CUSBACMCLASSCONTROLLER_CONSTRUCTL_EXIT=0x8
+[TRACE]TRACE_FLOW[0x8A]_CUSBACMCLASSCONTROLLER_CUSBACMCLASSCONTROLLER_CONS_ENTRY=0x5
+[TRACE]TRACE_FLOW[0x8A]_CUSBACMCLASSCONTROLLER_CUSBACMCLASSCONTROLLER_CONS_EXIT=0x6
+[TRACE]TRACE_FLOW[0x8A]_CUSBACMCLASSCONTROLLER_CUSBACMCLASSCONTROLLER_DES_ENTRY=0x3
+[TRACE]TRACE_FLOW[0x8A]_CUSBACMCLASSCONTROLLER_CUSBACMCLASSCONTROLLER_DES_EXIT=0x4
+[TRACE]TRACE_FLOW[0x8A]_CUSBACMCLASSCONTROLLER_DOCANCEL_ENTRY=0x15
+[TRACE]TRACE_FLOW[0x8A]_CUSBACMCLASSCONTROLLER_DOCANCEL_EXIT=0x16
+[TRACE]TRACE_FLOW[0x8A]_CUSBACMCLASSCONTROLLER_DOSTARTL_ENTRY=0xb
+[TRACE]TRACE_FLOW[0x8A]_CUSBACMCLASSCONTROLLER_DOSTARTL_EXIT=0xc
+[TRACE]TRACE_FLOW[0x8A]_CUSBACMCLASSCONTROLLER_DOSTOP_ENTRY=0x11
+[TRACE]TRACE_FLOW[0x8A]_CUSBACMCLASSCONTROLLER_DOSTOP_EXIT=0x12
+[TRACE]TRACE_FLOW[0x8A]_CUSBACMCLASSCONTROLLER_GETDESCRIPTORINFO_ENTRY=0xf
+[TRACE]TRACE_FLOW[0x8A]_CUSBACMCLASSCONTROLLER_GETDESCRIPTORINFO_EXIT=0x10
+[TRACE]TRACE_FLOW[0x8A]_CUSBACMCLASSCONTROLLER_NEWL_ENTRY=0x1
+[TRACE]TRACE_FLOW[0x8A]_CUSBACMCLASSCONTROLLER_NEWL_EXIT=0x2
+[TRACE]TRACE_FLOW[0x8A]_CUSBACMCLASSCONTROLLER_RUNERROR_ENTRY=0x17
+[TRACE]TRACE_FLOW[0x8A]_CUSBACMCLASSCONTROLLER_RUNERROR_EXIT=0x18
+[TRACE]TRACE_FLOW[0x8A]_CUSBACMCLASSCONTROLLER_RUNL_ENTRY=0x13
+[TRACE]TRACE_FLOW[0x8A]_CUSBACMCLASSCONTROLLER_RUNL_EXIT=0x14
+[TRACE]TRACE_FLOW[0x8A]_CUSBACMCLASSCONTROLLER_START_ENTRY=0x9
+[TRACE]TRACE_FLOW[0x8A]_CUSBACMCLASSCONTROLLER_START_EXIT=0xa
+[TRACE]TRACE_FLOW[0x8A]_CUSBACMCLASSCONTROLLER_STOP_ENTRY=0xd
+[TRACE]TRACE_FLOW[0x8A]_CUSBACMCLASSCONTROLLER_STOP_EXIT=0xe
+[TRACE]TRACE_FLOW[0x8A]_USBACMCLASSIMPCONTROLLER_IMPLEMENTATIONGROUPPROXY_ENTRY=0x19
+[TRACE]TRACE_FLOW[0x8A]_USBACMCLASSIMPCONTROLLER_IMPLEMENTATIONGROUPPROXY_EXIT=0x1a
+[TRACE]TRACE_NORMAL[0x86]_CUSBACMCLASSCONTROLLER_DOSTARTL=0x1
+[TRACE]TRACE_NORMAL[0x86]_CUSBACMCLASSCONTROLLER_DOSTARTL_DUP1=0x2
+[TRACE]TRACE_NORMAL[0x86]_CUSBACMCLASSCONTROLLER_DOSTARTL_DUP2=0x3
+[TRACE]TRACE_NORMAL[0x86]_CUSBACMCLASSCONTROLLER_DOSTARTL_DUP3=0x4
+[TRACE]TRACE_NORMAL[0x86]_CUSBACMCLASSCONTROLLER_DOSTARTL_DUP4=0x5
+[TRACE]TRACE_NORMAL[0x86]_CUSBACMCLASSCONTROLLER_DOSTARTL_DUP5=0x7
+[TRACE]TRACE_NORMAL[0x86]_CUSBACMCLASSCONTROLLER_DOSTARTL_DUP7=0x6
+[TRACE]TRACE_NORMAL[0x86]_CUSBACMCLASSCONTROLLER_DOSTOP=0x8
--- a/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/acmserver/group/acmserver.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/acmserver/group/acmserver.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2005-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"
@@ -36,12 +36,12 @@
 SOURCE			acmserverclient.cpp
 
 USERINCLUDE		../inc
-USERINCLUDE		../../ecacm/public
+USERINCLUDE		../../ecacm/public 
+USERINCLUDE		../traces 
+
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
 LIBRARY			euser.lib 
 LIBRARY			c32.lib
 
-#include <usb/usblogger.mmh>
-
 UNPAGED
--- a/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/acmserver/src/acmserver.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/acmserver/src/acmserver.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2005-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"
@@ -22,18 +22,18 @@
 #include <e32base.h>
 #include <usb/acmserver.h>
 #include "acmserverimpl.h"
-#include <usb/usblogger.h>
 #include "acmserverconsts.h"
-
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "ACMSVRCLI");
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "acmserverTraces.h"
 #endif
 
+#ifdef _DEBUG
 /** Panic category for users of RAcmServer. */
-#ifdef _DEBUG
 _LIT(KAcmSrvPanicCat, "ACMSVR");
 #endif
 
+
 /** Panic codes for users of RAcmServer. */
 enum TAcmServerClientPanic
 	{
@@ -58,68 +58,116 @@
 EXPORT_C RAcmServer::RAcmServer() 
  :	iImpl(NULL)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( RACMSERVER_RACMSERVER_CONS_ENTRY );
+	
+	OstTraceFunctionExit0( RACMSERVER_RACMSERVER_CONS_EXIT );
 	}
 	   
 EXPORT_C RAcmServer::~RAcmServer()
 	{
-	LOG_FUNC
-
-	__ASSERT_DEBUG(!iImpl, _USB_PANIC(KAcmSrvPanicCat, EPanicNotClosed));
+	OstTraceFunctionEntry0( RACMSERVER_RACMSERVER_ENTRY_DES );
+	if (iImpl)
+		{
+		OstTraceExt1( TRACE_FATAL, RACMSERVER_RACMSERVER_DESTRUCTURE, "RAcmServer::~RAcmServer;iImpl=%p", iImpl );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmSrvPanicCat, EPanicNotClosed) );
+		}
+	OstTraceFunctionExit0( RACMSERVER_RACMSERVER_EXIT_DES );
 	}
 
 EXPORT_C TInt RAcmServer::Connect()
 	{
-	LOG_FUNC
-
-	__ASSERT_DEBUG(!iImpl, _USB_PANIC(KAcmSrvPanicCat, EPanicAlreadyConnected));
+	OstTraceFunctionEntry0( RACMSERVER_CONNECT_ENTRY );
+	if (iImpl)
+		{
+		OstTraceExt1( TRACE_FATAL, RACMSERVER_CONNECT, "RAcmServer::Connect;iImpl=%p", iImpl );	
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmSrvPanicCat, EPanicAlreadyConnected) );
+		}
 	TRAPD(err, iImpl = CAcmServerImpl::NewL());
+	OstTraceFunctionExit0( RACMSERVER_CONNECT_EXIT );
 	return err;
 	}
 
 EXPORT_C void RAcmServer::Close()
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( RACMSERVER_CLOSE_ENTRY );
+	
 	delete iImpl;
 	iImpl = NULL;
+	OstTraceFunctionExit0( RACMSERVER_CLOSE_EXIT );
 	}
 
 EXPORT_C TInt RAcmServer::CreateFunctions(const TUint aNoAcms)
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8("\taNoAcms = %d"), aNoAcms);
+	OstTraceFunctionEntry0( RACMSERVER_CREATEFUNCTIONS_ENTRY );
+	OstTrace1( TRACE_NORMAL, RACMSERVER_CREATEFUNCTIONS, "RAcmServer::CreateFunctions;aNoAcms=%d", aNoAcms );
+	
+	if (!iImpl)
+		{
+		OstTrace0( TRACE_FATAL, RACMSERVER_CREATEFUNCTIONS_DUP2, "RAcmServer::CreateFunctions;EPanicNotConnected" );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmSrvPanicCat, EPanicNotConnected) );
+		}
 
-	__ASSERT_DEBUG(iImpl, _USB_PANIC(KAcmSrvPanicCat, EPanicNotConnected));
-	__ASSERT_DEBUG(aNoAcms, _USB_PANIC(KAcmSrvPanicCat, EPanicCantInstantiateZeroAcms));
+	if (!aNoAcms)
+		{
+		OstTrace0( TRACE_FATAL, RACMSERVER_CREATEFUNCTIONS_DUP1, "RAcmServer::CreateFunctions;EPanicCantInstantiateZeroAcms" );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmSrvPanicCat, EPanicCantInstantiateZeroAcms) );
+		}
 	return iImpl->CreateFunctions(aNoAcms, KDefaultAcmProtocolNum, KControlIfcName, KDataIfcName);
 	}
 							
 EXPORT_C TInt RAcmServer::CreateFunctions(const TUint aNoAcms, const TUint8 aProtocolNum)
 	{
-	LOG_FUNC
-	LOGTEXT3(_L8("\taNoAcms = %d, aProtocolNum = %d"), aNoAcms, aProtocolNum);
+	OstTraceFunctionEntry0( RACMSERVER_CREATEFUNCTIONS_TUINT_TUINT8_ENTRY );
+	OstTraceExt2( TRACE_NORMAL, RACMSERVER_CREATEFUNCTIONS_TUINT_TUINT8, "RAcmServer::CreateFunctions;aNoAcms=%d;aProtocolNum=%d", aNoAcms, aProtocolNum );
 
-	__ASSERT_DEBUG(iImpl, _USB_PANIC(KAcmSrvPanicCat, EPanicNotConnected));
-	__ASSERT_DEBUG(aNoAcms, _USB_PANIC(KAcmSrvPanicCat, EPanicCantInstantiateZeroAcms));
+	if (!iImpl)
+		{
+		OstTrace0( TRACE_FATAL, RACMSERVER_CREATEFUNCTIONS_TUINT_TUINT8_DUP1, "RAcmServer::CreateFunctions;EPanicNotConnected" );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmSrvPanicCat, EPanicNotConnected) );
+		}
+
+	if (!aNoAcms)
+		{
+		OstTrace0( TRACE_FATAL, RACMSERVER_CREATEFUNCTIONS_TUINT_TUINT8_DUP2, "RAcmServer::CreateFunctions;EPanicCantInstantiateZeroAcms" );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmSrvPanicCat, EPanicCantInstantiateZeroAcms) );
+		}
 	return iImpl->CreateFunctions(aNoAcms, aProtocolNum, KControlIfcName, KDataIfcName);
 	}
 
 EXPORT_C TInt RAcmServer::CreateFunctions(const TUint aNoAcms, const TUint8 aProtocolNum, const TDesC& aAcmControlIfcName, const TDesC& aAcmDataIfcName)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( RACMSERVER_CREATEFUNCTIONS_TUINT_TUINT8_TDESCREF_TDESCREF_ENTRY );
+	
+	if (!iImpl)
+		{
+		OstTrace0( TRACE_FATAL, RACMSERVER_CREATEFUNCTIONS_TUINT_TUINT8_TDESCREF_TDESCREF, "RAcmServer::CreateFunctions;EPanicNotConnected" );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmSrvPanicCat, EPanicNotConnected) );
+		}
 
-	__ASSERT_DEBUG(iImpl, _USB_PANIC(KAcmSrvPanicCat, EPanicNotConnected));
-	__ASSERT_DEBUG(aNoAcms, _USB_PANIC(KAcmSrvPanicCat, EPanicCantInstantiateZeroAcms));
+	if (!aNoAcms)
+		{
+		OstTrace0( TRACE_FATAL, RACMSERVER_CREATEFUNCTIONS_TUINT_TUINT8_TDESCREF_TDESCREF_DUP1, "RAcmServer::CreateFunctions;EPanicCantInstantiateZeroAcms" );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmSrvPanicCat, EPanicCantInstantiateZeroAcms) );
+		}
 	return iImpl->CreateFunctions(aNoAcms, aProtocolNum, aAcmControlIfcName, aAcmDataIfcName);
 	}
 
 EXPORT_C TInt RAcmServer::DestroyFunctions(const TUint aNoAcms)
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8("\taNoAcms = %d"), aNoAcms);
+	OstTraceFunctionEntry0( RACMSERVER_DESTROYFUNCTIONS_ENTRY );
+	OstTrace1( TRACE_NORMAL, RACMSERVER_DESTROYFUNCTIONS, "RAcmServer::DestroyFunctions;aNoAcms=%d", aNoAcms );
 
-	__ASSERT_DEBUG(iImpl, _USB_PANIC(KAcmSrvPanicCat, EPanicNotConnected));
-	__ASSERT_DEBUG(aNoAcms, _USB_PANIC(KAcmSrvPanicCat, EPanicCantDestroyZeroAcms));
+	if (!iImpl)
+		{
+		OstTrace0( TRACE_FATAL, RACMSERVER_DESTROYFUNCTIONS_DUP1, "RAcmServer::CreateFunctions;EPanicNotConnected" );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmSrvPanicCat, EPanicNotConnected) );
+		}
+
+	if (!aNoAcms)
+		{
+		OstTrace0( TRACE_FATAL, RACMSERVER_DESTROYFUNCTIONS_DUP2, "RAcmServer::CreateFunctions;EPanicCantDestroyZeroAcms" );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmSrvPanicCat, EPanicCantInstantiateZeroAcms) );
+		}
+
 	return iImpl->DestroyFunctions(aNoAcms);
 	}
--- a/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/acmserver/src/acmserverclient.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/acmserver/src/acmserverclient.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2005-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"
@@ -20,25 +20,28 @@
 */
 
 #include <e32base.h>
+#include <usb/acmserver.h>
 #include "acmserverclient.h"
 #include "acmserverconsts.h"
-#include <usb/usblogger.h>
-#include <usb/acmserver.h>
-
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "ACMSVRCLI");
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "acmserverclientTraces.h"
 #endif
 
 /** Constructor */
 RAcmServerClient::RAcmServerClient() 
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( RACMSERVERCLIENT_RACMSERVERCLIENT_CONS_ENTRY );
+	
+	OstTraceFunctionExit0( RACMSERVERCLIENT_RACMSERVERCLIENT_CONS_EXIT );
 	}
 	   
 /** Destructor */
 RAcmServerClient::~RAcmServerClient()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( RACMSERVERCLIENT_RACMSERVERCLIENT_DES_ENTRY);
+	
+	OstTraceFunctionExit0( RACMSERVERCLIENT_RACMSERVERCLIENT_ENTRY_DES_EXIT );
 	}
 
 /**
@@ -47,7 +50,8 @@
 */
 TVersion RAcmServerClient::Version() const
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( RACMSERVERCLIENT_VERSION_ENTRY );
+	
 
 	return TVersion(	KAcmSrvMajorVersionNumber,
 						KAcmSrvMinorVersionNumber,
@@ -62,17 +66,17 @@
 */
 TInt RAcmServerClient::Connect()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( RACMSERVERCLIENT_CONNECT_ENTRY );
+	
 
 	return CreateSession(KAcmServerName, Version(), 1);
 	}
 
 TInt RAcmServerClient::CreateFunctions(const TUint aNoAcms, const TUint8 aProtocolNum, const TDesC& aAcmControlIfcName, const TDesC& aAcmDataIfcName)
 	{
-	LOG_FUNC
-	LOGTEXT5(_L("\taNoAcms = %d, aProtocolNum = %d, Control Ifc Name = %S, Data Ifc Name = %S"),
-			aNoAcms, aProtocolNum, &aAcmControlIfcName, &aAcmDataIfcName);
-
+	OstTraceFunctionEntry0( RACMSERVERCLIENT_CREATEFUNCTIONS_ENTRY );
+	OstTraceExt4( TRACE_NORMAL, RACMSERVERCLIENT_CREATEFUNCTIONS, "RAcmServerClient::CreateFunctions;aNoAcms=%d;aProtocolNum=%d;aAcmControlIfcName=%S;aAcmDataIfcName=%S", aNoAcms, aProtocolNum, aAcmControlIfcName, aAcmDataIfcName );
+	
 	TIpcArgs args;
 	args.Set(0, aNoAcms);
 	args.Set(1, aProtocolNum);
@@ -83,8 +87,7 @@
 
 TInt RAcmServerClient::DestroyFunctions(const TUint aNoAcms)
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8("\taNoAcms = %d"), aNoAcms);
-
+	OstTraceFunctionEntry0( RACMSERVERCLIENT_DESTROYFUNCTIONS_ENTRY );
+	OstTrace1( TRACE_NORMAL, RACMSERVERCLIENT_DESTROYFUNCTIONS, "RAcmServerClient::DestroyFunctions;aNoAcms=%d", aNoAcms );
 	return SendReceive(EAcmDestroyAcmFunctions, TIpcArgs(aNoAcms));
 	}
--- a/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/acmserver/src/acmserverimpl.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/acmserver/src/acmserverimpl.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2005-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"
@@ -20,27 +20,29 @@
 */
 
 #include <e32base.h>
+#include <acminterface.h>
 #include "acmserverimpl.h"
-#include <usb/usblogger.h>
-#include <acminterface.h>
-
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "ACMSVRCLI");
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "acmserverimplTraces.h"
 #endif
 
 /** Constructor */
 CAcmServerImpl::CAcmServerImpl() 
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CACMSERVERIMPL_CACMSERVERIMPL_CONS_ENTRY );
+	
+	OstTraceFunctionExit0( CACMSERVERIMPL_CACMSERVERIMPL_CONS_EXIT );
 	}
 	   
 /** Destructor */
 CAcmServerImpl::~CAcmServerImpl()
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMSERVERIMPL_CACMSERVERIMPL_DES_ENTRY);
+	
 	iCommServ.Close();
 	iAcmServerClient.Close();
+	OstTraceFunctionExit0( CACMSERVERIMPL_CACMSERVERIMPL_ENTRY_DES_EXIT );
 	}
 
 /**
@@ -49,41 +51,61 @@
 */
 CAcmServerImpl* CAcmServerImpl::NewL()
 	{
-	LOG_STATIC_FUNC_ENTRY
-
+	OstTraceFunctionEntry0( CACMSERVERIMPL_NEWL_ENTRY );
+	
 	CAcmServerImpl* self = new(ELeave) CAcmServerImpl;
 	CleanupStack::PushL(self);
 	self->ConstructL();
 	CleanupStack::Pop(self);
+	OstTraceFunctionExit0( CACMSERVERIMPL_NEWL_EXIT );
 	return self;
 	}
 
 void CAcmServerImpl::ConstructL()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CACMSERVERIMPL_CONSTRUCTL_ENTRY );
+	
 
 	// In order to connect a session, the ECACM CSY must be loaded (it 
 	// contains the server).
-	LEAVEIFERRORL(iCommServ.Connect());
-	LEAVEIFERRORL(iCommServ.LoadCommModule(KAcmCsyName));
+	TInt	err;
+	err = iCommServ.Connect();
+	if (err < 0)
+		{
+		OstTrace1( TRACE_ERROR, CACMSERVERIMPL_CONSTRUCTL, "CAcmServerImpl::ConstructL;err=%d", err );
+		User::Leave(err);
+		}
+	
+	err = iCommServ.LoadCommModule(KAcmCsyName);
+	if (err < 0)
+		{
+		OstTrace1( TRACE_ERROR, CACMSERVERIMPL_CONSTRUCTL_DUP1, "CAcmServerImpl::ConstructL;err=%d", err );
+		User::Leave(err);
+		}
+
 	// NB RCommServ::Close undoes LoadCommModule.
-	LEAVEIFERRORL(iAcmServerClient.Connect());
+	err = iAcmServerClient.Connect();
+	if (err < 0)
+		{
+		OstTrace1( TRACE_ERROR, CACMSERVERIMPL_CONSTRUCTL_DUP2, "CAcmServerImpl::ConstructL;err=%d", err );
+		User::Leave(err);
+		}
+
 	// iCommServ is eventually cleaned up in our destructor. It must be held 
 	// open at least as long as our session on the ACM server, otherwise 
 	// there's a risk the ACM server will be pulled from under our feet.
+	OstTraceFunctionExit0( CACMSERVERIMPL_CONSTRUCTL_EXIT );
 	}
 
 TInt CAcmServerImpl::CreateFunctions(const TUint aNoAcms, const TUint8 aProtocolNum, const TDesC& aAcmControlIfcName, const TDesC& aAcmDataIfcName)
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMSERVERIMPL_CREATEFUNCTIONS_ENTRY );
 	return iAcmServerClient.CreateFunctions(aNoAcms, aProtocolNum, aAcmControlIfcName, aAcmDataIfcName);
 	}
 
 TInt CAcmServerImpl::DestroyFunctions(const TUint aNoAcms)
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8("\taNoAcms = %d"), aNoAcms);
-
+	OstTraceFunctionEntry0( CACMSERVERIMPL_DESTROYFUNCTIONS_ENTRY );
+	OstTrace1( TRACE_NORMAL, CACMSERVERIMPL_DESTROYFUNCTIONS, "CAcmServerImpl::DestroyFunctions;aNoAcms=%d", aNoAcms );
 	return iAcmServerClient.DestroyFunctions(aNoAcms);
 	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/acmserver/traces/OstTraceDefinitions.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,7 @@
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <opensystemtrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/acmserver/traces/fixed_id.definitions	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,54 @@
+#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt.
+[GROUP]TRACE_ERROR=0x82
+[GROUP]TRACE_FATAL=0x81
+[GROUP]TRACE_FLOW=0x8a
+[GROUP]TRACE_NORMAL=0x86
+[TRACE]TRACE_ERROR[0x82]_CACMSERVERIMPL_CONSTRUCTL=0x1
+[TRACE]TRACE_ERROR[0x82]_CACMSERVERIMPL_CONSTRUCTL_DUP1=0x2
+[TRACE]TRACE_ERROR[0x82]_CACMSERVERIMPL_CONSTRUCTL_DUP2=0x3
+[TRACE]TRACE_FATAL[0x81]_RACMSERVER_CONNECT=0x2
+[TRACE]TRACE_FATAL[0x81]_RACMSERVER_CREATEFUNCTIONS_DUP1=0x4
+[TRACE]TRACE_FATAL[0x81]_RACMSERVER_CREATEFUNCTIONS_DUP2=0x3
+[TRACE]TRACE_FATAL[0x81]_RACMSERVER_CREATEFUNCTIONS_TUINT_TUINT8_DUP1=0x5
+[TRACE]TRACE_FATAL[0x81]_RACMSERVER_CREATEFUNCTIONS_TUINT_TUINT8_DUP2=0x6
+[TRACE]TRACE_FATAL[0x81]_RACMSERVER_CREATEFUNCTIONS_TUINT_TUINT8_TDESCREF_TDESCREF=0x7
+[TRACE]TRACE_FATAL[0x81]_RACMSERVER_CREATEFUNCTIONS_TUINT_TUINT8_TDESCREF_TDESCREF_DUP1=0x8
+[TRACE]TRACE_FATAL[0x81]_RACMSERVER_DESTROYFUNCTIONS_DUP1=0x9
+[TRACE]TRACE_FATAL[0x81]_RACMSERVER_DESTROYFUNCTIONS_DUP2=0xa
+[TRACE]TRACE_FATAL[0x81]_RACMSERVER_RACMSERVER_DESTRUCTURE=0x1
+[TRACE]TRACE_FLOW[0x8A]_CACMSERVERIMPL_CACMSERVERIMPL_CONS_ENTRY=0x15
+[TRACE]TRACE_FLOW[0x8A]_CACMSERVERIMPL_CACMSERVERIMPL_CONS_EXIT=0x16
+[TRACE]TRACE_FLOW[0x8A]_CACMSERVERIMPL_CACMSERVERIMPL_DES_ENTRY=0x17
+[TRACE]TRACE_FLOW[0x8A]_CACMSERVERIMPL_CACMSERVERIMPL_ENTRY_DES_EXIT=0x18
+[TRACE]TRACE_FLOW[0x8A]_CACMSERVERIMPL_CONSTRUCTL_ENTRY=0x1b
+[TRACE]TRACE_FLOW[0x8A]_CACMSERVERIMPL_CONSTRUCTL_EXIT=0x1c
+[TRACE]TRACE_FLOW[0x8A]_CACMSERVERIMPL_CREATEFUNCTIONS_ENTRY=0x1d
+[TRACE]TRACE_FLOW[0x8A]_CACMSERVERIMPL_DESTROYFUNCTIONS_ENTRY=0x1e
+[TRACE]TRACE_FLOW[0x8A]_CACMSERVERIMPL_NEWL_ENTRY=0x19
+[TRACE]TRACE_FLOW[0x8A]_CACMSERVERIMPL_NEWL_EXIT=0x1a
+[TRACE]TRACE_FLOW[0x8A]_RACMSERVERCLIENT_CONNECT_ENTRY=0x12
+[TRACE]TRACE_FLOW[0x8A]_RACMSERVERCLIENT_CREATEFUNCTIONS_ENTRY=0x13
+[TRACE]TRACE_FLOW[0x8A]_RACMSERVERCLIENT_DESTROYFUNCTIONS_ENTRY=0x14
+[TRACE]TRACE_FLOW[0x8A]_RACMSERVERCLIENT_RACMSERVERCLIENT_CONS_ENTRY=0xd
+[TRACE]TRACE_FLOW[0x8A]_RACMSERVERCLIENT_RACMSERVERCLIENT_CONS_EXIT=0xe
+[TRACE]TRACE_FLOW[0x8A]_RACMSERVERCLIENT_RACMSERVERCLIENT_DES_ENTRY=0xf
+[TRACE]TRACE_FLOW[0x8A]_RACMSERVERCLIENT_RACMSERVERCLIENT_ENTRY_DES_EXIT=0x10
+[TRACE]TRACE_FLOW[0x8A]_RACMSERVERCLIENT_VERSION_ENTRY=0x11
+[TRACE]TRACE_FLOW[0x8A]_RACMSERVER_CLOSE_ENTRY=0x7
+[TRACE]TRACE_FLOW[0x8A]_RACMSERVER_CLOSE_EXIT=0x8
+[TRACE]TRACE_FLOW[0x8A]_RACMSERVER_CONNECT_ENTRY=0x5
+[TRACE]TRACE_FLOW[0x8A]_RACMSERVER_CONNECT_EXIT=0x6
+[TRACE]TRACE_FLOW[0x8A]_RACMSERVER_CREATEFUNCTIONS_ENTRY=0x9
+[TRACE]TRACE_FLOW[0x8A]_RACMSERVER_CREATEFUNCTIONS_TUINT_TUINT8_ENTRY=0xa
+[TRACE]TRACE_FLOW[0x8A]_RACMSERVER_CREATEFUNCTIONS_TUINT_TUINT8_TDESCREF_TDESCREF_ENTRY=0xb
+[TRACE]TRACE_FLOW[0x8A]_RACMSERVER_DESTROYFUNCTIONS_ENTRY=0xc
+[TRACE]TRACE_FLOW[0x8A]_RACMSERVER_RACMSERVER_CONS_ENTRY=0x1
+[TRACE]TRACE_FLOW[0x8A]_RACMSERVER_RACMSERVER_CONS_EXIT=0x2
+[TRACE]TRACE_FLOW[0x8A]_RACMSERVER_RACMSERVER_ENTRY_DES=0x3
+[TRACE]TRACE_FLOW[0x8A]_RACMSERVER_RACMSERVER_EXIT_DES=0x4
+[TRACE]TRACE_NORMAL[0x86]_CACMSERVERIMPL_DESTROYFUNCTIONS=0x6
+[TRACE]TRACE_NORMAL[0x86]_RACMSERVERCLIENT_CREATEFUNCTIONS=0x4
+[TRACE]TRACE_NORMAL[0x86]_RACMSERVERCLIENT_DESTROYFUNCTIONS=0x5
+[TRACE]TRACE_NORMAL[0x86]_RACMSERVER_CREATEFUNCTIONS=0x1
+[TRACE]TRACE_NORMAL[0x86]_RACMSERVER_CREATEFUNCTIONS_TUINT_TUINT8=0x2
+[TRACE]TRACE_NORMAL[0x86]_RACMSERVER_DESTROYFUNCTIONS=0x3
--- a/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/group/ECACM.MMP	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/group/ECACM.MMP	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -60,6 +60,7 @@
 
 USERINCLUDE 	../inc
 USERINCLUDE 	../public
+USERINCLUDE 	../traces
 
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
@@ -67,8 +68,7 @@
 LIBRARY 		c32.lib
 LIBRARY			efsrv.lib
 
-#include <usb/usblogger.mmh>
-
 VENDORID 0x70000001
 
 UNPAGED
+
--- a/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/AcmPort.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/AcmPort.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -16,16 +16,15 @@
 */
 
 #include <acminterface.h>
-#include <usb/usblogger.h>
 #include "AcmPort.h"
 #include "AcmPortFactory.h"
 #include "AcmUtils.h"
 #include "AcmWriter.h"
 #include "AcmReader.h"
 #include "AcmPanic.h"
-
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "ECACM");
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "AcmPortTraces.h"
 #endif
 
 const TUint KCapsRate=(   KCapsBps50
@@ -94,12 +93,13 @@
  * @return Ownership of a newly created CAcmPort object
  */
 	{
-	LOG_STATIC_FUNC_ENTRY
-
+	OstTraceFunctionEntry0( CACMPORT_NEWL_ENTRY );
+	
 	CAcmPort* self = new(ELeave) CAcmPort(aUnit, aFactory);
 	CleanupClosePushL(*self);
 	self->ConstructL();
 	CleanupStack::Pop();
+	OstTraceFunctionExit0( CACMPORT_NEWL_EXIT );
 	return self;
 	}
 
@@ -109,12 +109,20 @@
  * port.
  */
 	{
+	OstTraceFunctionEntry0( CACMPORT_CONSTRUCTL_ENTRY );
+	
 	iReader = CAcmReader::NewL(*this, KDefaultBufferSize);
 	iWriter = CAcmWriter::NewL(*this, KDefaultBufferSize);
 
 	TName name;
+	TInt	err;
 	name.Num(iUnit);
-	LEAVEIFERRORL(SetName(&name));
+	err = SetName(&name);
+	if (err < 0)
+		{
+		OstTrace1( TRACE_FATAL, CACMPORT_CONSTRUCTL, "CAcmPort::ConstructL;err=%d", err );
+		User::Leave(err);
+		}
 
 	iCommServerConfig.iBufFlags = 0;
 	iCommServerConfig.iBufSize = iReader->BufSize();
@@ -133,6 +141,7 @@
 	iCommConfig.iParityErrorChar= 0;
 	iCommConfig.iSIREnable		= ESIRDisable;
 	iCommConfig.iSIRSettings	= 0;
+	OstTraceFunctionExit0( CACMPORT_CONSTRUCTL_EXIT );
 	}
 
 CAcmPort::CAcmPort(const TUint aUnit, MAcmPortObserver& aObserver) 
@@ -147,6 +156,8 @@
  * @param aUnit The port number.
  */
 	{
+	OstTraceFunctionEntry0( CACMPORT_CACMPORT_CONS_ENTRY );
+	OstTraceFunctionExit0( CACMPORT_CACMPORT_DES_EXIT );
 	}
 
 void CAcmPort::StartRead(const TAny* aClientBuffer, TInt aLength)
@@ -157,26 +168,30 @@
  * @param aLength number of bytes to read
  */
 	{
-	LOG_LINE
-	LOG_FUNC
-	LOGTEXT3(_L8("\taClientBuffer=0x%08x, aLength=%d"),
-		aClientBuffer, aLength);
+	OstTraceFunctionEntry0( CACMPORT_STARTREAD_ENTRY );
+	OstTraceExt2( TRACE_NORMAL, CACMPORT_STARTREAD, "CAcmPort::StartRead;aClientBuffer=%p;aLength=%d", aClientBuffer, aLength );
 
 	if ( !iAcm )
 		{
-		LOGTEXT(_L8("\t***access denied"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_STARTREAD_DUP1, "CAcmPort::StartRead;\t***access denied" );
 		ReadCompleted(KErrAccessDenied);
+		OstTraceFunctionExit0( CACMPORT_STARTREAD_EXIT );
 		return;
 		}
 
 	// Analyse the request and call the relevant API on the data reader. NB We 
 	// do not pass requests for zero bytes to the data reader. They are an 
 	// RComm oddity we should handle here.
-	__ASSERT_DEBUG(iReader, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (!iReader)
+		{
+		OstTraceExt1( TRACE_FATAL, CACMPORT_STARTREAD_DUP3, "CAcmPort::StartRead;iReader=%p", iReader );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 
 	if(iReader->IsNotifyDataAvailableQueryPending())
 		{
 		ReadCompleted(KErrInUse);
+		OstTraceFunctionExit0( CACMPORT_STARTREAD_EXIT_DUP1 );
 		return;
 		}
 
@@ -192,9 +207,10 @@
 		{
 		// Obscure RComm API feature- complete zero-length Read immediately, 
 		// to indicate that the hardware is powered up.
-		LOGTEXT(_L8("\tcompleting immediately with KErrNone"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_STARTREAD_DUP2, "CAcmPort::StartRead;\tcompleting immediately with KErrNone" );
 		ReadCompleted(KErrNone);
 		}
+	OstTraceFunctionExit0( CACMPORT_STARTREAD_EXIT_DUP2 );
 	}
 
 void CAcmPort::ReadCancel()
@@ -202,17 +218,21 @@
  * Downcall from C32. Cancel a read.
  */
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMPORT_READCANCEL_ENTRY );
 	if ( !iAcm )
 		{
-		LOGTEXT(_L8("\t***access denied"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_READCANCEL, "CAcmPort::ReadCancel;\t***access denied" );
+		OstTraceFunctionExit0( CACMPORT_READCANCEL_EXIT );
 		return;
 		}
 
-	__ASSERT_DEBUG(iReader, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (!iReader)
+		{
+		OstTraceExt1( TRACE_FATAL, CACMPORT_READCANCEL_DUP1, "CAcmPort::ReadCancel;iReader=%p", iReader );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	iReader->ReadCancel();
+	OstTraceFunctionExit0( CACMPORT_READCANCEL_EXIT_DUP1 );
 	}
 
 TInt CAcmPort::QueryReceiveBuffer(TInt& aLength) const
@@ -223,18 +243,23 @@
  * @return Error.
  */
 	{
-	LOG_LINE
-	LOG_FUNC
+	OstTraceFunctionEntry0( CACMPORT_QUERYRECEIVEBUFFER_ENTRY );
 	
 	if ( !iAcm )
 		{
-		LOGTEXT(_L8("\t***access denied"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_QUERYRECEIVEBUFFER, "CAcmPort::QueryReceiveBuffer;\t***access denied" );
+		OstTraceFunctionExit0( CACMPORT_QUERYRECEIVEBUFFER_EXIT );
 		return KErrAccessDenied;
 		}
 
-	__ASSERT_DEBUG(iReader, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (!iReader)
+		{
+		OstTraceExt1( TRACE_FATAL, CACMPORT_QUERYRECEIVEBUFFER_DUP2, "CAcmPort::QueryReceiveBuffer;iReader=%p", iReader );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	aLength = static_cast<TInt>(iReader->BufLen());
-	LOGTEXT2(_L8("\tlength=%d"), aLength);
+	OstTrace1( TRACE_NORMAL, CACMPORT_QUERYRECEIVEBUFFER_DUP1, "CAcmPort::QueryReceiveBuffer;aLength=%d", aLength );
+	OstTraceFunctionExit0( CACMPORT_QUERYRECEIVEBUFFER_EXIT_DUP1 );
 	return KErrNone;
 	}
 
@@ -245,24 +270,32 @@
  * @param aFlags Flags indicating which buffer(s) to reset.
  */
 	{
-	LOG_LINE
-	LOGTEXT2(_L8(">>CAcmPort::ResetBuffers aFlags = %d"), aFlags);
+	OstTraceFunctionEntry0( CACMPORT_RESETBUFFERS_ENTRY );
+	OstTrace1( TRACE_NORMAL, CACMPORT_RESETBUFFERS, "CAcmPort::ResetBuffers;aFlags=%d", aFlags );
 
 	if ( aFlags & KCommResetRx )
 		{
-		LOGTEXT(_L8("\tresetting Rx buffer"));
-		__ASSERT_DEBUG(iReader, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+		OstTrace0( TRACE_NORMAL, CACMPORT_RESETBUFFERS_DUP1, "CAcmPort::ResetBuffers;\tresetting Rx buffer" );
+		if (!iReader)
+			{
+			OstTraceExt1( TRACE_FATAL, CACMPORT_RESETBUFFERS_DUP3, "CAcmPort::ResetBuffers;iReader=%p", iReader );
+			__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+			}
 		iReader->ResetBuffer();
 		}
 
 	if ( aFlags & KCommResetTx )
 		{
-		LOGTEXT(_L8("\tresetting Tx buffer"));
-		__ASSERT_DEBUG(iWriter, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+		OstTrace0( TRACE_NORMAL, CACMPORT_RESETBUFFERS_DUP2, "CAcmPort::ResetBuffers;\tresetting Tx buffer" );
+		if (!iWriter)
+			{
+			OstTraceExt1( TRACE_FATAL, CACMPORT_RESETBUFFERS_DUP4, "CAcmPort::ResetBuffers;iWriter=%p", iWriter );
+			__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+			}
 		iWriter->ResetBuffer();
 		}
 
-	LOGTEXT(_L8("<<CAcmPort::ResetBuffers"));
+	OstTraceFunctionExit0( CACMPORT_RESETBUFFERS_EXIT );
 	}
 
 void CAcmPort::StartWrite(const TAny* aClientBuffer, TInt aLength)
@@ -273,32 +306,35 @@
  * @param aLength number of bytes to write
  */
 	{
-	LOG_LINE
-	LOG_FUNC
-	LOGTEXT3(_L8("\taClientBuffer=0x%08x, aLength=%d"),
-		aClientBuffer, aLength);
+	OstTraceFunctionEntry0( CACMPORT_STARTWRITE_ENTRY );
+	OstTraceExt2( TRACE_NORMAL, CACMPORT_STARTWRITE, "CAcmPort::StartWrite;aClientBuffer=%p;aLength=%d", aClientBuffer, aLength );
 
 	if ( !iAcm )
 		{
-		LOGTEXT(_L8("\t***access denied"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_STARTWRITE_DUP1, "CAcmPort::StartWrite;\t***access denied" );
 		WriteCompleted(KErrAccessDenied);
+		OstTraceFunctionExit0( CACMPORT_STARTWRITE_EXIT );
 		return;
 		}
 
 	if ( aLength < 0 )
 		{
 		// Negative length makes no sense.
-		LOGTEXT(_L8("\taLength is negative- "
-			"completing immediately with KErrArgument"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_STARTWRITE_DUP2, "CAcmPort::StartWrite;\taLength is negative-completing immediately with KErrArgument" );
 		WriteCompleted(KErrArgument);
+		OstTraceFunctionExit0( CACMPORT_STARTWRITE_EXIT_DUP1 );
 		return;
 		}
 
 	// NB We pass zero-byte writes down to the LDD as normal. This results in 
 	// a zero-length packet being sent to the host.
-
-	__ASSERT_DEBUG(iWriter, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (!iWriter)
+		{
+		OstTraceExt1( TRACE_FATAL, CACMPORT_STARTWRITE_DUP3, "CAcmPort::StartWrite;iWriter=%p", iWriter );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	iWriter->Write(aClientBuffer, static_cast<TUint>(aLength));
+	OstTraceFunctionExit0( CACMPORT_STARTWRITE_EXIT_DUP2 );
 	}
 
 void CAcmPort::WriteCancel()
@@ -306,17 +342,22 @@
  * Downcall from C32. Cancel a pending write
  */
 	{
-	LOG_LINE
-	LOG_FUNC
+	OstTraceFunctionEntry0( CACMPORT_WRITECANCEL_ENTRY );
 	
 	if ( !iAcm )
 		{
-		LOGTEXT(_L8("\t***access denied"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_WRITECANCEL, "CAcmPort::WriteCancel;\t***access denied" );
+		OstTraceFunctionExit0( CACMPORT_WRITECANCEL_EXIT );
 		return;
 		}
 
-	__ASSERT_DEBUG(iWriter, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (!iWriter)
+		{
+		OstTraceExt1( TRACE_FATAL,CACMPORT_WRITECANCEL_DUP1, "CAcmPort::WriteCancel;iWriter=%p", iWriter );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	iWriter->WriteCancel();
+	OstTraceFunctionExit0( CACMPORT_WRITECANCEL_EXIT_DUP1 );
 	}
 
 void CAcmPort::Break(TInt aTime)
@@ -328,13 +369,13 @@
  * @param aTime Length of break in microseconds
  */
 	{
-	LOG_LINE
-	LOG_FUNC
-	LOGTEXT2(_L8("\taTime=%d (microseconds)"), aTime);
+	OstTraceFunctionEntry0( CACMPORT_BREAK_ENTRY );
+	OstTrace1( TRACE_NORMAL, CACMPORT_BREAK, "CAcmPort::Break;\taTime=%d (microseconds)", aTime );
 
 	if ( !iAcm )
 		{
-		LOGTEXT(_L8("\t***access denied"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_BREAK_DUP1, "CAcmPort::Break;\t***access denied" );
+		OstTraceFunctionExit0( CACMPORT_BREAK_EXIT );
 		return;
 		}
 
@@ -346,15 +387,16 @@
 	TInt err = iAcm->BreakRequest(CBreakController::EDevice,
 		CBreakController::ETiming,
 		TTimeIntervalMicroSeconds32(aTime));
-	LOGTEXT2(_L8("\tBreakRequest = %d"), err);
+	OstTrace1( TRACE_NORMAL, CACMPORT_BREAK_DUP2, "CAcmPort::Break;\tBreakRequest = %d", err );
 	// Note that the break controller may refuse our request if a host-driven 
 	// break is outstanding.
 	if ( err )
 		{
-		LOGTEXT2(_L8("\tcalling BreakCompleted with %d"), err);
+		OstTrace1( TRACE_NORMAL, CACMPORT_BREAK_DUP3, "CAcmPort::Break;\tcalling BreakCompleted with %d", err );
 		iBreak = EFalse;
 		BreakCompleted(err);
 		}						
+	OstTraceFunctionExit0( CACMPORT_BREAK_EXIT_DUP1 );
 	}
 
 void CAcmPort::BreakCancel()
@@ -362,22 +404,20 @@
  * Downcall from C32. Cancel a pending break.
  */
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMPORT_BREAKCANCEL_ENTRY );
 	if ( !iAcm )
 		{
-		LOGTEXT(_L8("\t***access denied"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_BREAKCANCEL, "CAcmPort::BreakCancel;\t***access denied" );
+		OstTraceFunctionExit0( CACMPORT_BREAKCANCEL_EXIT );
 		return;
 		}
 	
 	iCancellingBreak = ETrue;
-
 	TInt err = iAcm->BreakRequest(CBreakController::EDevice,
 		CBreakController::EInactive);
 	// Note that the device cannot turn off a break if there's a host-driven 
 	// break in progress.
-	LOGTEXT2(_L8("\tBreakRequest = %d"), err);
+	OstTrace1( TRACE_NORMAL, CACMPORT_BREAKCANCEL_DUP1, "CAcmPort::BreakCancel;\tBreakRequest = %d", err );
 	if ( err )
 		{
 		iCancellingBreak = EFalse;
@@ -386,6 +426,7 @@
 	// Whether BreakOff worked or not, reset our flag saying we're no longer 
 	// interested in any subsequent completion anyway.
 	iBreak = EFalse;
+	OstTraceFunctionExit0( CACMPORT_BREAKCANCEL_EXIT_DUP1 );
 	}
 
 TInt CAcmPort::GetConfig(TDes8& aDes) const
@@ -396,43 +437,39 @@
  * @return Error.
  */
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMPORT_GETCONFIG_ENTRY );
 	if ( !iAcm )
 		{
-		LOGTEXT(_L8("\t***access denied"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_GETCONFIG, "CAcmPort::GetConfig;\t***access denied" );
+		OstTraceFunctionExit0( CACMPORT_GETCONFIG_EXIT );
 		return KErrAccessDenied;
 		}
 
 	if ( aDes.Length() < static_cast<TInt>(sizeof(TCommConfigV01)) )
 		{
-		LOGTEXT(_L8("\t***not supported"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_GETCONFIG_DUP12, "CAcmPort::GetConfig;\t***not supported" );
+		OstTraceFunctionExit0( CACMPORT_GETCONFIG_EXIT_DUP1 );
 		return KErrNotSupported;
 		}
 
 	TCommConfig commConfigPckg;
 	TCommConfigV01& commConfig = commConfigPckg();
 	commConfig = iCommConfig;
+	aDes.Copy(commConfigPckg);
 	
-	aDes.Copy(commConfigPckg);
+	OstTrace1( TRACE_NORMAL, CACMPORT_GETCONFIG_DUP1, "CAcmPort::GetConfig;\tiCommConfig.iRate=%d", iCommConfig.iRate );
+	OstTrace1( TRACE_NORMAL, CACMPORT_GETCONFIG_DUP2, "CAcmPort::GetConfig;\tiCommConfig.iDataBits = %d", iCommConfig.iDataBits );
+	OstTrace1( TRACE_NORMAL, CACMPORT_GETCONFIG_DUP3, "CAcmPort::GetConfig;\tiCommConfig.iStopBits = %d", iCommConfig.iStopBits );
+	OstTrace1( TRACE_NORMAL, CACMPORT_GETCONFIG_DUP4, "CAcmPort::GetConfig;\tiCommConfig.iParity = %d", iCommConfig.iParity );
+	OstTrace1( TRACE_NORMAL, CACMPORT_GETCONFIG_DUP5, "CAcmPort::GetConfig;\tiCommConfig.iHandshake = %d", iCommConfig.iHandshake );
+	OstTrace1( TRACE_NORMAL, CACMPORT_GETCONFIG_DUP6, "CAcmPort::GetConfig;\tiCommConfig.iParityError = %d", iCommConfig.iParityError );
+	OstTrace1( TRACE_NORMAL, CACMPORT_GETCONFIG_DUP7, "CAcmPort::GetConfig;\tiCommConfig.iFifo = %d", iCommConfig.iFifo );
+	OstTrace1( TRACE_NORMAL, CACMPORT_GETCONFIG_DUP8, "CAcmPort::GetConfig;\tiCommConfig.iSpecialRate = %d", iCommConfig.iSpecialRate );
+	OstTrace1( TRACE_NORMAL, CACMPORT_GETCONFIG_DUP9, "CAcmPort::GetConfig;\tiCommConfig.iTerminatorCount = %d", iCommConfig.iTerminatorCount );
+	OstTrace1( TRACE_NORMAL, CACMPORT_GETCONFIG_DUP10, "CAcmPort::GetConfig;\tiCommConfig.iSIREnable = %d", iCommConfig.iSIREnable );
+	OstTrace1( TRACE_NORMAL, CACMPORT_GETCONFIG_DUP11, "CAcmPort::GetConfig;\tiCommConfig.iSIRSettings = %d", iCommConfig.iSIRSettings );
 
-	LOGTEXT2(_L8("\tiCommConfig.iRate = %d"), iCommConfig.iRate);
-	LOGTEXT2(_L8("\tiCommConfig.iDataBits = %d"), iCommConfig.iDataBits);
-	LOGTEXT2(_L8("\tiCommConfig.iStopBits = %d"), iCommConfig.iStopBits);
-	LOGTEXT2(_L8("\tiCommConfig.iParity = %d"), iCommConfig.iParity);
-	LOGTEXT2(_L8("\tiCommConfig.iHandshake = %d"), iCommConfig.iHandshake);
-	LOGTEXT2(_L8("\tiCommConfig.iParityError = %d"), 
-		iCommConfig.iParityError);
-	LOGTEXT2(_L8("\tiCommConfig.iFifo = %d"), iCommConfig.iFifo);
-	LOGTEXT2(_L8("\tiCommConfig.iSpecialRate = %d"), 
-		iCommConfig.iSpecialRate);
-	LOGTEXT2(_L8("\tiCommConfig.iTerminatorCount = %d"), 
-		iCommConfig.iTerminatorCount);
-	LOGTEXT2(_L8("\tiCommConfig.iSIREnable = %d"), iCommConfig.iSIREnable);
-	LOGTEXT2(_L8("\tiCommConfig.iSIRSettings = %d"), 
-		iCommConfig.iSIRSettings);
-
+	OstTraceFunctionExit0( CACMPORT_GETCONFIG_EXIT_DUP2 );
 	return KErrNone;
 	}
 
@@ -444,24 +481,20 @@
  * @return Error
  */
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMPORT_SETCONFIG_ENTRY );
 	if ( !iAcm )
 		{
-		LOGTEXT(_L8("\t***access denied"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_SETCONFIG, "CAcmPort::SetConfig;\t***access denied" );
+		OstTraceFunctionExit0( CACMPORT_SETCONFIG_EXIT );
 		return KErrAccessDenied;
 		}
 
-	LOGTEXT4(_L8("\tlength of argument %d, TCommConfigV01 %d, "
-		"TCommConfigV02 %d"), 
-		aDes.Length(), 
-		(TInt)sizeof(TCommConfigV01),
-		(TInt)sizeof(TCommConfigV02));
-
+	OstTraceExt3( TRACE_NORMAL, CACMPORT_SETCONFIG_DUP1, "CAcmPort::SetConfig;\tlength of argument=%d;TCommConfigV01=%d;TCommConfigV02=%d", aDes.Length(), (TInt)sizeof(TCommConfigV01), (TInt)sizeof(TCommConfigV02) );
+	
 	if ( aDes.Length() < static_cast<TInt>(sizeof(TCommConfigV01)) )
 		{
-		LOGTEXT(_L8("\t***not supported"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_SETCONFIG_DUP2, "CAcmPort::SetConfig;\t***not supported" );
+		OstTraceFunctionExit0( CACMPORT_SETCONFIG_EXIT_DUP1 );
 		return KErrNotSupported;
 		}
 
@@ -469,18 +502,17 @@
 	configPckg.Copy(aDes);
 	TCommConfigV01& config = configPckg();
 
-	LOGTEXT2(_L8("\tiCommConfig.iRate = %d"), config.iRate);
-	LOGTEXT2(_L8("\tiCommConfig.iDataBits = %d"), config.iDataBits);
-	LOGTEXT2(_L8("\tiCommConfig.iStopBits = %d"), config.iStopBits);
-	LOGTEXT2(_L8("\tiCommConfig.iParity = %d"), config.iParity);
-	LOGTEXT2(_L8("\tiCommConfig.iHandshake = %d"), config.iHandshake);
-	LOGTEXT2(_L8("\tiCommConfig.iParityError = %d"), config.iParityError);
-	LOGTEXT2(_L8("\tiCommConfig.iFifo = %d"), config.iFifo);
-	LOGTEXT2(_L8("\tiCommConfig.iSpecialRate = %d"), config.iSpecialRate);
-	LOGTEXT2(_L8("\tiCommConfig.iTerminatorCount = %d"), 
-		config.iTerminatorCount);
-	LOGTEXT2(_L8("\tiCommConfig.iSIREnable = %d"), config.iSIREnable);
-	LOGTEXT2(_L8("\tiCommConfig.iSIRSettings = %d"), config.iSIRSettings);
+	OstTrace1( TRACE_DUMP, CACMPORT_SETCONFIG_DUP3, "CAcmPort::SetConfig;\tconfig.iRate=%d", config.iRate );
+	OstTrace1( TRACE_DUMP, CACMPORT_SETCONFIG_DUP4, "CAcmPort::SetConfig;\tconfig.iDataBits=%d", config.iDataBits );
+	OstTrace1( TRACE_DUMP, CACMPORT_SETCONFIG_DUP5, "CAcmPort::SetConfig;\tconfig.iStopBits=%d", config.iStopBits );
+	OstTrace1( TRACE_DUMP, CACMPORT_SETCONFIG_DUP6, "CAcmPort::SetConfig;\tconfig.iParity=%d", config.iParity );
+	OstTrace1( TRACE_DUMP, CACMPORT_SETCONFIG_DUP7, "CAcmPort::SetConfig;\tconfig.iHandshake=%d", config.iHandshake );
+	OstTrace1( TRACE_DUMP, CACMPORT_SETCONFIG_DUP8, "CAcmPort::SetConfig;\tconfig.iParityError=%d", config.iParityError );
+	OstTrace1( TRACE_DUMP, CACMPORT_SETCONFIG_DUP9, "CAcmPort::SetConfig;\tconfig.iFifo=%d", config.iFifo );
+	OstTrace1( TRACE_DUMP, CACMPORT_SETCONFIG_DUP10, "CAcmPort::SetConfig;\tconfig.iSpecialRate=%d", config.iSpecialRate );
+	OstTrace1( TRACE_DUMP, CACMPORT_SETCONFIG_DUP11, "CAcmPort::SetConfig;\tconfig.iTerminatorCount=%d", config.iTerminatorCount );
+	OstTrace1( TRACE_DUMP, CACMPORT_SETCONFIG_DUP12, "CAcmPort::SetConfig;\tconfig.iSIREnable=%d", config.iSIREnable );
+	OstTrace1( TRACE_DUMP, CACMPORT_SETCONFIG_DUP13, "CAcmPort::SetConfig;\tconfig.iSIRSettings=%d", config.iSIRSettings );
 
 	// Tell the reader object about the new terminators. Pass the whole config 
 	// struct by reference for ease.
@@ -493,6 +525,7 @@
 		config.iHandshake);
 	iCommConfig = config;
 
+	OstTraceFunctionExit0( CACMPORT_SETCONFIG_EXIT_DUP2 );
 	return KErrNone;
 	}
 
@@ -510,12 +543,14 @@
  * @param aHandshake	New handshake setting
  */
 	{
-	LOGTEXT(_L8(">>CAcmPort::HandleConfigNotification"));
-	LOGTEXT2(_L8("\taRate = %d"), aRate);
-	LOGTEXT2(_L8("\taDataBits = %d"), aDataBits);
-	LOGTEXT2(_L8("\taStopBits = %d"), aStopBits);
-	LOGTEXT2(_L8("\taParity = %d"), aParity);
-	LOGTEXT2(_L8("\taHandshake = %d"), aHandshake);
+	OstTraceFunctionEntry0( CACMPORT_HANDLECONFIGNOTIFICATION_ENTRY );
+	
+	OstTrace0( TRACE_DUMP, CACMPORT_HANDLECONFIGNOTIFICATION, "CAcmPort::HandleConfigNotification;>>CAcmPort::HandleConfigNotification" );
+	OstTrace1( TRACE_DUMP, CACMPORT_HANDLECONFIGNOTIFICATION_DUP1, "CAcmPort::HandleConfigNotification;aRate=%d", aRate );
+	OstTrace1( TRACE_DUMP, CACMPORT_HANDLECONFIGNOTIFICATION_DUP2, "CAcmPort::HandleConfigNotification;aDataBits=%d", aDataBits );
+	OstTrace1( TRACE_DUMP, CACMPORT_HANDLECONFIGNOTIFICATION_DUP3, "CAcmPort::HandleConfigNotification;aStopBits=%d", aStopBits );
+	OstTrace1( TRACE_DUMP, CACMPORT_HANDLECONFIGNOTIFICATION_DUP4, "CAcmPort::HandleConfigNotification;aParity=%d", aParity );
+	OstTrace1( TRACE_DUMP, CACMPORT_HANDLECONFIGNOTIFICATION_DUP5, "CAcmPort::HandleConfigNotification;aHandshake=%d", aHandshake );
 			
 	iCommNotification.iChangedMembers = 0;
 
@@ -551,12 +586,12 @@
 
 	if ( iCommNotification.iChangedMembers )
 		{
-		LOGTEXT(_L8("\tcalling ConfigChangeCompleted with KErrNone"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_HANDLECONFIGNOTIFICATION_DUP6, "CAcmPort::HandleConfigNotification;\tcalling ConfigChangeCompleted with KErrNone" );
 		ConfigChangeCompleted(iCommNotificationDes,KErrNone);
 		iNotifyConfigChange = EFalse;
 		}
 
-	LOGTEXT(_L8("<<CAcmPort::HandleConfigNotification"));
+	OstTraceFunctionExit0( CACMPORT_HANDLECONFIGNOTIFICATION_EXIT );
 	}
 
 TInt CAcmPort::SetServerConfig(const TDesC8& aDes)
@@ -567,18 +602,18 @@
  * @return Error.
  */
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMPORT_SETSERVERCONFIG_ENTRY );
 	if ( !iAcm )
 		{
-		LOGTEXT(_L8("\t***access denied"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_SETSERVERCONFIG, "CAcmPort::SetServerConfig;\t***access denied" );
+		OstTraceFunctionExit0( CACMPORT_SETSERVERCONFIG_EXIT );
 		return KErrAccessDenied;
 		}
 
 	if ( aDes.Length() < static_cast<TInt>(sizeof(TCommServerConfigV01)) )
 		{
-		LOGTEXT(_L8("\t***not supported"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_SETSERVERCONFIG_DUP1, "CAcmPort::SetServerConfig;\t***not supported" );
+		OstTraceFunctionExit0( CACMPORT_SETSERVERCONFIG_EXIT_DUP1 );
 		return KErrNotSupported;
 		}
 
@@ -588,7 +623,8 @@
 
 	if ( serverConfig.iBufFlags != KCommBufferFull )
 		{
-		LOGTEXT(_L8("\t***not supported"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_SETSERVERCONFIG_DUP2, "CAcmPort::SetServerConfig;\t***not supported" );
+		OstTraceFunctionExit0( CACMPORT_SETSERVERCONFIG_EXIT_DUP2 );
 		return KErrNotSupported;
 		}
 
@@ -598,12 +634,14 @@
 		{
 		// Failure- the buffer lengths will have been left as they were, so 
 		// just return error.
-		LOGTEXT2(_L8("\t***DoSetBufferLengths=%d"), err);
+		OstTrace1( TRACE_NORMAL, CACMPORT_SETSERVERCONFIG_DUP3, "CAcmPort::SetServerConfig;\t***DoSetBufferLengths=%d", err );
+		OstTraceFunctionExit0( CACMPORT_SETSERVERCONFIG_EXIT_DUP3 );
 		return err;
 		}
 
 	// Changed buffer sizes OK. Note that new config.
 	iCommServerConfig = serverConfig;
+	OstTraceFunctionExit0( CACMPORT_SETSERVERCONFIG_EXIT_DUP4 );
 	return KErrNone;
 	}
 
@@ -615,18 +653,18 @@
  * @return Error.
  */
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMPORT_GETSERVERCONFIG_ENTRY );
 	if ( !iAcm )
 		{
-		LOGTEXT(_L8("\t***access denied"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_GETSERVERCONFIG, "CAcmPort::GetServerConfig;\t***access denied" );	
+		OstTraceFunctionExit0( CACMPORT_GETSERVERCONFIG_EXIT );
 		return KErrAccessDenied;
 		}
 
 	if ( aDes.Length() < static_cast<TInt>(sizeof(TCommServerConfigV01)) )
 		{
-		LOGTEXT(_L8("\t***not supported"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_GETSERVERCONFIG_DUP1, "CAcmPort::GetServerConfig;\t***not supported" );
+		OstTraceFunctionExit0( CACMPORT_GETSERVERCONFIG_EXIT_DUP1 );
 		return KErrNotSupported;
 		}
 
@@ -635,6 +673,7 @@
 	TCommServerConfigV01& serverConfig = (*serverConfigPckg)();
 
 	serverConfig = iCommServerConfig;
+	OstTraceFunctionExit0( CACMPORT_GETSERVERCONFIG_EXIT_DUP2 );
 	return KErrNone;
 	}
 
@@ -646,12 +685,12 @@
  * @return Error.
  */
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMPORT_GETCAPS_ENTRY );
+	
 	if ( !iAcm )
 		{
-		LOGTEXT(_L8("\t***access denied"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_GETCAPS, "CAcmPort::GetCaps;\t***access denied" );
+		OstTraceFunctionExit0( CACMPORT_GETCAPS_EXIT );
 		return KErrAccessDenied;
 		}
 
@@ -681,13 +720,15 @@
 		break;
 	default:
 		{
-		LOGTEXT(_L8("\t***bad argument"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_GETCAPS_DUP1, "CAcmPort::GetCaps;\t***bad argument" );
+		OstTraceFunctionExit0( CACMPORT_GETCAPS_EXIT_DUP1 );
 		return KErrArgument;
 		}
 		}
 
 	aDes.Copy(capsPckg.Left(aDes.Length()));
 
+	OstTraceFunctionExit0( CACMPORT_GETCAPS_EXIT_DUP2 );
 	return KErrNone;
 	}
 
@@ -699,19 +740,18 @@
  * @return Error.
  */
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMPORT_GETSIGNALS_ENTRY );
 	if ( !iAcm )
 		{
-		LOGTEXT(_L8("\t***access denied"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_GETSIGNALS, "CAcmPort::GetSignals;\t***access denied" );
+		OstTraceFunctionExit0( CACMPORT_GETSIGNALS_EXIT );
 		return KErrAccessDenied;
 		}
 
 	aSignals = ConvertSignals(iSignals);
 
-	LOGTEXT3(_L8("iSignals=0x%x, aSignals=0x%x"),
-		iSignals, aSignals);
+	OstTraceExt2( TRACE_NORMAL, CACMPORT_GETSIGNALS_DUP1, "CAcmPort::GetSignals;iSignals=%x;aSignals=%x", iSignals, (TUint32)aSignals );
+	OstTraceFunctionExit0( CACMPORT_GETSIGNALS_EXIT_DUP1 );
 	return KErrNone;
 	}
 
@@ -723,12 +763,11 @@
  * @return Error.
  */
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMPORT_SETSIGNALSTOMARK_ENTRY );
 	if ( !iAcm )
 		{
-		LOGTEXT(_L8("\t***access denied"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_SETSIGNALSTOMARK, "CAcmPort::SetSignalsToMark;\t***access denied" );
+		OstTraceFunctionExit0( CACMPORT_SETSIGNALSTOMARK_EXIT );
 		return KErrAccessDenied;
 		}
 
@@ -736,12 +775,13 @@
 	TInt err = SetSignals(newSignals);
 	if ( err )
 		{
-		LOGTEXT2(_L8("***SetSignals = %d"), err);
+		OstTrace1( TRACE_NORMAL, CACMPORT_SETSIGNALSTOMARK_DUP1, "CAcmPort::SetSignalsToMark;***SetSignals = %d", err );
+		OstTraceFunctionExit0( CACMPORT_SETSIGNALSTOMARK_EXIT_DUP1 );
 		return err;
 		}
 
-	LOGTEXT3(_L8("iSignals=0x%x, aSignals=0x%x"),
-		iSignals, aSignals);
+	OstTraceExt2( TRACE_NORMAL, CACMPORT_SETSIGNALSTOMARK_DUP2, "CAcmPort::SetSignalsToMark;iSignals=%x;aSignals=%x", iSignals, (TUint32)aSignals );
+	OstTraceFunctionExit0( CACMPORT_SETSIGNALSTOMARK_EXIT_DUP2 );
 	return KErrNone;
 	}
 
@@ -753,12 +793,11 @@
  * @return Error.
  */
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMPORT_SETSIGNALSTOSPACE_ENTRY );
 	if ( !iAcm )
 		{
-		LOGTEXT(_L8("\t***access denied"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_SETSIGNALSTOSPACE, "CAcmPort::SetSignalsToSpace;\t***access denied" );
+		OstTraceFunctionExit0( CACMPORT_SETSIGNALSTOSPACE_EXIT );
 		return KErrAccessDenied;
 		}
 
@@ -766,12 +805,13 @@
 	TInt err = SetSignals(newSignals);
 	if ( err )
 		{
-		LOGTEXT2(_L8("***SetSignals = %d"), err);
+		OstTrace1( TRACE_NORMAL, CACMPORT_SETSIGNALSTOSPACE_DUP1, "CAcmPort::SetSignalsToSpace;***SetSignals = %d", err );
+		OstTraceFunctionExit0( CACMPORT_SETSIGNALSTOSPACE_EXIT_DUP1 );
 		return err;
 		}
 
-	LOGTEXT3(_L8("iSignals=0x%x, aSignals=0x%x"),
-		iSignals, aSignals);
+	OstTraceExt2( TRACE_NORMAL, CACMPORT_SETSIGNALSTOSPACE_DUP2, "CAcmPort::SetSignalsToSpace;iSignals=%x;aSignals=%x", iSignals, (TUint32)aSignals );
+	OstTraceFunctionExit0( CACMPORT_SETSIGNALSTOSPACE_EXIT_DUP2 );
 	return KErrNone;
 	}
 
@@ -785,23 +825,24 @@
  * @return Error.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CACMPORT_SETSIGNALS_ENTRY );
 
 	TBool ring =((aNewSignals & KSignalRNG)==KSignalRNG);
 	TBool dsr  =((aNewSignals & KSignalDSR)==KSignalDSR);
 	TBool dcd  =((aNewSignals & KSignalDCD)==KSignalDCD);
  
- 
  	if ( !iAcm )
 		{
-		LOGTEXT(_L8("\t***access denied"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_SETSIGNALS, "CAcmPort::SetSignals;\t***access denied" );
+		OstTraceFunctionExit0( CACMPORT_SETSIGNALS_EXIT );
 		return KErrAccessDenied;
 		}
 
 	TInt err = iAcm->SendSerialState(ring,dsr,dcd);
 	if ( err )
 		{
-		LOGTEXT2(_L8("\t***SendSerialState = %d- returning"), err);
+		OstTrace1( TRACE_NORMAL, CACMPORT_SETSIGNALS_DUP1, "CAcmPort::SetSignals;\t***SendSerialState = %d- returning", err );
+		OstTraceFunctionExit0( CACMPORT_SETSIGNALS_EXIT_DUP1 );
 		return err;
 		}
 
@@ -831,7 +872,7 @@
 				}
 
 			// Report correctly mapped signals that client asked for
-			LOGTEXT(_L8("\tcalling SignalChangeCompleted with KErrNone"));
+			OstTrace0( TRACE_NORMAL, CACMPORT_SETSIGNALS_DUP2, "CAcmPort::SetSignals;\tcalling SignalChangeCompleted with KErrNone" );
 			TUint32 signals = ConvertSignals ( changedSignalsMask | ( aNewSignals & iNotifySignalMask ) );
 			SignalChangeCompleted ( signals, KErrNone );
 			iNotifySignalChange = EFalse;
@@ -840,7 +881,7 @@
 
 	// Store new signals in iSignals
 	iSignals = aNewSignals;
-
+	OstTraceFunctionExit0( CACMPORT_SETSIGNALS_EXIT_DUP2 );
 	return KErrNone;
 	}
 
@@ -859,10 +900,9 @@
  * role.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMPORT_CONVERTANDFILTERSIGNALS_ENTRY );
+	
 	TUint32 signals = 0;
-
 	// note that this never allows the client to use this method
 	// to diddle the BREAK state
 
@@ -894,6 +934,7 @@
 			|	KSignalRNG);
 		}
 
+	OstTraceFunctionExit0( CACMPORT_CONVERTANDFILTERSIGNALS_EXIT );
 	return signals;
 	}
 
@@ -916,8 +957,8 @@
  * port is.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMPORT_CONVERTSIGNALS_ENTRY );
+	
 	// Swap signals around if the client is expecting DTE signalling
 	if ( iRole == ECommRoleDTE )
 		{
@@ -965,6 +1006,7 @@
 		aSignals = ( aSignals & ~KSwapSignals ) | swappedSignals;
 		}
 
+	OstTraceFunctionExit0( CACMPORT_CONVERTSIGNALS_EXIT );
 	return aSignals;
 	}
 
@@ -979,18 +1021,23 @@
  * @return Error.
  */
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMPORT_GETRECEIVEBUFFERLENGTH_ENTRY );
+	
 	if ( !iAcm )
 		{
-		LOGTEXT(_L8("\t***access denied"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_GETRECEIVEBUFFERLENGTH, "CAcmPort::GetReceiveBufferLength;\t***access denied" );
+		OstTraceFunctionExit0( CACMPORT_GETRECEIVEBUFFERLENGTH_EXIT );
 		return KErrAccessDenied;
 		}
 
-	__ASSERT_DEBUG(iReader, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (!iReader)
+		{
+		OstTraceExt1( TRACE_FATAL, CACMPORT_GETRECEIVEBUFFERLENGTH_DUP2, "CAcmPort::GetReceiveBufferLength;iReader=%p", iReader );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	aLength = static_cast<TInt>(iReader->BufSize());
-	LOGTEXT2(_L8("\tlength=%d"), aLength);
+	OstTrace1( TRACE_NORMAL, CACMPORT_GETRECEIVEBUFFERLENGTH_DUP1, "CAcmPort::GetReceiveBufferLength;aLength=%d", aLength );
+	OstTraceFunctionExit0( CACMPORT_GETRECEIVEBUFFERLENGTH_EXIT_DUP1 );
 	return KErrNone;
 	}
 
@@ -1003,10 +1050,14 @@
  * @return Error.
  */
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8("\taLength=%d"), aLength);
+	OstTraceFunctionEntry0( CACMPORT_DOSETBUFFERLENGTHS_ENTRY );
+	OstTrace1( TRACE_NORMAL, CACMPORT_DOSETBUFFERLENGTHS, "CAcmPort::DoSetBufferLengths;aLength=%d", aLength );
 
-	__ASSERT_DEBUG(iReader, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (!iReader)
+		{
+		OstTraceExt1( TRACE_FATAL, CACMPORT_DOSETBUFFERLENGTHS_DUP5, "CAcmPort::DoSetBufferLengths;iReader=%p", iReader );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	// Sart trying to resize buffers. Start with the reader. 
 	// Before we start though, set some stuff up we may need later (see 
 	// comments below).
@@ -1017,8 +1068,8 @@
 		// If we can't allocate the dummy buffer, we can't guarantee that we 
 		// can roll back this API safely if it fails halfway through. So abort 
 		// the entire operation.
-		LOGTEXT(_L8("\t***failed to allocate dummy buffer- "
-			"returning KErrNoMemory"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_DOSETBUFFERLENGTHS_DUP1, "CAcmPort::DoSetBufferLengths;\t***failed to allocate dummy buffer- returning KErrNoMemory" );
+		OstTraceFunctionExit0( CACMPORT_DOSETBUFFERLENGTHS_EXIT );
 		return KErrNoMemory;
 		}
 
@@ -1029,12 +1080,17 @@
 		// (i.e. at its old size). This is a safe failure case- simply 
 		// clean up and return the error to the client.
 		delete dummyBuffer;
-		LOGTEXT2(_L8("\t***SetBufSize on reader failed with %d"), ret);
+		OstTrace1( TRACE_NORMAL, CACMPORT_DOSETBUFFERLENGTHS_DUP2, "CAcmPort::DoSetBufferLengths;\t***SetBufSize on reader failed with %d", ret );
+		OstTraceFunctionExit0( CACMPORT_DOSETBUFFERLENGTHS_EXIT_DUP1 );
 		return ret;
 		}
 
 	// OK, the Rx buffer has been resized, now for the Tx buffer...
-	__ASSERT_DEBUG(iWriter, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (!iWriter)
+		{
+		OstTraceExt1( TRACE_FATAL, CACMPORT_DOSETBUFFERLENGTHS_DUP6, "CAcmPort::DoSetBufferLengths;iWriter=%p", iWriter );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	ret = iWriter->SetBufSize(aLength);
 	if ( ret )
 		{
@@ -1043,20 +1099,25 @@
 		// buffer back to the old size. To make sure that this will work, free 
 		// the dummy buffer we initially allocated.
 		delete dummyBuffer;
-		LOGTEXT2(_L8("\t***SetBufSize on writer failed with %d"), ret);
+		OstTrace1( TRACE_NORMAL, CACMPORT_DOSETBUFFERLENGTHS_DUP3, "CAcmPort::DoSetBufferLengths;\t***SetBufSize on writer failed with %d", ret );
 		TInt err = iReader->SetBufSize(oldSize);
-		__ASSERT_DEBUG(!err, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+		if (err)
+			{
+			OstTrace1( TRACE_FATAL, CACMPORT_DOSETBUFFERLENGTHS_DUP7, "CAcmPort::DoSetBufferLengths;err=%d", err );
+			__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+			}
 		static_cast<void>(err);
 		// Now both buffers are at the size they started at, and the 
 		// request failed with error code 'ret'.
+		OstTraceFunctionExit0( CACMPORT_DOSETBUFFERLENGTHS_EXIT_DUP2 );
 		return ret;
 		}
 
 	// We seem to have successfully resized both buffers... clean up and 
 	// return.
 	delete dummyBuffer;
-	
-	LOGTEXT(_L8("\treturning KErrNone"));
+	OstTrace0( TRACE_NORMAL, CACMPORT_DOSETBUFFERLENGTHS_DUP4, "CAcmPort::DoSetBufferLengths;\treturning KErrNone" );
+	OstTraceFunctionExit0( CACMPORT_DOSETBUFFERLENGTHS_EXIT_DUP3 );
 	return KErrNone;
 	}
 
@@ -1070,19 +1131,18 @@
  * @return Error.
  */
 	{
-	LOG_LINE
-	LOG_FUNC
-	LOGTEXT2(_L8("\taLength=%d"), aLength);
-
+	OstTraceFunctionEntry0( CACMPORT_SETRECEIVEBUFFERLENGTH_ENTRY );
+	OstTrace1( TRACE_NORMAL, CACMPORT_SETRECEIVEBUFFERLENGTH, "CAcmPort::SetReceiveBufferLength;aLength=%d", aLength );
 	if ( !iAcm )
 		{
-		LOGTEXT(_L8("\t***access denied"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_SETRECEIVEBUFFERLENGTH_DUP1, "CAcmPort::SetReceiveBufferLength;\t***access denied" );
+		OstTraceFunctionExit0( CACMPORT_SETRECEIVEBUFFERLENGTH_EXIT );
 		return KErrAccessDenied;
 		}
 
 	TInt ret = DoSetBufferLengths(static_cast<TUint>(aLength));
-	LOGTEXT2(_L8("\tDoSetBufferLengths=%d"), ret);
-	LOGTEXT2(_L8("\treturning %d"), ret);
+	OstTrace1( TRACE_NORMAL, CACMPORT_SETRECEIVEBUFFERLENGTH_DUP2, "CAcmPort::SetReceiveBufferLength;\tDoSetBufferLengths = return value = %d", ret );
+	OstTraceFunctionExit0( CACMPORT_SETRECEIVEBUFFERLENGTH_EXIT_DUP1 );
 	return ret;
 	}
 
@@ -1091,9 +1151,9 @@
  * Downcall from C32. Destruct - we must (eventually) call delete this
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMPORT_DESTRUCT_ENTRY );
 	delete this;
+	OstTraceFunctionExit0( CACMPORT_DESTRUCT_EXIT );
 	}
 
 void CAcmPort::FreeMemory()
@@ -1102,8 +1162,8 @@
  * Implemented to do nothing.
  */
 	{
-	LOG_LINE
-	LOG_FUNC
+	OstTraceFunctionEntry0( CACMPORT_FREEMEMORY_ENTRY );
+	OstTraceFunctionExit0( CACMPORT_FREEMEMORY_EXIT );
 	}
 
 void CAcmPort::NotifyDataAvailable()
@@ -1111,18 +1171,22 @@
  * Downcall from C32. Notify client when data is available. 
  */
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMPORT_NOTIFYDATAAVAILABLE_ENTRY );
 	if ( !iAcm )
 		{
-		LOGTEXT(_L8("\t***access denied"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_NOTIFYDATAAVAILABLE, "CAcmPort::NotifyDataAvailable;\t***access denied" );
 		NotifyDataAvailableCompleted(KErrAccessDenied);
+		OstTraceFunctionExit0( CACMPORT_NOTIFYDATAAVAILABLE_EXIT );
 		return;
 		}
-	__ASSERT_DEBUG(iReader, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
-
+	
+	if (!iReader)
+		{
+		OstTraceExt1( TRACE_FATAL, CACMPORT_NOTIFYDATAAVAILABLE_DUP1, "CAcmPort::NotifyDataAvailable;iReader=%p", iReader );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	iReader->NotifyDataAvailable();		
+	OstTraceFunctionExit0( CACMPORT_NOTIFYDATAAVAILABLE_EXIT_DUP1 );
 	}
 
 void CAcmPort::NotifyDataAvailableCancel()
@@ -1131,17 +1195,22 @@
  * that C32 actually completes the client's request for us.
  */
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMPORT_NOTIFYDATAAVAILABLECANCEL_ENTRY );
+	
 	if ( !iAcm )
 		{
-		LOGTEXT(_L8("\t***access denied"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_NOTIFYDATAAVAILABLECANCEL, "CAcmPort::NotifyDataAvailableCancel;\t***access denied" );
+		OstTraceFunctionExit0( CACMPORT_NOTIFYDATAAVAILABLECANCEL_EXIT );
 		return;
 		}
-	__ASSERT_DEBUG(iReader, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
 
+	if (!iReader)
+		{
+		OstTraceExt1( TRACE_FATAL, CACMPORT_NOTIFYDATAAVAILABLECANCEL_DUP1, "CAcmPort::NotifyDataAvailableCancel;iReader=%p", iReader );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	iReader->NotifyDataAvailableCancel();
+	OstTraceFunctionExit0( CACMPORT_NOTIFYDATAAVAILABLECANCEL_EXIT_DUP1 );
 	}
 
 TInt CAcmPort::GetFlowControlStatus(TFlowControl& /*aFlowControl*/)
@@ -1152,16 +1221,17 @@
  * @return Error.
  */
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMPORT_GETFLOWCONTROLSTATUS_ENTRY );
+	
 	if ( !iAcm )
 		{
-		LOGTEXT(_L8("\t***access denied"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_GETFLOWCONTROLSTATUS, "CAcmPort::GetFlowControlStatus;\t***access denied" );
+		OstTraceFunctionExit0( CACMPORT_GETFLOWCONTROLSTATUS_EXIT );
 		return KErrAccessDenied;
 		}
 
-	LOGTEXT(_L8("\t***not supported"));
+	OstTrace0( TRACE_NORMAL, CACMPORT_GETFLOWCONTROLSTATUS_DUP1, "CAcmPort::GetFlowControlStatus;\t***not supported" );
+	OstTraceFunctionExit0( CACMPORT_GETFLOWCONTROLSTATUS_EXIT_DUP1 );
 	return KErrNotSupported;
 	}
 
@@ -1173,18 +1243,19 @@
  * it's not very useful.
  */
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMPORT_NOTIFYOUTPUTEMPTY_ENTRY );
+	
 	if ( !iAcm )
 		{
-		LOGTEXT(_L8("\t***access denied"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_NOTIFYOUTPUTEMPTY, "CAcmPort::NotifyOutputEmpty;\t***access denied" );
 		NotifyOutputEmptyCompleted(KErrAccessDenied);
+		OstTraceFunctionExit0( CACMPORT_NOTIFYOUTPUTEMPTY_EXIT );
 		return;
 		}
 
-	LOGTEXT(_L8("\t***not supported"));
+	OstTrace0( TRACE_NORMAL, CACMPORT_NOTIFYOUTPUTEMPTY_DUP1, "CAcmPort::NotifyOutputEmpty;\t***not supported" );
 	NotifyOutputEmptyCompleted(KErrNotSupported);
+	OstTraceFunctionExit0( CACMPORT_NOTIFYOUTPUTEMPTY_EXIT_DUP1 );
 	}
 
 void CAcmPort::NotifyOutputEmptyCancel()
@@ -1194,8 +1265,8 @@
  * us.
  */
 	{
-	LOG_LINE
-	LOG_FUNC
+	OstTraceFunctionEntry0( CACMPORT_NOTIFYOUTPUTEMPTYCANCEL_ENTRY );
+	OstTraceFunctionExit0( CACMPORT_NOTIFYOUTPUTEMPTYCANCEL_EXIT );
 	}
 
 void CAcmPort::NotifyBreak()
@@ -1204,21 +1275,25 @@
  * line.
  */
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMPORT_NOTIFYBREAK_ENTRY );
+	
 	if ( !iAcm )
 		{
-		LOGTEXT(_L8("\t***access denied"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_NOTIFYBREAK, "CAcmPort::NotifyBreak;\t***access denied" );
 		BreakNotifyCompleted(KErrAccessDenied);
+		OstTraceFunctionExit0( CACMPORT_NOTIFYBREAK_EXIT );
 		return;
 		}
 
 	// C32 protects us against this.
-	__ASSERT_DEBUG(!iNotifyBreak, 
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (iNotifyBreak)
+		{
+		OstTrace1( TRACE_FATAL, CACMPORT_NOTIFYBREAK_DUP1, "CAcmPort::NotifyBreak;iNotifyBreak=%d", (TInt)iNotifyBreak );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 
 	iNotifyBreak = ETrue;
+	OstTraceFunctionExit0( CACMPORT_NOTIFYBREAK_EXIT_DUP1 );
 	}
 
 void CAcmPort::NotifyBreakCancel()
@@ -1227,16 +1302,16 @@
  * Note that C32 actually completes the client's request for us.
  */
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMPORT_NOTIFYBREAKCANCEL_ENTRY );
 	if ( !iAcm )
 		{
-		LOGTEXT(_L8("\t***access denied"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_NOTIFYBREAKCANCEL, "CAcmPort::NotifyBreakCancel;\t***access denied" );
+		OstTraceFunctionExit0( CACMPORT_NOTIFYBREAKCANCEL_EXIT );
 		return;
 		}
 
 	iNotifyBreak = EFalse;
+	OstTraceFunctionExit0( CACMPORT_NOTIFYBREAKCANCEL_EXIT_DUP1 );
 	}
 
 void CAcmPort::BreakRequestCompleted()
@@ -1247,17 +1322,17 @@
  * This is implemented to complete the RComm client's Break request.
  */
  	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CACMPORT_BREAKREQUESTCOMPLETED_ENTRY );
+	
 
 	if ( !iCancellingBreak )
 		{
-		LOGTEXT(_L8("\tcalling BreakCompleted with KErrNone"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_BREAKREQUESTCOMPLETED, "CAcmPort::BreakRequestCompleted;\tcalling BreakCompleted with KErrNone" );
 		BreakCompleted(KErrNone);
 		}
 	else
 		{
-		LOGTEXT(_L8("\tbreak is being cancelled- "
-			"letting C32 complete the request"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_BREAKREQUESTCOMPLETED_DUP1, "CAcmPort::BreakRequestCompleted;\tbreak is being cancelled-letting C32 complete the request" );
 		}
 	// In the event of an RComm::BreakCancel, this function is called 
 	// sychronously with CAcmPort::BreakCancel, and C32 will complete the 
@@ -1265,6 +1340,7 @@
 	// only need to complete it if there isn't a cancel going on.
 	iBreak = EFalse;
 	iCancellingBreak = EFalse;
+	OstTraceFunctionExit0( CACMPORT_BREAKREQUESTCOMPLETED_EXIT );
 	}
 
 void CAcmPort::BreakStateChange()
@@ -1277,8 +1353,7 @@
  * NotifySignalChange requests, and complete NotifyBreak requests.
  */
  	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMPORT_BREAKSTATECHANGE_ENTRY );
 	// TODO: what if no iAcm?
 
 	// Take a copy of the current signal state for comparison later
@@ -1288,12 +1363,12 @@
 	// it and apply the appropriate flag state to the local iSignals
 	if ( iAcm && iAcm->BreakActive() )
 		{
-		LOGTEXT(_L8("\tbreak is active"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_BREAKSTATECHANGE, "CAcmPort::BreakStateChange;\tbreak is active" );
 		iSignals |= KSignalBreak;
 		}
 	else
 		{
-		LOGTEXT(_L8("\tbreak is inactive"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_BREAKSTATECHANGE_DUP1, "CAcmPort::BreakStateChange;\tbreak is inactive" );
 		iSignals &= ~KSignalBreak;
 		}
 
@@ -1302,7 +1377,7 @@
 	// out of the break-active condition...
 	if ( iNotifyBreak && !iBreak )
 		{
-		LOGTEXT(_L8("\tcalling BreakNotifyCompleted with KErrNone"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_BREAKSTATECHANGE_DUP2, "CAcmPort::BreakStateChange;\tcalling BreakNotifyCompleted with KErrNone" );
 		BreakNotifyCompleted(KErrNone);
 		iNotifyBreak = EFalse;
 		}
@@ -1313,11 +1388,12 @@
 		&&	( ( iNotifySignalMask & ( iSignals ^ oldSignals ) ) != 0 ) )
 		{
 		// Report correctly mapped signals that client asked for
-		LOGTEXT(_L8("\tcalling SignalChangeCompleted with KErrNone"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_BREAKSTATECHANGE_DUP3, "CAcmPort::BreakStateChange;\tcalling SignalChangeCompleted with KErrNone" );
 		TUint32 signals = ConvertSignals ( KBreakChanged | ( iSignals & iNotifySignalMask ) );
 		SignalChangeCompleted( signals, KErrNone);
 		iNotifySignalChange = EFalse;
 		}
+	OstTraceFunctionExit0( CACMPORT_BREAKSTATECHANGE_EXIT );
 	}
 
 void CAcmPort::NotifyFlowControlChange()
@@ -1326,18 +1402,19 @@
  * Note that this is not supported.
  */
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMPORT_NOTIFYFLOWCONTROLCHANGE_ENTRY );
+	
 	if ( !iAcm )
 		{
-		LOGTEXT(_L8("\t***access denied"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_NOTIFYFLOWCONTROLCHANGE, "CAcmPort::NotifyFlowControlChange;\t***access denied" );
 		FlowControlChangeCompleted(EFlowControlOn, KErrAccessDenied);
+		OstTraceFunctionExit0( CACMPORT_NOTIFYFLOWCONTROLCHANGE_EXIT );
 		return;
 		}
 
-	LOGTEXT(_L8("\t***not supported"));
+	OstTrace0( TRACE_NORMAL, CACMPORT_NOTIFYFLOWCONTROLCHANGE_DUP1, "CAcmPort::NotifyFlowControlChange;\t***not supported" );
 	FlowControlChangeCompleted(EFlowControlOn,KErrNotSupported);
+	OstTraceFunctionExit0( CACMPORT_NOTIFYFLOWCONTROLCHANGE_EXIT_DUP1 );
 	}
 
 void CAcmPort::NotifyFlowControlChangeCancel()
@@ -1347,8 +1424,8 @@
  * request for us.
  */
 	{
-	LOG_LINE
-	LOG_FUNC
+	OstTraceFunctionEntry0( CACMPORT_NOTIFYFLOWCONTROLCHANGECANCEL_ENTRY );
+	OstTraceFunctionExit0( CACMPORT_NOTIFYFLOWCONTROLCHANGECANCEL_EXIT );
 	}
 
 void CAcmPort::NotifyConfigChange()
@@ -1357,25 +1434,26 @@
  * configuration.
  */
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMPORT_NOTIFYCONFIGCHANGE_ENTRY );
+	
 	if ( !iAcm )
 		{
-		LOGTEXT(_L8("\t***access denied"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_NOTIFYCONFIGCHANGE, "CAcmPort::NotifyConfigChange;\t***access denied" );
 		ConfigChangeCompleted(iCommNotificationDes, KErrAccessDenied);
+		OstTraceFunctionExit0( CACMPORT_NOTIFYCONFIGCHANGE_EXIT );
 		return;
 		}
 
 	if ( iNotifyConfigChange )
 		{
-		LOGTEXT(_L8("\t***in use"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_NOTIFYCONFIGCHANGE_DUP1, "CAcmPort::NotifyConfigChange;\t***in use" );
 		ConfigChangeCompleted(iCommNotificationDes,KErrInUse);
 		}
 	else
 		{
 		iNotifyConfigChange = ETrue;
 		}
+	OstTraceFunctionExit0( CACMPORT_NOTIFYCONFIGCHANGE_EXIT_DUP1 );
 	}
 
 void CAcmPort::NotifyConfigChangeCancel()
@@ -1385,16 +1463,17 @@
  * client's request for us.
  */
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMPORT_NOTIFYCONFIGCHANGECANCEL_ENTRY );
+	
 	if ( !iAcm )
 		{
-		LOGTEXT(_L8("\t***access denied"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_NOTIFYCONFIGCHANGECANCEL, "CAcmPort::NotifyConfigChangeCancel;\t***access denied" );
+		OstTraceFunctionExit0( CACMPORT_NOTIFYCONFIGCHANGECANCEL_EXIT );
 		return;
 		}
 
 	iNotifyConfigChange = EFalse;
+	OstTraceFunctionExit0( CACMPORT_NOTIFYCONFIGCHANGECANCEL_EXIT_DUP1 );
 	}
 
 void CAcmPort::HostConfigChange(const TCommConfigV01& aConfig)
@@ -1404,8 +1483,7 @@
  * @param aConfig	New configuration data.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMPORT_HOSTCONFIGCHANGE_ENTRY );
 	HandleConfigNotification(aConfig.iRate,
 		aConfig.iDataBits,
 		aConfig.iParity,
@@ -1415,6 +1493,7 @@
 	iCommConfig.iDataBits = aConfig.iDataBits;
 	iCommConfig.iParity = aConfig.iParity;
 	iCommConfig.iStopBits = aConfig.iStopBits;
+	OstTraceFunctionExit0( CACMPORT_HOSTCONFIGCHANGE_EXIT );
 	}
 
 void CAcmPort::NotifySignalChange(TUint aSignalMask)
@@ -1422,20 +1501,18 @@
  * Downcall from C32. Notify a client of a change to the signal lines.
  */
 	{
-	LOG_LINE
-	LOGTEXT2(_L8(">>CAcmPort::NotifySignalChange aSignalMask=0x%08x"), 
-		aSignalMask);
-
+	OstTraceFunctionEntry0( CACMPORT_NOTIFYSIGNALCHANGE_ENTRY );
+	OstTrace1( TRACE_NORMAL, CACMPORT_NOTIFYSIGNALCHANGE, "CAcmPort::NotifySignalChange;>>CAcmPort::NotifySignalChange aSignalMask=0x%08x", aSignalMask );
 	if ( iNotifySignalChange )
 		{
 		if ( !iAcm )
 			{
-			LOGTEXT(_L8("\t***access denied"));
+			OstTrace0( TRACE_NORMAL, CACMPORT_NOTIFYSIGNALCHANGE_DUP1, "CAcmPort::NotifySignalChange;\t***access denied" );
 			SignalChangeCompleted(0, KErrAccessDenied);
 			}
 		else
 			{
-			LOGTEXT(_L8("\t***in use"));
+			OstTrace0( TRACE_NORMAL, CACMPORT_NOTIFYSIGNALCHANGE_DUP2, "CAcmPort::NotifySignalChange;\t***in use" );
 			SignalChangeCompleted(0, KErrInUse);
 			}
 		}
@@ -1447,7 +1524,8 @@
 		iNotifySignalMask = ConvertSignals(aSignalMask);
 		}
 
-	LOGTEXT(_L8("<<CAcmPort::NotifySignalChange"));
+	OstTrace0( TRACE_NORMAL, CACMPORT_NOTIFYSIGNALCHANGE_DUP3, "CAcmPort::NotifySignalChange;<<CAcmPort::NotifySignalChange" );
+	OstTraceFunctionExit0( CACMPORT_NOTIFYSIGNALCHANGE_EXIT );
 	}
 
 void CAcmPort::NotifySignalChangeCancel()
@@ -1457,16 +1535,17 @@
  * request for us.
  */
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMPORT_NOTIFYSIGNALCHANGECANCEL_ENTRY );
+	
 	if ( !iAcm )
 		{
-		LOGTEXT(_L8("\t***access denied"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_NOTIFYSIGNALCHANGECANCEL, "CAcmPort::NotifySignalChangeCancel;\t***access denied" );
+		OstTraceFunctionExit0( CACMPORT_NOTIFYSIGNALCHANGECANCEL_EXIT );
 		return;
 		}
 
 	iNotifySignalChange = EFalse;
+	OstTraceFunctionExit0( CACMPORT_NOTIFYSIGNALCHANGECANCEL_EXIT_DUP1 );
 	}
 
 void CAcmPort::HostSignalChange(TBool aDtr, TBool aRts)
@@ -1477,8 +1556,9 @@
  * @param aRts The state of the RTS signal.
  */
 	{
-	LOGTEXT3(_L8(">>CAcmPort::HostSignalChange aDtr=%d, aRts=%d"), aDtr, aRts);
-
+	OstTraceFunctionEntry0( CACMPORT_HOSTSIGNALCHANGE_ENTRY );
+	OstTraceExt2( TRACE_NORMAL, CACMPORT_HOSTSIGNALCHANGE, "CAcmPort::HostSignalChange;>>CAcmPort::HostSignalChange aDtr=%d, aRts=%d", aDtr, aRts );
+	
 	// Take a copy of the current signal state for comparison later
 	TUint32 oldSignals = iSignals;
 
@@ -1506,8 +1586,7 @@
 		{
 		// Create bitfield of changed signals that client is interested in
 		TUint32 changedSignals = ( iSignals ^ oldSignals ) & iNotifySignalMask;
-		LOGTEXT5(_L8("\tiSignals=%x, oldSignals=%x, changedSignals=%x, iNotifySignalMask=%x")
-						,iSignals, oldSignals, changedSignals, iNotifySignalMask);
+		OstTraceExt4( TRACE_NORMAL, CACMPORT_HOSTSIGNALCHANGE_DUP1, "CAcmPort::HostSignalChange;iSignals=%x;oldSignals=%x;changedSignals=%x;iNotifySignalMask=%x", iSignals, oldSignals, changedSignals, (TUint32)iNotifySignalMask );
 		if ( changedSignals != 0 )
 			{
 			// Mark which signals have changed
@@ -1520,17 +1599,18 @@
 				{
 				changedSignalsMask |= KRTSChanged;
 				}
-			LOGTEXT2(_L8("\tchangedSignalsMask=%x"), changedSignalsMask);
-
+			
+			OstTrace1( TRACE_NORMAL, CACMPORT_HOSTSIGNALCHANGE_DUP2, "CAcmPort::HostSignalChange;changedSignalsMask=%x", changedSignalsMask );
 			// Report correctly mapped signals that client asked for
 			TUint32 signals = ConvertSignals ( changedSignalsMask | ( iSignals & iNotifySignalMask ) );
-			LOGTEXT2(_L8("\tcalling SignalChangeCompleted with KErrNone, signals=%x"), signals);
+			OstTrace1( TRACE_NORMAL, CACMPORT_HOSTSIGNALCHANGE_DUP3, "CAcmPort::HostSignalChange;signals=%x", signals );
 			SignalChangeCompleted( signals, KErrNone);
 			iNotifySignalChange = EFalse;
 			}
 		}
 
-	LOGTEXT(_L8("<<CAcmPort::HostSignalChange"));
+	OstTrace0( TRACE_NORMAL, CACMPORT_HOSTSIGNALCHANGE_DUP4, "CAcmPort::HostSignalChange;<<CAcmPort::HostSignalChange" );
+	OstTraceFunctionExit0( CACMPORT_HOSTSIGNALCHANGE_EXIT );
 	}
 
 TInt CAcmPort::GetRole(TCommRole& aRole)
@@ -1541,17 +1621,18 @@
  * @return Error.
  */
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMPORT_GETROLE_ENTRY );
+	
 	if ( !iAcm )
 		{
-		LOGTEXT(_L8("\t***access denied"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_GETROLE, "CAcmPort::GetRole;\t***access denied" );
+		OstTraceFunctionExit0( CACMPORT_GETROLE_EXIT );
 		return KErrAccessDenied;
 		}
 
 	aRole = iRole;
-	LOGTEXT2(_L8("\trole=%d"), aRole);
+	OstTrace1( TRACE_NORMAL, CACMPORT_GETROLE_DUP1, "CAcmPort::GetRole;\trole=%d", aRole );
+	OstTraceFunctionExit0( DUP1_CACMPORT_GETROLE_EXIT );
 	return KErrNone;
 	}
 
@@ -1563,10 +1644,10 @@
  * @return Error.
  */
 	{
-	LOG_LINE
-	LOGTEXT2(_L8(">>CAcmPort::SetRole aRole=%d"), aRole);
-
+	OstTraceFunctionEntry0( CACMPORT_SETROLE_ENTRY );
+	OstTrace1( TRACE_NORMAL, CACMPORT_SETROLE, "CAcmPort::SetRole;>>CAcmPort::SetRole aRole=%d", aRole );
 	TInt ret = KErrNone;
+	
 	if ( !iAcm )
 		{
 		ret = KErrAccessDenied;
@@ -1576,7 +1657,8 @@
 		iRole = aRole;
 		}
 
-	LOGTEXT2(_L8("<<CAcmPort::SetRole ret=%d"), ret);
+	OstTrace1( TRACE_NORMAL, CACMPORT_SETROLE_DUP1, "CAcmPort::SetRole;<<CAcmPort::SetRole ret=%d", ret );
+	OstTraceFunctionExit0( CACMPORT_SETROLE_EXIT );
 	return ret;
 	}
 
@@ -1594,18 +1676,29 @@
  * @param aAcm The new ACM (may be NULL).
  */
 	{
-	LOGTEXT3(_L8(">>CAcmPort::SetAcm aAcm = 0x%08x, iAcm = 0x%08x"), aAcm, iAcm);
+	OstTraceFunctionEntry0( CACMPORT_SETACM_ENTRY );
+	OstTrace1( TRACE_NORMAL, CACMPORT_SETACM, "CAcmPort::SetAcm;>>CAcmPort::SetAcm aAcm = 0x%08x", aAcm );
+	OstTrace1( TRACE_NORMAL, CACMPORT_SETACM_DUP3, "CAcmPort::SetAcm;iAcm=0x%08x", iAcm );
+	
 	
 	if ( !aAcm )
 		{
 		// Cancel any outstanding operations on the reader and writer.
-		__ASSERT_DEBUG(iReader, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+		if (!iReader)
+			{
+			OstTraceExt1( TRACE_FATAL, CACMPORT_SETACM_DUP4, "CAcmPort::SetAcm;iReader=%p", iReader );
+			__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+			}
 		iReader->ReadCancel();
-		__ASSERT_DEBUG(iWriter, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+		if (!iWriter)
+			{
+			OstTraceExt1( TRACE_FATAL, CACMPORT_SETACM_DUP5, "CAcmPort::SetAcm;iWriter=%p", iWriter );
+			__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+			}
 		iWriter->WriteCancel();
 
 		// Complete any outstanding requests
-		LOGTEXT(_L8("\tcompleting outstanding requests with KErrAccessDenied"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_SETACM_DUP1, "CAcmPort::SetAcm;\tcompleting outstanding requests with KErrAccessDenied" );
 		SignalChangeCompleted(iSignals,KErrAccessDenied);
 		ReadCompleted(KErrAccessDenied);
 		WriteCompleted(KErrAccessDenied);
@@ -1617,15 +1710,19 @@
 		}
 	else
 		{
-		__ASSERT_DEBUG(!iAcm, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+		if (iAcm)
+			{
+			OstTraceExt1( TRACE_FATAL, CACMPORT_SETACM_DUP6, "CAcmPort::SetAcm;iAcm=%p", iAcm );
+			__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+			}
 		aAcm->SetCallback(this);
 		// Set the port as the observer of break events.
 		aAcm->SetBreakCallback(this);
 		}
 
 	iAcm = aAcm;
-	
-	LOGTEXT(_L8("<<CAcmPort::SetAcm"));
+	OstTrace0( TRACE_NORMAL, CACMPORT_SETACM_DUP2, "CAcmPort::SetAcm;<<CAcmPort::SetAcm" );
+	OstTraceFunctionExit0( CACMPORT_SETACM_EXIT );
 	}
 
 CAcmPort::~CAcmPort()
@@ -1633,8 +1730,8 @@
  * Destructor.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMPORT_CACMPORT_DESTRUCTRURE_ENTRY );
+	
 	delete iReader;
 	delete iWriter;
 	
@@ -1642,12 +1739,13 @@
 	// changes.
 	if ( iAcm )
 		{
-		LOGTEXT(_L8("\tiAcm exists- calling SetCallback(NULL)"));
+		OstTrace0( TRACE_NORMAL, CACMPORT_CACMPORT_DESTRUCTRURE, "CAcmPort::~CAcmPort;\tiAcm exists- calling SetCallback(NULL)" );
 		iAcm->SetCallback(NULL);
 		}
 
-	LOGTEXT(_L8("\tcalling AcmPortClosed on observer"));
+	OstTrace0( TRACE_NORMAL, CACMPORT_CACMPORT_DESTRUCTRURE_DUP1, "CAcmPort::~CAcmPort;\tcalling AcmPortClosed on observer" );
 	iObserver.AcmPortClosed(iUnit);
+	OstTraceFunctionExit0( CACMPORT_CACMPORT_DESTRUCTRURE_EXIT );
 	}
 
 //
--- a/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/AcmPortFactory.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/AcmPortFactory.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -15,19 +15,19 @@
 *
 */
 
+#include <acminterface.h>
 #include "AcmPortFactory.h"
 #include "AcmUtils.h"
-#include <acminterface.h>
 #include "AcmPort.h"
 #include "AcmPanic.h"
 #include "acmserver.h"
 #include "CdcAcmClass.h"
-#include <usb/usblogger.h>
 #include "c32comm_internal.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "AcmPortFactoryTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "ECACM");
-#endif
 
 // Do not move this into a header file. It must be kept private to the CSY. It 
 // is the secret information that enables the old (registration port) 
@@ -41,12 +41,12 @@
  * @return Ownership of a newly created CAcmPortFactory object
  */
 	{
-	LOG_STATIC_FUNC_ENTRY
-
+	OstTraceFunctionEntry0( CACMPORTFACTORY_NEWL_ENTRY );
 	CAcmPortFactory* self = new(ELeave) CAcmPortFactory;
 	CleanupClosePushL(*self);
 	self->ConstructL();
 	CleanupStack::Pop();
+	OstTraceFunctionExit0( CACMPORTFACTORY_NEWL_EXIT );
 	return self;
 	}
 	
@@ -55,12 +55,14 @@
  * Constructor.
  */
 	{
+	OstTraceFunctionEntry0( CACMPORTFACTORY_CACMPORTFACTORY_ENTRY );
 	iVersion = TVersion(
 		KEC32MajorVersionNumber, 
 		KEC32MinorVersionNumber, 
 		KEC32BuildVersionNumber);
 	iConfigBuf().iAcmConfigVersion = 1;
 	iOwned = EFalse;
+	OstTraceFunctionExit0( CACMPORTFACTORY_CACMPORTFACTORY_EXIT );
 	}
 
 void CAcmPortFactory::ConstructL()
@@ -68,29 +70,58 @@
  * Second phase constructor.
  */
 	{
-	LEAVEIFERRORL(SetName(&KAcmSerialName)); 
+	OstTraceFunctionEntry0( CACMPORTFACTORY_CONSTRUCTL_ENTRY );
+	TInt	aReason	= SetName(&KAcmSerialName);
+	if (aReason < 0)
+		{
+		OstTrace1( TRACE_NORMAL, CACMPORTFACTORY_CONSTRUCTL, "CAcmPortFactory::ConstructL;aReason=%d", aReason );
+		User::Leave(aReason);
+		}
+	
 	iAcmServer = CAcmServer::NewL(*this);
 	
 	TInt err = RProperty::Define(KUidSystemCategory, KAcmKey, RProperty::EByteArray, TPublishedAcmConfigs::KAcmMaxFunctions);
 	if(err == KErrAlreadyExists)
 		{	
-		LEAVEIFERRORL(iAcmProperty.Attach(KUidSystemCategory, KAcmKey, EOwnerThread));
+		aReason = iAcmProperty.Attach(KUidSystemCategory, KAcmKey, EOwnerThread);
+		if (aReason < 0)
+			{
+			OstTrace1( TRACE_NORMAL, CACMPORTFACTORY_CONSTRUCTL_DUP1, "CAcmPortFactory::ConstructL;aReason=%d", aReason );
+			User::Leave(aReason);
+			}
+	
 		//Since the P&S data already exists we need to retrieve it
-		LEAVEIFERRORL(iAcmProperty.Get(iConfigBuf));
+		aReason = iAcmProperty.Get(iConfigBuf);
+		if (aReason < 0)
+			{
+			OstTrace1( TRACE_NORMAL, CACMPORTFACTORY_CONSTRUCTL_DUP2, "CAcmPortFactory::ConstructL;aReason=%d", aReason );
+			User::Leave(aReason);
+			}
 		}
 	else if(err == KErrNone)
 		{
 		//A blank iConfigBuf already exists at this point to we don't need to do anything to it
 		//before publishing the P&S data
-		LEAVEIFERRORL(iAcmProperty.Attach(KUidSystemCategory, KAcmKey, EOwnerThread));
+		aReason = iAcmProperty.Attach(KUidSystemCategory, KAcmKey, EOwnerThread);
+		if (aReason < 0)
+			{
+			OstTrace1( TRACE_NORMAL, CACMPORTFACTORY_CONSTRUCTL_DUP3, "CAcmPortFactory::ConstructL;aReason=%d", aReason );
+			User::Leave(aReason);
+			}
 		PublishAcmConfig();
 		iOwned = ETrue;
 		}
 	else
 		{
-		LEAVEIFERRORL(err); //This will always leave, but a log will be created at least.	
+		if (err < 0)
+			{
+			OstTrace1( TRACE_NORMAL, CACMPORTFACTORY_CONSTRUCTL_DUP4, "CAcmPortFactory::ConstructL;err=%d", err );
+			User::Leave(err);
+			}
+		//Here will always leave, but a log will be created at least.	
 		}
 		
+	OstTraceFunctionExit0( CACMPORTFACTORY_CONSTRUCTL_EXIT );
 	}
 
 /**
@@ -101,7 +132,14 @@
 	{
 	// Update the publish and subscribe info
 	TInt err = iAcmProperty.Set(iConfigBuf);
-	__ASSERT_DEBUG(err == KErrNone, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (err != KErrNone)
+		{	
+		OstTraceExt3( TRACE_NORMAL, CACMPORTFACTORY_PUBLISHACMCONFIG, 
+				"CAcmPortFactory::PublishAcmConfig;code=%d;name=%S;line = %d", 
+				(TInt)EPanicInternalError, KAcmPanicCat, (TInt)__LINE__);
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
+	
 	(void)err;
 	}
 
@@ -115,8 +153,7 @@
  */
 	//return the security policy for the given port number, aPort.  
 	{
-	LOG_FUNC
-	
+	OstTraceFunctionEntry0( CACMPORTFACTORY_PORTPLATSECCAPABILITY_ENTRY );
 	TSecurityPolicy securityPolicy; 
 	if ( aPort == KRegistrationPortUnit ) 
 		{
@@ -126,6 +163,7 @@
 		{
 		securityPolicy = TSecurityPolicy(ECapabilityLocalServices);	
 		}
+	OstTraceFunctionExit0( CACMPORTFACTORY_PORTPLATSECCAPABILITY_EXIT );
 	return securityPolicy;	 	
 	}
 
@@ -136,9 +174,8 @@
  * @param aUnit The port number of the closing port.
  */
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8("\taUnit = %d"), aUnit);
-
+	OstTraceFunctionEntry0( CACMPORTFACTORY_ACMPORTCLOSED_ENTRY );
+	OstTrace1( TRACE_NORMAL, CACMPORTFACTORY_ACMPORTCLOSED, "CAcmPortFactory::AcmPortClosed;aUnit=%d", aUnit );
 	// I would assert that the calling port is stored in our array, but if we 
 	// ran out of memory during CAcmPort::NewL, this function would be called 
 	// from the port's destructor, but the slot in the port array would still 
@@ -151,6 +188,7 @@
 #ifdef _DEBUG
 	LogPortsAndFunctions();
 #endif
+	OstTraceFunctionExit0( CACMPORTFACTORY_ACMPORTCLOSED_EXIT );
 	}
 
 CAcmPortFactory::~CAcmPortFactory()
@@ -158,8 +196,7 @@
  * Destructor.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( DUP1_CACMPORTFACTORY_CACMPORTFACTORY_ENTRY );
 	// Delete ACM instances. We could assert that the ACM Class Controller has 
 	// caused them all to be destroyed, but if we do that, and USBSVR panics 
 	// while it's Started, it will result in C32 panicking too, which is 
@@ -180,6 +217,7 @@
 		}
 	
 	delete iAcmServer;
+	OstTraceFunctionExit0( DUP1_CACMPORTFACTORY_CACMPORTFACTORY_EXIT );
 	}
 
 CPort* CAcmPortFactory::NewPortL(const TUint aUnit)
@@ -189,11 +227,9 @@
  * @param aUnit Port unit number
  */
 	{
-	LOG_LINE
-	LOGTEXT2(_L8(">>CAcmPortFactory::NewPortL aUnit=%d"), aUnit);
-
+	OstTraceFunctionEntry0( CACMPORTFACTORY_NEWPORTL_ENTRY );
+	OstTrace1( TRACE_NORMAL, CACMPORTFACTORY_NEWPORTL, "CAcmPortFactory::NewPortL;aUnit=%d", aUnit );
 	CPort* port = NULL;
-
 	TUint lowerLimit = KAcmLowUnit; // This non-const TUint avoids compiler remarks (low-level warnings) for the following comparisons..
 	// ACM ports
 	if ( (aUnit >= lowerLimit) && aUnit < static_cast<TUint>( iAcmClassArray.Count()) + KAcmLowUnit)
@@ -204,7 +240,12 @@
 		const TUint index = aUnit - KAcmLowUnit;
 		if ( iAcmPortArray[index] )
 			{
-			LEAVEIFERRORL(KErrInUse); // TODO: is this ever executed?
+			if (KErrInUse < 0)
+				{
+				OstTrace1( TRACE_ERROR, CACMPORTFACTORY_NEWPORTL_DUP2, "CAcmPortFactory::NewPortL;KErrInUse=%d", KErrInUse );
+				User::Leave(KErrInUse);
+				}
+				// TODO: is this ever executed?
 			}						   
 		iAcmPortArray[index] = CAcmPort::NewL(aUnit, *this);
 		iAcmPortArray[index]->SetAcm( iAcmClassArray[index]);
@@ -217,14 +258,18 @@
 		}
 	else 
 		{
-		LEAVEIFERRORL(KErrAccessDenied);
+		if (KErrAccessDenied < 0)
+			{
+			OstTrace1( TRACE_ERROR, CACMPORTFACTORY_NEWPORTL_DUP3, "CAcmPortFactory::NewPortL;KErrAccessDenied=%d", KErrAccessDenied );
+			User::Leave(KErrAccessDenied);
+			}
 		}
 
 #ifdef _DEBUG
 	LogPortsAndFunctions();
 #endif
-
-	LOGTEXT2(_L8("<<CAcmPortFactory::NewPortL port=0x%08x"), port);
+	OstTrace1( TRACE_NORMAL, CACMPORTFACTORY_NEWPORTL_DUP1, "CAcmPortFactory::NewPortL;port=0x%08x", port );
+	OstTraceFunctionExit0( CACMPORTFACTORY_NEWPORTL_EXIT );
 	return port;
 	}
 
@@ -237,8 +282,8 @@
  * @param aNoAcms Number of ACM interfaces to destroy.
  */
 	{
-	LOGTEXT2(_L8(">>CAcmPortFactory::DestroyFunctions aNoAcms = %d"), aNoAcms);
-
+	OstTraceFunctionEntry0( CACMPORTFACTORY_DESTROYFUNCTIONS_ENTRY );
+	OstTrace1( TRACE_NORMAL, CACMPORTFACTORY_DESTROYFUNCTIONS, "CAcmPortFactory::DestroyFunctions;aNoAcms=%d", aNoAcms );
 #ifdef _DEBUG
 	CheckAcmArray();
 #endif
@@ -270,8 +315,8 @@
 	CheckAcmArray();
 	LogPortsAndFunctions();
 #endif
-
-	LOGTEXT(_L8("<<CAcmPortFactory::DestroyFunctions"));
+	OstTrace0( TRACE_NORMAL, CACMPORTFACTORY_DESTROYFUNCTIONS_DUP1, "CAcmPortFactory::DestroyFunctions;<<CAcmPortFactory::DestroyFunctions" );
+	OstTraceFunctionExit0( CACMPORTFACTORY_DESTROYFUNCTIONS_EXIT );
 	}
 
 void CAcmPortFactory::CheckAcmArray()
@@ -280,12 +325,16 @@
  * something valid. NB It is the ACM port array which may contain empty slots.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMPORTFACTORY_CHECKACMARRAY_ENTRY );
 	for ( TUint ii  = 0; ii < static_cast<TUint>( iAcmClassArray.Count()) ; ii++ )
 		{
-		__ASSERT_DEBUG( iAcmClassArray[ii], _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+		if (!iAcmClassArray[ii])
+			{			
+			OstTraceExt2( TRACE_NORMAL, CACMPORTFACTORY_CHECKACMARRAY, "CAcmPortFactory::CheckAcmArray;code=%d;name=%S", (TInt)EPanicInternalError, KAcmPanicCat);
+			__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+			}
 		}
+	OstTraceFunctionExit0( CACMPORTFACTORY_CHECKACMARRAY_EXIT );
 	}
 
 TInt CAcmPortFactory::CreateFunctions(const TUint aNoAcms, const TUint8 aProtocolNum, const TDesC16& aAcmControlIfcName, const TDesC16& aAcmDataIfcName)
@@ -298,8 +347,8 @@
  * @param aAcmDataIfcName Data Interface Name or a null descriptor
  */
 	{
-	LOGTEXT5(_L("\taNoAcms = %d, aProtocolNum = %d, Control Ifc Name = %S, Data Ifc Name = %S"),
-			aNoAcms, aProtocolNum, &aAcmControlIfcName, &aAcmDataIfcName);
+	OstTraceFunctionEntry0( CACMPORTFACTORY_CREATEFUNCTIONS_ENTRY );
+	OstTraceExt4( TRACE_NORMAL, CACMPORTFACTORY_CREATEFUNCTIONS, "CAcmPortFactory::CreateFunctions;aNoAcms=%d;aProtocolNum=%d;aAcmControlIfcName=%S;aAcmDataIfcName=%S", (TInt)aNoAcms, (TInt)aProtocolNum, aAcmControlIfcName, aAcmDataIfcName );
 
 #ifdef _DEBUG
 	CheckAcmArray();
@@ -310,7 +359,7 @@
 	// Create the ACM class instances.
 	for ( TUint ii = 0 ; ii < aNoAcms ; ii++ )
 		{
-		LOGTEXT2(_L8("\tabout to create ACM instance %d"), ii);
+		OstTrace1( TRACE_NORMAL, CACMPORTFACTORY_CREATEFUNCTIONS_DUP1, "CAcmPortFactory::CreateFunctions;\tabout to create ACM instance %d", ii );
 		TRAP(ret, CreateFunctionL(aProtocolNum, aAcmControlIfcName, aAcmDataIfcName));
 		if ( ret != KErrNone )
 			{
@@ -328,7 +377,8 @@
 	LogPortsAndFunctions();
 #endif
 
-	LOGTEXT2(_L8("<<CAcmPortFactory::CreateFunctions ret = %d"), ret);
+	OstTrace1( TRACE_NORMAL, CACMPORTFACTORY_CREATEFUNCTIONS_DUP2, "CAcmPortFactory::CreateFunctions;ret=%d", ret );
+	OstTraceFunctionExit0( CACMPORTFACTORY_CREATEFUNCTIONS_EXIT );
 	return ret;
 	}
 
@@ -337,26 +387,40 @@
  * Creates a single ACM function, appending it to the  iAcmClassArray array.
  */
 	{
-	LOG_FUNC
-
-	LOGTEXT3(_L8("\tiAcmPortArray.Count() = %d,  iAcmClassArray.Count() = %d"), 
-		iAcmPortArray.Count(),  iAcmClassArray.Count());
-
-	LOGTEXT4(_L("\taProtocolNum = %d, Control Ifc Name = %S, Data Ifc Name = %S"),
-			aProtocolNum, &aAcmControlIfcName, &aAcmDataIfcName);
+	OstTraceFunctionEntry0( CACMPORTFACTORY_CREATEFUNCTIONL_ENTRY );
+	OstTraceExt2( TRACE_NORMAL, CACMPORTFACTORY_CREATEFUNCTIONL, 
+			"CAcmPortFactory::CreateFunctionL;\tiAcmPortArray.Count()=%d;iAcmClassArray.Count()=%d", 
+			iAcmPortArray.Count(), iAcmClassArray.Count() );
+	
+	OstTraceExt3( TRACE_NORMAL, CACMPORTFACTORY_CREATEFUNCTIONL_DUP1, 
+			"CAcmPortFactory::CreateFunctionL;aProtocolNum=%d;aAcmControlIfcName=%S;aAcmDataIfcName=%S", 
+			aProtocolNum, aAcmControlIfcName, aAcmDataIfcName );
 
 	CCdcAcmClass* acm = CCdcAcmClass::NewL(aProtocolNum, aAcmControlIfcName, aAcmDataIfcName);
 	CleanupStack::PushL(acm);
 
 	// If there isn't already a slot in the ACM port array corresponding to 
 	// this ACM interface instance, create one. 
+	TInt	err;
 	if ( iAcmPortArray.Count() <  iAcmClassArray.Count() + 1 )
 		{
-		LOGTEXT(_L8("\tappending a slot to the ACM port array"));
-		LEAVEIFERRORL(iAcmPortArray.Append(NULL));
+		OstTrace0( TRACE_NORMAL, CACMPORTFACTORY_CREATEFUNCTIONL_DUP2, 
+				"CAcmPortFactory::CreateFunctionL;\tappending a slot to the ACM port array" );
+		err = iAcmPortArray.Append(NULL);
+		if (err < 0)
+			{
+			OstTrace1( TRACE_ERROR, CACMPORTFACTORY_CREATEFUNCTIONL_DUP4, "CAcmPortFactory::CreateFunctionL;err=%d", err );
+			User::Leave(err);
+			}
 		}
 
-	LEAVEIFERRORL(iAcmClassArray.Append(acm));
+	err = iAcmClassArray.Append(acm);
+	if (err < 0)
+		{
+		OstTrace1( TRACE_ERROR, CACMPORTFACTORY_CREATEFUNCTIONL_DUP5, "CAcmPortFactory::CreateFunctionL;err=%d", err );
+		User::Leave(err);
+		}
+
 	CleanupStack::Pop(acm);
 	
 	// If there's an ACM port at the relevant index (held open from when USB 
@@ -364,7 +428,9 @@
 	// interface.
 	if ( iAcmPortArray[iAcmClassArray.Count() - 1] )
 		{
-		LOGTEXT3(_L8("\tinforming CAcmPort instance %d of acm 0x%08x"),  iAcmClassArray.Count() - 1, acm);
+		OstTraceExt2( TRACE_NORMAL, CACMPORTFACTORY_CREATEFUNCTIONL_DUP3, 
+				"CAcmPortFactory::CreateFunctionL;\tinforming CAcmPort instance %d of acm 0x%p", 
+				iAcmClassArray.Count() - 1, acm );
 		iAcmPortArray[iAcmClassArray.Count() - 1]->SetAcm(acm);
 		}
  
@@ -373,6 +439,7 @@
 	iConfigBuf().iAcmCount++;
 	//don't update the p&s data here, do it in CreateFunctions after the construction of 
 	//all the requested functions
+	OstTraceFunctionExit0( CACMPORTFACTORY_CREATEFUNCTIONL_EXIT );
 	}
 
 void CAcmPortFactory::Info(TSerialInfo& aSerialInfo)
@@ -382,16 +449,17 @@
  * @param aSerialInfo where info will be written to
  */
 	{
+	OstTraceFunctionEntry0( CACMPORTFACTORY_INFO_ENTRY );
 	// NB Our TSerialInfo does not advertise the existence of the registration 
 	// port.
-	LOG_FUNC
-
+	
 	_LIT(KSerialDescription, "USB Serial Port Emulation via ACM");	
 	aSerialInfo.iDescription = KSerialDescription;
 	aSerialInfo.iName = KAcmSerialName;
 	aSerialInfo.iLowUnit = KAcmLowUnit;
 	aSerialInfo.iHighUnit = (iAcmPortArray.Count()==0) ? 0 : (iAcmPortArray.Count()-1);
 	// See comments in AcmInterface.h 
+	OstTraceFunctionExit0( CACMPORTFACTORY_INFO_EXIT );
 	}
 
 void CAcmPortFactory::LogPortsAndFunctions()
@@ -411,18 +479,24 @@
  * port open/closed history of the CSY.
  */
 	{
+	OstTraceFunctionEntry0( CACMPORTFACTORY_LOGPORTSANDFUNCTIONS_ENTRY );
 	TUint ii;
 
 	// Log ACM functions and corresponding ports.
 	for ( ii = 0 ; ii < static_cast<TUint>( iAcmClassArray.Count()) ; ii++ )
 		{
-		LOGTEXT5(_L8("\t iAcmClassArray[%d] = 0x%08x, iAcmPortArray[%d] = 0x%08x"), ii,  iAcmClassArray[ii], ii, iAcmPortArray[ii]);
+		OstTraceExt4( TRACE_NORMAL, CACMPORTFACTORY_LOGPORTSANDFUNCTIONS, 
+				"CAcmPortFactory::LogPortsAndFunctions;\t iAcmClassArray[%d] = %p, iAcmPortArray[%d] = %p", 
+				(TInt)ii, iAcmClassArray[ii], (TInt)ii, iAcmPortArray[ii] );	
 		}
 	// Log any ports extending beyond where we currently have ACM interfaces.
 	for ( ; ii < static_cast<TUint>(iAcmPortArray.Count()) ; ii++ )
 		{
-		LOGTEXT4(_L8("\t iAcmClassArray[%d] = <no slot>, iAcmPortArray[%d] = 0x%08x"), ii, ii, iAcmPortArray[ii]);
+		OstTraceExt3( TRACE_NORMAL, CACMPORTFACTORY_LOGPORTSANDFUNCTIONS_DUP1, 
+				"CAcmPortFactory::LogPortsAndFunctions;\t iAcmClassArray[%d] = <no slot>, iAcmPortArray[%d] = %p", 
+				(TInt)ii, (TInt)ii, iAcmPortArray[ii] );
 		}
+	OstTraceFunctionExit0( CACMPORTFACTORY_LOGPORTSANDFUNCTIONS_EXIT );
 	}
 
 //
--- a/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/AcmReader.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/AcmReader.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -23,11 +23,11 @@
 #include "CdcAcmClass.h"
 #include "AcmPanic.h"
 #include "AcmPort.h"
-#include <usb/usblogger.h>
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "AcmReaderTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "ECACM");
-#endif
 
 CAcmReader* CAcmReader::NewL(CAcmPort& aPort,
 							 TUint aBufSize)
@@ -39,12 +39,12 @@
  * @return Ownership of a new CAcmReader.
  */
 	{
-	LOG_STATIC_FUNC_ENTRY
-
+	OstTraceFunctionEntry0( CACMREADER_NEWL_ENTRY );	
 	CAcmReader* self = new(ELeave) CAcmReader(aPort, aBufSize);
 	CleanupStack::PushL(self);
 	self->ConstructL();
 	CLEANUPSTACK_POP(self);
+	OstTraceFunctionExit0( CACMREADER_NEWL_EXIT );
 	return self;
 	}
 
@@ -53,11 +53,10 @@
  * Destructor.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMREADER_CACMREADER_DES_ENTRY );
 	ReadCancel();
-	
 	delete iBuffer;
+	OstTraceFunctionExit0( CACMREADER_CACMREADER_DES_EXIT );
 	}
 
 CAcmReader::CAcmReader(CAcmPort& aPort,
@@ -72,6 +71,8 @@
 	iInBuf(NULL,0,0),
 	iPort(aPort)
 	{
+	OstTraceFunctionEntry0( CACMREADER_CACMREADER_CONS_ENTRY );
+	OstTraceFunctionExit0( CACMREADER_CACMREADER_CONS_EXIT );
 	}
 
 void CAcmReader::ConstructL()
@@ -79,9 +80,16 @@
  * 2nd-phase construction.
  */
 	{
+	OstTraceFunctionEntry0( CACMREADER_CONSTRUCTL_ENTRY );
 	// Create iBuffer. 
-	LOGTEXT(_L8("\tabout to create iBuffer"));
-	LEAVEIFERRORL(SetBufSize(iBufSize));
+	OstTrace0( TRACE_NORMAL, CACMREADER_CONSTRUCTL, "CAcmReader::ConstructL;\tabout to create iBuffer" );
+	TInt	err = SetBufSize(iBufSize);
+	if (err < 0)
+		{
+		OstTrace1( TRACE_ERROR, CACMREADER_CONSTRUCTL_DUP1, "CAcmReader::ConstructL;err=%d", err );
+		User::Leave(err);
+		}
+	OstTraceFunctionExit0( CACMREADER_CONSTRUCTL_EXIT );
 	}
 
 void CAcmReader::Read(const TAny* aClientBuffer, TUint aMaxLen)
@@ -92,9 +100,8 @@
  * @param aMaxLen Maximum length to read.
  */
 	{
-	LOG_FUNC
-	LOGTEXT3(_L8("\taClientBuffer=0x%08x, aMaxLen=%d"), 
-		aClientBuffer, aMaxLen);
+	OstTraceFunctionEntry0( CACMREADER_READ_ENTRY );
+	OstTraceExt2( TRACE_NORMAL, CACMREADER_READ, "CAcmReader::Read;\taClientBuffer=%p, aMaxLen=%d", aClientBuffer, (TInt)aMaxLen );
 
 	// Check we're open to requests and make a note of interesting data.
 	// including iLengthToGo
@@ -112,6 +119,7 @@
 		{
 		ReadWithTerminators();
 		}
+	OstTraceFunctionExit0( CACMREADER_READ_EXIT );
 	}
 
 void CAcmReader::ReadWithoutTerminators()
@@ -119,18 +127,22 @@
  * Process a read request given that no terminator characters are set.
  */
 	{
-	LOG_FUNC
-	
+	OstTraceFunctionEntry0( CACMREADER_READWITHOUTTERMINATORS_ENTRY );
 	// Can we complete immediately from the buffer?
 	const TUint bufLen = BufLen();
-	LOGTEXT2(_L8("\thave %d bytes in buffer"), bufLen);
-	LOGTEXT2(_L8("\tLength to go is %d bytes"), iLengthToGo);
+	OstTraceExt2( TRACE_NORMAL, CACMREADER_READWITHOUTTERMINATORS, 
+			"CAcmReader::ReadWithoutTerminators;\thave %d bytes in buffer;\tLength to go is %d bytes", 
+			(TInt)bufLen, (TInt)iLengthToGo );
 	if ( iLengthToGo <= bufLen )
 		{
-		LOGTEXT2(_L8("\tcompleting request immediately from buffer with %d "
-			"bytes"), iLengthToGo);
+		OstTrace1( TRACE_NORMAL, CACMREADER_READWITHOUTTERMINATORS_DUP1, 
+				"CAcmReader::ReadWithoutTerminators;\tcompleting  "
+				"request immediately from buffer with %d bytes", 
+				(TInt)iLengthToGo );
+		
 		WriteBackData(iLengthToGo);
 		CompleteRequest(KErrNone);
+		OstTraceFunctionExit0( CACMREADER_READWITHOUTTERMINATORS_EXIT );
 		return;
 		}
 
@@ -138,14 +150,17 @@
 	// back as much as we have, and issue a Read for more.
 	if ( bufLen )
 		{
-		LOGTEXT2(_L8("\twriting back %d bytes"), bufLen);
+		OstTrace1( TRACE_NORMAL, CACMREADER_READWITHOUTTERMINATORS_DUP2, 
+				"CAcmReader::ReadWithoutTerminators;\twriting back %d bytes", (TInt)bufLen );
 		// Write back as much data as we've got already.
 		WriteBackData(bufLen);
 		}
 
 	// Issue a read for the data we still need. 
-	LOGTEXT2(_L8("\tRequesting read - require %d bytes"),iLengthToGo);
+	OstTrace1( TRACE_NORMAL, CACMREADER_READWITHOUTTERMINATORS_DUP3, 
+			"CAcmReader::ReadWithoutTerminators;iLengthToGo=%d", (TInt)iLengthToGo );
 	IssueRead();
+	OstTraceFunctionExit0( CACMREADER_READWITHOUTTERMINATORS_EXIT_DUP1 );
 	}
 
 void CAcmReader::ReadWithTerminators()
@@ -153,23 +168,24 @@
  * Process a read request given that terminator characters are set.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMREADER_READWITHTERMINATORS_ENTRY );
 	// Can we complete immediately from the buffer? Search the buffer we have 
 	// for any terminators. If found, complete back to the client. If not 
 	// found, start issuing ReadOneOrMores until we either find one or run out 
 	// of client buffer.
 
 	const TUint bufLen = BufLen();
-	LOGTEXT2(_L8("\tbufLen = %d"), bufLen);
+	OstTrace1( TRACE_NORMAL, CACMREADER_READWITHTERMINATORS, "CAcmReader::ReadWithTerminators;bufLen=%d", (TInt)bufLen );
 	if ( bufLen )
 		{
 		CheckForBufferedTerminatorsAndProceed();
+		OstTraceFunctionExit0( CACMREADER_READWITHTERMINATORS_EXIT );
 		return;
 		}
 
 	// There's no buffered data. Get some.
 	IssueReadOneOrMore();
+	OstTraceFunctionExit0( CACMREADER_READWITHTERMINATORS_EXIT_DUP1 );
 	}
 
 void CAcmReader::ReadOneOrMore(const TAny* aClientBuffer, TUint aMaxLen)
@@ -181,31 +197,31 @@
  * @param aMaxLen Maximum length to read.
  */
 	{
-	LOG_FUNC
-	LOGTEXT3(_L8("\taClientBuffer=0x%08x, aMaxLen=%d"), 
-		aClientBuffer, aMaxLen);
-
+	OstTraceFunctionEntry0( CACMREADER_READONEORMORE_ENTRY );
+	OstTraceExt2( TRACE_NORMAL, CACMREADER_READONEORMORE, 
+			"CAcmReader::ReadOneOrMore;aClientBuffer=%p;aMaxLen=%d", aClientBuffer, (TInt)aMaxLen );
 	// Check we're open to requests and make a note of interesting data.
 	CheckNewRequest(aClientBuffer, aMaxLen);
+	iCurrentRequest.iRequestType = EReadOneOrMore;	
 
-	iCurrentRequest.iRequestType = EReadOneOrMore;	
-	
 	// Check to see if there's anything in our buffer- if there is, we can 
 	// complete immediately.
 	const TUint bufLen = BufLen();
-	LOGTEXT2(_L8("\tbufLen = %d"), bufLen);
+	OstTrace1( TRACE_NORMAL, CACMREADER_READONEORMORE_DUP1, "CAcmReader::ReadOneOrMore;bufLen=%d", (TInt)bufLen );
 	if ( bufLen )
 		{
 		// Complete request with what's in the buffer
-		LOGTEXT2(_L8("\tcompleting request immediately from buffer with %d "
-			"bytes"), bufLen);
+		OstTrace1( TRACE_FLOW, CACMREADER_READONEORMORE_DUP2, 
+				"CAcmReader::ReadOneOrMore;\tcompleting request immediately from buffer with %d bytes", (TInt)bufLen );
 		WriteBackData(bufLen);
 		CompleteRequest(KErrNone);
+		OstTraceFunctionExit0( CACMREADER_READONEORMORE_EXIT );
 		return;
 		}
 
 	// Get some more data.
 	IssueReadOneOrMore();
+	OstTraceFunctionExit0( CACMREADER_READONEORMORE_EXIT_DUP1 );
 	}
 
 void CAcmReader::NotifyDataAvailable()
@@ -213,15 +229,17 @@
  * NotifyDataAvailable API. If a request is pending completes the client with KErrInUse.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CACMREADER_NOTIFYDATAAVAILABLE_ENTRY );
 	if(iCurrentRequest.iClientPtr) // a request is pending
 		{
 		iPort.NotifyDataAvailableCompleted(KErrInUse);
+		OstTraceFunctionExit0( CACMREADER_NOTIFYDATAAVAILABLE_EXIT );
 		return;
 		}
 	iCurrentRequest.iClientPtr = iBuffer;
 	iCurrentRequest.iRequestType = ENotifyDataAvailable;	 	
 	iPort.Acm()->NotifyDataAvailable(*this);		
+	OstTraceFunctionExit0( CACMREADER_NOTIFYDATAAVAILABLE_EXIT_DUP1 );
 	} 
 		
 void CAcmReader::NotifyDataAvailableCancel()
@@ -230,19 +248,21 @@
  *
  */
 	{
-	LOG_FUNC	
+	OstTraceFunctionEntry0( CACMREADER_NOTIFYDATAAVAILABLECANCEL_ENTRY );	
 	if (ENotifyDataAvailable == iCurrentRequest.iRequestType)
 		{
 		// Cancel any outstanding request on the LDD.		
 		if (iPort.Acm())
 			{
-			LOGTEXT(_L8("\tiPort.Acm() exists- calling NotifyDataAvailableCancel() on it"));
+			OstTrace0( TRACE_NORMAL, CACMREADER_NOTIFYDATAAVAILABLECANCEL, 
+					"CAcmReader::NotifyDataAvailableCancel;\tiPort.Acm() exists- calling NotifyDataAvailableCancel() on it" );
 			iPort.Acm()->NotifyDataAvailableCancel();
 			}
 		// Reset our flag to say there's no current outstanding request. What's 
 		// already in our buffer can stay there.
 		iCurrentRequest.iClientPtr = NULL;
 		}	
+	OstTraceFunctionExit0( CACMREADER_NOTIFYDATAAVAILABLECANCEL_EXIT );
 	}
 
 void CAcmReader::ReadCancel()
@@ -250,14 +270,14 @@
  * Cancel API. Cancels any outstanding (Read or ReadOneOrMore) request.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMREADER_READCANCEL_ENTRY );
 	if (ENotifyDataAvailable != iCurrentRequest.iRequestType)
 		{
 		// Cancel any outstanding request on the LDD.
 		if (iPort.Acm())
 			{
-			LOGTEXT(_L8("\tiPort.Acm() exists- calling ReadCancel on it"));
+			OstTrace0( TRACE_NORMAL, CACMREADER_READCANCEL, 
+					"CAcmReader::ReadCancel;\tiPort.Acm() exists- calling ReadCancel on it" );
 			iPort.Acm()->ReadCancel();
 			}
 		
@@ -265,6 +285,7 @@
 		// already in our buffer can stay there.
 		iCurrentRequest.iClientPtr = NULL;
 		}
+	OstTraceFunctionExit0( CACMREADER_READCANCEL_EXIT );
 	}
 	
 TUint CAcmReader::BufLen() const
@@ -275,21 +296,22 @@
  * @return Length of data in buffer.
  */
 	{
-	LOGTEXT(_L8(">>CAcmReader::BufLen"));
-
+	OstTraceFunctionEntry0( CACMREADER_BUFLEN_ENTRY );
+	OstTrace0( TRACE_NORMAL, CACMREADER_BUFLEN, "CAcmReader::BufLen;>>CAcmReader::BufLen" );
 	TUint len = 0;
 	if ( BufWrap() )
 		{
-		LOGTEXT(_L8("\tbuf wrapped"));
+		OstTrace0( TRACE_NORMAL, CACMREADER_BUFLEN_DUP1, "CAcmReader::BufLen;\tbuf wrapped" );
 		len = iBufSize - ( iOutPtr - iInPtr );
 		}
 	else
 		{
-		LOGTEXT(_L8("\tbuf not wrapped"));
+	OstTrace0( TRACE_NORMAL, CACMREADER_BUFLEN_DUP2, "CAcmReader::BufLen;\tbuf not wrapped" );
 		len = iInPtr - iOutPtr;
 		}
 
-	LOGTEXT2(_L8("<<CAcmReader::BufLen len=%d"), len);
+	OstTrace1( TRACE_NORMAL, CACMREADER_BUFLEN_DUP3, "CAcmReader::BufLen;len=%d", (TInt)len );
+	OstTraceFunctionExit0( CACMREADER_BUFLEN_EXIT );
 	return len;
 	}
 
@@ -298,14 +320,18 @@
  * Called by the port to clear the buffer.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMREADER_RESETBUFFER_ENTRY );
 	// A request is outstanding- C32 should protect against this.
-	__ASSERT_DEBUG(!iCurrentRequest.iClientPtr, 
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (iCurrentRequest.iClientPtr)
+		{
+		OstTraceExt1( TRACE_FATAL, CACMREADER_RESETBUFFER, 
+				"CAcmReader::ResetBuffer;iCurrentRequest.iClientPtr=%p", iCurrentRequest.iClientPtr );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 
 	// Reset the pointers. All data is 'lost'.
 	iOutPtr = iInPtr = iBufStart;
+	OstTraceFunctionExit0( CACMREADER_RESETBUFFER_EXIT );
 	}
 
 TInt CAcmReader::SetBufSize(TUint aSize)
@@ -317,13 +343,14 @@
  * @param aSize The required size of the buffer.
  */
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8("\taSize=%d"), aSize);
-
+	OstTraceFunctionEntry0( CACMREADER_SETBUFSIZE_ENTRY );
+	OstTrace1( TRACE_NORMAL, CACMREADER_SETBUFSIZE, "CAcmReader::SetBufSize;aSize=%d", (TInt)aSize );
 	if ( iCurrentRequest.iClientPtr )
 		{
 		// A request is outstanding. C32 does not protect us against this.
-		LOGTEXT(_L8("\t***a request is outstanding- returning KErrInUse"));
+		OstTrace0( TRACE_NORMAL, CACMREADER_SETBUFSIZE_DUP1, 
+				"CAcmReader::SetBufSize;\t***a request is outstanding- returning KErrInUse" );
+		OstTraceFunctionExit0( CACMREADER_SETBUFSIZE_EXIT );
 		return KErrInUse;
 		}
 
@@ -331,7 +358,9 @@
 	HBufC8* newBuf = HBufC8::New(aSize);
 	if ( !newBuf )
 		{
-		LOGTEXT(_L8("\tfailed to create new buffer- returning KErrNoMemory"));
+		OstTrace0( TRACE_NORMAL, CACMREADER_SETBUFSIZE_DUP2, 
+				"CAcmReader::SetBufSize;\tfailed to create new buffer- returning KErrNoMemory" );
+		OstTraceFunctionExit0( CACMREADER_SETBUFSIZE_EXIT_DUP1 );
 		return KErrNoMemory;
 		}
 	delete iBuffer;
@@ -343,6 +372,7 @@
 	iBufSize = aSize;
 	CheckBufferEmptyAndResetPtrs();
 
+	OstTraceFunctionExit0( CACMREADER_SETBUFSIZE_EXIT_DUP2 );
 	return KErrNone;
 	}
 
@@ -353,20 +383,28 @@
  * @param aConfig The new configuration.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CACMREADER_SETTERMINATORS_ENTRY );
 	
 	// C32 protects the port against having config set while there's a request 
 	// outstanding.
-	__ASSERT_DEBUG(!iCurrentRequest.iClientPtr, 
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (iCurrentRequest.iClientPtr)
+		{
+		OstTraceExt1( TRACE_FATAL, CACMREADER_SETTERMINATORS_DUP2, 
+				"CAcmReader::SetTerminators;iCurrentRequest.iClientPtr=%p", iCurrentRequest.iClientPtr );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 
 	iTerminatorCount = aConfig.iTerminatorCount;
-	LOGTEXT2(_L8("\tnow %d terminators:"), iTerminatorCount);
+	OstTrace1( TRACE_NORMAL, CACMREADER_SETTERMINATORS, 
+			"CAcmReader::SetTerminators;\tnow %d terminators:", (TInt)iTerminatorCount );
+	
 	for ( TUint ii = 0; ii < static_cast<TUint>(KConfigMaxTerminators) ; ii++ )
 		{
 		iTerminator[ii] = aConfig.iTerminator[ii];
-		LOGTEXT2(_L8("\t\t%d"), iTerminator[ii]);
+		OstTrace1( TRACE_NORMAL, CACMREADER_SETTERMINATORS_DUP1, 
+				"CAcmReader::SetTerminators;\t\t%d", iTerminator[ii]);
 		}
+	OstTraceFunctionExit0( CACMREADER_SETTERMINATORS_EXIT );
 	}
 	
 void CAcmReader::ReadCompleted(TInt aError)
@@ -376,18 +414,20 @@
  * @param aError Error.
  */
 	{
-	LOGTEXT2(_L8(">>CAcmReader::ReadCompleted aError=%d"), aError);						   	
+	OstTraceFunctionEntry0( CACMREADER_READCOMPLETED_ENTRY );
+	OstTrace1( TRACE_NORMAL, CACMREADER_READCOMPLETED, 
+			"CAcmReader::ReadCompleted;>>CAcmReader::ReadCompleted aError=%d", aError );				   	
 
 	const TUint justRead = static_cast<TUint>(iInBuf.Length());
-	LOGTEXT3(_L8("\tiInBuf length=%d, iLengthToGo=%d"), 
-		justRead,
-		iLengthToGo);
+	OstTraceExt2( TRACE_NORMAL, CACMREADER_READCOMPLETED_DUP1, 
+			"CAcmReader::ReadCompleted;\tiInBuf length=%d, iLengthToGo=%d", (TInt)justRead, (TInt)iLengthToGo );
 
 	// This protects against a regression in the LDD- read requests shouldn't 
 	// ever complete with zero bytes and KErrNone.
 	if ( justRead == 0 && aError == KErrNone )
 		{
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError);
+		OstTrace0( TRACE_FATAL, CACMREADER_READCOMPLETED_DUP3, "CAcmReader::ReadCompleted;ustRead == 0 && aError == KErrNone" );	
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
 		}
 
 	// The new data will have been added to our buffer. Move iInPtr up by the 
@@ -401,6 +441,7 @@
 		// multi-stage Read the client will get any data already written back 
 		// to them with IPCWrite.
 		CompleteRequest(aError);
+		OstTraceFunctionExit0( CACMREADER_READCOMPLETED_EXIT );
 		return;
 		}
 
@@ -408,8 +449,8 @@
 	// it will also complete the request if we've given the client enough data
 	// or will reissue another read if not
 	ReadWithoutTerminators();
-	
-	LOGTEXT(_L8("<<CAcmReader::ReadCompleted"));
+	OstTrace0( TRACE_NORMAL, CACMREADER_READCOMPLETED_DUP2, "CAcmReader::ReadCompleted;<<CAcmReader::ReadCompleted" );
+	OstTraceFunctionExit0( CACMREADER_READCOMPLETED_EXIT_DUP1 );
 	}
 
 void CAcmReader::ReadOneOrMoreCompleted(TInt aError)
@@ -419,21 +460,24 @@
  * @param aError Error.
  */
 	{
-	LOGTEXT2(_L8(">>CAcmReader::ReadOneOrMoreCompleted aError=%d"), aError);						   	
+	OstTraceFunctionEntry0( CACMREADER_READONEORMORECOMPLETED_ENTRY );
+	OstTrace1( TRACE_NORMAL, CACMREADER_READONEORMORECOMPLETED, 
+			"CAcmReader::ReadOneOrMoreCompleted;>>CAcmReader::ReadOneOrMoreCompleted aError=%d", aError );						   	
 
 	const TUint justRead = static_cast<TUint>(iInBuf.Length());
-	LOGTEXT2(_L8("\tjustRead = %d"), justRead);
+	OstTrace1( TRACE_NORMAL, CACMREADER_READONEORMORECOMPLETED_DUP1, 
+			"CAcmReader::ReadOneOrMoreCompleted;\tjustRead = %d", (TInt)justRead );
 
 	// The new data will have been added to our buffer. Move iInPtr 
 	// up by the length just read.
 	iInPtr += justRead;
-
 	if ( aError )
 		{
 		// If the ReadOneOrMore failed, we complete back to the client and 
 		// don't do anything more. The client will get any data already 
 		// written back to them with IPCWrite.
 		CompleteRequest(aError);
+		OstTraceFunctionExit0( CACMREADER_READONEORMORECOMPLETED_EXIT );
 		return;
 		}
 
@@ -444,8 +488,10 @@
 	// data. 
 	if ( justRead == 0 )
 		{
-		LOGTEXT(_L8("\twe appear to have a ZLP- reissuing ReadOneOrMore"));
+		OstTrace0( TRACE_NORMAL, CACMREADER_READONEORMORECOMPLETED_DUP2, 
+				"CAcmReader::ReadOneOrMoreCompleted;\twe appear to have a ZLP- reissuing ReadOneOrMore" );
 		IssueReadOneOrMore();
+		OstTraceFunctionExit0( CACMREADER_READONEORMORECOMPLETED_EXIT_DUP1 );
 		return;
 		}
 
@@ -454,8 +500,8 @@
 		// Complete the client's request with as much data as we can. NB 
 		// Opinion may be divided over whether to do this, or complete with 
 		// just 1 byte. We implement the more generous approach.
-		LOGTEXT2(_L8("\tcurrent request is ReadOneOrMore- completing with "
-			"%d bytes"), justRead);
+		OstTrace1( TRACE_NORMAL, CACMREADER_READONEORMORECOMPLETED_DUP3, 
+				"CAcmReader::ReadOneOrMoreCompleted;\tcurrent request is ReadOneOrMore- completing with %d bytes", (TInt)justRead );
 		WriteBackData(justRead);
 		CompleteRequest(KErrNone);
 		}
@@ -465,28 +511,33 @@
 		// ReadOneOrMore, we only request LDD::ReadOneOrMore in this case.)
 
 		// Process the buffer for terminators. 
-		LOGTEXT(_L8("\tcurrent request is Read with terminators"));
+		OstTrace0( TRACE_NORMAL, CACMREADER_READONEORMORECOMPLETED_DUP4, 
+				"CAcmReader::ReadOneOrMoreCompleted;\tcurrent request is Read with terminators" );
 		CheckForBufferedTerminatorsAndProceed();
 		}
 
-	LOGTEXT(_L8("<<CAcmReader::ReadOneOrMoreCompleted"));
+	OstTrace0( TRACE_NORMAL, CACMREADER_READONEORMORECOMPLETED_DUP5, 
+			"CAcmReader::ReadOneOrMoreCompleted;<<CAcmReader::ReadOneOrMoreCompleted" );
+	OstTraceFunctionExit0( CACMREADER_READONEORMORECOMPLETED_EXIT_DUP2 );
 	}
 
 void CAcmReader::NotifyDataAvailableCompleted(TInt aError)
 	{
+	OstTraceFunctionEntry0( CACMREADER_NOTIFYDATAAVAILABLECOMPLETED_ENTRY );
 /**
  * Called by lower classes when data has arrived at the LDD after a 
  * NotifyDataAvailable request has been posted on the port. 
  *
  * @param aError Error.
  */
-	LOGTEXT2(_L8(">>CAcmReader::NotifyDataAvailableCompleted aError=%d"), aError);	
-		
+	OstTrace1( TRACE_NORMAL, CACMREADER_NOTIFYDATAAVAILABLECOMPLETED, 
+			"CAcmReader::NotifyDataAvailableCompleted;aError=%d", aError );
+	
 	// If the NotifyDataAvailable request failed, we complete back 
 	// to the client and don't do anything more.
-	CompleteRequest(aError);		
-	
-	LOGTEXT(_L8("<<CAcmReader::NotifyDataAvailableCompleted"));	
+	CompleteRequest(aError);
+	OstTrace0( TRACE_NORMAL, CACMREADER_NOTIFYDATAAVAILABLECOMPLETED_DUP2, "<<CAcmReader::NotifyDataAvailableCompleted" );
+	OstTraceFunctionExit0( CACMREADER_NOTIFYDATAAVAILABLECOMPLETED_EXIT );
 	}
 
 void CAcmReader::CheckBufferEmptyAndResetPtrs()
@@ -496,14 +547,16 @@
  * fiddling around wrapping at the end of the buffer.
  */
 	{
-	LOGTEXT(_L8("CAcmReader::CheckBufferEmptyAndResetPtrs"));
-
-	if ( BufLen() != 0 )
+	OstTraceFunctionEntry0( CACMREADER_CHECKBUFFEREMPTYANDRESETPTRS_ENTRY );
+	TInt	blen = BufLen();
+	if ( blen != 0 )
 		{
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError);
+		OstTrace1( TRACE_FATAL, CACMREADER_CHECKBUFFEREMPTYANDRESETPTRS, "CAcmReader::CheckBufferEmptyAndResetPtrs;blen=%d", blen );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
 		}
 
 	iOutPtr = iInPtr = iBufStart;
+	OstTraceFunctionExit0( CACMREADER_CHECKBUFFEREMPTYANDRESETPTRS_EXIT );
 	}
 
 void CAcmReader::CheckNewRequest(const TAny* aClientBuffer, TUint aMaxLen)
@@ -516,25 +569,41 @@
  * @param aMaxLen Maximum length to read.
  */
 	{
+	OstTraceFunctionEntry0( CACMREADER_CHECKNEWREQUEST_ENTRY );
+	
 	// The port should handle zero-length reads, not us.
-	__ASSERT_DEBUG(aMaxLen > 0, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
-	__ASSERT_DEBUG(aMaxLen <= static_cast<TUint>(KMaxTInt), 
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (aMaxLen <= 0)
+		{
+		OstTrace0( TRACE_FATAL, CACMREADER_CHECKNEWREQUEST, "CAcmReader::CheckNewRequest;aMaxLen <= 0" );
+		
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 
+	if (aMaxLen > static_cast<TUint>(KMaxTInt))
+		{
+		OstTrace0( TRACE_FATAL, CACMREADER_CHECKNEWREQUEST_DUP1, "CAcmReader::CheckNewRequest;aMaxLen > static_cast<TUint>(KMaxTInt)" );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	// Check we have no outstanding request already.
 	if ( iCurrentRequest.iClientPtr )// just panic in case of concurrent Read or ReadOneOrMore queries.
 		{							 // in case of NotifyDataAvailable queries, we already have completed the client with KErrInUse.
 									 // This code is kept for legacy purpose. That justifies the existence of IsNotifyDataAvailableQueryPending
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError);
+		OstTraceExt1( TRACE_FATAL, CACMREADER_CHECKNEWREQUEST_DUP3, 
+				"CAcmReader::CheckNewRequest;iCurrentRequest.iClientPtr=%p", iCurrentRequest.iClientPtr );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
 		}
 	// Sanity check on what C32 gave us.
-	__ASSERT_DEBUG(aClientBuffer, 
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (!aClientBuffer)
+		{
+		OstTrace0( TRACE_FATAL, CACMREADER_CHECKNEWREQUEST_DUP2, "CAcmReader::CheckNewRequest;aClientBuffer = NULL" );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 
 	// Make a note of interesting data.
 	iCurrentRequest.iClientPtr = aClientBuffer;
 	iLengthToGo = aMaxLen;
 	iOffsetIntoClientsMemory = 0;
+	OstTraceFunctionExit0( CACMREADER_CHECKNEWREQUEST_EXIT );
 	}
 
 void CAcmReader::CheckForBufferedTerminatorsAndProceed()
@@ -544,23 +613,29 @@
  * amount if not.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CACMREADER_CHECKFORBUFFEREDTERMINATORSANDPROCEED_ENTRY );
+	
+	TInt ret = FindTerminator();
+	OstTrace1( TRACE_NORMAL, CACMREADER_CHECKFORBUFFEREDTERMINATORSANDPROCEED_DUP6, 
+			"CAcmReader::CheckForBufferedTerminatorsAndProceed;\tFindTerminator = %d", ret );
 
-	TInt ret = FindTerminator();
-	LOGTEXT2(_L8("\tFindTerminator = %d"), ret);
 	if ( ret < KErrNone )
 		{
-		LOGTEXT(_L8("\tno terminator found"));
+		OstTrace0( TRACE_NORMAL, CACMREADER_CHECKFORBUFFEREDTERMINATORSANDPROCEED, 
+				"CAcmReader::CheckForBufferedTerminatorsAndProceed;\tno terminator found" );
+		
 		const TUint bufLen = BufLen();
-		LOGTEXT2(_L8("\tbufLen = %d"), bufLen);
+		OstTrace1( TRACE_NORMAL, CACMREADER_CHECKFORBUFFEREDTERMINATORSANDPROCEED_DUP1, 
+				"CAcmReader::CheckForBufferedTerminatorsAndProceed;\tbufLen = %d", (TInt)bufLen );
+		
 		// No terminator was found. Does the buffer already exceed the 
 		// client's descriptor?
 		if ( bufLen >= iLengthToGo )
 			{
 			// Yes- complete as much data to the client as their 
 			// descriptor can handle.
-			LOGTEXT2(_L8("\tbuffer >= client descriptor- "
-				"writing back %d bytes"), iLengthToGo);
+			OstTrace1( TRACE_NORMAL, CACMREADER_CHECKFORBUFFEREDTERMINATORSANDPROCEED_DUP2, 
+					"CAcmReader::CheckForBufferedTerminatorsAndProceed;iLengthToGo=%d", (TInt)iLengthToGo );
 			WriteBackData(iLengthToGo);
 			CompleteRequest(KErrNone);
 			}
@@ -574,13 +649,15 @@
 		}
 	else
 		{
-		LOGTEXT(_L8("\tterminator found!"));
+		OstTrace0( TRACE_NORMAL, CACMREADER_CHECKFORBUFFEREDTERMINATORSANDPROCEED_DUP3, 
+				"CAcmReader::CheckForBufferedTerminatorsAndProceed;\tterminator found!" );
 		// Will the terminator position fit within the client's descriptor?
 		if ( static_cast<TUint>(ret) <= iLengthToGo )
 			{
 			// Yes- complete (up to the terminator) back to the client.
-			LOGTEXT2(_L8("\tterminator will fit in client's descriptor- "
-				"writing back %d bytes"), ret);
+			OstTrace1( TRACE_NORMAL, CACMREADER_CHECKFORBUFFEREDTERMINATORSANDPROCEED_DUP4, 
+					"CAcmReader::CheckForBufferedTerminatorsAndProceed;\tterminator will fit "
+					"in client's descriptor- writing back %d bytes ", (TInt)ret );
 			WriteBackData(static_cast<TUint>(ret));
 			CompleteRequest(KErrNone);
 			}
@@ -588,12 +665,14 @@
 			{
 			// No- complete as much data to the client as their descriptor can 
 			// handle.
-			LOGTEXT2(_L8("\tterminator won't fit in client's descriptor- "
-				"writing back %d bytes"), iLengthToGo);
+			OstTrace1( TRACE_NORMAL, CACMREADER_CHECKFORBUFFEREDTERMINATORSANDPROCEED_DUP5, 
+							"CAcmReader::CheckForBufferedTerminatorsAndProceed; "
+							"\tterminator won't fit in client's descriptor- writing back %d bytes", (TInt)iLengthToGo );
 			WriteBackData(iLengthToGo);
 			CompleteRequest(KErrNone);
 			}
 		}
+	OstTraceFunctionExit0( CACMREADER_CHECKFORBUFFEREDTERMINATORSANDPROCEED_EXIT );
 	}
 
 void CAcmReader::WriteBackData(TUint aLength)
@@ -608,36 +687,44 @@
  * @param aLength Amount of data to write back.
  */
 	{
-	LOGTEXT2(_L8("CAcmReader::WriteBackData aLength = %d"), aLength);
-	LOGTEXT2(_L8("\tBufLen() = %d"), BufLen());
+	OstTraceFunctionEntry0( CACMREADER_WRITEBACKDATA_ENTRY );
+	OstTrace1( TRACE_DUMP, CACMREADER_WRITEBACKDATA, "CAcmReader::WriteBackData;aLength=%d", (TInt)aLength );
+	OstTrace1( TRACE_DUMP, CACMREADER_WRITEBACKDATA_DUP1, "CAcmReader::WriteBackData;\tBufLen() = %d", (TInt)BufLen() );
 
-	LOGTEXT2(_L8("\tBufLen() = %d"), BufLen());
-
-	__ASSERT_DEBUG(aLength <= BufLen(), 
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (aLength > BufLen())
+		{
+		OstTrace0( TRACE_FATAL, CACMREADER_WRITEBACKDATA_DUP15, "CAcmReader::WriteBackData;aLength > BufLen()" );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 
 	const TUint lenBeforeWrap = iBufStart + iBufSize - iOutPtr;
 
-	LOGTEXT2(_L8("\tiOutPtr=%d"), iOutPtr - iBufStart);
-	LOGTEXT2(_L8("\tiInPtr=%d"), iInPtr - iBufStart);
-	LOGTEXT2(_L8("\tiOffsetIntoClientsMemory=%d"), iOffsetIntoClientsMemory);
-	LOGTEXT2(_L8("\tlenBeforeWrap=%d"), lenBeforeWrap);
+	OstTrace1( TRACE_DUMP, CACMREADER_WRITEBACKDATA_DUP2, "CAcmReader::WriteBackData;\tiOutPtr=%d", (TInt)(iOutPtr - iBufStart) );
+	OstTrace1( TRACE_DUMP, CACMREADER_WRITEBACKDATA_DUP3, "CAcmReader::WriteBackData;\tiInPtr=%d", (TInt)(iInPtr - iBufStart) );
+	OstTrace1( TRACE_DUMP, CACMREADER_WRITEBACKDATA_DUP4, "CAcmReader::WriteBackData;\tiOffsetIntoClientsMemory=%d", (TInt)iOffsetIntoClientsMemory );
+	OstTrace1( TRACE_DUMP, CACMREADER_WRITEBACKDATA_DUP5, "CAcmReader::WriteBackData;\tlenBeforeWrap=%d", (TInt)lenBeforeWrap );
 	
 	if ( aLength > lenBeforeWrap )
 		{ 
 		// We'll have to do this in two stages...
-		LOGTEXT(_L8("\twriting back in two stages"));
-
-		__ASSERT_DEBUG(BufWrap(), 
-			_USB_PANIC(KAcmPanicCat, EPanicInternalError));
+		OstTrace0( TRACE_NORMAL, CACMREADER_WRITEBACKDATA_DUP6, "CAcmReader::WriteBackData;\twriting back in two stages" );
+		if (!BufWrap())
+			{
+			OstTrace0( TRACE_FATAL, CACMREADER_WRITEBACKDATA_DUP16, "CAcmReader::WriteBackData;BufWrap() is NULL" );
+			__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+			}
 
 		// Stage 1...
 		TPtrC8 ptrBeforeWrap(iOutPtr, lenBeforeWrap);
 		TInt err = iPort.IPCWrite(iCurrentRequest.iClientPtr,
 			ptrBeforeWrap,
 			iOffsetIntoClientsMemory);
-		LOGTEXT2(_L8("\tIPCWrite = %d"), err);
-		__ASSERT_DEBUG(!err, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+		OstTrace1( TRACE_NORMAL, CACMREADER_WRITEBACKDATA_DUP7, "CAcmReader::WriteBackData;\tIPCWrite = %d", (TInt)err );
+		if (err)
+			{
+			OstTrace1( TRACE_FATAL, CACMREADER_WRITEBACKDATA_DUP17, "CAcmReader::WriteBackData;err=%d", err );
+			__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+			}
 		static_cast<void>(err);
 		iOffsetIntoClientsMemory += lenBeforeWrap;
 
@@ -647,39 +734,54 @@
 		err = iPort.IPCWrite(iCurrentRequest.iClientPtr,
 			ptrAfterWrap,
 			iOffsetIntoClientsMemory);
-		LOGTEXT2(_L8("\tIPCWrite = %d"), err);
-		__ASSERT_DEBUG(!err, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+		OstTrace1( TRACE_NORMAL, CACMREADER_WRITEBACKDATA_DUP8, "CAcmReader::WriteBackData;\tIPCWrite = %d", (TInt)err );
+		if (err)
+			{
+			OstTrace1( TRACE_FATAL, CACMREADER_WRITEBACKDATA_DUP18, "CAcmReader::WriteBackData;err=%d", err );
+			__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+			}
 		iOffsetIntoClientsMemory += seg2Len;
 
 		// and set the pointers to show that we've consumed the data...
 		iOutPtr = iBufStart + seg2Len;
-		LOGTEXT(_L8("\twrite in two segments completed"));
+		OstTrace0( TRACE_NORMAL, CACMREADER_WRITEBACKDATA_DUP9, "CAcmReader::WriteBackData;\twrite in two segments completed" );
 		}
 	else // We can do it in one go...
 		{
-		LOGTEXT(_L8("\twriting in one segment"));
+		OstTrace0( TRACE_NORMAL, CACMREADER_WRITEBACKDATA_DUP10, "CAcmReader::WriteBackData;\twriting in one segment" );
 
 		TPtrC8 ptr(iOutPtr, aLength);
 		TInt err = iPort.IPCWrite(iCurrentRequest.iClientPtr,
 			ptr,
 			iOffsetIntoClientsMemory);
-		LOGTEXT2(_L8("\tIPCWrite = %d"), err);
-		__ASSERT_DEBUG(!err, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+		OstTrace1( TRACE_NORMAL, CACMREADER_WRITEBACKDATA_DUP11, "CAcmReader::WriteBackData;\tIPCWrite = %d", (TInt)err );
+		if (err)
+			{
+			OstTrace1( TRACE_FATAL, CACMREADER_WRITEBACKDATA_DUP19, "CAcmReader::WriteBackData;err=%d", err );
+			__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+			}
 		static_cast<void>(err);
 		iOffsetIntoClientsMemory += aLength;
 
 		// Set the pointers to show that we've consumed the data...
 		iOutPtr += aLength;
-		LOGTEXT(_L8("\twrite in one segment completed"));
+		OstTrace0( TRACE_NORMAL, CACMREADER_WRITEBACKDATA_DUP12, "CAcmReader::WriteBackData;\twrite in one segments completed" );
 		}
 
-	LOGTEXT2(_L8("\tiOutPtr=%d"), iOutPtr - iBufStart);
-	LOGTEXT2(_L8("\tiOffsetIntoClientsMemory=%d"), iOffsetIntoClientsMemory);
+	OstTrace1( TRACE_NORMAL, CACMREADER_WRITEBACKDATA_DUP13, 
+			"CAcmReader::WriteBackData;\tiOutPtr=%d", (TInt)(iOutPtr - iBufStart) );
+	OstTrace1( TRACE_NORMAL, CACMREADER_WRITEBACKDATA_DUP14, 
+			"CAcmReader::WriteBackData;\tiOffsetIntoClientsMemory=%d", (TInt)iOffsetIntoClientsMemory );
 
 	// Adjust iLengthToGo
-	__ASSERT_DEBUG(iLengthToGo >= aLength, 
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (iLengthToGo < aLength)
+		{
+		OstTraceExt2( TRACE_FATAL, CACMREADER_WRITEBACKDATA_DUP20, 
+				"CAcmReader::WriteBackData;iLengthToGo=%d;aLength=%d", (TInt)iLengthToGo, (TInt)aLength );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	iLengthToGo -= aLength;
+	OstTraceFunctionExit0( CACMREADER_WRITEBACKDATA_EXIT );
 	}
 
 void CAcmReader::CompleteRequest(TInt aError)
@@ -691,21 +793,24 @@
  * @param aError The error code to complete with.
  */
 	{
-	LOGTEXT2(_L8("CAcmReader::CompleteRequest aError=%d"), aError);
+	OstTraceFunctionEntry0( CACMREADER_COMPLETEREQUEST_ENTRY );
+	OstTrace1( TRACE_NORMAL, CACMREADER_COMPLETEREQUEST, "CAcmReader::CompleteRequest;aError=%d", (TInt)aError );
 
 	// Set our flag to say that we no longer have an outstanding request.
 	iCurrentRequest.iClientPtr = NULL;
-
 	if(ENotifyDataAvailable==iCurrentRequest.iRequestType)
 		{
-		LOGTEXT2(_L8("\tcalling NotifyDataAvailableCompleted with error %d"), aError);
+		OstTrace1( TRACE_NORMAL, CACMREADER_COMPLETEREQUEST_DUP1, 
+				"CAcmReader::CompleteRequest;\tcalling NotifyDataAvailableCompleted with error %d", aError );
 		iPort.NotifyDataAvailableCompleted(aError);	
 		}
 	else // read and readoneormore
 		{
-		LOGTEXT2(_L8("\tcalling ReadCompleted with error %d"), aError);
+		OstTrace1( TRACE_NORMAL, CACMREADER_COMPLETEREQUEST_DUP2, 
+					"CAcmReader::CompleteRequest;\tcalling ReadCompleted with error %d", aError );
 		iPort.ReadCompleted(aError);
 		}
+	OstTraceFunctionExit0( CACMREADER_COMPLETEREQUEST_EXIT );
 	}
 
 void CAcmReader::IssueRead()
@@ -717,25 +822,27 @@
  * buffer being wrapped and the consequent risk of overwriting.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMREADER_ISSUEREAD_ENTRY );
 	CheckBufferEmptyAndResetPtrs();
 
-	LOGTEXT2(_L8("\tiBufSize = %d"), iBufSize);
-	LOGTEXT2(_L8("\tiInPtr = %d"), iInPtr - iBufStart);
-
+	OstTrace1( TRACE_DUMP, CACMREADER_ISSUEREAD, "CAcmReader::IssueRead;iBufSize=%d", (TInt)iBufSize );
+	OstTrace1( TRACE_DUMP, CACMREADER_ISSUEREAD_DUP1, "CAcmReader::IssueRead;\tiInPtr = %d", (TInt)(iInPtr - iBufStart) );
 	const TUint lenBeforeWrap = iBufStart + iBufSize - iInPtr;
 	
-	LOGTEXT2(_L8("\tiLengthToGo = %d"), iLengthToGo);
-	LOGTEXT2(_L8("\tlenBeforeWrap = %d"), lenBeforeWrap);
+	OstTrace1( TRACE_DUMP, CACMREADER_ISSUEREAD_DUP2, "CAcmReader::IssueRead;\tiLengthToGo = %d", (TInt)iLengthToGo );
+	OstTrace1( TRACE_DUMP, CACMREADER_ISSUEREAD_DUP3, "CAcmReader::IssueRead;\tlenBeforeWrap = %d", (TInt)lenBeforeWrap );
 
 	const TUint limit = Min(static_cast<TInt>(iLengthToGo), 
 		static_cast<TInt>(lenBeforeWrap));
-	LOGTEXT2(_L8("\tissuing read for %d bytes"), limit);
+	OstTrace1( TRACE_DUMP, CACMREADER_ISSUEREAD_DUP4, "CAcmReader::IssueRead;\tissuing read for %d bytes", (TInt)limit );
 	iInBuf.Set(iInPtr, 0, limit);
-	__ASSERT_DEBUG(iPort.Acm(), 
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (!iPort.Acm())
+		{
+		OstTrace0( TRACE_FATAL, CACMREADER_ISSUEREAD_DUP5, "CAcmReader::IssueRead;iPort.Acm() is null" );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	iPort.Acm()->Read(*this, iInBuf, limit);
+	OstTraceFunctionExit0( CACMREADER_ISSUEREAD_EXIT );
 	}
 
 void CAcmReader::IssueReadOneOrMore()
@@ -747,25 +854,29 @@
  * buffer being wrapped and the consequent risk of overwriting.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMREADER_ISSUEREADONEORMORE_ENTRY );
 	CheckBufferEmptyAndResetPtrs();
 
-	LOGTEXT2(_L8("\tiBufSize = %d"), iBufSize);
-	LOGTEXT2(_L8("\tiInPtr = %d"), iInPtr - iBufStart);
-
+	OstTrace1( TRACE_DUMP, CACMREADER_ISSUEREADONEORMORE, "CAcmReader::IssueReadOneOrMore;iBufSize=%d", (TInt)iBufSize );
+	OstTrace1( TRACE_DUMP, CACMREADER_ISSUEREADONEORMORE_DUP1, 
+			"CAcmReader::IssueReadOneOrMore;\tiInPtr = %d",(TInt)(iInPtr - iBufStart) );
 	const TUint lenBeforeWrap = iBufStart + iBufSize - iInPtr;
 	
-	LOGTEXT2(_L8("\tiLengthToGo = %d"), iLengthToGo);
-	LOGTEXT2(_L8("\tlenBeforeWrap = %d"), lenBeforeWrap);
+	OstTrace1( TRACE_DUMP, CACMREADER_ISSUEREADONEORMORE_DUP2, "CAcmReader::IssueReadOneOrMore;iLengthToGo=%d", (TInt)iLengthToGo );
+	OstTrace1( TRACE_DUMP, CACMREADER_ISSUEREADONEORMORE_DUP3, "CAcmReader::IssueReadOneOrMore;lenBeforeWrap=%d", (TInt)lenBeforeWrap );
 
 	const TUint limit1 = Min(static_cast<TInt>(lenBeforeWrap), iLengthToGo);
-	
-	LOGTEXT2(_L8("\tissuing read one or more for %d bytes"), limit1);
+	OstTrace1( TRACE_DUMP, CACMREADER_ISSUEREADONEORMORE_DUP4, 
+			"CAcmReader::IssueReadOneOrMore;\tissuing read one or more for %d bytes", (TInt)limit1 );
+
 	iInBuf.Set(iInPtr, 0, limit1);
-	__ASSERT_DEBUG(iPort.Acm(), 
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (!iPort.Acm())
+		{
+		OstTrace0( TRACE_FATAL, CACMREADER_ISSUEREADONEORMORE_DUP5, "CAcmReader::IssueReadOneOrMore;iPort.Acm() is null" );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	iPort.Acm()->ReadOneOrMore(*this, iInBuf, limit1);
+	OstTraceFunctionExit0( CACMREADER_ISSUEREADONEORMORE_EXIT );
 	}
 
 TInt CAcmReader::FindTerminator() const
@@ -780,8 +891,8 @@
  * account. If negative: error.
  */
 	{
-	LOGTEXT(_L8(">>CAcmReader::FindTerminator"));
-
+	OstTraceFunctionEntry0( CACMREADER_FINDTERMINATOR_ENTRY );
+	
 	TInt pos = 0;
 	TInt ret = KErrNone;
 	if ( !BufWrap() )
@@ -816,10 +927,14 @@
 		}
 
 	// Check we're returning what we said we would.
-	__ASSERT_DEBUG(ret != KErrNone, 
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (ret == KErrNone)
+		{
+		OstTrace0( TRACE_FATAL, CACMREADER_FINDTERMINATOR_DUP1, "CAcmReader::FindTerminator;ret == KErrNone" );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	
-	LOGTEXT2(_L8("<<CAcmReader::FindTerminator ret=%d"), ret);
+	OstTrace1( TRACE_NORMAL, CACMREADER_FINDTERMINATOR, "CAcmReader::FindTerminator;ret=%d", ret );
+	OstTraceFunctionExit0( CACMREADER_FINDTERMINATOR_EXIT );
 	return ret;
 	}
 
@@ -843,26 +958,33 @@
  * found.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMREADER_PARTIALFINDTERMINATOR_ENTRY );
+	
 	aPos = 1;
-	LOGTEXT3(_L8("\taFrom=%d, aTo=%d"), aFrom-iBufStart, aTo-iBufStart);
-
+	OstTraceExt2( TRACE_NORMAL, CACMREADER_PARTIALFINDTERMINATOR, 
+			"CAcmReader::PartialFindTerminator;\taFrom=%d, aTo=%d", (TInt)(aFrom-iBufStart), (TInt)(aTo-iBufStart) );
+	
 	for ( TUint8* p = aFrom ; p < aTo ; p++, aPos++ )
 		{
 		for ( TUint i = 0 ; i < iTerminatorCount ; i++ )
 			{
-			__ASSERT_DEBUG(p, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+			if (!p)
+				{
+				OstTraceExt1( TRACE_FATAL, CACMREADER_PARTIALFINDTERMINATOR_DUP3, "CAcmReader::PartialFindTerminator;p=%p", p );
+				__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+				}
 			if ( *p == iTerminator[i] )
 				{
-				LOGTEXT3(_L8("\tterminator %d found at aPos %d"), 
-					iTerminator[i], aPos);
+				OstTraceExt2( TRACE_FLOW, CACMREADER_PARTIALFINDTERMINATOR_DUP1, 
+						"CAcmReader::PartialFindTerminator;\tterminator %d found at aPos %d", (TInt)iTerminator[i], (TInt)aPos );
+				OstTraceFunctionExit0( CACMREADER_PARTIALFINDTERMINATOR_EXIT );
 				return KErrNone;
 				}
 			}
 		}
 	
-	LOGTEXT(_L8("\tno terminator found"));
+	OstTrace0( TRACE_NORMAL, CACMREADER_PARTIALFINDTERMINATOR_DUP2, "CAcmReader::PartialFindTerminator;\tno terminator found" );
+	OstTraceFunctionExit0( CACMREADER_PARTIALFINDTERMINATOR_EXIT_DUP2 );
 	return KErrNotFound;
 	}
 
--- a/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/AcmWriter.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/AcmWriter.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -15,14 +15,13 @@
 *
 */
 
-#include <usb/usblogger.h>
 #include "AcmWriter.h"
 #include "AcmPort.h"
 #include "AcmPanic.h"
 #include "AcmUtils.h"
-
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "ECACM");
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "AcmWriterTraces.h"
 #endif
 
 CAcmWriter* CAcmWriter::NewL(CAcmPort& aPort, 
@@ -35,12 +34,12 @@
  * @return Ownership of a newly created CAcmWriter object
  */
 	{
-	LOG_STATIC_FUNC_ENTRY
-
+	OstTraceFunctionEntry0( CACMWRITER_NEWL_ENTRY );
 	CAcmWriter* self = new(ELeave) CAcmWriter(aPort, aBufSize);
 	CleanupStack::PushL(self);
 	self->ConstructL();
 	CLEANUPSTACK_POP(self);
+	OstTraceFunctionExit0( CACMWRITER_NEWL_EXIT );
 	return self;
 	}
 
@@ -49,11 +48,10 @@
  * Destructor.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMWRITER_CACMWRITER_DES_ENTRY );
 	WriteCancel();
-
 	delete iBuffer;
+	OstTraceFunctionExit0( CACMWRITER_CACMWRITER_DES_EXIT );
 	}
 
 void CAcmWriter::Write(const TAny* aClientBuffer, TUint aLength)
@@ -64,8 +62,8 @@
  * @param aLength Number of bytes to write
  */
 	{
-	LOGTEXT3(_L8("CAcmWriter::Write aClientBuffer=0x%08x, aLength=%d"), 
-		aClientBuffer, aLength);
+	OstTraceFunctionEntry0( CACMWRITER_WRITE_ENTRY );
+	OstTraceExt2( TRACE_NORMAL, CACMWRITER_WRITE, "CAcmWriter::Write;aClientBuffer=%p;aLength=%d", aClientBuffer, (TInt)aLength );
 
 	// Check we're open to requests and make a note of interesting data.
 	CheckNewRequest(aClientBuffer, aLength);
@@ -78,6 +76,7 @@
 	ReadDataFromClient();
 	// ...and write as much as we've got to the LDD
 	IssueWrite();
+	OstTraceFunctionExit0( CACMWRITER_WRITE_EXIT );
 	}
 
 void CAcmWriter::WriteCancel()
@@ -85,18 +84,18 @@
  * Cancel a write.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMWRITER_WRITECANCEL_ENTRY );
 	// Cancel any outstanding request on the LDD.
 	if ( iPort.Acm() )
 		{
-		LOGTEXT(_L8("\tiPort.Acm() exists- calling WriteCancel on it"));
+		OstTrace0( TRACE_NORMAL, CACMWRITER_WRITECANCEL, "CAcmWriter::WriteCancel;\tiPort.Acm() exists- calling WriteCancel on it" );
 		iPort.Acm()->WriteCancel();
 		}
 
 	// Reset our flag to say there's no current outstanding request. What's 
 	// already in our buffer can stay there.
 	iCurrentRequest.iClientPtr = NULL;
+	OstTraceFunctionExit0( CACMWRITER_WRITECANCEL_EXIT );
 	}
 
 void CAcmWriter::ResetBuffer()
@@ -104,15 +103,20 @@
  * Called by the port to clear the buffer.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMWRITER_RESETBUFFER_ENTRY );
 	// A request is outstanding- C32 should protect against this.
-	__ASSERT_DEBUG(!iCurrentRequest.iClientPtr, 
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError));
 
+	if (iCurrentRequest.iClientPtr != NULL)
+		{
+		OstTrace1( TRACE_FATAL, CACMWRITER_RESETBUFFER, 
+										"CAcmWriter::ResetBuffer;EPanicInternalError=%d", 
+										(TInt)EPanicInternalError );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	// Don't have anything to do. There are no pointers to reset. This 
 	// function may in the future (if we support KConfigWriteBufferedComplete) 
 	// do work, so leave the above assertion in.
+	OstTraceFunctionExit0( CACMWRITER_RESETBUFFER_EXIT );
 	}
 
 TInt CAcmWriter::SetBufSize(TUint aSize)
@@ -123,13 +127,15 @@
  * @param aSize The required size of the buffer.
  */
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8("\taSize=%d"), aSize);
+	OstTraceFunctionEntry0( CACMWRITER_SETBUFSIZE_ENTRY );
+	OstTrace1( TRACE_NORMAL, CACMWRITER_SETBUFSIZE, "CAcmWriter::SetBufSize;aSize=%d", (TInt)aSize );
 
 	if ( iCurrentRequest.iClientPtr )
 		{
 		// A request is outstanding. C32 does not protect us against this.
-		LOGTEXT(_L8("\t***a request is outstanding- returning KErrInUse"));
+		OstTrace0( TRACE_NORMAL, CACMWRITER_SETBUFSIZE_DUP1, 
+				"CAcmWriter::SetBufSize;\t***a request is outstanding- returning KErrInUse" );
+		OstTraceFunctionExit0( CACMWRITER_SETBUFSIZE_EXIT );
 		return KErrInUse;
 		}
 
@@ -137,7 +143,9 @@
 	HBufC8* newBuf = HBufC8::New(static_cast<TInt>(aSize));
 	if ( !newBuf )
 		{
-		LOGTEXT(_L8("\tfailed to create new buffer- returning KErrNoMemory"));
+		OstTrace0( TRACE_NORMAL, CACMWRITER_SETBUFSIZE_DUP2, 
+				"CAcmWriter::SetBufSize;\tfailed to create new buffer- returning KErrNoMemory" );
+		OstTraceFunctionExit0( CACMWRITER_SETBUFSIZE_EXIT_DUP1 );
 		return KErrNoMemory;
 		}
 	delete iBuffer;
@@ -145,6 +153,7 @@
 	iBuf.Set(iBuffer->Des());
 	iBufSize = aSize;
 
+	OstTraceFunctionExit0( CACMWRITER_SETBUFSIZE_EXIT_DUP2 );
 	return KErrNone;
 	}
 
@@ -160,6 +169,8 @@
 	iBuf(NULL,0,0),
 	iPort(aPort)
 	{
+	OstTraceFunctionEntry0( CACMWRITER_CACMWRITER_CONS_ENTRY );
+	OstTraceFunctionExit0( CACMWRITER_CACMWRITER_CONS_EXIT );
 	}
 
 void CAcmWriter::ConstructL()
@@ -167,9 +178,16 @@
  * 2nd-phase constructor. 
  */
 	{
+	OstTraceFunctionEntry0( CACMWRITER_CONSTRUCTL_ENTRY );
 	// Create the required buffer.
-	LOGTEXT(_L8("\tabout to create iBuffer"));
-	LEAVEIFERRORL(SetBufSize(iBufSize));
+	OstTrace0( TRACE_NORMAL, CACMWRITER_CONSTRUCTL, "CAcmWriter::ConstructL;\tabout to create iBuffer" );
+	TInt err = SetBufSize(iBufSize);
+	if (err < 0)
+		{
+		OstTrace1( TRACE_ERROR, CACMWRITER_CONSTRUCTL_DUP1, "CAcmWriter::ConstructL;err=%d", err );
+		User::Leave(err);
+		}
+	OstTraceFunctionExit0( CACMWRITER_CONSTRUCTL_EXIT );
 	}
 
 void CAcmWriter::WriteCompleted(TInt aError)
@@ -182,12 +200,12 @@
  * @param aError Error with which the write completed.
  */
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8("\taError=%d"), aError);						   	
-
+	OstTraceFunctionEntry0( CACMWRITER_WRITECOMPLETED_ENTRY );
+	OstTrace1( TRACE_NORMAL, CACMWRITER_WRITECOMPLETED, "CAcmWriter::WriteCompleted;aError=%d", (TInt)aError );					   	
 	if(iLengthToGo == 0 || aError != KErrNone)
 		{
-		LOGTEXT2(_L8("\tcompleting request with %d"), aError);
+		OstTrace1( TRACE_NORMAL, CACMWRITER_WRITECOMPLETED_DUP1, 
+				"CAcmWriter::WriteCompleted;\tcompleting request with %d", aError );
 		CompleteRequest(aError);	
 		}
 	else
@@ -197,6 +215,7 @@
 		ReadDataFromClient();
 		IssueWrite();
 		}
+	OstTraceFunctionExit0( CACMWRITER_WRITECOMPLETED_EXIT );
 	}
 
 void CAcmWriter::ReadDataFromClient()
@@ -204,22 +223,28 @@
  * Read data from the client space into the internal buffer, prior to writing.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CACMWRITER_READDATAFROMCLIENT_ENTRY );
 	TPtr8 ptr((TUint8*)iBuf.Ptr(),
 			  0,
 			  Min(iBuf.MaxLength(), iLengthToGo));
 
 	TInt err = iPort.IPCRead(iCurrentRequest.iClientPtr,
 			ptr,
-			static_cast<TInt>(iOffsetIntoClientsMemory));	
-	LOGTEXT2(_L8("\tIPCRead = %d"), err);
+			static_cast<TInt>(iOffsetIntoClientsMemory));
+	OstTrace1( TRACE_NORMAL, CACMWRITER_READDATAFROMCLIENT, "CAcmWriter::ReadDataFromClient;\tIPCRead = %d", err );
+	
 	iBuf.SetLength(ptr.Length());
-	__ASSERT_DEBUG(!err, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
-	
+	if (err != 0)
+		{
+		OstTrace1( TRACE_FATAL, CACMWRITER_READDATAFROMCLIENT_DUP1, 
+										"CAcmWriter::ReadDataFromClient;EPanicInternalError=%d", 
+										(TInt)EPanicInternalError );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	static_cast<void>(err);
-
 	// Increase our pointer (into the client's space) of already-read data.
 	iOffsetIntoClientsMemory += iBuf.Length();
+	OstTraceFunctionExit0( CACMWRITER_READDATAFROMCLIENT_EXIT );
 	}
 
 
@@ -234,26 +259,38 @@
  * @param aLength Length to write.
  */
 	{
-	LOG_FUNC
-
-	__ASSERT_DEBUG(aLength <= static_cast<TUint>(KMaxTInt), 
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError));
-
+	OstTraceFunctionEntry0( CACMWRITER_CHECKNEWREQUEST_ENTRY );
+	
+	if (aLength > static_cast<TUint>(KMaxTInt))
+		{
+		OstTrace1( TRACE_FATAL, CACMWRITER_CHECKNEWREQUEST, 
+										"CAcmWriter::CheckNewRequest;aLength > static_cast<TUint>(KMaxTInt), EPanicInternalError=%d", 
+										(TInt)EPanicInternalError );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	// Check we have no outstanding request already.
 	if ( iCurrentRequest.iClientPtr )
 		{
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError);
+		OstTrace1( TRACE_FATAL, CACMWRITER_CHECKNEWREQUEST_DUP1, 
+										"CAcmWriter::CheckNewRequest;iCurrentRequest.iClientPtr != NULL, EPanicInternalError=%d", 
+										(TInt)EPanicInternalError );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
 		}
 	// Sanity check on what C32 gave us.
-	__ASSERT_DEBUG(aClientBuffer, 
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError));
-
+	if (aClientBuffer == NULL)
+		{
+		OstTrace1( TRACE_FATAL, CACMWRITER_CHECKNEWREQUEST_DUP2, 
+										"CAcmWriter::CheckNewRequest;aClientBuffer == NULL, EPanicInternalError=%d", 
+										(TInt)EPanicInternalError );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	// Make a note of interesting data.
 	iCurrentRequest.iLength = aLength;
 	iCurrentRequest.iClientPtr = aClientBuffer;
 	
 	iLengthToGo = aLength;
 	iOffsetIntoClientsMemory = 0;
+	OstTraceFunctionExit0( CACMWRITER_CHECKNEWREQUEST_EXIT );
 	}
 
 void CAcmWriter::CompleteRequest(TInt aError)
@@ -264,13 +301,17 @@
  * @param aError The error code to complete with.
  */
 	{
-	LOGTEXT2(_L8("CAcmWriter::CompleteRequest aError=%d"), aError);
-
+	OstTraceFunctionEntry0( CACMWRITER_COMPLETEREQUEST_ENTRY );
+	OstTrace1( TRACE_NORMAL, CACMWRITER_COMPLETEREQUEST, 
+			"CAcmWriter::CompleteRequest;CAcmWriter::CompleteRequest aError=%d", (TInt)aError );
+	
 	// Set our flag to say that we no longer have an outstanding request.
 	iCurrentRequest.iClientPtr = NULL;
-
-	LOGTEXT2(_L8("\tcalling WriteCompleted with %d"), aError);
+	OstTrace1( TRACE_NORMAL, CACMWRITER_COMPLETEREQUEST_DUP1, 
+			"CAcmWriter::CompleteRequest;\tcalling WriteCompleted with %d", aError );
+	
 	iPort.WriteCompleted(aError);
+	OstTraceFunctionExit0( CACMWRITER_COMPLETEREQUEST_EXIT );
 	}
 
 void CAcmWriter::IssueWrite()
@@ -279,11 +320,15 @@
  * entire load of buffered data in one go.
  */
 	{
-	LOG_FUNC
-
-	LOGTEXT2(_L8("\tissuing Write of %d bytes"), iBuf.Length());
-	__ASSERT_DEBUG(iPort.Acm(), 
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	OstTraceFunctionEntry0( CACMWRITER_ISSUEWRITE_ENTRY );
+	
+	OstTrace1( TRACE_NORMAL, CACMWRITER_ISSUEWRITE, "CAcmWriter::IssueWrite;\tissuing Write of %d bytes", (TInt)(iBuf.Length()) );
+	if (iPort.Acm() == NULL)
+		{
+		OstTrace1( TRACE_FATAL, CACMWRITER_ISSUEWRITE_DUP1, 
+					"CAcmWriter::IssueWrite;EPanicInternalError=%d", (TInt)EPanicInternalError);
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	iPort.Acm()->Write(*this, 
 		iBuf, 
 		iBuf.Length());
@@ -296,11 +341,14 @@
 	// This is not expected to occur but the test is in here just to be safe.
 	if(iBuf.Length() == 0 && iCurrentRequest.Length() != 0 && iLengthToGo != 0)
 		{
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError);
+		OstTrace1( TRACE_FATAL, CACMWRITER_ISSUEWRITE_DUP2, 
+					"CAcmWriter::IssueWrite;EPanicInternalError=%d", (TInt)EPanicInternalError);
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
 		}
 #endif
 	// Update our counter of remaining data to write. 
 	iLengthToGo -= iBuf.Length();
+	OstTraceFunctionExit0( CACMWRITER_ISSUEWRITE_EXIT );
 	}
 
 //
--- a/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/ActiveDataAvailableNotifier.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/ActiveDataAvailableNotifier.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
@@ -22,11 +22,12 @@
 #include "AcmPanic.h"
 #include "AcmUtils.h"
 #include "NotifyDataAvailableObserver.h"
-#include <usb/usblogger.h>
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "ActiveDataAvailableNotifierTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "ECACM");
-#endif
+
 
 CActiveDataAvailableNotifier::CActiveDataAvailableNotifier(
 								MNotifyDataAvailableObserver& aParent, 
@@ -46,7 +47,9 @@
  * @param aEndpoint The endpoint to read from.
  */
 	{
+	OstTraceFunctionEntry0( CACTIVEDATAAVAILABLENOTIFIER_CACTIVEDATAAVAILABLENOTIFIER_CONS_ENTRY );
 	CActiveScheduler::Add(this);
+	OstTraceFunctionExit0( CACTIVEDATAAVAILABLENOTIFIER_CACTIVEDATAAVAILABLENOTIFIER_CONS_EXIT );
 	}
 
 CActiveDataAvailableNotifier::~CActiveDataAvailableNotifier()
@@ -54,9 +57,9 @@
  * Destructor.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACTIVEDATAAVAILABLENOTIFIER_CACTIVEDATAAVAILABLENOTIFIER_DES_ENTRY );
 	Cancel();
+	OstTraceFunctionExit0( CACTIVEDATAAVAILABLENOTIFIER_CACTIVEDATAAVAILABLENOTIFIER_DES_EXIT );
 	}
 
 CActiveDataAvailableNotifier* CActiveDataAvailableNotifier::NewL(
@@ -74,10 +77,10 @@
  * @return Ownership of a new CActiveReadOneOrMoreReader object.
  */
 	{
-	LOG_STATIC_FUNC_ENTRY
-
+	OstTraceFunctionEntry0( CACTIVEDATAAVAILABLENOTIFIER_NEWL_ENTRY );
 	CActiveDataAvailableNotifier* self = 
 		new(ELeave) CActiveDataAvailableNotifier(aParent, aLdd, aEndpoint);
+	OstTraceFunctionExit0( CACTIVEDATAAVAILABLENOTIFIER_NEWL_EXIT );
 	return self;
 	}
 
@@ -86,12 +89,10 @@
  * When incoming data arrives at the LDD notify the caller.
  */
 	{
-	LOGTEXT(_L8(">>CActiveDataAvailableNotifier::NotifyDataAvailable"));
-
+	OstTraceFunctionEntry0( CACTIVEDATAAVAILABLENOTIFIER_NOTIFYDATAAVAILABLE_ENTRY );
 	iLdd.ReadOneOrMore(iStatus, iEndpoint, iUnusedBuf, 0);
 	SetActive();
-
-	LOGTEXT(_L8("<<CActiveDataAvailableNotifier::NotifyDataAvailable"));
+	OstTraceFunctionExit0( CACTIVEDATAAVAILABLENOTIFIER_NOTIFYDATAAVAILABLE_EXIT );
 	}
 
 void CActiveDataAvailableNotifier::DoCancel()
@@ -99,9 +100,9 @@
  * Cancel an outstanding request.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACTIVEDATAAVAILABLENOTIFIER_DOCANCEL_ENTRY );
 	iLdd.ReadCancel(iEndpoint);
+	OstTraceFunctionExit0( CACTIVEDATAAVAILABLENOTIFIER_DOCANCEL_EXIT );
 	}
 
 void CActiveDataAvailableNotifier::RunL()
@@ -114,10 +115,8 @@
  * been detached.
  */
 	{
-	LOG_LINE
-	LOG_FUNC
-	LOGTEXT2(_L8("\tiStatus = %d"), iStatus.Int());
-	
+	OstTraceFunctionEntry0( CACTIVEDATAAVAILABLENOTIFIER_RUNL_ENTRY );
+	OstTrace1( TRACE_NORMAL, CACTIVEDATAAVAILABLENOTIFIER_RUNL, "CActiveDataAvailableNotifier::RunL;iStatus=%d", iStatus.Int() );
 	TBool complete = EFalse;
 	TInt completeErr = KErrNone;
 
@@ -162,6 +161,7 @@
 		{
 		iParent.NotifyDataAvailableCompleted(completeErr);
 		}
+	OstTraceFunctionExit0( CACTIVEDATAAVAILABLENOTIFIER_RUNL_EXIT );
 	}
 
 //
--- a/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/ActiveReadOneOrMoreReader.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/ActiveReadOneOrMoreReader.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -22,10 +22,9 @@
 #include "AcmPanic.h"
 #include "AcmUtils.h"
 #include "ReadOneOrMoreObserver.h"
-#include <usb/usblogger.h>
-
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "ECACM");
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "ActiveReadOneOrMoreReaderTraces.h"
 #endif
 
 CActiveReadOneOrMoreReader::CActiveReadOneOrMoreReader(
@@ -45,7 +44,9 @@
  * @param aEndpoint The endpoint to read from.
  */
 	{
+	OstTraceFunctionEntry0( CACTIVEREADONEORMOREREADER_CACTIVEREADONEORMOREREADER_CONS_ENTRY );
 	CActiveScheduler::Add(this);
+	OstTraceFunctionExit0( CACTIVEREADONEORMOREREADER_CACTIVEREADONEORMOREREADER_CONS_EXIT );
 	}
 
 CActiveReadOneOrMoreReader::~CActiveReadOneOrMoreReader()
@@ -53,9 +54,9 @@
  * Destructor.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACTIVEREADONEORMOREREADER_CACTIVEREADONEORMOREREADER_DES_ENTRY );
 	Cancel();
+	OstTraceFunctionExit0( CACTIVEREADONEORMOREREADER_CACTIVEREADONEORMOREREADER_DES_EXIT );
 	}
 
 CActiveReadOneOrMoreReader* CActiveReadOneOrMoreReader::NewL(
@@ -72,10 +73,10 @@
  * @return Ownership of a new CActiveReadOneOrMoreReader object.
  */
 	{
-	LOG_STATIC_FUNC_ENTRY
-
+	OstTraceFunctionEntry0( CACTIVEREADONEORMOREREADER_NEWL_ENTRY );
 	CActiveReadOneOrMoreReader* self = 
 		new(ELeave) CActiveReadOneOrMoreReader(aParent, aLdd, aEndpoint);
+	OstTraceFunctionExit0( CACTIVEREADONEORMOREREADER_NEWL_EXIT );
 	return self;
 	}
 
@@ -87,13 +88,12 @@
  * @param aLength The length to read.
  */
 	{
-	LOGTEXT2(_L8(">>CActiveReadOneOrMoreReader::ReadOneOrMore "
-		"aLength=%d"), aLength);
-
+	OstTraceFunctionEntry0( CACTIVEREADONEORMOREREADER_READONEORMORE_ENTRY );
+	OstTrace1( TRACE_NORMAL, CACTIVEREADONEORMOREREADER_READONEORMORE, 
+			"CActiveReadOneOrMoreReader::ReadOneOrMore;aLength=%d", aLength );
 	iLdd.ReadOneOrMore(iStatus, iEndpoint, aDes, aLength);
 	SetActive();
-
-	LOGTEXT(_L8("<<CActiveReadOneOrMoreReader::ReadOneOrMore"));
+	OstTraceFunctionExit0( CACTIVEREADONEORMOREREADER_READONEORMORE_EXIT );
 	}
 
 void CActiveReadOneOrMoreReader::DoCancel()
@@ -101,9 +101,9 @@
  * Cancel an outstanding request.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACTIVEREADONEORMOREREADER_DOCANCEL_ENTRY );
 	iLdd.ReadCancel(iEndpoint);
+	OstTraceFunctionExit0( CACTIVEREADONEORMOREREADER_DOCANCEL_EXIT );
 	}
 
 void CActiveReadOneOrMoreReader::RunL()
@@ -112,13 +112,11 @@
  * parent class of the completion.
  */
 	{
-	LOG_LINE
-	LOGTEXT2(_L8(">>CActiveReadOneOrMoreReader::RunL iStatus=%d"), 
-		iStatus.Int());
-
+	OstTraceFunctionEntry0( CACTIVEREADONEORMOREREADER_RUNL_ENTRY );
+	OstTrace1( TRACE_NORMAL, CACTIVEREADONEORMOREREADER_RUNL, 
+			"CActiveReadOneOrMoreReader::RunL;iStatus=%d", iStatus.Int() );
 	iParent.ReadOneOrMoreCompleted(iStatus.Int());
-
-	LOGTEXT(_L8("<<CActiveReadOneOrMoreReader::RunL"));
+	OstTraceFunctionExit0( CACTIVEREADONEORMOREREADER_RUNL_EXIT );
 	}
 
 //
--- a/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/ActiveReader.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/ActiveReader.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -22,10 +22,9 @@
 #include "AcmPanic.h"
 #include "ReadObserver.h"
 #include "AcmUtils.h"
-#include <usb/usblogger.h>
-
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "ECACM");
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "ActiveReaderTraces.h"
 #endif
 
 CActiveReader::CActiveReader(MReadObserver& aParent, RDevUsbcClient& aLdd, TEndpointNumber aEndpoint)
@@ -42,7 +41,9 @@
  * @param aEndpoint The endpoint to read from.
  */
 	{
+	OstTraceFunctionEntry0( CACTIVEREADER_CACTIVEREADER_CONS_ENTRY );
 	CActiveScheduler::Add(this);
+	OstTraceFunctionExit0( CACTIVEREADER_CACTIVEREADER_CONS_EXIT );
 	}
 
 CActiveReader::~CActiveReader()
@@ -50,9 +51,9 @@
  * Destructor.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACTIVEREADER_CACTIVEREADER_DES_ENTRY );
 	Cancel();
+	OstTraceFunctionExit0( CACTIVEREADER_CACTIVEREADER_DES_EXIT );
 	}
 
 CActiveReader* CActiveReader::NewL(MReadObserver& aParent, 
@@ -68,9 +69,9 @@
  * @return Ownership of a new CActiveReader object.
  */
 	{
-	LOG_STATIC_FUNC_ENTRY
-
+	OstTraceFunctionEntry0( CACTIVEREADER_NEWL_ENTRY );
 	CActiveReader* self = new(ELeave) CActiveReader(aParent, aLdd, aEndpoint);
+	OstTraceFunctionExit0( CACTIVEREADER_NEWL_EXIT );
 	return self;
 	}
 
@@ -82,10 +83,10 @@
  * @param aLen The length to read.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACTIVEREADER_READ_ENTRY );
 	iLdd.Read(iStatus, iEndpoint, aDes, aLen); 
 	SetActive();
+	OstTraceFunctionExit0( CACTIVEREADER_READ_EXIT );
 	}
 
 void CActiveReader::DoCancel()
@@ -93,9 +94,9 @@
  * Cancel an outstanding read.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACTIVEREADER_DOCANCEL_ENTRY );
 	iLdd.ReadCancel(iEndpoint);
+	OstTraceFunctionExit0( CACTIVEREADER_DOCANCEL_EXIT );
 	}
 
 void CActiveReader::RunL()
@@ -104,12 +105,10 @@
  * parent class of the completion.
  */
 	{
-	LOG_LINE
-	LOGTEXT2(_L8(">>CActiveReader::RunL iStatus=%d"), iStatus.Int());
-
+	OstTraceFunctionEntry0( CACTIVEREADER_RUNL_ENTRY );
+	OstTrace1( TRACE_NORMAL, CACTIVEREADER_RUNL, "CActiveReader::RunL;RunL iStatus=%d", iStatus.Int() );
 	iParent.ReadCompleted(iStatus.Int());
-
-	LOGTEXT(_L8("<<CActiveReader::RunL"));
+	OstTraceFunctionExit0( CACTIVEREADER_RUNL_EXIT );
 	}
 
 //
--- a/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/ActiveWriter.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/ActiveWriter.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -22,11 +22,11 @@
 #include "AcmPanic.h"
 #include "WriteObserver.h"
 #include "AcmUtils.h"
-#include <usb/usblogger.h>
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "ActiveWriterTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "ECACM");
-#endif
 
 CActiveWriter::CActiveWriter(MWriteObserver& aParent, RDevUsbcClient& aLdd, TEndpointNumber aEndpoint)
  :	CActive(KEcacmAOPriority), 
@@ -44,7 +44,9 @@
  * @param aEndpoint The endpoint to write to.
  */
 	{
+	OstTraceFunctionEntry0( CACTIVEWRITER_CACTIVEWRITER_CONS_ENTRY );
 	CActiveScheduler::Add(this);
+	OstTraceFunctionExit0( CACTIVEWRITER_CACTIVEWRITER_CONS_EXIT );
 	}
 
 CActiveWriter::~CActiveWriter()
@@ -52,9 +54,9 @@
  * Destructor.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACTIVEWRITER_CACTIVEWRITER_DES_ENTRY );
 	Cancel();
+	OstTraceFunctionExit0( CACTIVEWRITER_CACTIVEWRITER_DES_EXIT );
 	}
 
 CActiveWriter* CActiveWriter::NewL(MWriteObserver& aParent, 
@@ -70,9 +72,9 @@
  * @return Ownership of a new CActiveWriter object.
  */
 	{
-	LOG_STATIC_FUNC_ENTRY
-
+	OstTraceFunctionEntry0( CACTIVEWRITER_NEWL_ENTRY );
 	CActiveWriter* self = new(ELeave) CActiveWriter(aParent, aLdd, aEndpoint);
+	OstTraceFunctionExit0( CACTIVEWRITER_NEWL_EXIT );
 	return self;
 	}
 
@@ -87,8 +89,8 @@
  * @param aZlp Whether ZLP termination may be required.
  */
 	{
-	LOGTEXT(_L8(">>CActiveWriter::Write"));
-
+	OstTraceFunctionEntry0( CACTIVEWRITER_WRITE_ENTRY );
+	
 	if ( aZlp )
 		{
 		// the driver can be relied on to correctly handle appended ZLPs
@@ -109,7 +111,7 @@
 			{
 			iLdd.Write(iStatus, iEndpoint, aDes, aLen, EFalse);
 			iWritingState = ECompleteMessage;
-			LOGTEXT2(_L8("CActiveWriter::Writing %d bytes"), aLen);
+			OstTrace1( TRACE_NORMAL, CACTIVEWRITER_WRITE, "CActiveWriter::Write;Writing %d bytes", aLen );
 			}
 		else
 			{
@@ -125,12 +127,12 @@
 			iLdd.Write(iStatus, iEndpoint, iFirstPortion, aLen-1, EFalse);
 			
 			iWritingState = EFirstMessagePart;
-			LOGTEXT3(_L8("CActiveWriter::Writing %d bytes of the %d"), aLen-1, aLen);
+			OstTraceExt2( TRACE_NORMAL, CACTIVEWRITER_WRITE_DUP1, 
+					"CActiveWriter::Write;Writing %d bytes of the %d", aLen-1, aLen );
 			}
 		}
 	SetActive();
-
-	LOGTEXT(_L8("<<CActiveWriter::Write"));
+	OstTraceFunctionExit0( CACTIVEWRITER_WRITE_EXIT );
 	}
 
 void CActiveWriter::DoCancel()
@@ -138,9 +140,9 @@
  * Cancel an outstanding write.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACTIVEWRITER_DOCANCEL_ENTRY );
 	iLdd.WriteCancel(iEndpoint);
+	OstTraceFunctionExit0( CACTIVEWRITER_DOCANCEL_EXIT );
 	}
 
 void CActiveWriter::RunL()
@@ -149,8 +151,8 @@
  * parent class of the completion.
  */
 	{
-	LOG_LINE
-	LOGTEXT2(_L8(">>CActiveWriter::RunL iStatus=%d"), iStatus.Int());
+	OstTraceFunctionEntry0( CACTIVEWRITER_RUNL_ENTRY );
+	OstTrace1( TRACE_NORMAL, CACTIVEWRITER_RUNL, "CActiveWriter::RunL;iStatus=%d", iStatus.Int() );
 	
 	if ( iWritingState == EFirstMessagePart )
 		{
@@ -159,8 +161,8 @@
 			// now send the second part..
 			iLdd.Write(iStatus, iEndpoint, iSecondPortion, iSecondPortion.Length(), EFalse);
 			iWritingState = EFinalMessagePart;
-			LOGTEXT(_L8("CActiveWriter::Writing 1 byte to complete original nx64 byte message"));
-
+			OstTrace0( TRACE_NORMAL, CACTIVEWRITER_RUNL_DUP1, 
+					"CActiveWriter::RunL;Writing 1 byte to complete original nx64 byte message" );
 			SetActive();
 			}
 		else
@@ -175,7 +177,7 @@
 		iParent.WriteCompleted(iStatus.Int());
 		}
 		
-	LOGTEXT(_L8("<<CActiveWriter::RunL"));
+	OstTraceFunctionExit0( CACTIVEWRITER_RUNL_EXIT );
 	}
 
 //
--- a/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/BreakController.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/BreakController.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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,11 +21,11 @@
 #include "HostPushedChangeObserver.h"
 #include "AcmPanic.h"
 #include "BreakObserver.h"
-#include <usb/usblogger.h>
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "BreakControllerTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "ECACM");
-#endif
 
 CBreakController::CBreakController(CCdcAcmClass& aParentAcm)
 /**
@@ -37,6 +37,7 @@
 	iBreakState(EInactive),
 	iParentAcm(aParentAcm)
 	{
+	OstTraceFunctionEntry0( CBREAKCONTROLLER_CBREAKCONTROLLER_CONS_ENTRY );
 	CActiveScheduler::Add(this);
 
 	// now populate the state machine that manages the transfers between
@@ -66,6 +67,7 @@
 
 	StateDispatcher[ELocked    ][EInactive ] = &ScInactive;
 	StateDispatcher[ELocked    ][ETiming   ] = &ScSetTimer; 
+	OstTraceFunctionExit0( CBREAKCONTROLLER_CBREAKCONTROLLER_CONS_EXIT );
 	}
 
 CBreakController* CBreakController::NewL(CCdcAcmClass& aParentAcm)
@@ -76,12 +78,12 @@
  * @return Ownership of a new CBreakController object.
  */ 
 	{
-	LOG_STATIC_FUNC_ENTRY
-
+	OstTraceFunctionEntry0( CBREAKCONTROLLER_NEWL_ENTRY );
 	CBreakController* self = new(ELeave) CBreakController(aParentAcm);
 	CleanupStack::PushL(self);
 	self->ConstructL();
 	CLEANUPSTACK_POP(self);
+	OstTraceFunctionExit0( CBREAKCONTROLLER_NEWL_EXIT );
 	return self;
 	}
 
@@ -90,7 +92,13 @@
  * 2nd-phase constructor.
  */
 	{
-	LEAVEIFERRORL(iTimer.CreateLocal());
+	TInt	err;
+	err = iTimer.CreateLocal();
+	if (err < 0)
+		{
+		OstTrace1( TRACE_NORMAL, CBREAKCONTROLLER_CONSTRUCTL, "CBreakController::ConstructL;err=%d", err );
+		User::Leave(err);
+		}
 	}
 
 CBreakController::~CBreakController()
@@ -98,10 +106,10 @@
  * Destructor.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CBREAKCONTROLLER_CBREAKCONTROLLER_DES_ENTRY );
 	Cancel();
 	iTimer.Close();
+	OstTraceFunctionExit0( CBREAKCONTROLLER_CBREAKCONTROLLER_DES_EXIT );
 	}
 
 void CBreakController::RunL()
@@ -109,9 +117,8 @@
  * Called by the active scheduler; handles timer completion.
  */
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CBREAKCONTROLLER_RUNL_ENTRY );
+	
 	// check the status to see if the timer has matured, if so go straight 
 	// to INACTIVE state (and publish new state)
 	if ( iStatus == KErrNone )
@@ -119,9 +126,13 @@
 		// Use iRequester to turn the break off. This should not fail.
 		TInt err = BreakRequest(iRequester, EInactive);
 		static_cast<void>(err);
-		__ASSERT_DEBUG(!err, 
-			_USB_PANIC(KAcmPanicCat, EPanicInternalError));
+		if (err)
+			{		
+			OstTrace1( TRACE_FATAL, CBREAKCONTROLLER_RUNL, "CBreakController::RunL;err=%d", err );
+			__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+			}
 		}
+	OstTraceFunctionExit0( CBREAKCONTROLLER_RUNL_EXIT );
 	}
 
 void CBreakController::DoCancel()
@@ -129,9 +140,9 @@
  * Called by the framework; handles cancelling the outstanding timer request.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CBREAKCONTROLLER_DOCANCEL_ENTRY );
 	iTimer.Cancel();
+	OstTraceFunctionExit0( CBREAKCONTROLLER_DOCANCEL_EXIT );
 	}
 
 TInt CBreakController::BreakRequest(TRequester aRequester, 
@@ -147,28 +158,30 @@
  * @return Error, for instance if a different entity already owns the break.
  */
  	{
-	LOG_FUNC
-	LOGTEXT4(_L8("\taRequester = %d, aState = %d, aDelay = %d"), 
-		aRequester, aState, aDelay.Int());	  
+	OstTraceFunctionEntry0( CBREAKCONTROLLER_BREAKREQUEST_ENTRY );
+	OstTraceExt3( TRACE_NORMAL, CBREAKCONTROLLER_BREAKREQUEST, 
+			"CBreakController::BreakRequest;aRequester=%d;aState=%d;aDelay=%d", (TInt)aRequester, (TInt)aState, aDelay.Int() );
 
 	// Check the validity of the request.
 	if ( aRequester != iRequester && iRequester != ENone )
 		{
-		LOGTEXT3(_L8("\t*** %d is in charge- cannot service request "
-			"from %d- returning KErrInUse"), iRequester, aRequester);
+		OstTraceExt2( TRACE_FLOW, CBREAKCONTROLLER_BREAKREQUEST_DUP1, 
+				"CBreakController::BreakRequest;%d is in charge- cannot service request from %d- returning KErrInUse", 
+				(TInt)iRequester, (TInt)aRequester );
+		
+		OstTraceFunctionExit0( CBREAKCONTROLLER_BREAKREQUEST_EXIT );
 		return KErrInUse;
 		}
 
 	iRequester = aRequester;
-
 	StateMachine(aState, aDelay);
-
 	// Reset the owner member if relevant.
 	if ( aState == EInactive )
 		{
 		iRequester = ENone;
 		}
 
+	OstTraceFunctionExit0( CBREAKCONTROLLER_BREAKREQUEST_EXIT_DUP1 );
 	return KErrNone;
 	}
 
@@ -181,20 +194,23 @@
  * @param aDelay Only used if going to a breaking state, the delay.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CBREAKCONTROLLER_STATEMACHINE_ENTRY );
 	TBool resultOK = EFalse;
 
 	// Invoke the desired function.
 	PBFNT pfsDispatch = StateDispatcher[iBreakState][aBreakState];
-	__ASSERT_DEBUG(pfsDispatch, 
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (!pfsDispatch)	
+		{
+		OstTraceExt1( TRACE_FATAL, CBREAKCONTROLLER_STATEMACHINE, "CBreakController::StateMachine;pfsDispatch=%p", (TAny*)pfsDispatch );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	resultOK = ( *pfsDispatch )(this, aDelay);
 
 	if ( resultOK )
 		{
-		LOGTEXT(_L8("\tbreak state dispatcher returned *SUCCESS*"));
-
+		OstTrace0( TRACE_NORMAL, CBREAKCONTROLLER_STATEMACHINE_DUP1, 
+				"CBreakController::StateMachine;\tbreak state dispatcher returned *SUCCESS*" );
+		
 		// check to see if the state change will need to result
 		// in a modification to the public state of BREAK which is
 		// either NO-BREAK == EBreakInactive
@@ -214,8 +230,10 @@
 		}
 	else
 		{
-		LOGTEXT(_L8("\tbreak state dispatcher returned *FAILURE*"));
+		OstTrace0( TRACE_NORMAL, CBREAKCONTROLLER_STATEMACHINE_DUP2, 
+				"CBreakController::StateMachine;\tbreak state dispatcher returned *FAILURE*" );
 		}
+	OstTraceFunctionExit0( CBREAKCONTROLLER_STATEMACHINE_EXIT );
 	}
 
 void CBreakController::Publish(TState aNewState)
@@ -226,11 +244,13 @@
  * @param aNewState The next state we're about to go to.
  */
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8("\taNewState = %d"), aNewState);
+	OstTraceFunctionEntry0( CBREAKCONTROLLER_PUBLISH_ENTRY );
 
-	__ASSERT_DEBUG(aNewState != iBreakState, 
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (aNewState == iBreakState)
+		{
+		OstTrace1( TRACE_FATAL, CBREAKCONTROLLER_PUBLISH, "CBreakController::Publish;aNewState=%d", (TInt)aNewState );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 
 	// send the new BREAK state off to the USB Host
 	// this function is normally used so that ACMCSY can send client 
@@ -247,7 +267,7 @@
 	// this should cause it to be toggled there.
 	if( iParentAcm.BreakCallback() )
 		{
-		LOGTEXT(_L8("\tabout to call back break state change"));
+		OstTrace0( TRACE_NORMAL, CBREAKCONTROLLER_PUBLISH_DUP1, "CBreakController::Publish;\tabout to call back break state change" );
 		iParentAcm.BreakCallback()->BreakStateChange();
 		}
 
@@ -255,13 +275,13 @@
 	// we tell the MBreakObserver (ACM port) that the break has completed. 
 	if ( aNewState == EInactive )
 		{
-		LOGTEXT(_L8("\tnew state is break-inactive"));
+		OstTrace0( TRACE_NORMAL, CBREAKCONTROLLER_PUBLISH_DUP2, "CBreakController::Publish;\tnew state is break-inactive" );
 		if ( iRequester == EDevice )
 			{
-			LOGTEXT(_L8("\tdevice is interested"));
+			OstTrace0( TRACE_NORMAL, CBREAKCONTROLLER_PUBLISH_DUP3, "CBreakController::Publish;\tdevice is interested" );
 			if( iParentAcm.BreakCallback() )
 				{
-				LOGTEXT(_L8("\tabout to call back break completion"));
+				OstTrace0( TRACE_NORMAL, CBREAKCONTROLLER_PUBLISH_DUP4, "CBreakController::Publish;\tabout to call back break completion" );
 				iParentAcm.BreakCallback()->BreakRequestCompleted(); 
 				}
 			}
@@ -269,6 +289,7 @@
 		// We just got to break-inactive state. Blank the requester record.
 		iRequester = ENone;
 		}
+	OstTraceFunctionExit0( CBREAKCONTROLLER_PUBLISH_EXIT );
 	}
 
 /**
@@ -281,18 +302,17 @@
 TBool CBreakController::ScInvalid(CBreakController *aThis, 
 								  TTimeIntervalMicroSeconds32 aDelay)
 	{
-	LOG_STATIC_FUNC_ENTRY
-
+	OstTraceFunctionEntry0( CBREAKCONTROLLER_SCINVALID_ENTRY );
 	static_cast<void>(aThis); // remove warning 
 	static_cast<void>(aDelay); // remove warning
-	
+	OstTraceFunctionExit0( CBREAKCONTROLLER_SCINVALID_EXIT );
 	return( EFalse );
 	}
 
 TBool CBreakController::ScInactive(CBreakController *aThis, 
 								   TTimeIntervalMicroSeconds32 aDelay)
 	{
-	LOG_STATIC_FUNC_ENTRY
+	OstTraceFunctionEntry0( CBREAKCONTROLLER_SCINACTIVE_ENTRY );
 	
 	static_cast<void>(aDelay); // remove warning
 
@@ -302,17 +322,19 @@
 
 	aThis->iParentAcm.SetBreakActive(EFalse);
 
+	OstTraceFunctionExit0( CBREAKCONTROLLER_SCINACTIVE_EXIT );
 	return( ETrue );
 	}
 
 TBool CBreakController::ScSetTimer(CBreakController *aThis, 
 								   TTimeIntervalMicroSeconds32 aDelay)
 	{
-	LOG_STATIC_FUNC_ENTRY
+	OstTraceFunctionEntry0( CBREAKCONTROLLER_SCSETTIMER_ENTRY );
 
 	// don't try to set any delay if the caller wants something impossible
 	if ( aDelay.Int() <= 0 )
 		{
+		OstTraceFunctionExit0( CBREAKCONTROLLER_SCSETTIMER_EXIT );
 		return( EFalse );
 		}
 
@@ -323,14 +345,14 @@
 
 	aThis->iParentAcm.SetBreakActive(ETrue);
 
+	OstTraceFunctionExit0( CBREAKCONTROLLER_SCSETTIMER_EXIT_DUP1 );
 	return( ETrue );
 	}
 
 TBool CBreakController::ScLocked(CBreakController *aThis, 
 								 TTimeIntervalMicroSeconds32 aDelay)
 	{
-	LOG_STATIC_FUNC_ENTRY
-
+	OstTraceFunctionEntry0( CBREAKCONTROLLER_SCLOCKED_ENTRY );
 	static_cast<void>(aDelay); // remove warning
 
 	// this may have been called while a BREAK is already current, so cancel 
@@ -339,6 +361,7 @@
 
 	aThis->iParentAcm.SetBreakActive(ETrue);
 
+	OstTraceFunctionExit0( CBREAKCONTROLLER_SCLOCKED_EXIT );
 	return( ETrue );
 	}
 
--- a/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/CdcAcmClass.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/CdcAcmClass.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -22,10 +22,9 @@
 #include "AcmUtils.h"
 #include "HostPushedChangeObserver.h"
 #include "BreakController.h"
-#include <usb/usblogger.h>
-
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "ECACM");
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "CdcAcmClassTraces.h"
 #endif
 
 extern const TInt32 KUsbAcmHostCanHandleZLPs = 0;
@@ -35,7 +34,9 @@
  * Constructor.
  */
 	{
+	OstTraceFunctionEntry0( CCDCACMCLASS_CCDCACMCLASS_CONS_ENTRY );
 	SetDefaultAcm();
+	OstTraceFunctionExit0( CCDCACMCLASS_CCDCACMCLASS_CONS_EXIT );
 	}
 
 CCdcAcmClass* CCdcAcmClass::NewL(const TUint8 aProtocolNum, const TDesC16& aAcmControlIfcName, const TDesC16& aAcmDataIfcName)
@@ -45,12 +46,12 @@
  * @return Ownership of a new CCdcAcmClass object
  */
 	{
-	LOG_STATIC_FUNC_ENTRY
-
+	OstTraceFunctionEntry0( CCDCACMCLASS_NEWL_ENTRY );
 	CCdcAcmClass* self = new(ELeave) CCdcAcmClass;
 	CleanupStack::PushL(self);
 	self->ConstructL(aProtocolNum, aAcmControlIfcName, aAcmDataIfcName);
 	CLEANUPSTACK_POP(self);
+	OstTraceFunctionExit0( CCDCACMCLASS_NEWL_EXIT );
 	return self;
 	}
 
@@ -62,32 +63,41 @@
  * @param aDataIfcName contains the interface name
  */
 	{
+	OstTraceFunctionEntry0( CCDCACMCLASS_CONSTRUCTL_ENTRY );
+	
 	TUint8 interfaceNumber;
 	TInt res;
 
-	LOGTEXT(_L8("\tabout to create control interface with name"));
+	OstTrace0( TRACE_NORMAL, CCDCACMCLASS_CONSTRUCTL, "CCdcAcmClass::ConstructL;\tabout to create control interface with name" );
 	iControl = CCdcControlInterface::NewL(*this, aProtocolNum, aControlIfcName);
 
-	LOGTEXT(_L8("\tabout to create data interface with name"));
+	OstTrace0( TRACE_NORMAL, CCDCACMCLASS_CONSTRUCTL_DUP1, "CCdcAcmClass::ConstructL;\tabout to create data interface with name" );
 	iData = CCdcDataInterface::NewL(aDataIfcName);
 
 	iBreakController = CBreakController::NewL(*this);
 
-	LOGTEXT(_L8("\tabout to call GetInterfaceNumber"));
+	OstTrace0( TRACE_NORMAL, CCDCACMCLASS_CONSTRUCTL_DUP2, "CCdcAcmClass::ConstructL;\tabout to call GetInterfaceNumber" );
 	res = iData->GetInterfaceNumber(interfaceNumber);
 	if ( res )
 		{
-		LOGTEXT2(_L8("\tGetInterfaceNumber=%d"), res);
-		LEAVEIFERRORL(res);
+		OstTrace1( TRACE_NORMAL, CCDCACMCLASS_CONSTRUCTL_DUP3, "CCdcAcmClass::ConstructL;\tGetInterfaceNumber=%d", res );
+		if (res < 0)
+			{
+			 User::Leave(res);
+			}
 		}
 
-	LOGTEXT(_L8("\tabout to call SetupClassSpecificDescriptor"));
+	OstTrace0( TRACE_NORMAL, CCDCACMCLASS_CONSTRUCTL_DUP4, "CCdcAcmClass::ConstructL;\tabout to call SetupClassSpecificDescriptor" );
 	res = iControl->SetupClassSpecificDescriptor(interfaceNumber);
 	if ( res )
 		{
-		LOGTEXT2(_L8("\tSetupClassSpecificDescriptor=%d"), res);
-		LEAVEIFERRORL(res);
+		OstTrace1( TRACE_NORMAL, CCDCACMCLASS_CONSTRUCTL_DUP5, "CCdcAcmClass::ConstructL;\tSetupClassSpecificDescriptor=%d", res );
+		if (res < 0)
+			{
+			User::Leave(res);
+			}
 		}
+	OstTraceFunctionExit0( CCDCACMCLASS_CONSTRUCTL_EXIT );
 	}
 
 CCdcAcmClass::~CCdcAcmClass()
@@ -95,11 +105,11 @@
  * Destructor.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CCDCACMCLASS_CCDCACMCLASS_DES_ENTRY );
 	delete iControl;
 	delete iData;
 	delete iBreakController;
+	OstTraceFunctionExit0( CCDCACMCLASS_CCDCACMCLASS_DES_EXIT );
 	}
 
 void CCdcAcmClass::SetCallback(MHostPushedChangeObserver* aCallback)
@@ -108,8 +118,8 @@
  * because the ACM class and the port have different lifetimes.
  */
 	{
-	LOGTEXT2(_L8(">>CCdcAcmClass::SetCallback aCallback=0x%08x"), aCallback);
-
+	OstTraceFunctionEntry0( CCDCACMCLASS_SETCALLBACK_ENTRY );
+	OstTraceExt1( TRACE_NORMAL, CCDCACMCLASS_SETCALLBACK, "CCdcAcmClass::SetCallback;aCallback=%p", aCallback );
 	iCallback = aCallback;
 
 	// remember that this function can also be called to
@@ -127,7 +137,7 @@
 		iCallback->HostSignalChange(iDtrState,iRtsState);
 		}
 	
-	LOGTEXT(_L8("<<CCdcAcmClass::SetCallback"));
+	OstTraceFunctionExit0( CCDCACMCLASS_SETCALLBACK_EXIT );
 	}
 
 void CCdcAcmClass::SetBreakCallback(MBreakObserver* aBreakCallback)
@@ -136,12 +146,10 @@
  * because the ACM class and the port have different lifetimes.
  */
 	{
-	LOGTEXT2(_L8(">>CCdcAcmClass::SetBreakCallback aBreakCallback=0x%08x"), 
-		aBreakCallback);
-
+	OstTraceFunctionEntry0( CCDCACMCLASS_SETBREAKCALLBACK_ENTRY );
+	OstTraceExt1( TRACE_NORMAL, CCDCACMCLASS_SETBREAKCALLBACK, "CCdcAcmClass::SetBreakCallback;aBreakCallback=%p", aBreakCallback );
 	iBreakCallback = aBreakCallback;
-
-	LOGTEXT(_L8("<<CCdcAcmClass::SetBreakCallback"));
+	OstTraceFunctionExit0( CCDCACMCLASS_SETBREAKCALLBACK_EXIT );
 	}
 
 void CCdcAcmClass::ReadOneOrMore(MReadOneOrMoreObserver& aObserver, TDes8& aDes)
@@ -152,12 +160,10 @@
  * @param aDes Descriptor to read into
  */
 	{
-	LOGTEXT2(_L8(">>CCdcAcmClass::ReadOneOrMore aObserver=0x%08x"), 
-		&aObserver);
-
+	OstTraceFunctionEntry0( CCDCACMCLASS_READONEORMORE_ENTRY );
+	OstTraceExt1( TRACE_NORMAL, CCDCACMCLASS_READONEORMORE, "CCdcAcmClass::ReadOneOrMore;aObserver=%p", &aObserver );
 	ReadOneOrMore(aObserver, aDes, aDes.Length());
-
-	LOGTEXT(_L8("<<CCdcAcmClass::ReadOneOrMore"));
+	OstTraceFunctionExit0( CCDCACMCLASS_READONEORMORE_EXIT );
 	}
 
 void CCdcAcmClass::ReadOneOrMore(MReadOneOrMoreObserver& aObserver, 
@@ -171,14 +177,18 @@
  * @param aLength Amount of data to read
  */
 	{
-	LOGTEXT3(_L8(">>CCdcAcmClass::ReadOneOrMore aObserver=0x%08x, "
-		"aLength=%d"), 
-			&aObserver, aLength);
+	OstTraceFunctionEntry0( CCDCACMCLASS_READONEORMORE_MREADONEORMOREOBSERVERREF_TDES8REF_TINT_ENTRY );
+	OstTraceExt2( TRACE_NORMAL, CCDCACMCLASS_READONEORMORE_MREADONEORMOREOBSERVERREF_TDES8REF_TINT, 
+			"CCdcAcmClass::ReadOneOrMore;aObserver=%p;aLength=%d", &aObserver, aLength );
 
-	__ASSERT_DEBUG(iData, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (!iData)
+		{
+		OstTrace1( TRACE_FATAL, CCDCACMCLASS_READONEORMORE_MREADONEORMOREOBSERVERREF_TDES8REF_TINT_DUP1, "CCdcAcmClass::ReadOneOrMore;iData=%d", (TInt)iData );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	iData->ReadOneOrMore(aObserver, aDes, aLength);
 
-	LOGTEXT(_L8("<<CCdcAcmClass::ReadOneOrMore"));
+	OstTraceFunctionExit0( CCDCACMCLASS_READONEORMORE_MREADONEORMOREOBSERVERREF_TDES8REF_TINT_EXIT );
 	}
 
 void CCdcAcmClass::Read(MReadObserver& aObserver, TDes8& aDes)
@@ -189,11 +199,10 @@
  * @param aDes Descriptor to read into.
  */
 	{
-	LOGTEXT2(_L8(">>CCdcAcmClass::Read aObserver=0x%08x"), &aObserver);
-
+	OstTraceFunctionEntry0( CCDCACMCLASS_READ_ENTRY );
+	OstTraceExt1( TRACE_NORMAL, CCDCACMCLASS_READ, "CCdcAcmClass::Read;aObserver=%p", &aObserver );
 	Read(aObserver, aDes, aDes.Length());
-
-	LOGTEXT(_L8("<<CCdcAcmClass::Read"));
+	OstTraceFunctionExit0( CCDCACMCLASS_READ_EXIT );
 	}
 
 void CCdcAcmClass::Read(MReadObserver& aObserver, TDes8& aDes, TInt aLength)
@@ -205,13 +214,15 @@
  * @param aLength Amount of data to read.
  */
 	{
-	LOGTEXT3(_L8(">>CCdcAcmClass::Read aObserver=0x%08x, aLength=%d"), 
-		&aObserver, aLength);
-
-	__ASSERT_DEBUG(iData, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	OstTraceFunctionEntry0( CCDCACMCLASS_READ_ENTRY_DUP1 );
+	OstTraceExt2( TRACE_NORMAL, CCDCACMCLASS_READ_DUP1, "CCdcAcmClass::Read;aObserver=%p;aLength=%d", &aObserver, aLength );
+	if (!iData)
+		{		
+		OstTraceExt1( TRACE_FATAL, CCDCACMCLASS_READ_DUP2, "CCdcAcmClass::Read;iData=%p", iData );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	iData->Read(aObserver, aDes, aLength);
-
-	LOGTEXT(_L8("<<CCdcAcmClass::Read"));
+	OstTraceFunctionExit0( CCDCACMCLASS_READ_ENTRY_DUP1_EXIT );
 	}
 
 void CCdcAcmClass::ReadCancel()
@@ -219,10 +230,15 @@
  * Cancel a read request.
  */
 	{
-	LOG_FUNC
-
-	__ASSERT_DEBUG(iData, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	OstTraceFunctionEntry0( CCDCACMCLASS_READCANCEL_ENTRY );
+	
+	if (!iData)
+		{
+		OstTraceExt1( TRACE_FATAL, CCDCACMCLASS_READCANCEL, "CCdcAcmClass::ReadCancel;iData=%p", iData );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	iData->CancelRead();
+	OstTraceFunctionExit0( CCDCACMCLASS_READCANCEL_EXIT );
 	}
 
 void CCdcAcmClass::Write(MWriteObserver& aObserver, const TDesC8& aDes)
@@ -233,12 +249,10 @@
  * @param aDes Descriptor containing the data to be written.
  */
 	{
-	LOGTEXT2(_L8(">>CCdcAcmClass::Write aObserver=0x%08x"), 
-		&aObserver);
-
+	OstTraceFunctionEntry0( CCDCACMCLASS_WRITE_ENTRY );
+	OstTraceExt1( TRACE_NORMAL, CCDCACMCLASS_WRITE, "CCdcAcmClass::Write;aObserver=%p", &aObserver );
 	Write(aObserver, aDes, aDes.Length());
-
-	LOGTEXT(_L8("<<CCdcAcmClass::Write"));
+	OstTraceFunctionExit0( CCDCACMCLASS_WRITE_EXIT );
 	}
 
 void CCdcAcmClass::Write(MWriteObserver& aObserver, 
@@ -252,13 +266,15 @@
  * @param aLength The amount of data to write.
  */
 	{
-	LOGTEXT3(_L8(">>CCdcAcmClass::Write aObserver=0x%08x, aLength=%d"), 
-		&aObserver, aLength);
-
-	__ASSERT_DEBUG(iData, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	OstTraceFunctionEntry0( CCDCACMCLASS_WRITE_ENTRY_DUP1 );
+	OstTraceExt2( TRACE_NORMAL, CCDCACMCLASS_WRITE_DUP1, "CCdcAcmClass::Write;aObserver=%p;aLength=%d", &aObserver, aLength );
+	if (!iData)
+		{
+		OstTraceExt1( TRACE_FATAL, CCDCACMCLASS_WRITE_DUP2, "CCdcAcmClass::Write;iData=%p", iData );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	iData->Write(aObserver, aDes, aLength);
-
-	LOGTEXT(_L8("<<CCdcAcmClass::Write"));
+	OstTraceFunctionExit0( CCDCACMCLASS_WRITE_ENTRY_DUP1_EXIT );
 	}
 
 void CCdcAcmClass::WriteCancel()
@@ -266,10 +282,14 @@
  * Cancel the write request.
  */
 	{
-	LOG_FUNC
-
-	__ASSERT_DEBUG(iData, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	OstTraceFunctionEntry0( CCDCACMCLASS_WRITECANCEL_ENTRY );
+	if (!iData)
+		{
+		OstTraceExt1( TRACE_FATAL, CCDCACMCLASS_WRITECANCEL, "CCdcAcmClass::WriteCancel;iData=%p", iData );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	iData->CancelWrite();
+	OstTraceFunctionExit0( CCDCACMCLASS_WRITECANCEL_EXIT );
 	}
 
 TInt CCdcAcmClass::HandleGetCommFeature(const TUint16 aSelector, 
@@ -282,9 +302,8 @@
  *					the ACM device or the country code from ISO 3166.
  */
 	{
-	LOGTEXT2(_L8(">>CCdcAcmClass::HandleGetCommFeature aSelector=%d"), 
-		aSelector); 
-
+	OstTraceFunctionEntry0( CCDCACMCLASS_HANDLEGETCOMMFEATURE_ENTRY );
+	OstTrace1( TRACE_NORMAL, CCDCACMCLASS_HANDLEGETCOMMFEATURE, "CCdcAcmClass::HandleGetCommFeature;aSelector=%d", (TInt)aSelector );
 	TInt ret = KErrNone;
 
 	// check the feature selector from the header and reject if invalid,
@@ -301,8 +320,8 @@
 		ppbuffer = &pbuffer;
 		
 		CCdcControlInterface::PutU16(ppbuffer,iAcmState);
-
-		LOGTEXT2(_L8("\tAbstract State [0x%04X]"), iAcmState);
+		OstTraceExt1( TRACE_NORMAL, CCDCACMCLASS_HANDLEGETCOMMFEATURE_DUP1, 
+				"CCdcAcmClass::HandleGetCommFeature;\tAbstract State [0x%hx]", iAcmState );
 		}
 		break;
 
@@ -311,7 +330,8 @@
 #if defined(DISABLE_ACM_CF_COUNTRY_SETTING)
 
 		aReturnData.SetLength(0);
-		LOGTEXT(_L8("\tCountry Code Not Supported"));
+		OstTrace0( TRACE_NORMAL, CCDCACMCLASS_HANDLEGETCOMMFEATURE_DUP2, 
+				"CCdcAcmClass::HandleGetCommFeature;\tCountry Code Not Supported" );
 		ret = KErrNotSupported;
 
 #elif defined(ENABLE_ACM_CF_COUNTRY_SETTING)
@@ -324,20 +344,21 @@
 		ppbuffer = &pbuffer;
 		
 		CCdcControlInterface::PutU16(ppbuffer,iCountryCode);
-
-		LOGTEXT2(_L8("\tCountry Code [0x%04X]"), iCountryCode);
-
+		OstTraceExt1( TRACE_NORMAL, CCDCACMCLASS_HANDLEGETCOMMFEATURE_DUP3, 
+				"CCdcAcmClass::HandleGetCommFeature;\tCountry Code [0x%hx]", iCountryCode );
 #endif
 		}
 		break;
 
 	default:
 		aReturnData.SetLength(0);
-		LOGTEXT(_L8("\tBad Selector"));
+		OstTrace0( TRACE_NORMAL, CCDCACMCLASS_HANDLEGETCOMMFEATURE_DUP4, "CCdcAcmClass::HandleGetCommFeature;\tBad Selector" );
 		ret = KErrUnknown;
 		}
 
-	LOGTEXT2(_L8("<<CCdcAcmClass::HandleGetCommFeature ret=%d"), ret); 
+	OstTrace1( TRACE_NORMAL, CCDCACMCLASS_HANDLEGETCOMMFEATURE_DUP5, 
+			"CCdcAcmClass::HandleGetCommFeature;ret=%d", ret );
+	OstTraceFunctionExit0( CCDCACMCLASS_HANDLEGETCOMMFEATURE_EXIT );
 	return ret;
 	}
 
@@ -347,9 +368,8 @@
  * @param aSelector Multiplex control for the feature is held in wValue field
  */
 	{
-	LOGTEXT2(_L8(">>CCdcAcmClass::HandleClearCommFeature aSelector=%d"), 
-		aSelector);
-
+	OstTraceFunctionEntry0( CCDCACMCLASS_HANDLECLEARCOMMFEATURE_ENTRY );
+	OstTrace1( TRACE_NORMAL, CCDCACMCLASS_HANDLECLEARCOMMFEATURE, "CCdcAcmClass::HandleClearCommFeature;aSelector=%d", (TInt)aSelector );
 	TInt ret = KErrNone;
 
 	// check the feature selector from the header and reject if invalid,
@@ -360,21 +380,24 @@
 		{
 		// reset to guaranteed-success default, so ignore return value
 		static_cast<void>(HandleNewAbstractState(EUsbAbstractStateDataMultiplex));
-		LOGTEXT2(_L8("\tAbstract State [0x%04X]"), iAcmState);
+		OstTraceExt1( TRACE_NORMAL, CCDCACMCLASS_HANDLECLEARCOMMFEATURE_DUP1, 
+				"CCdcAcmClass::HandleClearCommFeature;\tAbstract State [0x%hx]", iAcmState );
 		}
 		break;
 	
 	case EUsbCommFeatureSelectCountryCode:
 		{
 #if defined(DISABLE_ACM_CF_COUNTRY_SETTING)
-
-		LOGTEXT(_L8("\tCountry Code Not Supported"));
+		
+		OstTrace0( TRACE_NORMAL, CCDCACMCLASS_HANDLECLEARCOMMFEATURE_DUP2, 
+				"CCdcAcmClass::HandleClearCommFeature;\tCountry Code Not Supported" );
 		ret = KErrNotSupported;
 
 #elif defined(ENABLE_ACM_CF_COUNTRY_SETTING)
 
 		HandleNewCountryCode(KUsbCommCountryCode0);
-		LOGTEXT2(_L8("\tCountry Code [0x%04X]"), iCountryCode);
+		OstTraceExt1( TRACE_NORMAL, CCDCACMCLASS_HANDLECLEARCOMMFEATURE_DUP3, 
+				"CCdcAcmClass::HandleClearCommFeature;\tCountry Code [0x%hx]", iCountryCode );
 
 #endif
 		}
@@ -382,12 +405,13 @@
 	
 	default:
 		{
-		LOGTEXT(_L8("\tBad Selector"));
+		OstTrace0( TRACE_NORMAL, CCDCACMCLASS_HANDLECLEARCOMMFEATURE_DUP4, "CCdcAcmClass::HandleClearCommFeature;\tBad Selector" );
 		ret = KErrUnknown;
 		}
 		}
 
-	LOGTEXT2(_L8("<<CCdcAcmClass::HandleClearCommFeature ret=%d"), ret);
+	OstTrace1( TRACE_NORMAL, CCDCACMCLASS_HANDLECLEARCOMMFEATURE_DUP5, "CCdcAcmClass::HandleClearCommFeature;ret=%d", ret );
+	OstTraceFunctionExit0( CCDCACMCLASS_HANDLECLEARCOMMFEATURE_EXIT );
 	return ret;
 	}
 
@@ -408,11 +432,13 @@
  * data bit settings.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CCDCACMCLASS_HANDLESETLINECODING_ENTRY );
+	
 
 	if (aData.Length() != 7) // TODO: magic number?
 		{
-		LOGTEXT(_L8("\t***buffer too small"));
+		OstTrace0( TRACE_NORMAL, CCDCACMCLASS_HANDLESETLINECODING, "CCdcAcmClass::HandleSetLineCoding;\t***buffer too small" );
+		OstTraceFunctionExit0( CCDCACMCLASS_HANDLESETLINECODING_EXIT );
 		return KErrGeneral;
 		}
 
@@ -435,6 +461,7 @@
 		iCallback->HostConfigChange(epocConfig);
 		}
 
+	OstTraceFunctionExit0( CCDCACMCLASS_HANDLESETLINECODING_EXIT_DUP1 );
 	return KErrNone;
 	}
 
@@ -446,6 +473,8 @@
  * defaults.
  */
 	{
+	OstTraceFunctionEntry0( CCDCACMCLASS_SETDEFAULTACM_ENTRY );
+	
 	iUsbConfig.iRate	 = 115200;
 	iUsbConfig.iStopBits = EUsbStopBitOne;
 	iUsbConfig.iParity	 = EUsbParityNone;
@@ -467,6 +496,7 @@
 	iDcdState  = EFalse;
 
 	iBreakActive = EFalse;
+	OstTraceFunctionExit0( CCDCACMCLASS_SETDEFAULTACM_EXIT );
 	}
 
 void CCdcAcmClass::ConvertUsbConfigCodingToEpoc(const TUsbConfig& aUsbConfig, 
@@ -479,6 +509,8 @@
  * @param aEpocConfig	The EPOC configuration to be converted to.
  */
 	{
+	OstTraceFunctionEntry0( CCDCACMCLASS_CONVERTUSBCONFIGCODINGTOEPOC_ENTRY );
+	
 	switch ( aUsbConfig.iDataBits )
 		{
 	case EUsbDataBitsFive:
@@ -585,6 +617,7 @@
 			break;
 			}
 		}
+	OstTraceFunctionExit0( CCDCACMCLASS_CONVERTUSBCONFIGCODINGTOEPOC_EXIT );
 	}
 
 TInt CCdcAcmClass::HandleNewAbstractState(const TUint16 aAbstractState)
@@ -598,14 +631,12 @@
  *	D1 controls 'data multiplexed state' -> iAcmDataMultiplex
  */
 	{
-	LOGTEXT2(_L8(">>CCdcAcmClass::HandleNewAbstractState aAbstractState=%d"), 
-		aAbstractState);
+	OstTraceFunctionEntry0( CCDCACMCLASS_HANDLENEWABSTRACTSTATE_ENTRY );
+	OstTrace1( TRACE_NORMAL, CCDCACMCLASS_HANDLENEWABSTRACTSTATE, "CCdcAcmClass::HandleNewAbstractState;aAbstractState=%d", (TInt)aAbstractState );
 
 	TBool	multiplex;
 	TBool	idle;
-
 	TUint16 newstate;
-
 	TInt ret;
 
 	// collect local booleans from incoming combo ready to do local
@@ -656,21 +687,23 @@
 	// informed, note that the callback may not have been placed.
 	if( iAcmState != newstate )
 		{
-		LOGTEXT2(_L8("\tNew Combo [0x%04X]"), newstate);
+		OstTraceExt1( TRACE_NORMAL, CCDCACMCLASS_HANDLENEWABSTRACTSTATE_DUP1, 
+				"CCdcAcmClass::HandleNewAbstractState;\tNew Combo [0x%hx]", newstate );
 
 		if ( iCallback )
 			{
 			// If there was such a function in class 
 			// MHostPushedChangeObserver, notify 
 			// via iCallback->HostAbstractStateChange(newstate);
-			LOGTEXT(_L8("\tHas No Notification Method in class MHostPushedChangeObserver"));
+			OstTrace0( TRACE_NORMAL, CCDCACMCLASS_HANDLENEWABSTRACTSTATE_DUP2, 
+					"CCdcAcmClass::HandleNewAbstractState;\tHas No Notification Method in class MHostPushedChangeObserver" );
 			}
 		}
 
 	// and save the new state ready for next check
 	iAcmState = newstate;
-
-	LOGTEXT2(_L8("<<CCdcAcmClass::HandleNewAbstractState ret=%d"), ret);
+	OstTrace1( TRACE_NORMAL, CCDCACMCLASS_HANDLENEWABSTRACTSTATE_DUP3, "CCdcAcmClass::HandleNewAbstractState;ret=%d", ret );
+	OstTraceFunctionExit0( CCDCACMCLASS_HANDLENEWABSTRACTSTATE_EXIT );
 	return ret;
 	}
 
@@ -682,9 +715,8 @@
  * @param aCountryCode	The new Country Code as defined in ISO-3166
  */
 	{
-	LOGTEXT2(_L8(">>CCdcAcmClass::HandleNewCountryCode aCountryCode=%d"), 
-		aCountryCode);
-
+	OstTraceFunctionEntry0( CCDCACMCLASS_HANDLENEWCOUNTRYCODE_ENTRY );
+	OstTrace1( TRACE_NORMAL, CCDCACMCLASS_HANDLENEWCOUNTRYCODE, "CCdcAcmClass::HandleNewCountryCode;aCountryCode=%d", (TInt)aCountryCode );
 	TInt ret;
 
 #if defined(DISABLE_ACM_CF_COUNTRY_SETTING)
@@ -707,7 +739,8 @@
 
 #endif
 
-	LOGTEXT2(_L8("<<CCdcAcmClass::HandleNewCountryCode ret=%d"), ret);
+	OstTrace1( TRACE_NORMAL, CCDCACMCLASS_HANDLENEWCOUNTRYCODE_DUP1, "CCdcAcmClass::HandleNewCountryCode;ret=%d", ret );
+	OstTraceFunctionExit0( CCDCACMCLASS_HANDLENEWCOUNTRYCODE_EXIT );
 	return ret;
 	}
 
@@ -718,10 +751,9 @@
  * @param aData Pointer to the Encapsulated message
  */
 	{
-	LOG_FUNC
-
-	LOGTEXT(_L8("\t***not supported"));
-
+	OstTraceFunctionEntry0( CCDCACMCLASS_HANDLESENDENCAPCOMMAND_ENTRY );	
+	OstTrace0( TRACE_NORMAL, CCDCACMCLASS_HANDLESENDENCAPCOMMAND, "CCdcAcmClass::HandleSendEncapCommand;\t***not supported" );
+	OstTraceFunctionExit0( CCDCACMCLASS_HANDLESENDENCAPCOMMAND_EXIT );
 	return KErrNotSupported;
 	}
 
@@ -732,10 +764,9 @@
  * @param aReturnData Pointer to the Response field
  */
 	{
-	LOG_FUNC
-
-	LOGTEXT(_L8("\t***not supported"));
-
+	OstTraceFunctionEntry0( CCDCACMCLASS_HANDLEGETENCAPRESPONSE_ENTRY );
+	OstTrace0( TRACE_NORMAL, CCDCACMCLASS_HANDLEGETENCAPRESPONSE, "CCdcAcmClass::HandleGetEncapResponse;\t***not supported" );
+	OstTraceFunctionExit0( CCDCACMCLASS_HANDLEGETENCAPRESPONSE_EXIT );
 	return KErrNotSupported;
 	}
 
@@ -749,15 +780,17 @@
  *					the ACM device or the country code from ISO 3166.
  */
 	{
-	LOGTEXT2(_L8(">>CCdcAcmClass::HandleSetCommFeature aSelector=%d"), 
-		aSelector);
+	OstTraceFunctionEntry0( CCDCACMCLASS_HANDLESETCOMMFEATURE_ENTRY );
+	OstTrace1( TRACE_NORMAL, CCDCACMCLASS_HANDLESETCOMMFEATURE, "CCdcAcmClass::HandleSetCommFeature;aSelector=%d", (TInt)aSelector );
 
 	// reject any message that has malformed data
 	if ( aData.Length() != 2 )
 		{
-		LOGTEXT2(_L8("\t***aData.Length (%d) incorrect"), aData.Length());
-		LOGTEXT2(_L8("<<CCdcAcmClass::HandleSetCommFeature ret=%d"), 
-			KErrArgument);
+		OstTrace1( TRACE_NORMAL, CCDCACMCLASS_HANDLESETCOMMFEATURE_DUP1, 
+				"CCdcAcmClass::HandleSetCommFeature;\t***aData.Length (%d) incorrect", aData.Length() );
+		OstTrace1( TRACE_NORMAL, CCDCACMCLASS_HANDLESETCOMMFEATURE_DUP2, 
+				"CCdcAcmClass::HandleSetCommFeature;ret=%d", KErrArgument );
+		OstTraceFunctionExit0( CCDCACMCLASS_HANDLESETCOMMFEATURE_EXIT );
 		return KErrArgument;
 		}
 
@@ -781,9 +814,9 @@
 		if ( newstate != iAcmState )
 			{
 			ret = HandleNewAbstractState(newstate);
-
-			LOGTEXT4(_L8("\tHandleNewAbstractState=%d [0x%04X]->[0x%04X]"),
-					ret, iAcmState, newstate);
+			OstTraceExt3( TRACE_NORMAL, CCDCACMCLASS_HANDLESETCOMMFEATURE_DUP3, 
+					"CCdcAcmClass::HandleSetCommFeature;\tHandleNewAbstractState=%d [%hu]->[%hu]", 
+					ret, iAcmState, newstate );
 			}
 		}
 		break;
@@ -792,7 +825,7 @@
 		{
 #if defined(DISABLE_ACM_CF_COUNTRY_SETTING)
 
-		LOGTEXT(_L8("Country Code Not Supported"));
+		OstTrace0( TRACE_NORMAL, CCDCACMCLASS_HANDLESETCOMMFEATURE_DUP4, "CCdcAcmClass::HandleSetCommFeature;Country Code Not Supported" );
 		ret = KErrNotSupported;
 
 #elif defined(ENABLE_ACM_CF_COUNTRY_SETTING)
@@ -809,9 +842,8 @@
 		if( newcountry != iCountryCode )
 			{
 			ret = HandleNewCountryCode(newcountry);
-
-			LOGTEXT4(_L8("\tHandleNewCountryCode=%d [0x%04X]->[0x%04X]"),
-					ret, iCountryCode, newcountry);
+			OstTraceExt3( TRACE_NORMAL, CCDCACMCLASS_HANDLESETCOMMFEATURE_DUP5, 
+					"CCdcAcmClass::HandleSetCommFeature;\tHandleNewCountryCode=%d [%u]->[%u]", ret, iCountryCode, newcountry );
 			}
 
 #endif
@@ -820,12 +852,12 @@
 
 	default:
 		{
-		LOGTEXT(_L8("\tBad Selector"));
+		OstTrace0( TRACE_NORMAL, CCDCACMCLASS_HANDLESETCOMMFEATURE_DUP6, "CCdcAcmClass::HandleSetCommFeature;\tBad Selector" );
 		ret = KErrUnknown;
 		}
 		}
-
-	LOGTEXT2(_L8("<<CCdcAcmClass::HandleSetCommFeature ret=%d"), ret);
+	OstTrace1( TRACE_NORMAL, CCDCACMCLASS_HANDLESETCOMMFEATURE_DUP7, "CCdcAcmClass::HandleSetCommFeature;ret=%d", ret );
+	OstTraceFunctionExit0( CCDCACMCLASS_HANDLESETCOMMFEATURE_EXIT_DUP1 );
 	return ret;
 	}
 
@@ -839,8 +871,7 @@
  * bits, parity and data bits.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CCDCACMCLASS_HANDLEGETLINECODING_ENTRY );
 	aReturnData.SetLength(7);
 
 	TUint8* pbuffer;
@@ -853,6 +884,7 @@
 	CCdcControlInterface::PutU08(ppbuffer, static_cast<TUint8>(iUsbConfig.iParity  ));
 	CCdcControlInterface::PutU08(ppbuffer, static_cast<TUint8>(iUsbConfig.iDataBits));
 
+	OstTraceFunctionExit0( CCDCACMCLASS_HANDLEGETLINECODING_EXIT );
 	return KErrNone;
 	}
 
@@ -864,9 +896,9 @@
  * @param aDtrState DTR state.
  */
 	{
-	LOGTEXT3(_L8(">>CCdcAcmClass::HandleSetControlLineState aRtsState=%d, "
-		"aDtrState=%d"),
-			aRtsState, aDtrState);
+	OstTraceFunctionEntry0( CCDCACMCLASS_HANDLESETCONTROLLINESTATE_ENTRY );
+	OstTraceExt2( TRACE_NORMAL, CCDCACMCLASS_HANDLESETCONTROLLINESTATE, 
+			"CCdcAcmClass::HandleSetControlLineState;aRtsState=%d;aDtrState=%d", (TInt)aRtsState, (TInt)aDtrState );
 
 	iRtsState	= aRtsState;
 	iDtrState	= aDtrState;
@@ -875,7 +907,8 @@
 		iCallback->HostSignalChange(iDtrState,iRtsState);
 		}
 
-	LOGTEXT(_L8("<<CCdcAcmClass::HandleSetControlLineState ret=0"));
+	OstTrace0( TRACE_NORMAL, CCDCACMCLASS_HANDLESETCONTROLLINESTATE_DUP1, "CCdcAcmClass::HandleSetControlLineState;ret=0" );
+	OstTraceFunctionExit0( CCDCACMCLASS_HANDLESETCONTROLLINESTATE_EXIT );
 	return KErrNone;
 	}
 
@@ -886,9 +919,8 @@
  * @param aDuration Duration of the break in milliseconds.
  */
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8("\taDuration = %d"), aDuration);
-
+	OstTraceFunctionEntry0( CCDCACMCLASS_HANDLESENDBREAK_ENTRY );
+	OstTrace1( TRACE_NORMAL, CCDCACMCLASS_HANDLESENDBREAK, "CCdcAcmClass::HandleSendBreak;aDuration=%d", (TInt)aDuration );
 	TInt ret = KErrNone;
 
 	// timing value as given is checked for 'special' values
@@ -911,7 +943,8 @@
 			aDuration*1000);
 		}
 
-	LOGTEXT2(_L8("\tret = %d"), ret);
+	OstTrace1( TRACE_NORMAL, CCDCACMCLASS_HANDLESENDBREAK_DUP1, "CCdcAcmClass::HandleSendBreak;ret=%d", ret );
+	OstTraceFunctionExit0( CCDCACMCLASS_HANDLESENDBREAK_EXIT );
 	return ret;
 	}
 
@@ -926,9 +959,9 @@
  * Active Object.
  */
 	{
-	LOGTEXT4(_L8(">>CCdcAcmClass::SendSerialState aRing=%d, "
-		"aDsr=%d, aDcd=%d"), 
-			aRing, aDsr, aDcd);
+	OstTraceFunctionEntry0( CCDCACMCLASS_SENDSERIALSTATE_ENTRY );
+	OstTraceExt3( TRACE_NORMAL, CCDCACMCLASS_SENDSERIALSTATE, 
+			"CCdcAcmClass::SendSerialState;aRing=%d;aDsr=%d;aDcd=%d", (TInt)aRing, (TInt)aDsr, (TInt)aDcd );
 
 	// stub non-supported flags
 	TBool overrun = EFalse;
@@ -952,7 +985,8 @@
 		aDsr,
 		aDcd);
 
-	LOGTEXT2(_L8("<<CCdcAcmClass::SendSerialState ret=%d"), ret);
+	OstTrace1( TRACE_NORMAL, CCDCACMCLASS_SENDSERIALSTATE_DUP1, "CCdcAcmClass::SendSerialState;ret=%d", ret );
+	OstTraceFunctionExit0( CCDCACMCLASS_SENDSERIALSTATE_EXIT );
 	return ret;
 	}
 
@@ -963,6 +997,8 @@
  * @return Break flag.
  */
 	{
+	OstTraceFunctionEntry0( CCDCACMCLASS_BREAKACTIVE_ENTRY );
+	OstTraceFunctionExit0( CCDCACMCLASS_BREAKACTIVE_EXIT );
 	return iBreakActive;
 	}
 
@@ -973,6 +1009,8 @@
  * @return Whether RNG is set or not.
  */
 	{
+	OstTraceFunctionEntry0( CCDCACMCLASS_RINGSTATE_ENTRY );
+	OstTraceFunctionExit0( CCDCACMCLASS_RINGSTATE_EXIT );
 	return iRingState;
 	}
 
@@ -983,6 +1021,8 @@
  * @return Whether DSR is set or not.
  */
 	{
+	OstTraceFunctionEntry0( CCDCACMCLASS_DSRSTATE_ENTRY );
+	OstTraceFunctionExit0( CCDCACMCLASS_DSRSTATE_EXIT );
 	return iDsrState;
 	}
 
@@ -993,6 +1033,8 @@
  * @return Whether DCD is set or not.
  */
 	{
+	OstTraceFunctionEntry0( CCDCACMCLASS_DCDSTATE_ENTRY );
+	OstTraceFunctionExit0( CCDCACMCLASS_DCDSTATE_EXIT );
 	return iDcdState;
 	}
 
@@ -1003,7 +1045,9 @@
  * @param aBreakActive The break flag is set to this value.
  */
 	{
+	OstTraceFunctionEntry0( CCDCACMCLASS_SETBREAKACTIVE_ENTRY );
 	iBreakActive = aBreakActive;
+	OstTraceFunctionExit0( CCDCACMCLASS_SETBREAKACTIVE_EXIT );
 	}
 
 MHostPushedChangeObserver* CCdcAcmClass::Callback()
@@ -1013,6 +1057,8 @@
  * @return The observer of host-pushed changes.
  */
 	{
+	OstTraceFunctionEntry0( CCDCACMCLASS_CALLBACK_ENTRY );
+	OstTraceFunctionExit0( CCDCACMCLASS_CALLBACK_EXIT );
 	return iCallback;
 	}
 
@@ -1023,6 +1069,8 @@
  * @return The observer of break changes.
  */
 	{
+	OstTraceFunctionEntry0( CCDCACMCLASS_BREAKCALLBACK_ENTRY );
+	OstTraceFunctionExit0( CCDCACMCLASS_BREAKCALLBACK_EXIT );
 	return iBreakCallback;
 	}
 
@@ -1039,13 +1087,17 @@
  * @return Error, for instance if a different entity already owns the break.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CCDCACMCLASS_BREAKREQUEST_ENTRY );
 
-	__ASSERT_DEBUG(iBreakController, 
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (!iBreakController)
+		{
+		OstTraceExt1( TRACE_FATAL, CCDCACMCLASS_BREAKREQUEST, "CCdcAcmClass::BreakRequest;iBreakController=%p", iBreakController );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 
 	TInt err = iBreakController->BreakRequest(aRequester, aState, aDelay);
-	LOGTEXT2(_L8("\tBreakRequest = %d"), err);
+	OstTrace1( TRACE_NORMAL, CCDCACMCLASS_BREAKREQUEST_DUP1, "CCdcAcmClass::BreakRequest;err=%d", err );
+	OstTraceFunctionExit0( CCDCACMCLASS_BREAKREQUEST_EXIT );
 	return err;
 	}
 
@@ -1056,12 +1108,16 @@
  * @param aObserver The observer to notify completion to.
  */
 	{
-	LOGTEXT2(_L8(">>CCdcAcmClass::NotifyDataAvailable aObserver=0x%08x"), &aObserver);
+	OstTraceFunctionEntry0( CCDCACMCLASS_NOTIFYDATAAVAILABLE_ENTRY );
+	OstTraceExt1( TRACE_NORMAL, CCDCACMCLASS_NOTIFYDATAAVAILABLE, "CCdcAcmClass::NotifyDataAvailable;aObserver=%p", &aObserver );
 
-	__ASSERT_DEBUG(iData, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (!iData)
+		{
+		OstTraceExt1( TRACE_FATAL, CCDCACMCLASS_NOTIFYDATAAVAILABLE_DUP1, "CCdcAcmClass::NotifyDataAvailable;iData=%p", iData );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	iData->NotifyDataAvailable(aObserver);
-
-	LOGTEXT(_L8("<<CCdcAcmClass::NotifyDataAvailable"));
+	OstTraceFunctionExit0( CCDCACMCLASS_NOTIFYDATAAVAILABLE_EXIT );
 	}
 
 void CCdcAcmClass::NotifyDataAvailableCancel()
@@ -1069,10 +1125,14 @@
  * Cancel the request to be notified (when data is available to be read from the LDD).
  */
 	{
-	LOG_FUNC
-
-	__ASSERT_DEBUG(iData, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	OstTraceFunctionEntry0( CCDCACMCLASS_NOTIFYDATAAVAILABLECANCEL_ENTRY );
+	if (!iData)
+		{
+		OstTraceExt1( TRACE_FATAL, CCDCACMCLASS_NOTIFYDATAAVAILABLECANCEL, "CCdcAcmClass::NotifyDataAvailableCancel;iData=%p", iData );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	iData->CancelNotifyDataAvailable();
+	OstTraceFunctionExit0( CCDCACMCLASS_NOTIFYDATAAVAILABLECANCEL_EXIT );
 	}
 
 //
--- a/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/CdcControlInterface.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/CdcControlInterface.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -25,11 +25,11 @@
 #include "CdcAcmClass.h"
 #include "AcmPanic.h"
 #include "AcmUtils.h"
-#include <usb/usblogger.h>
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "CdcControlInterfaceTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "ECACM");
-#endif
 
 CCdcControlInterface::CCdcControlInterface(const TUint8 aProtocolNum, const TDesC16& aIfcName)
 /**
@@ -41,6 +41,8 @@
 	iSerialState(0xFFFF),
 	iProtocolNum(aProtocolNum)
 	{
+	OstTraceFunctionEntry0( CCDCCONTROLINTERFACE_CCDCCONTROLINTERFACE_CONS_ENTRY );
+	OstTraceFunctionExit0( CCDCCONTROLINTERFACE_CCDCCONTROLINTERFACE_CONS_EXIT );
 	}
 
 CCdcControlInterface* CCdcControlInterface::NewL(CCdcAcmClass& aParent, const TUint8 aProtocolNum, const TDesC16& aIfcName)
@@ -54,14 +56,14 @@
  * @return A pointer to the new object
  */
 	{
-	LOG_STATIC_FUNC_ENTRY
-
-	LOGTEXT2(_L("\tControl Ifc Name = %S"), &aIfcName);
+	OstTraceFunctionEntry0( CCDCCONTROLINTERFACE_NEWL_ENTRY );
+	OstTraceExt1( TRACE_NORMAL, CCDCCONTROLINTERFACE_NEWL, "CCdcControlInterface::NewL;\tControl Ifc Name = %S", aIfcName );
 
 	CCdcControlInterface* self = new(ELeave) CCdcControlInterface(aProtocolNum, aIfcName);
 	CleanupStack::PushL(self);
 	self->ConstructL(aParent);
 	CLEANUPSTACK_POP(self);
+	OstTraceFunctionExit0( CCDCCONTROLINTERFACE_NEWL_EXIT );
 	return self;
 	}
 
@@ -73,11 +75,13 @@
  * @param aParent The ACM class.
  */
 	{
+	OstTraceFunctionEntry0( CCDCCONTROLINTERFACE_CONSTRUCTL_ENTRY );
+	
 	BaseConstructL();
 
 	iReader  = CCdcControlInterfaceReader::NewL(aParent, iLdd);
-
-	LOGTEXT2(_L8("\tcreated CdcControlInterface iProtocolNum = %d"), iProtocolNum);
+	OstTrace1( TRACE_NORMAL, CCDCCONTROLINTERFACE_CONSTRUCTL, "CCdcControlInterface::ConstructL;iProtocolNum=%d", (TInt)iProtocolNum );
+	OstTraceFunctionExit0( CCDCCONTROLINTERFACE_CONSTRUCTL_EXIT );
 	}
 
 TInt CCdcControlInterface::SetUpInterface()
@@ -86,25 +90,29 @@
  * endpoint and, if found, configuring the interface.
  */
 	{
-	LOGTEXT(_L8(">>CCdcControlInterface::SetUpInterface"));
+	OstTraceFunctionEntry0( CCDCCONTROLINTERFACE_SETUPINTERFACE_ENTRY );
 
 	TUsbDeviceCaps dCaps;
 	TInt ret = iLdd.DeviceCaps(dCaps);
-	LOGTEXT(_L8("\tchecking result of DeviceCaps"));
+	OstTrace0( TRACE_NORMAL, CCDCCONTROLINTERFACE_SETUPINTERFACE, "CCdcControlInterface::SetUpInterface;\tchecking result of DeviceCaps" );
 	if ( ret )
 		{
-		LOGTEXT2(_L8("<<CCdcControlInterface::SetUpInterface ret=%d"), ret);
+		OstTrace1( TRACE_NORMAL, CCDCCONTROLINTERFACE_SETUPINTERFACE_DUP1, "CCdcControlInterface::SetUpInterface;ret=%d", ret );
+		OstTraceFunctionExit0( CCDCCONTROLINTERFACE_SETUPINTERFACE_EXIT );
 		return ret;
 		}
 
 	const TUint KRequiredNumberOfEndpoints = 1; // in addition to endpoint 0.
 
 	const TUint totalEndpoints = static_cast<TUint>(dCaps().iTotalEndpoints);
-	LOGTEXT2(_L8("\tiTotalEndpoints = %d"), totalEndpoints);
+	OstTrace1( TRACE_NORMAL, CCDCCONTROLINTERFACE_SETUPINTERFACE_DUP2, 
+			"CCdcControlInterface::SetUpInterface;totalEndpoints=%d", (TInt)totalEndpoints );
+
 	if ( totalEndpoints < KRequiredNumberOfEndpoints )
 		{
-		LOGTEXT2(_L8("<<CCdcControlInterface::SetUpInterface ret=%d"), 
-			KErrGeneral);
+		OstTrace1( TRACE_NORMAL, CCDCCONTROLINTERFACE_SETUPINTERFACE_DUP3, 
+				"CCdcControlInterface::SetUpInterface;ret=%d", KErrGeneral );
+		OstTraceFunctionExit0( CCDCCONTROLINTERFACE_SETUPINTERFACE_EXIT_DUP1 );
 		return KErrGeneral;
 		}
 	
@@ -112,10 +120,13 @@
 	TUsbcEndpointData data[KUsbcMaxEndpoints];
 	TPtr8 dataptr(reinterpret_cast<TUint8*>(data), sizeof(data), sizeof(data));
 	ret = iLdd.EndpointCaps(dataptr);
-	LOGTEXT(_L8("\tchecking result of EndpointCaps"));
+	OstTrace0( TRACE_NORMAL, CCDCCONTROLINTERFACE_SETUPINTERFACE_DUP4, 
+			"CCdcControlInterface::SetUpInterface;\tchecking result of EndpointCaps" );
+
 	if ( ret )
 		{
-		LOGTEXT2(_L8("<<CCdcControlInterface::SetUpInterface ret=%d"), ret);
+		OstTrace1( TRACE_NORMAL, CCDCCONTROLINTERFACE_SETUPINTERFACE_DUP5, "CCdcControlInterface::SetUpInterface;ret=%d", ret );
+		OstTraceFunctionExit0( CCDCCONTROLINTERFACE_SETUPINTERFACE_EXIT_DUP2 );
 		return ret;
 		}
 
@@ -125,8 +136,11 @@
 	for ( TUint i = 0 ; i < totalEndpoints ; i++ )
 		{
 		const TUsbcEndpointCaps* caps = &data[i].iCaps;
-		__ASSERT_DEBUG(caps, 
-			_USB_PANIC(KAcmPanicCat, EPanicInternalError));
+		if (!caps)
+			{
+			OstTraceExt1( TRACE_FATAL, CCDCCONTROLINTERFACE_SETUPINTERFACE_DUP6, "CCdcControlInterface::SetUpInterface;caps=%p", caps );
+			__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+			}
 
 		if (data[i].iInUse)
 			{
@@ -152,11 +166,13 @@
 			break;
 			}
 		}
-	LOGTEXT(_L8("\tchecking epFound"));
+	
+	
+	OstTrace0( TRACE_NORMAL, CCDCCONTROLINTERFACE_SETUPINTERFACE_DUP8, "CCdcControlInterface::SetUpInterface;\tchecking epFound" );
 	if ( !epFound )
 		{
-		LOGTEXT2(_L8("<<CCdcControlInterface::SetUpInterface ret=%d"), 
-			KErrGeneral);
+		OstTrace1( TRACE_NORMAL, CCDCCONTROLINTERFACE_SETUPINTERFACE_DUP9, "CCdcControlInterface::SetUpInterface;ret=%d", KErrGeneral );
+		OstTraceFunctionExit0( CCDCCONTROLINTERFACE_SETUPINTERFACE_EXIT_DUP3 );
 		return KErrGeneral;
 		}
 
@@ -167,11 +183,12 @@
 	ifc().iClass.iSubClassNum = 0x02; // Table 16- Abstract Control Model
 	ifc().iClass.iProtocolNum = iProtocolNum; // Table 17
 
-	LOGTEXT(_L8("\tabout to call SetInterface"));
+	OstTrace0( TRACE_NORMAL, CCDCCONTROLINTERFACE_SETUPINTERFACE_DUP10, 
+			"CCdcControlInterface::SetUpInterface;\tabout to call SetInterface" );
 	// Zero effectively indicates that alternate interfaces are not used.
 	ret = iLdd.SetInterface(0, ifc);
-
-	LOGTEXT2(_L8("<<CCdcControlInterface::SetUpInterface ret=%d"), ret);
+	OstTrace1( TRACE_NORMAL, CCDCCONTROLINTERFACE_SETUPINTERFACE_DUP11, "CCdcControlInterface::SetUpInterface;ret=%d", ret );
+	OstTraceFunctionExit0( CCDCCONTROLINTERFACE_SETUPINTERFACE_EXIT_DUP4 );
 	return ret;
 	}
 
@@ -184,8 +201,9 @@
  * @return Error.
  */
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8("\taDataInterfaceNumber = %d"), aDataInterfaceNumber);
+	OstTraceFunctionEntry0( CCDCCONTROLINTERFACE_SETUPCLASSSPECIFICDESCRIPTOR_ENTRY );
+	OstTrace1( TRACE_NORMAL, CCDCCONTROLINTERFACE_SETUPCLASSSPECIFICDESCRIPTOR, 
+			"CCdcControlInterface::SetupClassSpecificDescriptor;aDataInterfaceNumber=%d", (TInt)aDataInterfaceNumber );
 
 	TInt res;
 
@@ -229,18 +247,26 @@
 
 	if ( res )
 		{
-		LOGTEXT2(_L8("\t***GetInterfaceNumber=%d"), res);
+		OstTrace1( TRACE_NORMAL, CCDCCONTROLINTERFACE_SETUPCLASSSPECIFICDESCRIPTOR_DUP1, 
+				"CCdcControlInterface::SetupClassSpecificDescriptor;\t***GetInterfaceNumber=%d", res );
+		OstTraceFunctionExit0( CCDCCONTROLINTERFACE_SETUPCLASSSPECIFICDESCRIPTOR_EXIT );
 		return res;
 		}
 
-	LOGTEXT(_L8("\tabout to call SetCSInterfaceDescriptorBlock"));
+	OstTrace0( TRACE_NORMAL, CCDCCONTROLINTERFACE_SETUPCLASSSPECIFICDESCRIPTOR_DUP2, 
+			"CCdcControlInterface::SetupClassSpecificDescriptor;\tabout to call SetCSInterfaceDescriptorBlock" );
+	
 	res = iLdd.SetCSInterfaceDescriptorBlock(0, descriptor.Des());
 	if ( res )
 		{
-		LOGTEXT2(_L8("\t***SetCSInterfaceDescriptorBlock=%d"), res);
+		OstTrace1( TRACE_NORMAL, CCDCCONTROLINTERFACE_SETUPCLASSSPECIFICDESCRIPTOR_DUP3, 
+				"CCdcControlInterface::SetupClassSpecificDescriptor;\t***SetCSInterfaceDescriptorBlock=%d", res );
+		
+		OstTraceFunctionExit0( CCDCCONTROLINTERFACE_SETUPCLASSSPECIFICDESCRIPTOR_EXIT_DUP1 );
 		return res;
 		}
 
+	OstTraceFunctionExit0( CCDCCONTROLINTERFACE_SETUPCLASSSPECIFICDESCRIPTOR_EXIT_DUP2 );
 	return KErrNone;
 	}
 
@@ -249,9 +275,9 @@
  * Destructor
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( DUP1_CCDCCONTROLINTERFACE_CCDCCONTROLINTERFACE_ENTRY );
 	delete iReader;
+	OstTraceFunctionExit0( DUP1_CCDCCONTROLINTERFACE_CCDCCONTROLINTERFACE_EXIT );
 	}
 
 /**
@@ -283,6 +309,8 @@
  * the little-endian USB bus.
  */
 	{
+	OstTraceFunctionEntry0( TUSBNOTIFICATIONNETWORKCONNECTION_PACKBUFFER_ENTRY );
+	
 	iBuffer.SetLength(KUSBNotificationNetworkConnectionSize);
 
 	iBuffer[0] = bmRequestType;
@@ -294,6 +322,7 @@
 	iBuffer[6] = static_cast<TUint8>( wLength & 0x00ff);
 	iBuffer[7] = static_cast<TUint8>((wLength & 0xff00) >> 8);
 
+	OstTraceFunctionExit0( TUSBNOTIFICATIONNETWORKCONNECTION_PACKBUFFER_EXIT );
 	return iBuffer;
 	}
 
@@ -309,8 +338,9 @@
  * @return Error.
  */
 	{
-	LOGTEXT2(_L8(">>CCdcControlInterface::SendNetworkConnection aValue=%d"), 
-		aValue);
+	OstTraceFunctionEntry0( CCDCCONTROLINTERFACE_SENDNETWORKCONNECTION_ENTRY );
+	OstTrace1( TRACE_NORMAL, CCDCCONTROLINTERFACE_SENDNETWORKCONNECTION, 
+			"CCdcControlInterface::SendNetworkConnection;aValue=%d", (TInt)aValue );
 
 	// form the message and prime it down to the interrupt handler
 	// (that is 'interrupt' in the USB sense)
@@ -329,7 +359,9 @@
 		notification.PackBuffer(), 
 		notification.PackBuffer().Length());
 
-	LOGTEXT2(_L8("<<CCdcControlInterface::SendNetworkConnection ret=%d"), ret);
+	OstTrace1( TRACE_NORMAL, CCDCCONTROLINTERFACE_SENDNETWORKCONNECTION_DUP1, 
+			"CCdcControlInterface::SendNetworkConnection;ret=%d", ret );
+	OstTraceFunctionExit0( CCDCCONTROLINTERFACE_SENDNETWORKCONNECTION_EXIT );
 	return ret;
 	}
 
@@ -363,6 +395,8 @@
  * the little-endian USB bus.
  */
 	{
+	OstTraceFunctionEntry0( TUSBNOTIFICATIONSERIALSTATE_PACKBUFFER_ENTRY );
+	
 	iBuffer.SetLength(KUSBNotificationSerialStateSize);
 
 	iBuffer[0] = bmRequestType;
@@ -376,6 +410,7 @@
 	iBuffer[8] = static_cast<TUint8>( wData & 0x00ff);
 	iBuffer[9] = static_cast<TUint8>((wData & 0xff00) >> 8);
 
+	OstTraceFunctionExit0( TUSBNOTIFICATIONSERIALSTATE_PACKBUFFER_EXIT );
 	return iBuffer;
 	}
 
@@ -399,14 +434,22 @@
  * @return Error.
  */
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8("\taOverRun=%d"), aOverRun);
-	LOGTEXT2(_L8("\taParity=%d"), aParity);
-	LOGTEXT2(_L8("\taFraming=%d"), aFraming);
-	LOGTEXT2(_L8("\taRing=%d"), aRing);
-	LOGTEXT2(_L8("\taBreak=%d"), aBreak);
-	LOGTEXT2(_L8("\taTxCarrier=%d"), aTxCarrier);
-	LOGTEXT2(_L8("\taRxCarrier=%d"), aRxCarrier);
+	OstTraceFunctionEntry0( CCDCCONTROLINTERFACE_SENDSERIALSTATE_ENTRY );
+	
+	OstTrace1( TRACE_DUMP, CCDCCONTROLINTERFACE_SENDSERIALSTATE, 
+			"CCdcControlInterface::SendSerialState;aOverRun=%d", (TInt)aOverRun );
+	OstTrace1( TRACE_DUMP, CCDCCONTROLINTERFACE_SENDSERIALSTATE_DUP1, 
+			"CCdcControlInterface::SendSerialState;aParity=%d", (TInt)aParity );
+	OstTrace1( TRACE_DUMP, CCDCCONTROLINTERFACE_SENDSERIALSTATE_DUP2, 
+			"CCdcControlInterface::SendSerialState;aFraming=%d", (TInt)aFraming );
+	OstTrace1( TRACE_DUMP, CCDCCONTROLINTERFACE_SENDSERIALSTATE_DUP3, 
+			"CCdcControlInterface::SendSerialState;aRing=%d", (TInt)aRing );
+	OstTrace1( TRACE_DUMP, CCDCCONTROLINTERFACE_SENDSERIALSTATE_DUP4, 
+			"CCdcControlInterface::SendSerialState;aBreak=%d", (TInt)aBreak );
+	OstTrace1( TRACE_DUMP, CCDCCONTROLINTERFACE_SENDSERIALSTATE_DUP5, 
+			"CCdcControlInterface::SendSerialState;aTxCarrier=%d", (TInt)aTxCarrier );
+	OstTrace1( TRACE_DUMP, CCDCCONTROLINTERFACE_SENDSERIALSTATE_DUP6, 
+			"CCdcControlInterface::SendSerialState;aRxCarrier=%d", (TInt)aRxCarrier );
 
 	// First work out what might need to be sent by assembling the bits into 
 	// the correct places. See CDC spec table 69 (UART state bitmap values).
@@ -426,7 +469,9 @@
 	// send it off.
 	if ( data == iSerialState )
 		{
-		LOGTEXT(_L8("\tdata == iSerialState"));
+		OstTrace0( TRACE_NORMAL, CCDCCONTROLINTERFACE_SENDSERIALSTATE_DUP7, 
+				"CCdcControlInterface::SendSerialState;\tdata == iSerialState" );
+		OstTraceFunctionExit0( CCDCCONTROLINTERFACE_SENDSERIALSTATE_EXIT );
 		return KErrNone;
 		}
 
@@ -451,8 +496,8 @@
 	TInt ret = WriteData(	EEndpoint1, 
 							notification.PackBuffer(), 
 							notification.PackBuffer().Length());
-	LOGTEXT2(_L8("\tWriteData = %d"), ret);
-
+	OstTrace1( TRACE_NORMAL, CCDCCONTROLINTERFACE_SENDSERIALSTATE_DUP8, "CCdcControlInterface::SendSerialState;ret=%d", ret );
+	OstTraceFunctionExit0( DUP1_CCDCCONTROLINTERFACE_SENDSERIALSTATE_EXIT );
 	return ret;
 	}
 
@@ -467,20 +512,25 @@
  * @param aLength
  */
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8("\taEndpoint=%d"), aEndPoint);
+	OstTraceFunctionEntry0( CCDCCONTROLINTERFACE_WRITEDATA_ENTRY );
+	OstTrace1( TRACE_NORMAL, CCDCCONTROLINTERFACE_WRITEDATA, "CCdcControlInterface::WriteData;aEndPoint=%d", (TInt)aEndPoint );
 
 	TInt ret;
 	RTimer timer;
 	ret = timer.CreateLocal();
 	if ( ret )
 		{
-		LOGTEXT2(_L8("\ttimer.CreateLocal = %d- returning"), ret);
+		OstTrace1( TRACE_NORMAL, CCDCCONTROLINTERFACE_WRITEDATA_DUP1, 
+				"CCdcControlInterface::WriteData;\ttimer.CreateLocal = %d- returning", ret );
+		
+		OstTraceFunctionExit0( CCDCCONTROLINTERFACE_WRITEDATA_EXIT );
 		return ret;
 		}
 	TRequestStatus status;
 	TRequestStatus timerStatus;
-	LOGTEXT(_L8("\tAttempting to write data to control interface"));
+	OstTrace0( TRACE_NORMAL, CCDCCONTROLINTERFACE_WRITEDATA_DUP2, 
+			"CCdcControlInterface::WriteData;\tAttempting to write data to control interface" );
+
 	iLdd.Write(status, aEndPoint, aDes, aLength);
 	timer.After(timerStatus, KWriteDataTimeout);
 	User::WaitForRequest(status, timerStatus);
@@ -488,20 +538,25 @@
 		{
 		// Timeout occurred, silently ignore error condition.
 		// Assuming that the line has been disconnected
-		LOGTEXT(_L8("CCdcControlInterface::WriteData() - Timeout occurred"));
+		OstTrace0( TRACE_NORMAL, CCDCCONTROLINTERFACE_WRITEDATA_DUP3, 
+				"CCdcControlInterface::WriteData;CCdcControlInterface::WriteData() - Timeout occurred" );
+		
 		iLdd.WriteCancel(aEndPoint);
 		User::WaitForRequest(status);
 		ret = timerStatus.Int();
 		}
 	else
 		{
-		LOGTEXT(_L8("CCdcControlInterface::WriteData() - Write completed"));
+		OstTrace0( TRACE_NORMAL, CCDCCONTROLINTERFACE_WRITEDATA_DUP4, 
+				"CCdcControlInterface::WriteData;CCdcControlInterface::WriteData() - Write completed" );
+		
 		timer.Cancel();
 		User::WaitForRequest(timerStatus);
 		ret = status.Int();
 		}
 
-	LOGTEXT2(_L8("\treturning %d"), ret);
+	OstTrace1( TRACE_NORMAL, CCDCCONTROLINTERFACE_WRITEDATA_DUP5, "CCdcControlInterface::WriteData;ret=%d", ret );
+	OstTraceFunctionExit0( CCDCCONTROLINTERFACE_WRITEDATA_EXIT_DUP1 );
 	return ret;
 	}
 
--- a/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/CdcControlInterfaceReader.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/CdcControlInterfaceReader.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -22,11 +22,11 @@
 #include "AcmUtils.h"
 #include "CdcControlInterfaceRequestHandler.h"
 #include "AcmConstants.h"
-#include <usb/usblogger.h>
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "CdcControlInterfaceReaderTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "ECACM");
-#endif
 
 CCdcControlInterfaceReader::CCdcControlInterfaceReader(
 				MCdcCommsClassRequestHandler& aParent, 
@@ -41,8 +41,10 @@
  * @param aLdd		The USB LDD handle to be used.
  */
 	{
+	OstTraceFunctionEntry0( CCDCCONTROLINTERFACEREADER_CCDCCONTROLINTERFACEREADER_CONS_ENTRY );
 	CActiveScheduler::Add(this);
 	ReadMessageHeader();
+	OstTraceFunctionExit0( CCDCCONTROLINTERFACEREADER_CCDCCONTROLINTERFACEREADER_CONS_EXIT );
 	}
 
 CCdcControlInterfaceReader::~CCdcControlInterfaceReader()
@@ -50,9 +52,9 @@
  * Destructor
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CCDCCONTROLINTERFACEREADER_CCDCCONTROLINTERFACEREADER_DES_ENTRY );
 	Cancel(); //Call CActive::Cancel()	 
+	OstTraceFunctionExit0( CCDCCONTROLINTERFACEREADER_CCDCCONTROLINTERFACEREADER_DES_EXIT );
 	}
 
 CCdcControlInterfaceReader* CCdcControlInterfaceReader::NewL(
@@ -65,11 +67,11 @@
  * @param aLdd		The USB LDD handle to be used.
  */
 	{
-	LOG_STATIC_FUNC_ENTRY
-
+	OstTraceFunctionEntry0( CCDCCONTROLINTERFACEREADER_NEWL_ENTRY );
 	CCdcControlInterfaceReader* self = new(ELeave) CCdcControlInterfaceReader(
 		aParent, 
 		aLdd);
+	OstTraceFunctionExit0( CCDCCONTROLINTERFACEREADER_NEWL_EXIT );
 	return self;
 	}
 
@@ -78,9 +80,10 @@
  * This function will be called when a read completes.
  */
 	{
-	LOGTEXT2(_L8(">>CCdcControlInterfaceReader::RunL iStatus=%d"), iStatus.Int());
+	OstTraceFunctionEntry0( CCDCCONTROLINTERFACEREADER_RUNL_ENTRY );
+	OstTrace1( TRACE_NORMAL, CCDCCONTROLINTERFACEREADER_RUNL, "CCdcControlInterfaceReader::RunL;iStatus=%d", iStatus.Int() );
 	HandleReadCompletion(iStatus.Int());
-	LOGTEXT(_L8("<<CCdcControlInterfaceReader::RunL"));
+	OstTraceFunctionExit0( CCDCCONTROLINTERFACEREADER_RUNL_EXIT );
 	}
 
 void CCdcControlInterfaceReader::DoCancel()
@@ -88,8 +91,9 @@
  * Cancel an outstanding read.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CCDCCONTROLINTERFACEREADER_DOCANCEL_ENTRY );
 	iLdd.ReadCancel(EEndpoint0);
+	OstTraceFunctionExit0( CCDCCONTROLINTERFACEREADER_DOCANCEL_EXIT );
 	}
 
 void CCdcControlInterfaceReader::HandleReadCompletion(TInt aError)
@@ -103,17 +107,22 @@
  * @param aError Error
  */
 	{
-	LOGTEXT2(_L8(">>CCdcControlInterfaceReader::HandleReadCompletion "
-		"aError=%d"), aError);
+	OstTraceFunctionEntry0( CCDCCONTROLINTERFACEREADER_HANDLEREADCOMPLETION_ENTRY );
+	OstTrace1( TRACE_NORMAL, CCDCCONTROLINTERFACEREADER_HANDLEREADCOMPLETION, 
+			"CCdcControlInterfaceReader::HandleReadCompletion;aError=%d", aError );
 
 	if ( aError )
 		{
-		ReadMessageHeader();			  
-		LOGTEXT(_L8("<<CCdcControlInterfaceReader::HandleReadCompletion"));
+		ReadMessageHeader();		
+		OstTrace0( TRACE_NORMAL, CCDCCONTROLINTERFACEREADER_HANDLEREADCOMPLETION_DUP1, 
+				"CCdcControlInterfaceReader::HandleReadCompletion" );
+		OstTraceFunctionExit0( CCDCCONTROLINTERFACEREADER_HANDLEREADCOMPLETION_EXIT );
 		return;
 		}
 
-	LOGTEXT2(_L8("\tcompleted with iState=%d"),iState);
+	OstTrace1( TRACE_NORMAL, CCDCCONTROLINTERFACEREADER_HANDLEREADCOMPLETION_DUP2, 
+			"CCdcControlInterfaceReader::HandleReadCompletion;iState=%d", (TInt)iState );
+
 	switch ( iState)
 		{
 	case EWaitingForHeader:
@@ -130,12 +139,14 @@
 
 	default:
 		{
-		_USB_PANIC(KAcmPanicCat, EPanicIllegalState);
+		OstTrace1( TRACE_FATAL, CCDCCONTROLINTERFACEREADER_HANDLEREADCOMPLETION_DUP3, 
+					"CCdcControlInterfaceReader::HandleReadCompletion;iState=%d", (TInt)iState );
+		User::Panic(KAcmPanicCat, EPanicIllegalState);
 		}
 		break;
 		}
 
-	LOGTEXT(_L8("<<CCdcControlInterfaceReader::HandleReadCompletion"));
+	OstTraceFunctionExit0( CCDCCONTROLINTERFACEREADER_HANDLEREADCOMPLETION_EXIT_DUP1 );
 	}
 
 void CCdcControlInterfaceReader::DecodeMessageHeader()
@@ -144,20 +155,23 @@
  * requires some data in response and dispatches the request appropriately.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CCDCCONTROLINTERFACEREADER_DECODEMESSAGEHEADER_ENTRY );
 	if ( TUsbRequestHdr::Decode(iMessageHeader, iRequestHeader) != KErrNone )
 		{
-		LOGTEXT(_L8("\t- Unable to decode request header!"));
+		OstTrace0( TRACE_NORMAL, CCDCCONTROLINTERFACEREADER_DECODEMESSAGEHEADER, 
+				"CCdcControlInterfaceReader::DecodeMessageHeader;\t- Unable to decode request header!" );
+		
 		// Stall bus- unknown message. If this fails, there's nothing we can 
 		// do.
 		static_cast<void>(iLdd.EndpointZeroRequestError()); 
 		ReadMessageHeader();
+		OstTraceFunctionExit0( CCDCCONTROLINTERFACEREADER_DECODEMESSAGEHEADER_EXIT );
 		return;
 		}
 
-	LOGTEXT2(_L8("\t- New read! Request 0x%x"), iRequestHeader.iRequest);
-
+	OstTrace1( TRACE_NORMAL, CCDCCONTROLINTERFACEREADER_DECODEMESSAGEHEADER_DUP1, 
+			"CCdcControlInterfaceReader::DecodeMessageHeader;\t- New read! Request %d", (TInt)iRequestHeader.iRequest );
+	
 	if ( iRequestHeader.IsDataResponseRequired() )
 		{
 		DecodeMessageDataWithResponseRequired();
@@ -171,6 +185,7 @@
 		{
 		ReadMessageData(iRequestHeader.iLength);
 		}
+	OstTraceFunctionExit0( DUP1_CCDCCONTROLINTERFACEREADER_DECODEMESSAGEHEADER_EXIT );
 	}
 
 void CCdcControlInterfaceReader::DecodeMessageDataWithResponseRequired()
@@ -178,11 +193,11 @@
  * Decode a message which requires data to be sent to the host in response.
  */
 	{
-	LOG_FUNC
-
-	LOGTEXT2(_L8("\t- New read! Request 0x%x"), iRequestHeader.iRequest);
+	OstTraceFunctionEntry0( CCDCCONTROLINTERFACEREADER_DECODEMESSAGEDATAWITHRESPONSEREQUIRED_ENTRY );
+	OstTraceExt1( TRACE_NORMAL, CCDCCONTROLINTERFACEREADER_DECODEMESSAGEDATAWITHRESPONSEREQUIRED, 
+			"CCdcControlInterfaceReader::DecodeMessageDataWithResponseRequired;\t- New read! Request=%hhx", iRequestHeader.iRequest );
+	
 	TBuf8<KAcmControlReadBufferLength> returnBuffer;
-
 	switch ( iRequestHeader.iRequest )
 		{
 	case KGetEncapsulated:
@@ -248,8 +263,10 @@
 
 	default:
 		{
-		LOGTEXT2(_L8("\t- request number not recognised (%d)"),
-			iRequestHeader.iRequest);
+		OstTrace1( TRACE_NORMAL, CCDCCONTROLINTERFACEREADER_DECODEMESSAGEDATAWITHRESPONSEREQUIRED_DUP1, 
+				"CCdcControlInterfaceReader::DecodeMessageDataWithResponseRequired;\t- request number not recognised (%d)", 
+				(TInt)(iRequestHeader.iRequest) );
+		
 		// Stall bus- unknown message. If this fails, there's nothing we can 
 		// do.
 		static_cast<void>(iLdd.EndpointZeroRequestError()); 
@@ -258,6 +275,7 @@
 		}
 
 	ReadMessageHeader();
+	OstTraceFunctionExit0( CCDCCONTROLINTERFACEREADER_DECODEMESSAGEDATAWITHRESPONSEREQUIRED_EXIT );
 	}
 
 void CCdcControlInterfaceReader::DecodeMessageData()
@@ -268,17 +286,20 @@
  * can be nack'ed by signalling an endpoint zero request error.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CCDCCONTROLINTERFACEREADER_DECODEMESSAGEDATA_ENTRY );
 	if ( iMessageData.Length() != iRequestHeader.iLength )
 		{
-		LOGTEXT(_L8("\t- Data length is incorrect"));
+		OstTrace0( TRACE_NORMAL, CCDCCONTROLINTERFACEREADER_DECODEMESSAGEDATA, 
+				"CCdcControlInterfaceReader::DecodeMessageData;\t- Data length is incorrect" );
+		
 		ReadMessageHeader();
+		OstTraceFunctionExit0( CCDCCONTROLINTERFACEREADER_DECODEMESSAGEDATA_EXIT );
 		return;
 		}
 
-	LOGTEXT2(_L8("\tNew read! Request %d"), iRequestHeader.iRequest);
-
+	OstTrace1( TRACE_NORMAL, CCDCCONTROLINTERFACEREADER_DECODEMESSAGEDATA_DUP1, 
+			"CCdcControlInterfaceReader::DecodeMessageData;\tNew read! Request %d", (TInt)(iRequestHeader.iRequest) );
+	
 	switch ( iRequestHeader.iRequest )
 		{
 	case KSendEncapsulated:
@@ -366,8 +387,9 @@
 			}
 		break;
 	default:
-		LOGTEXT2(_L8("\t***request number not recognised (%d)"),
-			iRequestHeader.iRequest);
+		OstTrace1( TRACE_NORMAL, CCDCCONTROLINTERFACEREADER_DECODEMESSAGEDATA_DUP2, 
+				"CCdcControlInterfaceReader::DecodeMessageData;\t***request number not recognised (%d)", (TInt)(iRequestHeader.iRequest) );
+		
 		// Stall bus- unknown message. If this fails, there's nothing we can 
 		// do.
 		static_cast<void>(iLdd.EndpointZeroRequestError()); 
@@ -375,6 +397,7 @@
 		}
 
 	ReadMessageHeader();
+	OstTraceFunctionExit0( CCDCCONTROLINTERFACEREADER_DECODEMESSAGEDATA_EXIT_DUP1 );
 	}
 
 void CCdcControlInterfaceReader::ReadMessageHeader()
@@ -383,12 +406,11 @@
  * message header.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CCDCCONTROLINTERFACEREADER_READMESSAGEHEADER_ENTRY );
 	iState = EWaitingForHeader;
-
 	iLdd.ReadPacket(iStatus, EEndpoint0, iMessageHeader, KUsbRequestHdrSize);
 	SetActive();
+	OstTraceFunctionExit0( CCDCCONTROLINTERFACEREADER_READMESSAGEHEADER_EXIT );
 	}
 
 void CCdcControlInterfaceReader::ReadMessageData(TUint aLength)
@@ -399,14 +421,14 @@
  * @param aLength Length of data to read.
  */
 	{
-	LOG_FUNC
-
-	LOGTEXT2(_L8("\tqueuing read, length = %d"),aLength);
+	OstTraceFunctionEntry0( CCDCCONTROLINTERFACEREADER_READMESSAGEDATA_ENTRY );
+	OstTrace1( TRACE_NORMAL, CCDCCONTROLINTERFACEREADER_READMESSAGEDATA, 
+			"CCdcControlInterfaceReader::ReadMessageData;\tqueuing read, length = %d", (TInt)aLength );
 
 	iState = EWaitingForData;
-
 	iLdd.Read(iStatus, EEndpoint0, iMessageData, static_cast<TInt>(aLength));
 	SetActive();
+	OstTraceFunctionExit0( CCDCCONTROLINTERFACEREADER_READMESSAGEDATA_EXIT );
 	}
 
 //
--- a/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/CdcDataInterface.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/CdcDataInterface.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -23,11 +23,11 @@
 #include "AcmUtils.h"
 #include "ActiveReadOneOrMoreReader.h"
 #include "ActiveDataAvailableNotifier.h"
-#include <usb/usblogger.h>
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "CdcDataInterfaceTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "ECACM");
-#endif
 
 #ifdef __HEADLESS_ACM_TEST_CODE__
 #pragma message ("Building headless ACM (performance test code for RDevUsbcClient)")
@@ -41,6 +41,8 @@
  :	CCdcInterfaceBase(aIfcName),
  	iPacketSize(KDefaultMaxPacketTypeBulk)
 	{
+	OstTraceFunctionEntry0( CCDCDATAINTERFACE_CCDCDATAINTERFACE_CONS_ENTRY );
+	OstTraceFunctionExit0( CCDCDATAINTERFACE_CCDCDATAINTERFACE_CONS_EXIT );
 	}
 
 CCdcDataInterface* CCdcDataInterface::NewL(const TDesC16& aIfcName)
@@ -53,14 +55,13 @@
  * @return A pointer to the new object
  */
 	{
-	LOG_STATIC_FUNC_ENTRY
-
-	LOGTEXT2(_L("\tData Ifc Name = %S"), &aIfcName);
-
+	OstTraceFunctionEntry0( CCDCDATAINTERFACE_NEWL_ENTRY );
+	OstTraceExt1( TRACE_NORMAL, CCDCDATAINTERFACE_NEWL, "CCdcDataInterface::NewL;\tData Ifc Name = %S", aIfcName );
 	CCdcDataInterface* self = new (ELeave) CCdcDataInterface(aIfcName);
 	CleanupStack::PushL(self);
 	self->ConstructL();
 	CLEANUPSTACK_POP(self);
+	OstTraceFunctionExit0( CCDCDATAINTERFACE_NEWL_EXIT );
 	return self;
 	}
 
@@ -72,8 +73,9 @@
  * @param aParent Observer.
  */
 	{
+	OstTraceFunctionEntry0( CCDCDATAINTERFACE_CONSTRUCTL_ENTRY );
+	
 	BaseConstructL();
-
 	iReadOneOrMoreReader  = CActiveReadOneOrMoreReader::NewL(*this, iLdd, EEndpoint2);
 	iReader = CActiveReader::NewL(*this, iLdd, EEndpoint2);
 	iDataAvailableNotifier = CActiveDataAvailableNotifier::NewL(*this, iLdd, EEndpoint2);
@@ -84,6 +86,7 @@
 
 	iHostCanHandleZLPs = (KUsbAcmHostCanHandleZLPs != 0);
 	
+	OstTraceFunctionExit0( CCDCDATAINTERFACE_CONSTRUCTL_EXIT );
 	}
 
 TInt CCdcDataInterface::SetUpInterface()
@@ -93,14 +96,15 @@
  * descriptor for the endpoints is registered with the LDD.
  */
 	{
-	LOGTEXT(_L8(">>CCdcDataInterface::SetUpInterface"));
+	OstTraceFunctionEntry0( CCDCDATAINTERFACE_SETUPINTERFACE_ENTRY );
 
 	TUsbDeviceCaps dCaps;
 	TInt ret = iLdd.DeviceCaps(dCaps);
-	LOGTEXT(_L8("\tchecking result of DeviceCaps"));
+	OstTrace0( TRACE_NORMAL, CCDCDATAINTERFACE_SETUPINTERFACE, "CCdcDataInterface::SetUpInterface;\tchecking result of DeviceCaps" );
 	if ( ret )
 		{
-		LOGTEXT2(_L8("<<CCdcDataInterface::SetUpInterface ret=%d"), ret);
+		OstTrace1( TRACE_NORMAL, CCDCDATAINTERFACE_SETUPINTERFACE_DUP1, "CCdcDataInterface::SetUpInterface;ret=%d", ret );
+		OstTraceFunctionExit0( CCDCDATAINTERFACE_SETUPINTERFACE_EXIT );
 		return ret;
 		}
 
@@ -108,11 +112,13 @@
 	const TUint KRequiredNumberOfEndpoints = 2;
 
 	const TUint totalEndpoints = static_cast<TUint>(dCaps().iTotalEndpoints);
-	LOGTEXT2(_L8("\tiTotalEndpoints = %d"), totalEndpoints);
+	OstTrace1( TRACE_NORMAL, CCDCDATAINTERFACE_SETUPINTERFACE_DUP2, 
+			"CCdcDataInterface::SetUpInterface;totalEndpoints=%d", (TInt)totalEndpoints );
+	
 	if ( totalEndpoints < KRequiredNumberOfEndpoints )
 		{
-		LOGTEXT2(_L8("<<CCdcDataInterface::SetUpInterface ret=%d"), 
-			KErrGeneral);
+		OstTrace1( TRACE_NORMAL, CCDCDATAINTERFACE_SETUPINTERFACE_DUP3, "CCdcDataInterface::SetUpInterface;ret=%d", KErrGeneral );
+		OstTraceFunctionExit0( CCDCDATAINTERFACE_SETUPINTERFACE_EXIT_DUP1 );
 		return KErrGeneral;
 		}
 	
@@ -120,10 +126,11 @@
 	TUsbcEndpointData data[KUsbcMaxEndpoints];
 	TPtr8 dataptr(reinterpret_cast<TUint8*>(data), sizeof(data), sizeof(data));
 	ret = iLdd.EndpointCaps(dataptr);
-	LOGTEXT(_L8("\tchecking result of EndpointCaps"));
+	OstTrace0( TRACE_NORMAL, CCDCDATAINTERFACE_SETUPINTERFACE_DUP9, "CCdcDataInterface::SetUpInterface;\tchecking result of EndpointCaps" );
 	if ( ret )
 		{
-		LOGTEXT2(_L8("<<CCdcDataInterface::SetUpInterface ret=%d"), ret);
+		OstTrace1( TRACE_NORMAL, CCDCDATAINTERFACE_SETUPINTERFACE_DUP4, "CCdcDataInterface::SetUpInterface;ret=%d", ret );
+		OstTraceFunctionExit0( CCDCDATAINTERFACE_SETUPINTERFACE_EXIT_DUP2 );
 		return ret;
 		}
 
@@ -131,12 +138,15 @@
 	TUsbcInterfaceInfoBuf ifc;
 	TBool foundIn = EFalse;
 	TBool foundOut = EFalse;
-
+	
 	for ( TUint i = 0; !(foundIn && foundOut) && i < totalEndpoints; i++ )
 		{
 		const TUsbcEndpointCaps* caps = &data[i].iCaps;
-		__ASSERT_DEBUG(caps, 
-			_USB_PANIC(KAcmPanicCat, EPanicInternalError));
+		if (!caps)
+			{
+			OstTraceExt1( TRACE_FATAL, CCDCDATAINTERFACE_SETUPINTERFACE_DUP5, "CCdcDataInterface::SetUpInterface;caps=%p", caps );
+			__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+			}
 		if (data[i].iInUse)
 			continue;
 
@@ -181,8 +191,8 @@
 
 	if (! (foundIn && foundOut))
 		{
-		LOGTEXT2(_L8("<<CCdcDataInterface::SetUpInterface ret=%d"), 
-			KErrGeneral);
+		OstTrace1( TRACE_NORMAL, CCDCDATAINTERFACE_SETUPINTERFACE_DUP6, "CCdcDataInterface::SetUpInterface;ret=%d", KErrGeneral );
+		OstTraceFunctionExit0( CCDCDATAINTERFACE_SETUPINTERFACE_EXIT_DUP3 );
 		return KErrGeneral;
 		}
 
@@ -205,18 +215,21 @@
 	// from EP0.
 	ifc().iFeatureWord |= KUsbcInterfaceInfo_NoEp0RequestsPlease;
 
-	LOGTEXT(_L8("\tcalling SetInterface"));
+	OstTrace0( TRACE_NORMAL, CCDCDATAINTERFACE_SETUPINTERFACE_DUP7, "CCdcDataInterface::SetUpInterface;\tcalling SetInterface" );
 	// Zero effectively indicates that alternate interfaces are not used.
 	ret = iLdd.SetInterface(0, ifc, bandwidthPriority);
 
-	LOGTEXT2(_L8("<<CCdcDataInterface::SetUpInterface ret=%d"), ret);
+	OstTrace1( TRACE_NORMAL, CCDCDATAINTERFACE_SETUPINTERFACE_DUP8, "CCdcDataInterface::SetUpInterface;ret=%d", ret );
+	OstTraceFunctionExit0( CCDCDATAINTERFACE_SETUPINTERFACE_EXIT_DUP4 );
 	return ret;
 	}
 
 
 void CCdcDataInterface::MLSOStateChange(TInt aPacketSize)
 	{
+	OstTraceFunctionEntry0( CCDCDATAINTERFACE_MLSOSTATECHANGE_ENTRY );	
 	iPacketSize = aPacketSize;
+	OstTraceFunctionExit0( CCDCDATAINTERFACE_MLSOSTATECHANGE_EXIT );
 	}
 
 
@@ -225,13 +238,13 @@
  * Destructor. Cancel and destroy the child classes.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CCDCDATAINTERFACE_CCDCDATAINTERFACE_DES_ENTRY );
 	delete iLinkState;
 	delete iReadOneOrMoreReader;
 	delete iReader;
 	delete iWriter;
 	delete iDataAvailableNotifier;
+	OstTraceFunctionExit0( CCDCDATAINTERFACE_CCDCDATAINTERFACE_DES_EXIT );
 	}
 
 void CCdcDataInterface::Write(MWriteObserver& aObserver, 
@@ -245,14 +258,18 @@
  * @param aLen Length of the data to be sent
  */
 	{
-	LOG_FUNC
-
-	__ASSERT_DEBUG(!iWriteObserver, 
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError));
-
+	OstTraceFunctionEntry0( CCDCDATAINTERFACE_WRITE_ENTRY );
+	if (iWriteObserver)
+		{
+		OstTraceExt1( TRACE_FATAL, CCDCDATAINTERFACE_WRITE, "CCdcDataInterface::Write;iWriteObserver=%p", iWriteObserver );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	iWriteObserver = &aObserver;
-
-	__ASSERT_DEBUG(iWriter, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (!iWriter)
+		{
+		OstTraceExt1( TRACE_FATAL, CCDCDATAINTERFACE_WRITE_DUP1, "CCdcDataInterface::Write;iWriter=%p", iWriter );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	
 	if ( iHostCanHandleZLPs )
 		{
@@ -267,7 +284,7 @@
 		iWriter->Write(aDes, aLen, EFalse); 
 		}
 		
-	LOGTEXT(_L8("<<CCdcDataInterface::Write"));
+	OstTraceFunctionExit0( CCDCDATAINTERFACE_WRITE_EXIT );
 	}
 
 void CCdcDataInterface::WriteCompleted(TInt aError)
@@ -277,46 +294,67 @@
  * @param aError Error.
  */
 	{
-	LOGTEXT2(_L8(">>CCdcDataInterface::WriteCompleted aError=%d"), aError);
+	OstTraceFunctionEntry0( CCDCDATAINTERFACE_WRITECOMPLETED_ENTRY );
+	OstTrace1( TRACE_NORMAL, CCDCDATAINTERFACE_WRITECOMPLETED, "CCdcDataInterface::WriteCompleted;aError=%d", aError );
 
 #ifdef __HEADLESS_ACM_TEST_CODE__
 	// Issue another Read or ReadOneOrMore as appropriate.
 	// If the Write completed with an error, we panic, as it's invalidating 
 	// the test.
-	__ASSERT_DEBUG(aError == KErrNone, 
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (aError != KErrNone)
+		{
+		OstTrace1( TRACE_FATAL, CCDCDATAINTERFACE_WRITECOMPLETED_DUP1, "CCdcDataInterface::WriteCompleted;aError=%d", aError );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	switch ( iHeadlessReadType )
 		{
 	case ERead:
-		LOGTEXT2(_L8("__HEADLESS_ACM_TEST_CODE__- issuing Read for %d bytes"), 
-			iHeadlessReadLength);
-		__ASSERT_DEBUG(iReader, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+		OstTrace1( TRACE_NORMAL, CCDCDATAINTERFACE_WRITECOMPLETED_DUP2, 
+				"CCdcDataInterface::WriteCompleted;__HEADLESS_ACM_TEST_CODE__- issuing Read for %d bytes", iHeadlessReadLength );
+
+		if (!iReader)
+			{
+			OstTraceExt1( TRACE_FATAL, CCDCDATAINTERFACE_WRITECOMPLETED_DUP3, "CCdcDataInterface::WriteCompleted;iReader=%p", iReader );
+			__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+			}
 		iReader->Read(iHeadlessAcmBuffer, iHeadlessReadLength);
 		break;
 	case EReadOneOrMore:
-		LOGTEXT2(_L8("__HEADLESS_ACM_TEST_CODE__- issuing ReadOneOrMore for %d bytes"), 
-			iHeadlessReadLength);
-		__ASSERT_DEBUG(iReadOneOrMoreReader, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+		OstTrace1( TRACE_NORMAL, CCDCDATAINTERFACE_WRITECOMPLETED_DUP4, 
+				"CCdcDataInterface::WriteCompleted;__HEADLESS_ACM_TEST_CODE__- issuing ReadOneOrMore for %d bytes", iHeadlessReadLength );
+	
+		if (!iReadOneOrMoreReader)
+			{
+			OstTraceExt1( TRACE_FATAL, CCDCDATAINTERFACE_WRITECOMPLETED_DUP5, 
+							"CCdcDataInterface::WriteCompleted;iReadOneOrMoreReader=%p", iReadOneOrMoreReader );
+			__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+			}
 		iReadOneOrMoreReader->ReadOneOrMore(iHeadlessAcmBuffer, iHeadlessReadLength);
 		break;
 	case EUnknown:
 	default:
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError);
+		OstTrace0( TRACE_FATAL, CCDCDATAINTERFACE_WRITECOMPLETED_DUP6, "CCdcDataInterface::WriteCompleted;EPanicInternalError" );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
 		break;
 		}
 #else
 	// In case the write observer wants to post another write synchronously on 
 	// being informed that this write has completed, use this little 'temp' 
 	// fiddle.
-	__ASSERT_DEBUG(iWriteObserver, 
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (!iWriteObserver)
+		{
+		OstTraceExt1( TRACE_FATAL, CCDCDATAINTERFACE_WRITECOMPLETED_DUP7, 
+						"CCdcDataInterface::WriteCompleted;iWriteObserver=%p", iWriteObserver );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	MWriteObserver* temp = iWriteObserver;
 	iWriteObserver = NULL;
-	LOGTEXT(_L8("\tcalling WriteCompleted on observer"));
+	OstTrace0( TRACE_NORMAL, CCDCDATAINTERFACE_WRITECOMPLETED_DUP8, 
+				"CCdcDataInterface::WriteCompleted;\tcalling WriteCompleted on observer" );
 	temp->WriteCompleted(aError);
 #endif // __HEADLESS_ACM_TEST_CODE__
 
-	LOGTEXT(_L8("<<CCdcDataInterface::WriteCompleted"));
+	OstTraceFunctionExit0( CCDCDATAINTERFACE_WRITECOMPLETED_EXIT );
 	}
 
 void CCdcDataInterface::CancelWrite()
@@ -324,13 +362,15 @@
  * Cancel an outstanding write request
  */
 	{
-	LOG_FUNC
-	
-	__ASSERT_DEBUG(iWriter, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
-
+	OstTraceFunctionEntry0( CCDCDATAINTERFACE_CANCELWRITE_ENTRY );
+	if (!iWriter)
+		{
+		OstTraceExt1( TRACE_FATAL, CCDCDATAINTERFACE_CANCELWRITE, "CCdcDataInterface::CancelWrite;iWriter=%p", iWriter );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	iWriter->Cancel();
-
 	iWriteObserver = NULL;
+	OstTraceFunctionExit0( CCDCDATAINTERFACE_CANCELWRITE_EXIT );
 	}
 
 void CCdcDataInterface::Read(MReadObserver& aObserver, 
@@ -345,27 +385,42 @@
  * @param aMaxLen Number of bytes to read
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CCDCDATAINTERFACE_READ_ENTRY );
+	
 #ifdef __HEADLESS_ACM_TEST_CODE__
-	LOGTEXT(_L8("__HEADLESS_ACM_TEST_CODE__"));
+	OstTrace0( TRACE_NORMAL, CCDCDATAINTERFACE_READ, "CCdcDataInterface::Read;__HEADLESS_ACM_TEST_CODE__" );
 	// Issue a Read using our special internal buffer.
 	iHeadlessReadType = ERead;
 	iHeadlessReadLength = aMaxLen;
 	static_cast<void>(&aObserver);
 	static_cast<void>(&aDes);
-	__ASSERT_DEBUG(aMaxLen <= iHeadlessAcmBuffer.MaxLength(), 
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError));
-	__ASSERT_DEBUG(iReader, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (aMaxLen > iHeadlessAcmBuffer.MaxLength())
+		{
+		OstTrace1( TRACE_FATAL, CCDCDATAINTERFACE_READ_DUP1, "CCdcDataInterface::Read;aMaxLen=%d", aMaxLen );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
+	if (!iReader)
+		{
+		OstTraceExt1( TRACE_FATAL, CCDCDATAINTERFACE_READ_DUP2, "CCdcDataInterface::Read;iReader=%p", iReader );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	iReader->Read(iHeadlessAcmBuffer, aMaxLen);
 #else
-	__ASSERT_DEBUG(!iReadObserver, 
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (iReadObserver)
+		{
+		OstTraceExt1( TRACE_FATAL, CCDCDATAINTERFACE_READ_DUP3, "CCdcDataInterface::Read;iReadObserver=%p", iReadObserver );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	iReadObserver = &aObserver;
-
-	__ASSERT_DEBUG(iReader, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (!iReader)
+		{
+		OstTraceExt1( TRACE_FATAL, CCDCDATAINTERFACE_READ_DUP4, "CCdcDataInterface::Read;iReader=%p", iReader );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
+	
 	iReader->Read(aDes, aMaxLen);
 #endif // __HEADLESS_ACM_TEST_CODE__
+	OstTraceFunctionExit0( CCDCDATAINTERFACE_READ_EXIT );
 	}
 
 void CCdcDataInterface::ReadOneOrMore(MReadOneOrMoreObserver& aObserver, 
@@ -380,29 +435,45 @@
  * @param aMaxLen Number of bytes to read
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CCDCDATAINTERFACE_READONEORMORE_ENTRY );
+	
 
 #ifdef __HEADLESS_ACM_TEST_CODE__
-	LOGTEXT(_L8("__HEADLESS_ACM_TEST_CODE__"));
+	OstTrace0( TRACE_NORMAL, CCDCDATAINTERFACE_READONEORMORE, "CCdcDataInterface::ReadOneOrMore;__HEADLESS_ACM_TEST_CODE__" );
 	// Issue a ReadOneOrMore using our special internal buffer.
 	iHeadlessReadType = EReadOneOrMore;
 	iHeadlessReadLength = aMaxLen;
 	static_cast<void>(&aObserver);
 	static_cast<void>(&aDes);
-	__ASSERT_DEBUG(aMaxLen <= iHeadlessAcmBuffer.MaxLength(), 
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError));
-	__ASSERT_DEBUG(iReadOneOrMoreReader, 
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (aMaxLen > iHeadlessAcmBuffer.MaxLength())
+		{
+		OstTrace1( TRACE_FATAL, CCDCDATAINTERFACE_READONEORMORE_DUP1, "CCdcDataInterface::ReadOneOrMore;aMaxLen=%d", aMaxLen );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
+	if (!iReadOneOrMoreReader)
+		{
+		OstTraceExt1( TRACE_FATAL, CCDCDATAINTERFACE_READONEORMORE_DUP2, 
+									"CCdcDataInterface::ReadOneOrMore;iReadOneOrMoreReader=%p", iReadOneOrMoreReader );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	iReadOneOrMoreReader->ReadOneOrMore(iHeadlessAcmBuffer, aMaxLen);
 #else
-	__ASSERT_DEBUG(!iReadOneOrMoreObserver, 
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (iReadOneOrMoreObserver)
+		{
+		OstTraceExt1( TRACE_FATAL, CCDCDATAINTERFACE_READONEORMORE_DUP3, 
+						"CCdcDataInterface::ReadOneOrMore;iReadOneOrMoreObserver=%p", iReadOneOrMoreObserver );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	iReadOneOrMoreObserver = &aObserver;
-
-	__ASSERT_DEBUG(iReadOneOrMoreReader, 
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (!iReadOneOrMoreReader)
+		{
+		OstTraceExt1( TRACE_FATAL, CCDCDATAINTERFACE_READONEORMORE_DUP4, 
+						"CCdcDataInterface::ReadOneOrMore;iReadOneOrMoreObserver=%p", iReadOneOrMoreObserver );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	iReadOneOrMoreReader->ReadOneOrMore(aDes, aMaxLen);
 #endif // __HEADLESS_ACM_TEST_CODE__
+	OstTraceFunctionExit0( CCDCDATAINTERFACE_READONEORMORE_EXIT );
 	}
 
 void CCdcDataInterface::ReadOneOrMoreCompleted(TInt aError)
@@ -413,31 +484,47 @@
  * @param aError The result of the read request.
  */
 	{
-	LOGTEXT2(_L8(">>CCdcDataInterface::ReadOneOrMoreCompleted aError=%d"), 
-		aError);
+	OstTraceFunctionEntry0( CCDCDATAINTERFACE_READONEORMORECOMPLETED_ENTRY );
+	OstTrace1( TRACE_NORMAL, CCDCDATAINTERFACE_READONEORMORECOMPLETED, "CCdcDataInterface::ReadOneOrMoreCompleted;aError=%d", aError );
 
 #ifdef __HEADLESS_ACM_TEST_CODE__
-	LOGTEXT2(_L8("__HEADLESS_ACM_TEST_CODE__- issuing Write for %d bytes"),
-		iHeadlessAcmBuffer.Length());
+	OstTrace1( TRACE_NORMAL, CCDCDATAINTERFACE_READONEORMORECOMPLETED_DUP1, 
+			"CCdcDataInterface::ReadOneOrMoreCompleted;__HEADLESS_ACM_TEST_CODE__- issuing Write for %d bytes", iHeadlessAcmBuffer.Length() );
+
 	// Write back the data just read.
 	// If the ReadOneOrMore completed with an error, we panic, as it's 
 	// invalidating the test.
-	__ASSERT_DEBUG(aError == KErrNone, 
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError));
-	__ASSERT_DEBUG(iWriter, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (aError != KErrNone)
+		{
+		OstTrace1( TRACE_FATAL, CCDCDATAINTERFACE_READONEORMORECOMPLETED_DUP2, 
+								"CCdcDataInterface::ReadOneOrMoreCompleted;aError=%d", aError );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
+
+	if (!iWriter)
+		{	
+		OstTraceExt1( TRACE_FATAL, CCDCDATAINTERFACE_READONEORMORECOMPLETED_DUP3, 
+							"CCdcDataInterface::ReadOneOrMoreCompleted;iWriter=%p", iWriter );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	iWriter->Write(iHeadlessAcmBuffer, iHeadlessAcmBuffer.Length(), EFalse); 
 #else
-	__ASSERT_DEBUG(iReadOneOrMoreObserver, 
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (!iReadOneOrMoreObserver)
+		{
+		OstTraceExt1( TRACE_FATAL, CCDCDATAINTERFACE_READONEORMORECOMPLETED_DUP4, 
+							"CCdcDataInterface::ReadOneOrMoreCompleted;iReadOneOrMoreObserver=%p", iReadOneOrMoreObserver );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 
 	// See comment in WriteCompleted.
 	MReadOneOrMoreObserver* temp = iReadOneOrMoreObserver;
 	iReadOneOrMoreObserver = NULL;
-	LOGTEXT(_L8("\tcalling ReadOneOrMoreCompleted on observer"));
+	OstTrace0( TRACE_NORMAL, CCDCDATAINTERFACE_READONEORMORECOMPLETED_DUP5, 
+			"CCdcDataInterface::ReadOneOrMoreCompleted;\tcalling ReadOneOrMoreCompleted on observer" );
 	temp->ReadOneOrMoreCompleted(aError);
 #endif // __HEADLESS_ACM_TEST_CODE__
 
-	LOGTEXT(_L8("<<CCdcDataInterface::ReadOneOrMoreCompleted"));
+	OstTraceFunctionExit0( CCDCDATAINTERFACE_READONEORMORECOMPLETED_EXIT );
 	}
 
 void CCdcDataInterface::ReadCompleted(TInt aError)
@@ -447,30 +534,44 @@
  * @param aError Error.
  */
 	{
-	LOGTEXT2(_L8(">>CCdcDataInterface::ReadCompleted aError=%d"), aError);
+	OstTraceFunctionEntry0( CCDCDATAINTERFACE_READCOMPLETED_ENTRY );
+	OstTrace1( TRACE_NORMAL, CCDCDATAINTERFACE_READCOMPLETED, "CCdcDataInterface::ReadCompleted;aError=%d", aError );
 
 #ifdef __HEADLESS_ACM_TEST_CODE__
-	LOGTEXT2(_L8("__HEADLESS_ACM_TEST_CODE__- issuing Write for %d bytes"),
-		iHeadlessAcmBuffer.Length());
+	OstTrace1( TRACE_NORMAL, CCDCDATAINTERFACE_READCOMPLETED_DUP1, 
+			"CCdcDataInterface::ReadCompleted;__HEADLESS_ACM_TEST_CODE__- issuing Write for %d bytes", iHeadlessAcmBuffer.Length() );
+	
 	// Write back the data just read.
 	// If the Read completed with an error, we panic, as it's invalidating the 
 	// test.				 
-	__ASSERT_DEBUG(aError == KErrNone,
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError));
-	__ASSERT_DEBUG(iWriter, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (aError != KErrNone)
+		{
+		OstTrace1( TRACE_FATAL, CCDCDATAINTERFACE_READCOMPLETED_DUP2, "CCdcDataInterface::ReadCompleted;aError=%d", aError );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
+
+	if (!iWriter)
+		{
+		OstTraceExt1( TRACE_NORMAL, CCDCDATAINTERFACE_READCOMPLETED_DUP3, "CCdcDataInterface::ReadCompleted;iWriter=%p", iWriter );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	iWriter->Write(iHeadlessAcmBuffer, iHeadlessAcmBuffer.Length(), EFalse); 
 #else
-	__ASSERT_DEBUG(iReadObserver, 
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (!iReadObserver)
+		{
+		OstTraceExt1( TRACE_FATAL, CCDCDATAINTERFACE_READCOMPLETED_DUP4, 
+							"CCdcDataInterface::ReadCompleted;iReadObserver=%p", iReadObserver );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 
 	// See comment in WriteCompleted.
 	MReadObserver* temp = iReadObserver;
 	iReadObserver = NULL;
-	LOGTEXT(_L8("\tcalled ReadCompleted on observer"));
+	OstTrace0( TRACE_NORMAL, CCDCDATAINTERFACE_READCOMPLETED_DUP5, "CCdcDataInterface::ReadCompleted;\tcalled ReadCompleted on observer" );
 	temp->ReadCompleted(aError);
 #endif // __HEADLESS_ACM_TEST_CODE__
 
-	LOGTEXT(_L8("<<CCdcDataInterface::ReadCompleted"));
+	OstTraceFunctionExit0( CCDCDATAINTERFACE_READCOMPLETED_EXIT );
 	}
 
 void CCdcDataInterface::CancelRead()
@@ -478,16 +579,24 @@
  * Cancel an outstanding read request
  */
 	{
-	LOG_FUNC
-
-	__ASSERT_DEBUG(iReader, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
-	__ASSERT_DEBUG(iReadOneOrMoreReader, 
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	OstTraceFunctionEntry0( CCDCDATAINTERFACE_CANCELREAD_ENTRY );
+	if (!iReader)
+		{
+		OstTraceExt1( TRACE_FATAL, CCDCDATAINTERFACE_CANCELREAD, "CCdcDataInterface::CancelRead;iReader=%p", iReader );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
+	if (!iReadOneOrMoreReader)
+		{
+		OstTraceExt1( TRACE_FATAL, CCDCDATAINTERFACE_CANCELREAD_DUP1, 
+							"CCdcDataInterface::CancelRead;iReadOneOrMoreReader=%p", iReadOneOrMoreReader );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 
 	iReader->Cancel();
 	iReadOneOrMoreReader->Cancel();
 	iReadObserver = NULL;
 	iReadOneOrMoreObserver = NULL;
+	OstTraceFunctionExit0( CCDCDATAINTERFACE_CANCELREAD_EXIT );
 	}
 
 	
@@ -498,15 +607,17 @@
  * @param aError Error.
  */
 	{
-	LOGTEXT2(_L8(">>CCdcDataInterface::NotifyDataAvailableCompleted aError=%d"), aError);	
+	OstTraceFunctionEntry0( CCDCDATAINTERFACE_NOTIFYDATAAVAILABLECOMPLETED_ENTRY );
+	OstTrace1( TRACE_NORMAL, CCDCDATAINTERFACE_NOTIFYDATAAVAILABLECOMPLETED, 
+			"CCdcDataInterface::NotifyDataAvailableCompleted;aError=%d", aError );	
 	
 	// See comment in WriteCompleted.
 	MNotifyDataAvailableObserver* temp = iNotifyDataAvailableObserver;
 	iNotifyDataAvailableObserver = NULL;
-	LOGTEXT(_L8("\tcalled NotifyDataAvailableCompleted on observer"));
+	OstTrace0( TRACE_NORMAL, CCDCDATAINTERFACE_NOTIFYDATAAVAILABLECOMPLETED_DUP1, 
+			"CCdcDataInterface::NotifyDataAvailableCompleted;\tcalled NotifyDataAvailableCompleted on observer" );
 	temp->NotifyDataAvailableCompleted(aError);
-	
-	LOGTEXT(_L8("<<CCdcDataInterface::NotifyDataAvailableCompleted"));
+	OstTraceFunctionExit0( CCDCDATAINTERFACE_NOTIFYDATAAVAILABLECOMPLETED_EXIT );
 	}
 	
 void CCdcDataInterface::NotifyDataAvailable(MNotifyDataAvailableObserver& aObserver)
@@ -516,14 +627,23 @@
  * @param aObserver The observer to notify of completion.
  */
 	{
-	LOG_FUNC
-		
-	__ASSERT_DEBUG(!iNotifyDataAvailableObserver, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	OstTraceFunctionEntry0( CCDCDATAINTERFACE_NOTIFYDATAAVAILABLE_ENTRY );
+	
+	if (iNotifyDataAvailableObserver)
+		{
+		OstTraceExt1( TRACE_FATAL, CCDCDATAINTERFACE_NOTIFYDATAAVAILABLE, 
+							"CCdcDataInterface::NotifyDataAvailable;iNotifyDataAvailableObserver=%p", iNotifyDataAvailableObserver );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	iNotifyDataAvailableObserver = &aObserver;
-
-	__ASSERT_DEBUG(iDataAvailableNotifier, 
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (!iDataAvailableNotifier)
+		{
+		OstTraceExt1( TRACE_FATAL, CCDCDATAINTERFACE_NOTIFYDATAAVAILABLE_DUP1, 
+						"CCdcDataInterface::NotifyDataAvailable;iDataAvailableNotifier=%p", iDataAvailableNotifier );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	iDataAvailableNotifier->NotifyDataAvailable();
+	OstTraceFunctionExit0( CCDCDATAINTERFACE_NOTIFYDATAAVAILABLE_EXIT );
 	}
 
 void CCdcDataInterface::CancelNotifyDataAvailable()
@@ -531,12 +651,16 @@
  * Cancel notification of arrival of data.
  */
 	{
-	LOG_FUNC
-
-	__ASSERT_DEBUG(iDataAvailableNotifier, _USB_PANIC(KAcmPanicCat, EPanicInternalError));
-
+	OstTraceFunctionEntry0( CCDCDATAINTERFACE_CANCELNOTIFYDATAAVAILABLE_ENTRY );
+	if (!iDataAvailableNotifier)
+		{
+		OstTraceExt1( TRACE_FATAL, CCDCDATAINTERFACE_CANCELNOTIFYDATAAVAILABLE, 
+						"CCdcDataInterface::CancelNotifyDataAvailable;iDataAvailableNotifier=%p", iDataAvailableNotifier );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 	iDataAvailableNotifier->Cancel();
 	iNotifyDataAvailableObserver = NULL;	
+	OstTraceFunctionExit0( CCDCDATAINTERFACE_CANCELNOTIFYDATAAVAILABLE_EXIT );
 	}
 
 //
--- a/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/CdcInterfaceBase.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/CdcInterfaceBase.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -17,11 +17,11 @@
 
 #include <e32std.h>
 #include "CdcInterfaceBase.h"
-#include <usb/usblogger.h>
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "CdcInterfaceBaseTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "ECACM");
-#endif
 
 CCdcInterfaceBase::CCdcInterfaceBase(const TDesC16& aIfcName)
 /**
@@ -30,7 +30,9 @@
  * @param aIfcName The name of the interface.
  */
 	{
+	OstTraceFunctionEntry0( CCDCINTERFACEBASE_CCDCINTERFACEBASE_CONS_ENTRY );
 	iIfcName.Set(aIfcName);
+	OstTraceFunctionExit0( CCDCINTERFACEBASE_CCDCINTERFACEBASE_CONS_EXIT );
 	}
 
 void CCdcInterfaceBase::BaseConstructL()
@@ -39,21 +41,31 @@
  * This call registers the object with the USB device driver
  */
 	{
-	LOGTEXT(_L8("\tcalling RDevUsbcClient::Open"));
+	OstTraceFunctionEntry0( CCDCINTERFACEBASE_BASECONSTRUCTL_ENTRY );
+	OstTrace0( TRACE_NORMAL, CCDCINTERFACEBASE_BASECONSTRUCTL, "CCdcInterfaceBase::BaseConstructL;\tcalling RDevUsbcClient::Open" );
 	// 0 is assumed to mean ep0
 	TInt ret = iLdd.Open(0); 
 	if ( ret )
-		{
-		LOGTEXT2(_L8("\tRDevUsbcClient::Open = %d"), ret);
-		LEAVEIFERRORL(ret); 
+		{		
+		OstTrace1( TRACE_NORMAL, CCDCINTERFACEBASE_BASECONSTRUCTL_DUP1, 
+					"CCdcInterfaceBase::BaseConstructL;\tRDevUsbcClient::Open = %d", ret );
+		if (ret < 0)
+			{
+			User::Leave(ret);
+			}
 		}
 
 	ret = SetUpInterface();
 	if ( ret )
 		{
-		LOGTEXT2(_L8("\tSetUpInterface = %d"), ret);
-		LEAVEIFERRORL(ret);
+		OstTrace1( TRACE_NORMAL, CCDCINTERFACEBASE_BASECONSTRUCTL_DUP2, 
+					"CCdcInterfaceBase::BaseConstructL;\tSetUpInterface = %d", ret );
+		if (ret < 0)
+			{
+			User::Leave(ret);
+			}
 		}
+	OstTraceFunctionExit0( CCDCINTERFACEBASE_BASECONSTRUCTL_EXIT );
 	}
 
 CCdcInterfaceBase::~CCdcInterfaceBase()
@@ -61,18 +73,18 @@
  * Destructor.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CCDCINTERFACEBASE_CCDCINTERFACEBASE_DES_ENTRY );
 	if ( iLdd.Handle() )
 		{
-		LOGTEXT(_L8("\tLDD handle exists"));
-
+		OstTrace0( TRACE_NORMAL, CCDCINTERFACEBASE_CCDCINTERFACEBASE_DES, 
+				"CCdcInterfaceBase::~CCdcInterfaceBase;\tLDD handle exists" );
 		// Don't bother calling ReleaseInterface- the base driver spec says 
 		// that Close does it for us.
-
-		LOGTEXT(_L8("\tclosing LDD session"));
+		OstTrace0( TRACE_NORMAL, CCDCINTERFACEBASE_CCDCINTERFACEBASE_DES_DUP1, 
+				"CCdcInterfaceBase::~CCdcInterfaceBase;\tclosing LDD session" );
 		iLdd.Close();
 		}
+	OstTraceFunctionExit0( CCDCINTERFACEBASE_CCDCINTERFACEBASE_DES_EXIT );
 	}
 
 TInt CCdcInterfaceBase::GetInterfaceNumber(TUint8& aIntNumber)
@@ -83,24 +95,25 @@
  * @return Error.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CCDCINTERFACEBASE_GETINTERFACENUMBER_ENTRY );
 	TInt interfaceSize = 0;
-
 	// 0 means the main interface in the LDD API
 	TInt res = iLdd.GetInterfaceDescriptorSize(0, interfaceSize);
 
 	if ( res )
 		{
-		LOGTEXT2(_L8("\t***GetInterfaceDescriptorSize()=%d"), res);
+		OstTrace1( TRACE_NORMAL, CCDCINTERFACEBASE_GETINTERFACENUMBER, 
+				"CCdcInterfaceBase::GetInterfaceNumber;\t***GetInterfaceDescriptorSize()=%d", res );
+		OstTraceFunctionExit0( CCDCINTERFACEBASE_GETINTERFACENUMBER_EXIT );
 		return res;
 		}
 
 	HBufC8* interfaceBuf = HBufC8::New(interfaceSize);
 	if ( !interfaceBuf )
 		{
-		LOGTEXT(_L8("\t***failed to create interfaceBuf- "
-			"returning KErrNoMemory"));
+		OstTrace0( TRACE_NORMAL, CCDCINTERFACEBASE_GETINTERFACENUMBER_DUP1, 
+				"CCdcInterfaceBase::GetInterfaceNumber;\t***failed to create interfaceBuf-returning KErrNoMemory" );
+		OstTraceFunctionExit0( CCDCINTERFACEBASE_GETINTERFACENUMBER_EXIT_DUP1 );
 		return KErrNoMemory;
 		}
 
@@ -112,26 +125,27 @@
 	if ( res )
 		{
 		delete interfaceBuf;
-		LOGTEXT2(_L8("\t***GetInterfaceDescriptor()=%d"), res);
+		OstTrace1( TRACE_NORMAL, CCDCINTERFACEBASE_GETINTERFACENUMBER_DUP2, "CCdcInterfaceBase::GetInterfaceNumber;res=%d", res );
+		OstTraceFunctionExit0( CCDCINTERFACEBASE_GETINTERFACENUMBER_EXIT_DUP2 );
 		return res;
 		}
 
-#ifdef __FLOG_ACTIVE
-	LOGTEXT2(_L8("\t***interface length = %d"), interfacePtr.Length());
+	OstTrace1( TRACE_NORMAL, CCDCINTERFACEBASE_GETINTERFACENUMBER_DUP3, 
+			"CCdcInterfaceBase::GetInterfaceNumber;\t***interface length = %d", interfacePtr.Length() );
 	for ( TInt i = 0 ; i < interfacePtr.Length() ; i++ )
 		{
-		LOGTEXT2(_L8("\t***** %x"),interfacePtr[i]);
+		OstTraceExt1( TRACE_NORMAL, CCDCINTERFACEBASE_GETINTERFACENUMBER_DUP4, 
+				"\t***** %hhx", interfacePtr[i] );
 		}
-#endif
 
 	const TUint8* buffer = reinterpret_cast<const TUint8*>(interfacePtr.Ptr());
 	// 2 is where the interface number is, according to the LDD API
 	aIntNumber = buffer[2]; 
-
-	LOGTEXT2(_L8("\tinterface number = %d"), aIntNumber);
-
+	OstTrace1( TRACE_NORMAL, CCDCINTERFACEBASE_GETINTERFACENUMBER_DUP5, 
+			"CCdcInterfaceBase::GetInterfaceNumber;\tinterface number = %d", (TInt)aIntNumber );
+	
 	delete interfaceBuf;
-
+	OstTraceFunctionExit0( CCDCINTERFACEBASE_GETINTERFACENUMBER_EXIT_DUP3 );
 	return KErrNone;
 	}
 
--- a/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/ClassDescriptor.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/ClassDescriptor.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -17,11 +17,11 @@
 
 #include "ClassDescriptor.h"
 #include "AcmPanic.h"
-#include <usb/usblogger.h>
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "ClassDescriptorTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "ECACM");
-#endif
 
 TDes8& TUsbCsClassDescriptor::Des()
 /**
@@ -32,6 +32,8 @@
  * this class and has the same lifetime.
  */
 	{
+	OstTraceFunctionEntry0( TUSBCSCLASSDESCRIPTOR_DES_ENTRY );
+	
 	TUint index = 0;
 
 	iBuffer.SetLength(KUsbClassSpecificBufferSize);
@@ -71,9 +73,13 @@
 
 #endif
 
-	__ASSERT_DEBUG(index == KUsbClassSpecificBufferSize, 
-		_USB_PANIC(KAcmPanicCat, EPanicInternalError));
+	if (index != KUsbClassSpecificBufferSize)
+		{
+		OstTrace1( TRACE_FATAL, TUSBCSCLASSDESCRIPTOR_DES, "TUsbCsClassDescriptor::Des;index=%d", (TInt)index );
+		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
+		}
 
+	OstTraceFunctionExit0( TUSBCSCLASSDESCRIPTOR_DES_EXIT );
 	return iBuffer;
 	}
 
--- a/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/DllMain.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/DllMain.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -18,6 +18,11 @@
 #include <e32std.h>
 #include <cs_port.h>
 #include "AcmPortFactory.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "DllMainTraces.h"
+#endif
+
 
 extern "C" IMPORT_C CSerial* LibEntryL(void);	
 
@@ -26,6 +31,7 @@
  * Lib main entry point
  */
 	{	
+	OstTraceFunctionEntry0( DLLMAIN_LIBENTRYL_ECACM_ENTRY );
 	return (CAcmPortFactory::NewL());
 	}
 
--- a/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/RegistrationPort.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/RegistrationPort.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -15,17 +15,17 @@
 *
 */
 
+#include <usb/acmserver.h>
 #include "RegistrationPort.h"
 #include "AcmConstants.h"
 #include "AcmUtils.h"
-#include <usb/acmserver.h>
 #include "acmcontroller.h"
-#include <usb/usblogger.h>
 #include "acmserverconsts.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "RegistrationPortTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "ECACM");
-#endif
 
 CRegistrationPort* CRegistrationPort::NewL(MAcmController& aAcmController, 
 										   TUint aUnit)
@@ -37,12 +37,12 @@
  * @return Ownership of a newly created CRegistrationPort object
  */
 	{
-	LOG_STATIC_FUNC_ENTRY
-
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_NEWL_ENTRY );
 	CRegistrationPort* self = new(ELeave) CRegistrationPort(aAcmController);
 	CleanupClosePushL(*self);
 	self->ConstructL(aUnit);
 	CleanupStack::Pop();
+	OstTraceFunctionExit0( CREGISTRATIONPORT_NEWL_EXIT );
 	return self;
 	}
 
@@ -53,11 +53,16 @@
  * @param aUnit The port number.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_CONSTRUCTL_ENTRY );
 	TName name;
 	name.Num(aUnit);
-	LEAVEIFERRORL(SetName(&name));
+	TInt err = SetName(&name);
+	if (err < 0)
+		{
+		OstTrace1( TRACE_NORMAL, CREGISTRATIONPORT_CONSTRUCTL, "CRegistrationPort::ConstructL;err=%d", err );
+		User::Leave(err);
+		}
+	OstTraceFunctionExit0( CREGISTRATIONPORT_CONSTRUCTL_EXIT );
 	}
 
 CRegistrationPort::CRegistrationPort(MAcmController& aAcmController) 
@@ -68,6 +73,8 @@
  */
  :	iAcmController(aAcmController)
 	{
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_CREGISTRATIONPORT_CONS_ENTRY );
+	OstTraceFunctionExit0( CREGISTRATIONPORT_CREGISTRATIONPORT_CONS_EXIT );
 	}
 
 void CRegistrationPort::StartRead(const TAny* /*aClientBuffer*/, 
@@ -79,9 +86,9 @@
  * @param aLength number of bytes to read
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_STARTREAD_ENTRY );
 	ReadCompleted(KErrNotSupported);
+	OstTraceFunctionExit0( CREGISTRATIONPORT_STARTREAD_EXIT );
 	}
 
 void CRegistrationPort::ReadCancel()
@@ -89,9 +96,9 @@
  * Cancel a read
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_READCANCEL_ENTRY );
 	ReadCompleted(KErrNotSupported);
+	OstTraceFunctionExit0( CREGISTRATIONPORT_READCANCEL_EXIT );
 	}
 
 
@@ -103,8 +110,8 @@
  * @return KErrNotSupported always.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_QUERYRECEIVEBUFFER_ENTRY );
+	OstTraceFunctionExit0( CREGISTRATIONPORT_QUERYRECEIVEBUFFER_EXIT );
 	return KErrNotSupported;
 	}
 
@@ -114,7 +121,8 @@
  * Not supported.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_RESETBUFFERS_ENTRY );
+	OstTraceFunctionExit0( CREGISTRATIONPORT_RESETBUFFERS_EXIT );
 	}
 
 void CRegistrationPort::StartWrite(const TAny* /*aClientBuffer*/, 
@@ -126,9 +134,9 @@
  * @param aLength number of bytes to write
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_STARTWRITE_ENTRY );
 	WriteCompleted(KErrNotSupported);
+	OstTraceFunctionExit0( CREGISTRATIONPORT_STARTWRITE_EXIT );
 	}
 
 void CRegistrationPort::WriteCancel()
@@ -136,9 +144,9 @@
  * Cancel a pending write
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_WRITECANCEL_ENTRY );
 	WriteCompleted(KErrNotSupported);
+	OstTraceFunctionExit0( CREGISTRATIONPORT_WRITECANCEL_EXIT );
 	}
 
 void CRegistrationPort::Break(TInt /*aTime*/)
@@ -148,9 +156,9 @@
  * @param aTime Length of break in microseconds
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_BREAK_ENTRY );
 	BreakCompleted(KErrNotSupported);
+	OstTraceFunctionExit0( CREGISTRATIONPORT_BREAK_EXIT );
 	}
 
 void CRegistrationPort::BreakCancel()
@@ -158,7 +166,8 @@
  * Cancel a pending break.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_BREAKCANCEL_ENTRY );
+	OstTraceFunctionExit0( CREGISTRATIONPORT_BREAKCANCEL_EXIT );
 	}
 
 TInt CRegistrationPort::GetConfig(TDes8& /*aDes*/) const
@@ -169,8 +178,8 @@
  * @return Error
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_GETCONFIG_ENTRY );
+	OstTraceFunctionExit0( CREGISTRATIONPORT_GETCONFIG_EXIT );
 	return KErrNotSupported;
 	}
 
@@ -182,8 +191,8 @@
  * @return Error
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_SETCONFIG_ENTRY );
+	OstTraceFunctionExit0( CREGISTRATIONPORT_SETCONFIG_EXIT );
 	return KErrNotSupported;
 	}
 
@@ -195,8 +204,8 @@
  * @return Error
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_SETSERVERCONFIG_ENTRY );
+	OstTraceFunctionExit0( CREGISTRATIONPORT_SETSERVERCONFIG_EXIT );
 	return KErrNotSupported;
 	}
 
@@ -208,8 +217,8 @@
  * @return Error
  */
 	{
-	LOG_FUNC
-	
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_GETSERVERCONFIG_ENTRY );
+	OstTraceFunctionExit0( CREGISTRATIONPORT_GETSERVERCONFIG_EXIT );
 	return KErrNotSupported;
 	}
 
@@ -221,8 +230,8 @@
  * @return Error
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_GETCAPS_ENTRY );
+	OstTraceFunctionExit0( CREGISTRATIONPORT_GETCAPS_EXIT );
 	return KErrNotSupported;
 	}
 
@@ -234,8 +243,8 @@
  * @return Error
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_GETSIGNALS_ENTRY );
+	OstTraceFunctionExit0( CREGISTRATIONPORT_GETSIGNALS_EXIT );
 	return KErrNotSupported;
 	}
 
@@ -251,7 +260,8 @@
  * @return Error
  */
 	{
-	LOGTEXT2(_L8(">>CRegistrationPort::SetSignalsToMark aAcmField = 0x%x"), aAcmField);
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_SETSIGNALSTOMARK_ENTRY );
+	OstTrace1( TRACE_NORMAL, CREGISTRATIONPORT_SETSIGNALSTOMARK, "CRegistrationPort::SetSignalsToMark;aAcmField = 0x%x", aAcmField );
 
 	// Extract number of interfaces and protocol number
 	//	low 2 bytes represent the number of ACMs
@@ -265,8 +275,8 @@
 	protocolNumber = protocolNumber ? protocolNumber : KDefaultAcmProtocolNum;
 
 	TInt ret = iAcmController.CreateFunctions(interfaces, protocolNumber, KControlIfcName, KDataIfcName);
-
-	LOGTEXT2(_L8("<<CRegistrationPort::SetSignalsToMark ret = %d"), ret);
+	OstTrace1( TRACE_NORMAL, CREGISTRATIONPORT_SETSIGNALSTOMARK_DUP1, "CRegistrationPort::SetSignalsToMark;ret=%d", ret );
+	OstTraceFunctionExit0( CREGISTRATIONPORT_SETSIGNALSTOMARK_EXIT );
 	return ret;
 	}
 
@@ -281,11 +291,11 @@
  * @return Error
  */
 	{
-	LOGTEXT2(_L8(">>CRegistrationPort::SetSignalsToSpace aNoAcms = %d"), aNoAcms);
-
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_SETSIGNALSTOSPACE_ENTRY );
+	OstTrace1( TRACE_NORMAL, CREGISTRATIONPORT_SETSIGNALSTOSPACE, "CRegistrationPort::SetSignalsToSpace;aNoAcms=%d", (TInt)aNoAcms );
 	iAcmController.DestroyFunctions(aNoAcms);
-
-	LOGTEXT(_L8("<<CRegistrationPort::SetSignalsToSpace ret = KErrNone"));
+	OstTrace0( TRACE_NORMAL, CREGISTRATIONPORT_SETSIGNALSTOSPACE_DUP1, "CRegistrationPort::SetSignalsToSpace;ret = KErrNone" );
+	OstTraceFunctionExit0( CREGISTRATIONPORT_SETSIGNALSTOSPACE_EXIT );
 	return KErrNone;
 	}
 
@@ -297,8 +307,8 @@
  * @return Error
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_GETRECEIVEBUFFERLENGTH_ENTRY );
+	OstTraceFunctionExit0( CREGISTRATIONPORT_GETRECEIVEBUFFERLENGTH_EXIT );
 	return KErrNotSupported;
 	}
 
@@ -310,8 +320,8 @@
  * @return Error
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_SETRECEIVEBUFFERLENGTH_ENTRY );
+	OstTraceFunctionExit0( CREGISTRATIONPORT_SETRECEIVEBUFFERLENGTH_EXIT );
 	return KErrNotSupported;
 	}
 
@@ -320,9 +330,9 @@
  * Destruct - we must (eventually) call delete this
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_DESTRUCT_ENTRY );
 	delete this;
+	OstTraceFunctionExit0( CREGISTRATIONPORT_DESTRUCT_EXIT );
 	}
 
 void CRegistrationPort::FreeMemory()
@@ -330,7 +340,8 @@
  * Attempt to reduce our memory foot print.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_FREEMEMORY_ENTRY );
+	OstTraceFunctionExit0( CREGISTRATIONPORT_FREEMEMORY_EXIT );
 	}
 
 void CRegistrationPort::NotifyDataAvailable()
@@ -338,9 +349,9 @@
  * Notify client when data is available
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_NOTIFYDATAAVAILABLE_ENTRY );
 	NotifyDataAvailableCompleted(KErrNotSupported);
+	OstTraceFunctionExit0( CREGISTRATIONPORT_NOTIFYDATAAVAILABLE_EXIT );
 	}
 
 void CRegistrationPort::NotifyDataAvailableCancel()
@@ -348,9 +359,9 @@
  * Cancel an outstanding data availalbe notification
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_NOTIFYDATAAVAILABLECANCEL_ENTRY );
 	NotifyDataAvailableCompleted(KErrNotSupported);
+	OstTraceFunctionExit0( CREGISTRATIONPORT_NOTIFYDATAAVAILABLECANCEL_EXIT );
 	}
 
 TInt CRegistrationPort::GetFlowControlStatus(TFlowControl& /*aFlowControl*/)
@@ -361,8 +372,8 @@
  * @return Error
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_GETFLOWCONTROLSTATUS_ENTRY );
+	OstTraceFunctionExit0( CREGISTRATIONPORT_GETFLOWCONTROLSTATUS_EXIT );
 	return KErrNotSupported;
 	}
 
@@ -371,9 +382,9 @@
  * Notify the client when the output buffer is empty.
  */
 	{
-	LOG_FUNC
-	
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_NOTIFYOUTPUTEMPTY_ENTRY );
 	NotifyOutputEmptyCompleted(KErrNotSupported);
+	OstTraceFunctionExit0( CREGISTRATIONPORT_NOTIFYOUTPUTEMPTY_EXIT );
 	}
 
 void CRegistrationPort::NotifyOutputEmptyCancel()
@@ -381,9 +392,9 @@
  * Cancel a pending request to be notified when the output buffer is empty.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_NOTIFYOUTPUTEMPTYCANCEL_ENTRY );
 	NotifyOutputEmptyCompleted(KErrNotSupported);
+	OstTraceFunctionExit0( CREGISTRATIONPORT_NOTIFYOUTPUTEMPTYCANCEL_EXIT );
 	}
 
 void CRegistrationPort::NotifyBreak()
@@ -391,9 +402,9 @@
  * Notify a client of a break on the serial line.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_NOTIFYBREAK_ENTRY );
 	BreakNotifyCompleted(KErrNotSupported);
+	OstTraceFunctionExit0( CREGISTRATIONPORT_NOTIFYBREAK_EXIT );
 	}
 
 void CRegistrationPort::NotifyBreakCancel()
@@ -401,9 +412,9 @@
  * Cancel a pending notification of a serial line break.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_NOTIFYBREAKCANCEL_ENTRY );
 	BreakNotifyCompleted(KErrNotSupported);
+	OstTraceFunctionExit0( CREGISTRATIONPORT_NOTIFYBREAKCANCEL_EXIT );
 	}
 
 void CRegistrationPort::NotifyFlowControlChange()
@@ -411,9 +422,9 @@
  * Notify a client of a change in the flow control state.
  */
 	{
-	LOG_FUNC
-	
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_NOTIFYFLOWCONTROLCHANGE_ENTRY );
 	FlowControlChangeCompleted(EFlowControlOn,KErrNotSupported);
+	OstTraceFunctionExit0( CREGISTRATIONPORT_NOTIFYFLOWCONTROLCHANGE_EXIT );
 	}
 
 void CRegistrationPort::NotifyFlowControlChangeCancel()
@@ -421,9 +432,9 @@
  * Cancel a pending request to be notified when the flow control state changes.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_NOTIFYFLOWCONTROLCHANGECANCEL_ENTRY );
 	FlowControlChangeCompleted(EFlowControlOn,KErrNotSupported);
+	OstTraceFunctionExit0( CREGISTRATIONPORT_NOTIFYFLOWCONTROLCHANGECANCEL_EXIT );
 	}
 
 void CRegistrationPort::NotifyConfigChange()
@@ -431,9 +442,9 @@
  * Notify a client of a change to the serial port configuration.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_NOTIFYCONFIGCHANGE_ENTRY );
 	ConfigChangeCompleted(KNullDesC8, KErrNotSupported);
+	OstTraceFunctionExit0( CREGISTRATIONPORT_NOTIFYCONFIGCHANGE_EXIT );
 	}
 
 void CRegistrationPort::NotifyConfigChangeCancel()
@@ -442,9 +453,9 @@
  * configuration.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_NOTIFYCONFIGCHANGECANCEL_ENTRY );
 	ConfigChangeCompleted(KNullDesC8, KErrNotSupported);
+	OstTraceFunctionExit0( CREGISTRATIONPORT_NOTIFYCONFIGCHANGECANCEL_EXIT );
 	}
 
 void CRegistrationPort::NotifySignalChange(TUint /*aSignalMask*/)
@@ -452,9 +463,9 @@
  * Notify a client of a change to the signal lines.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_NOTIFYSIGNALCHANGE_ENTRY );
 	SignalChangeCompleted(0, KErrNotSupported);
+	OstTraceFunctionExit0( CREGISTRATIONPORT_NOTIFYSIGNALCHANGE_EXIT );
 	}
 
 void CRegistrationPort::NotifySignalChangeCancel()
@@ -463,9 +474,9 @@
  * lines.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_NOTIFYSIGNALCHANGECANCEL_ENTRY );
 	SignalChangeCompleted(0, KErrNotSupported);
+	OstTraceFunctionExit0( CREGISTRATIONPORT_NOTIFYSIGNALCHANGECANCEL_EXIT );
 	}
 
 TInt CRegistrationPort::GetRole(TCommRole& aRole)
@@ -476,9 +487,10 @@
  * @return Error
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_GETROLE_ENTRY );
 	aRole = iRole;
-	LOGTEXT2(_L8("\trole=%d"), aRole);
+	OstTrace1( TRACE_NORMAL, CREGISTRATIONPORT_GETROLE, "CRegistrationPort::GetRole;aRole=%d", (TInt)aRole );
+	OstTraceFunctionExit0( CREGISTRATIONPORT_GETROLE_EXIT );
 	return KErrNone;
 	}
 
@@ -490,14 +502,14 @@
  * @return Error
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_SETROLE_ENTRY );
 	// This is required to keep C32 happy while opening the port.
 	// All we do is store the role and return it if asked.
 	// Note that this is needed for multiple ACM ports because C32 doesn't 
 	// check the return value for multiple ports so opening registration port 
 	// more than once will fail.
 	iRole = aRole;
+	OstTraceFunctionExit0( CREGISTRATIONPORT_SETROLE_EXIT );
 	return KErrNone; 
 	}
 
@@ -506,7 +518,8 @@
  * Destructor.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CREGISTRATIONPORT_CREGISTRATIONPORT_DES_ENTRY );
+	OstTraceFunctionExit0( CREGISTRATIONPORT_CREGISTRATIONPORT_DES_EXIT );
 	}
 
 //
--- a/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/RequestHeader.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/RequestHeader.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -16,6 +16,11 @@
 */
 
 #include "RequestHeader.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "RequestHeaderTraces.h"
+#endif
+
 
 const TDesC8& TUsbRequestHdr::Des()
 /**
@@ -26,6 +31,7 @@
  * this class and has the same lifetime.
  */
 	{
+	OstTraceFunctionEntry0( TUSBREQUESTHDR_DES_ENTRY );
 	iBuffer.SetLength(KUsbRequestHdrSize);
 
 	iBuffer[0] = iRequestType;
@@ -37,6 +43,7 @@
 	iBuffer[6] = static_cast<TUint8>(iLength & 0x00ff);
 	iBuffer[7] = static_cast<TUint8>((iLength & 0xff00) >> 8);
 
+	OstTraceFunctionExit0( TUSBREQUESTHDR_DES_EXIT );
 	return iBuffer;
 	}
 
@@ -50,14 +57,20 @@
  * @return Error.
  */
 	{
+	OstTraceFunctionEntry0( TUSBREQUESTHDR_DECODE_ENTRY );
+	
 	if (aBuffer.Length() < static_cast<TInt>(KUsbRequestHdrSize))
+		{
+		OstTraceFunctionExit0( TUSBREQUESTHDR_DECODE_EXIT );
 		return KErrGeneral;
+		}
 
 	aTarget.iRequestType = aBuffer[0];
 	aTarget.iRequest = aBuffer[1];
 	aTarget.iValue	 = static_cast<TUint16>(aBuffer[2] + (aBuffer[3] << 8));
 	aTarget.iIndex	 = static_cast<TUint16>(aBuffer[4] + (aBuffer[5] << 8));
 	aTarget.iLength  = static_cast<TUint16>(aBuffer[6] + (aBuffer[7] << 8));
+	OstTraceFunctionExit0( TUSBREQUESTHDR_DECODE_EXIT_DUP1 );
 	return KErrNone;
 	}
 
@@ -68,6 +81,7 @@
  * @return TBool	Flag indicating whether a data response required.
  */
 	{
+	OstTraceFunctionEntry0( TUSBREQUESTHDR_ISDATARESPONSEREQUIRED_ENTRY );
 	return (iRequestType & 0x80) ? ETrue : EFalse;
 	}
 
--- a/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/acmserver.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/acmserver.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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,19 +21,19 @@
  @internalComponent
 */
 
-#include <usb/usblogger.h>
 #include "acmserver.h"
 #include "acmsession.h"
 #include "acmserversecuritypolicy.h"
 #include "acmserverconsts.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "acmserverTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "ECACM");
-#endif
 
 CAcmServer* CAcmServer::NewL(MAcmController& aAcmController)
 	{
-	LOG_STATIC_FUNC_ENTRY
+	OstTraceFunctionEntry0( CACMSERVER_NEWL_ENTRY );
 
 	CAcmServer* self = new(ELeave) CAcmServer(aAcmController);
 	CleanupStack::PushL(self);
@@ -42,33 +42,43 @@
 	// code).
 	if ( err != KErrAlreadyExists )
 		{
-		LEAVEIFERRORL(err);
+		if (err < 0)
+			{
+			OstTrace1( TRACE_ERROR, CACMSERVER_NEWL, "CAcmServer::NewL;err=%d", err );
+			User::Leave(err);
+			}
 		}
 	CleanupStack::Pop(self);
+	OstTraceFunctionExit0( CACMSERVER_NEWL_EXIT );
 	return self;
 	}
 
 CAcmServer::~CAcmServer()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CACMSERVER_CACMSERVER_DES_ENTRY );
+	OstTraceFunctionExit0( CACMSERVER_CACMSERVER_DES_EXIT );
 	}
 
 CAcmServer::CAcmServer(MAcmController& aAcmController)
  :	CPolicyServer(CActive::EPriorityStandard, KAcmServerPolicy),
  	iAcmController(aAcmController)
  	{
+	OstTraceFunctionEntry0( CACMSERVER_CACMSERVER_CONS_ENTRY );
+	OstTraceFunctionExit0( CACMSERVER_CACMSERVER_CONS_EXIT );
 	}
 
 CSession2* CAcmServer::NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMSERVER_NEWSESSIONL_ENTRY );
 	//Validate session as coming from UsbSvr
 	static _LIT_SECURITY_POLICY_S0(KSidPolicy, 0x101fe1db);
 	TBool auth = KSidPolicy.CheckPolicy(aMessage);
 	if(!auth)
 		{
-		LEAVEIFERRORL(KErrPermissionDenied);
+		OstTrace1( TRACE_ERROR, CACMSERVER_NEWSESSIONL_DUP1, 
+							"CAcmServer::NewSessionL;KErrPermissionDenied=%d", 
+							KErrPermissionDenied );
+		User::Leave(KErrPermissionDenied);
 		}
 
 	// Version number check...
@@ -78,10 +88,14 @@
 
 	if ( !User::QueryVersionSupported(v, aVersion) )
 		{
-		LEAVEIFERRORL(KErrNotSupported);
+		OstTrace1( TRACE_ERROR, CACMSERVER_NEWSESSIONL_DUP2, 
+							"CAcmServer::NewSessionL;KErrNotSupported=%d", 
+							KErrNotSupported );
+		User::Leave(KErrNotSupported);
 		}
 
 	CAcmSession* sess = CAcmSession::NewL(iAcmController);
-	LOGTEXT2(_L8("\tsess = 0x%08x"), sess);
+	OstTraceExt1( TRACE_NORMAL, CACMSERVER_NEWSESSIONL, "CAcmServer::NewSessionL;sess=%p", sess );
+	OstTraceFunctionExit0( CACMSERVER_NEWSESSIONL_EXIT );
 	return sess;
 	}
--- a/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/acmsession.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/acmsession.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2005-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"
@@ -24,37 +24,37 @@
 #include "acmserverconsts.h"
 #include "acmsession.h"
 #include "AcmPortFactory.h"
-#include <usb/usblogger.h>
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "acmsessionTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "ECACM");
-#endif
 
 CAcmSession* CAcmSession::NewL(MAcmController& aAcmController)
 	{
-	LOG_STATIC_FUNC_ENTRY
-
+	OstTraceFunctionEntry0( CACMSESSION_NEWL_ENTRY );
 	CAcmSession* self = new(ELeave) CAcmSession(aAcmController);
+	OstTraceFunctionExit0( CACMSESSION_NEWL_EXIT );
 	return self;
 	}
 
 CAcmSession::CAcmSession(MAcmController& aAcmController)
  :	iAcmController(aAcmController)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CACMSESSION_CACMSESSION_CONS_ENTRY );
+	OstTraceFunctionExit0( CACMSESSION_CACMSESSION_CONS_EXIT );
 	}
 
 CAcmSession::~CAcmSession()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CACMSESSION_CACMSESSION_DES_ENTRY );	
+	OstTraceFunctionExit0( CACMSESSION_CACMSESSION_DES_EXIT );
 	}
 	
 void CAcmSession::CreateFunctionsL(const RMessage2& aMessage)
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACMSESSION_CREATEFUNCTIONSL_ENTRY );
 	RBuf acmControlIfcName, acmDataIfcName;
-
 	TInt size = aMessage.GetDesLengthL(2);
 	acmControlIfcName.CreateL(size);
 	acmControlIfcName.CleanupClosePushL();
@@ -65,19 +65,27 @@
 	acmDataIfcName.CleanupClosePushL();
 	aMessage.ReadL(3, acmDataIfcName);
 
-	LOGTEXT5(_L("\taNoAcms = %d, aProtocolNum = %d, Control Ifc Name = %S, Data Ifc Name = %S"),
-			aMessage.Int0(), aMessage.Int1(), &acmControlIfcName, &acmDataIfcName);
+	OstTraceExt4( TRACE_DUMP, CACMSESSION_CREATEFUNCTIONSL, 
+			"CAcmSession::CreateFunctionsL;\taNoAcms = %d, aProtocolNum = %d, "
+			"Control Ifc Name = %S, Data Ifc Name = %S", 
+			aMessage.Int0(), aMessage.Int1(), acmControlIfcName, acmDataIfcName );
+	
 
-	LEAVEIFERRORL(iAcmController.CreateFunctions(aMessage.Int0(), aMessage.Int1(), acmControlIfcName, acmDataIfcName));
+	TInt err = iAcmController.CreateFunctions(aMessage.Int0(), aMessage.Int1(), acmControlIfcName, acmDataIfcName);
+	if (err < 0)
+		{
+		OstTrace1( TRACE_NORMAL, CACMSESSION_CREATEFUNCTIONSL_DUP1, "CAcmSession::CreateFunctionsL;err=%d", err );
+		User::Leave(err);
+		}
 
 	CleanupStack::PopAndDestroy(2);
+	OstTraceFunctionExit0( CACMSESSION_CREATEFUNCTIONSL_EXIT );
 	}
 
 void CAcmSession::ServiceL(const RMessage2& aMessage)
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8("\taMessage.Function() = %d"), aMessage.Function());
-
+	OstTraceFunctionEntry0( CACMSESSION_SERVICEL_ENTRY );
+	OstTrace1( TRACE_NORMAL, CACMSESSION_SERVICEL, "CAcmSession::ServiceL;aMessage.Function()=%d", aMessage.Function() );
 	switch ( aMessage.Function() )
 		{
 	case EAcmCreateAcmFunctions:
@@ -99,4 +107,5 @@
 		aMessage.Panic(KAcmSrvPanic, EAcmBadAcmMessage);
 		break;
 		}
+	OstTraceFunctionExit0( CACMSESSION_SERVICEL_EXIT );
 	}
--- a/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/linkstatenotifier.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/linkstatenotifier.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-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"
@@ -17,19 +17,19 @@
 
 #include <e32base.h>
 #include <d32usbc.h>
-#include <usb/usblogger.h>
 #include "AcmPanic.h"
 #include "linkstatenotifier.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "linkstatenotifierTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "ECACM");
-#endif
 
 CLinkStateNotifier* CLinkStateNotifier::NewL(MLinkStateObserver& aParent, RDevUsbcClient& aUsb)
 	{
-	LOG_STATIC_FUNC_ENTRY
-	
+	OstTraceFunctionEntry0( CLINKSTATENOTIFIER_NEWL_ENTRY );
 	CLinkStateNotifier* self = new (ELeave) CLinkStateNotifier(aParent, aUsb);
+	OstTraceFunctionExit0( CLINKSTATENOTIFIER_NEWL_EXIT );
 	return self;
 	}
 
@@ -38,9 +38,9 @@
 	 : CActive(EPriorityStandard),
 	   iParent(aParent), iUsb(aUsb)
 	{
-	LOG_FUNC
-	
+	OstTraceFunctionEntry0( CLINKSTATENOTIFIER_CLINKSTATENOTIFIER_CONS_ENTRY );
 	CActiveScheduler::Add(this);
+	OstTraceFunctionExit0( CLINKSTATENOTIFIER_CLINKSTATENOTIFIER_CONS_EXIT );
 	}
 
 
@@ -50,8 +50,9 @@
 */
 CLinkStateNotifier::~CLinkStateNotifier()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CLINKSTATENOTIFIER_CLINKSTATENOTIFIER_DES_ENTRY );
 	Cancel();
+	OstTraceFunctionExit0( CLINKSTATENOTIFIER_CLINKSTATENOTIFIER_DES_EXIT );
 	}
 
 
@@ -62,6 +63,8 @@
 */
 TInt CLinkStateNotifier::RunError(TInt /*aError*/)
 	{
+	OstTraceFunctionEntry0( CLINKSTATENOTIFIER_RUNERROR_ENTRY );
+	OstTraceFunctionExit0( CLINKSTATENOTIFIER_RUNERROR_EXIT );
 	return KErrNone;
 	}
 
@@ -72,14 +75,16 @@
 */
 void CLinkStateNotifier::RunL()
 	{
-	LOGTEXT2(_L8("CObexUsbHandler::RunL called state=0x%X"), iUsbState);
+	OstTraceFunctionEntry0( CLINKSTATENOTIFIER_RUNL_ENTRY );
+	OstTrace1( TRACE_NORMAL, CLINKSTATENOTIFIER_RUNL, "CLinkStateNotifier::RunL;called state=0x%X", iUsbState );
 	
 	if (iStatus != KErrNone)
 		{
-		LOGTEXT2(_L8("CObexUsbHandler::RunL() - Error = %d"),iStatus.Int());
+		OstTrace1( TRACE_NORMAL, CLINKSTATENOTIFIER_RUNL_DUP1, "CLinkStateNotifier::RunL;- Error = %d", iStatus.Int() );
 		LinkDown();
 		iParent.MLSOStateChange(KDefaultMaxPacketTypeBulk);
 
+		OstTraceFunctionExit0( CLINKSTATENOTIFIER_RUNL_EXIT );
 		return;
 		}
 
@@ -105,7 +110,8 @@
 			break;
 
 		default:
-			__ASSERT_DEBUG(false, _USB_PANIC(KAcmPanicCat, EPanicUnknownDeviceState));
+			OstTrace0( TRACE_FATAL, CLINKSTATENOTIFIER_RUNL_DUP2, "CLinkStateNotifier::RunL;EPanicUnknownDeviceState" );
+			__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicUnknownDeviceState) );
 			break;
 			}
 		}
@@ -115,6 +121,7 @@
 	// Await further notification of a state change.
 	iUsb.AlternateDeviceStatusNotify(iStatus, iUsbState);
 	SetActive();
+	OstTraceFunctionExit0( CLINKSTATENOTIFIER_RUNL_EXIT_DUP1 );
 	}
 
 
@@ -123,9 +130,9 @@
 */
 void CLinkStateNotifier::DoCancel()
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CLINKSTATENOTIFIER_DOCANCEL_ENTRY );
 	iUsb.AlternateDeviceStatusNotifyCancel();
+	OstTraceFunctionExit0( CLINKSTATENOTIFIER_DOCANCEL_EXIT );
 	}
 
 
@@ -135,14 +142,16 @@
 */
 void CLinkStateNotifier::Start()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CLINKSTATENOTIFIER_START_ENTRY );
 	iUsb.AlternateDeviceStatusNotify(iStatus, iUsbState);
 	SetActive();
+	OstTraceFunctionExit0( CLINKSTATENOTIFIER_START_EXIT );
 	}
 
 
 void CLinkStateNotifier::LinkUp()
 	{
+	OstTraceFunctionEntry0( CLINKSTATENOTIFIER_LINKUP_ENTRY );
 	if (iUsb.CurrentlyUsingHighSpeed())
 		{
 		iPacketSize = KMaxPacketTypeBulkHS;
@@ -151,10 +160,13 @@
 		{
 		iPacketSize = KMaxPacketTypeBulkFS;
 		}
+	OstTraceFunctionExit0( CLINKSTATENOTIFIER_LINKUP_EXIT );
 	}
 
 
 void CLinkStateNotifier::LinkDown()
 	{
+	OstTraceFunctionEntry0( CLINKSTATENOTIFIER_LINKDOWN_ENTRY );
 	iPacketSize = 0;
+	OstTraceFunctionExit0( CLINKSTATENOTIFIER_LINKDOWN_EXIT );
 	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/traces/OstTraceDefinitions.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,7 @@
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <opensystemtrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/traces/fixed_id.definitions	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,1126 @@
+#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt.
+[GROUP]TRACE_DUMP=0x89
+[GROUP]TRACE_ERROR=0x82
+[GROUP]TRACE_FATAL=0x81
+[GROUP]TRACE_FLOW=0x8a
+[GROUP]TRACE_NORMAL=0x86
+[TRACE]TRACE_DUMP[0x89]_CACMPORT_HANDLECONFIGNOTIFICATION=0xc
+[TRACE]TRACE_DUMP[0x89]_CACMPORT_HANDLECONFIGNOTIFICATION_DUP1=0xd
+[TRACE]TRACE_DUMP[0x89]_CACMPORT_HANDLECONFIGNOTIFICATION_DUP2=0xe
+[TRACE]TRACE_DUMP[0x89]_CACMPORT_HANDLECONFIGNOTIFICATION_DUP3=0xf
+[TRACE]TRACE_DUMP[0x89]_CACMPORT_HANDLECONFIGNOTIFICATION_DUP4=0x10
+[TRACE]TRACE_DUMP[0x89]_CACMPORT_HANDLECONFIGNOTIFICATION_DUP5=0x11
+[TRACE]TRACE_DUMP[0x89]_CACMPORT_SETCONFIG_DUP10=0x8
+[TRACE]TRACE_DUMP[0x89]_CACMPORT_SETCONFIG_DUP11=0x9
+[TRACE]TRACE_DUMP[0x89]_CACMPORT_SETCONFIG_DUP12=0xa
+[TRACE]TRACE_DUMP[0x89]_CACMPORT_SETCONFIG_DUP13=0xb
+[TRACE]TRACE_DUMP[0x89]_CACMPORT_SETCONFIG_DUP3=0x1
+[TRACE]TRACE_DUMP[0x89]_CACMPORT_SETCONFIG_DUP4=0x2
+[TRACE]TRACE_DUMP[0x89]_CACMPORT_SETCONFIG_DUP5=0x3
+[TRACE]TRACE_DUMP[0x89]_CACMPORT_SETCONFIG_DUP6=0x4
+[TRACE]TRACE_DUMP[0x89]_CACMPORT_SETCONFIG_DUP7=0x5
+[TRACE]TRACE_DUMP[0x89]_CACMPORT_SETCONFIG_DUP8=0x6
+[TRACE]TRACE_DUMP[0x89]_CACMPORT_SETCONFIG_DUP9=0x7
+[TRACE]TRACE_DUMP[0x89]_CACMREADER_ISSUEREAD=0x18
+[TRACE]TRACE_DUMP[0x89]_CACMREADER_ISSUEREADONEORMORE=0x1d
+[TRACE]TRACE_DUMP[0x89]_CACMREADER_ISSUEREADONEORMORE_DUP1=0x1e
+[TRACE]TRACE_DUMP[0x89]_CACMREADER_ISSUEREADONEORMORE_DUP2=0x1f
+[TRACE]TRACE_DUMP[0x89]_CACMREADER_ISSUEREADONEORMORE_DUP3=0x20
+[TRACE]TRACE_DUMP[0x89]_CACMREADER_ISSUEREADONEORMORE_DUP4=0x21
+[TRACE]TRACE_DUMP[0x89]_CACMREADER_ISSUEREAD_DUP1=0x19
+[TRACE]TRACE_DUMP[0x89]_CACMREADER_ISSUEREAD_DUP2=0x1a
+[TRACE]TRACE_DUMP[0x89]_CACMREADER_ISSUEREAD_DUP3=0x1b
+[TRACE]TRACE_DUMP[0x89]_CACMREADER_ISSUEREAD_DUP4=0x1c
+[TRACE]TRACE_DUMP[0x89]_CACMREADER_WRITEBACKDATA=0x12
+[TRACE]TRACE_DUMP[0x89]_CACMREADER_WRITEBACKDATA_DUP1=0x13
+[TRACE]TRACE_DUMP[0x89]_CACMREADER_WRITEBACKDATA_DUP2=0x14
+[TRACE]TRACE_DUMP[0x89]_CACMREADER_WRITEBACKDATA_DUP3=0x15
+[TRACE]TRACE_DUMP[0x89]_CACMREADER_WRITEBACKDATA_DUP4=0x16
+[TRACE]TRACE_DUMP[0x89]_CACMREADER_WRITEBACKDATA_DUP5=0x17
+[TRACE]TRACE_DUMP[0x89]_CACMSESSION_CREATEFUNCTIONSL=0x29
+[TRACE]TRACE_DUMP[0x89]_CCDCCONTROLINTERFACE_SENDSERIALSTATE=0x22
+[TRACE]TRACE_DUMP[0x89]_CCDCCONTROLINTERFACE_SENDSERIALSTATE_DUP1=0x23
+[TRACE]TRACE_DUMP[0x89]_CCDCCONTROLINTERFACE_SENDSERIALSTATE_DUP2=0x24
+[TRACE]TRACE_DUMP[0x89]_CCDCCONTROLINTERFACE_SENDSERIALSTATE_DUP3=0x25
+[TRACE]TRACE_DUMP[0x89]_CCDCCONTROLINTERFACE_SENDSERIALSTATE_DUP4=0x26
+[TRACE]TRACE_DUMP[0x89]_CCDCCONTROLINTERFACE_SENDSERIALSTATE_DUP5=0x27
+[TRACE]TRACE_DUMP[0x89]_CCDCCONTROLINTERFACE_SENDSERIALSTATE_DUP6=0x28
+[TRACE]TRACE_ERROR[0x82]_CACMPORTFACTORY_CREATEFUNCTIONL_DUP4=0x3
+[TRACE]TRACE_ERROR[0x82]_CACMPORTFACTORY_CREATEFUNCTIONL_DUP5=0x4
+[TRACE]TRACE_ERROR[0x82]_CACMPORTFACTORY_NEWPORTL_DUP2=0x1
+[TRACE]TRACE_ERROR[0x82]_CACMPORTFACTORY_NEWPORTL_DUP3=0x2
+[TRACE]TRACE_ERROR[0x82]_CACMREADER_CONSTRUCTL_DUP1=0x5
+[TRACE]TRACE_ERROR[0x82]_CACMSERVER_NEWL=0x7
+[TRACE]TRACE_ERROR[0x82]_CACMSERVER_NEWSESSIONL_DUP1=0x8
+[TRACE]TRACE_ERROR[0x82]_CACMSERVER_NEWSESSIONL_DUP2=0x9
+[TRACE]TRACE_ERROR[0x82]_CACMWRITER_CONSTRUCTL_DUP1=0x6
+[TRACE]TRACE_FATAL[0x81]_CACMPORT_CONSTRUCTL=0x1
+[TRACE]TRACE_FATAL[0x81]_CACMPORT_DOSETBUFFERLENGTHS_DUP5=0xa
+[TRACE]TRACE_FATAL[0x81]_CACMPORT_DOSETBUFFERLENGTHS_DUP6=0xb
+[TRACE]TRACE_FATAL[0x81]_CACMPORT_DOSETBUFFERLENGTHS_DUP7=0xc
+[TRACE]TRACE_FATAL[0x81]_CACMPORT_GETRECEIVEBUFFERLENGTH_DUP2=0x9
+[TRACE]TRACE_FATAL[0x81]_CACMPORT_NOTIFYBREAK_DUP1=0xf
+[TRACE]TRACE_FATAL[0x81]_CACMPORT_NOTIFYDATAAVAILABLECANCEL_DUP1=0xe
+[TRACE]TRACE_FATAL[0x81]_CACMPORT_NOTIFYDATAAVAILABLE_DUP1=0xd
+[TRACE]TRACE_FATAL[0x81]_CACMPORT_QUERYRECEIVEBUFFER_DUP2=0x4
+[TRACE]TRACE_FATAL[0x81]_CACMPORT_READCANCEL_DUP1=0x3
+[TRACE]TRACE_FATAL[0x81]_CACMPORT_RESETBUFFERS_DUP3=0x5
+[TRACE]TRACE_FATAL[0x81]_CACMPORT_RESETBUFFERS_DUP4=0x6
+[TRACE]TRACE_FATAL[0x81]_CACMPORT_SETACM_DUP4=0x10
+[TRACE]TRACE_FATAL[0x81]_CACMPORT_SETACM_DUP5=0x11
+[TRACE]TRACE_FATAL[0x81]_CACMPORT_SETACM_DUP6=0x12
+[TRACE]TRACE_FATAL[0x81]_CACMPORT_STARTREAD_DUP3=0x2
+[TRACE]TRACE_FATAL[0x81]_CACMPORT_STARTWRITE_DUP3=0x7
+[TRACE]TRACE_FATAL[0x81]_CACMPORT_WRITECANCEL_DUP1=0x8
+[TRACE]TRACE_FATAL[0x81]_CACMREADER_CHECKBUFFEREMPTYANDRESETPTRS=0x16
+[TRACE]TRACE_FATAL[0x81]_CACMREADER_CHECKNEWREQUEST=0x17
+[TRACE]TRACE_FATAL[0x81]_CACMREADER_CHECKNEWREQUEST_DUP1=0x18
+[TRACE]TRACE_FATAL[0x81]_CACMREADER_CHECKNEWREQUEST_DUP2=0x1a
+[TRACE]TRACE_FATAL[0x81]_CACMREADER_CHECKNEWREQUEST_DUP3=0x19
+[TRACE]TRACE_FATAL[0x81]_CACMREADER_FINDTERMINATOR_DUP1=0x23
+[TRACE]TRACE_FATAL[0x81]_CACMREADER_ISSUEREADONEORMORE_DUP5=0x22
+[TRACE]TRACE_FATAL[0x81]_CACMREADER_ISSUEREAD_DUP5=0x21
+[TRACE]TRACE_FATAL[0x81]_CACMREADER_PARTIALFINDTERMINATOR_DUP3=0x24
+[TRACE]TRACE_FATAL[0x81]_CACMREADER_READCOMPLETED_DUP3=0x15
+[TRACE]TRACE_FATAL[0x81]_CACMREADER_RESETBUFFER=0x13
+[TRACE]TRACE_FATAL[0x81]_CACMREADER_SETTERMINATORS_DUP2=0x14
+[TRACE]TRACE_FATAL[0x81]_CACMREADER_WRITEBACKDATA_DUP15=0x1b
+[TRACE]TRACE_FATAL[0x81]_CACMREADER_WRITEBACKDATA_DUP16=0x1c
+[TRACE]TRACE_FATAL[0x81]_CACMREADER_WRITEBACKDATA_DUP17=0x1d
+[TRACE]TRACE_FATAL[0x81]_CACMREADER_WRITEBACKDATA_DUP18=0x1e
+[TRACE]TRACE_FATAL[0x81]_CACMREADER_WRITEBACKDATA_DUP19=0x1f
+[TRACE]TRACE_FATAL[0x81]_CACMREADER_WRITEBACKDATA_DUP20=0x20
+[TRACE]TRACE_FATAL[0x81]_CACMWRITER_CHECKNEWREQUEST=0x27
+[TRACE]TRACE_FATAL[0x81]_CACMWRITER_CHECKNEWREQUEST_DUP1=0x28
+[TRACE]TRACE_FATAL[0x81]_CACMWRITER_CHECKNEWREQUEST_DUP2=0x29
+[TRACE]TRACE_FATAL[0x81]_CACMWRITER_ISSUEWRITE_DUP1=0x2a
+[TRACE]TRACE_FATAL[0x81]_CACMWRITER_ISSUEWRITE_DUP2=0x2b
+[TRACE]TRACE_FATAL[0x81]_CACMWRITER_READDATAFROMCLIENT_DUP1=0x26
+[TRACE]TRACE_FATAL[0x81]_CACMWRITER_RESETBUFFER=0x25
+[TRACE]TRACE_FATAL[0x81]_CBREAKCONTROLLER_PUBLISH=0x2e
+[TRACE]TRACE_FATAL[0x81]_CBREAKCONTROLLER_RUNL=0x2c
+[TRACE]TRACE_FATAL[0x81]_CBREAKCONTROLLER_STATEMACHINE=0x2d
+[TRACE]TRACE_FATAL[0x81]_CCDCACMCLASS_BREAKREQUEST=0x34
+[TRACE]TRACE_FATAL[0x81]_CCDCACMCLASS_NOTIFYDATAAVAILABLECANCEL=0x36
+[TRACE]TRACE_FATAL[0x81]_CCDCACMCLASS_NOTIFYDATAAVAILABLE_DUP1=0x35
+[TRACE]TRACE_FATAL[0x81]_CCDCACMCLASS_READCANCEL=0x31
+[TRACE]TRACE_FATAL[0x81]_CCDCACMCLASS_READONEORMORE_MREADONEORMOREOBSERVERREF_TDES8REF_TINT_DUP1=0x2f
+[TRACE]TRACE_FATAL[0x81]_CCDCACMCLASS_READ_DUP2=0x30
+[TRACE]TRACE_FATAL[0x81]_CCDCACMCLASS_WRITECANCEL=0x33
+[TRACE]TRACE_FATAL[0x81]_CCDCACMCLASS_WRITE_DUP2=0x32
+[TRACE]TRACE_FATAL[0x81]_CCDCCONTROLINTERFACEREADER_HANDLEREADCOMPLETION_DUP3=0x38
+[TRACE]TRACE_FATAL[0x81]_CCDCCONTROLINTERFACE_SETUPINTERFACE_DUP6=0x37
+[TRACE]TRACE_FATAL[0x81]_CCDCDATAINTERFACE_CANCELNOTIFYDATAAVAILABLE=0x53
+[TRACE]TRACE_FATAL[0x81]_CCDCDATAINTERFACE_CANCELREAD=0x4f
+[TRACE]TRACE_FATAL[0x81]_CCDCDATAINTERFACE_CANCELREAD_DUP1=0x50
+[TRACE]TRACE_FATAL[0x81]_CCDCDATAINTERFACE_CANCELWRITE=0x41
+[TRACE]TRACE_FATAL[0x81]_CCDCDATAINTERFACE_NOTIFYDATAAVAILABLE=0x51
+[TRACE]TRACE_FATAL[0x81]_CCDCDATAINTERFACE_NOTIFYDATAAVAILABLE_DUP1=0x52
+[TRACE]TRACE_FATAL[0x81]_CCDCDATAINTERFACE_READCOMPLETED_DUP2=0x4d
+[TRACE]TRACE_FATAL[0x81]_CCDCDATAINTERFACE_READCOMPLETED_DUP4=0x4e
+[TRACE]TRACE_FATAL[0x81]_CCDCDATAINTERFACE_READONEORMORECOMPLETED_DUP2=0x4a
+[TRACE]TRACE_FATAL[0x81]_CCDCDATAINTERFACE_READONEORMORECOMPLETED_DUP3=0x4b
+[TRACE]TRACE_FATAL[0x81]_CCDCDATAINTERFACE_READONEORMORECOMPLETED_DUP4=0x4c
+[TRACE]TRACE_FATAL[0x81]_CCDCDATAINTERFACE_READONEORMORE_DUP1=0x46
+[TRACE]TRACE_FATAL[0x81]_CCDCDATAINTERFACE_READONEORMORE_DUP2=0x47
+[TRACE]TRACE_FATAL[0x81]_CCDCDATAINTERFACE_READONEORMORE_DUP3=0x48
+[TRACE]TRACE_FATAL[0x81]_CCDCDATAINTERFACE_READONEORMORE_DUP4=0x49
+[TRACE]TRACE_FATAL[0x81]_CCDCDATAINTERFACE_READ_DUP1=0x42
+[TRACE]TRACE_FATAL[0x81]_CCDCDATAINTERFACE_READ_DUP2=0x43
+[TRACE]TRACE_FATAL[0x81]_CCDCDATAINTERFACE_READ_DUP3=0x44
+[TRACE]TRACE_FATAL[0x81]_CCDCDATAINTERFACE_READ_DUP4=0x45
+[TRACE]TRACE_FATAL[0x81]_CCDCDATAINTERFACE_SETUPINTERFACE_DUP5=0x39
+[TRACE]TRACE_FATAL[0x81]_CCDCDATAINTERFACE_WRITE=0x3a
+[TRACE]TRACE_FATAL[0x81]_CCDCDATAINTERFACE_WRITECOMPLETED_DUP1=0x3c
+[TRACE]TRACE_FATAL[0x81]_CCDCDATAINTERFACE_WRITECOMPLETED_DUP3=0x3d
+[TRACE]TRACE_FATAL[0x81]_CCDCDATAINTERFACE_WRITECOMPLETED_DUP5=0x3e
+[TRACE]TRACE_FATAL[0x81]_CCDCDATAINTERFACE_WRITECOMPLETED_DUP6=0x3f
+[TRACE]TRACE_FATAL[0x81]_CCDCDATAINTERFACE_WRITECOMPLETED_DUP7=0x40
+[TRACE]TRACE_FATAL[0x81]_CCDCDATAINTERFACE_WRITE_DUP1=0x3b
+[TRACE]TRACE_FATAL[0x81]_CLINKSTATENOTIFIER_RUNL_DUP2=0x55
+[TRACE]TRACE_FATAL[0x81]_TUSBCSCLASSDESCRIPTOR_DES=0x54
+[TRACE]TRACE_FLOW[0x8A]_CACMPORTFACTORY_ACMPORTCLOSED_ENTRY=0x97
+[TRACE]TRACE_FLOW[0x8A]_CACMPORTFACTORY_ACMPORTCLOSED_EXIT=0x98
+[TRACE]TRACE_FLOW[0x8A]_CACMPORTFACTORY_CACMPORTFACTORY_ENTRY=0x91
+[TRACE]TRACE_FLOW[0x8A]_CACMPORTFACTORY_CACMPORTFACTORY_EXIT=0x92
+[TRACE]TRACE_FLOW[0x8A]_CACMPORTFACTORY_CHECKACMARRAY_ENTRY=0x9f
+[TRACE]TRACE_FLOW[0x8A]_CACMPORTFACTORY_CHECKACMARRAY_EXIT=0xa0
+[TRACE]TRACE_FLOW[0x8A]_CACMPORTFACTORY_CONSTRUCTL_ENTRY=0x93
+[TRACE]TRACE_FLOW[0x8A]_CACMPORTFACTORY_CONSTRUCTL_EXIT=0x94
+[TRACE]TRACE_FLOW[0x8A]_CACMPORTFACTORY_CREATEFUNCTIONL_ENTRY=0xa3
+[TRACE]TRACE_FLOW[0x8A]_CACMPORTFACTORY_CREATEFUNCTIONL_EXIT=0xa4
+[TRACE]TRACE_FLOW[0x8A]_CACMPORTFACTORY_CREATEFUNCTIONS_ENTRY=0xa1
+[TRACE]TRACE_FLOW[0x8A]_CACMPORTFACTORY_CREATEFUNCTIONS_EXIT=0xa2
+[TRACE]TRACE_FLOW[0x8A]_CACMPORTFACTORY_DESTROYFUNCTIONS_ENTRY=0x9d
+[TRACE]TRACE_FLOW[0x8A]_CACMPORTFACTORY_DESTROYFUNCTIONS_EXIT=0x9e
+[TRACE]TRACE_FLOW[0x8A]_CACMPORTFACTORY_INFO_ENTRY=0xa5
+[TRACE]TRACE_FLOW[0x8A]_CACMPORTFACTORY_INFO_EXIT=0xa6
+[TRACE]TRACE_FLOW[0x8A]_CACMPORTFACTORY_LOGPORTSANDFUNCTIONS_ENTRY=0xa7
+[TRACE]TRACE_FLOW[0x8A]_CACMPORTFACTORY_LOGPORTSANDFUNCTIONS_EXIT=0xa8
+[TRACE]TRACE_FLOW[0x8A]_CACMPORTFACTORY_NEWL_ENTRY=0x8f
+[TRACE]TRACE_FLOW[0x8A]_CACMPORTFACTORY_NEWL_EXIT=0x90
+[TRACE]TRACE_FLOW[0x8A]_CACMPORTFACTORY_NEWPORTL_ENTRY=0x9b
+[TRACE]TRACE_FLOW[0x8A]_CACMPORTFACTORY_NEWPORTL_EXIT=0x9c
+[TRACE]TRACE_FLOW[0x8A]_CACMPORTFACTORY_PORTPLATSECCAPABILITY_ENTRY=0x95
+[TRACE]TRACE_FLOW[0x8A]_CACMPORTFACTORY_PORTPLATSECCAPABILITY_EXIT=0x96
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_BREAKCANCEL_ENTRY=0x1d
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_BREAKCANCEL_EXIT=0x1e
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_BREAKCANCEL_EXIT_DUP1=0x1f
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_BREAKREQUESTCOMPLETED_ENTRY=0x6e
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_BREAKREQUESTCOMPLETED_EXIT=0x6f
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_BREAKSTATECHANGE_ENTRY=0x70
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_BREAKSTATECHANGE_EXIT=0x71
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_BREAK_ENTRY=0x1a
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_BREAK_EXIT=0x1b
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_BREAK_EXIT_DUP1=0x1c
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_CACMPORT_CONS_ENTRY=0x5
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_CACMPORT_DESTRUCTRURE_ENTRY=0x8d
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_CACMPORT_DESTRUCTRURE_EXIT=0x8e
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_CACMPORT_DES_EXIT=0x6
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_CONSTRUCTL_ENTRY=0x3
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_CONSTRUCTL_EXIT=0x4
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_CONVERTANDFILTERSIGNALS_ENTRY=0x47
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_CONVERTANDFILTERSIGNALS_EXIT=0x48
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_CONVERTSIGNALS_ENTRY=0x49
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_CONVERTSIGNALS_EXIT=0x4a
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_DESTRUCT_ENTRY=0x56
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_DESTRUCT_EXIT=0x57
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_DOSETBUFFERLENGTHS_ENTRY=0x4e
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_DOSETBUFFERLENGTHS_EXIT=0x4f
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_DOSETBUFFERLENGTHS_EXIT_DUP1=0x50
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_DOSETBUFFERLENGTHS_EXIT_DUP2=0x51
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_DOSETBUFFERLENGTHS_EXIT_DUP3=0x52
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_FREEMEMORY_ENTRY=0x58
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_FREEMEMORY_EXIT=0x59
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_GETCAPS_ENTRY=0x34
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_GETCAPS_EXIT=0x35
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_GETCAPS_EXIT_DUP1=0x36
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_GETCAPS_EXIT_DUP2=0x37
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_GETCONFIG_ENTRY=0x20
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_GETCONFIG_EXIT=0x21
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_GETCONFIG_EXIT_DUP1=0x22
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_GETCONFIG_EXIT_DUP2=0x23
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_GETFLOWCONTROLSTATUS_ENTRY=0x60
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_GETFLOWCONTROLSTATUS_EXIT=0x61
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_GETFLOWCONTROLSTATUS_EXIT_DUP1=0x62
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_GETRECEIVEBUFFERLENGTH_ENTRY=0x4b
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_GETRECEIVEBUFFERLENGTH_EXIT=0x4c
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_GETRECEIVEBUFFERLENGTH_EXIT_DUP1=0x4d
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_GETROLE_ENTRY=0x86
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_GETROLE_EXIT=0x87
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_GETSERVERCONFIG_ENTRY=0x30
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_GETSERVERCONFIG_EXIT=0x31
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_GETSERVERCONFIG_EXIT_DUP1=0x32
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_GETSERVERCONFIG_EXIT_DUP2=0x33
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_GETSIGNALS_ENTRY=0x38
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_GETSIGNALS_EXIT=0x39
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_GETSIGNALS_EXIT_DUP1=0x3a
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_HANDLECONFIGNOTIFICATION_ENTRY=0x28
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_HANDLECONFIGNOTIFICATION_EXIT=0x29
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_HOSTCONFIGCHANGE_ENTRY=0x7d
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_HOSTCONFIGCHANGE_EXIT=0x7e
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_HOSTSIGNALCHANGE_ENTRY=0x84
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_HOSTSIGNALCHANGE_EXIT=0x85
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NEWL_ENTRY=0x1
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NEWL_EXIT=0x2
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NOTIFYBREAKCANCEL_ENTRY=0x6b
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NOTIFYBREAKCANCEL_EXIT=0x6c
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NOTIFYBREAKCANCEL_EXIT_DUP1=0x6d
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NOTIFYBREAK_ENTRY=0x68
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NOTIFYBREAK_EXIT=0x69
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NOTIFYBREAK_EXIT_DUP1=0x6a
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NOTIFYCONFIGCHANGECANCEL_ENTRY=0x7a
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NOTIFYCONFIGCHANGECANCEL_EXIT=0x7b
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NOTIFYCONFIGCHANGECANCEL_EXIT_DUP1=0x7c
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NOTIFYCONFIGCHANGE_ENTRY=0x77
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NOTIFYCONFIGCHANGE_EXIT=0x78
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NOTIFYCONFIGCHANGE_EXIT_DUP1=0x79
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NOTIFYDATAAVAILABLECANCEL_ENTRY=0x5d
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NOTIFYDATAAVAILABLECANCEL_EXIT=0x5e
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NOTIFYDATAAVAILABLECANCEL_EXIT_DUP1=0x5f
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NOTIFYDATAAVAILABLE_ENTRY=0x5a
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NOTIFYDATAAVAILABLE_EXIT=0x5b
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NOTIFYDATAAVAILABLE_EXIT_DUP1=0x5c
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NOTIFYFLOWCONTROLCHANGECANCEL_ENTRY=0x75
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NOTIFYFLOWCONTROLCHANGECANCEL_EXIT=0x76
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NOTIFYFLOWCONTROLCHANGE_ENTRY=0x72
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NOTIFYFLOWCONTROLCHANGE_EXIT=0x73
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NOTIFYFLOWCONTROLCHANGE_EXIT_DUP1=0x74
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NOTIFYOUTPUTEMPTYCANCEL_ENTRY=0x66
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NOTIFYOUTPUTEMPTYCANCEL_EXIT=0x67
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NOTIFYOUTPUTEMPTY_ENTRY=0x63
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NOTIFYOUTPUTEMPTY_EXIT=0x64
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NOTIFYOUTPUTEMPTY_EXIT_DUP1=0x65
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NOTIFYSIGNALCHANGECANCEL_ENTRY=0x81
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NOTIFYSIGNALCHANGECANCEL_EXIT=0x82
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NOTIFYSIGNALCHANGECANCEL_EXIT_DUP1=0x83
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NOTIFYSIGNALCHANGE_ENTRY=0x7f
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_NOTIFYSIGNALCHANGE_EXIT=0x80
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_QUERYRECEIVEBUFFER_ENTRY=0xe
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_QUERYRECEIVEBUFFER_EXIT=0xf
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_QUERYRECEIVEBUFFER_EXIT_DUP1=0x10
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_READCANCEL_ENTRY=0xb
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_READCANCEL_EXIT=0xc
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_READCANCEL_EXIT_DUP1=0xd
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_RESETBUFFERS_ENTRY=0x11
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_RESETBUFFERS_EXIT=0x12
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_SETACM_ENTRY=0x8b
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_SETACM_EXIT=0x8c
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_SETCONFIG_ENTRY=0x24
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_SETCONFIG_EXIT=0x25
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_SETCONFIG_EXIT_DUP1=0x26
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_SETCONFIG_EXIT_DUP2=0x27
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_SETRECEIVEBUFFERLENGTH_ENTRY=0x53
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_SETRECEIVEBUFFERLENGTH_EXIT=0x54
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_SETRECEIVEBUFFERLENGTH_EXIT_DUP1=0x55
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_SETROLE_ENTRY=0x89
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_SETROLE_EXIT=0x8a
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_SETSERVERCONFIG_ENTRY=0x2a
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_SETSERVERCONFIG_EXIT=0x2b
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_SETSERVERCONFIG_EXIT_DUP1=0x2c
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_SETSERVERCONFIG_EXIT_DUP2=0x2d
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_SETSERVERCONFIG_EXIT_DUP3=0x2e
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_SETSERVERCONFIG_EXIT_DUP4=0x2f
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_SETSIGNALSTOMARK_ENTRY=0x3b
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_SETSIGNALSTOMARK_EXIT=0x3c
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_SETSIGNALSTOMARK_EXIT_DUP1=0x3d
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_SETSIGNALSTOMARK_EXIT_DUP2=0x3e
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_SETSIGNALSTOSPACE_ENTRY=0x3f
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_SETSIGNALSTOSPACE_EXIT=0x40
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_SETSIGNALSTOSPACE_EXIT_DUP1=0x41
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_SETSIGNALSTOSPACE_EXIT_DUP2=0x42
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_SETSIGNALS_ENTRY=0x43
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_SETSIGNALS_EXIT=0x44
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_SETSIGNALS_EXIT_DUP1=0x45
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_SETSIGNALS_EXIT_DUP2=0x46
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_STARTREAD_ENTRY=0x7
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_STARTREAD_EXIT=0x8
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_STARTREAD_EXIT_DUP1=0x9
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_STARTREAD_EXIT_DUP2=0xa
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_STARTWRITE_ENTRY=0x13
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_STARTWRITE_EXIT=0x14
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_STARTWRITE_EXIT_DUP1=0x15
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_STARTWRITE_EXIT_DUP2=0x16
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_WRITECANCEL_ENTRY=0x17
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_WRITECANCEL_EXIT=0x18
+[TRACE]TRACE_FLOW[0x8A]_CACMPORT_WRITECANCEL_EXIT_DUP1=0x19
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_BUFLEN_ENTRY=0xc4
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_BUFLEN_EXIT=0xc5
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_CACMREADER_CONS_ENTRY=0xad
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_CACMREADER_CONS_EXIT=0xae
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_CACMREADER_DES_ENTRY=0xab
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_CACMREADER_DES_EXIT=0xac
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_CHECKBUFFEREMPTYANDRESETPTRS_ENTRY=0xd7
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_CHECKBUFFEREMPTYANDRESETPTRS_EXIT=0xd8
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_CHECKFORBUFFEREDTERMINATORSANDPROCEED_ENTRY=0xdb
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_CHECKFORBUFFEREDTERMINATORSANDPROCEED_EXIT=0xdc
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_CHECKNEWREQUEST_ENTRY=0xd9
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_CHECKNEWREQUEST_EXIT=0xda
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_COMPLETEREQUEST_ENTRY=0xdf
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_COMPLETEREQUEST_EXIT=0xe0
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_CONSTRUCTL_ENTRY=0xaf
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_CONSTRUCTL_EXIT=0xb0
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_FINDTERMINATOR_ENTRY=0xe5
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_FINDTERMINATOR_EXIT=0xe6
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_ISSUEREADONEORMORE_ENTRY=0xe3
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_ISSUEREADONEORMORE_EXIT=0xe4
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_ISSUEREAD_ENTRY=0xe1
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_ISSUEREAD_EXIT=0xe2
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_NEWL_ENTRY=0xa9
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_NEWL_EXIT=0xaa
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_NOTIFYDATAAVAILABLECANCEL_ENTRY=0xc0
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_NOTIFYDATAAVAILABLECANCEL_EXIT=0xc1
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_NOTIFYDATAAVAILABLECOMPLETED_ENTRY=0xd5
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_NOTIFYDATAAVAILABLECOMPLETED_EXIT=0xd6
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_NOTIFYDATAAVAILABLE_ENTRY=0xbd
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_NOTIFYDATAAVAILABLE_EXIT=0xbe
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_NOTIFYDATAAVAILABLE_EXIT_DUP1=0xbf
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_PARTIALFINDTERMINATOR_DUP1=0xe8
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_PARTIALFINDTERMINATOR_ENTRY=0xe7
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_PARTIALFINDTERMINATOR_EXIT=0xe9
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_PARTIALFINDTERMINATOR_EXIT_DUP2=0xea
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_READCANCEL_ENTRY=0xc2
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_READCANCEL_EXIT=0xc3
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_READCOMPLETED_ENTRY=0xce
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_READCOMPLETED_EXIT=0xcf
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_READCOMPLETED_EXIT_DUP1=0xd0
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_READONEORMORECOMPLETED_ENTRY=0xd1
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_READONEORMORECOMPLETED_EXIT=0xd2
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_READONEORMORECOMPLETED_EXIT_DUP1=0xd3
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_READONEORMORECOMPLETED_EXIT_DUP2=0xd4
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_READONEORMORE_DUP2=0xba
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_READONEORMORE_ENTRY=0xb9
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_READONEORMORE_EXIT=0xbb
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_READONEORMORE_EXIT_DUP1=0xbc
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_READWITHOUTTERMINATORS_ENTRY=0xb3
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_READWITHOUTTERMINATORS_EXIT=0xb4
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_READWITHOUTTERMINATORS_EXIT_DUP1=0xb5
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_READWITHTERMINATORS_ENTRY=0xb6
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_READWITHTERMINATORS_EXIT=0xb7
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_READWITHTERMINATORS_EXIT_DUP1=0xb8
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_READ_ENTRY=0xb1
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_READ_EXIT=0xb2
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_RESETBUFFER_ENTRY=0xc6
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_RESETBUFFER_EXIT=0xc7
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_SETBUFSIZE_ENTRY=0xc8
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_SETBUFSIZE_EXIT=0xc9
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_SETBUFSIZE_EXIT_DUP1=0xca
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_SETBUFSIZE_EXIT_DUP2=0xcb
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_SETTERMINATORS_ENTRY=0xcc
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_SETTERMINATORS_EXIT=0xcd
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_WRITEBACKDATA_ENTRY=0xdd
+[TRACE]TRACE_FLOW[0x8A]_CACMREADER_WRITEBACKDATA_EXIT=0xde
+[TRACE]TRACE_FLOW[0x8A]_CACMSERVER_CACMSERVER_CONS_ENTRY=0x263
+[TRACE]TRACE_FLOW[0x8A]_CACMSERVER_CACMSERVER_CONS_EXIT=0x264
+[TRACE]TRACE_FLOW[0x8A]_CACMSERVER_CACMSERVER_DES_ENTRY=0x261
+[TRACE]TRACE_FLOW[0x8A]_CACMSERVER_CACMSERVER_DES_EXIT=0x262
+[TRACE]TRACE_FLOW[0x8A]_CACMSERVER_NEWL_ENTRY=0x25f
+[TRACE]TRACE_FLOW[0x8A]_CACMSERVER_NEWL_EXIT=0x260
+[TRACE]TRACE_FLOW[0x8A]_CACMSERVER_NEWSESSIONL_ENTRY=0x265
+[TRACE]TRACE_FLOW[0x8A]_CACMSERVER_NEWSESSIONL_EXIT=0x266
+[TRACE]TRACE_FLOW[0x8A]_CACMSESSION_CACMSESSION_CONS_ENTRY=0x269
+[TRACE]TRACE_FLOW[0x8A]_CACMSESSION_CACMSESSION_CONS_EXIT=0x26a
+[TRACE]TRACE_FLOW[0x8A]_CACMSESSION_CACMSESSION_DES_ENTRY=0x26b
+[TRACE]TRACE_FLOW[0x8A]_CACMSESSION_CACMSESSION_DES_EXIT=0x26c
+[TRACE]TRACE_FLOW[0x8A]_CACMSESSION_CREATEFUNCTIONSL_ENTRY=0x26d
+[TRACE]TRACE_FLOW[0x8A]_CACMSESSION_CREATEFUNCTIONSL_EXIT=0x26e
+[TRACE]TRACE_FLOW[0x8A]_CACMSESSION_NEWL_ENTRY=0x267
+[TRACE]TRACE_FLOW[0x8A]_CACMSESSION_NEWL_EXIT=0x268
+[TRACE]TRACE_FLOW[0x8A]_CACMSESSION_SERVICEL_ENTRY=0x26f
+[TRACE]TRACE_FLOW[0x8A]_CACMSESSION_SERVICEL_EXIT=0x270
+[TRACE]TRACE_FLOW[0x8A]_CACMWRITER_CACMWRITER_CONS_ENTRY=0xf9
+[TRACE]TRACE_FLOW[0x8A]_CACMWRITER_CACMWRITER_CONS_EXIT=0xfa
+[TRACE]TRACE_FLOW[0x8A]_CACMWRITER_CACMWRITER_DES_ENTRY=0xed
+[TRACE]TRACE_FLOW[0x8A]_CACMWRITER_CACMWRITER_DES_EXIT=0xee
+[TRACE]TRACE_FLOW[0x8A]_CACMWRITER_CHECKNEWREQUEST_ENTRY=0x101
+[TRACE]TRACE_FLOW[0x8A]_CACMWRITER_CHECKNEWREQUEST_EXIT=0x102
+[TRACE]TRACE_FLOW[0x8A]_CACMWRITER_COMPLETEREQUEST_ENTRY=0x103
+[TRACE]TRACE_FLOW[0x8A]_CACMWRITER_COMPLETEREQUEST_EXIT=0x104
+[TRACE]TRACE_FLOW[0x8A]_CACMWRITER_CONSTRUCTL_ENTRY=0xfb
+[TRACE]TRACE_FLOW[0x8A]_CACMWRITER_CONSTRUCTL_EXIT=0xfc
+[TRACE]TRACE_FLOW[0x8A]_CACMWRITER_ISSUEWRITE_ENTRY=0x105
+[TRACE]TRACE_FLOW[0x8A]_CACMWRITER_ISSUEWRITE_EXIT=0x106
+[TRACE]TRACE_FLOW[0x8A]_CACMWRITER_NEWL_ENTRY=0xeb
+[TRACE]TRACE_FLOW[0x8A]_CACMWRITER_NEWL_EXIT=0xec
+[TRACE]TRACE_FLOW[0x8A]_CACMWRITER_READDATAFROMCLIENT_ENTRY=0xff
+[TRACE]TRACE_FLOW[0x8A]_CACMWRITER_READDATAFROMCLIENT_EXIT=0x100
+[TRACE]TRACE_FLOW[0x8A]_CACMWRITER_RESETBUFFER_ENTRY=0xf3
+[TRACE]TRACE_FLOW[0x8A]_CACMWRITER_RESETBUFFER_EXIT=0xf4
+[TRACE]TRACE_FLOW[0x8A]_CACMWRITER_SETBUFSIZE_ENTRY=0xf5
+[TRACE]TRACE_FLOW[0x8A]_CACMWRITER_SETBUFSIZE_EXIT=0xf6
+[TRACE]TRACE_FLOW[0x8A]_CACMWRITER_SETBUFSIZE_EXIT_DUP1=0xf7
+[TRACE]TRACE_FLOW[0x8A]_CACMWRITER_SETBUFSIZE_EXIT_DUP2=0xf8
+[TRACE]TRACE_FLOW[0x8A]_CACMWRITER_WRITECANCEL_ENTRY=0xf1
+[TRACE]TRACE_FLOW[0x8A]_CACMWRITER_WRITECANCEL_EXIT=0xf2
+[TRACE]TRACE_FLOW[0x8A]_CACMWRITER_WRITECOMPLETED_ENTRY=0xfd
+[TRACE]TRACE_FLOW[0x8A]_CACMWRITER_WRITECOMPLETED_EXIT=0xfe
+[TRACE]TRACE_FLOW[0x8A]_CACMWRITER_WRITE_ENTRY=0xef
+[TRACE]TRACE_FLOW[0x8A]_CACMWRITER_WRITE_EXIT=0xf0
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEDATAAVAILABLENOTIFIER_CACTIVEDATAAVAILABLENOTIFIER_CONS_ENTRY=0x107
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEDATAAVAILABLENOTIFIER_CACTIVEDATAAVAILABLENOTIFIER_CONS_EXIT=0x108
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEDATAAVAILABLENOTIFIER_CACTIVEDATAAVAILABLENOTIFIER_DES_ENTRY=0x109
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEDATAAVAILABLENOTIFIER_CACTIVEDATAAVAILABLENOTIFIER_DES_EXIT=0x10a
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEDATAAVAILABLENOTIFIER_DOCANCEL_ENTRY=0x10f
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEDATAAVAILABLENOTIFIER_DOCANCEL_EXIT=0x110
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEDATAAVAILABLENOTIFIER_NEWL_ENTRY=0x10b
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEDATAAVAILABLENOTIFIER_NEWL_EXIT=0x10c
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEDATAAVAILABLENOTIFIER_NOTIFYDATAAVAILABLE_ENTRY=0x10d
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEDATAAVAILABLENOTIFIER_NOTIFYDATAAVAILABLE_EXIT=0x10e
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEDATAAVAILABLENOTIFIER_RUNL_ENTRY=0x111
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEDATAAVAILABLENOTIFIER_RUNL_EXIT=0x112
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEREADER_CACTIVEREADER_CONS_ENTRY=0x11f
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEREADER_CACTIVEREADER_CONS_EXIT=0x120
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEREADER_CACTIVEREADER_DES_ENTRY=0x121
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEREADER_CACTIVEREADER_DES_EXIT=0x122
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEREADER_DOCANCEL_ENTRY=0x127
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEREADER_DOCANCEL_EXIT=0x128
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEREADER_NEWL_ENTRY=0x123
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEREADER_NEWL_EXIT=0x124
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEREADER_READ_ENTRY=0x125
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEREADER_READ_EXIT=0x126
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEREADER_RUNL_ENTRY=0x129
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEREADER_RUNL_EXIT=0x12a
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEREADONEORMOREREADER_CACTIVEREADONEORMOREREADER_CONS_ENTRY=0x113
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEREADONEORMOREREADER_CACTIVEREADONEORMOREREADER_CONS_EXIT=0x114
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEREADONEORMOREREADER_CACTIVEREADONEORMOREREADER_DES_ENTRY=0x115
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEREADONEORMOREREADER_CACTIVEREADONEORMOREREADER_DES_EXIT=0x116
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEREADONEORMOREREADER_DOCANCEL_ENTRY=0x11b
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEREADONEORMOREREADER_DOCANCEL_EXIT=0x11c
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEREADONEORMOREREADER_NEWL_ENTRY=0x117
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEREADONEORMOREREADER_NEWL_EXIT=0x118
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEREADONEORMOREREADER_READONEORMORE_ENTRY=0x119
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEREADONEORMOREREADER_READONEORMORE_EXIT=0x11a
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEREADONEORMOREREADER_RUNL_ENTRY=0x11d
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEREADONEORMOREREADER_RUNL_EXIT=0x11e
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEWRITER_CACTIVEWRITER_CONS_ENTRY=0x12b
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEWRITER_CACTIVEWRITER_CONS_EXIT=0x12c
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEWRITER_CACTIVEWRITER_DES_ENTRY=0x12d
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEWRITER_CACTIVEWRITER_DES_EXIT=0x12e
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEWRITER_DOCANCEL_ENTRY=0x133
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEWRITER_DOCANCEL_EXIT=0x134
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEWRITER_NEWL_ENTRY=0x12f
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEWRITER_NEWL_EXIT=0x130
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEWRITER_RUNL_ENTRY=0x135
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEWRITER_RUNL_EXIT=0x136
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEWRITER_WRITE_ENTRY=0x131
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEWRITER_WRITE_EXIT=0x132
+[TRACE]TRACE_FLOW[0x8A]_CBREAKCONTROLLER_BREAKREQUEST_DUP1=0x142
+[TRACE]TRACE_FLOW[0x8A]_CBREAKCONTROLLER_BREAKREQUEST_ENTRY=0x141
+[TRACE]TRACE_FLOW[0x8A]_CBREAKCONTROLLER_BREAKREQUEST_EXIT=0x143
+[TRACE]TRACE_FLOW[0x8A]_CBREAKCONTROLLER_BREAKREQUEST_EXIT_DUP1=0x144
+[TRACE]TRACE_FLOW[0x8A]_CBREAKCONTROLLER_CBREAKCONTROLLER_CONS_ENTRY=0x137
+[TRACE]TRACE_FLOW[0x8A]_CBREAKCONTROLLER_CBREAKCONTROLLER_CONS_EXIT=0x138
+[TRACE]TRACE_FLOW[0x8A]_CBREAKCONTROLLER_CBREAKCONTROLLER_DES_ENTRY=0x13b
+[TRACE]TRACE_FLOW[0x8A]_CBREAKCONTROLLER_CBREAKCONTROLLER_DES_EXIT=0x13c
+[TRACE]TRACE_FLOW[0x8A]_CBREAKCONTROLLER_DOCANCEL_ENTRY=0x13f
+[TRACE]TRACE_FLOW[0x8A]_CBREAKCONTROLLER_DOCANCEL_EXIT=0x140
+[TRACE]TRACE_FLOW[0x8A]_CBREAKCONTROLLER_NEWL_ENTRY=0x139
+[TRACE]TRACE_FLOW[0x8A]_CBREAKCONTROLLER_NEWL_EXIT=0x13a
+[TRACE]TRACE_FLOW[0x8A]_CBREAKCONTROLLER_PUBLISH_ENTRY=0x147
+[TRACE]TRACE_FLOW[0x8A]_CBREAKCONTROLLER_PUBLISH_EXIT=0x148
+[TRACE]TRACE_FLOW[0x8A]_CBREAKCONTROLLER_RUNL_ENTRY=0x13d
+[TRACE]TRACE_FLOW[0x8A]_CBREAKCONTROLLER_RUNL_EXIT=0x13e
+[TRACE]TRACE_FLOW[0x8A]_CBREAKCONTROLLER_SCINACTIVE_ENTRY=0x14b
+[TRACE]TRACE_FLOW[0x8A]_CBREAKCONTROLLER_SCINACTIVE_EXIT=0x14c
+[TRACE]TRACE_FLOW[0x8A]_CBREAKCONTROLLER_SCINVALID_ENTRY=0x149
+[TRACE]TRACE_FLOW[0x8A]_CBREAKCONTROLLER_SCINVALID_EXIT=0x14a
+[TRACE]TRACE_FLOW[0x8A]_CBREAKCONTROLLER_SCLOCKED_ENTRY=0x150
+[TRACE]TRACE_FLOW[0x8A]_CBREAKCONTROLLER_SCLOCKED_EXIT=0x151
+[TRACE]TRACE_FLOW[0x8A]_CBREAKCONTROLLER_SCSETTIMER_ENTRY=0x14d
+[TRACE]TRACE_FLOW[0x8A]_CBREAKCONTROLLER_SCSETTIMER_EXIT=0x14e
+[TRACE]TRACE_FLOW[0x8A]_CBREAKCONTROLLER_SCSETTIMER_EXIT_DUP1=0x14f
+[TRACE]TRACE_FLOW[0x8A]_CBREAKCONTROLLER_STATEMACHINE_ENTRY=0x145
+[TRACE]TRACE_FLOW[0x8A]_CBREAKCONTROLLER_STATEMACHINE_EXIT=0x146
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_BREAKACTIVE_ENTRY=0x18c
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_BREAKACTIVE_EXIT=0x18d
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_BREAKCALLBACK_ENTRY=0x198
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_BREAKCALLBACK_EXIT=0x199
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_BREAKREQUEST_ENTRY=0x19a
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_BREAKREQUEST_EXIT=0x19b
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_CALLBACK_ENTRY=0x196
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_CALLBACK_EXIT=0x197
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_CCDCACMCLASS_CONS_ENTRY=0x152
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_CCDCACMCLASS_CONS_EXIT=0x153
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_CCDCACMCLASS_DES_ENTRY=0x158
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_CCDCACMCLASS_DES_EXIT=0x159
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_CONSTRUCTL_ENTRY=0x156
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_CONSTRUCTL_EXIT=0x157
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_CONVERTUSBCONFIGCODINGTOEPOC_ENTRY=0x177
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_CONVERTUSBCONFIGCODINGTOEPOC_EXIT=0x178
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_DCDSTATE_ENTRY=0x192
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_DCDSTATE_EXIT=0x193
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_DSRSTATE_ENTRY=0x190
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_DSRSTATE_EXIT=0x191
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_HANDLECLEARCOMMFEATURE_ENTRY=0x170
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_HANDLECLEARCOMMFEATURE_EXIT=0x171
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_HANDLEGETCOMMFEATURE_ENTRY=0x16e
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_HANDLEGETCOMMFEATURE_EXIT=0x16f
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_HANDLEGETENCAPRESPONSE_ENTRY=0x17f
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_HANDLEGETENCAPRESPONSE_EXIT=0x180
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_HANDLEGETLINECODING_ENTRY=0x184
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_HANDLEGETLINECODING_EXIT=0x185
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_HANDLENEWABSTRACTSTATE_ENTRY=0x179
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_HANDLENEWABSTRACTSTATE_EXIT=0x17a
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_HANDLENEWCOUNTRYCODE_ENTRY=0x17b
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_HANDLENEWCOUNTRYCODE_EXIT=0x17c
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_HANDLESENDBREAK_ENTRY=0x188
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_HANDLESENDBREAK_EXIT=0x189
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_HANDLESENDENCAPCOMMAND_ENTRY=0x17d
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_HANDLESENDENCAPCOMMAND_EXIT=0x17e
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_HANDLESETCOMMFEATURE_ENTRY=0x181
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_HANDLESETCOMMFEATURE_EXIT=0x182
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_HANDLESETCOMMFEATURE_EXIT_DUP1=0x183
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_HANDLESETCONTROLLINESTATE_ENTRY=0x186
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_HANDLESETCONTROLLINESTATE_EXIT=0x187
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_HANDLESETLINECODING_ENTRY=0x172
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_HANDLESETLINECODING_EXIT=0x173
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_HANDLESETLINECODING_EXIT_DUP1=0x174
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_NEWL_ENTRY=0x154
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_NEWL_EXIT=0x155
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_NOTIFYDATAAVAILABLECANCEL_ENTRY=0x19e
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_NOTIFYDATAAVAILABLECANCEL_EXIT=0x19f
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_NOTIFYDATAAVAILABLE_ENTRY=0x19c
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_NOTIFYDATAAVAILABLE_EXIT=0x19d
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_READCANCEL_ENTRY=0x166
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_READCANCEL_EXIT=0x167
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_READONEORMORE_ENTRY=0x15e
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_READONEORMORE_EXIT=0x15f
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_READONEORMORE_MREADONEORMOREOBSERVERREF_TDES8REF_TINT_ENTRY=0x160
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_READONEORMORE_MREADONEORMOREOBSERVERREF_TDES8REF_TINT_EXIT=0x161
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_READ_ENTRY=0x162
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_READ_ENTRY_DUP1=0x164
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_READ_ENTRY_DUP1_EXIT=0x165
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_READ_EXIT=0x163
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_RINGSTATE_ENTRY=0x18e
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_RINGSTATE_EXIT=0x18f
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_SENDSERIALSTATE_ENTRY=0x18a
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_SENDSERIALSTATE_EXIT=0x18b
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_SETBREAKACTIVE_ENTRY=0x194
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_SETBREAKACTIVE_EXIT=0x195
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_SETBREAKCALLBACK_ENTRY=0x15c
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_SETBREAKCALLBACK_EXIT=0x15d
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_SETCALLBACK_ENTRY=0x15a
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_SETCALLBACK_EXIT=0x15b
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_SETDEFAULTACM_ENTRY=0x175
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_SETDEFAULTACM_EXIT=0x176
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_WRITECANCEL_ENTRY=0x16c
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_WRITECANCEL_EXIT=0x16d
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_WRITE_ENTRY=0x168
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_WRITE_ENTRY_DUP1=0x16a
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_WRITE_ENTRY_DUP1_EXIT=0x16b
+[TRACE]TRACE_FLOW[0x8A]_CCDCACMCLASS_WRITE_EXIT=0x169
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACEREADER_CCDCCONTROLINTERFACEREADER_CONS_ENTRY=0x1be
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACEREADER_CCDCCONTROLINTERFACEREADER_CONS_EXIT=0x1bf
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACEREADER_CCDCCONTROLINTERFACEREADER_DES_ENTRY=0x1c0
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACEREADER_CCDCCONTROLINTERFACEREADER_DES_EXIT=0x1c1
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACEREADER_DECODEMESSAGEDATAWITHRESPONSEREQUIRED_ENTRY=0x1ce
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACEREADER_DECODEMESSAGEDATAWITHRESPONSEREQUIRED_EXIT=0x1cf
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACEREADER_DECODEMESSAGEDATA_ENTRY=0x1d0
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACEREADER_DECODEMESSAGEDATA_EXIT=0x1d1
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACEREADER_DECODEMESSAGEDATA_EXIT_DUP1=0x1d2
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACEREADER_DECODEMESSAGEHEADER_ENTRY=0x1cb
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACEREADER_DECODEMESSAGEHEADER_EXIT=0x1cc
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACEREADER_DOCANCEL_ENTRY=0x1c6
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACEREADER_DOCANCEL_EXIT=0x1c7
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACEREADER_HANDLEREADCOMPLETION_ENTRY=0x1c8
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACEREADER_HANDLEREADCOMPLETION_EXIT=0x1c9
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACEREADER_HANDLEREADCOMPLETION_EXIT_DUP1=0x1ca
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACEREADER_NEWL_ENTRY=0x1c2
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACEREADER_NEWL_EXIT=0x1c3
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACEREADER_READMESSAGEDATA_ENTRY=0x1d5
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACEREADER_READMESSAGEDATA_EXIT=0x1d6
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACEREADER_READMESSAGEHEADER_ENTRY=0x1d3
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACEREADER_READMESSAGEHEADER_EXIT=0x1d4
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACEREADER_RUNL_ENTRY=0x1c4
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACEREADER_RUNL_EXIT=0x1c5
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACE_CCDCCONTROLINTERFACE_CONS_ENTRY=0x1a0
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACE_CCDCCONTROLINTERFACE_CONS_EXIT=0x1a1
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACE_CONSTRUCTL_ENTRY=0x1a4
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACE_CONSTRUCTL_EXIT=0x1a5
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACE_NEWL_ENTRY=0x1a2
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACE_NEWL_EXIT=0x1a3
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACE_SENDNETWORKCONNECTION_ENTRY=0x1b4
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACE_SENDNETWORKCONNECTION_EXIT=0x1b5
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACE_SENDSERIALSTATE_ENTRY=0x1b8
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACE_SENDSERIALSTATE_EXIT=0x1b9
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACE_SETUPCLASSSPECIFICDESCRIPTOR_ENTRY=0x1ac
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACE_SETUPCLASSSPECIFICDESCRIPTOR_EXIT=0x1ad
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACE_SETUPCLASSSPECIFICDESCRIPTOR_EXIT_DUP1=0x1ae
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACE_SETUPCLASSSPECIFICDESCRIPTOR_EXIT_DUP2=0x1af
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACE_SETUPINTERFACE_ENTRY=0x1a6
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACE_SETUPINTERFACE_EXIT=0x1a7
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACE_SETUPINTERFACE_EXIT_DUP1=0x1a8
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACE_SETUPINTERFACE_EXIT_DUP2=0x1a9
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACE_SETUPINTERFACE_EXIT_DUP3=0x1aa
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACE_SETUPINTERFACE_EXIT_DUP4=0x1ab
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACE_WRITEDATA_ENTRY=0x1bb
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACE_WRITEDATA_EXIT=0x1bc
+[TRACE]TRACE_FLOW[0x8A]_CCDCCONTROLINTERFACE_WRITEDATA_EXIT_DUP1=0x1bd
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_CANCELNOTIFYDATAAVAILABLE_ENTRY=0x1fb
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_CANCELNOTIFYDATAAVAILABLE_EXIT=0x1fc
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_CANCELREAD_ENTRY=0x1f5
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_CANCELREAD_EXIT=0x1f6
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_CANCELWRITE_ENTRY=0x1eb
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_CANCELWRITE_EXIT=0x1ec
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_CCDCDATAINTERFACE_CONS_ENTRY=0x1d7
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_CCDCDATAINTERFACE_CONS_EXIT=0x1d8
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_CCDCDATAINTERFACE_DES_ENTRY=0x1e5
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_CCDCDATAINTERFACE_DES_EXIT=0x1e6
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_CONSTRUCTL_ENTRY=0x1db
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_CONSTRUCTL_EXIT=0x1dc
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_MLSOSTATECHANGE_ENTRY=0x1e3
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_MLSOSTATECHANGE_EXIT=0x1e4
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_NEWL_ENTRY=0x1d9
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_NEWL_EXIT=0x1da
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_NOTIFYDATAAVAILABLECOMPLETED_ENTRY=0x1f7
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_NOTIFYDATAAVAILABLECOMPLETED_EXIT=0x1f8
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_NOTIFYDATAAVAILABLE_ENTRY=0x1f9
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_NOTIFYDATAAVAILABLE_EXIT=0x1fa
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_READCOMPLETED_ENTRY=0x1f3
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_READCOMPLETED_EXIT=0x1f4
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_READONEORMORECOMPLETED_ENTRY=0x1f1
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_READONEORMORECOMPLETED_EXIT=0x1f2
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_READONEORMORE_ENTRY=0x1ef
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_READONEORMORE_EXIT=0x1f0
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_READ_ENTRY=0x1ed
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_READ_EXIT=0x1ee
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_SETUPINTERFACE_ENTRY=0x1dd
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_SETUPINTERFACE_EXIT=0x1de
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_SETUPINTERFACE_EXIT_DUP1=0x1df
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_SETUPINTERFACE_EXIT_DUP2=0x1e0
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_SETUPINTERFACE_EXIT_DUP3=0x1e1
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_SETUPINTERFACE_EXIT_DUP4=0x1e2
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_WRITECOMPLETED_ENTRY=0x1e9
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_WRITECOMPLETED_EXIT=0x1ea
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_WRITE_ENTRY=0x1e7
+[TRACE]TRACE_FLOW[0x8A]_CCDCDATAINTERFACE_WRITE_EXIT=0x1e8
+[TRACE]TRACE_FLOW[0x8A]_CCDCINTERFACEBASE_BASECONSTRUCTL_ENTRY=0x1ff
+[TRACE]TRACE_FLOW[0x8A]_CCDCINTERFACEBASE_BASECONSTRUCTL_EXIT=0x200
+[TRACE]TRACE_FLOW[0x8A]_CCDCINTERFACEBASE_CCDCINTERFACEBASE_CONS_ENTRY=0x1fd
+[TRACE]TRACE_FLOW[0x8A]_CCDCINTERFACEBASE_CCDCINTERFACEBASE_CONS_EXIT=0x1fe
+[TRACE]TRACE_FLOW[0x8A]_CCDCINTERFACEBASE_CCDCINTERFACEBASE_DES_ENTRY=0x201
+[TRACE]TRACE_FLOW[0x8A]_CCDCINTERFACEBASE_CCDCINTERFACEBASE_DES_EXIT=0x202
+[TRACE]TRACE_FLOW[0x8A]_CCDCINTERFACEBASE_GETINTERFACENUMBER_ENTRY=0x203
+[TRACE]TRACE_FLOW[0x8A]_CCDCINTERFACEBASE_GETINTERFACENUMBER_EXIT=0x204
+[TRACE]TRACE_FLOW[0x8A]_CCDCINTERFACEBASE_GETINTERFACENUMBER_EXIT_DUP1=0x205
+[TRACE]TRACE_FLOW[0x8A]_CCDCINTERFACEBASE_GETINTERFACENUMBER_EXIT_DUP2=0x206
+[TRACE]TRACE_FLOW[0x8A]_CCDCINTERFACEBASE_GETINTERFACENUMBER_EXIT_DUP3=0x207
+[TRACE]TRACE_FLOW[0x8A]_CLINKSTATENOTIFIER_CLINKSTATENOTIFIER_CONS_ENTRY=0x273
+[TRACE]TRACE_FLOW[0x8A]_CLINKSTATENOTIFIER_CLINKSTATENOTIFIER_CONS_EXIT=0x274
+[TRACE]TRACE_FLOW[0x8A]_CLINKSTATENOTIFIER_CLINKSTATENOTIFIER_DES_ENTRY=0x275
+[TRACE]TRACE_FLOW[0x8A]_CLINKSTATENOTIFIER_CLINKSTATENOTIFIER_DES_EXIT=0x276
+[TRACE]TRACE_FLOW[0x8A]_CLINKSTATENOTIFIER_DOCANCEL_ENTRY=0x27c
+[TRACE]TRACE_FLOW[0x8A]_CLINKSTATENOTIFIER_DOCANCEL_EXIT=0x27d
+[TRACE]TRACE_FLOW[0x8A]_CLINKSTATENOTIFIER_LINKDOWN_ENTRY=0x282
+[TRACE]TRACE_FLOW[0x8A]_CLINKSTATENOTIFIER_LINKDOWN_EXIT=0x283
+[TRACE]TRACE_FLOW[0x8A]_CLINKSTATENOTIFIER_LINKUP_ENTRY=0x280
+[TRACE]TRACE_FLOW[0x8A]_CLINKSTATENOTIFIER_LINKUP_EXIT=0x281
+[TRACE]TRACE_FLOW[0x8A]_CLINKSTATENOTIFIER_NEWL_ENTRY=0x271
+[TRACE]TRACE_FLOW[0x8A]_CLINKSTATENOTIFIER_NEWL_EXIT=0x272
+[TRACE]TRACE_FLOW[0x8A]_CLINKSTATENOTIFIER_RUNERROR_ENTRY=0x277
+[TRACE]TRACE_FLOW[0x8A]_CLINKSTATENOTIFIER_RUNERROR_EXIT=0x278
+[TRACE]TRACE_FLOW[0x8A]_CLINKSTATENOTIFIER_RUNL_ENTRY=0x279
+[TRACE]TRACE_FLOW[0x8A]_CLINKSTATENOTIFIER_RUNL_EXIT=0x27a
+[TRACE]TRACE_FLOW[0x8A]_CLINKSTATENOTIFIER_RUNL_EXIT_DUP1=0x27b
+[TRACE]TRACE_FLOW[0x8A]_CLINKSTATENOTIFIER_START_ENTRY=0x27e
+[TRACE]TRACE_FLOW[0x8A]_CLINKSTATENOTIFIER_START_EXIT=0x27f
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_BREAKCANCEL_ENTRY=0x21f
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_BREAKCANCEL_EXIT=0x220
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_BREAK_ENTRY=0x21d
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_BREAK_EXIT=0x21e
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_CONSTRUCTL_ENTRY=0x20d
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_CONSTRUCTL_EXIT=0x20e
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_CREGISTRATIONPORT_CONS_ENTRY=0x20f
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_CREGISTRATIONPORT_CONS_EXIT=0x210
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_CREGISTRATIONPORT_DES_ENTRY=0x257
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_CREGISTRATIONPORT_DES_EXIT=0x258
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_DESTRUCT_ENTRY=0x235
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_DESTRUCT_EXIT=0x236
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_FREEMEMORY_ENTRY=0x237
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_FREEMEMORY_EXIT=0x238
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_GETCAPS_ENTRY=0x229
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_GETCAPS_EXIT=0x22a
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_GETCONFIG_ENTRY=0x221
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_GETCONFIG_EXIT=0x222
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_GETFLOWCONTROLSTATUS_ENTRY=0x23d
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_GETFLOWCONTROLSTATUS_EXIT=0x23e
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_GETRECEIVEBUFFERLENGTH_ENTRY=0x231
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_GETRECEIVEBUFFERLENGTH_EXIT=0x232
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_GETROLE_ENTRY=0x253
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_GETROLE_EXIT=0x254
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_GETSERVERCONFIG_ENTRY=0x227
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_GETSERVERCONFIG_EXIT=0x228
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_GETSIGNALS_ENTRY=0x22b
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_GETSIGNALS_EXIT=0x22c
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_NEWL_ENTRY=0x20b
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_NEWL_EXIT=0x20c
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_NOTIFYBREAKCANCEL_ENTRY=0x245
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_NOTIFYBREAKCANCEL_EXIT=0x246
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_NOTIFYBREAK_ENTRY=0x243
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_NOTIFYBREAK_EXIT=0x244
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_NOTIFYCONFIGCHANGECANCEL_ENTRY=0x24d
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_NOTIFYCONFIGCHANGECANCEL_EXIT=0x24e
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_NOTIFYCONFIGCHANGE_ENTRY=0x24b
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_NOTIFYCONFIGCHANGE_EXIT=0x24c
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_NOTIFYDATAAVAILABLECANCEL_ENTRY=0x23b
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_NOTIFYDATAAVAILABLECANCEL_EXIT=0x23c
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_NOTIFYDATAAVAILABLE_ENTRY=0x239
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_NOTIFYDATAAVAILABLE_EXIT=0x23a
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_NOTIFYFLOWCONTROLCHANGECANCEL_ENTRY=0x249
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_NOTIFYFLOWCONTROLCHANGECANCEL_EXIT=0x24a
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_NOTIFYFLOWCONTROLCHANGE_ENTRY=0x247
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_NOTIFYFLOWCONTROLCHANGE_EXIT=0x248
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_NOTIFYOUTPUTEMPTYCANCEL_ENTRY=0x241
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_NOTIFYOUTPUTEMPTYCANCEL_EXIT=0x242
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_NOTIFYOUTPUTEMPTY_ENTRY=0x23f
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_NOTIFYOUTPUTEMPTY_EXIT=0x240
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_NOTIFYSIGNALCHANGECANCEL_ENTRY=0x251
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_NOTIFYSIGNALCHANGECANCEL_EXIT=0x252
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_NOTIFYSIGNALCHANGE_ENTRY=0x24f
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_NOTIFYSIGNALCHANGE_EXIT=0x250
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_QUERYRECEIVEBUFFER_ENTRY=0x215
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_QUERYRECEIVEBUFFER_EXIT=0x216
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_READCANCEL_ENTRY=0x213
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_READCANCEL_EXIT=0x214
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_RESETBUFFERS_ENTRY=0x217
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_RESETBUFFERS_EXIT=0x218
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_SETCONFIG_ENTRY=0x223
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_SETCONFIG_EXIT=0x224
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_SETRECEIVEBUFFERLENGTH_ENTRY=0x233
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_SETRECEIVEBUFFERLENGTH_EXIT=0x234
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_SETROLE_ENTRY=0x255
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_SETROLE_EXIT=0x256
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_SETSERVERCONFIG_ENTRY=0x225
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_SETSERVERCONFIG_EXIT=0x226
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_SETSIGNALSTOMARK_ENTRY=0x22d
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_SETSIGNALSTOMARK_EXIT=0x22e
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_SETSIGNALSTOSPACE_ENTRY=0x22f
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_SETSIGNALSTOSPACE_EXIT=0x230
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_STARTREAD_ENTRY=0x211
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_STARTREAD_EXIT=0x212
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_STARTWRITE_ENTRY=0x219
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_STARTWRITE_EXIT=0x21a
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_WRITECANCEL_ENTRY=0x21b
+[TRACE]TRACE_FLOW[0x8A]_CREGISTRATIONPORT_WRITECANCEL_EXIT=0x21c
+[TRACE]TRACE_FLOW[0x8A]_DLLMAIN_LIBENTRYL_ECACM_ENTRY=0x20a
+[TRACE]TRACE_FLOW[0x8A]_DUP1_CACMPORTFACTORY_CACMPORTFACTORY_ENTRY=0x99
+[TRACE]TRACE_FLOW[0x8A]_DUP1_CACMPORTFACTORY_CACMPORTFACTORY_EXIT=0x9a
+[TRACE]TRACE_FLOW[0x8A]_DUP1_CACMPORT_GETROLE_EXIT=0x88
+[TRACE]TRACE_FLOW[0x8A]_DUP1_CCDCCONTROLINTERFACEREADER_DECODEMESSAGEHEADER_EXIT=0x1cd
+[TRACE]TRACE_FLOW[0x8A]_DUP1_CCDCCONTROLINTERFACE_CCDCCONTROLINTERFACE_ENTRY=0x1b0
+[TRACE]TRACE_FLOW[0x8A]_DUP1_CCDCCONTROLINTERFACE_CCDCCONTROLINTERFACE_EXIT=0x1b1
+[TRACE]TRACE_FLOW[0x8A]_DUP1_CCDCCONTROLINTERFACE_SENDSERIALSTATE_EXIT=0x1ba
+[TRACE]TRACE_FLOW[0x8A]_TUSBCSCLASSDESCRIPTOR_DES_ENTRY=0x208
+[TRACE]TRACE_FLOW[0x8A]_TUSBCSCLASSDESCRIPTOR_DES_EXIT=0x209
+[TRACE]TRACE_FLOW[0x8A]_TUSBNOTIFICATIONNETWORKCONNECTION_PACKBUFFER_ENTRY=0x1b2
+[TRACE]TRACE_FLOW[0x8A]_TUSBNOTIFICATIONNETWORKCONNECTION_PACKBUFFER_EXIT=0x1b3
+[TRACE]TRACE_FLOW[0x8A]_TUSBNOTIFICATIONSERIALSTATE_PACKBUFFER_ENTRY=0x1b6
+[TRACE]TRACE_FLOW[0x8A]_TUSBNOTIFICATIONSERIALSTATE_PACKBUFFER_EXIT=0x1b7
+[TRACE]TRACE_FLOW[0x8A]_TUSBREQUESTHDR_DECODE_ENTRY=0x25b
+[TRACE]TRACE_FLOW[0x8A]_TUSBREQUESTHDR_DECODE_EXIT=0x25c
+[TRACE]TRACE_FLOW[0x8A]_TUSBREQUESTHDR_DECODE_EXIT_DUP1=0x25d
+[TRACE]TRACE_FLOW[0x8A]_TUSBREQUESTHDR_DES_ENTRY=0x259
+[TRACE]TRACE_FLOW[0x8A]_TUSBREQUESTHDR_DES_EXIT=0x25a
+[TRACE]TRACE_FLOW[0x8A]_TUSBREQUESTHDR_ISDATARESPONSEREQUIRED_ENTRY=0x25e
+[TRACE]TRACE_NORMAL[0x86]_CACMPORTFACTORY_ACMPORTCLOSED=0x6f
+[TRACE]TRACE_NORMAL[0x86]_CACMPORTFACTORY_CHECKACMARRAY=0x74
+[TRACE]TRACE_NORMAL[0x86]_CACMPORTFACTORY_CONSTRUCTL=0x69
+[TRACE]TRACE_NORMAL[0x86]_CACMPORTFACTORY_CONSTRUCTL_DUP1=0x6a
+[TRACE]TRACE_NORMAL[0x86]_CACMPORTFACTORY_CONSTRUCTL_DUP2=0x6b
+[TRACE]TRACE_NORMAL[0x86]_CACMPORTFACTORY_CONSTRUCTL_DUP3=0x6c
+[TRACE]TRACE_NORMAL[0x86]_CACMPORTFACTORY_CONSTRUCTL_DUP4=0x6d
+[TRACE]TRACE_NORMAL[0x86]_CACMPORTFACTORY_CREATEFUNCTIONL=0x78
+[TRACE]TRACE_NORMAL[0x86]_CACMPORTFACTORY_CREATEFUNCTIONL_DUP1=0x79
+[TRACE]TRACE_NORMAL[0x86]_CACMPORTFACTORY_CREATEFUNCTIONL_DUP2=0x7a
+[TRACE]TRACE_NORMAL[0x86]_CACMPORTFACTORY_CREATEFUNCTIONL_DUP3=0x7b
+[TRACE]TRACE_NORMAL[0x86]_CACMPORTFACTORY_CREATEFUNCTIONS=0x75
+[TRACE]TRACE_NORMAL[0x86]_CACMPORTFACTORY_CREATEFUNCTIONS_DUP1=0x76
+[TRACE]TRACE_NORMAL[0x86]_CACMPORTFACTORY_CREATEFUNCTIONS_DUP2=0x77
+[TRACE]TRACE_NORMAL[0x86]_CACMPORTFACTORY_DESTROYFUNCTIONS=0x72
+[TRACE]TRACE_NORMAL[0x86]_CACMPORTFACTORY_DESTROYFUNCTIONS_DUP1=0x73
+[TRACE]TRACE_NORMAL[0x86]_CACMPORTFACTORY_LOGPORTSANDFUNCTIONS=0x7c
+[TRACE]TRACE_NORMAL[0x86]_CACMPORTFACTORY_LOGPORTSANDFUNCTIONS_DUP1=0x7d
+[TRACE]TRACE_NORMAL[0x86]_CACMPORTFACTORY_NEWPORTL=0x70
+[TRACE]TRACE_NORMAL[0x86]_CACMPORTFACTORY_NEWPORTL_DUP1=0x71
+[TRACE]TRACE_NORMAL[0x86]_CACMPORTFACTORY_PUBLISHACMCONFIG=0x6e
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_BREAK=0xe
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_BREAKCANCEL=0x12
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_BREAKCANCEL_DUP1=0x13
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_BREAKREQUESTCOMPLETED=0x4a
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_BREAKREQUESTCOMPLETED_DUP1=0x4b
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_BREAKSTATECHANGE=0x4c
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_BREAKSTATECHANGE_DUP1=0x4d
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_BREAKSTATECHANGE_DUP2=0x4e
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_BREAKSTATECHANGE_DUP3=0x4f
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_BREAK_DUP1=0xf
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_BREAK_DUP2=0x10
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_BREAK_DUP3=0x11
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_CACMPORT_DESTRUCTRURE=0x67
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_CACMPORT_DESTRUCTRURE_DUP1=0x68
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_DOSETBUFFERLENGTHS=0x3a
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_DOSETBUFFERLENGTHS_DUP1=0x3b
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_DOSETBUFFERLENGTHS_DUP2=0x3c
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_DOSETBUFFERLENGTHS_DUP3=0x3d
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_DOSETBUFFERLENGTHS_DUP4=0x3e
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_GETCAPS=0x2b
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_GETCAPS_DUP1=0x2c
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_GETCONFIG=0x14
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_GETCONFIG_DUP1=0x16
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_GETCONFIG_DUP10=0x1f
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_GETCONFIG_DUP11=0x20
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_GETCONFIG_DUP12=0x15
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_GETCONFIG_DUP2=0x17
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_GETCONFIG_DUP3=0x18
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_GETCONFIG_DUP4=0x19
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_GETCONFIG_DUP5=0x1a
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_GETCONFIG_DUP6=0x1b
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_GETCONFIG_DUP7=0x1c
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_GETCONFIG_DUP8=0x1d
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_GETCONFIG_DUP9=0x1e
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_GETFLOWCONTROLSTATUS=0x44
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_GETFLOWCONTROLSTATUS_DUP1=0x45
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_GETRECEIVEBUFFERLENGTH=0x38
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_GETRECEIVEBUFFERLENGTH_DUP1=0x39
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_GETROLE=0x5f
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_GETROLE_DUP1=0x60
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_GETSERVERCONFIG=0x29
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_GETSERVERCONFIG_DUP1=0x2a
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_GETSIGNALS=0x2d
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_GETSIGNALS_DUP1=0x2e
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_HANDLECONFIGNOTIFICATION_DUP6=0x24
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_HOSTSIGNALCHANGE=0x5a
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_HOSTSIGNALCHANGE_DUP1=0x5b
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_HOSTSIGNALCHANGE_DUP2=0x5c
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_HOSTSIGNALCHANGE_DUP3=0x5d
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_HOSTSIGNALCHANGE_DUP4=0x5e
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_NOTIFYBREAK=0x48
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_NOTIFYBREAKCANCEL=0x49
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_NOTIFYCONFIGCHANGE=0x52
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_NOTIFYCONFIGCHANGECANCEL=0x54
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_NOTIFYCONFIGCHANGE_DUP1=0x53
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_NOTIFYDATAAVAILABLE=0x42
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_NOTIFYDATAAVAILABLECANCEL=0x43
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_NOTIFYFLOWCONTROLCHANGE=0x50
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_NOTIFYFLOWCONTROLCHANGE_DUP1=0x51
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_NOTIFYOUTPUTEMPTY=0x46
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_NOTIFYOUTPUTEMPTY_DUP1=0x47
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_NOTIFYSIGNALCHANGE=0x55
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_NOTIFYSIGNALCHANGECANCEL=0x59
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_NOTIFYSIGNALCHANGE_DUP1=0x56
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_NOTIFYSIGNALCHANGE_DUP2=0x57
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_NOTIFYSIGNALCHANGE_DUP3=0x58
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_QUERYRECEIVEBUFFER=0x5
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_QUERYRECEIVEBUFFER_DUP1=0x6
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_READCANCEL=0x4
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_RESETBUFFERS=0x7
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_RESETBUFFERS_DUP1=0x8
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_RESETBUFFERS_DUP2=0x9
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_SETACM=0x63
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_SETACM_DUP1=0x65
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_SETACM_DUP2=0x66
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_SETACM_DUP3=0x64
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_SETCONFIG=0x21
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_SETCONFIG_DUP1=0x22
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_SETCONFIG_DUP2=0x23
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_SETRECEIVEBUFFERLENGTH=0x3f
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_SETRECEIVEBUFFERLENGTH_DUP1=0x40
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_SETRECEIVEBUFFERLENGTH_DUP2=0x41
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_SETROLE=0x61
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_SETROLE_DUP1=0x62
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_SETSERVERCONFIG=0x25
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_SETSERVERCONFIG_DUP1=0x26
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_SETSERVERCONFIG_DUP2=0x27
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_SETSERVERCONFIG_DUP3=0x28
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_SETSIGNALS=0x35
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_SETSIGNALSTOMARK=0x2f
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_SETSIGNALSTOMARK_DUP1=0x30
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_SETSIGNALSTOMARK_DUP2=0x31
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_SETSIGNALSTOSPACE=0x32
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_SETSIGNALSTOSPACE_DUP1=0x33
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_SETSIGNALSTOSPACE_DUP2=0x34
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_SETSIGNALS_DUP1=0x36
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_SETSIGNALS_DUP2=0x37
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_STARTREAD=0x1
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_STARTREAD_DUP1=0x2
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_STARTREAD_DUP2=0x3
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_STARTWRITE=0xa
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_STARTWRITE_DUP1=0xb
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_STARTWRITE_DUP2=0xc
+[TRACE]TRACE_NORMAL[0x86]_CACMPORT_WRITECANCEL=0xd
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_BUFLEN=0x89
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_BUFLEN_DUP1=0x8a
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_BUFLEN_DUP2=0x8b
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_BUFLEN_DUP3=0x8c
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_CHECKFORBUFFEREDTERMINATORSANDPROCEED=0x9e
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_CHECKFORBUFFEREDTERMINATORSANDPROCEED_DUP1=0x9f
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_CHECKFORBUFFEREDTERMINATORSANDPROCEED_DUP2=0xa0
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_CHECKFORBUFFEREDTERMINATORSANDPROCEED_DUP3=0xa1
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_CHECKFORBUFFEREDTERMINATORSANDPROCEED_DUP4=0xa2
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_CHECKFORBUFFEREDTERMINATORSANDPROCEED_DUP5=0xa3
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_CHECKFORBUFFEREDTERMINATORSANDPROCEED_DUP6=0x9d
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_COMPLETEREQUEST=0xad
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_COMPLETEREQUEST_DUP1=0xae
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_COMPLETEREQUEST_DUP2=0xaf
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_CONSTRUCTL=0x7e
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_FINDTERMINATOR=0xb0
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_NOTIFYDATAAVAILABLECANCEL=0x87
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_NOTIFYDATAAVAILABLECOMPLETED=0x9b
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_NOTIFYDATAAVAILABLECOMPLETED_DUP2=0x9c
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_PARTIALFINDTERMINATOR=0xb1
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_PARTIALFINDTERMINATOR_DUP2=0xb2
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_READ=0x7f
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_READCANCEL=0x88
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_READCOMPLETED=0x92
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_READCOMPLETED_DUP1=0x93
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_READCOMPLETED_DUP2=0x94
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_READONEORMORE=0x85
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_READONEORMORECOMPLETED=0x95
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_READONEORMORECOMPLETED_DUP1=0x96
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_READONEORMORECOMPLETED_DUP2=0x97
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_READONEORMORECOMPLETED_DUP3=0x98
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_READONEORMORECOMPLETED_DUP4=0x99
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_READONEORMORECOMPLETED_DUP5=0x9a
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_READONEORMORE_DUP1=0x86
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_READWITHOUTTERMINATORS=0x80
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_READWITHOUTTERMINATORS_DUP1=0x81
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_READWITHOUTTERMINATORS_DUP2=0x82
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_READWITHOUTTERMINATORS_DUP3=0x83
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_READWITHTERMINATORS=0x84
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_SETBUFSIZE=0x8d
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_SETBUFSIZE_DUP1=0x8e
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_SETBUFSIZE_DUP2=0x8f
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_SETTERMINATORS=0x90
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_SETTERMINATORS_DUP1=0x91
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_WRITEBACKDATA_DUP10=0xa8
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_WRITEBACKDATA_DUP11=0xa9
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_WRITEBACKDATA_DUP12=0xaa
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_WRITEBACKDATA_DUP13=0xab
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_WRITEBACKDATA_DUP14=0xac
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_WRITEBACKDATA_DUP6=0xa4
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_WRITEBACKDATA_DUP7=0xa5
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_WRITEBACKDATA_DUP8=0xa6
+[TRACE]TRACE_NORMAL[0x86]_CACMREADER_WRITEBACKDATA_DUP9=0xa7
+[TRACE]TRACE_NORMAL[0x86]_CACMSERVER_NEWSESSIONL=0x152
+[TRACE]TRACE_NORMAL[0x86]_CACMSESSION_CREATEFUNCTIONSL_DUP1=0x153
+[TRACE]TRACE_NORMAL[0x86]_CACMSESSION_SERVICEL=0x154
+[TRACE]TRACE_NORMAL[0x86]_CACMWRITER_COMPLETEREQUEST=0xbc
+[TRACE]TRACE_NORMAL[0x86]_CACMWRITER_COMPLETEREQUEST_DUP1=0xbd
+[TRACE]TRACE_NORMAL[0x86]_CACMWRITER_CONSTRUCTL=0xb8
+[TRACE]TRACE_NORMAL[0x86]_CACMWRITER_ISSUEWRITE=0xbe
+[TRACE]TRACE_NORMAL[0x86]_CACMWRITER_READDATAFROMCLIENT=0xbb
+[TRACE]TRACE_NORMAL[0x86]_CACMWRITER_SETBUFSIZE=0xb5
+[TRACE]TRACE_NORMAL[0x86]_CACMWRITER_SETBUFSIZE_DUP1=0xb6
+[TRACE]TRACE_NORMAL[0x86]_CACMWRITER_SETBUFSIZE_DUP2=0xb7
+[TRACE]TRACE_NORMAL[0x86]_CACMWRITER_WRITE=0xb3
+[TRACE]TRACE_NORMAL[0x86]_CACMWRITER_WRITECANCEL=0xb4
+[TRACE]TRACE_NORMAL[0x86]_CACMWRITER_WRITECOMPLETED=0xb9
+[TRACE]TRACE_NORMAL[0x86]_CACMWRITER_WRITECOMPLETED_DUP1=0xba
+[TRACE]TRACE_NORMAL[0x86]_CACTIVEDATAAVAILABLENOTIFIER_RUNL=0xbf
+[TRACE]TRACE_NORMAL[0x86]_CACTIVEREADER_RUNL=0xc2
+[TRACE]TRACE_NORMAL[0x86]_CACTIVEREADONEORMOREREADER_READONEORMORE=0xc0
+[TRACE]TRACE_NORMAL[0x86]_CACTIVEREADONEORMOREREADER_RUNL=0xc1
+[TRACE]TRACE_NORMAL[0x86]_CACTIVEWRITER_RUNL=0xc5
+[TRACE]TRACE_NORMAL[0x86]_CACTIVEWRITER_RUNL_DUP1=0xc6
+[TRACE]TRACE_NORMAL[0x86]_CACTIVEWRITER_WRITE=0xc3
+[TRACE]TRACE_NORMAL[0x86]_CACTIVEWRITER_WRITE_DUP1=0xc4
+[TRACE]TRACE_NORMAL[0x86]_CBREAKCONTROLLER_BREAKREQUEST=0xc8
+[TRACE]TRACE_NORMAL[0x86]_CBREAKCONTROLLER_CONSTRUCTL=0xc7
+[TRACE]TRACE_NORMAL[0x86]_CBREAKCONTROLLER_PUBLISH_DUP1=0xcb
+[TRACE]TRACE_NORMAL[0x86]_CBREAKCONTROLLER_PUBLISH_DUP2=0xcc
+[TRACE]TRACE_NORMAL[0x86]_CBREAKCONTROLLER_PUBLISH_DUP3=0xcd
+[TRACE]TRACE_NORMAL[0x86]_CBREAKCONTROLLER_PUBLISH_DUP4=0xce
+[TRACE]TRACE_NORMAL[0x86]_CBREAKCONTROLLER_STATEMACHINE_DUP1=0xc9
+[TRACE]TRACE_NORMAL[0x86]_CBREAKCONTROLLER_STATEMACHINE_DUP2=0xca
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_BREAKREQUEST_DUP1=0x100
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_CONSTRUCTL=0xcf
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_CONSTRUCTL_DUP1=0xd0
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_CONSTRUCTL_DUP2=0xd1
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_CONSTRUCTL_DUP3=0xd2
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_CONSTRUCTL_DUP4=0xd3
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_CONSTRUCTL_DUP5=0xd4
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_HANDLECLEARCOMMFEATURE=0xe3
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_HANDLECLEARCOMMFEATURE_DUP1=0xe4
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_HANDLECLEARCOMMFEATURE_DUP2=0xe5
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_HANDLECLEARCOMMFEATURE_DUP3=0xe6
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_HANDLECLEARCOMMFEATURE_DUP4=0xe7
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_HANDLECLEARCOMMFEATURE_DUP5=0xe8
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_HANDLEGETCOMMFEATURE=0xdd
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_HANDLEGETCOMMFEATURE_DUP1=0xde
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_HANDLEGETCOMMFEATURE_DUP2=0xdf
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_HANDLEGETCOMMFEATURE_DUP3=0xe0
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_HANDLEGETCOMMFEATURE_DUP4=0xe1
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_HANDLEGETCOMMFEATURE_DUP5=0xe2
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_HANDLEGETENCAPRESPONSE=0xf1
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_HANDLENEWABSTRACTSTATE=0xea
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_HANDLENEWABSTRACTSTATE_DUP1=0xeb
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_HANDLENEWABSTRACTSTATE_DUP2=0xec
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_HANDLENEWABSTRACTSTATE_DUP3=0xed
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_HANDLENEWCOUNTRYCODE=0xee
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_HANDLENEWCOUNTRYCODE_DUP1=0xef
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_HANDLESENDBREAK=0xfc
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_HANDLESENDBREAK_DUP1=0xfd
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_HANDLESENDENCAPCOMMAND=0xf0
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_HANDLESETCOMMFEATURE=0xf2
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_HANDLESETCOMMFEATURE_DUP1=0xf3
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_HANDLESETCOMMFEATURE_DUP2=0xf4
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_HANDLESETCOMMFEATURE_DUP3=0xf5
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_HANDLESETCOMMFEATURE_DUP4=0xf6
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_HANDLESETCOMMFEATURE_DUP5=0xf7
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_HANDLESETCOMMFEATURE_DUP6=0xf8
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_HANDLESETCOMMFEATURE_DUP7=0xf9
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_HANDLESETCONTROLLINESTATE=0xfa
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_HANDLESETCONTROLLINESTATE_DUP1=0xfb
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_HANDLESETLINECODING=0xe9
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_NOTIFYDATAAVAILABLE=0x101
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_READ=0xd9
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_READONEORMORE=0xd7
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_READONEORMORE_MREADONEORMOREOBSERVERREF_TDES8REF_TINT=0xd8
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_READ_DUP1=0xda
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_SENDSERIALSTATE=0xfe
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_SENDSERIALSTATE_DUP1=0xff
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_SETBREAKCALLBACK=0xd6
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_SETCALLBACK=0xd5
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_WRITE=0xdb
+[TRACE]TRACE_NORMAL[0x86]_CCDCACMCLASS_WRITE_DUP1=0xdc
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACEREADER_DECODEMESSAGEDATA=0x124
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACEREADER_DECODEMESSAGEDATAWITHRESPONSEREQUIRED=0x122
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACEREADER_DECODEMESSAGEDATAWITHRESPONSEREQUIRED_DUP1=0x123
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACEREADER_DECODEMESSAGEDATA_DUP1=0x125
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACEREADER_DECODEMESSAGEDATA_DUP2=0x126
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACEREADER_DECODEMESSAGEHEADER=0x120
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACEREADER_DECODEMESSAGEHEADER_DUP1=0x121
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACEREADER_HANDLEREADCOMPLETION=0x11d
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACEREADER_HANDLEREADCOMPLETION_DUP1=0x11e
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACEREADER_HANDLEREADCOMPLETION_DUP2=0x11f
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACEREADER_READMESSAGEDATA=0x127
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACEREADER_RUNL=0x11c
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACE_CONSTRUCTL=0x103
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACE_NEWL=0x102
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACE_SENDNETWORKCONNECTION=0x112
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACE_SENDNETWORKCONNECTION_DUP1=0x113
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACE_SENDSERIALSTATE_DUP7=0x114
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACE_SENDSERIALSTATE_DUP8=0x115
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACE_SETUPCLASSSPECIFICDESCRIPTOR=0x10e
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACE_SETUPCLASSSPECIFICDESCRIPTOR_DUP1=0x10f
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACE_SETUPCLASSSPECIFICDESCRIPTOR_DUP2=0x110
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACE_SETUPCLASSSPECIFICDESCRIPTOR_DUP3=0x111
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACE_SETUPINTERFACE=0x104
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACE_SETUPINTERFACE_DUP1=0x105
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACE_SETUPINTERFACE_DUP10=0x10c
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACE_SETUPINTERFACE_DUP11=0x10d
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACE_SETUPINTERFACE_DUP2=0x106
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACE_SETUPINTERFACE_DUP3=0x107
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACE_SETUPINTERFACE_DUP4=0x108
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACE_SETUPINTERFACE_DUP5=0x109
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACE_SETUPINTERFACE_DUP8=0x10a
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACE_SETUPINTERFACE_DUP9=0x10b
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACE_WRITEDATA=0x116
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACE_WRITEDATA_DUP1=0x117
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACE_WRITEDATA_DUP2=0x118
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACE_WRITEDATA_DUP3=0x119
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACE_WRITEDATA_DUP4=0x11a
+[TRACE]TRACE_NORMAL[0x86]_CCDCCONTROLINTERFACE_WRITEDATA_DUP5=0x11b
+[TRACE]TRACE_NORMAL[0x86]_CCDCDATAINTERFACE_NEWL=0x128
+[TRACE]TRACE_NORMAL[0x86]_CCDCDATAINTERFACE_NOTIFYDATAAVAILABLECOMPLETED=0x13f
+[TRACE]TRACE_NORMAL[0x86]_CCDCDATAINTERFACE_NOTIFYDATAAVAILABLECOMPLETED_DUP1=0x140
+[TRACE]TRACE_NORMAL[0x86]_CCDCDATAINTERFACE_READ=0x136
+[TRACE]TRACE_NORMAL[0x86]_CCDCDATAINTERFACE_READCOMPLETED=0x13b
+[TRACE]TRACE_NORMAL[0x86]_CCDCDATAINTERFACE_READCOMPLETED_DUP1=0x13c
+[TRACE]TRACE_NORMAL[0x86]_CCDCDATAINTERFACE_READCOMPLETED_DUP3=0x13d
+[TRACE]TRACE_NORMAL[0x86]_CCDCDATAINTERFACE_READCOMPLETED_DUP5=0x13e
+[TRACE]TRACE_NORMAL[0x86]_CCDCDATAINTERFACE_READONEORMORE=0x137
+[TRACE]TRACE_NORMAL[0x86]_CCDCDATAINTERFACE_READONEORMORECOMPLETED=0x138
+[TRACE]TRACE_NORMAL[0x86]_CCDCDATAINTERFACE_READONEORMORECOMPLETED_DUP1=0x139
+[TRACE]TRACE_NORMAL[0x86]_CCDCDATAINTERFACE_READONEORMORECOMPLETED_DUP5=0x13a
+[TRACE]TRACE_NORMAL[0x86]_CCDCDATAINTERFACE_SETUPINTERFACE=0x129
+[TRACE]TRACE_NORMAL[0x86]_CCDCDATAINTERFACE_SETUPINTERFACE_DUP1=0x12a
+[TRACE]TRACE_NORMAL[0x86]_CCDCDATAINTERFACE_SETUPINTERFACE_DUP2=0x12b
+[TRACE]TRACE_NORMAL[0x86]_CCDCDATAINTERFACE_SETUPINTERFACE_DUP3=0x12c
+[TRACE]TRACE_NORMAL[0x86]_CCDCDATAINTERFACE_SETUPINTERFACE_DUP4=0x12e
+[TRACE]TRACE_NORMAL[0x86]_CCDCDATAINTERFACE_SETUPINTERFACE_DUP6=0x12f
+[TRACE]TRACE_NORMAL[0x86]_CCDCDATAINTERFACE_SETUPINTERFACE_DUP7=0x130
+[TRACE]TRACE_NORMAL[0x86]_CCDCDATAINTERFACE_SETUPINTERFACE_DUP8=0x131
+[TRACE]TRACE_NORMAL[0x86]_CCDCDATAINTERFACE_SETUPINTERFACE_DUP9=0x12d
+[TRACE]TRACE_NORMAL[0x86]_CCDCDATAINTERFACE_WRITECOMPLETED=0x132
+[TRACE]TRACE_NORMAL[0x86]_CCDCDATAINTERFACE_WRITECOMPLETED_DUP2=0x133
+[TRACE]TRACE_NORMAL[0x86]_CCDCDATAINTERFACE_WRITECOMPLETED_DUP4=0x134
+[TRACE]TRACE_NORMAL[0x86]_CCDCDATAINTERFACE_WRITECOMPLETED_DUP8=0x135
+[TRACE]TRACE_NORMAL[0x86]_CCDCINTERFACEBASE_BASECONSTRUCTL=0x141
+[TRACE]TRACE_NORMAL[0x86]_CCDCINTERFACEBASE_BASECONSTRUCTL_DUP1=0x142
+[TRACE]TRACE_NORMAL[0x86]_CCDCINTERFACEBASE_BASECONSTRUCTL_DUP2=0x143
+[TRACE]TRACE_NORMAL[0x86]_CCDCINTERFACEBASE_CCDCINTERFACEBASE_DES=0x144
+[TRACE]TRACE_NORMAL[0x86]_CCDCINTERFACEBASE_CCDCINTERFACEBASE_DES_DUP1=0x145
+[TRACE]TRACE_NORMAL[0x86]_CCDCINTERFACEBASE_GETINTERFACENUMBER=0x146
+[TRACE]TRACE_NORMAL[0x86]_CCDCINTERFACEBASE_GETINTERFACENUMBER_DUP1=0x147
+[TRACE]TRACE_NORMAL[0x86]_CCDCINTERFACEBASE_GETINTERFACENUMBER_DUP2=0x148
+[TRACE]TRACE_NORMAL[0x86]_CCDCINTERFACEBASE_GETINTERFACENUMBER_DUP3=0x149
+[TRACE]TRACE_NORMAL[0x86]_CCDCINTERFACEBASE_GETINTERFACENUMBER_DUP4=0x14a
+[TRACE]TRACE_NORMAL[0x86]_CCDCINTERFACEBASE_GETINTERFACENUMBER_DUP5=0x14b
+[TRACE]TRACE_NORMAL[0x86]_CLINKSTATENOTIFIER_RUNL=0x155
+[TRACE]TRACE_NORMAL[0x86]_CLINKSTATENOTIFIER_RUNL_DUP1=0x156
+[TRACE]TRACE_NORMAL[0x86]_CREGISTRATIONPORT_CONSTRUCTL=0x14c
+[TRACE]TRACE_NORMAL[0x86]_CREGISTRATIONPORT_GETROLE=0x151
+[TRACE]TRACE_NORMAL[0x86]_CREGISTRATIONPORT_SETSIGNALSTOMARK=0x14d
+[TRACE]TRACE_NORMAL[0x86]_CREGISTRATIONPORT_SETSIGNALSTOMARK_DUP1=0x14e
+[TRACE]TRACE_NORMAL[0x86]_CREGISTRATIONPORT_SETSIGNALSTOSPACE=0x14f
+[TRACE]TRACE_NORMAL[0x86]_CREGISTRATIONPORT_SETSIGNALSTOSPACE_DUP1=0x150
--- a/usbmgmt/usbmgr/device/classdrivers/bld.inf	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/bld.inf	Tue Aug 31 17:01:47 2010 +0300
@@ -19,4 +19,5 @@
 #include "ms/bld.inf"
 #include "obex/bld.inf"
 #include "whcm/bld.inf"
+#include "ncm/group/bld.inf"
 
--- a/usbmgmt/usbmgr/device/classdrivers/ms/classcontroller/group/msclasscontroller.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/ms/classcontroller/group/msclasscontroller.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -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,13 +28,15 @@
 uid			0x10009d8d 0x10204bbb
 
 
-userinclude		../inc
+sourcepath		../src
+source			CUsbMsClassController.cpp
+source			CUsbMsClassImpCollection.cpp
+
+USERINCLUDE			../inc
+USERINCLUDE			../traces
 
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
-sourcepath		../src
-source			CUsbMsClassController.cpp
-source			CUsbMsClassImpCollection.cpp
 
 start resource usbms.rss
 targetpath /private/10204bbb
@@ -50,6 +52,4 @@
 LIBRARY			efsrv.lib
 LIBRARY			bafl.lib
 
-#include <usb/usblogger.mmh>
-
 VENDORID 0x70000001
--- a/usbmgmt/usbmgr/device/classdrivers/ms/classcontroller/src/CUsbMsClassController.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/ms/classcontroller/src/CUsbMsClassController.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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,14 +28,13 @@
 #include <cusbclasscontrollerplugin.h>
 #include <usbms.rsg>
 #include "CUsbMsClassController.h"
-#include <usb/usblogger.h>
- 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "MSCC");
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "CUsbMsClassControllerTraces.h"
 #endif
 
+#ifdef _DEBUG
 // Panic category 
-#ifdef _DEBUG
 _LIT( KMsCcPanicCategory, "UsbMsCc" );
 #endif
 
@@ -58,12 +57,12 @@
 CUsbMsClassController* CUsbMsClassController::NewL(
 	MUsbClassControllerNotify& aOwner)
 	{
-	LOG_STATIC_FUNC_ENTRY
-
+	OstTraceFunctionEntry0( CUSBMSCLASSCONTROLLER_NEWL_ENTRY );
 	CUsbMsClassController* r = new (ELeave) CUsbMsClassController(aOwner);
 	CleanupStack::PushL(r);
 	r->ConstructL();
 	CleanupStack::Pop();
+	OstTraceFunctionExit0( CUSBMSCLASSCONTROLLER_NEWL_EXIT );
 	return r;
 	}
 
@@ -72,7 +71,9 @@
  */
 CUsbMsClassController::~CUsbMsClassController()
 	{
+	OstTraceFunctionEntry0( CUSBMSCLASSCONTROLLER_CUSBMSCLASSCONTROLLER_DES_ENTRY );
 	Cancel();
+	OstTraceFunctionExit0( CUSBMSCLASSCONTROLLER_CUSBMSCLASSCONTROLLER_DES_EXIT );
 	}
 
 /**
@@ -84,7 +85,9 @@
 	MUsbClassControllerNotify& aOwner)
 	: CUsbClassControllerPlugIn(aOwner, KMsStartupPriority)	
 	{
+	OstTraceFunctionEntry0( CUSBMSCLASSCONTROLLER_CUSBMSCLASSCONTROLLER_CONS_ENTRY );
 	// Intentionally left blank
+	OstTraceFunctionExit0( CUSBMSCLASSCONTROLLER_CUSBMSCLASSCONTROLLER_CONS_EXIT );
 	}
 
 /**
@@ -92,9 +95,9 @@
  */
 void CUsbMsClassController::ConstructL()
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CUSBMSCLASSCONTROLLER_CONSTRUCT_ENTRY );
 	ReadMassStorageConfigL();
+	OstTraceFunctionExit0( CUSBMSCLASSCONTROLLER_CONSTRUCT_EXIT );
 	}
 
 /**
@@ -104,11 +107,16 @@
  */
 void CUsbMsClassController::Start(TRequestStatus& aStatus)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBMSCLASSCONTROLLER_START_ENTRY );
 	
 	// The service state should always be idle when this function is called 
 	// (guaranteed by CUsbSession).
-	__ASSERT_DEBUG( iState == EUsbServiceIdle, _USB_PANIC(KMsCcPanicCategory, EBadApiCall) );
+	
+	if (iState != EUsbServiceIdle)
+		{
+		OstTrace1( TRACE_FATAL, CUSBMSCLASSCONTROLLER_START, "CUsbMsClassController::Star;iState=%d", (TInt)iState );
+		__ASSERT_DEBUG( EFalse, User::Panic(KMsCcPanicCategory, EBadApiCall) );
+		}
 
 	TRequestStatus* reportStatus = &aStatus;
 
@@ -121,7 +129,9 @@
 		{
 		iState = EUsbServiceIdle;
 		User::RequestComplete(reportStatus, err);
-		LOGTEXT(_L8("Failed to connect to mass storage file server"));
+		OstTrace0( TRACE_NORMAL, CUSBMSCLASSCONTROLLER_START_DUP1, 
+				"CUsbMsClassController::Start;Failed to connect to mass storage file server" );
+		OstTraceFunctionExit0( CUSBMSCLASSCONTROLLER_START_EXIT );
 		return;
 		}
 
@@ -131,19 +141,19 @@
 	if (err != KErrNone)
 		{
 		iState = EUsbServiceIdle;
-		
 		// Connection was created successfully in last step
 		// Get it closed since failed to start device.
 		iUsbMs.Close();
-		
 		User::RequestComplete(reportStatus, err);
-		LOGTEXT(_L8("Failed to start mass storage device"));
+		OstTrace0( TRACE_NORMAL, CUSBMSCLASSCONTROLLER_START_DUP2, 
+						"CUsbMsClassController::Start;Failed to start mass storage device" );
+		OstTraceFunctionExit0( CUSBMSCLASSCONTROLLER_START_EXIT_DUP1 );
 		return;
 		}
 
 	iState = EUsbServiceStarted;
-
 	User::RequestComplete(reportStatus, KErrNone);
+	OstTraceFunctionExit0( CUSBMSCLASSCONTROLLER_START_EXIT_DUP2 );
 	}
 
 /**
@@ -153,27 +163,32 @@
  */
 void CUsbMsClassController::Stop(TRequestStatus& aStatus)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBMSCLASSCONTROLLER_STOP_ENTRY );
 	
 	// The service state should always be started when this function is called
 	// (guaranteed by CUsbSession)
-	__ASSERT_DEBUG( iState == EUsbServiceStarted, _USB_PANIC(KMsCcPanicCategory, EBadApiCall) );
+	if (iState != EUsbServiceStarted)
+		{
+		OstTrace1( TRACE_FATAL, CUSBMSCLASSCONTROLLER_STOP, "CUsbMsClassController::Stop;iState=%d", (TInt)iState );
+		__ASSERT_DEBUG( EFalse, User::Panic(KMsCcPanicCategory, EBadApiCall) );
+		}
 
 	TRequestStatus* reportStatus = &aStatus;
-	
 	TInt err = iUsbMs.Stop();
 	
 	if (err != KErrNone)
 		{
 		iState = EUsbServiceStarted;
 		User::RequestComplete(reportStatus, err);
-		LOGTEXT(_L8("Failed to stop mass storage device"));
+		OstTrace0( TRACE_NORMAL, CUSBMSCLASSCONTROLLER_STOP_DUP1, 
+						"CUsbMsClassController::Start;Failed to stop mass storage device" );
+		OstTraceFunctionExit0( CUSBMSCLASSCONTROLLER_STOP_EXIT );
 		return;
 		}	
 
 	iUsbMs.Close();
-
 	User::RequestComplete(reportStatus, KErrNone);
+	OstTraceFunctionExit0( CUSBMSCLASSCONTROLLER_START_STOP_DUP1 );
 	}
 
 /**
@@ -184,7 +199,11 @@
  */
 void CUsbMsClassController::GetDescriptorInfo(TUsbDescriptor& /*aDescriptorInfo*/) const
 	{
-	__ASSERT_DEBUG( EFalse, _USB_PANIC(KMsCcPanicCategory, EUnusedFunction));
+	OstTraceFunctionEntry0( CUSBMSCLASSCONTROLLER_GETDESCRIPTORINFO_ENTRY );
+	OstTrace1( TRACE_FATAL, CUSBMSCLASSCONTROLLER_GETDESCRIPTORINFO, 
+			"CUsbMsClassController::GetDescriptorInfo;panic line=%d", (TInt)__LINE__ );
+	__ASSERT_DEBUG( EFalse, User::Panic(KMsCcPanicCategory, EUnusedFunction) );
+	OstTraceFunctionExit0( CUSBMSCLASSCONTROLLER_GETDESCRIPTORINFO_EXIT );
 	}
 
 /**
@@ -193,7 +212,11 @@
  */
 void CUsbMsClassController::RunL()
 	{
-	__ASSERT_DEBUG( EFalse, _USB_PANIC(KMsCcPanicCategory, EUnusedFunction) );
+	OstTraceFunctionEntry0( CUSBMSCLASSCONTROLLER_RUNL_ENTRY );
+	OstTrace1( TRACE_FATAL, CUSBMSCLASSCONTROLLER_RUNL, 
+			"CUsbMsClassController::RunL;panic line=%d", (TInt)__LINE__ );
+	__ASSERT_DEBUG( EFalse, User::Panic(KMsCcPanicCategory, EUnusedFunction) );
+	OstTraceFunctionExit0( CUSBMSCLASSCONTROLLER_RUNL_EXIT );
 	}
 
 /**
@@ -202,7 +225,11 @@
  */
 void CUsbMsClassController::DoCancel()
 	{
-	__ASSERT_DEBUG( EFalse, _USB_PANIC(KMsCcPanicCategory, EUnusedFunction) );
+	OstTraceFunctionEntry0( CUSBMSCLASSCONTROLLER_DOCANCEL_ENTRY );
+	OstTrace1( TRACE_FATAL, CUSBMSCLASSCONTROLLER_DOCANCEL, 
+			"CUsbMsClassController::DoCancel;panic line=%d", (TInt)__LINE__ );
+	__ASSERT_DEBUG( EFalse, User::Panic(KMsCcPanicCategory, EUnusedFunction) );
+	OstTraceFunctionExit0( CUSBMSCLASSCONTROLLER_DOCANCEL_EXIT );
 	}
 
 /**
@@ -214,7 +241,11 @@
  */
 TInt CUsbMsClassController::RunError(TInt /*aError*/)
 	{
-	__ASSERT_DEBUG( EFalse, _USB_PANIC(KMsCcPanicCategory, EUnusedFunction) );
+	OstTraceFunctionEntry0( CUSBMSCLASSCONTROLLER_RUNERROR_ENTRY );
+	OstTrace1( TRACE_FATAL, CUSBMSCLASSCONTROLLER_RUNERROR, 
+			"CUsbMsClassController::RunError;panic line=%d", (TInt)__LINE__ );
+	__ASSERT_DEBUG( EFalse, User::Panic(KMsCcPanicCategory, EUnusedFunction) );
+	OstTraceFunctionExit0( CUSBMSCLASSCONTROLLER_RUNERROR_EXIT );
 	return KErrNone;
 	}
 
@@ -223,21 +254,31 @@
  */
 void CUsbMsClassController::ReadMassStorageConfigL()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBMSCLASSCONTROLLER_READMASSSTORAGECONFIGL_ENTRY );
 
 	// Try to connect to file server
-	RFs fs;
-	LEAVEIFERRORL(fs.Connect());
+	RFs		fs;
+	TInt	fserr = fs.Connect();
+	
+	if (fserr < 0)
+		{
+		OstTrace1( TRACE_FATAL, CUSBMSCLASSCONTROLLER_READMASSSTORAGECONFIGL, 
+				"CUsbMsClassController::ReadMassStorageConfigL;leave err = %d", fserr );
+		User::Leave(fserr);
+		}
 	CleanupClosePushL(fs);
 
 	RResourceFile resource;
 	TRAPD(err, resource.OpenL(fs, KUsbMsResource));
-	LOGTEXT2(_L8("Opened resource file with error %d"), err);
+	OstTrace1( TRACE_NORMAL, CUSBMSCLASSCONTROLLER_READMASSSTORAGECONFIGL_DUP1, 
+				"CUsbMsClassController::ReadMassStorageConfigL;Opened resource file with error %d", err );
 
 	if (err != KErrNone)
 		{
-		LOGTEXT(_L8("Unable to open resource file"));
+		OstTrace0( TRACE_NORMAL, CUSBMSCLASSCONTROLLER_READMASSSTORAGECONFIGL_DUP2, 
+					"CUsbMsClassController::ReadMassStorageConfigL;Unable to open resource file" );
 		CleanupStack::PopAndDestroy(&fs);
+		OstTraceFunctionExit0( CUSBMSCLASSCONTROLLER_READMASSSTORAGECONFIGL_EXIT );
 		return;
 		}
 
@@ -249,8 +290,10 @@
 	TRAPD(ret, msConfigBuf = resource.AllocReadL(USBMS_CONFIG));
 	if (ret != KErrNone)
 		{
-		LOGTEXT(_L8("Failed to open mass storage configuration file"));
+		OstTrace0( TRACE_NORMAL, CUSBMSCLASSCONTROLLER_READMASSSTORAGECONFIGL_DUP3, 
+					"CUsbMsClassController::ReadMassStorageConfigL;Failed to open mass storage configuration file" );
 		CleanupStack::PopAndDestroy(2, &fs); 
+		OstTraceFunctionExit0( CUSBMSCLASSCONTROLLER_READMASSSTORAGECONFIGL_EXIT_DUP1 );
 		return;
 		}
 	CleanupStack::PushL(msConfigBuf);
@@ -282,11 +325,17 @@
 	ConfigItem(productRev, iMsConfig.iProductRev, 4);
 	
 	// Debugging
-	LOGTEXT2(_L8("vendorId = %S\n"), 	&vendorId);
-	LOGTEXT2(_L8("productId = %S\n"), 	&productId);
-	LOGTEXT2(_L8("productRev = %S\n"), 	&productRev);
+	OstTraceExt1( TRACE_NORMAL, CUSBMSCLASSCONTROLLER_READMASSSTORAGECONFIGL_DUP4, 
+					"CUsbMsClassController::ReadMassStorageConfigL;vendorId = %S\n", vendorId );
+
+	OstTraceExt1( TRACE_NORMAL, CUSBMSCLASSCONTROLLER_READMASSSTORAGECONFIGL_DUP5, 
+					"CUsbMsClassController::ReadMassStorageConfigL;productId = %S\n", productId );
+
+	OstTraceExt1( TRACE_NORMAL, CUSBMSCLASSCONTROLLER_READMASSSTORAGECONFIGL_DUP6, 
+					"CUsbMsClassController::ReadMassStorageConfigL;productRev = %S\n", productRev );
 		
 	CleanupStack::PopAndDestroy(3, &fs); // msConfigBuf, resource, fs		
+	OstTraceFunctionExit0( CUSBMSCLASSCONTROLLER_READMASSSTORAGECONFIGL_EXIT_DUP2 );
 	}
 	
 /**
@@ -295,11 +344,13 @@
  */
  void CUsbMsClassController::ConfigItem(const TPtrC& source, TDes& target, TInt maxLength)
  	{
+	 OstTraceFunctionEntry0( CUSBMSCLASSCONTROLLER_CONFIGITEM_ENTRY );
  	if (source.Length() < maxLength)
  		{
  		maxLength = source.Length();
  		}
  		
- 	target.Copy(source.Ptr(), maxLength);	 	
+ 	target.Copy(source.Ptr(), maxLength);
+ 	OstTraceFunctionExit0( CUSBMSCLASSCONTROLLER_CONFIGITEM_EXIT );
  	}
 
--- a/usbmgmt/usbmgr/device/classdrivers/ms/classcontroller/src/CUsbMsClassImpCollection.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/ms/classcontroller/src/CUsbMsClassImpCollection.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -26,6 +26,12 @@
 #include <ecom/implementationproxy.h>
 #include "CUsbMsClassController.h"
 
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "CUsbMsClassImpCollectionTraces.h"
+#endif
+
+
 // Define the private interface UIDs
 const TImplementationProxy UsbCCImplementationTable[] =
     {
@@ -34,7 +40,8 @@
 
 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
     {
+	OstTraceFunctionEntry0( CUSBMSCLASSIMPCOLLECTION_IMPLEMENTATIONGROUPPROXY_ENTRY );
     aTableCount = sizeof(UsbCCImplementationTable) / sizeof(TImplementationProxy);
-
+    OstTraceFunctionExit0( CUSBMSCLASSIMPCOLLECTION_IMPLEMENTATIONGROUPPROXY_EXIT );
     return UsbCCImplementationTable;
     }
--- a/usbmgmt/usbmgr/device/classdrivers/ms/classcontroller/src/usbms.rss	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/ms/classcontroller/src/usbms.rss	Tue Aug 31 17:01:47 2010 +0300
@@ -32,8 +32,9 @@
 
 RESOURCE USBMASSSTORAGE_CONFIG usbms_config
 	{
-    vendorId    = "vendorId";      	// no more than 8 characters
-    productId   = "productId";      // no more than 16 characters
-    productRev  = "rev";    	    // no more than 4 characters
+    vendorId    = "Nokia";  	    // no more than 8 characters
+    productId   = "S60";      // no more than 16 characters
+    productRev  = "1.0";    	    // no more than 4 characters
     }
 
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ms/classcontroller/traces/OstTraceDefinitions.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,7 @@
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <opensystemtrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ms/classcontroller/traces/fixed_id.definitions	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,51 @@
+#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt.
+[GROUP]TRACE_FATAL=0x81
+[GROUP]TRACE_FLOW=0x8a
+[GROUP]TRACE_NORMAL=0x86
+[TRACE]TRACE_FATAL[0x81]_CUSBMSCLASSCONTROLLER_DOCANCEL=0x5
+[TRACE]TRACE_FATAL[0x81]_CUSBMSCLASSCONTROLLER_GETDESCRIPTORINFO=0x3
+[TRACE]TRACE_FATAL[0x81]_CUSBMSCLASSCONTROLLER_READMASSSTORAGECONFIGL=0x7
+[TRACE]TRACE_FATAL[0x81]_CUSBMSCLASSCONTROLLER_RUNERROR=0x6
+[TRACE]TRACE_FATAL[0x81]_CUSBMSCLASSCONTROLLER_RUNL=0x4
+[TRACE]TRACE_FATAL[0x81]_CUSBMSCLASSCONTROLLER_START=0x1
+[TRACE]TRACE_FATAL[0x81]_CUSBMSCLASSCONTROLLER_STOP=0x2
+[TRACE]TRACE_FLOW[0x8A]_CUSBMSCLASSCONTROLLER_CONFIGITEM_ENTRY=0x1c
+[TRACE]TRACE_FLOW[0x8A]_CUSBMSCLASSCONTROLLER_CONFIGITEM_EXIT=0x1d
+[TRACE]TRACE_FLOW[0x8A]_CUSBMSCLASSCONTROLLER_CONSTRUCT_ENTRY=0x7
+[TRACE]TRACE_FLOW[0x8A]_CUSBMSCLASSCONTROLLER_CONSTRUCT_EXIT=0x8
+[TRACE]TRACE_FLOW[0x8A]_CUSBMSCLASSCONTROLLER_CUSBMSCLASSCONTROLLER_CONS_ENTRY=0x5
+[TRACE]TRACE_FLOW[0x8A]_CUSBMSCLASSCONTROLLER_CUSBMSCLASSCONTROLLER_CONS_EXIT=0x6
+[TRACE]TRACE_FLOW[0x8A]_CUSBMSCLASSCONTROLLER_CUSBMSCLASSCONTROLLER_DES_ENTRY=0x3
+[TRACE]TRACE_FLOW[0x8A]_CUSBMSCLASSCONTROLLER_CUSBMSCLASSCONTROLLER_DES_EXIT=0x4
+[TRACE]TRACE_FLOW[0x8A]_CUSBMSCLASSCONTROLLER_DOCANCEL_ENTRY=0x14
+[TRACE]TRACE_FLOW[0x8A]_CUSBMSCLASSCONTROLLER_DOCANCEL_EXIT=0x15
+[TRACE]TRACE_FLOW[0x8A]_CUSBMSCLASSCONTROLLER_GETDESCRIPTORINFO_ENTRY=0x10
+[TRACE]TRACE_FLOW[0x8A]_CUSBMSCLASSCONTROLLER_GETDESCRIPTORINFO_EXIT=0x11
+[TRACE]TRACE_FLOW[0x8A]_CUSBMSCLASSCONTROLLER_NEWL_ENTRY=0x1
+[TRACE]TRACE_FLOW[0x8A]_CUSBMSCLASSCONTROLLER_NEWL_EXIT=0x2
+[TRACE]TRACE_FLOW[0x8A]_CUSBMSCLASSCONTROLLER_READMASSSTORAGECONFIGL_ENTRY=0x18
+[TRACE]TRACE_FLOW[0x8A]_CUSBMSCLASSCONTROLLER_READMASSSTORAGECONFIGL_EXIT=0x19
+[TRACE]TRACE_FLOW[0x8A]_CUSBMSCLASSCONTROLLER_READMASSSTORAGECONFIGL_EXIT_DUP1=0x1a
+[TRACE]TRACE_FLOW[0x8A]_CUSBMSCLASSCONTROLLER_READMASSSTORAGECONFIGL_EXIT_DUP2=0x1b
+[TRACE]TRACE_FLOW[0x8A]_CUSBMSCLASSCONTROLLER_RUNERROR_ENTRY=0x16
+[TRACE]TRACE_FLOW[0x8A]_CUSBMSCLASSCONTROLLER_RUNERROR_EXIT=0x17
+[TRACE]TRACE_FLOW[0x8A]_CUSBMSCLASSCONTROLLER_RUNL_ENTRY=0x12
+[TRACE]TRACE_FLOW[0x8A]_CUSBMSCLASSCONTROLLER_RUNL_EXIT=0x13
+[TRACE]TRACE_FLOW[0x8A]_CUSBMSCLASSCONTROLLER_START_ENTRY=0x9
+[TRACE]TRACE_FLOW[0x8A]_CUSBMSCLASSCONTROLLER_START_EXIT=0xa
+[TRACE]TRACE_FLOW[0x8A]_CUSBMSCLASSCONTROLLER_START_EXIT_DUP1=0xb
+[TRACE]TRACE_FLOW[0x8A]_CUSBMSCLASSCONTROLLER_START_EXIT_DUP2=0xc
+[TRACE]TRACE_FLOW[0x8A]_CUSBMSCLASSCONTROLLER_START_STOP_DUP1=0xf
+[TRACE]TRACE_FLOW[0x8A]_CUSBMSCLASSCONTROLLER_STOP_ENTRY=0xd
+[TRACE]TRACE_FLOW[0x8A]_CUSBMSCLASSCONTROLLER_STOP_EXIT=0xe
+[TRACE]TRACE_FLOW[0x8A]_CUSBMSCLASSIMPCOLLECTION_IMPLEMENTATIONGROUPPROXY_ENTRY=0x1e
+[TRACE]TRACE_FLOW[0x8A]_CUSBMSCLASSIMPCOLLECTION_IMPLEMENTATIONGROUPPROXY_EXIT=0x1f
+[TRACE]TRACE_NORMAL[0x86]_CUSBMSCLASSCONTROLLER_READMASSSTORAGECONFIGL_DUP1=0x4
+[TRACE]TRACE_NORMAL[0x86]_CUSBMSCLASSCONTROLLER_READMASSSTORAGECONFIGL_DUP2=0x5
+[TRACE]TRACE_NORMAL[0x86]_CUSBMSCLASSCONTROLLER_READMASSSTORAGECONFIGL_DUP3=0x6
+[TRACE]TRACE_NORMAL[0x86]_CUSBMSCLASSCONTROLLER_READMASSSTORAGECONFIGL_DUP4=0x7
+[TRACE]TRACE_NORMAL[0x86]_CUSBMSCLASSCONTROLLER_READMASSSTORAGECONFIGL_DUP5=0x8
+[TRACE]TRACE_NORMAL[0x86]_CUSBMSCLASSCONTROLLER_READMASSSTORAGECONFIGL_DUP6=0x9
+[TRACE]TRACE_NORMAL[0x86]_CUSBMSCLASSCONTROLLER_START_DUP1=0x1
+[TRACE]TRACE_NORMAL[0x86]_CUSBMSCLASSCONTROLLER_START_DUP2=0x2
+[TRACE]TRACE_NORMAL[0x86]_CUSBMSCLASSCONTROLLER_STOP_DUP1=0x3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/group/bld.inf	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* 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: 
+*
+*/
+
+PRJ_PLATFORMS
+armv5
+
+PRJ_MMPFILES
+ncmclasscontroller.mmp
+
+PRJ_EXPORTS
+usbncmconfiguration.hby     /epoc32/rom/include/usbncmconfiguration.hby
+usbncm.iby                  /epoc32/rom/include/usbncm.iby
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/group/ncmcc_over_dummy_stubs.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,39 @@
+/*
+* 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
+@SYMPurpose ncmclasscontroller.dll USB NCM Class Controller over dummy stubs
+ */
+
+macro OVERDUMMY_NCMCC
+
+#include "ncmclasscontroller_base.mmp"
+
+target  dummy_ncmclasscontroller.dll
+
+UID 0x10009d8d 0x2002EA9F
+
+sourcepath    ../src
+START resource ncmcc_over_dummy.rss
+  TARGET dummy_ncmclasscontroller.rsc
+END
+
+// Dummy librarys
+LIBRARY     dummy_sock.lib
+LIBRARY     dummyusbsclddapi.lib
+LIBRARY     dummy_ncminternalsrv.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/group/ncmclasscontroller.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,39 @@
+/*
+* 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
+@SYMPurpose ncmclasscontroller.dll USB NCM Class Controller
+ */
+
+#include "ncmclasscontroller_base.mmp"
+
+target      ncmclasscontroller.dll
+
+UID 0x10009d8d 0x2002bcfd
+
+sourcepath    ../src
+START resource 2002bcfd.rss
+  TARGET ncmclasscontroller.rsc
+END
+
+LIBRARY     esock.lib
+LIBRARY     ncminternalsrv.lib
+LIBRARY     usbcsc_bil.lib
+LIBRARY     insock.lib
+LIBRARY     nifman.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/group/ncmclasscontroller_base.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* 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
+@SYMPurpose ncmclasscontroller.dll USB NCM Class Controller
+ */
+
+CAPABILITY CommDD NetworkControl NetworkServices LocalServices ProtServ
+targettype    plugin
+
+userinclude   ../inc
+userinclude   ../../inc
+userinclude   ../traces
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+sourcepath    ../src
+source      ncmclasscontroller.cpp 
+source      ncmclassimpcollection.cpp
+source      ncmconnectionmanager.cpp
+source      ncmiapprogresswatcher.cpp
+source      ncmconnectionmanagerhelper.cpp 
+source      ncmclassdescriptor.cpp
+source      ncmclientmanager.cpp
+source      ncmdhcpnotifwatcher.cpp
+source      ncmiapreader.cpp
+
+LIBRARY     euser.lib
+LIBRARY     usbclasscontroller.lib
+LIBRARY     efsrv.lib
+LIBRARY     bafl.lib 
+LIBRARY     commdb.lib
+LIBRARY     centralrepository.lib
+LIBRARY     commsfw.lib
+LIBRARY     esocksvr.lib
+LIBRARY     netmeta.lib
+LIBRARY     nodemessages.lib
+LIBRARY     random.lib
+LIBRARY     commsdataobjects.lib
+LIBRARY     commsdat.lib 
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/group/usbncm.iby	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* Configuration for NCM functions
+*
+*/
+
+#ifndef USBNCM_IBY
+#define USBNCM_IBY
+
+// NCM Feature flag
+#ifdef FF_AUTOMOTIVESTACK
+
+#include <usbncmconfiguration.hby>
+
+// *** NCM (networking control model) Class Controller.
+
+#ifdef USBNCM_PATCHDATA_KUSBNCM_CUSTOM_ETHERNET_FRAME_SIZE
+patchdata ncmclasscontroller.dll@KEthernetFrameSize USBNCM_PATCHDATA_KUSBNCM_CUSTOM_ETHERNET_FRAME_SIZE
+#endif
+
+USB_PLUGIN(ncmclasscontroller.dll,2002bcfd.rsc)
+file=ABI_DIR\USB_DIR\ncmpkt.drv        ncmpkt.drv
+file=ABI_DIR\USB_DIR\ncminternalsrv.dll   ncminternalsrv.dll
+
+#endif // FF_AUTOMOTIVESTACK
+
+#endif // USBNCM_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/group/usbncmconfiguration.hby	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* Configuration for NCM functions
+*
+*/
+
+#ifndef USBNCMCONFIGURATION_HBY
+#define USBNCMCONFIGURATION_HBY
+
+
+#define USBNCM_PATCHDATA_KUSBNCM_CUSTOM_ETHERNET_FRAME_SIZE  8192
+
+#endif // USBNCMCONFIGURATION_HBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/inc/ncmclasscontroller.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,99 @@
+/*
+* 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
+@internalComponent
+*/
+
+#ifndef NCMCLASSCONTROLLER_H
+#define NCMCLASSCONTROLLER_H
+
+#include <e32property.h>
+#include <cusbclasscontrollerplugin.h>
+
+#include "ncmconnectionmanagerobserver.h"
+#include "ncmcommon.h"
+
+#ifdef OVERDUMMY_NCMCC
+#include <usb/testncmcc/dummy_ncminternalsrv.h>
+#else
+#include "ncminternalsrv.h"
+#endif // OVERDUMMY_NCMCC
+
+class CNcmConnectionManager;
+class CNcmClientManager;
+
+/**
+ * NCM Class controller. 
+ * It is derived from CUsbClassControllerPlugIn. The USB Manager will control 
+ * NCM class through it.
+ * And it implements interface MNcmConnectionManagerObserver as well. 
+ */
+NONSHARABLE_CLASS(CNcmClassController): 
+                public CUsbClassControllerPlugIn,
+                public MNcmConnectionManagerObserver
+	{
+public:
+	static CNcmClassController* NewL(MUsbClassControllerNotify& aOwner);
+	~CNcmClassController();
+
+	// From MNcmConnectionManagerObserver
+    void McmoErrorIndication(TInt aError);
+    
+private:
+    /**
+     * Two-phases construction: phase 1
+     * @param[in]  aOwner, an Interface to talk to the USB server.
+     */
+	CNcmClassController(MUsbClassControllerNotify& aOwner);
+    /**
+     * Two-phases construction: phase 2
+     */
+	void ConstructL();
+	
+	// From CActive
+	void RunL();
+	void DoCancel();
+	TInt RunError(TInt aError);
+
+	// From CUsbClassControllerBase
+	void Start(TRequestStatus& aStatus);
+	void Stop(TRequestStatus& aStatus);
+	void GetDescriptorInfo(TUsbDescriptor& aDescriptorInfo) const;
+
+	
+private:
+	void RandomMacAddressL();
+	
+private: 
+    TNcmMacAddress         iHostMacAddress;
+	
+    CNcmConnectionManager*    iConnectionMan; // Owned.
+	
+	// Not own.
+	TRequestStatus*        iReportStatus;
+	
+	CNcmClientManager*     iClientMgr; // Owned
+	
+	RNcmInternalSrv        iNcmInternalSvr;
+	
+	TBool                  iConnectingToNcmPktDrv;
+
+    TUint                  iDataBufferSize; // Buffer size of data end points
+	};
+
+#endif // NCMCLASSCONTROLLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/inc/ncmclassdescriptor.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,79 @@
+/*
+* 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
+@internalComponent
+*/
+
+
+#ifndef NCMCLASSDESCRIPTOR_H
+#define NCMCLASSDESCRIPTOR_H
+
+#include <e32std.h>
+
+
+const TUint   KUSBNcmClassSpecificBufferSize = 29;
+
+
+/**
+ * Defined NCM Class Descriptor
+ */
+NONSHARABLE_CLASS(TNcmClassDescriptor) 	///< Class-specific descriptor
+	{
+public:
+	
+	//Header Functional Descriptor
+	TUint8	iHdrSize;			///< Header size
+	TUint8	iHdrType;			///< Type
+	TUint8	iHdrSubType;		///< Sub-type
+	TUint16 iHdrBcdCDC; 		///< CDC version no in binary coded decimal
+
+	//Union Functional Descriptor
+	TUint8	iUnSize;			///< Union descriptor size
+	TUint8	iUnType;			///< Union descriptor type
+	TUint8	iUnSubType; 		///< Union descriptor sub-type
+	TUint8	iUnMasterInterface; ///< Master interface number
+	TUint8	iUnSlaveInterface;	///< Slave interface number
+
+	//Ethernet Networking Functional Descriptor
+	TUint8	iEthFunLength;	///<	Size of this functional descriptor
+	TUint8	iEthFunType;	///<	CS_INTERFACE		
+	TUint8	iEthFunSubtype;	///<	Ethernet Networking functional descriptor subtype as defined in [USBCDC1.2]
+	TUint8	iMACAddress;		///<	Index of string descriptor. The string descriptor holds the 48bit Ethernet MAC address. 
+	TUint	iEthernetStatistics;	///<	Indicates which Ethernet statistics functions the device collects. 
+	TUint16	iMaxSegmentSize;	///<	The maximum segment size that the Ethernet device is capable of supporting. 
+	TUint16	iNumberMCFilters;	///<	Contains the number of multicast filters that can be configured by the host.
+	TUint8	iNumberPowerFilters;	///<	Contains the number of pattern filters that are available for causing wake-up of the host.
+
+	
+	//NCM Functional Descriptor
+	TUint8	iNcmFunLength;	///<	Size of this functional descriptor
+	TUint8	iNcmFunType;	///<	CS_INTERFACE
+	TUint8	iNcmFunSubtype;	///<	NCM Functional Descriptor subtype
+	TUint16	iNcmVersion;		///<	Release number of this specification in BCD
+	TUint8	iNetworkCapabilities;	///<	Specifies the capabilities of this function
+	
+public:
+	TDes8& Des();
+
+private:
+
+	TBuf8<KUSBNcmClassSpecificBufferSize> iBuffer;
+	};
+
+#endif // NCMCLASSDESCRIPTOR_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/inc/ncmclientmanager.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,102 @@
+/*
+* 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
+@internalComponent
+*/
+
+
+#ifndef NCMCLIENTMANAGER_H
+#define NCMCLIENTMANAGER_H
+
+#include <e32std.h>
+#include <e32base.h>
+
+#ifdef OVERDUMMY_NCMCC
+#include <dummyusbsclddapi.h>
+#else
+#include <d32usbcsc.h>
+#endif // OVERDUMMY_NCMCC
+
+#include "ncmcommon.h"
+
+class RNcmInternalSrv;
+
+/**
+ * A class which encapsulates the operations related to USB shared chunk LDD
+ */
+class CNcmClientManager : public CBase
+    {
+public:
+    /**
+     * Constructor
+     * @param[in]  aHostMacAddress, the NCM interface MAC address 
+     *             which will be used to config.
+     */
+    CNcmClientManager(const TNcmMacAddress& aHostMacAddress);
+    
+    ~CNcmClientManager();
+
+    /**
+     * Setup NCM interfaces
+     * @param[out]   aDataEpBufferSize, NCM data interface EP buffer size
+     */
+    void SetNcmInterfacesL(TUint& aDataEpBufferSize);
+    /**
+     * Transfer ownership of NCM interface handles to NCM internal 
+     * server which is located in C32 process space
+     * @param[in]   aServer, NCM internal server. 
+     */
+    void TransferInterfacesL(RNcmInternalSrv& aServer);
+        
+private:
+    /**
+     * Setup NCM communication interface
+     */
+    void SetCommunicationInterfaceL();
+    /**
+     * Setup NCM data interface
+     * @param   aDataEpBufferSize, NCM data interface EP buffer size
+     */
+    void SetDataInterfaceL(TUint& aDataEpBufferSize);
+    /**
+     * Setup NCM class specific descriptors
+     * @param   aDataInterfaceNumber, NCM data interface number
+     */
+    TInt SetupClassSpecificDescriptor(TUint8 aDataInterfaceNumber);
+    /**
+     * Set NCM interface MAC address into NCM class specific descriptor
+     * @param[out]   aStrIndex, the index of string which contains NCM 
+     *               interface MAC address 
+     */
+    TInt SetMacAddressString(TUint8& aStrIndex);
+    /**
+     * Get NCM data interface number
+     * @param[out]  aInterfaceNumber, NCM data interface number
+     */
+    TInt DataInterfaceNumber(TUint8& aInterfaceNumber);
+    
+private:
+    const TNcmMacAddress&   iHostMacAddress;
+    
+    TBool                   iCommLddInitiated;
+    RDevUsbcScClient        iCommLdd;
+    TBool                   iDataLddInitiated;
+    RDevUsbcScClient        iDataLdd;
+    };
+
+#endif // NCMCLIENTMANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/inc/ncmconnectionmanager.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,166 @@
+/*
+* 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
+@internalComponent
+*/
+
+#ifndef NCMCONNECTIONMANAGER_H
+#define NCMCONNECTIONMANAGER_H
+
+#ifdef OVERDUMMY_NCMCC
+#include <usb/testncmcc/dummy_essock.h>
+#include <usb/testncmcc/dummy_insock.h>
+#include <usb/testncmcc/dummy_nifman.h>
+#else
+#include <es_sock.h>
+#include <in_sock.h> 
+#include <nifman.h>
+#include <commdbconnpref.h>
+#endif // OVERDUMMY_NCMCC
+
+#include <e32property.h>
+#include "ncmcommon.h"
+#include "ncmiapprogressstateobserver.h"
+#include "ncmiapconnectionobserver.h"
+#include "ncmdhcpnotifobserver.h"
+#include "ncmiapreaderobserver.h"
+
+
+class MNcmConnectionManagerObserver;
+class CNcmIapProgressWatcher;
+class CNcmConnectionManHelper;
+class CNcmDhcpNotifWatcher;
+class CNcmIapReader;
+class RNcmInternalSrv;
+
+/**
+ * CNcmConnectionManager to control ncm networking interface
+ * It handles:
+ *  1 Searching NCM IAP
+ *  2 Start NCM connection
+ *  3 IAP progress notification
+ *  4 DHCP provisioning request from NCM internal server
+ */
+NONSHARABLE_CLASS(CNcmConnectionManager) : public CBase,
+										public MNcmIapProgressStateObserver,
+										public MNcmConnectionObserver,
+										public MNcmDhcpNotificationObserver,
+										public MNcmIAPReaderObserver
+	{
+public:
+    /**
+     * Constructs a CNcmConnectionManager object.
+     * @param[in]   aOwner, NCM connection observer
+     * @param[in]   aHostMacAddress, the NCM interface MAC address
+     * @param[in]   aDataBufferSize, the EndPoint buffer size
+     * @param[in]   aNcmInternalSvr, the NCM internal server
+     * @return      Ownership of a new CNcmConnectionManager object
+     */ 
+	static CNcmConnectionManager* NewL(MNcmConnectionManagerObserver& aOwner,
+            const TNcmMacAddress& aMacAddress, TUint aDataBufferSize,
+            RNcmInternalSrv&   aNcmInternalSvr);
+	~CNcmConnectionManager();
+	
+    /**
+     * Start NCM connection
+     * @param aStatus complete status for this request.
+     */
+	void Start(TRequestStatus& aStatus);
+	
+    /**
+     * Cancel starting of NCM connection 
+     */
+	void StartCancel();
+    
+    /**
+     * Stop NCM connection 
+     */
+	void Stop();
+	
+	// From MIapPorgressStateObserver
+	virtual void MipsoHandleClassFatalError(TInt aError);
+	
+	// From MNcmConnectionObserver
+	virtual void MicoHandleConnectionComplete(TInt aError);
+	
+	// From MNcmDhcpNotificationObserver
+	virtual void MdnoHandleDhcpNotification(TInt aError);
+	
+	// From MNcmIAPReaderObserver
+	virtual void MicoHandleIAPReadingComplete(TInt aError);
+
+private:
+    /**
+     * Two-phase construction: phase 1
+     * @param[in]   aObserver, NCM connection observer
+     * @param[in]   aHostMacAddress, the NCM interface MAC address
+     * @param[in]   aDataBufferSize, the EndPoint buffer size
+     * @param[in]   aNcmInternalSvr, the NCM internal server
+     */ 
+	CNcmConnectionManager(MNcmConnectionManagerObserver& aObserver, 
+	        const TNcmMacAddress& aHostMacAddress, TUint aDataBufferSize,
+            RNcmInternalSrv&   aNcmInternalSvr);
+	/**
+	 * Two-phase construction: phase 2
+	 */
+	void ConstructL();
+	
+	/**
+	 * Reset NCM connection manager
+	 */
+    void Reset();
+    
+    /*
+     * Change default MTU size on NCM connection
+     */
+    void SetCustomMtuL();
+    
+    /*
+     * Handle NCM connection building completion 
+     */
+	void HandleConnectionCompleteL();
+	
+private:
+	// Owned.
+	CNcmIapProgressWatcher*       iIapPrgrsWatcher;
+	CNcmConnectionManHelper*      iConnManHelper;
+	CNcmDhcpNotifWatcher*         iDhcpNotifWatcher;
+	CNcmIapReader*                iIapReader;
+
+	// Not own.
+	TRequestStatus* 					iReportStatus;
+	
+	MNcmConnectionManagerObserver& 		iConnMgrObserver;
+	
+	// RSocketServ used for starting NCM IAP and configuring DHCP and NAPT, owned
+	RSocketServ							iSocketServ;
+
+	// RConnection used for starting NCM IAP and configuring DHCP server, owned
+	RConnection							iConnection;
+    
+    TCommDbConnPref                     iConnPref;
+
+	RProperty 							iProperty;
+	TBool 								iConnComplete;
+	
+    const TNcmMacAddress&               iHostMacAddress;
+    const TUint                         iDataBufferSize;
+    RNcmInternalSrv&                    iNcmInternalSvr;
+};
+
+#endif // NCMCONNECTIONMANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/inc/ncmconnectionmanagerhelper.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* 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
+@internalComponent
+*/
+
+#ifndef NCMCONNECTIONMANAGERHELPER_H
+#define NCMCONNECTIONMANAGERHELPER_H
+
+#include <e32base.h>
+
+#ifdef OVERDUMMY_NCMCC
+#include <usb/testncmcc/dummy_essock.h>
+#include <usb/testncmcc/dummy_insock.h>
+#else
+#include <es_sock.h>
+#include <in_sock.h> 
+#include <commdbconnpref.h>
+#endif // OVERDUMMY_NCMCC
+
+class MNcmConnectionObserver;
+
+/**
+ * CNcmConnectionManHelper is the handler for NCM connection.
+ * 1 Start a NCM connection
+ * 2 Cancel starting attempt
+ * 3 Stop a NCM connection 
+ */
+NONSHARABLE_CLASS(CNcmConnectionManHelper) : public CActive
+	{
+public:
+    /** 
+     * Constructor
+     * @param[in]  aObserver, IAP connection observer
+     * @param[in]  aConnection, the NCM connection
+     */ 
+    CNcmConnectionManHelper(MNcmConnectionObserver& aObserver, RConnection& aConnection);
+
+	~CNcmConnectionManHelper();
+	void Start(TConnPref& aPref);
+	void Stop();
+	
+private:
+	
+	// From CActive
+	void RunL();
+	void DoCancel();
+
+private:
+	MNcmConnectionObserver&	iObserver; // IAP connection observer
+	RConnection&			iConnection; // The NCM connection	
+	};
+
+#endif // NCMCONNECTIONMANAGERHELPER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/inc/ncmconnectionmanagerobserver.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* 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
+@internalComponent
+*/
+
+#ifndef NCMCONNECTIONMANAGEROBSERVER_H
+#define NCMCONNECTIONMANAGEROBSERVER_H
+
+#include <e32std.h>
+
+/**
+ * MNcmConnectionManagerObserver defines the interface for connection manager
+ * callback.
+ */
+class MNcmConnectionManagerObserver
+    {
+public:
+    /*
+     * Called by NCM connection manager to report error to NCM connection 
+     * observer.
+     * @param   aError, error code reports to NCM connection observer
+     */
+    virtual void McmoErrorIndication(TInt aError) = 0;
+    };
+
+#endif // NCMCONNECTIONMANAGEROBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/inc/ncmdhcpnotifobserver.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* 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
+@internalComponent
+*/
+
+#ifndef NCMDHCPNOTIFOBSERVER_H
+#define NCMDHCPNOTIFOBSERVER_H
+
+#include <e32std.h>
+
+/**
+ * MdnoHandleDhcpNotification defines the interface for notification of Dhcp
+ * provisioning request
+ */
+class MNcmDhcpNotificationObserver
+    {
+public:
+    /**
+     * Called by DHCP prvisioning requestion watcher to handle DHCP 
+     * provisioning request notification from NCM internal server.
+     * @param   aError, completion code of DHCP provisioning request
+     */
+    virtual void MdnoHandleDhcpNotification(TInt aError) = 0;
+    };
+
+#endif // NCMDHCPNOTIFOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/inc/ncmdhcpnotifwatcher.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,74 @@
+/*
+* 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
+@internalComponent
+*/
+
+#ifndef NCMDHCPNOTIFWATCHER_H
+#define NCMDHCPNOTIFWATCHER_H
+
+#include <e32base.h>
+
+#ifdef OVERDUMMY_NCMCC
+#include <usb/testncmcc/dummy_essock.h>
+#include <usb/testncmcc/dummy_insock.h>
+#else
+#include <es_sock.h>
+#include <in_sock.h> 
+#endif // OVERDUMMY_NCMCC
+
+class MNcmDhcpNotificationObserver;
+class RNcmInternalSrv;
+
+/*
+ * CNcmDhcpNotifWatcher is handler of DHCP provisioning requestion from NCM 
+ * internal server.
+ */
+NONSHARABLE_CLASS(CNcmDhcpNotifWatcher) : public CActive
+	{
+public:
+    /**
+     * Constructor
+     * @param[in]  aObserver, the observer of DHCP provisioning result. 
+     * @param[in]  aNcmInteralSvr, the NCM internal server.
+     */
+    CNcmDhcpNotifWatcher(MNcmDhcpNotificationObserver& aObserver,
+            RNcmInternalSrv& aNcmInteralSvr);
+    
+	~CNcmDhcpNotifWatcher();
+	
+	/**
+	 * Start the watcher to monitor DHCP provisioning requestion from
+	 * NCM internal server.
+	 */
+	void StartL();
+	
+private:
+	
+	// From CActive
+	void RunL();
+	void DoCancel();
+
+private:
+	
+	MNcmDhcpNotificationObserver& iObserver;  // DHCP provisioning result observer
+	RNcmInternalSrv&           iNcmInteralSvr; // NCM internal server
+	};
+
+#endif // NCMDHCPNOTIFWATCHER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/inc/ncmiapconnectionobserver.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* 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
+@internalComponent
+*/
+
+#ifndef NCMIAPCONNECTIONOBSERVER_H
+#define NCMIAPCONNECTIONOBSERVER_H
+
+#include <e32std.h>
+
+/** MNcmConnectionObserver defines the interface to handle the Notification of 
+ * NCM connection established.
+ */
+class MNcmConnectionObserver
+    {
+public:
+    /**
+     * Called by connection watcher to handle NCM connection building 
+     * completion.
+     */
+    virtual void MicoHandleConnectionComplete(TInt aError) = 0;
+    };
+
+#endif // NCMIAPCONNECTIONOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/inc/ncmiapprogressstateobserver.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* 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
+@internalComponent
+*/
+
+#ifndef NCMIAPPROGRESSSTATEOBSERVER_H
+#define NCMIAPPROGRESSSTATEOBSERVER_H
+
+#include <e32std.h>
+
+/**
+ * MNcmIapProgressStateObserver defines the interface for events 
+ * on IAP progress stage changing.
+ */
+class MNcmIapProgressStateObserver
+    {
+public:
+    /**
+     * Called by connection watcher when it detects the class fatal error.
+     */
+    virtual void MipsoHandleClassFatalError(TInt aError) = 0;
+    };
+
+#endif // NCMIAPPROGRESSSTATEOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/inc/ncmiapprogresswatcher.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,71 @@
+/*
+* 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
+@internalComponent
+*/
+
+#ifndef NCMIAPPROGRESSWATCHER_H
+#define NCMIAPPROGRESSWATCHER_H
+
+#include <e32base.h>
+
+#ifdef OVERDUMMY_NCMCC
+#include <usb/testncmcc/dummy_essock.h>
+#include <usb/testncmcc/dummy_insock.h>
+#else
+#include <es_sock.h>
+#include <in_sock.h> 
+#endif // OVERDUMMY_NCMCC
+
+class MNcmIapProgressStateObserver;
+
+/**
+ * CNcmIapProgressWatcher will handle IAP state changes
+ */
+NONSHARABLE_CLASS(CNcmIapProgressWatcher) : public CActive
+	{
+public:
+    /**
+     * Constructor
+     * @param[in]  aObserver, the observer of IAP progress change. 
+     * @param[in]  aConnection, the NCM connection.
+     */
+    CNcmIapProgressWatcher(MNcmIapProgressStateObserver& aObserver, 
+                        RConnection& aConnection);
+    
+	~CNcmIapProgressWatcher();
+	
+	/**
+	 * Start IAP progress watcher
+	 */
+	void Start();
+	
+private:
+	// From CActive
+	void RunL();
+	void DoCancel();
+
+private:
+	
+	TNifProgressBuf            iProgressInfoBuf;
+	MNcmIapProgressStateObserver& iObserver;
+	RConnection&               iConnection;
+	};
+
+#endif // NCMIAPPROGRESSWATCHER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/inc/ncmiapreader.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,69 @@
+/*
+* 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
+@internalComponent
+*/
+
+#ifndef NCMIAPREADER_H
+#define NCMIAPREADER_H
+
+#include <e32base.h>
+
+class MNcmIAPReaderObserver;
+class TCommDbConnPref;
+
+/**
+ * IAP reader reads NCM IAP from CommDB and set it into NCM connection preference.
+ */
+NONSHARABLE_CLASS(CNcmIapReader) : public CActive
+	{
+public:
+
+    /**
+     * Constructor
+     * @param[in]  aObserver, the observer of IAP reading progress. 
+     * @param[in]  aConnection, the NCM connection preference.
+     */    
+    CNcmIapReader(MNcmIAPReaderObserver& aObserver, TCommDbConnPref& aConnPref);
+    
+    /**
+     * Destructor
+     */
+	~CNcmIapReader();
+	
+	/**
+	 * Start NCM IAP reader
+	 */
+	void Start();
+	
+private:
+	
+	// From CActive
+	void RunL();
+	void DoCancel();
+
+private:
+	void SearchNcmIapL();
+	
+private:
+	MNcmIAPReaderObserver&    iObserver;
+	TCommDbConnPref&       iConnPref;
+	};
+
+#endif // NCMIAPREADER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/inc/ncmiapreaderobserver.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,39 @@
+/*
+* 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
+@internalComponent
+*/
+
+#ifndef NCMIAPREADEROBSERVER_H
+#define NCMIAPREADEROBSERVER_H
+
+#include <e32std.h>
+
+/**
+MNcmIAPReaderObserver defines the interface for handling IAP reading completion
+*/
+class MNcmIAPReaderObserver
+    {
+public:
+    /**
+     * Called by IAP reader when IAP reading completed 
+     */
+    virtual void MicoHandleIAPReadingComplete(TInt aError) = 0;
+    };
+
+#endif // NCMIAPREADEROBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/src/2002bcfd.rss	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* 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
+ * @internalComponent
+ */
+
+
+#include <ecom/registryinfo.rh>
+
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = 0x2002bcfd;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x101fbf21;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x2002c305;
+                    version_no = 1;
+                    display_name = "NCM CC";
+                    default_data = "";
+                    opaque_data = "";
+                    }
+                };
+            }
+        };
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/src/ncmcc_over_dummy.rss	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* 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
+ @prototype
+*/
+
+
+#include <ecom/registryinfo.rh>
+
+RESOURCE REGISTRY_INFO theInfo
+	{
+	dll_uid = 0x2002EA9F;
+	interfaces =
+		{
+		INTERFACE_INFO
+			{
+			interface_uid = 0x101fbf21;
+			implementations =
+				{
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = 0x2002EA9F;
+					version_no = 1;
+					display_name = "Dummy NCM CC";
+					default_data = "";
+					opaque_data = "";
+					}
+				};
+			}
+		};
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/src/ncmclasscontroller.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,397 @@
+/*
+* 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
+ * @internalComponent
+ */
+
+#include <usb_std.h>
+#include <barsc.h>
+#include <barsread.h>
+#include <cusbclasscontrollerbase.h> 
+#include <musbclasscontrollernotify.h>
+#include <usb/usbncm.h>
+#include <random.h>
+
+#include "ncmclasscontroller.h"
+#include "ncmconnectionmanager.h"
+#include "ncmclientmanager.h"
+
+// For OST tracing
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "ncmclasscontrollerTraces.h"
+#endif
+
+
+using namespace UsbNcm;
+_LIT(KNcmControllerPanic, "UsbNcmCC"); // must be <=16 chars
+const TInt KNcmStartupPriority = 3;
+
+// MTU size. 
+extern const TUint KEthernetFrameSize = 8192;
+
+// Lengths of the various bits of the NCM descriptor. Taken from the NCM Specification rev 1.0.
+const TInt KNcmInterfaceDescriptorLength = 3;
+const TInt KNcmCcHeaderDescriptorLength = 5;
+const TInt KNcmFunctionalDescriptorLength = 4;
+const TInt KNcmCcUfdDescriptorLength = 5;
+const TInt KNcmDataClassHeaderDescriptorLength = 5;
+const TInt KNcmDeviceDescriptorLength = 18;
+const TInt KNcmConfigurationDescriptorLength = 9;
+const TInt KNcmCommunicationClassEndpointOutDescriptorLength = 9;
+const TInt KNcmNotificationEndpointDescriptorLength = 7;
+const TInt KNcmDataClassInterfaceDescriptorLength = 9;
+const TInt KNcmDataClassEndpointInDescriptorLength = 7;
+const TInt KNcmDataClassEndpointOutDescriptorLength = 7;
+
+const TInt KNcmDescriptorLength = KNcmInterfaceDescriptorLength
+        + KNcmCcHeaderDescriptorLength + KNcmFunctionalDescriptorLength
+        + KNcmCcUfdDescriptorLength + KNcmDataClassHeaderDescriptorLength
+        + KNcmDeviceDescriptorLength + KNcmConfigurationDescriptorLength
+        + KNcmCommunicationClassEndpointOutDescriptorLength
+        + KNcmNotificationEndpointDescriptorLength
+        + KNcmDataClassInterfaceDescriptorLength
+        + KNcmDataClassEndpointInDescriptorLength
+        + KNcmDataClassEndpointOutDescriptorLength;
+
+// Panic codes
+enum TNcmClassControllerPanicCode
+    {
+    ENcmPanicBadState = 1,
+    ENcmPanicOutstandingRequestFromDevice,
+    ENcmPanicAlreadyActive,
+    ENcmPanicUnhandledError,
+    ENcmPanicBadApiCallStart, // Attempt to call Start() when in illegal state
+    ENcmPanicBadApiCallStop, // Attempt to call Stop() when in illegal state
+    ENcmPanicUnexpectedIapState,
+    ENcmPanicUnexpectedError
+    };
+
+/**
+ * Constructs a CNcmClassController object.
+ * @param aOwner USB Device that owns and manages the class
+ * @return Ownership of a new CNcmClassController object
+ */
+CNcmClassController* CNcmClassController::NewL(
+        MUsbClassControllerNotify & aOwner)
+    {
+    OstTraceFunctionEntry0( CNCMCLASSCONTROLLER_NEWL_ENTRY );
+
+    CNcmClassController* self =
+            new (ELeave) CNcmClassController(aOwner);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    OstTraceFunctionExit1( CNCMCLASSCONTROLLER_NEWL_EXIT, ( TUint )( self ) );
+    return self;
+    }
+
+/**
+ * Constructor.
+ * @param aOwner USB Device that owns and manages the class
+ */
+CNcmClassController::CNcmClassController(
+        MUsbClassControllerNotify& aOwner) :
+    CUsbClassControllerPlugIn(aOwner, KNcmStartupPriority)
+    {
+    OstTraceFunctionEntryExt( CNCMCLASSCONTROLLER_CNCMCLASSCONTROLLER_ENTRY, this );
+    
+    iState = EUsbServiceIdle; // needs explicit initialisation as non-zero
+    
+    OstTraceFunctionExit1( CNCMCLASSCONTROLLER_CNCMCLASSCONTROLLER_EXIT, this );
+    }
+
+/**
+ * Method to perform second phase construction.
+ */
+void CNcmClassController::ConstructL()
+    {
+    OstTraceFunctionEntry1( CNCMCLASSCONTROLLER_CONSTRUCTL_ENTRY, this );
+    
+#ifndef OVERDUMMY_NCMCC
+    TInt err = KErrNone;
+    
+    OstTrace0(TRACE_NORMAL, CNCMCLASSCONTROLLER_CONSTRUCTL, "About to load eusbcsc!");
+    _LIT(KUsbSCLDDName, "eusbcsc");
+    err = User::LoadLogicalDevice(KUsbSCLDDName);
+    OstTrace1( TRACE_NORMAL, CNCMCLASSCONTROLLER_CONSTRUCTL_LOAD_CSC_LDD, "LoadLogicalDevice() returns %d!", err );
+    if (err != KErrNone && err != KErrAlreadyExists)
+        {
+        User::Leave(err);
+        }
+    OstTrace0(TRACE_NORMAL, CNCMCLASSCONTROLLER_CONSTRUCTL_CSC_LDD_LOADED, "Ldd eusbcsc loaded!");    
+#endif // OVERDUMMY_NCMCC
+    
+    RandomMacAddressL(); // Create a random MAC address for NCM host side interface.
+    iConnectionMan = CNcmConnectionManager::NewL(*this, iHostMacAddress, iDataBufferSize, iNcmInternalSvr);
+    iClientMgr = new  (ELeave) CNcmClientManager(iHostMacAddress);
+    OstTraceFunctionExit1( CNCMCLASSCONTROLLER_CONSTRUCTL_EXIT, this );
+    }
+
+void CNcmClassController::RandomMacAddressL()
+    {
+    OstTraceFunctionEntry1( CNCMCLASSCONTROLLER_RANDOMMACADDRESSL_ENTRY, this );
+    
+    //Create the NCM interface MAC address randomly 
+    iHostMacAddress.SetLength(KEthernetAddressLength);
+    TRandom::RandomL(iHostMacAddress);
+  
+    //Mark it a locally administered address
+    iHostMacAddress[0] = 0x02;
+    iHostMacAddress[1] = 0x00;
+    iHostMacAddress[2] = 0x00;
+    OstTraceFunctionExit1( CNCMCLASSCONTROLLER_RANDOMMACADDRESSL_EXIT, this );
+    }
+
+/**
+ * Destructor.
+ */
+CNcmClassController::~CNcmClassController()
+    {
+    OstTraceFunctionEntry1( CNCMCLASSCONTROLLER_CNCMCLASSCONTROLLER_ENTRY_DESTROY, this );
+    Cancel();
+
+    // Close internal server to release some resource
+    iNcmInternalSvr.Close();
+    delete iClientMgr;
+    delete iConnectionMan;
+
+#ifndef OVERDUMMY_NCMCC
+    OstTrace0(TRACE_NORMAL, CNCMCLASSCONTROLLER_CNCMCLASSCONTROLLER_PRE_UNLOAD_CSC_LDD, "About to unload Usbcsc!");
+    _LIT(KUsbSCLDDName, "Usbcsc");
+    TInt err = User::FreeLogicalDevice(KUsbSCLDDName);
+    OstTrace1(TRACE_NORMAL, CNCMCLASSCONTROLLER_CNCMCLASSCONTROLLER_UNLOAD_LDD_RESULT, "FreeLogicalDevice() returns %d!", err);
+#endif // OVERDUMMY_NCMCC
+    OstTraceFunctionExit1( CNCMCLASSCONTROLLER_CNCMCLASSCONTROLLER_EXIT_DESTROY, this );
+    }
+
+/**
+ * Called by UsbMan to start this class.
+ * @param aStatus Will be completed with success or failure.
+ */
+void CNcmClassController::Start(TRequestStatus& aStatus)
+    {
+    OstTraceFunctionEntryExt( CNCMCLASSCONTROLLER_START_ENTRY, this );
+    OstTrace1(TRACE_NORMAL, CNCMCLASSCONTROLLER_START_PRINT_STATE, "iState=%d", iState);
+    
+    //Start() should only be called if the CC is idle state		
+    __ASSERT_DEBUG((iState == EUsbServiceIdle),
+            User::Panic(KNcmControllerPanic, ENcmPanicBadApiCallStart));
+
+    // NB We enforce that the device doesn't re-post requests on us.
+    __ASSERT_DEBUG(!iReportStatus,
+            User::Panic(KNcmControllerPanic, ENcmPanicOutstandingRequestFromDevice));
+
+    // We should not be active before start
+    __ASSERT_DEBUG(!IsActive(), User::Panic(KNcmControllerPanic, ENcmPanicAlreadyActive));
+
+    aStatus = KRequestPending;
+    iReportStatus = &aStatus;
+
+    iState = EUsbServiceStarting;
+
+    // According to the latest discussion of 100ms limitation to 
+    // each personality starting, the calling to iConnectionMan->Start
+    // will happen later. A controller will set sevice state to started
+    // immediately after calling to RDevUsbcScClient::SetInterface()
+
+    TInt err = KErrNone;
+    
+    // Can not leave. Trap any error from SetNcmInterfacesL()
+    TRAP(err, iClientMgr->SetNcmInterfacesL(iDataBufferSize));
+    User::RequestComplete(iReportStatus, err);
+    
+    if (KErrNone == err)
+        {
+        // Set service state to started
+        iState = EUsbServiceStarted;
+        
+        iStatus = KRequestPending;
+        SetActive();
+        TRequestStatus* status = &iStatus;
+        User::RequestComplete(status, err);
+        }
+    OstTraceFunctionExit1( CNCMCLASSCONTROLLER_START_EXIT, this );
+    }
+
+/**
+ * Called by UsbMan to stop this class.
+ * @param aStatus Will be completed with success or failure.
+ */
+void CNcmClassController::Stop(TRequestStatus& aStatus)
+    {
+    OstTraceFunctionEntryExt( CNCMCLASSCONTROLLER_STOP_ENTRY, this );
+    OstTrace1( TRACE_NORMAL, CNCMCLASSCONTROLLER_STOP_PRINT_STATE, "iState=%d", iState );
+
+    __ASSERT_DEBUG(((iState == EUsbServiceStarted)||(iState == EUsbServiceStarting)),
+            User::Panic(KNcmControllerPanic, ENcmPanicBadApiCallStop));
+
+    // NB We enforce that the device doesn't re-post requests on us.
+    __ASSERT_DEBUG(!iReportStatus,
+            User::Panic(KNcmControllerPanic, ENcmPanicOutstandingRequestFromDevice));
+        
+    if (IsActive()) // Networking connetion building is ongoing!
+        {
+        Cancel();
+        }
+    else
+        {
+        iConnectionMan->Stop();
+        }
+
+    aStatus = KRequestPending;
+    iReportStatus = &aStatus;
+    User::RequestComplete(iReportStatus, KErrNone);
+    
+    iConnectingToNcmPktDrv = EFalse;
+    iState = EUsbServiceIdle;
+    OstTraceFunctionExit1( CNCMCLASSCONTROLLER_STOP_EXIT, this );
+    }
+
+/**
+ * Returns information about the interfaces supported by this class.
+ * @param aDescriptorInfo Will be filled in with interface information.
+ */
+void CNcmClassController::GetDescriptorInfo(
+        TUsbDescriptor& aDescriptorInfo) const
+    {
+    OstTraceFunctionEntryExt( CNCMCLASSCONTROLLER_GETDESCRIPTORINFO_ENTRY, this );
+
+    aDescriptorInfo.iNumInterfaces = 2;
+    aDescriptorInfo.iLength = KNcmDescriptorLength;
+    OstTraceFunctionExit1( CNCMCLASSCONTROLLER_GETDESCRIPTORINFO_EXIT, this );
+    }
+
+void CNcmClassController::McmoErrorIndication(TInt aError)
+    {
+    OstTraceFunctionEntryExt( CNCMCLASSCONTROLLER_MCMOERRORINDICATION_ENTRY, this );
+
+    Owner().UccnError(aError);
+    
+    OstTraceFunctionExit1( CNCMCLASSCONTROLLER_MCMOERRORINDICATION_EXIT, this );
+    }
+
+/**
+ * Called when connection manager completes.
+ */
+void CNcmClassController::RunL()
+    {
+    OstTraceFunctionEntry1( CNCMCLASSCONTROLLER_RUNL_ENTRY, this );
+    TInt completionCode = iStatus.Int();
+    OstTraceExt2( TRACE_NORMAL, CNCMCLASSCONTROLLER_RUNL_PRINT_INFO, "iState=%d; completionCode=%d", iState, completionCode );
+    
+    // Goto RunError() to handle any exception
+    User::LeaveIfError(completionCode);
+    
+    // We should only be in starting state when connection manager completes. Stopping is a synchronous call.
+    __ASSERT_DEBUG(EUsbServiceStarted == iState, User::Panic(KNcmControllerPanic, 
+            ENcmPanicBadState));
+
+    switch (iState)
+        {
+        case EUsbServiceStarted:
+            {            
+            OstTrace0( TRACE_NORMAL, CNCMCLASSCONTROLLER_RUNL_STARTED, "EUsbServiceStarted" );
+            if (iConnectingToNcmPktDrv)
+                {
+                OstTrace0( TRACE_FLOW, CNCMCLASSCONTROLLER_RUNL_TRANSFER_HANDLES, "An Ethernet connection over NCM built. Transfer interface handlers to NCM internal server." );
+                // NCM Packet Driver Loaded in C32, now transfer LDD handles to packet driver side through NCM internal server
+                iClientMgr->TransferInterfacesL(iNcmInternalSvr);
+                            
+                delete iClientMgr;
+                iClientMgr = NULL;
+                }
+            else
+                {
+                OstTrace0( TRACE_NORMAL, CNCMCLASSCONTROLLER_RUNL_BUILT_NCM_CONNECTION, "Going to build ethernet connection over NCM!" );
+                iConnectingToNcmPktDrv = ETrue;
+                iStatus = KRequestPending;
+                SetActive();
+                iConnectionMan->Start(iStatus);
+                }
+            
+            break;
+            }
+            
+        default:
+            {
+            OstTrace0( TRACE_ERROR, CNCMCLASSCONTROLLER_RUNL_DEFAULT, "Default::SHOULD NOT BE HERE!!!" );
+            User::Panic(KNcmControllerPanic, ENcmPanicBadState);
+            break;
+            }
+        }
+    OstTraceFunctionExit1( CNCMCLASSCONTROLLER_RUNL_EXIT, this );
+    }
+
+/**
+ * Implements cancellation of an outstanding request.
+ */
+void CNcmClassController::DoCancel()
+    {
+    OstTraceFunctionEntry1( CNCMCLASSCONTROLLER_DOCANCEL_ENTRY, this );
+
+    OstTraceExt2( TRACE_NORMAL, CNCMCLASSCONTROLLER_DOCANCEL_INFO_PRINT, "iState=%d; iReportStatus=%p", iState, iReportStatus );
+
+    // Update our iState. If we're starting, then roll back to idle. If we're 
+    // stopping, role back to started. Nothing else is legal.
+    switch (iState)
+        {
+        case EUsbServiceStarted:
+            OstTrace0( TRACE_NORMAL, CNCMCLASSCONTROLLER_DOCANCEL_IDLE, "EUsbServiceIdle" );
+            iState = EUsbServiceIdle;
+            if (iConnectingToNcmPktDrv)
+                {
+                iConnectionMan->StartCancel();
+                }
+            __ASSERT_DEBUG(!iReportStatus, User::Panic(KNcmControllerPanic, ENcmPanicUnhandledError));
+            
+            OstTraceFunctionExit1( CNCMCLASSCONTROLLER_DOCANCEL_EXIT, this );
+            return;
+            
+        default:
+            OstTrace1(TRACE_FATAL, CNCMCLASSCONTROLLER_DOCANCEL_DEFAULT, "Default::Should not be here:iState=%d", iState);
+            User::Panic(KNcmControllerPanic, ENcmPanicBadState);
+            break;
+        }
+
+    // Complete the client's request.	
+    __ASSERT_DEBUG(iReportStatus, User::Panic(KNcmControllerPanic, ENcmPanicUnhandledError));
+    User::RequestComplete(iReportStatus, KErrCancel);
+
+    OstTraceFunctionExit1( CNCMCLASSCONTROLLER_DOCANCEL_EXIT_DUP1, this );
+    }
+
+/**
+ * Called when RunL leaves. Does nothing, just return KErrNone.
+ * @return Error code. Simply return KErrNone.
+ */
+TInt CNcmClassController::RunError(TInt aError)
+    {
+    OstTraceFunctionEntryExt( CNCMCLASSCONTROLLER_RUNERROR_ENTRY, this );
+    
+    if (KErrCancel != aError)
+        {
+        // Report this failure to the observer
+        // Finally this will report to usbman and NCM class will be stopped.    
+        McmoErrorIndication(aError);
+        }
+
+    OstTraceFunctionExitExt( CNCMCLASSCONTROLLER_RUNERROR_EXIT, this, KErrNone );
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/src/ncmclassdescriptor.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,87 @@
+/*
+* 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
+ * @internalComponent
+ */
+
+#ifdef OVERDUMMY_NCMCC
+#include <usb/testncmcc/dummy_essock.h>
+#else
+#include <es_sock.h> 
+#endif // OVERDUMMY_NCMCC
+
+#include "ncmclassdescriptor.h"
+// For OST tracing
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "ncmclassdescriptorTraces.h"
+#endif
+
+
+/**
+ * This function packs the TNcmClassDescriptor class into a descriptor with 
+ * the correct byte alignment for transmission on the USB bus.
+ *
+ * @return Correctly-aligned buffer. NB The buffer returned is a member of 
+ * this class and has the same lifetime.
+ */
+TDes8& TNcmClassDescriptor::Des()
+	{    
+	OstTraceFunctionEntry0( TNCMCLASSDESCRIPTOR_DES_ENTRY );
+	TUint index = 0;
+
+	iBuffer.SetLength(KUSBNcmClassSpecificBufferSize);
+
+	iBuffer[index++] = iHdrSize;
+	iBuffer[index++] = iHdrType;
+	iBuffer[index++] = iHdrSubType;
+	LittleEndian::Put16(&iBuffer[index], iHdrBcdCDC);
+	index += 2;
+
+	iBuffer[index++] = iUnSize;
+	iBuffer[index++] = iUnType;
+	iBuffer[index++] = iUnSubType;
+	iBuffer[index++] = iUnMasterInterface;
+	iBuffer[index++] = iUnSlaveInterface;
+
+	iBuffer[index++] = iEthFunLength;
+	iBuffer[index++] = iEthFunType;
+	iBuffer[index++] = iEthFunSubtype;
+	iBuffer[index++] = iMACAddress;
+	LittleEndian::Put32(&iBuffer[index], iEthernetStatistics);	
+	index += 4;
+	LittleEndian::Put16(&iBuffer[index], iMaxSegmentSize);	
+	index += 2;
+	LittleEndian::Put16(&iBuffer[index], iNumberMCFilters);	
+	index += 2;
+	iBuffer[index++] = iNumberPowerFilters;
+
+	iBuffer[index++] = iNcmFunLength;
+	iBuffer[index++] = iNcmFunType;
+	iBuffer[index++] = iNcmFunSubtype;
+	LittleEndian::Put16(&iBuffer[index], iNcmVersion);	
+	index += 2;
+	iBuffer[index++] = iNetworkCapabilities;
+
+	OstTraceFunctionExit0( TNCMCLASSDESCRIPTOR_DES_EXIT );
+	return iBuffer;
+	}
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/src/ncmclassimpcollection.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,44 @@
+/*
+* 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
+ * @internalComponent
+ */
+
+#include <e32base.h>
+#include <e32std.h>
+#include <ecom/ecom.h>
+#include <ecom/implementationproxy.h>
+#include "ncmclasscontroller.h"
+
+// Define the private interface UIDs
+const TImplementationProxy UsbCCImplementationTable[] =
+    {
+#ifdef OVERDUMMY_NCMCC
+    IMPLEMENTATION_PROXY_ENTRY(0x2002EA9F, CNcmClassController::NewL),    
+#else
+	IMPLEMENTATION_PROXY_ENTRY(0x2002c305, CNcmClassController::NewL),
+#endif // OVERDUMMY_NCMCC
+    };
+
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+    {
+    aTableCount = sizeof(UsbCCImplementationTable) / sizeof(TImplementationProxy);
+
+    return UsbCCImplementationTable;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/src/ncmclientmanager.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,556 @@
+/*
+* 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
+ * @internalComponent
+ */
+
+#include "ncmclientmanager.h"
+
+
+#ifdef OVERDUMMY_NCMCC
+#include <usb/testncmcc/dummy_ncminternalsrv.h>
+#else
+#include "ncminternalsrv.h"
+#endif // OVERDUMMY_NCMCC
+
+#include "ncmclassdescriptor.h"
+// For OST tracing
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "ncmclientmanagerTraces.h"
+#endif
+
+
+// NCM Interface MTU size
+extern const TUint KEthernetFrameSize;
+
+// NCM MAC Address String descriptor buffer length
+const TUint KMacAddrStringDescSize = 32;
+
+
+/**
+ * Construtor
+ * @param aMacAddress the NCM ethernet interface MAC address
+ */
+CNcmClientManager::CNcmClientManager(const TNcmMacAddress& aHostMacAddress):
+        iHostMacAddress(aHostMacAddress)
+    {
+    OstTraceFunctionEntryExt( CNCMCLIENTMANAGER_CNCMCLIENTMANAGER_ENTRY, this );
+    
+    // No implementation required
+    OstTraceFunctionExit1( CNCMCLIENTMANAGER_CNCMCLIENTMANAGER_EXIT, this );
+    }
+
+/**
+ * Destructor
+ */
+CNcmClientManager::~CNcmClientManager()
+    {
+    OstTraceFunctionEntry0( CNCMCLIENTMANAGER_CNCMCLIENTMANAGER_ENTRY_DESTRUCTOR );
+    
+    TInt err = KErrNone;
+    if (iCommLddInitiated)
+        {
+        RChunk* commChunk = NULL;
+        OstTrace0(TRACE_NORMAL, CNCMCLIENTMANAGER_CNCMCLIENTMANAGER_PRE_CLOSE_COMM_INTERFACE, "About to get chunk handle for communication interface!");        
+        err = iCommLdd.GetDataTransferChunk(commChunk);
+        if (KErrNone == err)
+            {
+            OstTrace0(TRACE_NORMAL, CNCMCLIENTMANAGER_CNCMCLIENTMANAGER_CLOSE_COMM_CHUNK, "About to close chunk handle for communication interface!");
+            commChunk->Close();    
+            }
+        else
+            {
+            OstTrace1(TRACE_ERROR, CNCMCLIENTMANAGER_CNCMCLIENTMANAGER_CLOSE_COMM_CHUNK_FAIL, "Can not get chunk handle for communication interface: err = %d", err);
+            }
+        
+        OstTrace0(TRACE_NORMAL, CNCMCLIENTMANAGER_CNCMCLIENTMANAGER_CLOSE_COMM_INTERFACE, "About to close device handle for communication interface!");        
+        iCommLdd.Close();
+        }
+
+    if (iDataLddInitiated)
+        {
+        RChunk* dataChunk = NULL;
+        OstTrace0(TRACE_NORMAL, CNCMCLIENTMANAGER_CNCMCLIENTMANAGER_PRE_CLOSE_DATA_INTERFACE, "About to get chunk handle for data interface!");
+        err = iDataLdd.GetDataTransferChunk(dataChunk);
+        if (KErrNone == err)
+            {
+            OstTrace0(TRACE_NORMAL, CNCMCLIENTMANAGER_CNCMCLIENTMANAGER_CLOSE_DATA_CHUNK, "About to close chunk handle for communication interface!");
+            dataChunk->Close();
+            }
+        else
+            {
+            OstTrace1(TRACE_ERROR, CNCMCLIENTMANAGER_CNCMCLIENTMANAGER_CLOSE_DATA_CHUNK_FAIL, "Can not get chunk handle for data interface: err = %d", err);
+            }
+
+        OstTrace0(TRACE_NORMAL, CNCMCLIENTMANAGER_CNCMCLIENTMANAGER_CLOSE_DATA_INTERFACE, "About to close device handle for data interface!");
+        iDataLdd.Close();
+        }
+    OstTraceFunctionExit0( CNCMCLIENTMANAGER_CNCMCLIENTMANAGER_ENTRY_DESTRUCTOR_EXIT );
+    }
+
+
+/**
+ * Setup NCM interfaces
+ * @param[out]   aDataEpBufferSize, NCM data interface EP buffer size
+ */
+void CNcmClientManager::SetNcmInterfacesL(TUint& aDataEpBufferSize)
+    {
+    OstTraceFunctionEntryExt( CNCMCLIENTMANAGER_SETNCMINTERFACESL_ENTRY, this );
+    
+    // Setup NCM communication interface
+    SetCommunicationInterfaceL();
+    
+    // Setup NCM data interface
+    SetDataInterfaceL(aDataEpBufferSize);
+    
+    // Retrieve data interface number
+    TUint8 dataInterfaceNumber = 1;
+    User::LeaveIfError(DataInterfaceNumber(dataInterfaceNumber));
+    
+    // Setup NCM class descriptor with correct interface number
+    User::LeaveIfError(SetupClassSpecificDescriptor(dataInterfaceNumber));
+    OstTraceFunctionExit1( CNCMCLIENTMANAGER_SETNCMINTERFACESL_EXIT, this );
+    }
+
+/**
+ * Transfer NCM interface handlers from NCM class controller to NCM 
+ * packet driver through NCM internal server.
+ * @param aServer a reference to RNcmInternalSrv 
+ */
+void CNcmClientManager::TransferInterfacesL(RNcmInternalSrv& aServer)
+    {
+    OstTraceFunctionEntryExt( CNCMCLIENTMANAGER_TRANSFERINTERFACESL_ENTRY, this );
+    
+    RChunk* commChunk = NULL;
+    RChunk* dataChunk = NULL;
+
+    OstTrace0(TRACE_NORMAL, CNCMCLIENTMANAGER_TRANSFERINTERFACESL_PRE_TRANSFER_INTERFACES, "About to Transfer handles to NCM internal server!");
+    User::LeaveIfError(iCommLdd.GetDataTransferChunk(commChunk));
+    User::LeaveIfError(iDataLdd.GetDataTransferChunk(dataChunk));
+    User::LeaveIfError(aServer.TransferHandle(iCommLdd, *commChunk, 
+            iDataLdd, *dataChunk));
+    OstTrace0(TRACE_NORMAL, CNCMCLIENTMANAGER_TRANSFERINTERFACESL_INTERFACES_TRANSFERED, "Transfer handles to NCM internal server Done!");
+    OstTraceFunctionExit1( CNCMCLIENTMANAGER_TRANSFERINTERFACESL_EXIT, this );
+    }
+
+/**
+ * Setup NCM communication inteface
+ */
+void CNcmClientManager::SetCommunicationInterfaceL()
+    {
+    OstTraceFunctionEntry1( CNCMCLIENTMANAGER_SETCOMMUNICATIONINTERFACEL_ENTRY, this );
+        
+    User::LeaveIfError(iCommLdd.Open(0));
+    iCommLddInitiated = ETrue;
+
+    TInt err = KErrNone;
+
+    TUsbcScInterfaceInfoBuf ifc0;
+    TUsbcDeviceState deviceStatus;
+    
+    User::LeaveIfError(iCommLdd.DeviceStatus(deviceStatus));
+
+    if (deviceStatus == EUsbcDeviceStateConfigured)
+        {
+        User::Leave( KErrInUse);
+        }
+
+    TUsbDeviceCaps dCaps;
+    User::LeaveIfError(iCommLdd.DeviceCaps(dCaps));
+
+    TInt epNum = dCaps().iTotalEndpoints;
+
+    TUsbcEndpointData data[KUsbcMaxEndpoints];
+    TPtr8 dataptr(reinterpret_cast<TUint8*> (data), sizeof(data),
+            sizeof(data));
+
+    User::LeaveIfError(iCommLdd.EndpointCaps(dataptr));
+
+    TBool foundIntIN = EFalse;
+    const TUint KEndPointType = KUsbEpTypeInterrupt | KUsbEpDirIn;
+    for (TInt i = 0; i < epNum; i++)
+        {
+        const TUsbcEndpointData* epData = &data[i];
+        if ((!epData->iInUse) && // Not in use
+            ((epData->iCaps.iTypesAndDir & KEndPointType) == KEndPointType))
+            {
+            // EEndpoint1 is going to be our INTERRUPT (IN, write) endpoint
+            ifc0().iEndpointData[0].iType = KUsbEpTypeInterrupt;
+            ifc0().iEndpointData[0].iDir = KUsbEpDirIn;
+            ifc0().iEndpointData[0].iSize = epData->iCaps.MinPacketSize();
+            ifc0().iEndpointData[0].iInterval = 0x01;
+            ifc0().iEndpointData[0].iInterval_Hs = 0x01;
+
+            foundIntIN = ETrue;
+            break;
+            }
+        }
+    if (EFalse == foundIntIN)
+        {
+        OstTrace0( TRACE_ERROR, CNCMCLIENTMANAGER_SETCOMMUNICATIONINTERFACEL, "Can not find proper endpint for NCM communication interface" );
+        User::Leave( KErrNotFound);
+        }
+    
+    /*********************************************************************************************/
+    //Communication Class Interface (0x00)
+    /*********************************************************************************************/
+    _LIT16(KIfClassName0, "USB Networking (NCM)");
+    HBufC16* string0 = KIfClassName0().AllocLC();
+
+    ifc0().iString = string0;
+    ifc0().iTotalEndpointsUsed = 1;
+    ifc0().iClass.iClassNum = 0x02;
+    ifc0().iClass.iSubClassNum = 0x0D;
+    ifc0().iClass.iProtocolNum = 0x00;
+
+    User::LeaveIfError(iCommLdd.SetInterface(0, ifc0));
+
+    err = iCommLdd.FinalizeInterface();
+    if (KErrNone != err)
+        {
+        OstTrace1(TRACE_ERROR, CNCMCLIENTMANAGER_SETCOMMUNICATIONINTERFACEL_FAIL_TO_INIT, "Failed to FinalizeInterface, err %d", err);
+        User::Leave(err);
+        }
+    CleanupStack::PopAndDestroy(string0);
+    OstTraceFunctionExit1( CNCMCLIENTMANAGER_SETCOMMUNICATIONINTERFACEL_EXIT, this );
+    }
+
+/**
+ * Setup NCM data interface
+ * @param   aDataEpBufferSize, the determined data interface 
+ *          endpoint buffer size.
+ */
+void CNcmClientManager::SetDataInterfaceL(TUint& aDataEpBufferSize)
+    {
+    OstTraceFunctionEntryExt( CNCMCLIENTMANAGER_SETDATAINTERFACEL_ENTRY, this );
+    
+    const TUint KMaxScBufferSize = 1048576; // Up limit of end point buffer
+    const TUint KMinScBufferSize = 262144;  // Lower limit of end point buffer
+    const TUint KMaxScReadSize = 65536;
+
+    User::LeaveIfError(iDataLdd.Open(0));
+    iDataLddInitiated = ETrue;
+
+    TUsbcScInterfaceInfoBuf ifc0, ifc1;
+    TUsbDeviceCaps dCaps;
+    User::LeaveIfError(iDataLdd.DeviceCaps(dCaps));
+
+    TBool isResourceAllocationV2 = ((dCaps().iFeatureWord1
+            & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) != 0);
+    
+    TUsbcDeviceState deviceStatus;
+    
+    User::LeaveIfError(iDataLdd.DeviceStatus(deviceStatus));
+    if (deviceStatus == EUsbcDeviceStateConfigured)
+        {
+        User::Leave(KErrInUse);
+        }
+
+    TInt epNum = dCaps().iTotalEndpoints;
+    TUsbcEndpointData data[KUsbcMaxEndpoints];
+    TPtr8 dataptr(reinterpret_cast<TUint8*> (data), sizeof(data),
+            sizeof(data));
+
+    User::LeaveIfError(iDataLdd.EndpointCaps(dataptr));
+
+    const TUint KNcmDataInterfaceEpNumber = 2;
+    TBool foundBulkIN = EFalse;
+    TBool foundBulkOUT = EFalse;
+    TInt maxPacketSize = 0;
+    const TUint KEndPointBulkInType = KUsbEpTypeBulk | KUsbEpDirIn;
+    const TUint KEndPointBulkOutType = KUsbEpTypeBulk | KUsbEpDirOut;
+    for (TInt i = 0; i < epNum; i++)
+        {
+        const TUsbcEndpointData* epData = &data[i];
+        
+        // Check if this endpoint is in use 
+        if (epData->iInUse)
+            {
+            continue;
+            }
+        
+        maxPacketSize = epData->iCaps.MaxPacketSize();
+        if (!foundBulkIN && 
+                ((epData->iCaps.iTypesAndDir & KEndPointBulkInType) == KEndPointBulkInType))
+            {
+            // EEndpoint1 is going to be our TX (IN, write) endpoint
+            ifc1().iEndpointData[0].iType = KUsbEpTypeBulk;
+            ifc1().iEndpointData[0].iDir = KUsbEpDirIn;
+            ifc1().iEndpointData[0].iSize = maxPacketSize;
+            ifc1().iEndpointData[0].iInterval_Hs = 0x0;
+            ifc1().iEndpointData[0].iBufferSize = KMaxScBufferSize;
+
+            if (isResourceAllocationV2)
+                {
+                ifc1().iEndpointData[0].iFeatureWord1 |= 
+                    (KUsbcEndpointInfoFeatureWord1_DMA | KUsbcEndpointInfoFeatureWord1_DoubleBuffering);
+                }
+            
+            foundBulkIN = ETrue;
+            if (foundBulkIN && foundBulkOUT)
+                {
+                break;
+                }
+            continue;
+            }
+
+        if (!foundBulkOUT && 
+                ((epData->iCaps.iTypesAndDir & KEndPointBulkOutType) == KEndPointBulkOutType))
+            {
+            // EEndpoint2 is going to be our RX (OUT, read) endpoint
+            ifc1().iEndpointData[1].iType = KUsbEpTypeBulk;
+            ifc1().iEndpointData[1].iDir = KUsbEpDirOut;
+            ifc1().iEndpointData[1].iSize = maxPacketSize;
+            ifc1().iEndpointData[1].iInterval_Hs = 0x1;
+            ifc1().iEndpointData[1].iBufferSize = KMaxScBufferSize;
+            ifc1().iEndpointData[1].iReadSize = KMaxScReadSize;
+
+            if (isResourceAllocationV2)
+                {
+                ifc1().iEndpointData[1].iFeatureWord1 |= 
+                    (KUsbcEndpointInfoFeatureWord1_DMA | KUsbcEndpointInfoFeatureWord1_DoubleBuffering);
+                }
+
+            foundBulkOUT = ETrue;
+            if (foundBulkIN && foundBulkOUT)
+                {
+                break;
+                }
+            continue;
+            }
+        }
+
+    // Leave if no properly endpoint is found
+    if (EFalse == foundBulkIN || EFalse == foundBulkOUT)
+        {
+        User::Leave(KErrNotFound);
+        }
+    
+    _LIT16(KIfClassName0, "NCM Data Interface 0");
+
+    HBufC16* string0 = KIfClassName0().AllocL();
+    CleanupStack::PushL(string0);    
+    ifc0().iString = string0;
+    ifc0().iTotalEndpointsUsed = 0;
+    ifc0().iClass.iClassNum = 0x0A;
+    ifc0().iClass.iSubClassNum = 0x00;
+    ifc0().iClass.iProtocolNum = 0x01;    
+    User::LeaveIfError(iDataLdd.SetInterface(0, ifc0));
+        
+    _LIT16(KIfClassName1, "NCM Data Interface 1");
+    HBufC16* string1 = KIfClassName1().AllocL();
+    CleanupStack::PushL(string1);
+    ifc1().iString = string1;
+    ifc1().iTotalEndpointsUsed = KNcmDataInterfaceEpNumber;
+    ifc1().iClass.iClassNum = 0x0A;
+    ifc1().iClass.iSubClassNum = 0x00;
+    ifc1().iClass.iProtocolNum = 0x01;
+    
+    // Try to allocate expected memory for data interface endpoints
+    aDataEpBufferSize = KMaxScBufferSize;
+    
+    TInt err = KErrNone; 
+    FOREVER
+        {
+        OstTrace1(TRACE_NORMAL, CNCMCLIENTMANAGER_SETDATAINTERFACEL_TRY_NEW_BUF_SIZE, "Try buffer size: %d", aDataEpBufferSize);
+        err = iDataLdd.SetInterface(1, ifc1);
+        if (KErrNoMemory == err)
+            {
+            // Reduce buffer size and retry
+            aDataEpBufferSize = aDataEpBufferSize / 2;
+            if (aDataEpBufferSize < KMinScBufferSize)
+                {
+                User::Leave(KErrNoMemory);
+                }
+            ifc1().iEndpointData[0].iBufferSize = aDataEpBufferSize;
+            ifc1().iEndpointData[1].iBufferSize = aDataEpBufferSize;
+            continue;
+            }
+        else
+            {
+            OstTrace1(TRACE_ERROR, CNCMCLIENTMANAGER_SETDATAINTERFACEL_SET_INTERFACE_FAIL, "Set data interface and the returned err code is %d", err);
+            // Leave with error code
+            User::LeaveIfError(err);
+            break;
+            }
+        }
+    
+    CleanupStack::PopAndDestroy(2, string0);
+
+    User::LeaveIfError(iDataLdd.FinalizeInterface());
+    OstTraceFunctionExit1( CNCMCLIENTMANAGER_SETDATAINTERFACEL_EXIT, this );
+    }
+
+/**
+ * Setup the Class Descriptors
+ * @param aDataInterfaceNumber The interface number of the data class
+ * @return Error.
+ */
+TInt CNcmClientManager::SetupClassSpecificDescriptor(TUint8 aDataInterfaceNumber)
+    {
+    OstTraceFunctionEntryExt( CNCMCLIENTMANAGER_SETUPCLASSSPECIFICDESCRIPTOR_ENTRY, this );
+    
+    TInt res;
+
+    TNcmClassDescriptor descriptor;   
+
+    // Header Functional Descriptor- CDC spec table 15
+    descriptor.iHdrSize = 0x05;
+    descriptor.iHdrType = 0x24;
+    descriptor.iHdrSubType = 0x00;
+    descriptor.iHdrBcdCDC = 0x0120;
+
+    // Ethernet Networking Functional Descriptor-    ECM spec table 3
+    descriptor.iEthFunLength = 0x0D;
+    descriptor.iEthFunType = 0x24;
+    descriptor.iEthFunSubtype = 0x0F;
+    
+    // Generate the MAC address new NCM interface
+    res = SetMacAddressString(descriptor.iMACAddress);
+
+    if (res != KErrNone)
+        {
+        OstTraceFunctionExitExt( CNCMCLIENTMANAGER_SETUPCLASSSPECIFICDESCRIPTOR_EXIT, this, res );
+        return res;
+        }
+
+    descriptor.iEthernetStatistics = 0;
+    descriptor.iMaxSegmentSize = KEthernetFrameSize;
+    descriptor.iNumberMCFilters = 0;
+    descriptor.iNumberPowerFilters = 0;
+
+    // NCM Functional Descriptor-    NCM spec table 5-2
+    descriptor.iNcmFunLength = 0x06;
+    descriptor.iNcmFunType = 0x24;
+    descriptor.iNcmFunSubtype = 0x1A;
+    descriptor.iNcmVersion = 0x0100;
+    descriptor.iNetworkCapabilities = 0;
+
+    // Union functional descriptor- CDC spec table 16
+    descriptor.iUnSize = 0x05;
+    descriptor.iUnType = 0x24;
+    descriptor.iUnSubType = 0x06;
+    descriptor.iUnMasterInterface = 0;
+    descriptor.iUnSlaveInterface = aDataInterfaceNumber;
+
+    OstTrace0( TRACE_NORMAL, CNCMCLIENTMANAGER_SETUPCLASSSPECIFICDESCRIPTOR_PRE_SET_BLOCK, "About to call SetCSInterfaceDescriptorBlock" );
+    res = iCommLdd.SetCSInterfaceDescriptorBlock(0, descriptor.Des());
+    if (res != KErrNone)
+        {
+        OstTraceFunctionExitExt( CNCMCLIENTMANAGER_SETUPCLASSSPECIFICDESCRIPTOR_EXIT_DUP1, this, res );
+        return res;
+        }
+
+    OstTraceFunctionExitExt( CNCMCLIENTMANAGER_SETUPCLASSSPECIFICDESCRIPTOR_EXIT_DUP2, this, KErrNone );
+    return KErrNone;
+    }
+
+/**
+ * Set the MAC address string in descriptor
+ * @param aStrIndex the MAC address string index
+ */
+TInt CNcmClientManager::SetMacAddressString(TUint8& aStrIndex)
+    {
+    OstTraceFunctionEntryExt( CNCMCLIENTMANAGER_SETMACADDRESSSTRING_ENTRY, this );
+    
+    TBuf16<KMacAddrStringDescSize> str;
+    
+    // Search for MAC address string from index 0x10
+    aStrIndex = 0x10;
+
+    TInt ret = KErrNone;
+#ifndef OVERDUMMY_NCMCC
+    while (aStrIndex++ < 0xFF && ret != KErrNotFound)
+        {
+        ret = iDataLdd.GetStringDescriptor(aStrIndex, str);
+        }
+#endif // OVERDUMMY_NCMCC
+
+    if (aStrIndex < 0xFF)
+        {
+        TBuf8<KEthernetAddressLength*2> macAddrStr;
+        _LIT8(KMacAddressFormat, "%02X%02X%02X%02X%02X%02X");
+        OstTraceExt1(TRACE_NORMAL, CNCMCLIENTMANAGER_SETMACADDRESSSTRING, "The MAC address is %s", iHostMacAddress);
+        macAddrStr.AppendFormat(KMacAddressFormat, iHostMacAddress[0],
+                iHostMacAddress[1], iHostMacAddress[2], iHostMacAddress[3],
+                iHostMacAddress[4], iHostMacAddress[5]);
+        str.Copy(macAddrStr);
+        ret = iDataLdd.SetStringDescriptor(aStrIndex, str);
+        }
+    
+    OstTraceFunctionExitExt( CNCMCLIENTMANAGER_SETMACADDRESSSTRING_EXIT, this, ret );
+    return ret;
+    }
+
+/**
+ * Get NCM data interface number
+ * @param aInterfaceNumber NCM data interface number
+ * @return Error.
+ */
+TInt CNcmClientManager::DataInterfaceNumber(TUint8& aInterfaceNumber)
+    {
+    OstTraceFunctionEntryExt( CNCMCLIENTMANAGER_DATAINTERFACENUMBER_ENTRY, this );
+    
+    TInt interfaceSize = 0;
+
+    // 0 means the main interface in the LDD API
+    TInt res = iDataLdd.GetInterfaceDescriptorSize(0, interfaceSize);
+
+    if ( KErrNone == res )
+        {
+        OstTraceFunctionExitExt( CNCMCLIENTMANAGER_DATAINTERFACENUMBER_EXIT, this, res );
+        return res;
+        }
+
+    HBufC8* interfaceBuf = HBufC8::New(interfaceSize);
+    if ( !interfaceBuf )
+        {
+        OstTraceFunctionExitExt( CNCMCLIENTMANAGER_DATAINTERFACENUMBER_EXIT_DUP1, this, KErrNoMemory);
+        return KErrNoMemory;
+        }
+
+    TPtr8 interfacePtr = interfaceBuf->Des();
+    interfacePtr.SetLength(0);
+    // 0 means the main interface in the LDD API
+    res = iDataLdd.GetInterfaceDescriptor(0, interfacePtr); 
+
+    if ( KErrNone == res )
+        {
+        delete interfaceBuf;
+        OstTraceFunctionExitExt( CNCMCLIENTMANAGER_DATAINTERFACENUMBER_EXIT_DUP2, this, res );
+        return res;
+        }
+
+    OstTrace1(TRACE_NORMAL, CNCMCLIENTMANAGER_DATAINTERFACENUMBER_INTERFACE_INFO, "***Interface length =% d", interfacePtr.Length());
+    for ( TInt i = 0 ; i < interfacePtr.Length() ; i++ )
+        {
+        OstTrace1(TRACE_NORMAL, CNCMCLIENTMANAGER_DATAINTERFACENUMBER_INTERFACE_INFO2, "***** %x", interfacePtr[i]);
+        }
+
+    const TUint8* buffer = reinterpret_cast<const TUint8*>(interfacePtr.Ptr());
+    // 2 is where the interface number is, according to the LDD API
+    aInterfaceNumber = buffer[2];
+    OstTraceExt1(TRACE_NORMAL, CNCMCLIENTMANAGER_DATAINTERFACENUMBER, "Interface number = %hhu", aInterfaceNumber);
+
+    delete interfaceBuf;
+
+    OstTraceFunctionExitExt( CNCMCLIENTMANAGER_DATAINTERFACENUMBER_EXIT_DUP3, this, KErrNone );
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/src/ncmconnectionmanager.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,479 @@
+/*
+* 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
+ * @internalComponent
+ */
+
+#ifndef OVERDUMMY_NCMCC
+#include <commdbconnpref.h>
+#include <es_enum.h>
+#endif // OVERDUMMY_NCMCC
+
+#include <usb/usbncm.h>
+#include <nifvar.h>
+#include <cdbcols.h>
+#include <commdb.h>
+
+#include "ncmconnectionmanager.h"
+#include "ncmiapprogresswatcher.h"
+#include "ncmiapreader.h"
+#include "ncmdhcpnotifwatcher.h"
+
+#ifdef OVERDUMMY_NCMCC
+#include <usb/testncmcc/dummy_ncminternalsrv.h>
+#else
+#include "ncminternalsrv.h"
+#endif // OVERDUMMY_NCMCC
+
+#include "ncmclasscontroller.h"
+#include "ncmconnectionmanagerobserver.h"
+#include "ncmconnectionmanagerhelper.h"
+
+// For OST tracing
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "ncmconnectionmanagerTraces.h"
+#endif
+
+using namespace UsbNcm;
+
+#if defined(_DEBUG)
+_LIT(KNcmConnManagerPanic, "UsbNcmCM"); // must be <=16 chars
+#endif
+
+extern const TUint KEthernetFrameSize;
+
+// Panic codes
+enum TNcmCMPanicCode
+	{
+	ENcmCMPanicOutstandingRequestFromDevice = 1,
+    ENcmCMPanicNoRegisteredWatcher = 2,
+	ENcmCMEndMark
+	};
+
+/**
+ * Constructs a CNcmConnectionManager object.
+ * @param[in]   aObserver, NCM connection observer
+ * @param[in]   aHostMacAddress, the NCM interface MAC address
+ * @param[in]   aDataBufferSize, the EndPoint buffer size
+ * @param[in]   aNcmInternalSvr, the NCM internal server
+ * @return      Ownership of a new CNcmConnectionManager object
+ */
+CNcmConnectionManager* CNcmConnectionManager::NewL(
+        MNcmConnectionManagerObserver& aObserver,
+        const TNcmMacAddress& aMacAddress, TUint aDataBufferSize,
+        RNcmInternalSrv&   aNcmInternalSvr)
+	{	
+	OstTraceFunctionEntry0(CNCMCONNECTIONMANAGER_NEWL_ENTRY);
+	
+	CNcmConnectionManager* self = new (ELeave) CNcmConnectionManager(aObserver,
+            aMacAddress, aDataBufferSize, aNcmInternalSvr);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	
+	OstTraceFunctionExit0(CNCMCONNECTIONMANAGER_NEWL_EXIT);
+	return self;
+	}
+
+/**
+ * Method to perform second phase construction.
+ */
+void CNcmConnectionManager::ConstructL()
+	{
+	OstTraceFunctionEntry0(CNCMCONNECTIONMANAGER_CONSTRUCTL_ENTRY);
+	
+	TInt err = RProperty::Define(KUsbmanSvrUid, KKeyNcmSharedState, RProperty::EInt,
+		KAllowAllPolicy, KCommDDPolicy);
+    
+    if (KErrNone != err)
+        {
+        OstTrace1( TRACE_ERROR, CNCMCONNECTIONMANAGER_CONSTRUCTL, "Define NCM shared state P&S key fail: err=%d", err );
+        User::Leave(err);
+        }
+	
+	User::LeaveIfError(iProperty.Attach(KUsbmanSvrUid, KKeyNcmSharedState));
+	User::LeaveIfError(iProperty.Set(ENcmStateIntial));
+
+	User::LeaveIfError(iSocketServ.Connect());
+	User::LeaveIfError(iConnection.Open(iSocketServ));
+
+	iIapPrgrsWatcher = new (ELeave) CNcmIapProgressWatcher(*this, iConnection);
+	iConnManHelper = new  (ELeave) CNcmConnectionManHelper(*this, iConnection);
+	iDhcpNotifWatcher = new  (ELeave) CNcmDhcpNotifWatcher(*this, iNcmInternalSvr);
+	iIapReader = new  (ELeave) CNcmIapReader(*this, iConnPref);
+	
+	OstTraceFunctionExit0(CNCMCONNECTIONMANAGER_CONSTRUCTL_EXIT);
+	}
+
+/**
+ * Called when NCM connection starting attempt completed
+ */
+void CNcmConnectionManager::HandleConnectionCompleteL()
+    {
+    OstTraceFunctionEntry0( CNCMCONNECTIONMANAGER_HANDLECONNECTIONCOMPLETEL_ENTRY );
+    OstTrace0(TRACE_NORMAL, CNCMCONNECTIONMANAGER_HANDLECONNECTIONCOMPLETEL_CHANGE_MTU, "About to change default MTU size!");
+    // Change default MTU size
+    SetCustomMtuL();
+
+    OstTrace0(TRACE_NORMAL, CNCMCONNECTIONMANAGER_HANDLECONNECTIONCOMPLETEL_CONN_NCM_INTERNAL_SVR, "About to connect to internal NCM server!");
+    
+    // Connect to internal server in packet driver            
+    User::LeaveIfError(iNcmInternalSvr.Connect());
+
+    iNcmInternalSvr.TransferBufferSize(iDataBufferSize);
+    iNcmInternalSvr.SetIapId(iConnPref.IapId());
+    iDhcpNotifWatcher->StartL();
+    OstTraceFunctionExit0( CNCMCONNECTIONMANAGER_HANDLECONNECTIONCOMPLETEL_EXIT );
+    }
+
+/**
+ * Destructor.
+ */
+CNcmConnectionManager::~CNcmConnectionManager()
+	{
+	OstTraceFunctionEntry0(CNCMCONNECTIONMANAGER_CNCMCONNECTIONMANAGER_DESTRUCTOR_ENTRY);
+	
+	delete iIapReader;
+    delete iDhcpNotifWatcher;
+	delete iConnManHelper;
+	delete iIapPrgrsWatcher;
+	
+	iConnection.Close();
+	iSocketServ.Close();
+	iProperty.Close();
+	
+    RProperty::Delete(KKeyNcmSharedState);
+    
+	OstTraceFunctionExit0(CNCMCONNECTIONMANAGER_CNCMCONNECTIONMANAGER_DESTRUCTOR_EXIT);
+	}
+
+/**
+ * Constructor.
+ * @param[in]   aObserver, NCM connection observer
+ * @param[in]   aHostMacAddress, the NCM interface MAC address
+ * @param[in]   aDataBufferSize, the EndPoint buffer size
+ * @param[in]   aNcmInternalSvr, the NCM internal server
+ */
+CNcmConnectionManager::CNcmConnectionManager(MNcmConnectionManagerObserver& aObserver, 
+        const TNcmMacAddress& aHostMacAddress, TUint aDataBufferSize,
+        RNcmInternalSrv&   aNcmInternalSvr):
+        iConnMgrObserver(aObserver),
+        iHostMacAddress(aHostMacAddress), iDataBufferSize(aDataBufferSize),
+        iNcmInternalSvr(aNcmInternalSvr)
+	{
+	// No implementation needed.
+	}
+
+/**
+ *Called by class controller to start the connection building process.
+ *@param    aStatus, reference to ncm class controller's iStatus 
+ */
+void CNcmConnectionManager::Start(TRequestStatus& aStatus)
+	{
+	OstTraceFunctionEntry0(CNCMCONNECTIONMANAGER_START_ENTRY);
+	
+	__ASSERT_DEBUG(!iReportStatus, 
+		User::Panic(KNcmConnManagerPanic, ENcmCMPanicOutstandingRequestFromDevice));
+	
+	aStatus = KRequestPending;
+	iReportStatus = &aStatus;
+
+	Reset();
+	
+	// Preparing IAP information	
+	iIapReader->Start();
+	OstTraceFunctionExit0(CNCMCONNECTIONMANAGER_START_EXIT);
+	}
+
+/**
+ * Cancel ongoing starting attempt
+ */
+void CNcmConnectionManager::StartCancel()
+    {
+    OstTraceFunctionEntry0(CNCMCONNECTIONMANAGER_STARTCANCEL_ENTRY);
+    
+    __ASSERT_DEBUG(iReportStatus, 
+        User::Panic(KNcmConnManagerPanic, ENcmCMPanicNoRegisteredWatcher));
+    
+    Stop();
+    
+    User::RequestComplete(iReportStatus, KErrCancel);
+    
+    OstTraceFunctionExit0(CNCMCONNECTIONMANAGER_STARTCANCEL_EXIT);
+    }
+
+/**
+ * Called by class controller to stop the connection.
+ */
+void CNcmConnectionManager::Stop()
+	{
+    OstTraceFunctionEntry0(CNCMCONNECTIONMANAGER_STOP_ENTRY);
+    
+    // Cancel any current ongoing operations
+    Reset();
+    
+    // Reset shared state
+    iProperty.Set(ENcmStateIntial);
+	
+	iConnManHelper->Stop();
+	OstTraceFunctionExit0(CNCMCONNECTIONMANAGER_STOP_EXIT);
+	}
+
+/**
+ * Reset conneciton manager itself
+ */
+void CNcmConnectionManager::Reset()
+	{
+    OstTraceFunctionEntry0(CNCMCONNECTIONMANAGER_RESET_ENTRY);
+    
+	iConnComplete = EFalse;
+	
+	iIapReader->Cancel();
+	iDhcpNotifWatcher->Cancel();
+	iIapPrgrsWatcher->Cancel();
+	iConnManHelper->Cancel();
+	
+	OstTraceFunctionExit0(CNCMCONNECTIONMANAGER_RESET_EXIT);
+	}
+/**
+ * Change the default MTU size on NCM networking connection
+ */
+void CNcmConnectionManager::SetCustomMtuL()
+    {    
+    OstTraceFunctionEntry0(CNCMCONNECTIONMANAGER_SETCUSTOMMTUL_ENTRY);
+    
+    RSocket socket;
+    User::LeaveIfError(socket.Open(iSocketServ, KAfInet, KSockStream, KProtocolInetTcp,
+            iConnection));
+
+    TPckgBuf<TSoInet6InterfaceInfo> interfaceInfo;
+    TPckgBuf<TConnInterfaceName> interfaceName;
+    
+    TUint cnt = 0;
+    iConnection.EnumerateConnections(cnt); // Count all underlying interfaces
+    
+    TUint iap = iConnPref.IapId();
+    TInt index = 1;
+    for (index = 1; index <= cnt; index++)
+        {
+        TConnectionInfoBuf info;
+        iConnection.GetConnectionInfo(index, info);
+        if (info().iIapId == iap)
+            {
+            break;
+            }
+        }
+    
+    if (index > cnt)
+        {
+        OstTrace0( TRACE_NORMAL, CNCMCONNECTIONMANAGER_SETCUSTOMMTUL, "Can not find an interface based on NCM!" );
+        User::Leave(KErrNotFound);
+        }
+    
+    interfaceName().iIndex = index;    
+    OstTraceExt2( TRACE_NORMAL, CNCMCONNECTIONMANAGER_SETCUSTOMMTUL_INTER_INFO, ";cnt=%d;interfaceName().iIndex=%u", cnt, interfaceName().iIndex );
+    User::LeaveIfError(iConnection.Control(KCOLProvider, KConnGetInterfaceName, interfaceName));
+    OstTraceExt3( TRACE_NORMAL, CNCMCONNECTIONMANAGER_SETCUSTOMMTUL_NEW_MTU_SIZE, ";Interface Name=%S, ;current MTU=%d. MTU size will be changed to %d!", interfaceName().iName, interfaceInfo().iMtu, KEthernetFrameSize);
+        
+    TInt err = socket.SetOpt(KSoInetEnumInterfaces, KSolInetIfCtrl);
+    if (err != KErrNone)
+        {
+        OstTrace1(TRACE_NORMAL, CNCMCONNECTIONMANAGER_SETCUSTOMMTUL_START_INTER_ENUM, "Failed to set KSoInetEnumInterfaces option [%d]", err);
+        User::LeaveIfError(err);              
+        }
+        
+    err = KErrNotFound;
+    while (socket.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, interfaceInfo) == KErrNone)
+        {
+        OstTraceExt1(TRACE_NORMAL, CNCMCONNECTIONMANAGER_SETCUSTOMMTUL_INTER_NAME, "InterfaceInfo().iName = %S", interfaceInfo().iName);
+        OstTrace1(TRACE_NORMAL, CNCMCONNECTIONMANAGER_SETCUSTOMMTUL_INTER_MTU, "InterfaceInfo().iMtu = %d", interfaceInfo().iMtu);
+        if (interfaceInfo().iName == interfaceName().iName)
+            {
+            // found the interface
+            err = KErrNone;
+            break;
+            }
+        }
+    if (KErrNone != err)
+        {
+        OstTrace1(TRACE_ERROR, CNCMCONNECTIONMANAGER_SETCUSTOMMTUL_SEARCH_FAIL, "Can not find NCM connection: err=%x", err);
+        User::LeaveIfError(err);
+        }
+    
+    // Set new MTU size
+    TPckgBuf<TSoInet6InterfaceInfo> newinterfaceInfo;
+    newinterfaceInfo().iMtu = KEthernetFrameSize;	
+    newinterfaceInfo().iDoPrefix = 0;
+    newinterfaceInfo().iDoId = 0;
+    newinterfaceInfo().iDoState = 0;
+    newinterfaceInfo().iDoAnycast = 0;
+    newinterfaceInfo().iDoProxy = 0;
+    newinterfaceInfo().iAlias = interfaceInfo().iAlias;
+    newinterfaceInfo().iDelete = interfaceInfo().iDelete;
+    newinterfaceInfo().iState = interfaceInfo().iState;
+    newinterfaceInfo().iSpeedMetric = interfaceInfo().iSpeedMetric;
+    newinterfaceInfo().iFeatures = interfaceInfo().iFeatures;
+    newinterfaceInfo().iTag = interfaceInfo().iTag;
+    newinterfaceInfo().iName = interfaceInfo().iName;
+    newinterfaceInfo().iSpeedMetric = interfaceInfo().iSpeedMetric;
+    newinterfaceInfo().iFeatures = interfaceInfo().iFeatures;	
+    newinterfaceInfo().iHwAddr = interfaceInfo().iHwAddr;
+    newinterfaceInfo().iAddress = interfaceInfo().iAddress;
+    newinterfaceInfo().iNetMask = interfaceInfo().iNetMask;
+    newinterfaceInfo().iDefGate = interfaceInfo().iDefGate;
+    newinterfaceInfo().iNameSer2 = interfaceInfo().iNameSer2;
+    newinterfaceInfo().iNameSer1 = interfaceInfo().iNameSer1;
+	
+    OstTrace0( TRACE_NORMAL, CNCMCONNECTIONMANAGER_SETCUSTOMMTUL_PRE_SETMTU, "About to change the default MTU size." );
+	User::LeaveIfError(socket.SetOpt(KSoInetConfigInterface, KSolInetIfCtrl, newinterfaceInfo));
+
+    socket.Close();
+    
+    OstTraceFunctionExit0(CNCMCONNECTIONMANAGER_SETCUSTOMMTUL_EXIT);
+    }
+
+/**
+ * Called by connection watcher when it detects the class fatal error.
+ */
+void CNcmConnectionManager::MipsoHandleClassFatalError(TInt aError)
+	{
+	OstTraceFunctionEntryExt( CNCMCONNECTIONMANAGER_MIPSOHANDLECLASSFATALERROR_ENTRY, this );
+	
+	Reset();
+	
+	__ASSERT_DEBUG(!iReportStatus, User::Panic(KNcmConnManagerPanic, ENcmCMPanicOutstandingRequestFromDevice));
+		
+	OstTrace1(TRACE_ERROR, CNCMCONNECTIONMANAGER_MIPSOHANDLECLASSFATALERROR, "NCM connection fatal error occurs: %d", aError);
+	
+	iConnMgrObserver.McmoErrorIndication(aError);
+	
+	OstTraceFunctionExit1( CNCMCONNECTIONMANAGER_MIPSOHANDLECLASSFATALERROR_EXIT, this );
+	}
+
+/**
+ * Called by connection help when it get notification the 
+ * connection over NCM has been established.
+ */
+void CNcmConnectionManager::MicoHandleConnectionComplete(TInt aError)
+    {
+    OstTraceFunctionEntryExt( CNCMCONNECTIONMANAGER_MICOHANDLECONNECTIONCOMPLETE_ENTRY, this );
+    
+    // Reset shared state
+    iProperty.Set(ENcmStateIntial);
+    
+    if (KErrNone == aError)
+        {
+        TRAPD(err, HandleConnectionCompleteL());
+        User::RequestComplete(iReportStatus, err);
+        }
+    else
+        {
+        // Leave if connection build failed
+        User::RequestComplete(iReportStatus, aError);
+        }
+    
+    OstTraceFunctionExit1( CNCMCONNECTIONMANAGER_MICOHANDLECONNECTIONCOMPLETE_EXIT, this );
+    }
+
+/**
+ * Called by DHCP notification watcher.
+ * When the NCM internal server send DHCP request notification to 
+ * the watcher, watcher call this function to do DHCP provisioning
+ * for NCM connection.
+ */
+void CNcmConnectionManager::MdnoHandleDhcpNotification(TInt aError)
+    {
+    OstTraceFunctionEntryExt( CNCMCONNECTIONMANAGER_MDNOHANDLEDHCPNOTIFICATION_ENTRY, this );
+    if (KErrNone != aError)
+        {
+        // Report this failure to the observer
+        // Finally this will report to usbman and NCM class will be stopped.
+        iConnMgrObserver.McmoErrorIndication(aError);
+        OstTraceFunctionExit1( CNCMCONNECTIONMANAGER_MDNOHANDLEDHCPNOTIFICATION_EXIT, this );
+        return;
+        }
+    
+    // Doing DHCP for NCM
+    aError = KErrNone;
+
+    // Configuring DHCP server to assign the IP address to PC(host)
+    TRequestStatus stat;
+    OstTrace0(TRACE_NORMAL, CNCMCONNECTIONMANAGER_MDNOHANDLEDHCPNOTIFICATION_CALL_IOCTL, "About to call to Ioctl()");
+    
+    TNcmMacAddress macAddr = iHostMacAddress;
+    iConnection.Ioctl(KCOLConfiguration, KConnDhcpSetHwAddressParams, stat,
+            &macAddr);
+    User::WaitForRequest(stat);
+    aError = stat.Int();
+    OstTrace1( TRACE_NORMAL, CNCMCONNECTIONMANAGER_MDNOHANDLEDHCPNOTIFICATION_RETURN_IOCTL, "Return from Ioctl:aError=%d", aError );
+    
+    if (KErrNone == aError)
+        {
+        // Disable timer on interface and wont let interface coming down due to timer expiry.
+        iConnection.SetOpt(KCOLProvider, KConnDisableTimers, ETrue);
+        iIapPrgrsWatcher->Start();
+        }
+    else
+        {
+        // Silent stop the NCM connection. 
+        iConnManHelper->Stop();
+        
+        // Report this failure to the observer
+        // Finally this will report to usbman and NCM class will be stopped.
+        iConnMgrObserver.McmoErrorIndication(aError);        
+        }
+    
+    // Set DHCP result to NCM internal server
+    iNcmInternalSvr.SetDhcpResult(aError);
+    OstTraceFunctionExit1( CNCMCONNECTIONMANAGER_MDNOHANDLEDHCPNOTIFICATION_EXIT_DUP1, this );
+    }
+
+/**
+ * Called by IAP reader.
+ * When IAP reader finished reading NCM IAP preference from CentRep,
+ * it will call this function to start building ethernet connection
+ * using NCM IAP configuration.
+ */
+void CNcmConnectionManager::MicoHandleIAPReadingComplete(TInt aError)
+    {
+    OstTraceFunctionEntryExt( CNCMCONNECTIONMANAGER_MICOHANDLEIAPREADINGCOMPLETE_ENTRY, this );
+    if (KErrNone != aError)      
+      {
+      OstTrace1( TRACE_ERROR, CNCMCONNECTIONMANAGER_MICOHANDLEIAPREADINGCOMPLETE_IAP_RESULT, "IAP reading failed with error;aError=%d", aError );
+      User::RequestComplete(iReportStatus, aError);
+      
+      OstTraceFunctionExit1( CNCMCONNECTIONMANAGER_MICOHANDLEIAPREADINGCOMPLETE_EXIT, this );
+      return;
+      }
+    
+    aError = iProperty.Set(ENcmStartRequested);
+    
+    if (KErrNone != aError)
+      {
+      OstTrace1( TRACE_ERROR, CNCMCONNECTIONMANAGER_MICOHANDLEIAPREADINGCOMPLETE_SET_SHARED_STATE, "Property set failed with error:;aError=%d", aError );
+      User::RequestComplete(iReportStatus, aError);
+
+      OstTraceFunctionExit1( CNCMCONNECTIONMANAGER_MICOHANDLEIAPREADINGCOMPLETE_EXIT_DUP1, this );
+      return;
+      }
+
+    iConnManHelper->Start(iConnPref);
+    OstTraceFunctionExit1( CNCMCONNECTIONMANAGER_MICOHANDLEIAPREADINGCOMPLETE_EXIT_DUP2, this );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/src/ncmconnectionmanagerhelper.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,116 @@
+/*
+* 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
+ * @internalComponent
+ */
+
+#include <e32debug.h>
+
+#include "ncmconnectionmanagerhelper.h"
+#include "ncmiapconnectionobserver.h"
+#include "ncmconnectionmanager.h"
+
+// For OST tracing
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "ncmconnectionmanagerhelperTraces.h"
+#endif
+
+/**
+ * Constructor.
+ * @param aObserver The object which is interested in the IAP connection completion
+ * @param aConnection The reference of the NCM connection to be used
+ */
+CNcmConnectionManHelper::CNcmConnectionManHelper(MNcmConnectionObserver& aObserver,
+        RConnection& aConnection)
+    : CActive(CActive::EPriorityStandard)
+	, iObserver(aObserver)
+	, iConnection(aConnection) 
+	{
+	OstTraceFunctionEntryExt( CNCMCONNECTIONMANHELPER_CNCMCONNECTIONMANHELPER_ENTRY, this );
+	CActiveScheduler::Add(this);		
+	OstTraceFunctionExit1( CNCMCONNECTIONMANHELPER_CNCMCONNECTIONMANHELPER_EXIT, this );
+	}
+
+
+/**
+ * Destructor.
+ */
+CNcmConnectionManHelper::~CNcmConnectionManHelper()
+	{	
+	OstTraceFunctionEntry1( CNCMCONNECTIONMANHELPER_CNCMCONNECTIONMANHELPER_ENTRY_DESTRUCTOR, this );
+	if (IsActive())
+	    {
+	    Cancel();
+	    }
+	else
+	    {
+	    Stop();
+	    }
+	OstTraceFunctionExit1( CNCMCONNECTIONMANHELPER_CNCMCONNECTIONMANHELPER_ENTRY_DESTRUCTOR_EXIT, this );
+	}
+
+/**
+ * Start the connection.
+ * @param aPref NCM connect preference
+ */
+void CNcmConnectionManHelper::Start(TConnPref& aPref)
+	{	
+	OstTraceFunctionEntryExt( CNCMCONNECTIONMANHELPER_START_ENTRY, this );
+	if (!IsActive())
+		{
+		iConnection.Start(aPref, iStatus);
+		SetActive();
+		}
+	OstTraceFunctionExit1( CNCMCONNECTIONMANHELPER_START_EXIT, this );
+	}
+
+/**
+ * Stop the connection.
+ */
+void CNcmConnectionManHelper::Stop()
+	{
+    OstTraceFunctionEntry1( CNCMCONNECTIONMANHELPER_STOP_ENTRY, this );
+   
+	TInt err = iConnection.Stop(RConnection::EStopAuthoritative);
+	OstTrace1( TRACE_NORMAL, CNCMCONNECTIONMANHELPER_STOP_RETURN_CODE, "Return code from Stop() is:;err=%d", err );
+	OstTraceFunctionExit1( CNCMCONNECTIONMANHELPER_STOP_EXIT, this );
+	}
+/**
+ * Implements cancellation of an outstanding request.
+ */
+void CNcmConnectionManHelper::DoCancel()
+	{
+    OstTraceFunctionEntry0( CNCMCONNECTIONMANHELPER_DOCANCEL_ENTRY );
+
+	TInt err = iConnection.Stop(RConnection::EStopAuthoritative);
+
+    OstTrace1( TRACE_NORMAL, CNCMCONNECTIONMANHELPER_DOCNCEL, "Return code from Stop() is:;err=%d", err );
+	OstTraceFunctionExit0( CNCMCONNECTIONMANHELPER_DOCANCEL_EXIT );
+	}
+
+/**
+ * Called when connection completed.
+ */
+void CNcmConnectionManHelper::RunL()
+	{	
+	OstTraceFunctionEntry0( CNCMCONNECTIONMANHELPER_RUNL_ENTRY );
+	iObserver.MicoHandleConnectionComplete(iStatus.Int());
+	OstTraceFunctionExit0( CNCMCONNECTIONMANHELPER_RUNL_EXIT );
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/src/ncmdhcpnotifwatcher.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,122 @@
+/*
+* 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
+ *@internalComponent
+ */
+
+#include "ncmdhcpnotifwatcher.h"
+#include "ncmconnectionmanager.h"
+#include "ncmdhcpnotifobserver.h"
+
+#ifdef OVERDUMMY_NCMCC
+#include <usb/testncmcc/dummy_ncminternalsrv.h>
+#else
+#include "ncminternalsrv.h"
+
+#endif // OVERDUMMY_NCMCC
+
+// For OST trace
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "ncmdhcpnotifwatcherTraces.h"
+#endif
+
+/**
+ * Constructor.
+ * @param aObserver The AO which handle the DHCP provisioning request from NCM internal server 
+ * @param aNcmInteralSvr The reference of the NCM internal server client API handle
+ */
+CNcmDhcpNotifWatcher::CNcmDhcpNotifWatcher(MNcmDhcpNotificationObserver& aObserver,
+        RNcmInternalSrv& aNcmInteralSvr)
+	: CActive(CActive::EPriorityStandard), 
+	  iObserver(aObserver), 
+	  iNcmInteralSvr(aNcmInteralSvr) 
+	{
+    OstTraceFunctionEntryExt( CNCMDHCPNOTIFWATCHER_CNCMDHCPNOTIFWATCHER_ENTRY, this );
+    
+	CActiveScheduler::Add(this);		
+	OstTraceFunctionExit1( CNCMDHCPNOTIFWATCHER_CNCMDHCPNOTIFWATCHER_EXIT, this );
+	}
+
+
+/**
+ * Destructor.
+ */
+CNcmDhcpNotifWatcher::~CNcmDhcpNotifWatcher()
+	{
+	OstTraceFunctionEntry0( CNCMDHCPNOTIFWATCHER_CNCMDHCPNOTIFWATCHER_ENTRY_DESTROY );
+	Cancel();
+	OstTraceFunctionExit0( CNCMDHCPNOTIFWATCHER_CNCMDHCPNOTIFWATCHER_EXIT_DESTROY );
+	}
+
+/**
+ * Start observing the connection stage changes.
+ */
+void CNcmDhcpNotifWatcher::StartL()
+	{
+	OstTraceFunctionEntry0( CNCMDHCPNOTIFWATCHER_START_ENTRY );
+	    
+	if(!IsActive())
+	    {
+        iNcmInteralSvr.DhcpProvisionNotify(iStatus);
+        SetActive();
+	    }
+	else
+	    {
+	    // Report this to NCM connection manager
+	    OstTrace0( TRACE_FATAL, CNCMDHCPNOTIFWATCHER_STARTL, "DHCP notifier already actived!" );
+	    User::Leave(KErrInUse);
+	    }
+    
+	OstTraceFunctionExit0( CNCMDHCPNOTIFWATCHER_START_EXIT );
+	}
+
+/**
+ * Implements cancellation of an outstanding request. Cancels the connection progress notification request.
+ */
+void CNcmDhcpNotifWatcher::DoCancel()
+	{
+    OstTraceFunctionEntry0( CNCMDHCPNOTIFWATCHER_DOCANCEL_ENTRY );
+
+	iNcmInteralSvr.DhcpProvisionNotifyCancel();
+	OstTraceFunctionExit0( CNCMDHCPNOTIFWATCHER_DOCANCEL_EXIT );
+	}
+
+/**
+ * Called when got DHCP provisioning request from NCM internal server.
+ */
+void CNcmDhcpNotifWatcher::RunL()
+	{
+	OstTraceFunctionEntry0( CNCMDHCPNOTIFWATCHER_RUNL_ENTRY );
+	
+	TInt completionCode = iStatus.Int();
+	if (KErrCancel != completionCode)
+	    {
+        // Doing DHCP
+        iObserver.MdnoHandleDhcpNotification(iStatus.Int());
+        
+        if (KErrNone == completionCode)
+            {
+            // Restart the watcher
+            StartL();
+            }
+	    }
+	OstTraceFunctionExit0( CNCMDHCPNOTIFWATCHER_RUNL_EXIT );
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/src/ncmiapprogresswatcher.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,122 @@
+/*
+* 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
+ * @internalComponent
+ */
+
+#include "ncmiapprogresswatcher.h"
+#include "ncmiapprogressstateobserver.h"
+#include "ncmconnectionmanager.h"
+
+// For OST Tracing
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "ncmiapprogresswatcherTraces.h"
+#endif
+
+/**
+ * Constructor.
+ * @param aObserver The object which is interested in the IAP progress stage change
+ * @param aConnection The reference of the NCM connection to be used
+ */
+CNcmIapProgressWatcher::CNcmIapProgressWatcher(MNcmIapProgressStateObserver& aObserver, RConnection& aConnection)
+	: CActive(CActive::EPriorityStandard)
+	, iObserver(aObserver)
+	, iConnection(aConnection) 
+	{
+    OstTraceFunctionEntryExt( CNCMIAPPROGRESSWATCHER_CNCMIAPPROGRESSWATCHER_ENTRY, this );
+    
+	CActiveScheduler::Add(this);		
+	OstTraceFunctionExit1( CNCMIAPPROGRESSWATCHER_CNCMIAPPROGRESSWATCHER_EXIT, this );
+	}
+
+
+/**
+ * Destructor.
+ */
+CNcmIapProgressWatcher::~CNcmIapProgressWatcher()
+	{
+	OstTraceFunctionEntry0( CNCMIAPPROGRESSWATCHER_CNCMIAPPROGRESSWATCHER_ENTRY_DESTRUCTOR );
+	
+	Cancel();
+	OstTraceFunctionExit0( CNCMIAPPROGRESSWATCHER_CNCMIAPPROGRESSWATCHER_ENTRY_DESTRUCTOR_EXIT );
+	}
+
+/**
+ * Start observing the connection stage changes.
+ */
+void CNcmIapProgressWatcher::Start()
+	{
+	OstTraceFunctionEntry0( CNCMIAPPROGRESSWATCHER_START_ENTRY );
+	
+	if (!IsActive())
+		{
+		iConnection.ProgressNotification(iProgressInfoBuf, iStatus);
+		SetActive();
+		}
+	OstTraceFunctionExit0( CNCMIAPPROGRESSWATCHER_START_EXIT );
+	}
+
+/**
+ * Implements cancellation of an outstanding request. Cancels the connection progress notification request.
+ */
+void CNcmIapProgressWatcher::DoCancel()
+	{
+    OstTraceFunctionEntry0( CNCMIAPPROGRESSWATCHER_DOCANCEL_ENTRY );
+
+	iConnection.CancelProgressNotification();
+	OstTraceFunctionExit0( CNCMIAPPROGRESSWATCHER_DOCANCEL_EXIT );
+	}
+
+/**
+ * Called when connection stage changed.
+ */
+void CNcmIapProgressWatcher::RunL()
+	{
+	OstTraceFunctionEntry0( CNCMIAPPROGRESSWATCHER_RUNL_ENTRY );
+	
+	OstTrace1( TRACE_NORMAL, CNCMIAPPROGRESSWATCHER_RUNL_COMPLETION_CODE, ";iStatus.Int()=%d", iStatus.Int() );
+	OstTraceExt2( TRACE_NORMAL, CNCMIAPPROGRESSWATCHER_RUNL_INFO, ";iProgressInfoBuf().iStage=%d;iProgressInfoBuf().iError=%d", iProgressInfoBuf().iStage, iProgressInfoBuf().iError );
+	
+
+	TInt completionCode = iStatus.Int();
+    if (KErrNone == completionCode)
+        {
+        switch (iProgressInfoBuf().iStage)
+            {
+            case KConnectionUninitialised:
+                {
+                iObserver.MipsoHandleClassFatalError(KErrDisconnected);
+                break;
+                }
+            case ENcmPktDrvFatalError:
+                {
+                iObserver.MipsoHandleClassFatalError(iProgressInfoBuf().iError);
+                break;
+                }
+            default:
+                {
+                // Request the next notification
+                OstTrace0( TRACE_NORMAL, CNCMIAPPROGRESSWATCHER_RUNL_RESTART_WATCHER, "Request the next notification" );                
+                Start();
+                }
+            }
+        }
+	OstTraceFunctionExit0( CNCMIAPPROGRESSWATCHER_RUNL_EXIT );
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/src/ncmiapreader.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,210 @@
+/*
+* 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
+ * @internalComponent
+ */
+
+#include <e32debug.h>
+#include <commdb.h>
+
+#ifdef OVERDUMMY_NCMCC
+#include <usb/testncmcc/dummy_essock.h>
+#else
+#include <commdbconnpref.h>
+#endif
+
+#include <commsdattypesv1_1.h> 
+
+#include "ncmiapreaderobserver.h"
+#include "ncmiapreader.h"
+
+// For OST Tracing
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "ncmiapreaderTraces.h"
+#endif
+
+
+_LIT(KNcmIapReaderPanic, "UsbNcmIapReader"); // must be <=16 chars
+
+// Panic codes
+enum TNcmIapReaderPanicCode
+    {
+    ENcmIapReaderPanicOutstandingRequest = 1,
+    ENcmIapReaderPanicTooManyIAPs = 2,
+    ENcmIapReaderEndMark
+    };
+
+// NCM configuration item names
+_LIT(KBearerNifName, "ethint");
+_LIT(KBearerLddFileName, "eusbcsc");
+_LIT(KBearerPktDrvName, "ncmpkt.drv");
+
+/**
+ * Constructs a CNcmIapReader object.
+ * @param aObserver An MNcmIAPReaderObserver instance which handles IAP reading completing
+ * @param aConnPref The reference of the NCM connection aConnPref
+ */
+CNcmIapReader::CNcmIapReader(MNcmIAPReaderObserver& aObserver, TCommDbConnPref& aConnPref)
+: CActive(CActive::EPriorityStandard),
+      iObserver(aObserver),
+      iConnPref(aConnPref)
+	{
+	OstTraceFunctionEntryExt( CNCMIAPREADER_CNCMIAPREADER_ENTRY, this );
+	CActiveScheduler::Add(this);		
+	OstTraceFunctionExit1( CNCMIAPREADER_CNCMIAPREADER_EXIT, this );
+	}
+
+/**
+ * Destructor.
+ */
+CNcmIapReader::~CNcmIapReader()
+	{
+	OstTraceFunctionEntry0( CNCMIAPREADER_CNCMIAPREADER_ENTRY_DESTRUCTOR );
+	
+	Cancel();
+	OstTraceFunctionExit0( CNCMIAPREADER_CNCMIAPREADER_ENTRY_DESTRUCTOR_EXIT );
+	}
+
+/**
+ * Start the connection.
+ */
+void CNcmIapReader::Start()
+	{
+	OstTraceFunctionEntry0( CNCMIAPREADER_START_ENTRY );
+	
+	__ASSERT_ALWAYS(!IsActive(), 
+	        User::Panic(KNcmIapReaderPanic, ENcmIapReaderPanicOutstandingRequest));
+    
+    SetActive();
+    TRequestStatus* status = &iStatus;
+    User::RequestComplete(status, KErrNone);
+	
+	OstTraceFunctionExit0( CNCMIAPREADER_START_EXIT );
+	}
+
+/**
+ * Implements cancellation of an outstanding request.
+ */
+void CNcmIapReader::DoCancel()
+	{
+	OstTraceFunctionEntry0( CNCMIAPREADER_DOCANCEL_ENTRY );
+	
+    TRequestStatus* status = &iStatus;
+    User::RequestComplete(status, KErrCancel);
+	OstTraceFunctionExit0( CNCMIAPREADER_DOCANCEL_EXIT );
+	}
+
+/**
+ * Simulate an async way and give
+ * the scheduler a chance to schedule all AOs.
+ */
+void CNcmIapReader::RunL()
+	{
+	OstTraceFunctionEntry0( CNCMIAPREADER_RUNL_ENTRY );
+	
+	// Reading
+	TRAPD(err, SearchNcmIapL())
+	OstTrace1( TRACE_NORMAL, CNCMIAPREADER_RUNL_GETIAP, "Get NCM IAP with error code %d", err );
+	
+
+	// Complete connection manager
+	iObserver.MicoHandleIAPReadingComplete(err);
+	OstTraceFunctionExit0( CNCMIAPREADER_RUNL_EXIT );
+	}
+
+/**
+ * Search NCM IAP in current commDB and set it into the ncm connection manager.
+ */
+void CNcmIapReader::SearchNcmIapL()
+    {
+    OstTraceFunctionEntry0( CNCMIAPREADER_GETNCMIAPIDL_ENTRY );
+    
+    using namespace CommsDat;
+    CMDBSession* dbs = CMDBSession::NewLC(KCDLatestVersion); // Current version is 1.1
+    
+    CMDBRecordSet<CCDLANBearerRecord>* lanBearerTable = 
+            new (ELeave) CMDBRecordSet<CCDLANBearerRecord>(KCDTIdLANBearerRecord);
+    CleanupStack::PushL(lanBearerTable);
+    // Load the table into memory
+    lanBearerTable->LoadL(*dbs);
+ 
+    TInt numLanBearers = lanBearerTable->iRecords.Count();    
+    OstTrace1( TRACE_NORMAL, CNCMIAPREADER_GETNCMIAPIDL_COUNT_LAN_BEARER, "Found %d Lan Bearer!", numLanBearers );
+    TInt chosenLanBearer = KErrNotFound;
+    TInt i = 0;
+    for(i = 0; i<numLanBearers; i++)
+        {
+        CCDLANBearerRecord* lanBearer = 
+                static_cast<CCDLANBearerRecord*>(lanBearerTable->iRecords[i]);
+        if ((lanBearer->iLanBearerNifName.GetL().Compare(KBearerNifName()) == 0) &&
+            (lanBearer->iLanBearerLddFilename.GetL().Compare(KBearerLddFileName()) == 0) &&
+            (lanBearer->iLanBearerPacketDriverName.GetL().Compare(KBearerPktDrvName()) == 0))
+            {
+            // Matched all check points. We found LAN bearer for NCM
+            chosenLanBearer = lanBearer->RecordId();
+            break;
+            }
+        }
+    CleanupStack::PopAndDestroy(lanBearerTable); // lanBearerTable
+    if (KErrNotFound == chosenLanBearer)
+        {
+        OstTrace0( TRACE_ERROR, CNCMIAPREADER_GETNCMIAPIDL, "Can not find NCM Lan Bearer!" );
+        User::Leave(KErrNotFound);
+        }
+    OstTrace1( TRACE_NORMAL, CNCMIAPREADER_GETNCMIAPIDL_CHOSEN_LAN_BEARER, "Chosen Lan Bearer %d!", chosenLanBearer );
+    
+    CMDBRecordSet<CCDIAPRecord> * iapTable = 
+            new (ELeave) CMDBRecordSet<CCDIAPRecord>(KCDTIdIAPRecord);
+    CleanupStack::PushL(iapTable);
+    // Load the table into memory
+    iapTable->LoadL(*dbs);
+
+    TInt numIaps = iapTable->iRecords.Count();
+    TInt chosenIAP = KErrNotFound;
+    TInt iapLanBearer = KErrNotFound;
+    for (i = 0; i < numIaps; i++)
+        {
+        CCDIAPRecord* iap =
+                static_cast<CCDIAPRecord*> (iapTable->iRecords[i]);
+        OstTrace1( TRACE_NORMAL, CNCMIAPREADER_GETNCMIAPIDL_RECORD_ID, "Id of current IAP is %d!", iap->RecordId() );
+        OstTrace1( TRACE_NORMAL, CNCMIAPREADER_GETNCMIAPIDL_RECORD_BEARER_ID, "Lan Bearer Id of current IAP is %d!", TMDBElementId(iap->iBearer) );
+        iapLanBearer = TMDBElementId(iap->iBearer);
+        if ((iap->iBearerType.GetL().Compare(TPtrC(KCDTypeNameLANBearer)) == 0) && 
+                (iapLanBearer == chosenLanBearer))
+            {
+            // NCM IAP found!
+            // Panic if there is more than NCM IAP found
+            OstTrace1( TRACE_NORMAL, CNCMIAPREADER_SEARCHNCMIAPL_ONLY_ONE_NCM_IAP, "NCM IAP found: Current chosenIAP value is %d", chosenIAP );
+            
+            __ASSERT_ALWAYS(KErrNotFound == chosenIAP, User::Panic(KNcmIapReaderPanic, ENcmIapReaderPanicTooManyIAPs));
+            chosenIAP = iap->RecordId();
+            break;
+            }
+        }
+    CleanupStack::PopAndDestroy(2, dbs); // iapTable, dbs    
+    if(chosenIAP == KErrNotFound)
+        {
+        OstTrace0( TRACE_ERROR, CNCMIAPREADER_GETNCMIAPIDL_NOT_FOUND, "Can not find NCM IAP!" );
+        User::Leave(KErrNotFound);
+        }
+    OstTrace1( TRACE_NORMAL, CNCMIAPREADER_GETNCMIAPIDL_CHOSEN_IAP_ID, "Chosen IAP is %d!", chosenIAP );
+    iConnPref.SetIapId(chosenIAP);
+    OstTraceFunctionExit0( CNCMIAPREADER_GETNCMIAPIDL_EXIT );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/traces/OstTraceDefinitions.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,7 @@
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <opensystemtrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/traces/fixed_id.definitions	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,480 @@
+#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt.
+[GROUP]TRACE_ERROR=0x82
+[GROUP]TRACE_FATAL=0x81
+[GROUP]TRACE_FLOW=0x8a
+[GROUP]TRACE_NORMAL=0x86
+[TRACE]TRACE_ERROR[0x82]_CNCMCLASSCONTROLLER_RUNL_DEFAULT=0x11
+[TRACE]TRACE_ERROR[0x82]_CNCMCLIENTMANAGER_CNCMCLIENTMANAGER_CLOSE_COMM_CHUNK_FAIL=0x12
+[TRACE]TRACE_ERROR[0x82]_CNCMCLIENTMANAGER_CNCMCLIENTMANAGER_CLOSE_DATA_CHUNK_FAIL=0x13
+[TRACE]TRACE_ERROR[0x82]_CNCMCLIENTMANAGER_SETCOMMUNICATIONINTERFACEL=0x14
+[TRACE]TRACE_ERROR[0x82]_CNCMCLIENTMANAGER_SETCOMMUNICATIONINTERFACEL_FAIL_TO_INIT=0x15
+[TRACE]TRACE_ERROR[0x82]_CNCMCLIENTMANAGER_SETDATAINTERFACEL_SET_INTERFACE_FAIL=0x16
+[TRACE]TRACE_ERROR[0x82]_CNCMCONNECTIONMANAGER_CONSTRUCTL=0x17
+[TRACE]TRACE_ERROR[0x82]_CNCMCONNECTIONMANAGER_MICOHANDLEIAPREADINGCOMPLETE_IAP_RESULT=0x1a
+[TRACE]TRACE_ERROR[0x82]_CNCMCONNECTIONMANAGER_MICOHANDLEIAPREADINGCOMPLETE_SET_SHARED_STATE=0x1b
+[TRACE]TRACE_ERROR[0x82]_CNCMCONNECTIONMANAGER_MIPSOHANDLECLASSFATALERROR=0x19
+[TRACE]TRACE_ERROR[0x82]_CNCMCONNECTIONMANAGER_SETCUSTOMMTUL_SEARCH_FAIL=0x18
+[TRACE]TRACE_ERROR[0x82]_CNCMIAPREADER_GETNCMIAPIDL=0x1c
+[TRACE]TRACE_ERROR[0x82]_CNCMIAPREADER_GETNCMIAPIDL_NOT_FOUND=0x1d
+[TRACE]TRACE_FATAL[0x81]_CNCMCLASSCONTROLLER_DOCANCEL_DEFAULT=0x5
+[TRACE]TRACE_FATAL[0x81]_CNCMDHCPNOTIFWATCHER_STARTL=0x6
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_CNCMCLASSCONTROLLER_ENTRY=0xde
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_CNCMCLASSCONTROLLER_ENTRY_DESTROY=0xe4
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_CNCMCLASSCONTROLLER_EXIT=0xdf
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_CNCMCLASSCONTROLLER_EXIT_DESTROY=0xe5
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_CONSTRUCTL_ENTRY=0xe0
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_CONSTRUCTL_EXIT=0xe1
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_DOCANCEL_ENTRY=0xf1
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_DOCANCEL_EXIT=0xf2
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_DOCANCEL_EXIT_DUP1=0xf3
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_GETDESCRIPTORINFO_ENTRY=0xea
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_GETDESCRIPTORINFO_EXIT=0xeb
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_MCMOERRORINDICATION_ENTRY=0xec
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_MCMOERRORINDICATION_EXIT=0xed
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_NEWL_ENTRY=0xdc
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_NEWL_EXIT=0xdd
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_RANDOMMACADDRESSL_ENTRY=0xe2
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_RANDOMMACADDRESSL_EXIT=0xe3
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_RUNERROR_ENTRY=0xf4
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_RUNERROR_EXIT=0xf5
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_RUNL_ENTRY=0xee
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_RUNL_EXIT=0xf0
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_RUNL_TRANSFER_HANDLES=0xef
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_START_ENTRY=0xe6
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_START_EXIT=0xe7
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_STOP_ENTRY=0xe8
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_STOP_EXIT=0xe9
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLIENTMANAGER_CNCMCLIENTMANAGER_ENTRY=0x102
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLIENTMANAGER_CNCMCLIENTMANAGER_ENTRY_DESTRUCTOR=0xfc
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLIENTMANAGER_CNCMCLIENTMANAGER_ENTRY_DESTRUCTOR_EXIT=0xfd
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLIENTMANAGER_CNCMCLIENTMANAGER_EXIT=0x103
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLIENTMANAGER_CONSTRUCTL_ENTRY=0x104
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLIENTMANAGER_CONSTRUCTL_EXIT=0x105
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLIENTMANAGER_DATAINTERFACENUMBER_ENTRY=0x110
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLIENTMANAGER_DATAINTERFACENUMBER_EXIT=0x111
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLIENTMANAGER_DATAINTERFACENUMBER_EXIT_DUP1=0x112
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLIENTMANAGER_DATAINTERFACENUMBER_EXIT_DUP2=0x113
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLIENTMANAGER_DATAINTERFACENUMBER_EXIT_DUP3=0x114
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLIENTMANAGER_NEWLC_ENTRY=0xf8
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLIENTMANAGER_NEWLC_EXIT=0xf9
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLIENTMANAGER_NEWL_ENTRY=0xfa
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLIENTMANAGER_NEWL_EXIT=0xfb
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLIENTMANAGER_SETCOMMUNICATIONINTERFACEL_ENTRY=0x106
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLIENTMANAGER_SETCOMMUNICATIONINTERFACEL_EXIT=0x107
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLIENTMANAGER_SETDATAINTERFACEL_ENTRY=0x108
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLIENTMANAGER_SETDATAINTERFACEL_EXIT=0x109
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLIENTMANAGER_SETMACADDRESSSTRING_ENTRY=0x10e
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLIENTMANAGER_SETMACADDRESSSTRING_EXIT=0x10f
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLIENTMANAGER_SETNCMINTERFACESL_ENTRY=0xfe
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLIENTMANAGER_SETNCMINTERFACESL_EXIT=0xff
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLIENTMANAGER_SETUPCLASSSPECIFICDESCRIPTOR_ENTRY=0x10a
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLIENTMANAGER_SETUPCLASSSPECIFICDESCRIPTOR_EXIT=0x10b
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLIENTMANAGER_SETUPCLASSSPECIFICDESCRIPTOR_EXIT_DUP1=0x10c
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLIENTMANAGER_SETUPCLASSSPECIFICDESCRIPTOR_EXIT_DUP2=0x10d
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLIENTMANAGER_TRANSFERINTERFACESL_ENTRY=0x100
+[TRACE]TRACE_FLOW[0x8A]_CNCMCLIENTMANAGER_TRANSFERINTERFACESL_EXIT=0x101
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANAGER_CNCMCONNECTIONMANAGER_DESTRUCTOR_ENTRY=0x11b
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANAGER_CNCMCONNECTIONMANAGER_DESTRUCTOR_EXIT=0x11c
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANAGER_CONSTRUCTL_ENTRY=0x117
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANAGER_CONSTRUCTL_EXIT=0x118
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANAGER_HANDLECONNECTIONCOMPLETEL_ENTRY=0x119
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANAGER_HANDLECONNECTIONCOMPLETEL_EXIT=0x11a
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANAGER_MDNOHANDLEDHCPNOTIFICATION_ENTRY=0x12b
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANAGER_MDNOHANDLEDHCPNOTIFICATION_EXIT=0x12c
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANAGER_MDNOHANDLEDHCPNOTIFICATION_EXIT_DUP1=0x12d
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANAGER_MICOHANDLECONNECTIONCOMPLETE_ENTRY=0x129
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANAGER_MICOHANDLECONNECTIONCOMPLETE_EXIT=0x12a
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANAGER_MICOHANDLEIAPREADINGCOMPLETE_ENTRY=0x12e
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANAGER_MICOHANDLEIAPREADINGCOMPLETE_EXIT=0x12f
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANAGER_MICOHANDLEIAPREADINGCOMPLETE_EXIT_DUP1=0x130
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANAGER_MICOHANDLEIAPREADINGCOMPLETE_EXIT_DUP2=0x131
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANAGER_MIPSOHANDLECLASSFATALERROR_ENTRY=0x127
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANAGER_MIPSOHANDLECLASSFATALERROR_EXIT=0x128
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANAGER_NEWL_ENTRY=0x115
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANAGER_NEWL_EXIT=0x116
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANAGER_RESET_ENTRY=0x123
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANAGER_RESET_EXIT=0x124
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANAGER_SETCUSTOMMTUL_ENTRY=0x125
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANAGER_SETCUSTOMMTUL_EXIT=0x126
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANAGER_STARTCANCEL_ENTRY=0x11f
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANAGER_STARTCANCEL_EXIT=0x120
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANAGER_START_ENTRY=0x11d
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANAGER_START_EXIT=0x11e
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANAGER_STOP_ENTRY=0x121
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANAGER_STOP_EXIT=0x122
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANHELPER_CNCMCONNECTIONMANHELPER_ENTRY=0x134
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANHELPER_CNCMCONNECTIONMANHELPER_ENTRY_DESTRUCTOR=0x136
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANHELPER_CNCMCONNECTIONMANHELPER_ENTRY_DESTRUCTOR_EXIT=0x137
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANHELPER_CNCMCONNECTIONMANHELPER_EXIT=0x135
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANHELPER_CONSTRUCTL_ENTRY=0x138
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANHELPER_CONSTRUCTL_EXIT=0x139
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANHELPER_DOCANCEL_ENTRY=0x13e
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANHELPER_DOCANCEL_EXIT=0x13f
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANHELPER_NEWL_ENTRY=0x132
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANHELPER_NEWL_EXIT=0x133
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANHELPER_RUNL_ENTRY=0x140
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANHELPER_RUNL_EXIT=0x141
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANHELPER_START_ENTRY=0x13a
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANHELPER_START_EXIT=0x13b
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANHELPER_STOP_ENTRY=0x13c
+[TRACE]TRACE_FLOW[0x8A]_CNCMCONNECTIONMANHELPER_STOP_EXIT=0x13d
+[TRACE]TRACE_FLOW[0x8A]_CNCMDHCPNOTIFWATCHER_CNCMDHCPNOTIFWATCHER_ENTRY=0x142
+[TRACE]TRACE_FLOW[0x8A]_CNCMDHCPNOTIFWATCHER_CNCMDHCPNOTIFWATCHER_ENTRY_DESTROY=0x144
+[TRACE]TRACE_FLOW[0x8A]_CNCMDHCPNOTIFWATCHER_CNCMDHCPNOTIFWATCHER_EXIT=0x143
+[TRACE]TRACE_FLOW[0x8A]_CNCMDHCPNOTIFWATCHER_CNCMDHCPNOTIFWATCHER_EXIT_DESTROY=0x145
+[TRACE]TRACE_FLOW[0x8A]_CNCMDHCPNOTIFWATCHER_DOCANCEL_ENTRY=0x148
+[TRACE]TRACE_FLOW[0x8A]_CNCMDHCPNOTIFWATCHER_DOCANCEL_EXIT=0x149
+[TRACE]TRACE_FLOW[0x8A]_CNCMDHCPNOTIFWATCHER_RUNL_ENTRY=0x14a
+[TRACE]TRACE_FLOW[0x8A]_CNCMDHCPNOTIFWATCHER_RUNL_EXIT=0x14b
+[TRACE]TRACE_FLOW[0x8A]_CNCMDHCPNOTIFWATCHER_START_ENTRY=0x146
+[TRACE]TRACE_FLOW[0x8A]_CNCMDHCPNOTIFWATCHER_START_EXIT=0x147
+[TRACE]TRACE_FLOW[0x8A]_CNCMIAPPROGRESSWATCHER_CNCMIAPPROGRESSWATCHER_ENTRY=0x14e
+[TRACE]TRACE_FLOW[0x8A]_CNCMIAPPROGRESSWATCHER_CNCMIAPPROGRESSWATCHER_ENTRY_DESTRUCTOR=0x150
+[TRACE]TRACE_FLOW[0x8A]_CNCMIAPPROGRESSWATCHER_CNCMIAPPROGRESSWATCHER_ENTRY_DESTRUCTOR_EXIT=0x151
+[TRACE]TRACE_FLOW[0x8A]_CNCMIAPPROGRESSWATCHER_CNCMIAPPROGRESSWATCHER_EXIT=0x14f
+[TRACE]TRACE_FLOW[0x8A]_CNCMIAPPROGRESSWATCHER_CONSTRUCTL_ENTRY=0x152
+[TRACE]TRACE_FLOW[0x8A]_CNCMIAPPROGRESSWATCHER_CONSTRUCTL_EXIT=0x153
+[TRACE]TRACE_FLOW[0x8A]_CNCMIAPPROGRESSWATCHER_DOCANCEL_ENTRY=0x156
+[TRACE]TRACE_FLOW[0x8A]_CNCMIAPPROGRESSWATCHER_DOCANCEL_EXIT=0x157
+[TRACE]TRACE_FLOW[0x8A]_CNCMIAPPROGRESSWATCHER_NEWL_ENTRY=0x14c
+[TRACE]TRACE_FLOW[0x8A]_CNCMIAPPROGRESSWATCHER_NEWL_EXIT=0x14d
+[TRACE]TRACE_FLOW[0x8A]_CNCMIAPPROGRESSWATCHER_RUNL_ENTRY=0x158
+[TRACE]TRACE_FLOW[0x8A]_CNCMIAPPROGRESSWATCHER_RUNL_EXIT=0x159
+[TRACE]TRACE_FLOW[0x8A]_CNCMIAPPROGRESSWATCHER_START_ENTRY=0x154
+[TRACE]TRACE_FLOW[0x8A]_CNCMIAPPROGRESSWATCHER_START_EXIT=0x155
+[TRACE]TRACE_FLOW[0x8A]_CNCMIAPREADER_CNCMIAPREADER_ENTRY=0x15a
+[TRACE]TRACE_FLOW[0x8A]_CNCMIAPREADER_CNCMIAPREADER_ENTRY_DESTRUCTOR=0x15c
+[TRACE]TRACE_FLOW[0x8A]_CNCMIAPREADER_CNCMIAPREADER_ENTRY_DESTRUCTOR_EXIT=0x15d
+[TRACE]TRACE_FLOW[0x8A]_CNCMIAPREADER_CNCMIAPREADER_EXIT=0x15b
+[TRACE]TRACE_FLOW[0x8A]_CNCMIAPREADER_DOCANCEL_ENTRY=0x160
+[TRACE]TRACE_FLOW[0x8A]_CNCMIAPREADER_DOCANCEL_EXIT=0x161
+[TRACE]TRACE_FLOW[0x8A]_CNCMIAPREADER_GETNCMIAPIDL_ENTRY=0x164
+[TRACE]TRACE_FLOW[0x8A]_CNCMIAPREADER_GETNCMIAPIDL_EXIT=0x165
+[TRACE]TRACE_FLOW[0x8A]_CNCMIAPREADER_RUNL_ENTRY=0x162
+[TRACE]TRACE_FLOW[0x8A]_CNCMIAPREADER_RUNL_EXIT=0x163
+[TRACE]TRACE_FLOW[0x8A]_CNCMIAPREADER_START_ENTRY=0x15e
+[TRACE]TRACE_FLOW[0x8A]_CNCMIAPREADER_START_EXIT=0x15f
+[TRACE]TRACE_FLOW[0x8A]_TNCMCLASSDESCRIPTOR_DES_ENTRY=0xf6
+[TRACE]TRACE_FLOW[0x8A]_TNCMCLASSDESCRIPTOR_DES_EXIT=0xf7
+[TRACE]TRACE_NORMAL[0x86]_CNCMCLASSCONTROLLER_CNCMCLASSCONTROLLER_PRE_UNLOAD_CSC_LDD=0x53
+[TRACE]TRACE_NORMAL[0x86]_CNCMCLASSCONTROLLER_CNCMCLASSCONTROLLER_UNLOAD_LDD_RESULT=0x54
+[TRACE]TRACE_NORMAL[0x86]_CNCMCLASSCONTROLLER_CONSTRUCTL=0x50
+[TRACE]TRACE_NORMAL[0x86]_CNCMCLASSCONTROLLER_CONSTRUCTL_CSC_LDD_LOADED=0x52
+[TRACE]TRACE_NORMAL[0x86]_CNCMCLASSCONTROLLER_CONSTRUCTL_LOAD_CSC_LDD=0x51
+[TRACE]TRACE_NORMAL[0x86]_CNCMCLASSCONTROLLER_DOCANCEL_IDLE=0x5b
+[TRACE]TRACE_NORMAL[0x86]_CNCMCLASSCONTROLLER_DOCANCEL_INFO_PRINT=0x5a
+[TRACE]TRACE_NORMAL[0x86]_CNCMCLASSCONTROLLER_RUNL_BUILT_NCM_CONNECTION=0x59
+[TRACE]TRACE_NORMAL[0x86]_CNCMCLASSCONTROLLER_RUNL_PRINT_INFO=0x57
+[TRACE]TRACE_NORMAL[0x86]_CNCMCLASSCONTROLLER_RUNL_STARTED=0x58
+[TRACE]TRACE_NORMAL[0x86]_CNCMCLASSCONTROLLER_START_PRINT_STATE=0x55
+[TRACE]TRACE_NORMAL[0x86]_CNCMCLASSCONTROLLER_STOP_PRINT_STATE=0x56
+[TRACE]TRACE_NORMAL[0x86]_CNCMCLIENTMANAGER_CNCMCLIENTMANAGER_CLOSE_COMM_CHUNK=0x5d
+[TRACE]TRACE_NORMAL[0x86]_CNCMCLIENTMANAGER_CNCMCLIENTMANAGER_CLOSE_COMM_INTERFACE=0x5e
+[TRACE]TRACE_NORMAL[0x86]_CNCMCLIENTMANAGER_CNCMCLIENTMANAGER_CLOSE_DATA_CHUNK=0x60
+[TRACE]TRACE_NORMAL[0x86]_CNCMCLIENTMANAGER_CNCMCLIENTMANAGER_CLOSE_DATA_INTERFACE=0x61
+[TRACE]TRACE_NORMAL[0x86]_CNCMCLIENTMANAGER_CNCMCLIENTMANAGER_PRE_CLOSE_COMM_INTERFACE=0x5c
+[TRACE]TRACE_NORMAL[0x86]_CNCMCLIENTMANAGER_CNCMCLIENTMANAGER_PRE_CLOSE_DATA_INTERFACE=0x5f
+[TRACE]TRACE_NORMAL[0x86]_CNCMCLIENTMANAGER_DATAINTERFACENUMBER=0x69
+[TRACE]TRACE_NORMAL[0x86]_CNCMCLIENTMANAGER_DATAINTERFACENUMBER_INTERFACE_INFO=0x67
+[TRACE]TRACE_NORMAL[0x86]_CNCMCLIENTMANAGER_DATAINTERFACENUMBER_INTERFACE_INFO2=0x68
+[TRACE]TRACE_NORMAL[0x86]_CNCMCLIENTMANAGER_SETDATAINTERFACEL_TRY_NEW_BUF_SIZE=0x64
+[TRACE]TRACE_NORMAL[0x86]_CNCMCLIENTMANAGER_SETMACADDRESSSTRING=0x66
+[TRACE]TRACE_NORMAL[0x86]_CNCMCLIENTMANAGER_SETUPCLASSSPECIFICDESCRIPTOR_PRE_SET_BLOCK=0x65
+[TRACE]TRACE_NORMAL[0x86]_CNCMCLIENTMANAGER_TRANSFERINTERFACESL_INTERFACES_TRANSFERED=0x63
+[TRACE]TRACE_NORMAL[0x86]_CNCMCLIENTMANAGER_TRANSFERINTERFACESL_PRE_TRANSFER_INTERFACES=0x62
+[TRACE]TRACE_NORMAL[0x86]_CNCMCONNECTIONMANAGER_HANDLECONNECTIONCOMPLETEL_CHANGE_MTU=0x6a
+[TRACE]TRACE_NORMAL[0x86]_CNCMCONNECTIONMANAGER_HANDLECONNECTIONCOMPLETEL_CONN_NCM_INTERNAL_SVR=0x6b
+[TRACE]TRACE_NORMAL[0x86]_CNCMCONNECTIONMANAGER_MDNOHANDLEDHCPNOTIFICATION_CALL_IOCTL=0x73
+[TRACE]TRACE_NORMAL[0x86]_CNCMCONNECTIONMANAGER_MDNOHANDLEDHCPNOTIFICATION_RETURN_IOCTL=0x74
+[TRACE]TRACE_NORMAL[0x86]_CNCMCONNECTIONMANAGER_SETCUSTOMMTUL=0x6c
+[TRACE]TRACE_NORMAL[0x86]_CNCMCONNECTIONMANAGER_SETCUSTOMMTUL_INTER_INFO=0x6d
+[TRACE]TRACE_NORMAL[0x86]_CNCMCONNECTIONMANAGER_SETCUSTOMMTUL_INTER_MTU=0x71
+[TRACE]TRACE_NORMAL[0x86]_CNCMCONNECTIONMANAGER_SETCUSTOMMTUL_INTER_NAME=0x70
+[TRACE]TRACE_NORMAL[0x86]_CNCMCONNECTIONMANAGER_SETCUSTOMMTUL_NEW_MTU_SIZE=0x6e
+[TRACE]TRACE_NORMAL[0x86]_CNCMCONNECTIONMANAGER_SETCUSTOMMTUL_PRE_SETMTU=0x72
+[TRACE]TRACE_NORMAL[0x86]_CNCMCONNECTIONMANAGER_SETCUSTOMMTUL_START_INTER_ENUM=0x6f
+[TRACE]TRACE_NORMAL[0x86]_CNCMCONNECTIONMANHELPER_DOCNCEL=0x76
+[TRACE]TRACE_NORMAL[0x86]_CNCMCONNECTIONMANHELPER_STOP_RETURN_CODE=0x75
+[TRACE]TRACE_NORMAL[0x86]_CNCMIAPPROGRESSWATCHER_RUNL_COMPLETION_CODE=0x77
+[TRACE]TRACE_NORMAL[0x86]_CNCMIAPPROGRESSWATCHER_RUNL_INFO=0x78
+[TRACE]TRACE_NORMAL[0x86]_CNCMIAPPROGRESSWATCHER_RUNL_RESTART_WATCHER=0x79
+[TRACE]TRACE_NORMAL[0x86]_CNCMIAPREADER_GETNCMIAPIDL_CHOSEN_IAP_ID=0x7f
+[TRACE]TRACE_NORMAL[0x86]_CNCMIAPREADER_GETNCMIAPIDL_CHOSEN_LAN_BEARER=0x7c
+[TRACE]TRACE_NORMAL[0x86]_CNCMIAPREADER_GETNCMIAPIDL_COUNT_LAN_BEARER=0x7b
+[TRACE]TRACE_NORMAL[0x86]_CNCMIAPREADER_GETNCMIAPIDL_RECORD_BEARER_ID=0x7e
+[TRACE]TRACE_NORMAL[0x86]_CNCMIAPREADER_GETNCMIAPIDL_RECORD_ID=0x7d
+[TRACE]TRACE_NORMAL[0x86]_CNCMIAPREADER_RUNL_GETIAP=0x7a
+[TRACE]TRACE_NORMAL[0x86]_CNCMIAPREADER_SEARCHNCMIAPL_ONLY_ONE_NCM_IAP=0x4f
+[[OBSOLETE]][TRACE]TRACE_ERROR[0x82]_CCONNECTIONMANAGER_CONSTRUCTL=0xc
+[[OBSOLETE]][TRACE]TRACE_ERROR[0x82]_CCONNECTIONMANAGER_MICOHANDLEIAPREADINGCOMPLETE_IAP_RESULT=0x1
+[[OBSOLETE]][TRACE]TRACE_ERROR[0x82]_CCONNECTIONMANAGER_MICOHANDLEIAPREADINGCOMPLETE_SET_SHARED_STATE=0x2
+[[OBSOLETE]][TRACE]TRACE_ERROR[0x82]_CCONNECTIONMANAGER_MIPSOHANDLECLASSFATALERROR=0xb
+[[OBSOLETE]][TRACE]TRACE_ERROR[0x82]_CCONNECTIONMANAGER_SETCUSTOMMTUL_SEARCH_FAIL=0x8
+[[OBSOLETE]][TRACE]TRACE_ERROR[0x82]_CIAPREADER_GETNCMIAPIDL=0xd
+[[OBSOLETE]][TRACE]TRACE_ERROR[0x82]_CIAPREADER_GETNCMIAPIDL_NOT_FOUND=0x3
+[[OBSOLETE]][TRACE]TRACE_ERROR[0x82]_CNCMCLASSCONTROLLER_RUNL_DEFAULT=0xf
+[[OBSOLETE]][TRACE]TRACE_ERROR[0x82]_CUSBCLIENTMANAGER_CUSBCLIENTMANAGER_CLOSE_COMM_CHUNK_FAIL=0x4
+[[OBSOLETE]][TRACE]TRACE_ERROR[0x82]_CUSBCLIENTMANAGER_CUSBCLIENTMANAGER_CLOSE_DATA_CHUNK_FAIL=0x5
+[[OBSOLETE]][TRACE]TRACE_ERROR[0x82]_CUSBCLIENTMANAGER_SETCOMMUNICATIONINTERFACEL=0xe
+[[OBSOLETE]][TRACE]TRACE_ERROR[0x82]_CUSBCLIENTMANAGER_SETCOMMUNICATIONINTERFACEL_FAIL_TO_INIT=0x6
+[[OBSOLETE]][TRACE]TRACE_ERROR[0x82]_CUSBCLIENTMANAGER_SETDATAINTERFACEL_SET_INTERFACE_FAIL=0x7
+[[OBSOLETE]][TRACE]TRACE_ERROR[0x82]_CUSBNCMCLASSCONTROLLER_DOCANCEL_DEFAULT=0xa
+[[OBSOLETE]][TRACE]TRACE_ERROR[0x82]_CUSBNCMCLASSCONTROLLER_RUNL_DEFAULT=0x10
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CDHCPNOTIFWATCHER_STARTL=0x2
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CNCMCLASSCONTROLLER_DOCANCEL_DEFAULT=0x3
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CUSBNCMCLASSCONTROLLER_DOCANCEL_DEFAULT=0x4
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANAGER_CCONNECTIONMANAGER_DESTRUCTOR_ENTRY=0x6
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANAGER_CCONNECTIONMANAGER_DESTRUCTOR_EXIT=0x7
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANAGER_CCONNECTIONMANAGER_ENTRY=0x8
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANAGER_CCONNECTIONMANAGER_EXIT=0x9
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANAGER_CONSTRUCTL=0x1
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANAGER_CONSTRUCTL_ENTRY=0x2
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANAGER_CONSTRUCTL_EXIT=0x3
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANAGER_HANDLECONNECTIONCOMPLETEL_ENTRY=0x4
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANAGER_HANDLECONNECTIONCOMPLETEL_EXIT=0x5
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANAGER_MDNOHANDLEDHCPNOTIFICATION_ENTRY=0x1c
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANAGER_MDNOHANDLEDHCPNOTIFICATION_EXIT=0x9a
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANAGER_MDNOHANDLEDHCPNOTIFICATION_EXIT_DUP1=0x9b
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANAGER_MICOHANDLECONNECTIONCOMPLETE_ENTRY=0x1a
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANAGER_MICOHANDLECONNECTIONCOMPLETE_EXIT=0x1b
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANAGER_MICOHANDLEIAPREADINGCOMPLETE_ENTRY=0x1e
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANAGER_MICOHANDLEIAPREADINGCOMPLETE_EXIT=0x1f
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANAGER_MICOHANDLEIAPREADINGCOMPLETE_EXIT_DUP1=0x9c
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANAGER_MICOHANDLEIAPREADINGCOMPLETE_EXIT_DUP2=0x9d
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANAGER_MIPSOHANDLECLASSFATALERROR_ENTRY=0x18
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANAGER_MIPSOHANDLECLASSFATALERROR_EXIT=0x19
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANAGER_MIPSOHANDLEIAPTEARDOWN_ENTRY=0x16
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANAGER_MIPSOHANDLEIAPTEARDOWN_EXIT=0x17
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANAGER_NEWL_ENTRY=0x14
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANAGER_NEWL_EXIT=0x15
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANAGER_RESET_ENTRY=0x10
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANAGER_RESET_EXIT=0x11
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANAGER_SETCUSTOMMTUL_ENTRY=0x12
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANAGER_SETCUSTOMMTUL_EXIT=0x13
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANAGER_STARTCANCEL_ENTRY=0xc
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANAGER_STARTCANCEL_EXIT=0xd
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANAGER_START_ENTRY=0xa
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANAGER_START_EXIT=0xb
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANAGER_STOP_ENTRY=0xe
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANAGER_STOP_EXIT=0xf
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANHELPER_CCONNECTIONMANHELPER_ENTRY=0x22
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANHELPER_CCONNECTIONMANHELPER_ENTRY_DESTRUCTOR=0x24
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANHELPER_CCONNECTIONMANHELPER_ENTRY_DESTRUCTOR_EXIT=0x25
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANHELPER_CCONNECTIONMANHELPER_EXIT=0x23
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANHELPER_CONSTRUCTL_ENTRY=0x26
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANHELPER_CONSTRUCTL_EXIT=0x27
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANHELPER_DOCANCEL_ENTRY=0x2e
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANHELPER_DOCANCEL_EXIT=0x2f
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANHELPER_NEWL_ENTRY=0x20
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANHELPER_NEWL_EXIT=0x21
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANHELPER_RUNL_ENTRY=0x30
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANHELPER_RUNL_EXIT=0x31
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANHELPER_SILENTSTOP_ENTRY=0x2c
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANHELPER_SILENTSTOP_EXIT=0x2d
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANHELPER_START_ENTRY=0x28
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANHELPER_START_EXIT=0x29
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANHELPER_STOP_ENTRY=0x2a
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CCONNECTIONMANHELPER_STOP_EXIT=0x2b
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CDHCPNOTIFWATCHER_CDHCPNOTIFWATCHER_ENTRY=0x34
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CDHCPNOTIFWATCHER_CDHCPNOTIFWATCHER_ENTRY_DESTROY=0x9e
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CDHCPNOTIFWATCHER_CDHCPNOTIFWATCHER_EXIT=0x35
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CDHCPNOTIFWATCHER_CDHCPNOTIFWATCHER_EXIT_DESTROY=0x9f
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CDHCPNOTIFWATCHER_CONSTRUCTL_ENTRY=0x38
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CDHCPNOTIFWATCHER_CONSTRUCTL_EXIT=0x39
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CDHCPNOTIFWATCHER_DOCANCEL_ENTRY=0x3c
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CDHCPNOTIFWATCHER_DOCANCEL_EXIT=0x3d
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CDHCPNOTIFWATCHER_NEWL_ENTRY=0x32
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CDHCPNOTIFWATCHER_NEWL_EXIT=0x33
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CDHCPNOTIFWATCHER_RUNL_ENTRY=0x3e
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CDHCPNOTIFWATCHER_RUNL_EXIT=0x3f
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CDHCPNOTIFWATCHER_START_ENTRY=0x3a
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CDHCPNOTIFWATCHER_START_EXIT=0x3b
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CIAPPROGRESSWATCHER_CIAPPROGRESSWATCHER_ENTRY=0x42
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CIAPPROGRESSWATCHER_CIAPPROGRESSWATCHER_ENTRY_DESTRUCTOR=0x44
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CIAPPROGRESSWATCHER_CIAPPROGRESSWATCHER_ENTRY_DESTRUCTOR_EXIT=0x45
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CIAPPROGRESSWATCHER_CIAPPROGRESSWATCHER_EXIT=0x43
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CIAPPROGRESSWATCHER_CONSTRUCTL_ENTRY=0x46
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CIAPPROGRESSWATCHER_CONSTRUCTL_EXIT=0x47
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CIAPPROGRESSWATCHER_DOCANCEL_ENTRY=0x4a
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CIAPPROGRESSWATCHER_DOCANCEL_EXIT=0x4b
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CIAPPROGRESSWATCHER_NEWL_ENTRY=0x40
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CIAPPROGRESSWATCHER_NEWL_EXIT=0x41
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CIAPPROGRESSWATCHER_RUNL_ENTRY=0x4c
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CIAPPROGRESSWATCHER_RUNL_EXIT=0x4d
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CIAPPROGRESSWATCHER_START_ENTRY=0x48
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CIAPPROGRESSWATCHER_START_EXIT=0x49
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CIAPREADER_CIAPREADER_ENTRY=0x50
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CIAPREADER_CIAPREADER_ENTRY_DESTRUCTOR=0x52
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CIAPREADER_CIAPREADER_ENTRY_DESTRUCTOR_EXIT=0x53
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CIAPREADER_CIAPREADER_EXIT=0x51
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CIAPREADER_CONSTRUCTL_ENTRY=0x54
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CIAPREADER_CONSTRUCTL_EXIT=0x55
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CIAPREADER_DOCANCEL_ENTRY=0x58
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CIAPREADER_DOCANCEL_EXIT=0x59
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CIAPREADER_GETNCMIAPIDL_ENTRY=0x5c
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CIAPREADER_GETNCMIAPIDL_EXIT=0x5d
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CIAPREADER_NEWL_ENTRY=0x4e
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CIAPREADER_NEWL_EXIT=0x4f
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CIAPREADER_RUNL_ENTRY=0x5a
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CIAPREADER_RUNL_EXIT=0x5b
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CIAPREADER_START_ENTRY=0x56
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CIAPREADER_START_EXIT=0x57
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_CNCMCLASSCONTROLLER_ENTRY=0xaa
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_CNCMCLASSCONTROLLER_ENTRY_DESTROY=0xb0
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_CNCMCLASSCONTROLLER_EXIT=0xab
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_CNCMCLASSCONTROLLER_EXIT_DESTROY=0xb1
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_CONSTRUCTL_ENTRY=0xac
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_CONSTRUCTL_EXIT=0xad
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_DOCANCEL_ENTRY=0xbd
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_DOCANCEL_EXIT=0xbe
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_DOCANCEL_EXIT_DUP1=0xbf
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_GETDESCRIPTORINFO_ENTRY=0xb6
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_GETDESCRIPTORINFO_EXIT=0xb7
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_MCMOERRORINDICATION_ENTRY=0xb8
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_MCMOERRORINDICATION_EXIT=0xb9
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_NEWL_ENTRY=0xa8
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_NEWL_EXIT=0xa9
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_RANDOMMACADDRESSL_ENTRY=0xae
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_RANDOMMACADDRESSL_EXIT=0xaf
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_RUNERROR_ENTRY=0xc0
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_RUNERROR_EXIT=0xc1
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_RUNL_ENTRY=0xba
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_RUNL_EXIT=0xbc
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_RUNL_TRANSFER_HANDLES=0xbb
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_START_ENTRY=0xb2
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_START_EXIT=0xb3
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_STOP_ENTRY=0xb4
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CNCMCLASSCONTROLLER_STOP_EXIT=0xb5
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBCLIENTMANAGER_CONSTRUCTL_ENTRY=0x6c
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBCLIENTMANAGER_CONSTRUCTL_EXIT=0x6d
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBCLIENTMANAGER_CUSBCLIENTMANAGER_ENTRY=0x6a
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBCLIENTMANAGER_CUSBCLIENTMANAGER_ENTRY_DESTRUCTOR=0x64
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBCLIENTMANAGER_CUSBCLIENTMANAGER_ENTRY_DESTRUCTOR_EXIT=0x65
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBCLIENTMANAGER_CUSBCLIENTMANAGER_EXIT=0x6b
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBCLIENTMANAGER_DATAINTERFACENUMBER_ENTRY=0x78
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBCLIENTMANAGER_DATAINTERFACENUMBER_EXIT=0x79
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBCLIENTMANAGER_DATAINTERFACENUMBER_EXIT_DUP1=0xa2
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBCLIENTMANAGER_DATAINTERFACENUMBER_EXIT_DUP2=0xa3
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBCLIENTMANAGER_DATAINTERFACENUMBER_EXIT_DUP3=0xa4
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBCLIENTMANAGER_NEWLC_ENTRY=0x60
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBCLIENTMANAGER_NEWLC_EXIT=0x61
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBCLIENTMANAGER_NEWL_ENTRY=0x62
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBCLIENTMANAGER_NEWL_EXIT=0x63
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBCLIENTMANAGER_SETCOMMUNICATIONINTERFACEL_ENTRY=0x6e
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBCLIENTMANAGER_SETCOMMUNICATIONINTERFACEL_EXIT=0x6f
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBCLIENTMANAGER_SETDATAINTERFACEL_ENTRY=0x70
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBCLIENTMANAGER_SETDATAINTERFACEL_EXIT=0x71
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBCLIENTMANAGER_SETMACADDRESSSTRING_ENTRY=0x76
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBCLIENTMANAGER_SETMACADDRESSSTRING_EXIT=0x77
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBCLIENTMANAGER_SETNCMINTERFACESL_ENTRY=0x66
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBCLIENTMANAGER_SETNCMINTERFACESL_EXIT=0x67
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBCLIENTMANAGER_SETUPCLASSSPECIFICDESCRIPTOR_ENTRY=0x72
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBCLIENTMANAGER_SETUPCLASSSPECIFICDESCRIPTOR_EXIT=0x73
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBCLIENTMANAGER_SETUPCLASSSPECIFICDESCRIPTOR_EXIT_DUP1=0xa0
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBCLIENTMANAGER_SETUPCLASSSPECIFICDESCRIPTOR_EXIT_DUP2=0xa1
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBCLIENTMANAGER_TRANSFERINTERFACESL_ENTRY=0x68
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBCLIENTMANAGER_TRANSFERINTERFACESL_EXIT=0x69
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBNCMCLASSCONTROLLER_CONSTRUCTL_ENTRY=0xc6
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBNCMCLASSCONTROLLER_CONSTRUCTL_EXIT=0xc7
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBNCMCLASSCONTROLLER_CUSBNCMCLASSCONTROLLER_ENTRY=0xc4
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBNCMCLASSCONTROLLER_CUSBNCMCLASSCONTROLLER_ENTRY_DESTROY=0xca
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBNCMCLASSCONTROLLER_CUSBNCMCLASSCONTROLLER_EXIT=0xc5
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBNCMCLASSCONTROLLER_CUSBNCMCLASSCONTROLLER_EXIT_DESTROY=0xcb
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBNCMCLASSCONTROLLER_DOCANCEL_ENTRY=0xd7
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBNCMCLASSCONTROLLER_DOCANCEL_EXIT=0xd8
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBNCMCLASSCONTROLLER_DOCANCEL_EXIT_DUP1=0xd9
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBNCMCLASSCONTROLLER_GETDESCRIPTORINFO_ENTRY=0xd0
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBNCMCLASSCONTROLLER_GETDESCRIPTORINFO_EXIT=0xd1
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBNCMCLASSCONTROLLER_MCMOERRORINDICATION_ENTRY=0xd2
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBNCMCLASSCONTROLLER_MCMOERRORINDICATION_EXIT=0xd3
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBNCMCLASSCONTROLLER_NEWL_ENTRY=0xc2
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBNCMCLASSCONTROLLER_NEWL_EXIT=0xc3
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBNCMCLASSCONTROLLER_RANDOMMACADDRESSL_ENTRY=0xc8
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBNCMCLASSCONTROLLER_RANDOMMACADDRESSL_EXIT=0xc9
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBNCMCLASSCONTROLLER_RUNERROR_ENTRY=0xda
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBNCMCLASSCONTROLLER_RUNERROR_EXIT=0xdb
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBNCMCLASSCONTROLLER_RUNL_ENTRY=0xd4
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBNCMCLASSCONTROLLER_RUNL_EXIT=0xd6
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBNCMCLASSCONTROLLER_RUNL_TRANSFER_HANDLES=0xd5
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBNCMCLASSCONTROLLER_START_ENTRY=0xcc
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBNCMCLASSCONTROLLER_START_EXIT=0xcd
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBNCMCLASSCONTROLLER_STOP_ENTRY=0xce
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBNCMCLASSCONTROLLER_STOP_EXIT=0xcf
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_DUP1_CCONNECTIONMANAGER_MDNOHANDLEDHCPNOTIFICATION_EXIT=0x7d
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_DUP1_CCONNECTIONMANAGER_MICOHANDLEIAPREADINGCOMPLETE_EXIT=0x7e
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_DUP1_CDHCPNOTIFWATCHER_CDHCPNOTIFWATCHER_ENTRY=0x36
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_DUP1_CDHCPNOTIFWATCHER_CDHCPNOTIFWATCHER_EXIT=0x37
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_DUP1_CUSBCLIENTMANAGER_DATAINTERFACENUMBER_EXIT=0x7a
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_DUP1_CUSBCLIENTMANAGER_SETUPCLASSSPECIFICDESCRIPTOR_EXIT=0x74
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_DUP1_CUSBNCMCLASSCONTROLLER_CUSBNCMCLASSCONTROLLER_ENTRY=0x88
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_DUP1_CUSBNCMCLASSCONTROLLER_CUSBNCMCLASSCONTROLLER_EXIT=0x89
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_DUP1_CUSBNCMCLASSCONTROLLER_DOCANCEL_EXIT=0x97
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_DUP2_CCONNECTIONMANAGER_MICOHANDLEIAPREADINGCOMPLETE_EXIT=0x7f
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_DUP2_CUSBCLIENTMANAGER_DATAINTERFACENUMBER_EXIT=0x7b
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_DUP2_CUSBCLIENTMANAGER_SETUPCLASSSPECIFICDESCRIPTOR_EXIT=0x75
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_DUP3_CUSBCLIENTMANAGER_DATAINTERFACENUMBER_EXIT=0x7c
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_TUSBNCMCLASSDESCRIPTOR_DES_ENTRY=0x5e
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_TUSBNCMCLASSDESCRIPTOR_DES_EXIT=0x5f
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CCONNECTIONMANAGER_HANDLECONNECTIONCOMPLETEL_CHANGE_MTU=0x1
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CCONNECTIONMANAGER_HANDLECONNECTIONCOMPLETEL_CONN_NCM_INTERNAL_SVR=0x2
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CCONNECTIONMANAGER_MDNOHANDLEDHCPNOTIFICATION_CALL_IOCTL=0x33
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CCONNECTIONMANAGER_MDNOHANDLEDHCPNOTIFICATION_RETURN_IOCTL=0x34
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CCONNECTIONMANAGER_SETCUSTOMMTUL=0x3
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CCONNECTIONMANAGER_SETCUSTOMMTUL_INTER_INFO=0x4
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CCONNECTIONMANAGER_SETCUSTOMMTUL_INTER_MTU=0x8
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CCONNECTIONMANAGER_SETCUSTOMMTUL_INTER_NAME=0x7
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CCONNECTIONMANAGER_SETCUSTOMMTUL_NEW_MTU_SIZE=0x5
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CCONNECTIONMANAGER_SETCUSTOMMTUL_PRE_SETMTU=0x25
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CCONNECTIONMANAGER_SETCUSTOMMTUL_START_INTER_ENUM=0x6
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CCONNECTIONMANHELPER_DOCNCEL=0xd
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CCONNECTIONMANHELPER_SILENTSTOP=0xc
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CCONNECTIONMANHELPER_STOP_RETURN_CODE=0xb
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CIAPPROGRESSWATCHER_RUNL_COMPLETION_CODE=0xe
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CIAPPROGRESSWATCHER_RUNL_INFO=0xf
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CIAPPROGRESSWATCHER_RUNL_RESTART_WATCHER=0x35
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CIAPREADER_GETNCMIAPIDL=0x13
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CIAPREADER_GETNCMIAPIDL_CHOSEN_IAP_ID=0x17
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CIAPREADER_GETNCMIAPIDL_CHOSEN_LAN_BEARER=0x14
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CIAPREADER_GETNCMIAPIDL_COUNT_LAN_BEARER=0x12
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CIAPREADER_GETNCMIAPIDL_RECORD_BEARER_ID=0x16
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CIAPREADER_GETNCMIAPIDL_RECORD_ID=0x15
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CIAPREADER_RUNL_GETIAP=0x10
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CNCMCLASSCONTROLLER_CNCMCLASSCONTROLLER_PRE_UNLOAD_CSC_LDD=0x3a
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CNCMCLASSCONTROLLER_CNCMCLASSCONTROLLER_UNLOAD_LDD_RESULT=0x3b
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CNCMCLASSCONTROLLER_CONSTRUCTL=0x37
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CNCMCLASSCONTROLLER_CONSTRUCTL_CSC_LDD_LOADED=0x39
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CNCMCLASSCONTROLLER_CONSTRUCTL_LOAD_CSC_LDD=0x38
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CNCMCLASSCONTROLLER_DOCANCEL_IDLE=0x42
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CNCMCLASSCONTROLLER_DOCANCEL_INFO_PRINT=0x41
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CNCMCLASSCONTROLLER_RUNL_BUILT_NCM_CONNECTION=0x40
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CNCMCLASSCONTROLLER_RUNL_PRINT_INFO=0x3e
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CNCMCLASSCONTROLLER_RUNL_STARTED=0x3f
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CNCMCLASSCONTROLLER_START_PRINT_STATE=0x3c
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CNCMCLASSCONTROLLER_STOP_PRINT_STATE=0x3d
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CNCMIAPREADER_SEARCHNCMIAPL_ENSURE_ONLY_ONE_NCM_IAP=0x36
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBCLIENTMANAGER_CUSBCLIENTMANAGER_CLOSE_COMM_CHUNK=0x19
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBCLIENTMANAGER_CUSBCLIENTMANAGER_CLOSE_COMM_INTERFACE=0x1a
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBCLIENTMANAGER_CUSBCLIENTMANAGER_CLOSE_DATA_CHUNK=0x1c
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBCLIENTMANAGER_CUSBCLIENTMANAGER_CLOSE_DATA_INTERFACE=0x1d
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBCLIENTMANAGER_CUSBCLIENTMANAGER_PRE_CLOSE_COMM_INTERFACE=0x18
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBCLIENTMANAGER_CUSBCLIENTMANAGER_PRE_CLOSE_DATA_INTERFACE=0x1b
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBCLIENTMANAGER_DATAINTERFACENUMBER=0x24
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBCLIENTMANAGER_DATAINTERFACENUMBER_INTERFACE_INFO=0x22
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBCLIENTMANAGER_DATAINTERFACENUMBER_INTERFACE_INFO2=0x23
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBCLIENTMANAGER_SETDATAINTERFACEL_TRY_NEW_BUF_SIZE=0x20
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBCLIENTMANAGER_SETMACADDRESSSTRING=0x21
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBCLIENTMANAGER_SETUPCLASSSPECIFICDESCRIPTOR_PRE_SET_BLOCK=0x26
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBCLIENTMANAGER_TRANSFERINTERFACESL_INTERFACES_TRANSFERED=0x1f
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBCLIENTMANAGER_TRANSFERINTERFACESL_PRE_TRANSFER_INTERFACES=0x1e
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBNCMCLASSCONTROLLER_CONSTRUCTL=0x43
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBNCMCLASSCONTROLLER_CONSTRUCTL_CSC_LDD_LOADED=0x45
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBNCMCLASSCONTROLLER_CONSTRUCTL_LOAD_CSC_LDD=0x44
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBNCMCLASSCONTROLLER_CUSBNCMCLASSCONTROLLER_PRE_UNLOAD_CSC_LDD=0x46
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBNCMCLASSCONTROLLER_CUSBNCMCLASSCONTROLLER_UNLOAD_LDD_RESULT=0x47
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBNCMCLASSCONTROLLER_DOCANCEL_IDLE=0x4e
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBNCMCLASSCONTROLLER_DOCANCEL_INFO_PRINT=0x4d
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBNCMCLASSCONTROLLER_RUNL_BUILT_NCM_CONNECTION=0x4c
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBNCMCLASSCONTROLLER_RUNL_PRINT_INFO=0x4a
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBNCMCLASSCONTROLLER_RUNL_STARTED=0x4b
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBNCMCLASSCONTROLLER_START_PRINT_STATE=0x48
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBNCMCLASSCONTROLLER_STOP_PRINT_STATE=0x49
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/group/bld.inf	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* 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:
+*
+*/
+
+
+PRJ_PLATFORMS
+ARMV5
+
+#include "../ncmpktdrv/group/bld.inf"
+
+PRJ_MMPFILES
+
+
+PRJ_TESTMMPFILES
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/client/bwins/ncminternalsrvu.def	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,12 @@
+EXPORTS
+	?SetDhcpResult@RNcmInternalSrv@@QAEHH@Z @ 1 NONAME ; int RNcmInternalSrv::SetDhcpResult(int)
+	?Version@RNcmInternalSrv@@QBE?AVTVersion@@XZ @ 2 NONAME ; class TVersion RNcmInternalSrv::Version(void) const
+	?TransferHandle@RNcmInternalSrv@@QAEHAAVRHandleBase@@000@Z @ 3 NONAME ; int RNcmInternalSrv::TransferHandle(class RHandleBase &, class RHandleBase &, class RHandleBase &, class RHandleBase &)
+	??0RNcmInternalSrv@@QAE@XZ @ 4 NONAME ; RNcmInternalSrv::RNcmInternalSrv(void)
+	?DhcpProvisionNotify@RNcmInternalSrv@@QAEXAAVTRequestStatus@@@Z @ 5 NONAME ; void RNcmInternalSrv::DhcpProvisionNotify(class TRequestStatus &)
+	?DhcpProvisionNotifyCancel@RNcmInternalSrv@@QAEXXZ @ 6 NONAME ; void RNcmInternalSrv::DhcpProvisionNotifyCancel(void)
+	?Connect@RNcmInternalSrv@@QAEHXZ @ 7 NONAME ; int RNcmInternalSrv::Connect(void)
+	?SetIapId@RNcmInternalSrv@@QAEHI@Z @ 8 NONAME ; int RNcmInternalSrv::SetIapId(unsigned int)
+	??1RNcmInternalSrv@@QAE@XZ @ 9 NONAME ; RNcmInternalSrv::~RNcmInternalSrv(void)
+	?TransferBufferSize@RNcmInternalSrv@@QAEHI@Z @ 10 NONAME ; int RNcmInternalSrv::TransferBufferSize(unsigned int)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/client/eabi/ncminternalsrvu.def	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,14 @@
+EXPORTS
+	_ZN15RNcmInternalSrv13SetDhcpResultEi @ 1 NONAME
+	_ZN15RNcmInternalSrv14TransferHandleER11RHandleBaseS1_S1_S1_ @ 2 NONAME
+	_ZN15RNcmInternalSrv19DhcpProvisionNotifyER14TRequestStatus @ 3 NONAME
+	_ZN15RNcmInternalSrv25DhcpProvisionNotifyCancelEv @ 4 NONAME
+	_ZN15RNcmInternalSrv7ConnectEv @ 5 NONAME
+	_ZN15RNcmInternalSrv8SetIapIdEj @ 6 NONAME
+	_ZN15RNcmInternalSrvC1Ev @ 7 NONAME
+	_ZN15RNcmInternalSrvC2Ev @ 8 NONAME
+	_ZN15RNcmInternalSrvD1Ev @ 9 NONAME
+	_ZN15RNcmInternalSrvD2Ev @ 10 NONAME
+	_ZNK15RNcmInternalSrv7VersionEv @ 11 NONAME
+	_ZN15RNcmInternalSrv18TransferBufferSizeEj @ 12 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/client/group/bld.inf	Tue Aug 31 17:01:47 2010 +0300
@@ -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:
+*
+*/
+
+PRJ_PLATFORMS
+ARMV5
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+ncminternalsrv.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/client/group/ncminternalsrv.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* 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:
+*
+*/
+
+
+
+TARGET      ncminternalsrv.dll
+TARGETTYPE  DLL
+
+UID         0x1000008d  0x2002E6A5
+VENDORID    0x70000001
+
+
+//Being run in usbsvr.exe(usbman)
+CAPABILITY CommDD PowerMgmt TrustedUI ProtServ NetworkControl NetworkServices LocalServices ReadUserData WriteUserData ReadDeviceData WriteDeviceData 
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+USERINCLUDE   ../../../../inc
+USERINCLUDE   ../../server/inc
+
+
+SOURCEPATH    ../src
+SOURCE        ncminternalsrv.cpp
+
+LIBRARY       euser.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/group/bld.inf	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,29 @@
+/*
+* 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:
+*
+*/
+
+
+PRJ_PLATFORMS
+ARMV5
+
+#include "../pktdrv/group/bld.inf"
+#include "../client/group/bld.inf"
+
+PRJ_MMPFILES
+
+
+PRJ_TESTMMPFILES
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/eabi/ncmpktu.def	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	NewNcmPktDrvFactoryL @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/group/bld.inf	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* 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:
+*
+*/
+
+PRJ_PLATFORMS
+ARMV5
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+pktdrv.mmp
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/group/pktdrv.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* 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:
+*
+*/
+
+TARGET      ncmpkt.drv
+TARGETTYPE  DLL
+
+UID         0x1000053f 0x2002C306
+VENDORID    0x70000001
+
+
+// Being run in C32EXE
+CAPABILITY CommDD PowerMgmt TrustedUI ProtServ NetworkControl NetworkServices LocalServices ReadUserData WriteUserData ReadDeviceData WriteDeviceData 
+
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+
+USERINCLUDE   ../inc
+USERINCLUDE   ../../server/inc
+USERINCLUDE   ../../../../inc/
+USERINCLUDE   ../traces
+
+
+SOURCEPATH    ../src
+SOURCE        ncmpktdrvfactory.cpp
+SOURCE        ncmpktdrv.cpp
+SOURCE        ncmengine.cpp 
+SOURCE        ncmcommunicationinterface.cpp
+SOURCE        ncmcomminterfacesenderandreceiver.cpp
+SOURCE        ncmnotificationdescriptor.cpp
+SOURCE        ncmdatainterface.cpp
+SOURCE        ncmdatareceiver.cpp
+SOURCE        ncmdatasender.cpp 
+SOURCE        ncmntbparser.cpp
+SOURCE        ncmntbbuilder.cpp
+SOURCE        ncmntb16builder.cpp
+SOURCE        ncmbuffermanager.cpp
+SOURCE        ncmntbbuildpolicy.cpp
+SOURCE        ncmntbbuildsimplepolicy.cpp
+SOURCE        ncmsharedstatemanager.cpp
+SOURCE        ncmcoexistbearerwatcher.cpp 
+
+#include      "../../server/group/server.mmh"
+
+LIBRARY       euser.lib mbufmgr.lib esock.lib ethint.lib usbcsc_bil.lib
+LIBRARY       efsrv.lib random.lib
+LIBRARY       nodemessages.lib
+LIBRARY       netmeta.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/group/pktdrv_overdummyusbldd.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,62 @@
+/*
+* 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:
+*
+*/
+
+
+
+TARGET ncmpkt.drv
+TARGETTYPE DLL
+
+UID 0x1000053f 0x2002C306
+VENDORID 0x70000001
+#include	<comms-infras/commsdebugutility.mmh>
+
+// Being run in C32EXE
+CAPABILITY CommDD PowerMgmt TrustedUI ProtServ NetworkControl NetworkServices LocalServices ReadUserData WriteUserData ReadDeviceData WriteDeviceData 
+			
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+USERINCLUDE ../inc
+USERINCLUDE   ../../server/inc
+USERINCLUDE   ../../../../inc/
+USERINCLUDE   ../traces
+
+MACRO __OVER_DUMMYUSBSCLDD__
+
+SOURCEPATH    ../src
+SOURCE        ncmpktdrvfactory.cpp
+SOURCE        ncmpktdrv.cpp
+SOURCE        ncmengine.cpp 
+SOURCE        ncmcommunicationinterface.cpp
+SOURCE        ncmcomminterfacesenderandreceiver.cpp
+SOURCE        ncmnotificationdescriptor.cpp
+SOURCE        ncmdatainterface.cpp
+SOURCE        ncmdatareceiver.cpp
+SOURCE        ncmdatasender.cpp 
+SOURCE        ncmntbparser.cpp
+SOURCE        ncmntbbuilder.cpp
+SOURCE        ncmntb16builder.cpp
+SOURCE        ncmbuffermanager.cpp
+SOURCE        ncmntbbuildpolicy.cpp
+SOURCE        ncmntbbuildsimplepolicy.cpp
+SOURCE        ncmsharedstatemanager.cpp
+SOURCE        ncmcoexistbearerwatcher.cpp 
+
+#include      "../../server/group/server.mmh"
+
+LIBRARY       euser.lib esock.lib
+LIBRARY       efsrv.lib random.lib
+LIBRARY       dummyusbsclddapi.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmbuffermanager.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,104 @@
+// 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 the License "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 NCMBUFFERMANAGER_H
+#define NCMBUFFERMANAGER_H
+
+#include <e32base.h>
+#include "ncmpktdrvcommon.h"
+
+
+
+/**
+Responsible for share chunk buffer managerment
+*/
+
+NONSHARABLE_CLASS(CNcmBufferManager) : public CBase
+
+    {
+public:
+    static CNcmBufferManager* NewL();
+    ~CNcmBufferManager();
+    /**
+    * get a free buffer block
+    *
+    * @param aBuffer to store the buffer block
+    * @return KErrNone        if success
+    *         KErrCongestion  if there is not enough buffer block, should start flow control
+    */
+    TInt GetBuffer(TNcmBuffer& aBuffer);
+    /**
+    * free a buffer block
+    *
+    * @param aBuffer store the buffer block to free
+    */
+    void FreeBuffer(const TNcmBuffer& aBuffer);
+    void InitBufferArea(TAny* aBuf, TInt aLength);
+    /**
+    * get a free buffer block
+    *
+    * @param aSize new ntb size
+    * @return KErrNone        if success
+    *         KErrUnknown  if too big ntb size, can't create enought buffer block
+    */    
+    TInt SetBufferCellSize(TInt aSize);
+    TBool IsCongestion();
+    TInt RequiredBufferCount();	
+    inline void SetAlignSize(TInt aSize);	
+    inline TInt FreeBufferCount();		
+
+private:
+    CNcmBufferManager();
+
+private:
+    /**
+    * array of free buffer blocks 
+    */
+    RArray<TNcmBuffer> iFreeQueue;
+    /**
+    * share chunk LDD buffer area 
+    */
+    TUint8*            iBuf;
+    TInt               iLen;
+    TInt               iCellSize;
+    TInt               iAlignSize;	
+    /**
+    * there is enough buffer blocks or not 
+    */
+    TBool              iIsCongestion;
+    
+    };
+
+inline void CNcmBufferManager::SetAlignSize(TInt aSize)
+    {
+    iAlignSize = aSize;
+    }
+
+inline TInt CNcmBufferManager::FreeBufferCount()
+    {
+    return iFreeQueue.Count();
+    }
+
+
+#endif    //NCMBUFFERMANAGER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmcoexistbearerwatcher.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,80 @@
+/*
+* 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
+@internalComponent
+*/
+
+#ifndef NCMCOEXISTBEARERWATCHER_H
+#define NCMCOEXISTBEARERWATCHER_H
+
+#include <e32base.h>
+#include <e32property.h>
+
+#include "ncmpktdrvcommon.h"
+
+
+/**
+The IPBearerCoexistence P&S key watcher.
+*/
+NONSHARABLE_CLASS(CNcmCoexistBearerWatcher) : public CActive
+    {
+public:
+    static CNcmCoexistBearerWatcher* NewL();
+    ~CNcmCoexistBearerWatcher();
+
+    /**
+    Set the IP Over USB active if none is actived, or wait
+    @param[in]   aStatus, asychronous request status.
+    @return      KErrCompletion, successfully active IP Over USB.
+                 KErrNone, asychronous call, the result will be returned by aStatus later.
+                 other, system-wide error code.
+    */
+    TInt SetIpOverUsbActive(TRequestStatus& aStatus);
+    /** Deactive IP Over USB */
+    TInt SetIpOverUsbDeactive();
+    /** Check whether IP Over USB Bearer is actived or not. */
+    inline TBool IsIpOverUsbActived() const;
+
+private:
+    //From CActive
+    void RunL();
+    void DoCancel();
+
+    CNcmCoexistBearerWatcher();
+    void ConstructL();
+    TInt DoActive();
+
+private:
+    enum TIPBearerCoexistenceStatus
+        {
+        EIPBearerNoneActive  = 0,
+        EIPBearerIPOverUSB   = 1,
+        EIPBearerBTPan       = 2
+        };
+
+private:
+    RProperty                   iProperty;
+    TRequestStatus*             iReportStatus;
+    TIPBearerCoexistenceStatus  iBearerState;
+    };
+
+// Inline functions
+#include "ncmcoexistbearerwatcher.inl"
+
+#endif /* NCMCOEXISTBEARERWATCHER_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmcoexistbearerwatcher.inl	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,31 @@
+/*
+* 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
+@internalComponent
+*/
+
+#ifndef NCMCOEXISTBEARERWATCHER_INL
+#define NCMCOEXISTBEARERWATCHER_INL
+
+inline TBool CNcmCoexistBearerWatcher::IsIpOverUsbActived() const
+    {
+    return EIPBearerIPOverUSB==iBearerState;
+    }
+
+#endif //NCMCOEXISTBEARERWATCHER_INL
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmcomminterfacesenderandreceiver.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,112 @@
+/*
+* 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:
+* header file of class for read and write data from share chunk LDD 
+*
+*/
+
+
+/**
+@file
+@internalComponent
+*/
+
+#ifndef NCMCOMMINTERFACESENDERANDRECEIVER_H
+#define NCMCOMMINTERFACESENDERANDRECEIVER_H
+
+#include <e32base.h>
+
+#ifndef __OVER_DUMMYUSBSCLDD__
+#include <d32usbcsc.h>
+#else
+#include <dummyusbsclddapi.h>
+#endif
+
+
+
+class CNcmCommunicationInterface;
+
+/**
+Responsible for sending and receiving data on Control Endpoint
+*/
+
+NONSHARABLE_CLASS(CNcmCommInterfaceSenderAndReceiver) : public CActive
+    {
+public:
+    static CNcmCommInterfaceSenderAndReceiver* NewL(RDevUsbcScClient& aPort, CNcmCommunicationInterface& aCommInterface);
+    ~CNcmCommInterfaceSenderAndReceiver();
+    void Start();
+    void Stop();
+    /**
+    * read aLength data from LDD
+    *
+    * @param aStatus complete status for this request.
+    * @param aBuf buffer to store data.    
+    * @param aLength length to read.    
+    */
+    TInt Read(TRequestStatus& aStatus, TDes8& aBuf, TInt aLength);
+    /**
+    * write aLength data to LDD
+    *
+    * @param aStatus complete status for this request.
+    * @param aBuf buffer of data.    
+    * @param aLength length to write.    
+    */
+    TInt Write(TRequestStatus& aStatus, TDesC8& aBuf, TInt aLength);
+    
+private:
+    enum TNcmControlEndpointState
+        {
+        EUnInit = 1,
+        EIdle,
+        EReceiving,
+        ESending        
+        };
+    
+    CNcmCommInterfaceSenderAndReceiver(RDevUsbcScClient& aPort, CNcmCommunicationInterface& aCommInterface);
+    void ReadData();
+
+private:
+    /**
+    *  derived from CActive
+    */
+    void RunL();
+    void DoCancel();
+    
+private:
+    RDevUsbcScClient&               iPort;
+    /**
+    *  LDD control endpoint buffer
+    */
+    TEndpointBuffer                 iEp0Buffer;
+    CNcmCommunicationInterface&     iCommInterface;
+    /**
+    *  point to buffer to store data of Read function, this is not ownership
+    */
+    TDes8*                          iReceiveBuf;
+    /**
+    *  length of data left to be read from LDD for a Read request
+    */
+    TInt                            iToReceiveLength;
+    /**
+    *  complete status for Read and Write function, this is not ownership
+    */
+    TRequestStatus*                 iCompleteStatus;
+    TNcmControlEndpointState        iState;
+
+    };
+
+
+#endif //NCMCOMMINTERFACESENDERANDRECEIVER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmcommunicationinterface.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,153 @@
+/*
+* 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:
+* header file for NCM communication interface class 
+*
+*/
+
+/**
+@file
+@internalComponent
+*/
+
+#ifndef NCMCOMMUNICATIONINTERFACE_H
+#define NCMCOMMUNICATIONINTERFACE_H
+
+#include <e32base.h>
+
+#ifndef __OVER_DUMMYUSBSCLDD__
+#include <d32usbcsc.h>
+#else //!__OVER_DUMMYUSBSCLDD__
+#include <dummyusbsclddapi.h>
+#endif// __OVER_DUMMYUSBSCLDD__
+
+#include "ncmcomminterfacesenderandreceiver.h"
+#include "ncmpktdrvcommon.h"
+
+const TUint KSetupPacketLength = 8;
+const TUint KNtbParamStructLength = 28;
+const TUint KNtbInputSizeStructLength = 4;
+
+_LIT(KNcmCommInterface, "NcmCommunicationInterface");
+
+enum TNcmCommErrorCode
+    {
+    EInternalError,
+    EInvalidSetupPacketLength,
+    EInvalidOutSetupPacket,
+    EInvalidInSetupPacket,
+    EInvalidLengthToRead,
+    EInvalidDataPacketLength,
+    EInvalidFilterOffset
+    };
+
+/**
+* The interface to Ncm engine
+*/
+
+NONSHARABLE_CLASS(MNcmControlObserver)
+{
+public:
+    virtual TInt HandleSetNtbInputSize(TDes8& aBuf) = 0;
+    virtual TInt HandleGetNtbParam(TDes8& aBuf) = 0;
+    virtual TInt HandleGetNtbInputSize(TDes8& aBuf) = 0;
+    virtual void ControlError(TInt aError) = 0;
+};
+
+/**
+*  implement NCM control interface
+*/
+
+NONSHARABLE_CLASS(CNcmCommunicationInterface) : public CActive
+    {
+public:
+    static CNcmCommunicationInterface* NewL(MNcmControlObserver& aEngine, RDevUsbcScClient& aLdd);
+    ~CNcmCommunicationInterface();
+    TInt Start();
+    void Stop();
+    void ControlMsgError(TNcmCommErrorCode aCode);
+    TInt SendConnectionNotification(TBool aConnected);
+    TInt SendSpeedNotification(TInt aUSBitRate, TInt aDSBitRate);
+
+public:
+    inline RDevUsbcScClient& Ldd();
+    inline TBool IsStarted();
+    
+private:
+    enum TNcmCommRWState
+        {
+        EStateInitial = 0,
+        EStateReadSetup, 
+        EStateReadDataout, 
+        EStateWriteDatain
+        };
+
+    enum TUsbRequestType
+        {
+        EGetNtbParameters = 0x80,
+        EGetNtbInputSize  = 0x85,
+        ESetNtbInputSize  = 0x86
+        };
+
+private:
+    CNcmCommunicationInterface(MNcmControlObserver& aEngine, RDevUsbcScClient& aLdd);
+    void ConstructL();
+    void RunL();
+    void DoCancel();
+    void ReadSetup();
+    void DecodeSetup();
+    void ReadDataOut();
+    void WriteDataIn();
+    void ParseDataOut();
+    TInt WriteInterruptData(TInt aEndPoint, TDesC8& aDes, TInt aLength);
+    TInt GetInterfaceNumber();
+    
+
+private:
+    
+    MNcmControlObserver&                   iEngine;
+    /**
+    * USB request type
+    */        
+    TUint8                                 iRequestType;
+    /**
+    * data stage data length
+    */    
+    TUint16                                iDataStageLength;
+    /**
+    * usb setup packet
+    */    
+    TBuf8<KSetupPacketLength>              iSetupPacket;
+    /**
+    * control transfer data
+    */    
+    TBuf8<KNtbParamStructLength>           iDataBuffer;
+    TNcmCommRWState                        iRWState;
+    TBool                                  iStarted;
+    RDevUsbcScClient&                      iPort;
+    /**
+    * instance to CNcmCommInterfaceSenderAndReceiver
+    */    
+    CNcmCommInterfaceSenderAndReceiver*    iSenderAndReceiver;
+    /**
+    * communication interface number
+    */    
+    TUint8 iInterfaceNumber;
+
+    };
+
+// Inline functions
+#include "ncmcommunicationinterface.inl"
+
+#endif //NCMCOMMUNICATIONINTERFACE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmcommunicationinterface.inl	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,38 @@
+/*
+* 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:
+* NCM communication interface class inl file 
+*
+*/
+
+/**
+@file
+@internalComponent
+*/
+
+#ifndef NCMCOMMUNICATIONINTERFACE_INL
+#define NCMCOMMUNICATIONINTERFACE_INL
+
+inline RDevUsbcScClient& CNcmCommunicationInterface::Ldd()
+    {
+    return iPort;
+    }
+
+inline TBool CNcmCommunicationInterface::IsStarted()
+    {
+    return iStarted;
+    }
+
+
+#endif //NCMCOMMUNICATIONINTERFACE_INL
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmdatainterface.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,115 @@
+/*
+* 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
+@internalComponent
+*/
+
+#ifndef NCMDATAINTERFACE_H
+#define NCMDATAINTERFACE_H
+
+#include <e32base.h>
+#ifndef __OVER_DUMMYUSBSCLDD__
+#include <nifmbuf.h>
+#include <networking/ethinter.h>
+#include <d32usbcsc.h>
+#else
+#include <dummyusbsclddapi.h>
+#include <usb/testncm/ethinter.h>
+#endif
+
+#include "ncmpktdrvcommon.h"
+
+class    CNcmDataSender;
+class    CNcmDataReceiver;
+
+/**
+The interface to NCM data channel.
+*/
+NONSHARABLE_CLASS(MNcmDataObserver)
+{
+public:
+    /**
+    Process received datagram parsed from NCM.
+    @param[in]   aPacket, contains the datagram(ethernet frame) to be dealed with.
+    */
+    virtual void ProcessReceivedDatagram(RMBufPacket& aPacket) = 0;
+    /**
+    Notify the upper layer(TCP/IP stack) to continue to send data.
+    */
+    virtual void ResumeSending() = 0;
+    /**
+    Notify unrecoverable error in data channel.
+    */
+    virtual void DataError(TInt aError) = 0;
+    /**
+    Notify the Data Interface's alt-setting changes, which commonly from 0 to 1, or vice versa.
+    @param[in]   aIfAltSet, the alt-setting number.
+    */
+    virtual void HandleAltSetting(TInt aIfAltSet) = 0;
+};
+
+/**
+Maintain the logic of Ncm data channel
+*/
+NONSHARABLE_CLASS(CNcmDataInterface) : public CActive
+    {
+public:
+    static CNcmDataInterface* NewL(MNcmDataObserver& aEngine, RDevUsbcScClient& aLdd);
+    ~CNcmDataInterface();
+
+    inline TBool IsStarted() const;
+    void Start();
+    void Stop();
+    TInt Send(RMBufChain& aPacket);
+
+    TInt GetSpeed(TInt& aSpeed);
+    TInt GetNtbInputSize(TDes8& aSize);
+    TInt SetNtbInputSize(TDesC8& aSize);
+    TInt GetNtbParam(TDes8& aParam);
+    TInt SetInEpBufferSize(TUint aSize);
+
+    void ActivateLdd();
+    inline void DataError(TInt aErroCode) const;
+    inline void ResumeSending() const;
+    inline void ProcessDatagram(RMBufPacket& aPacket) const;
+    inline TInt AltSetting() const;
+
+private:
+    CNcmDataInterface(MNcmDataObserver& aEngine, RDevUsbcScClient& aLdd);
+    void ConstructL();
+
+    //From CActive
+    void RunL();
+    void DoCancel();
+
+private:
+    TBool               iStarted;
+    CNcmDataSender*     iSender;
+    CNcmDataReceiver*   iReceiver;
+    MNcmDataObserver&   iEngine;
+
+    RDevUsbcScClient&   iLdd;
+    TInt                iAltSetting;
+    TUint               iIfState;
+    };
+
+// inline functions
+#include "ncmdatainterface.inl"
+
+#endif // NCMDATAINTERFACE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmdatainterface.inl	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,67 @@
+/*
+* 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
+@internalComponent
+*/
+
+#ifndef NCMDATAINTERFACE_INL
+#define NCMDATAINTERFACE_INL
+
+/**
+ * Indicate whether DataInterface is started or not, called by Engine.
+ */
+inline TBool CNcmDataInterface::IsStarted() const
+    {
+    return iStarted;
+    }
+
+/**
+ * Return current alternate setting.
+ */
+inline TInt CNcmDataInterface::AltSetting() const
+    {
+    return iAltSetting;
+    }
+
+/**
+ * Notify the Engine that unrecoverable data error, like no memory, etc.
+ */
+inline void CNcmDataInterface::DataError(TInt aError) const
+    {
+    iEngine.DataError(aError);
+    }
+
+/**
+ * Resume sending, used when KStopSending returned by last send.
+ */
+inline void CNcmDataInterface::ResumeSending() const
+    {
+    iEngine.ResumeSending();
+    }
+
+/**
+ * Process(upwards simply) received NCM Datagram (ethernet frame).
+ */
+void CNcmDataInterface::ProcessDatagram(RMBufPacket& aPacket) const
+    {
+    iEngine.ProcessReceivedDatagram(aPacket);
+    }
+
+
+#endif //NCMDATAINTERFACE_INL
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmdatareceiver.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,80 @@
+/*
+* 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
+@internalComponent
+*/
+#ifndef NCMDATARECEIVER_H
+#define NCMDATARECEIVER_H
+
+#include <e32base.h>
+
+#ifndef __OVER_DUMMYUSBSCLDD__
+#include <d32usbcsc.h>
+#else
+#include <dummyusbsclddapi.h>
+#endif
+
+#include "ncmpktdrvcommon.h"
+#include "ncmntbparser.h"
+
+
+class CNcmDataInterface;
+
+/**
+Responsible for receiving NCM packet data
+*/
+NONSHARABLE_CLASS(CNcmDataReceiver) : public CActive, public MNcmNdpFrameObserver
+    {
+public:
+    static CNcmDataReceiver* NewL(RDevUsbcScClient& aPort, CNcmDataInterface& aParent);
+    ~CNcmDataReceiver();
+
+    void Start();
+    void Stop();
+
+    //from MNcmNdpFrameObserver
+    void ProcessEtherFrame(RMBufPacket&);
+    void ExpireBuffer(TAny*);
+
+    inline TUint NtbOutMaxSize() const;
+private:
+    void ConstructL();
+    CNcmDataReceiver(RDevUsbcScClient& aPort, CNcmDataInterface& aParent);
+
+    //From CActive
+    void RunL();
+    void DoCancel();
+
+    void ReadData();
+
+private:
+    RDevUsbcScClient&       iPort;
+    TEndpointBuffer         iEpIn;
+    TUint8*                 iBuf;
+    TUint                   iBufLen;
+    TBool                   iZlp;
+    CNcmNtbParser*          iNtbParser;
+    CNcmDataInterface&      iParent;
+    };
+
+// inline functions
+#include "ncmdatareceiver.inl"
+
+#endif //NCMDATARECEIVER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmdatareceiver.inl	Tue Aug 31 17:01:47 2010 +0300
@@ -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:
+*
+*/
+
+/**
+@file
+@internalComponent
+*/
+#ifndef NCMDATARECEIVER_INL
+#define NCMDATARECEIVER_INL
+
+inline TUint CNcmDataReceiver::NtbOutMaxSize() const
+    {
+    return iNtbParser ? iNtbParser->NtbOutMaxSize() : 0xFFFF;
+    }
+
+#endif //NCMDATARECEIVER_INL
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmdatasender.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,143 @@
+/*
+* 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
+@internalComponent
+*/
+
+
+#ifndef NCMDATASENDER_H
+#define NCMDATASENDER_H
+
+#include <e32base.h>
+
+#ifndef __OVER_DUMMYUSBSCLDD__
+#include <d32usbcsc.h>
+#else
+#include <dummyusbsclddapi.h>
+#include <usb/testncm/ethinter.h>
+#endif
+
+#include "ncmntbbuilder.h"
+#include "ncmpktdrvcommon.h"
+
+
+class CNcmDataInterface;
+class RDevUsbcScClient;
+class CNcmBufferManager;
+class CNcmNtbBuildPolicy;
+
+
+NONSHARABLE_CLASS(MNcmNtbBuildObserver)
+    {
+public:    
+    /**
+    * send a NTB out, this is interface with CNtbBuilder
+    *
+    * @param aBuffer contain a whole NTB.
+    */
+    virtual void SendNtbPayload(TNcmBuffer& aBuffer) = 0;
+    };
+
+
+
+/**
+Responsible for sending Ncm packet data
+*/
+
+NONSHARABLE_CLASS(CNcmDataSender) : public CActive, 
+                                    public MNcmNtbBuildObserver
+
+    {
+public:
+    static CNcmDataSender* NewL(RDevUsbcScClient& aPort, CNcmDataInterface& aParent);
+    ~CNcmDataSender();
+
+public:
+    /** derived from MNcmNtbBuildObserver */
+    void SendNtbPayload(TNcmBuffer& aBuffer);
+
+public:    
+    /**
+     * change NtbInMax size
+     *
+     * @param aSize, new NtbInMax size
+     * @param aIsAltZero, is alternate setting 0
+     * @return KErrNone           if success, 
+     *         KErrArgument       if the aSize is bigger than 65535, 
+     *           KErrUnknown        if aSize is too bigger and can't create enough buffer block
+     */
+    TInt SetNtbInMaxSize(TInt aSize, TBool aIsAltZero=ETrue);
+    void RunL();
+    void Start();
+    /**
+     * send a ethernet frame
+     *
+     * @param aPacket, the ethernet frame
+     * @return KErrNone            if success, 
+     *         KErrNotReady        if sender is not started.
+     *         KErrCongestion      if there is less buffers, need to start flow control.  
+     */    
+    TInt Send(RMBufChain& aPacket);
+    void GetNtbParam(TNcmNtbInParam& aParam);
+    void Stop();
+    TInt SetInEpBufferSize(TUint aSize);		
+    inline TInt NtbInMaxSize(); 
+  
+private:
+    CNcmDataSender(RDevUsbcScClient& aPort, CNcmDataInterface& aParent);
+    void ConstructL();
+    void SendNtbComplete();
+    TInt StartNewNtb();
+    void DoCancel();
+        
+private:
+    RDevUsbcScClient&           iPort;
+    CNcmDataInterface&          iParent;
+    /**
+    * LDD Endpoint buffer for in NCM in endpoint
+    */    
+    TEndpointBuffer             iEpOut;
+    /**
+    * store the buffers to be sent to LDD
+    */    
+    RArray<TNcmBuffer>          iTxArray;
+    /**
+    * store the buffer is on sending
+    */
+    TNcmBuffer                  iSendingBuffer;
+    /**
+    * there is a buffer currenly on sending
+    */
+    TBool                       iIsSending;
+    TBool                       iStarted;
+    CNcmNtbBuilder*             iNtbBuilder;
+    CNcmBufferManager*          iBufferManager;
+    CNcmNtbBuildPolicy*         iBuildPolicy;
+    /**
+    * networking may send packet when data sender is not started, use this to determin if do send resuming when start
+    */
+    TBool                       iStopSending;
+    
+    };
+
+// Inline functions
+#include "ncmdatasender.inl"
+
+#endif //NCMDATASENDER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmdatasender.inl	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,38 @@
+// 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 the License "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 NCMDATASENDER_INL
+#define NCMDATASENDER_INL
+
+
+
+inline TInt CNcmDataSender::NtbInMaxSize()
+    {
+    return iNtbBuilder->NtbInMaxSize();
+    }
+
+
+#endif
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmengine.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,133 @@
+/*
+* 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
+@internalComponent
+*/
+#ifndef NCMENGINE_H
+#define NCMENGINE_H
+
+
+#ifndef __OVER_DUMMYUSBSCLDD__
+#include <es_mbuf.h>
+#else
+#include <usb/testncm/ethinter.h>
+#endif
+
+#include <random.h>
+
+#include "ncmpktdrvcommon.h"
+#include "ncmcommunicationinterface.h"
+#include "ncmdatainterface.h"
+#include "ncmsharedstatemanager.h"
+
+class CNcmPktDrv;
+
+/**
+NCM Engine: coordinate with Data Interface, Comm Interface and Shared State Manager.
+*/
+NONSHARABLE_CLASS(CNcmEngine) : public CActive,
+                                public MNcmDataObserver,
+                                public MNcmControlObserver,
+                                public MShareStateObserver
+    {
+public:
+    static CNcmEngine* NewL(CNcmPktDrv& aPktDrv);
+    ~CNcmEngine();
+
+    //Start the engine, called by TransferHandle after PktDrvBase's StartInterface;
+    TInt Start(RMessagePtr2& aMsg);
+    //Stop the engine, called by PktDrvBase's StopInterface;
+    void Stop();
+
+    //Send a Packet to USB Host.
+    TInt Send(RMBufChain &aPacket);
+    //Get the Interface Mac Address;
+    TUint8* InterfaceAddress();
+
+    //From MNcmControlObserver
+    TInt HandleSetNtbInputSize(TDes8&);
+    TInt HandleGetNtbParam(TDes8&);
+    TInt HandleGetNtbInputSize(TDes8&);
+    void ControlError(TInt aError);
+
+    //From MNcmDataObserver
+    void ProcessReceivedDatagram(RMBufPacket&);
+    void ResumeSending();
+    void DataError(TInt aError);
+    void HandleAltSetting(TInt aIfNum);
+    TInt SetInEpBufferSize(TUint aSize);
+
+    //From MShareStateObserver
+    void NotifyDhcpStarted();
+
+    inline TInt SetStateToWatcher(TInt aType, TInt aValue) const;
+    inline TInt RegisterNotify(const RMessage2& aMsg) const;
+    inline TInt DeRegisterNotify() const;
+
+#ifdef __OVER_DUMMYUSBSCLDD__
+public:
+    TInt State() const {return iEngineState;}
+#endif
+
+private:
+    //From CActive
+    void RunL();
+    void DoCancel();
+
+    CNcmEngine();
+    CNcmEngine(CNcmPktDrv& aPktDrv);
+    void ConstructL();
+
+    void InitLddL(const RMessagePtr2& aMsg);
+    void RandomMacAddressL(TNcmMacAddress& aMacAddress);
+    void DoNcmStarted();
+    void StartDataLayer();
+    void StopDataLayer();
+
+private:
+    enum TNcmEngineState
+        {
+        ENcmStateUninitialized = 0,
+        ENcmStateStarting,
+        ENcmStateStarted,
+        ENcmStatePaused,
+        ENcmStateStopped,
+        ENcmStateMax
+        };
+
+private:
+    CNcmPktDrv&             iPktDrv;
+
+    CNcmDataInterface*      iDataInterface;
+    CNcmCommunicationInterface* iCommInterface;
+    CNcmSharedStateManager* iSharedStateManager;
+
+    TNcmEngineState         iEngineState;
+    TUint                   iDeviceState;
+
+    TNcmMacAddress          iSymbianMacAddress;
+
+    RDevUsbcScClient        iDataLdd;
+    RDevUsbcScClient        iCommLdd;
+    };
+
+//inline functions
+#include "ncmengine.inl"
+
+#endif // NCMENGINE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmengine.inl	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* 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
+@internalComponent
+*/
+#ifndef NCMENGINE_INL
+#define NCMENGINE_INL
+
+//Assumption: NcmEngine & NcmServer are existed simultaneously!!
+#ifdef _DEBUG
+_LIT(KEnginePanic, "CNcmEnginePanic");
+#endif
+/**
+ * Set IapId and Dhcp Provision Result to SharedState manager.
+ */
+inline TInt CNcmEngine::SetStateToWatcher(TInt aType, TInt aValue) const
+    {
+    __ASSERT_DEBUG(iSharedStateManager, User::Panic(KEnginePanic, __LINE__));
+    return iSharedStateManager->SetStateValue(aType, aValue);
+    }
+
+/**
+ * Register the callback of Class Controller to do Dhcp Provision.
+ */
+inline TInt CNcmEngine::RegisterNotify(const RMessage2& aMsg) const
+    {
+    __ASSERT_DEBUG(iSharedStateManager, User::Panic(KEnginePanic, __LINE__));
+    return iSharedStateManager->RegisterNotify(aMsg);
+    }
+
+/*
+ * Deregister the callback.
+ */
+inline TInt CNcmEngine::DeRegisterNotify() const
+    {
+    __ASSERT_DEBUG(iSharedStateManager, User::Panic(KEnginePanic, __LINE__));
+    return iSharedStateManager->DeRegisterNotify();
+    }
+
+
+#endif //NCMENGINE_INL
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmnotificationdescriptor.h	Tue Aug 31 17:01:47 2010 +0300
@@ -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:
+* header file for NCM notification message class 
+*
+*/
+
+
+
+#ifndef NCMNOTIFICATIONDESCRIPTOR_H
+#define NCMNOTIFICATIONDESCRIPTOR_H
+
+#include <e32std.h>
+
+
+const TUint KUSBNotificationNetworkConnection = 8;
+
+/**
+ * USB NetworkConnection Notification
+ */
+ 
+NONSHARABLE_CLASS(TUSBNotificationNetworkConnection)
+    {
+public:
+    TUint8    iRequestType;   ///< Request type
+    TUint8    iNotification;  ///< Notification number
+    TUint16   iValue;         ///< Notification value
+    TUint16   iIndex;         ///< Notification index
+    TUint16   iLength;        ///< Notification length
+public:
+    TDes8&    Des();
+
+private:
+    TBuf8<KUSBNotificationNetworkConnection> iBuffer;
+    };
+
+const TUint KUSBNotificationConnectionSpeedChange = 16;
+
+/**
+ * USB ConnectionSpeedChange Notification
+ */
+
+NONSHARABLE_CLASS(TUSBNotificationConnectionSpeedChange)
+    {
+public:
+    TUint8    iRequestType;   ///< Request type
+    TUint8    iNotification;  ///< Notification number
+    TUint16   iValue;         ///< Notification value
+    TUint16   iIndex;         ///< Notification index
+    TUint16   iLength;        ///< Notification length
+    TUint32   iUSBitRate;     ///< upstream bit rate, in bits per second 
+    TUint32   iDSBitRate;     ///< downstream bit rate, in bits per second
+public:
+    TDes8&    Des();
+
+private:
+    TBuf8<KUSBNotificationConnectionSpeedChange> iBuffer;
+    };
+
+#endif // NCMNOTIFICATIONDESCRIPTOR_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmntb16builder.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,92 @@
+/*
+* 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:
+* header file for NTB16 build  class
+*
+*/
+
+
+/**
+@file
+@internalComponent
+*/
+
+
+#ifndef NCMNTB16BUILDER_H
+#define NCMNTB16BUILDER_H
+
+#include <e32base.h>
+#include "ncmntbbuilder.h"
+#include "ncmpktdrvcommon.h"
+
+
+class MNcmNtbBuildObserver;
+
+
+NONSHARABLE_CLASS(TDatagramEntry)
+    {
+public:
+    TUint16 iWDatagramIndex;
+    TUint16 iWDatagramLength;    
+    };
+    
+/**
+Responsible for build NTB16 payload
+*/
+
+NONSHARABLE_CLASS(CNcmNtb16Builder) : public CNcmNtbBuilder
+    {
+public:
+    static CNcmNtbBuilder* NewL(MNcmNtbBuildObserver&);
+    ~CNcmNtb16Builder();
+
+public:
+/**
+*derived from CNcmNtbBuilder
+*/
+    void StartNewNtb(const TNcmBuffer& aBuffer);
+    TInt AppendPacket(const RMBufChain& aPacket);
+    TInt SetNtbInMaxSize(TInt aSize);
+    void CompleteNtbBuild();
+    void Reset();
+    
+private:
+    CNcmNtb16Builder(MNcmNtbBuildObserver&);
+    void ConstructL();
+    void BuildNtbHeader();
+    void BuildNdp();
+        
+
+private:
+    /**
+    * offset of NDP in buffer
+    */
+    TUint16    iNdpOffset;
+    /**
+    * length of NDP
+    */
+    TUint16    iNdpLength;
+    /**
+    * offset of next datagram can be in.
+    */
+    TUint16    iDatagramOffset;
+    /**
+    * array of datagrams index and length in NTB.
+    */    
+    RArray<TDatagramEntry>    iPacketsArray;
+    };
+
+
+#endif //NCMNTB16BUILDER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmntbbuilder.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,129 @@
+/*
+* 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:
+* header file for NTB build  base class
+*
+*/
+
+
+
+/**
+@file
+@internalComponent
+*/
+
+
+#ifndef NCMNTBBUILDER_H
+#define NCMNTBBUILDER_H
+
+#include <e32base.h>
+
+#include "ncmpktdrvcommon.h"
+
+
+class MNcmNtbBuildObserver;
+class RMBufChain;
+class CNcmNtbBuildPolicy;
+class TNcmNtbInParam;
+
+
+const TInt KErrBufferFull = -6667;
+
+
+/**
+Base class for build NTB
+*/
+
+NONSHARABLE_CLASS(CNcmNtbBuilder) : public CBase
+    {
+public:
+    /**
+    * append a ethernet frame to current NTB
+    *
+    * @param aPacket ethernet packet buffer
+    * @return KErrNone        if success
+    *         KErrBufferFull  if current NTB is full and can't insert the new packet to NTB and send the current NTB immediately
+    */
+    virtual TInt AppendPacket(const RMBufChain& aPacket) = 0;  
+    /**
+    * complete the current NTB
+    *
+    */
+    virtual void CompleteNtbBuild();
+    /**
+    * change the NtbInMaxSize
+    *
+    * @param aSize new size
+    * @return  KErrNone        if success   
+    *          KErrArgument    if the size is bigger than allowed size in NCM spec.
+    */
+    virtual TInt SetNtbInMaxSize(TInt aSize) = 0;
+    /**
+    * prepare build a new NTB
+    *
+    * @param aBuffer buffer to construct NTB
+    */
+    virtual void StartNewNtb(const TNcmBuffer& aBuffer);
+    /**
+    * reset builder to intial state.
+    */
+    virtual void Reset();
+
+public:
+    ~CNcmNtbBuilder();
+    void GetNtbParam(TNcmNtbInParam& aParam);
+    inline void SetBuildPolicy(CNcmNtbBuildPolicy& aPolicy);
+    /**
+    * @return  ETrue        if has called StartNewNtb for current NTB   
+    *          EFalse       otherwise
+    */
+    inline TBool IsNtbStarted();
+    inline TInt NtbInMaxSize();
+    inline TInt MinNtbInMaxSize();	
+
+protected:
+    CNcmNtbBuilder(MNcmNtbBuildObserver&);
+    void SendNtbPayload();
+
+protected:
+    /**
+    * refer to NCM spec for following five variable meaning.
+    */    
+    TInt                     iNtbInMaxSize;
+    TInt                     iNdpInDivisor;
+    TInt                     iNdpInPayloadRemainder;
+    TInt                     iNdpInAlignment;    
+    TUint16                  iSequence;
+
+    MNcmNtbBuildObserver&    iObserver;
+    /**
+    * buffer contains NTB
+    */    
+    TNcmBuffer               iBuffer;
+    /**
+    * point to builder policy, this is not ownership
+    */     
+    CNcmNtbBuildPolicy*      iBuildPolicy;
+    /**
+    * a NTB is started or not.
+    */    
+    TBool                    iNtbStarted;
+    };
+
+
+// Inline functions
+#include "ncmntbbuilder.inl"
+
+
+#endif /* NCMNTBBUILDER_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmntbbuilder.inl	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* 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:
+* NTB build base class inl file
+*
+*/
+
+
+/**
+@file
+@internalComponent
+*/
+
+
+#ifndef NCMNTBBUILDER_INL
+#define NCMNTBBUILDER_INL
+
+const TInt KMinNtbInMaxSize = 2048;
+
+inline TInt CNcmNtbBuilder::NtbInMaxSize()
+    {
+    return iNtbInMaxSize;
+    }
+
+inline void CNcmNtbBuilder::SetBuildPolicy(CNcmNtbBuildPolicy& aPolicy)
+    {
+    iBuildPolicy = &aPolicy;
+    }
+
+inline TBool CNcmNtbBuilder::IsNtbStarted()
+    {
+    return iNtbStarted;
+    }
+
+inline TInt CNcmNtbBuilder::MinNtbInMaxSize()
+    {
+    return KMinNtbInMaxSize;
+    }
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmntbbuildpolicy.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,71 @@
+/*
+* 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:
+* Header file NTB build policy base class
+*
+*/
+
+
+/**
+@file
+@internalComponent
+*/
+
+#ifndef NCMNTBBUILDPOLICY_H
+#define NCMNTBBUILDPOLICY_H
+
+
+#include <e32base.h>
+#include "ncmpktdrvcommon.h"
+
+class CNcmNtbBuilder;
+
+/**
+base class for ntb build policy
+*/
+
+NONSHARABLE_CLASS(CNcmNtbBuildPolicy) : public CActive
+    {
+public:
+    /**
+    *    call by builder when begin a new NTB
+    */
+    virtual void StartNewNtb() = 0;
+    /**
+    *     call by builder when a ethernet frame is added to NTB
+    */    
+    virtual void UpdateNtb(TInt aSize) = 0;
+    /**
+    *   call by builder when complete a NTB    
+    */
+    virtual void CompleteNtbBuild() = 0;
+	virtual void UpdateBufferSize(TInt aSize) = 0;
+    virtual void UpdateFreeBufferCount(TInt aCount) = 0;
+	virtual void UpdateTotalBufferCount(TInt aCount) = 0;
+    ~CNcmNtbBuildPolicy();
+    inline CNcmNtbBuilder& NtbBuilder();
+    
+protected:
+    CNcmNtbBuildPolicy(CNcmNtbBuilder&);
+    CNcmNtbBuilder&    iNtbBuilder;
+};
+
+
+inline CNcmNtbBuilder& CNcmNtbBuildPolicy::NtbBuilder()
+    {
+    return iNtbBuilder;
+    }
+
+
+#endif //NCMNTBBUILDPOLICY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmntbbuildsimplepolicy.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,77 @@
+/*
+* 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:
+* Header file for simple NTB build policy
+*
+*/
+
+
+/**
+@file
+@internalComponent
+*/
+
+
+#ifndef NCMNTBBUILDSIMPLEPOLICY_H
+#define NCMNTBBUILDSIMPLEPOLICY_H
+
+
+#include <e32base.h>
+#include "ncmntbbuildpolicy.h"
+
+
+/**
+* a simple build policy, fix packets count in a NTB and a timer to restrict maxiam time delay
+*/
+
+NONSHARABLE_CLASS(CNcmNtbBuildSimplePolicy) : public CNcmNtbBuildPolicy
+    {
+public:
+    static CNcmNtbBuildPolicy* NewL(CNcmNtbBuilder& aPolicy);
+    ~CNcmNtbBuildSimplePolicy();
+
+public:
+    /**
+    derived from CNcmNtbBuildPolicy
+    */
+    virtual void StartNewNtb();
+    virtual void UpdateNtb(TInt aSize);
+    virtual void CompleteNtbBuild();
+	
+	virtual void UpdateBufferSize(TInt aSize);
+    virtual void UpdateFreeBufferCount(TInt aCount);
+	virtual void UpdateTotalBufferCount(TInt aCount);
+
+private:    
+    void RunL();
+    void DoCancel();
+    void ConstructL();
+    CNcmNtbBuildSimplePolicy(CNcmNtbBuilder& aPolicy);
+    /**
+    * timer for maxiam packet time delay
+    */        
+    RTimer iTimer;
+    /**
+    * packets number in current NTB
+    */    
+    TInt iPacketsCount;
+	TInt iTotalBufferCount;
+	TInt iFreeBufferCount;
+	TInt iBufferSize;
+    
+};
+
+
+#endif //NCMNTBBUILDSIMPLEPOLICY_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmntbparser.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,210 @@
+/*
+* 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
+@internalComponent
+*/
+#ifndef NCMNTBPARSER_H
+#define NCMNTBPARSER_H
+
+#include <e32base.h>
+
+//DEBUG MACRO to dump the parsed NDP info.
+//#define DEBUG_DUMP_NTBINNER
+#ifdef DEBUG_DUMP_NTBINNER
+#include <e32debug.h>
+#endif
+
+#ifndef __OVER_DUMMYUSBSCLDD__
+#include <nifmbuf.h>
+#else
+#include <usb/testncm/pktdrv.h>
+#endif
+
+#include "ncmpktdrvcommon.h"
+
+/**
+ * interface for parsed NDP(ethernet frame).
+ */
+NONSHARABLE_CLASS(MNcmNdpFrameObserver)
+    {
+public:
+    virtual void ProcessEtherFrame(RMBufPacket&) = 0;
+    virtual void ExpireBuffer(TAny*) = 0;
+    };
+
+#ifdef DEBUG_DUMP_NTBINNER
+class NTHNDPDumper : public MNcmNdpFrameObserver
+    {
+public:
+    inline void ProcessEtherFrame(RMBufPacket& aPacket)
+        {
+        RDebug::Printf("NTHNDPDumper::parsed Ethernet Frame, length=%d", aPacket.Length());
+        aPacket.Free();
+        }
+    inline void ExpireBuffer(TAny* aBuf)
+        {
+        }
+    inline void FatalError(TInt aErrCode)
+        {
+        RDebug::Printf("NTHNDPDumper::Fatal Error=%d", aErrCode);
+        }
+    };
+#endif //DEBUG_DUMP_NTBINNER
+
+/**
+ * NCM NTH for NTB16
+ */
+NONSHARABLE_CLASS(TNcmNth16)
+    {
+public:
+    TUint8    dwSignature[4];
+    TUint16   wHeaderLength;
+    TUint16   wSequence;
+    TUint16   wBlockLength;
+    TUint16   wNdpIndex;
+
+public:
+    inline void Dump();
+    };
+
+/**
+ * NCM NDP 16
+ */
+NONSHARABLE_CLASS(TNcmNdp16)
+    {
+public:
+    TUint8    dwSignature[4];
+    TUint16   wLength;
+    TUint16   wNextNdpIndex;
+    TUint16   wDatagram0Index;
+    TUint16   wDatagram0Length;
+    TUint16   wDatagram1Index;
+    TUint16   wDatagram1Length;
+
+public:
+    inline void Dump();
+    };
+
+/**
+ * NCM packet parser
+ *    NOTE:the buffer to be parsed was not guaranteed as a whole USB transfer.
+ *         So, a internal state is used to remember previous parsed result.
+ */
+NONSHARABLE_CLASS(CNcmNtbParser) : public CBase
+    {
+public:
+    virtual TInt Parse(const TUint8* aBuf, TInt aBufLen, TBool aZlp = EFalse) = 0;
+    virtual void Reset(TInt aResetType=0) = 0;
+    virtual TUint NtbOutMaxSize() const = 0;
+    virtual ~CNcmNtbParser();
+
+protected:
+    inline CNcmNtbParser(MNcmNdpFrameObserver&);
+
+    MNcmNdpFrameObserver& iObserver;
+    };
+
+/**
+ * NCM NTB 16 parser
+ */
+NONSHARABLE_CLASS(CNcmNtb16Parser): public CNcmNtbParser
+    {
+public:
+    //From CNcmNtbParser
+    TInt Parse(const TUint8* aBuf, TInt aBufLen, TBool aZlp = EFalse);
+    TUint NtbOutMaxSize() const;
+    void Reset(TInt aType = 0);
+
+    virtual ~CNcmNtb16Parser();
+
+    static CNcmNtb16Parser* NewL(MNcmNdpFrameObserver&);
+
+private:
+    inline CNcmNtb16Parser(MNcmNdpFrameObserver&);
+    //parse NTH
+    TInt ParseNcmNtb16Header(const TUint8* aBuf, TInt aBufLen, TBool aZlp);
+    //parse NDP
+    TInt ParseNcmNtb16Ndp(const TUint8* aBuf, TInt aBufLen);
+    //parse NdpDatagram
+    TInt ParseNcmNtb16NdpDatagram(const TUint8* aBuf, TInt aBufLen);
+    //queue buffer.
+    TInt QueueBuf(const TUint8* aBuf, TInt aBufLen);
+    TUint8 DataTUint8(TUint aOffset, const TUint8* aBuf, TInt aBufLen);
+    TUint16 DataTUint16(TUint aOffset, const TUint8* aBuf, TInt aBufLen);
+    TInt DataPacket(const TUint8* aBuf, TInt aBufLen);
+    //search NCMH in the stream if the NTH header signature is wrong.
+    TInt SearchNcmHead(const TUint8* aBuf, TInt aBufLen);
+
+
+    enum TNcmNtb16ResetType
+        {
+        ENcmNtb16TypeResetAll = 0,
+        ENcmNtb16TypeResetQueue = 1,
+        ENcmNtb16TypeResetData = 2
+        };
+
+    enum TNcmNtb16ParseState
+        {
+        //initial state, NTH is not ready.
+        ENcmNtb16ParseStateUninitialized = 0,
+        //NTH is ready, NDP is not ready.
+        ENcmNtb16ParseStateNdpParsing,
+        //NDP is ready, NdpDatagram is not finished.
+        ENcmNtb16ParseStateNdpSeeking,
+        //Error state or NULL NDP, ignore coming bytes until this NTB end.
+        ENcmNtb16ParseStateSkipBytes
+        };
+
+    enum TNcmNtb16ParseNdpState
+        {
+        ENcmNtb16ParseNdpStateUninitialized = 0,
+        ENcmNtb16ParseNdpStateDatagramed
+        };
+
+private:
+    TNcmNth16              iNth;
+    TNcmNdp16              iNdp;
+
+    TNcmNtb16ParseState    iState;
+
+    TUint                  iDataLen; //NTB data length.
+    TUint                  iQueLen;  //Queue length.
+    TUint                  iDataOffset; //start offset in first buffer in queue.
+    RArray<TPtrC8>         iBufQueue;
+
+    TNcmNtb16ParseNdpState iNdpState;
+    TUint                  iNdpDataOffset;
+    TUint                  iNdpBound;
+    TUint16                iDatagramIndex;
+    TUint16                iDatagramLength;
+
+    RMBufPacket            iPacket;
+
+#ifdef _DEBUG
+    //error statistics
+    TUint16                iPrevSeq;
+    TUint                  iTotalSeq;
+#endif
+
+    TUint16                iMaxSize;
+    };
+
+// inline functions
+#include "ncmntbparser.inl"
+
+#endif /* NCMNTBPARSER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmntbparser.inl	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* 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
+@internalComponent
+*/
+#ifndef NCMNTBPARSER_INL
+#define NCMNTBPARSER_INL
+
+inline void TNcmNth16::Dump()
+    {
+#ifdef DEBUG_DUMP_NTBINNER
+    RDebug::Printf("NcmNth16:%08x\n"
+            "\tdwSignature=%S,\n"
+            "\twHeaderLength=%d,\n"
+            "\twSequence=%d,\n"
+            "\twBlockLength=%d,\n"
+            "\twNdpIndex=%d.",
+            this, &TPtrC8((TUint8*)&dwSignature, 4), wHeaderLength, wSequence, wBlockLength,
+            wNdpIndex);
+#endif
+    }
+
+inline void TNcmNdp16::Dump()
+    {
+#ifdef DEBUG_DUMP_NTBINNER
+    RDebug::Printf("NcmNdp16:%08x,\n"
+            "\tdwSignature=%S,\n"
+            "\twLength=%d,\n"
+            "\twNextNdpIndex=%d,\n"
+            "\twDatagram0Index=%d,\n"
+            "\twDatagram0Length=%d,\n"
+            "\twDatagram1Index=%d,\n"
+            "\twDatagram1Length=%d,\n",
+            this, &TPtrC8((TUint8*)&dwSignature, 4),
+            wLength, wNextNdpIndex, wDatagram0Index, wDatagram0Length,
+            wDatagram1Index, wDatagram1Length);
+#endif
+    }
+
+inline CNcmNtb16Parser::CNcmNtb16Parser(MNcmNdpFrameObserver& aObserver)
+            : CNcmNtbParser(aObserver), iMaxSize(0xFFFF)
+    {
+    }
+
+inline CNcmNtbParser::CNcmNtbParser(MNcmNdpFrameObserver& aObserver)
+            : iObserver(aObserver)
+    {
+    }
+
+
+#endif //NCMNTBPARSER_INL
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmpktdrv.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,82 @@
+/*
+* 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
+@internalComponent
+*/
+#ifndef NCMPKTDRV_H
+#define NCMPKTDRV_H
+
+
+#include <e32base.h>
+#ifndef __OVER_DUMMYUSBSCLDD__
+#include <nifmbuf.h>
+#include <es_mbuf.h>
+#include <networking/pktdrv.h>
+#include <networking/ethinter.h>
+#else
+#include <usb/testncm/ethinter.h>
+#endif
+
+class CNcmEngine;
+class CNcmServer;
+
+/**
+The Ncm packet driver
+*/
+NONSHARABLE_CLASS(CNcmPktDrv) : public CPktDrvBase
+    {
+public:
+    CNcmPktDrv(CPktDrvFactory& aFactory);
+    virtual ~CNcmPktDrv();
+    virtual void ConstructL(CLANLinkCommon* aParent);
+
+    //From CPktDrvBase
+    virtual TInt StartInterface();
+    virtual TInt StopInterface();
+    virtual TInt ResetInterface();
+    virtual TInt SetRxMode(TRxMode AMode);
+    virtual TInt GetRxMode() const;
+    virtual TInt SetInterfaceAddress(const THWAddr&);
+    virtual TUint8* GetInterfaceAddress()const;
+    virtual TInt GetMulticastList(const THWAddr* aAddr, TInt& n) const;
+    virtual TInt SetMulticastList(const THWAddr* aAddr, TInt n);
+    virtual TInt InterfacePowerUp();
+    virtual TInt InterfacePowerDown();
+    virtual TInt InterfaceSleep();
+    virtual TInt InterfaceResume();
+    virtual TInt Notification(enum TAgentToNifEventType aEvent, void* aInfo);
+    virtual TInt Control(TUint aLevel,TUint aName,TDes8& aOption, TAny* aSource=0);
+    virtual TInt Send(RMBufChain& aPkt);
+
+    //Upcall from Control Object
+    void ReceiveEthFrame(RMBufPacket&);
+    void ResumeSending();
+    void FatalErrorNotification(TInt aError);
+
+#ifdef __OVER_DUMMYUSBSCLDD__
+public:
+    TInt State() const;
+#endif
+
+private:
+    CNcmEngine*        iEngine;
+    CNcmServer*        iNcmServer;
+    };
+
+#endif // NCMPKTDRV_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmpktdrvcommon.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* 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
+@internalComponent
+*/
+#ifndef NCMPKTDRVCOMMON_H
+#define NCMPKTDRVCOMMON_H
+
+#include <e32base.h>
+#include "ncmcommon.h"
+
+const TInt KErrCongestion = -6668;
+const TInt KErrNoBuffer = -6669;
+
+
+NONSHARABLE_CLASS(TNcmNtbInParam)
+    {
+public:
+    TUint32    iNtbInMaxSize;
+    TUint16    iNdpInDivisor;
+    TUint16    iNdpInPayloadRemainder;
+    TUint16    iNdpInAlignment;
+    };
+
+
+NONSHARABLE_CLASS(TNcmBuffer)
+    {
+public:
+    TUint8*    iPtr;
+    TUint32    iLen;
+    TUint32    iMaxLength;
+    };
+
+#endif // NCMPKTDRVCOMMON_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmpktdrvfactory.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* 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
+@internalComponent
+*/
+
+#ifndef NCMPKTDRVFACTORY_H
+#define NCMPKTDRVFACTORY_H
+
+#include <e32base.h>
+
+#ifndef __OVER_DUMMYUSBSCLDD__
+#include <es_mbuf.h>
+#include <networking/pktdrv.h>
+#else
+#include <usb/testncm/pktdrv.h>
+#endif
+
+const TUint KNcmDrvMajorVersionNumber=1;
+const TUint KNcmDrvMinorVersionNumber=0;
+const TUint KNcmDrvBuildVersionNumber=0;
+
+NONSHARABLE_CLASS(CNcmPktDrvFactory) : public CPktDrvFactory
+    {
+public:
+    virtual CPktDrvBase* NewDriverL(CLANLinkCommon* aParent);
+    virtual TVersion Version() const;
+    };
+
+#endif // NCMPKTDRVFACTORY_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/inc/ncmsharedstatemanager.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,79 @@
+/*
+* 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
+@internalComponent
+*/
+
+#ifndef NCMSHAREDSTATEMANAGER_H
+#define NCMSHAREDSTATEMANAGER_H
+
+#include <e32base.h>
+#include <e32property.h>
+
+#include "ncmpktdrvcommon.h"
+#include "ncmcoexistbearerwatcher.h"
+
+
+/**
+The interface to Ncm Engine.
+*/
+NONSHARABLE_CLASS(MShareStateObserver)
+    {
+public:
+    virtual void NotifyDhcpStarted() = 0;
+    };
+
+using namespace UsbNcm;
+
+/**
+Maintain the shared state between the Paket Driver and NCM class controller
+*/
+NONSHARABLE_CLASS(CNcmSharedStateManager) : public CActive
+    {
+public:
+    static CNcmSharedStateManager* NewL(MShareStateObserver& aEngine);
+    ~CNcmSharedStateManager();
+
+    TInt NotifyDhcpProvisionRequested();
+    void NotifyNcmConnected();
+    void NotifyNcmDisconnected(TInt aReason);
+
+    TInt SetStateValue(TInt aType, TInt aValue);
+    TInt RegisterNotify(const RMessage2& aMsg);
+    TInt DeRegisterNotify();
+
+private:
+    CNcmSharedStateManager(MShareStateObserver& aEngine);
+    void ConstructL();
+
+    //From CActive
+    void RunL();
+    void DoCancel();
+
+    TInt DoDhcpProvisionRequest();
+
+private:
+    RProperty                    iProperty;
+    RMessage2                    iNotifyMsg;
+    TPckgBuf<TNcmConnectionEvent> iNcmState;
+    MShareStateObserver&         iEngine;
+    CNcmCoexistBearerWatcher*    iCoexistBearer;
+    };
+
+#endif // NCMSHAREDSTATEMANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/src/ncmbuffermanager.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,170 @@
+/*
+* 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
+@internalComponent
+*/
+
+
+#include "ncmbuffermanager.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "ncmbuffermanagerTraces.h"
+#endif
+
+
+
+
+// if there are KCongestionCount buffers will notify networking to stop sending
+// if there are at least KUnCongestionCount, will notify networking to start sending
+const TInt KCongestionCount = 1;
+const TInt KUnCongestionCount = 3;
+
+
+
+// ======== MEMBER FUNCTIONS ========
+//
+
+CNcmBufferManager* CNcmBufferManager::NewL()
+    {
+    OstTraceFunctionEntry0( CNCMBUFFERMANAGER_NEWL_ENTRY );
+    CNcmBufferManager *self = new (ELeave) CNcmBufferManager();
+    OstTraceFunctionExit0( CNCMBUFFERMANAGER_NEWL_EXIT );
+    return self;
+    }
+
+CNcmBufferManager::~CNcmBufferManager()
+    {
+    OstTraceFunctionEntry1( CNCMBUFFERMANAGER_CNCMBUFFERMANAGER_ENTRY, this );
+    iFreeQueue.Reset();
+    OstTraceFunctionExit1( CNCMBUFFERMANAGER_CNCMBUFFERMANAGER_EXIT, this );
+    }
+
+//
+// get a buffer block from manager
+//
+TInt CNcmBufferManager::GetBuffer(TNcmBuffer& aBuffer)
+    {
+	OstTraceFunctionEntry1( CNCMBUFFERMANAGER_GETBUFFER_ENTRY, this );
+	
+    TInt count = iFreeQueue.Count();
+    TInt ret = KErrNone;
+
+    if (count == 0)
+        {
+        OstTraceFunctionExit1( CNCMBUFFERMANAGER_GETBUFFER_EXIT, this );
+        return KErrNoBuffer;
+        }
+    else if (count == KCongestionCount)
+        {
+        iIsCongestion = ETrue;
+        ret = KErrCongestion;
+        }
+    aBuffer = iFreeQueue[0];
+    iFreeQueue.Remove(0);
+    OstTraceFunctionExit1( CNCMBUFFERMANAGER_GETBUFFER_EXIT_DUP1, this );
+    return ret;
+    }
+
+//
+// free a buffer block to manager
+//
+void CNcmBufferManager::FreeBuffer(const TNcmBuffer& aBuffer)
+    {
+    OstTraceFunctionEntry1( CNCMBUFFERMANAGER_FREEBUFFER_ENTRY, this );
+    iFreeQueue.Append(aBuffer);  
+    int count = iFreeQueue.Count();
+    iFreeQueue[count-1].iLen = 0;
+    if (count == KUnCongestionCount)
+        {
+        iIsCongestion = EFalse;
+        }
+    OstTraceFunctionExit1( CNCMBUFFERMANAGER_FREEBUFFER_EXIT, this );
+    }
+
+//
+// set the whole buffer area to create buffer blocks
+//
+void CNcmBufferManager::InitBufferArea(TAny* aBuf, TInt aLength)
+    {
+    OstTrace1( TRACE_NORMAL, CNCMBUFFERMANAGER_INITBUFFERAREA, "CNcmBufferManager::InitBufferArea aLength=%d", aLength );    
+    iBuf = (TUint8*)aBuf;
+    iLen = aLength;
+    }
+
+//
+// set the size of a buffer block, create buffer blocks on the buffer area
+//
+TInt CNcmBufferManager::SetBufferCellSize(TInt aSize)
+    {
+    OstTraceFunctionEntry1( CNCMBUFFERMANAGER_SETBUFFERCELLSIZE_ENTRY, this );
+
+//    buffer block size must be aligned with KAlignSize to make the each buffer start align with KAlignSize 
+    iCellSize = (aSize+iAlignSize-1)&~(iAlignSize-1);
+    OstTraceExt2( TRACE_NORMAL, CNCMBUFFERMANAGER_SETBUFFERCELLSIZE, "CNcmBufferManager::SetBufferCellSize aSize=%d, iCellSize=%d", aSize, iCellSize );
+
+//   buffer area got from share chunk LDD may not align, make it align to KAlignSize first
+    TUint32 buf = (TUint)iBuf;
+    buf = (buf+iAlignSize-1)&~(iAlignSize-1);
+    TUint8* alignbuf = (TUint8*)buf;
+    TUint32 offset = buf - (TUint)iBuf;
+    
+    int count = (iLen-offset)/iCellSize;
+    iFreeQueue.Reset();
+    if (count < KUnCongestionCount)
+        {        
+        OstTrace1( TRACE_FATAL, CNCMBUFFERMANAGER_SETBUFFERCELLSIZE1, "the buffer cell size is too big and create too less buffers %d", count );
+        OstTraceFunctionExit1( CNCMBUFFERMANAGER_SETBUFFERCELLSIZE_EXIT, this );
+        return KErrUnknown;
+        }
+
+    TNcmBuffer ncmbuf;
+    for (TInt i=0 ; i<count ; i++)
+        {
+        ncmbuf.iPtr = alignbuf+i*iCellSize;
+        ncmbuf.iLen = 0;
+        ncmbuf.iMaxLength = iCellSize;
+        iFreeQueue.Append(ncmbuf);
+        }
+    iIsCongestion = EFalse;
+    OstTraceFunctionExit1( CNCMBUFFERMANAGER_SETBUFFERCELLSIZE_EXIT_DUP1, this );
+    return KErrNone;
+    }
+
+CNcmBufferManager::CNcmBufferManager()
+    {
+    iIsCongestion = EFalse;
+    }
+
+//
+// if there is not enough buffer blocks, return ETrue and will start flow control in networking
+//
+
+TBool CNcmBufferManager::IsCongestion()
+    {
+    OstTrace1( TRACE_NORMAL, CNCMBUFFERMANAGER_ISCONGESTION, "CNcmBufferManager::FreeBufferCount %d", iFreeQueue.Count() );
+    return iIsCongestion;
+    }
+
+TInt CNcmBufferManager::RequiredBufferCount()
+    {
+    return KUnCongestionCount;
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/src/ncmcoexistbearerwatcher.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,203 @@
+/*
+* 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:
+*
+*/
+
+#include "ncmcoexistbearerwatcher.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "ncmcoexistbearerwatcherTraces.h"
+#endif
+
+
+#ifdef _DEBUG
+_LIT(KCoBearerPanic, "CoexistBearerPanic");
+#endif
+
+CNcmCoexistBearerWatcher* CNcmCoexistBearerWatcher::NewL()
+    {
+    CNcmCoexistBearerWatcher* self = new(ELeave) CNcmCoexistBearerWatcher();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CNcmCoexistBearerWatcher::CNcmCoexistBearerWatcher() : CActive(CActive::EPriorityStandard)
+    {
+    CActiveScheduler::Add(this);
+    }
+
+
+CNcmCoexistBearerWatcher::~CNcmCoexistBearerWatcher()
+    {
+    Cancel();
+    iProperty.Close();
+    }
+
+
+void CNcmCoexistBearerWatcher::ConstructL()
+    {
+    OstTraceFunctionEntry0(CNCMCOEXISTBEARERWATCHER_CONSTRUCTL);
+
+    const TUint KIPBearerCoexistenceProperty = 0x10286a95;
+
+    TInt err = iProperty.Define(KIPBearerCoexistenceProperty, RProperty::EInt, KAllowAllPolicy, KNetworkControlPolicy);
+    if ( (err != KErrNone) && (err != KErrAlreadyExists) )
+        {
+        OstTrace1( TRACE_ERROR, CNCMCOEXISTBEARERWATCHER_CONSTRUCTL_DUP02, "Failed to define the property;err=%d", err );
+        User::Leave(err);
+        }
+
+    TSecureId thisSID = RProcess().SecureId();
+    User::LeaveIfError(iProperty.Attach(thisSID, KIPBearerCoexistenceProperty));
+    User::LeaveIfError(iProperty.Get(reinterpret_cast<TInt&>(iBearerState)));
+
+    OstTraceFunctionExit0(CNCMCOEXISTBEARERWATCHER_CONSTRUCTL_DUP01);
+    }
+
+
+TInt CNcmCoexistBearerWatcher::SetIpOverUsbActive(TRequestStatus& aStatus)
+    {
+    OstTraceFunctionEntry0(CNCMCOEXISTBEARERWATCHER_SETIPOVERUSBACTIVE);
+
+    TInt ret = DoActive();
+    OstTrace1(TRACE_NORMAL, CNCMCOEXISTBEARERWATCHER_SETIPOVERUSBACTIVE_DUP01, "DoActive()=%d.", ret);
+
+    if (KErrNone == ret)
+        {
+        OstTraceFunctionExitExt(CNCMCOEXISTBEARERWATCHER_SETIPOVERUSBACTIVE_DUP02, this, KErrCompletion);
+        return KErrCompletion;
+        }
+    else if (KErrInUse == ret)
+        {
+        iReportStatus = &aStatus;
+        *iReportStatus = KRequestPending;
+
+        iProperty.Subscribe(iStatus);
+        SetActive();
+        return KErrNone;
+        }
+
+    OstTraceFunctionExitExt(CNCMCOEXISTBEARERWATCHER_SETIPOVERUSBACTIVE_DUP03, this, ret);
+    return ret;
+    }
+/**
+ * do Set IP Over USB Actived.
+ */
+TInt CNcmCoexistBearerWatcher::DoActive()
+    {
+    __ASSERT_DEBUG(iBearerState != EIPBearerIPOverUSB, User::Panic(KCoBearerPanic, __LINE__));
+
+    _LIT(KIPBearerCoexistenceMutex, "IPBearerCoexistenceMutex");
+    RMutex gMutex;
+    TInt error = gMutex.CreateGlobal(KIPBearerCoexistenceMutex);
+    if ( error != KErrNone )
+        {
+        if( error == KErrAlreadyExists )
+            {
+            error = gMutex.OpenGlobal(KIPBearerCoexistenceMutex);
+            if(error != KErrNone)
+                {
+                OstTrace1(TRACE_ERROR, CNCMCOEXISTBEARERWATCHER_DOACTIVE, "Failed to open global mutex, error=%d", error);
+                return KErrNotReady;
+                }
+            }
+        else
+            {
+            OstTrace1(TRACE_ERROR, CNCMCOEXISTBEARERWATCHER_DOACTIVE_DUP01,  "Failed to create a global mutex, error=%d", error);
+            return KErrNotReady;
+            }
+        }
+
+    gMutex.Wait();
+    error = iProperty.Get(reinterpret_cast<TInt&>(iBearerState));
+    if (error != KErrNone)
+        {
+        OstTrace1(TRACE_ERROR, CNCMCOEXISTBEARERWATCHER_DOACTIVE_DUP02, "Failed to get property value, error=%d", error);
+        }
+    else
+        {
+        if (iBearerState == EIPBearerNoneActive)
+            {
+            error = iProperty.Set(EIPBearerIPOverUSB);
+            if (error != KErrNone)
+                {
+                OstTrace1(TRACE_ERROR, CNCMCOEXISTBEARERWATCHER_DOACTIVE_DUP03, "Failed to set property value, error=%d", error);
+                }
+            else
+                {
+                iBearerState = EIPBearerIPOverUSB;
+                }
+            }
+        else
+            {
+            error = KErrInUse;
+            __ASSERT_DEBUG(iBearerState != EIPBearerIPOverUSB, User::Panic(KCoBearerPanic, __LINE__));
+            OstTrace1(TRACE_WARNING, CNCMCOEXISTBEARERWATCHER_DOACTIVE_DUP04, "Failed to set CoexistIPBearer to IPOverUsb since iBearerState=%d", iBearerState);
+            }
+        }
+
+    gMutex.Signal();
+    gMutex.Close();
+
+    return error;
+    }
+
+TInt CNcmCoexistBearerWatcher::SetIpOverUsbDeactive()
+    {
+    __ASSERT_DEBUG(iBearerState==EIPBearerIPOverUSB, User::Panic(KCoBearerPanic, __LINE__));
+
+    TInt err = iProperty.Set(EIPBearerNoneActive);
+    OstTrace1(TRACE_NORMAL, CNCMCOEXISTBEARERWATCHER_SETIPOVERUSBDEACTIVE, "Stop using Coexistence Bearer, result=%d", err);
+    iBearerState = EIPBearerNoneActive;
+
+    return err;
+    }
+
+void CNcmCoexistBearerWatcher::RunL()
+    {
+    OstTrace1(TRACE_NORMAL, CNCMCOEXISTBEARERWATCHER_RUNL, "iStatus.Int()=%d", iStatus.Int());
+
+    if (KErrNone == iStatus.Int())
+        {
+        TInt ret = DoActive();
+        OstTrace1(TRACE_NORMAL, CNCMCOEXISTBEARERWATCHER_RUNL_DUP01, "DoActive()=%d", ret);
+        if (KErrNone == ret)
+            {
+            User::RequestComplete(iReportStatus, KErrNone);
+            }
+        else if (KErrInUse == ret)
+            {
+            iProperty.Subscribe(iStatus);
+            SetActive();
+            }
+        else
+            {
+            User::RequestComplete(iReportStatus, ret);
+            }
+        }
+    else if (KErrCancel != iStatus.Int())
+        {
+        User::RequestComplete(iReportStatus, iStatus.Int());
+        }
+    }
+
+void CNcmCoexistBearerWatcher::DoCancel()
+    {
+    OstTraceFunctionEntry0(CNCMCOEXISTBEARERWATCHER_DOCANCEL);
+    iProperty.Cancel();
+    User::RequestComplete(iReportStatus, KErrCancel);
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/src/ncmcomminterfacesenderandreceiver.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,265 @@
+/*
+* 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:
+* implementation for read and write data from share chunk LDD 
+*
+*/
+
+
+/**
+@internalComponent
+*/
+
+#include "ncmcommunicationinterface.h"
+#include "ncmengine.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "ncmcomminterfacesenderandreceiverTraces.h"
+#endif
+
+
+
+// ======== MEMBER FUNCTIONS ========
+//
+
+CNcmCommInterfaceSenderAndReceiver::CNcmCommInterfaceSenderAndReceiver(RDevUsbcScClient& aPort, CNcmCommunicationInterface& aComm) 
+    : CActive(CActive::EPriorityStandard),
+    iPort(aPort),
+    iCommInterface(aComm),
+    iState(EUnInit)
+    {
+    CActiveScheduler::Add(this);
+    }
+
+CNcmCommInterfaceSenderAndReceiver* CNcmCommInterfaceSenderAndReceiver::NewL(RDevUsbcScClient& aPort, CNcmCommunicationInterface& aComm)
+    {
+    return new(ELeave) CNcmCommInterfaceSenderAndReceiver(aPort, aComm);
+    }
+
+CNcmCommInterfaceSenderAndReceiver::~CNcmCommInterfaceSenderAndReceiver()
+    {
+    Stop();
+    }
+
+void CNcmCommInterfaceSenderAndReceiver::Start()
+    {
+    OstTraceFunctionEntry1( CNCMCOMMINTERFACESENDERANDRECEIVER_START_ENTRY, this );
+    
+    TInt ret = iPort.OpenEndpoint(iEp0Buffer, KEp0Number);
+    if (ret != KErrNone)
+        {
+        OstTrace1( TRACE_FATAL, CNCMCOMMINTERFACESENDERANDRECEIVER_START1, "OpenEndpoint error %d", ret);
+        iCommInterface.ControlMsgError(EInternalError);
+        OstTraceFunctionExit1( CNCMCOMMINTERFACESENDERANDRECEIVER_START_EXIT, this );
+        return;
+        }
+    iState = EIdle;
+    OstTraceFunctionExit1( CNCMCOMMINTERFACESENDERANDRECEIVER_START_EXIT_DUP1, this );
+    }
+
+void CNcmCommInterfaceSenderAndReceiver::Stop()
+    {
+    OstTraceFunctionEntry0( CNCMCOMMINTERFACESENDERANDRECEIVER_STOP_ENTRY );
+    
+    iState = EIdle;
+    Cancel();    
+    iEp0Buffer.Close();
+    OstTraceFunctionExit0( CNCMCOMMINTERFACESENDERANDRECEIVER_STOP_EXIT );
+    }
+
+
+//
+//Read data of aLength from LDD
+//
+
+TInt CNcmCommInterfaceSenderAndReceiver::Read(TRequestStatus& aStatus, TDes8& aBuf, TInt aLength)
+    {
+    OstTraceFunctionEntry1( CNCMCOMMINTERFACESENDERANDRECEIVER_READ_ENTRY, this );   
+    OstTrace1( TRACE_NORMAL, CNCMCOMMINTERFACESENDERANDRECEIVER_READ, "CNcmCommInterfaceSenderAndReceiver::Read length %d", aLength );
+        
+    iCompleteStatus = &aStatus;
+    *iCompleteStatus = KRequestPending;
+    if (iState != EIdle)
+        {
+        OstTrace0( TRACE_FATAL, CNCMCOMMINTERFACESENDERANDRECEIVER_READ_DUP1, "CNcmCommInterfaceSenderAndReceiver Read In Use" );
+        OstTraceFunctionExit1( CNCMCOMMINTERFACESENDERANDRECEIVER_READ_EXIT, this );
+        return KErrInUse;
+        }
+    iReceiveBuf = &aBuf;
+    iReceiveBuf->Zero();
+    iToReceiveLength = aLength;
+    iState = EReceiving;
+    ReadData();
+    OstTraceFunctionExit1( CNCMCOMMINTERFACESENDERANDRECEIVER_READ_EXIT_DUP1, this );
+    return KErrNone;
+    }
+
+//
+//write aLength data to ldd
+//
+TInt CNcmCommInterfaceSenderAndReceiver::Write(TRequestStatus& aStatus, TDesC8& aBuf, TInt aLength)
+    {
+    OstTraceFunctionEntry1( CNCMCOMMINTERFACESENDERANDRECEIVER_WRITE_ENTRY, this );
+    OstTrace1( TRACE_NORMAL, CNCMCOMMINTERFACESENDERANDRECEIVER_WRITE, "CNcmCommInterfaceSenderAndReceiver::Write length %d", aLength );
+
+    iCompleteStatus = &aStatus;
+    *iCompleteStatus = KRequestPending;
+
+    if (iState != EIdle)
+        {
+        OstTrace0( TRACE_FATAL, CNCMCOMMINTERFACESENDERANDRECEIVER_WRITE1, "CNcmCommInterfaceSenderAndReceiver::Write in Use" );        
+        OstTraceFunctionExit1( CNCMCOMMINTERFACESENDERANDRECEIVER_WRITE_EXIT, this );
+        return KErrInUse;
+        }
+
+    TAny *buf;
+    TUint size;
+    TInt ret = iEp0Buffer.GetInBufferRange(buf, size);
+    if (ret != KErrNone)
+        {
+        OstTrace0( TRACE_FATAL, CNCMCOMMINTERFACESENDERANDRECEIVER_WRITE2, "CNcmCommInterfaceSenderAndReceiver::Write in Use" );        
+        OstTraceFunctionExit1( CNCMCOMMINTERFACESENDERANDRECEIVER_WRITE_EXIT_DUP1, this );
+        return ret;
+        }
+    else if (size < aLength)
+        {
+        OstTrace0( TRACE_FATAL, CNCMCOMMINTERFACESENDERANDRECEIVER_WRITE3, "write data is bigger than ldd buffer size" );        
+        OstTraceFunctionExit1( CNCMCOMMINTERFACESENDERANDRECEIVER_WRITE_EXIT_DUP2, this );
+        return KErrArgument;
+        }
+
+    TPtr8 writeBuf((TUint8 *)buf, size);
+    writeBuf.Copy(aBuf.Ptr(), aLength);    
+    ret = iEp0Buffer.WriteBuffer(buf, writeBuf.Size(), ETrue, iStatus);
+    if (ret != KErrNone)
+        {
+        OstTrace1( TRACE_FATAL, CNCMCOMMINTERFACESENDERANDRECEIVER_WRITE4, "WriteBuffer error %d", ret );
+        OstTraceFunctionExit1( CNCMCOMMINTERFACESENDERANDRECEIVER_WRITE_EXIT_DUP3, this );
+        return ret;
+        }
+    iState = ESending;
+    SetActive();
+    OstTraceFunctionExit1( CNCMCOMMINTERFACESENDERANDRECEIVER_WRITE_EXIT_DUP4, this );
+    return KErrNone;
+    }
+
+
+
+//
+//Read data from USB share chunk LDD
+//
+void CNcmCommInterfaceSenderAndReceiver::ReadData()
+    {
+    OstTraceFunctionEntry1( CNCMCOMMINTERFACESENDERANDRECEIVER_READDATA_ENTRY, this );
+    TInt ret;
+    TAny* buf;
+    TUint8* receivebuf; 
+    TUint receiveLen;
+    TBool zlp;
+
+    FOREVER
+        {
+        ret = iEp0Buffer.GetBuffer(buf, receiveLen, zlp, iStatus, iToReceiveLength);
+        receivebuf = (TUint8*)buf; 
+        if (ret == TEndpointBuffer::KStateChange)
+            {
+            OstTrace0( TRACE_NORMAL, CNCMCOMMINTERFACESENDERANDRECEIVER_READDATA, "receive state change, discard it" );
+            continue;
+            }
+
+        else if (ret == KErrCompletion)
+            {
+            OstTrace1( TRACE_NORMAL, CNCMCOMMINTERFACESENDERANDRECEIVER_READDATA1, "read data length %d from ldd", receiveLen );
+            if (receiveLen > iToReceiveLength)
+                {
+                User::RequestComplete(iCompleteStatus, KErrOverflow);
+                iState = EIdle;
+                OstTrace0( TRACE_NORMAL, CNCMCOMMINTERFACESENDERANDRECEIVER_READDATA2,"data from ldd is bigger than receive buffer" );
+                OstTraceFunctionExit1( CNCMCOMMINTERFACESENDERANDRECEIVER_READDATA_EXIT, this );
+                return;
+                }
+            
+            iReceiveBuf->Append(receivebuf, receiveLen);
+            iToReceiveLength -= receiveLen;
+            if (!iToReceiveLength)
+                {        
+                User::RequestComplete(iCompleteStatus, KErrNone);
+                iState = EIdle;
+                OstTrace0( TRACE_NORMAL, CNCMCOMMINTERFACESENDERANDRECEIVER_READDATA3,"Complete read request" );
+                OstTraceFunctionExit1( CNCMCOMMINTERFACESENDERANDRECEIVER_READDATA_EXIT_DUP1, this );
+                return;
+                }
+            continue;
+            }
+        else if (ret == KErrNone)
+            {
+            break;
+            }
+        else
+            {
+            OstTrace1( TRACE_NORMAL, CNCMCOMMINTERFACESENDERANDRECEIVER_READDATA4, "GetBuffer error %d", ret);
+            User::RequestComplete(iCompleteStatus, KErrNone);
+            iState = EIdle;
+            OstTraceFunctionExit1( CNCMCOMMINTERFACESENDERANDRECEIVER_READDATA_EXIT_DUP2, this );
+            return;
+            }
+        }
+    SetActive();
+    OstTraceFunctionExit1( CNCMCOMMINTERFACESENDERANDRECEIVER_READDATA_EXIT_DUP3, this );
+    }
+
+//
+//RunL, looply receive data from share chunk LDD until receive all required data
+//
+void CNcmCommInterfaceSenderAndReceiver::RunL()
+    {
+    OstTraceFunctionEntry1( CNCMCOMMINTERFACESENDERANDRECEIVER_RUNL_ENTRY, this );
+    if(iStatus.Int() != KErrNone)
+        {
+        if (KErrCancel == iStatus.Int() )
+            {
+            OstTrace0( TRACE_NORMAL, CNCMCOMMINTERFACESENDERANDRECEIVER_RUNL,"CNcmCommInterfaceSenderAndReceiver, control channel is cancelled" );
+            }
+        else
+            {
+            OstTrace1( TRACE_NORMAL, CNCMCOMMINTERFACESENDERANDRECEIVER_RUNL1, "CNcmCommInterfaceSenderAndReceiver::RunL error %d", iStatus.Int());
+            }
+        User::RequestComplete(iCompleteStatus, iStatus.Int());
+        }
+    else
+        {
+        if (iState == EReceiving)
+            {
+            ReadData();
+            }
+        else if (iState == ESending)
+            {
+            User::RequestComplete(iCompleteStatus, KErrNone);
+            iState = EIdle;
+            OstTrace0( TRACE_NORMAL, CNCMCOMMINTERFACESENDERANDRECEIVER_RUNL2,"Complete write request" );
+            }
+        }
+    OstTraceFunctionExit1( CNCMCOMMINTERFACESENDERANDRECEIVER_RUNL_EXIT, this );
+    }
+
+//
+//Cancel the outgoing read request
+//
+void CNcmCommInterfaceSenderAndReceiver::DoCancel()
+    {    
+    OstTraceFunctionEntry1( CNCMCOMMINTERFACESENDERANDRECEIVER_DOCANCEL_ENTRY, this );
+    iPort.ReadCancel(KUsbcScEndpointZero);
+    iPort.WriteCancel(KUsbcScEndpointZero);
+    OstTraceFunctionExit1( CNCMCOMMINTERFACESENDERANDRECEIVER_DOCANCEL_EXIT, this );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/src/ncmcommunicationinterface.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,522 @@
+/*
+* 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:
+* implementation of NCM communication interface class 
+*
+*/
+
+
+#include <es_sock.h>
+#include "ncmcommunicationinterface.h"
+#include "ncmnotificationdescriptor.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "ncmcommunicationinterfaceTraces.h"
+#endif
+
+
+
+const TUint KUsbRequestLengthIdx = 6;
+const TUint KUsbRequestTypeIdx = 1;
+const TInt  KIntEndpoint = 1;
+const TInt  KNotificationRequestType = 0xA1;
+
+
+#if defined(_DEBUG)
+_LIT(KNcmCommInterfacePanic, "UsbNcmComm"); // must be <=16 chars
+#endif
+
+
+// Panic codes
+enum TNcmCommPanicCode
+    {
+    ENcmCommWrongSetupLength = 1,
+    ENcmCommWrongDataLength,
+    ENcmCommWriteError,
+    ENcmCMEndMark
+    };
+
+
+// ======== MEMBER FUNCTIONS ========
+//
+
+CNcmCommunicationInterface::CNcmCommunicationInterface(MNcmControlObserver& aEngine, RDevUsbcScClient& aLdd) : CActive(CActive::EPriorityHigh),
+                            iEngine(aEngine), iPort(aLdd)
+    {
+    CActiveScheduler::Add(this);
+    }
+
+void CNcmCommunicationInterface::ConstructL()
+    {
+    iSenderAndReceiver = CNcmCommInterfaceSenderAndReceiver::NewL(iPort, *this);
+    }
+
+CNcmCommunicationInterface* CNcmCommunicationInterface::NewL(MNcmControlObserver& aEngine, RDevUsbcScClient& aLdd)
+    {
+    OstTraceFunctionEntry0( CNCMCOMMUNICATIONINTERFACE_NEWL_ENTRY );
+    CNcmCommunicationInterface *self=new (ELeave) CNcmCommunicationInterface(aEngine, aLdd);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+    OstTraceFunctionExit0( CNCMCOMMUNICATIONINTERFACE_NEWL_EXIT );
+    return self;
+    }
+
+CNcmCommunicationInterface::~CNcmCommunicationInterface()
+    {
+    OstTraceFunctionEntry1( CNCMCOMMUNICATIONINTERFACE_CNCMCOMMUNICATIONINTERFACE_ENTRY, this );
+    
+    Cancel();
+    delete iSenderAndReceiver;
+    OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_CNCMCOMMUNICATIONINTERFACE_EXIT, this );
+    }
+
+//
+//Start the control channel of NCM
+//
+TInt CNcmCommunicationInterface::Start()
+    {
+    OstTraceFunctionEntry1( CNCMCOMMUNICATIONINTERFACE_START_ENTRY, this );
+    if (iStarted)
+        {
+        OstTrace0( TRACE_WARNING, CNCMCOMMUNICATIONINTERFACE_START, "CNcmCommunicationInterface, already started!" );        
+        OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_START_EXIT, this );
+        return KErrInUse;
+        }
+
+    TInt ret = GetInterfaceNumber();
+    if (ret != KErrNone)
+        {        
+        OstTrace1( TRACE_FATAL, CNCMCOMMUNICATIONINTERFACE_START1, "GetInterfaceNumber failed ret=%d", ret);
+        OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_START_EXIT_DUP1, this );
+        return ret;
+        }
+    
+    iStarted = ETrue;
+    iRWState = EStateInitial;
+
+    iSenderAndReceiver->Start();
+
+    //force a call to RunL
+    SetActive();
+    TRequestStatus* status=&iStatus;
+    User::RequestComplete(status, KErrNone);
+    OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_START_EXIT_DUP2, this );
+    return KErrNone;
+    }
+
+//
+//Listen on the ep0 to receive the NCM control message from host
+//
+void CNcmCommunicationInterface::ReadSetup()
+    {
+    OstTraceFunctionEntry1( CNCMCOMMUNICATIONINTERFACE_READSETUP_ENTRY, this );
+    iRWState = EStateReadSetup;
+    iRequestType = 0;
+    iDataStageLength = 0;
+    TInt ret = iSenderAndReceiver->Read(iStatus, iSetupPacket, KSetupPacketLength);
+
+    if (ret != KErrNone)
+        {
+        OstTrace1( TRACE_FATAL, CNCMCOMMUNICATIONINTERFACE_READSETUP, "read setup packet error %d", ret);        
+        ControlMsgError(EInternalError);
+        OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_READSETUP_EXIT, this );
+        return;
+        }
+    SetActive();
+    OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_READSETUP_EXIT_DUP1, this );
+    }
+
+
+//
+//decode the setup packet to get command information.
+//
+void CNcmCommunicationInterface::DecodeSetup()
+    {
+    OstTraceFunctionEntry1( CNCMCOMMUNICATIONINTERFACE_DECODESETUP_ENTRY, this );
+    
+    __ASSERT_DEBUG(iSetupPacket.Length()==KSetupPacketLength, 
+        User::Panic(KNcmCommInterfacePanic, ENcmCommWrongSetupLength));
+		
+    iRequestType = iSetupPacket[KUsbRequestTypeIdx];
+    iDataStageLength = LittleEndian::Get16(&iSetupPacket[KUsbRequestLengthIdx]);
+	
+    switch (iRequestType)
+        {
+        case EGetNtbParameters:	
+            if (iDataStageLength != KNtbParamStructLength)
+                {
+                ControlMsgError(EInvalidLengthToRead);
+                break;
+                }
+            iEngine.HandleGetNtbParam(iDataBuffer);
+            __ASSERT_DEBUG(iDataBuffer.Length()==KNtbParamStructLength, 
+                User::Panic(KNcmCommInterfacePanic, ENcmCommWrongDataLength));			
+            WriteDataIn();
+            break;
+          
+        case EGetNtbInputSize:
+            if (iDataStageLength != KNtbInputSizeStructLength)
+                {
+                ControlMsgError(EInvalidLengthToRead);
+                break;
+                }			
+            iEngine.HandleGetNtbInputSize(iDataBuffer);
+            __ASSERT_DEBUG(iDataBuffer.Length()==KNtbInputSizeStructLength, 
+                User::Panic(KNcmCommInterfacePanic, ENcmCommWrongDataLength));						
+            WriteDataIn();
+            break;
+			
+        case ESetNtbInputSize:
+            if (iDataStageLength != KNtbInputSizeStructLength)
+                {
+                ControlMsgError(EInvalidLengthToRead);
+                break;
+                }		
+            ReadDataOut();
+            break;
+        default:
+            TInt ret = iPort.EndpointZeroRequestError();
+            OstTrace1( TRACE_ERROR, CNCMCOMMUNICATIONINTERFACE_DECODESETUP, "unsupport request, halt endpoint with EndpointZeroRequestError %d", ret);
+            ReadSetup();
+            break;
+        }
+    OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_DECODESETUP_EXIT, this );
+    }
+
+
+
+//
+//Read the raw data of a control request message from host
+//
+void CNcmCommunicationInterface::ReadDataOut()
+    {
+    OstTraceFunctionEntry1( CNCMCOMMUNICATIONINTERFACE_READDATAOUT_ENTRY, this );
+    iRWState = EStateReadDataout;
+    iSenderAndReceiver->Read(iStatus, iDataBuffer, iDataStageLength);
+    SetActive();
+    OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_READDATAOUT_EXIT, this );
+    }
+
+
+
+
+//
+//Parse the data out from host to specific NCM control message
+//
+void CNcmCommunicationInterface::ParseDataOut()
+    {
+    OstTraceFunctionEntry1( CNCMCOMMUNICATIONINTERFACE_PARSEDATAOUT_ENTRY, this );
+
+    __ASSERT_DEBUG(iDataBuffer.Length()>0, 
+        User::Panic(KNcmCommInterfacePanic, ENcmCommWrongDataLength));			
+
+    TInt ret = KErrNone;
+    switch (iRequestType)
+        {
+        case ESetNtbInputSize:
+            ret = iEngine.HandleSetNtbInputSize(iDataBuffer);    
+            break;
+        default:
+            ret = KErrNotSupported;
+            break;
+        }
+    
+    if (ret == KErrNone)
+        {
+        iPort.SendEp0StatusPacket();
+        }
+    else
+        {
+        OstTrace1( TRACE_WARNING, CNCMCOMMUNICATIONINTERFACE_PARSEDATAOUT, "handle request iRequestType error %d stall endpoint", ret);
+        iPort.EndpointZeroRequestError();
+        }
+    ReadSetup();
+    OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_PARSEDATAOUT_EXIT, this );
+    }
+    
+//
+// send connection status notification, aConnected = ETrue if connection up, otherwise EFalse if connection discnnected
+//
+TInt CNcmCommunicationInterface::SendConnectionNotification(TBool aConnected)
+    {
+    OstTraceFunctionEntry1( CNCMCOMMUNICATIONINTERFACE_SENDCONNECTIONNOTIFICATION_ENTRY, this );
+    const TUint8 KConnectionNotificationCode = 0x00;
+    const TUint16 KConnectedCode = 0x0001;
+    const TUint16 KDisconnectCode = 0x0000;    
+
+    TUSBNotificationNetworkConnection netNotify;
+    netNotify.iRequestType = KNotificationRequestType;
+    netNotify.iNotification = KConnectionNotificationCode;
+    netNotify.iValue = (aConnected)?KConnectedCode:KDisconnectCode; 
+    netNotify.iIndex = iInterfaceNumber;
+    netNotify.iLength = 0;
+
+    return WriteInterruptData(KIntEndpoint, netNotify.Des(), 
+        netNotify.Des().Length());            
+    }
+
+//
+// send speed notification
+//
+TInt CNcmCommunicationInterface::SendSpeedNotification(TInt aUSBitRate, TInt aDSBitRate)
+    {
+    OstTraceFunctionEntry1( CNCMCOMMUNICATIONINTERFACE_SENDSPEEDNOTIFICATION_ENTRY, this );
+    const TUint8 KSpeedNotificationCode = 0x2A;
+        
+    TUSBNotificationConnectionSpeedChange speedNotify;
+    speedNotify.iRequestType = KNotificationRequestType;
+    speedNotify.iNotification = KSpeedNotificationCode;
+    speedNotify.iValue = 0x00; 
+    speedNotify.iIndex = iInterfaceNumber;
+    speedNotify.iLength = 0x08;
+    speedNotify.iUSBitRate = aUSBitRate;
+    speedNotify.iDSBitRate = aDSBitRate;
+
+    return WriteInterruptData(KIntEndpoint, speedNotify.Des(), 
+        speedNotify.Des().Length());    
+    }
+
+
+//
+//According to the receving request message, send back a response to the host
+//
+void CNcmCommunicationInterface::WriteDataIn()
+    {
+    OstTraceFunctionEntry1( CNCMCOMMUNICATIONINTERFACE_WRITEDATAIN_ENTRY, this );
+
+    iRWState = EStateWriteDatain;
+    TInt ret = iSenderAndReceiver->Write(iStatus, iDataBuffer, iDataBuffer.Length());
+    __ASSERT_DEBUG(ret==KErrNone, User::Panic(KNcmCommInterfacePanic, ENcmCommWriteError));		
+    SetActive();
+    OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_WRITEDATAIN_EXIT, this );
+    }
+
+//
+//Cancel the outgoing request
+//
+void CNcmCommunicationInterface::DoCancel()
+    {
+    OstTraceFunctionEntry1( CNCMCOMMUNICATIONINTERFACE_DOCANCEL_ENTRY, this );
+    TRequestStatus* status = &iStatus;    
+    User::RequestComplete(status, KErrCancel); 
+    OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_DOCANCEL_EXIT, this );
+    }
+
+//
+//Stop the control channel to stop the NCM
+//
+void CNcmCommunicationInterface::Stop()
+    {
+    OstTraceFunctionEntry1( CNCMCOMMUNICATIONINTERFACE_STOP_ENTRY, this );
+    iStarted = EFalse;
+    iSenderAndReceiver->Stop();
+    Cancel();
+    OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_STOP_EXIT, this );
+    }
+
+//
+//AO RunL
+//
+void CNcmCommunicationInterface::RunL()
+    {
+    OstTraceFunctionEntry1( CNCMCOMMUNICATIONINTERFACE_RUNL_ENTRY, this );
+    if(iStatus.Int() != KErrNone)
+        {
+        if (KErrCancel == iStatus.Int() )
+            {
+            }
+        else
+            {
+            ControlMsgError(EInternalError);
+            }
+        OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_RUNL_EXIT, this );
+        return;
+        }
+
+    switch(iRWState)
+        {
+        case EStateInitial:
+            {
+            ReadSetup();
+            break;
+            }
+            
+        case EStateReadSetup:
+            {
+            DecodeSetup();
+            break;
+            }
+            
+        case EStateReadDataout:
+            {
+            ParseDataOut();
+            break;
+            }
+
+        case EStateWriteDatain:
+            {
+            ReadSetup();
+            break;
+            }    
+        }
+    OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_RUNL_EXIT_DUP1, this );
+    }
+
+  
+//
+//Any fatal error occurs when reading/sending a NCM control message via USB interface
+//
+void CNcmCommunicationInterface::ControlMsgError(TNcmCommErrorCode aCode)
+    {
+    OstTraceFunctionEntry1( CNCMCOMMUNICATIONINTERFACE_CONTROLMSGERROR_ENTRY, this );
+    OstTrace1( TRACE_NORMAL, CNCMCOMMUNICATIONINTERFACE_CONTROLMSGERROR, "CNcmCommunicationInterface, Handle Ncm Control Message with err=%d", aCode);
+    
+    // Stall bus, there's nothing else we can do 
+    iPort.EndpointZeroRequestError();  
+    iEngine.ControlError(aCode);
+    OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_CONTROLMSGERROR_EXIT, this );
+    }
+
+
+TInt CNcmCommunicationInterface::WriteInterruptData(TInt aEndPoint, 
+                               TDesC8& aDes, 
+                               TInt aLength)
+
+    {
+    OstTraceFunctionEntry1( CNCMCOMMUNICATIONINTERFACE_WRITEINTERRUPTDATA_ENTRY, this );
+
+    TInt ret;
+    RTimer timer;
+    ret = timer.CreateLocal();
+    if ( ret )
+        {
+        OstTrace1( TRACE_FATAL, CNCMCOMMUNICATIONINTERFACE_WRITEINTERRUPTDATA, "\ttimer.CreateLocal = %d- returning", ret);        
+        OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_WRITEINTERRUPTDATA_EXIT, this );
+        return ret;
+        }
+    TRequestStatus status;
+    TRequestStatus timerStatus;
+
+    TEndpointBuffer epBuffer;
+    ret = iPort.OpenEndpoint(epBuffer, aEndPoint);
+    if (ret != KErrNone)
+        {
+        timer.Close();
+        OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_WRITEINTERRUPTDATA_EXIT_DUP1, this );
+        return ret;
+        }
+
+    TAny *buf;
+    TUint size;
+    ret = epBuffer.GetInBufferRange(buf, size);
+    if (ret != KErrNone)
+        {        
+        timer.Close();
+        OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_WRITEINTERRUPTDATA_EXIT_DUP2, this );
+        return ret;
+        }
+    else if (size < aLength)
+        {
+        timer.Close();
+        OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_WRITEINTERRUPTDATA_EXIT_DUP3, this );
+        return KErrArgument;
+        }
+    
+    TPtr8 writeBuf((TUint8 *)buf, size);
+    writeBuf.Copy(aDes.Ptr(), aLength);
+    ret = epBuffer.WriteBuffer(buf, writeBuf.Size(), ETrue, status);
+    if (ret != KErrNone)
+        {
+        timer.Close();
+        OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_WRITEINTERRUPTDATA_EXIT_DUP4, this );
+        return ret;
+        }
+
+    const TInt KWriteDataTimeout = 1000000;
+    timer.After(timerStatus, KWriteDataTimeout);
+    User::WaitForRequest(status, timerStatus);
+    if ( timerStatus != KRequestPending )
+        {
+        // Timeout occurred, silently ignore error condition.
+        // Assuming that the line has been disconnected
+        OstTrace0( TRACE_ERROR, CNCMCOMMUNICATIONINTERFACE_WRITEINTERRUPTDATA1, "CNcmCommunicationInterface::WriteInterruptData() - Timeout occurred");
+        iPort.WriteCancel(epBuffer.BufferNumber());
+        User::WaitForRequest(status);
+        ret = timerStatus.Int();
+        }
+    else
+        {
+        OstTrace0( TRACE_ERROR, CNCMCOMMUNICATIONINTERFACE_WRITEINTERRUPTDATA2, "CNcmCommunicationInterface::WriteInterruptData() - Write completed");
+        timer.Cancel();
+        User::WaitForRequest(timerStatus);
+        ret = status.Int();
+        }
+    
+    epBuffer.Close();
+    timer.Close();
+    OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_WRITEINTERRUPTDATA_EXIT_DUP5, this );
+    return ret;
+    }
+
+
+//
+// Get interface number
+//
+TInt CNcmCommunicationInterface::GetInterfaceNumber()
+    {
+    OstTraceFunctionEntry1( CNCMCOMMUNICATIONINTERFACE_GETINTERFACENUMBER_ENTRY, this );
+
+    TInt interfaceSize = 0;
+    // 2 is where the interface number is, according to the LDD API
+    const TInt intNumOffsetInDes = 2;
+
+    // 0 means the main interface in the LDD API
+    TInt res = iPort.GetInterfaceDescriptorSize(0, interfaceSize);
+
+    if ( res )
+        {
+        OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_GETINTERFACENUMBER_EXIT, this );
+        return res;
+        }
+
+    HBufC8* interfaceBuf = HBufC8::New(interfaceSize);
+    if ( !interfaceBuf )
+        {
+        OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_GETINTERFACENUMBER_EXIT_DUP1, this );
+        return KErrNoMemory;
+        }
+
+    TPtr8 interfacePtr = interfaceBuf->Des();
+    interfacePtr.SetLength(0);
+    // 0 means the main interface in the LDD API
+    res = iPort.GetInterfaceDescriptor(0, interfacePtr); 
+
+    if ( res )
+        {
+        delete interfaceBuf;
+        OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_GETINTERFACENUMBER_EXIT_DUP2, this );
+        return res;
+        }
+
+    const TUint8* buffer = reinterpret_cast<const TUint8*>(interfacePtr.Ptr());
+    iInterfaceNumber = buffer[intNumOffsetInDes]; 
+
+    delete interfaceBuf;
+    OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_GETINTERFACENUMBER_EXIT_DUP3, this );
+    return KErrNone;
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/src/ncmdatainterface.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,309 @@
+/*
+* 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:
+*
+*/
+
+#include <e32base.h>
+#include <e32cons.h>
+
+#ifndef __OVER_DUMMYUSBSCLDD__
+#include <d32usbc.h>//EEndPoint2
+#else
+#include <dummyusbsclddapi.h>
+#endif
+#include "ncmdatainterface.h"
+#include "ncmdatareceiver.h"
+#include "ncmdatasender.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "ncmdatainterfaceTraces.h"
+#endif
+
+
+
+
+const TInt KAltSetting1 = 1;
+const TInt KAltSetting0 = 0;
+
+
+CNcmDataInterface* CNcmDataInterface::NewL(MNcmDataObserver& aEngine,
+        RDevUsbcScClient& aLdd)
+    {
+    CNcmDataInterface *self = new (ELeave) CNcmDataInterface(aEngine, aLdd);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CNcmDataInterface::CNcmDataInterface(MNcmDataObserver& aEngine,
+        RDevUsbcScClient& aLdd) :
+    CActive(CActive::EPriorityStandard), iEngine(aEngine), iLdd(aLdd)
+    {
+    CActiveScheduler::Add(this);
+    }
+
+void CNcmDataInterface::ConstructL()
+    {
+    OstTraceFunctionEntry0(CNCMDATAINTERFACE_CONSTRUCTL);
+
+    iReceiver = CNcmDataReceiver::NewL(iLdd, *this);
+    iSender = CNcmDataSender::NewL(iLdd, *this);
+    OstTraceFunctionExit0(CNCMDATAINTERFACE_CONSTRUCTL_DUP01);
+    }
+
+CNcmDataInterface::~CNcmDataInterface()
+    {
+    OstTraceFunctionEntry0(CNCMDATAINTERFACE_CNCMDATAINTERFACE_DUP01);
+    Cancel();
+
+    delete iReceiver;
+    delete iSender;
+    OstTraceFunctionExit0(CNCMDATAINTERFACE_CNCMDATAINTERFACE_DUP02);
+    }
+
+/**
+ Start the NCM data channel
+ */
+void CNcmDataInterface::Start()
+    {
+    OstTraceFunctionEntry0(CNCMDATAINTERFACE_START);
+    if (!iStarted)
+        {
+        iReceiver->Start();
+        iSender->Start();
+        iStarted = ETrue;
+        }
+    OstTraceFunctionExit0(CNCMDATAINTERFACE_START_DUP01);
+    }
+
+/**
+ Stop the NCM data channel
+ */
+void CNcmDataInterface::Stop()
+    {
+    OstTraceFunctionEntry0(CNCMDATAINTERFACE_STOP);
+    if (iStarted)
+        {
+        iReceiver->Stop();
+        iSender->Stop();
+        iStarted = EFalse;
+
+        //after stop().
+        if (KAltSetting1 == iAltSetting)
+            {
+
+            iAltSetting = KAltSetting0;
+            }
+        }
+    OstTraceFunctionExit0(CNCMDATAINTERFACE_STOP_DUP01);
+    }
+
+/**
+ Send packet data from upper link to NCM host
+ */
+TInt CNcmDataInterface::Send(RMBufChain &aPacket)
+    {
+    const TInt KContinue = 1;
+    const TInt KStop = 0;
+
+    TInt ret = iSender->Send(aPacket);
+    if (ret == KErrNone)
+        {
+        return KContinue;
+        }
+    else if (ret == KErrNotReady || ret == KErrCongestion)
+        {
+        return KStop;
+        }
+    else
+        {
+        iEngine.DataError(ret);
+        return KStop;
+        }
+    }
+
+/**
+ * Acitve this AO to monitor the LDD's alt-setting changes.
+ */
+void CNcmDataInterface::ActivateLdd()
+    {
+    TInt alt = 0;
+    TInt ret = KErrNone;
+
+    ret = iLdd.GetAlternateSetting(alt);
+    OstTraceExt2(TRACE_NORMAL, CNCMDATAINTERFACE_ACTIVATELDD, "ActivateLDD:alt=%d, ret=%d", alt, ret);
+
+    if (KErrNone == ret)
+        {
+        if (iAltSetting == alt)
+            {
+            iLdd.AlternateDeviceStatusNotify(iStatus, iIfState);
+            SetActive();
+            }
+        else
+            {
+            TRequestStatus* status = &iStatus;
+            iStatus = KRequestPending;
+            iIfState = KUsbAlternateSetting | alt;
+            SetActive();
+
+            User::RequestComplete(status, KErrNone);
+            }
+        }
+    else
+        {
+        //It's possible when Usb Device Status is not configed.
+        iLdd.AlternateDeviceStatusNotify(iStatus, iIfState);
+        SetActive();
+        }
+    }
+
+void CNcmDataInterface::RunL()
+    {
+    OstTraceExt2(TRACE_NORMAL, CNCMDATAINTERFACE_RUNL, "State=%x, status=%d", iIfState, iStatus.Int());
+
+    if (KErrNone == iStatus.Int())
+        {
+        iLdd.AlternateDeviceStatusNotify(iStatus, iIfState);
+        SetActive();
+
+        if (iIfState & KUsbAlternateSetting)
+            {
+            TInt ret = KErrNone;
+            iAltSetting = iIfState & ~KUsbAlternateSetting;
+
+            if (KAltSetting1 == iAltSetting)
+                {
+                ret = iLdd.StartNextOutAlternateSetting(ETrue);
+                if (KAltSetting1 == ret)
+                    {
+                    iEngine.HandleAltSetting(iAltSetting);
+                    }
+                else
+                    {
+                    iEngine.DataError(ret);
+                    }
+                }
+            else
+                {
+                iEngine.HandleAltSetting(iAltSetting);
+                ret = iLdd.StartNextOutAlternateSetting(ETrue);
+                if (KAltSetting0 != ret)
+                    {
+                    iEngine.DataError(ret);
+                    }
+                }
+            }
+        }
+    else
+        {
+        iEngine.DataError(iStatus.Int());
+        }
+    }
+
+/**
+ * AO cancel.
+ */
+void CNcmDataInterface::DoCancel()
+    {
+    iLdd.AlternateDeviceStatusNotifyCancel();
+    }
+
+
+/**
+ * Get Connection Speed. (NB. Upstream's is the same as downstream's).
+ */
+TInt CNcmDataInterface::GetSpeed(TInt& aSpeed)
+    {
+    const TInt KHighSpeed = 480 * 1024 * 1024;
+    const TInt KFullSpeed = 12 * 1024 * 1024;
+
+    if (iLdd.CurrentlyUsingHighSpeed())
+        {
+        aSpeed = KHighSpeed;
+        }
+    else
+        {
+        aSpeed = KFullSpeed;
+        }
+
+    return KErrNone;
+
+    }
+/**
+ * Get Ntb Input Size.
+ */
+TInt CNcmDataInterface::GetNtbInputSize(TDes8& aSize)
+    {
+    const TUint KNtbIntputSizeLength = 4;
+    aSize.SetLength(KNtbIntputSizeLength);
+    LittleEndian::Put32(&aSize[0], iSender->NtbInMaxSize());
+    return KErrNone;
+    }
+
+/**
+ * Set Ntb Input Size.
+ */
+TInt CNcmDataInterface::SetNtbInputSize(TDesC8& aSize)
+    {
+    TInt size = LittleEndian::Get32(aSize.Ptr());
+    return iSender->SetNtbInMaxSize(size, KAltSetting0==iAltSetting);
+    }
+
+/**
+ * Get Ntb Parameter.
+ */
+TInt CNcmDataInterface::GetNtbParam(TDes8& aParamBuf)
+    {
+    TNcmNtbInParam  param;
+
+    iSender->GetNtbParam(param);
+
+    const TUint32 KNtbParamLength = 0x001C;
+    const TUint32 KNtbFormat = 0x0001;
+    const TUint   KNtbParamLengthOffset = 0;                               //0
+    const TUint   KNtbFormatOffset = KNtbParamLengthOffset + 2;            //2
+    const TUint   KNtbInMaxSizeOffset = KNtbFormatOffset + 2;              //4
+    const TUint   KNtbInDivisorOffset = KNtbInMaxSizeOffset + 4;           //8
+    const TUint   KNtbInPayloadRemainderOffset = KNtbInDivisorOffset + 2;  //10
+    const TUint   KNtbInAlignmentOffset = KNtbInPayloadRemainderOffset + 2;//12
+    const TUint   KNtbOutMaxSizeOffset = KNtbInAlignmentOffset + 4;        //16
+    const TUint   KNtbOutDivisorOffset = KNtbOutMaxSizeOffset + 4;         //20
+    const TUint   KNtbOutPayloadRemainderOffset = KNtbOutDivisorOffset + 2;//22
+    const TUint   KNtbOutAlignmentOffset = KNtbOutPayloadRemainderOffset + 2;//24
+
+    aParamBuf.FillZ(KNtbParamLength);
+    LittleEndian::Put16(&aParamBuf[KNtbParamLengthOffset], KNtbParamLength);
+    LittleEndian::Put16(&aParamBuf[KNtbFormatOffset], KNtbFormat);
+    LittleEndian::Put32(&aParamBuf[KNtbInMaxSizeOffset], param.iNtbInMaxSize);
+    LittleEndian::Put16(&aParamBuf[KNtbInDivisorOffset], param.iNdpInDivisor);
+    LittleEndian::Put16(&aParamBuf[KNtbInPayloadRemainderOffset], param.iNdpInPayloadRemainder);
+    LittleEndian::Put16(&aParamBuf[KNtbInAlignmentOffset], param.iNdpInAlignment);
+
+    //Tricky way: copy the Sender's parameter as the Receiver's.
+    LittleEndian::Put32(&aParamBuf[KNtbOutMaxSizeOffset], iReceiver->NtbOutMaxSize());
+    LittleEndian::Put16(&aParamBuf[KNtbOutDivisorOffset], param.iNdpInDivisor);
+    LittleEndian::Put16(&aParamBuf[KNtbOutPayloadRemainderOffset], param.iNdpInPayloadRemainder);
+    LittleEndian::Put16(&aParamBuf[KNtbOutAlignmentOffset], param.iNdpInAlignment);
+
+    return KErrNone;
+    }
+
+TInt CNcmDataInterface::SetInEpBufferSize(TUint aSize)
+    {
+    return iSender->SetInEpBufferSize(aSize);
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/src/ncmdatareceiver.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,204 @@
+/*
+* 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 __OVER_DUMMYUSBSCLDD__
+#include <e32base.h>
+#include <d32usbc.h>//EEndPoint2
+#else
+#include <dummyusbsclddapi.h>
+#endif
+
+#include "ncmdatareceiver.h"
+#include "ncmdatainterface.h"
+
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "ncmdatareceiverTraces.h"
+#endif
+
+
+
+#ifdef _DEBUG
+_LIT(KDataReceiverPanic, "DataRcvrPanic");
+#endif
+
+/**
+@file
+@internalComponent
+*/
+
+/**
+ * Constructor
+ */
+CNcmDataReceiver::CNcmDataReceiver(RDevUsbcScClient& aPort, CNcmDataInterface& aParent) :
+                                            CActive(CActive::EPriorityStandard),
+                                            iPort(aPort),
+                                            iParent(aParent)
+    {
+    CActiveScheduler::Add(this);
+    }
+
+/**
+ * NewL to create object.
+ */
+CNcmDataReceiver* CNcmDataReceiver::NewL(RDevUsbcScClient& aPort, CNcmDataInterface& aParent)
+    {
+    OstTraceFunctionEntry0(CNCMDATARECEIVER_NEWL);
+
+    CNcmDataReceiver* self = new(ELeave) CNcmDataReceiver(aPort, aParent);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+
+    OstTraceFunctionExit1(CNCMDATARECEIVER_NEWL_DUP01, self);
+    return self;
+    }
+
+void CNcmDataReceiver::ConstructL()
+    {
+    iNtbParser = CNcmNtb16Parser::NewL(*this);
+    }
+
+/**
+ * Destructor
+ */
+CNcmDataReceiver::~CNcmDataReceiver()
+    {
+    OstTraceFunctionEntry0(CNCMDATARECEIVER_CNCMDATARECEIVER_DUP01);
+
+    Cancel();
+    delete iNtbParser;
+    }
+
+/**
+ * Start to receive and parse the USB data.
+ */
+void CNcmDataReceiver::Start()
+    {
+    OstTraceFunctionEntry0(CNCMDATARECEIVER_START);
+
+    TInt ret = iPort.OpenEndpoint(iEpIn, EEndpoint2);
+    if (KErrNone != ret)
+        {
+        OstTrace1(TRACE_ERROR, CNCMDATARECEIVER_START_DUP01, "OpenEndpoint error=%d", ret);
+        iParent.DataError(ret);
+        OstTraceFunctionExit0(CNCMDATARECEIVER_START_DUP02);
+        return;
+        }
+    ReadData();
+    OstTraceFunctionExit0(CNCMDATARECEIVER_START_DUP03);
+    }
+
+/**
+ * Read the data packet from NCM host
+ */
+void CNcmDataReceiver::ReadData()
+    {
+    OstTraceFunctionEntry0(CNCMDATARECEIVER_READDATA);
+
+    const TInt KRetryCount = 3;
+    TInt ret = KErrNone;
+    TInt errCnt = KRetryCount;
+
+    while(errCnt)
+        {
+        ret = iEpIn.TakeBuffer(reinterpret_cast<TAny*&>(iBuf), iBufLen, iZlp, iStatus);
+        if (KErrCompletion == ret)
+            {
+            errCnt = KRetryCount;
+            if (iBufLen > 0)
+                {
+                OstTraceExt3(TRACE_NORMAL, CNCMDATARECEIVER_READDATA_DUP02, "iBuf=%x, iBufLen=%d, iZlp=%d", (TInt)iBuf, iBufLen, iZlp);
+                ret = iNtbParser->Parse(iBuf, iBufLen, iZlp);
+                }
+            }
+        else if (KErrNone == ret || KErrEof == ret)
+            {
+            break;
+            }
+        else
+            {
+            OstTrace1(TRACE_ERROR, CNCMDATARECEIVER_READDATA_DUP03, "TakeBuffer error=%d", ret);
+            errCnt --;
+            }
+        }
+
+    if (KErrNone == ret)
+        {
+        SetActive();
+        }
+    else if (KErrEof != ret)
+        {
+        iParent.DataError(ret);
+        }
+
+    OstTraceFunctionExit0(CNCMDATARECEIVER_READDATA_DUP01);
+    }
+
+/**
+ * Expire the Share Chunk LDD's buffer (see above TakeBuffer)
+ */
+void CNcmDataReceiver::ExpireBuffer(TAny* aBuf)
+    {
+    TInt ret = iEpIn.Expire(aBuf);
+    __ASSERT_DEBUG(KErrNone==ret, User::Panic(KDataReceiverPanic, __LINE__));
+    }
+
+/**
+ * Deliver the received packet data to upper link
+ */
+void CNcmDataReceiver::ProcessEtherFrame(RMBufPacket& aPacket)
+    {
+    iParent.ProcessDatagram(aPacket);
+    }
+
+/**
+ * RunL, a state machine to read the NCM packet data from NCM host
+ */
+void CNcmDataReceiver::RunL()
+    {
+    if(KErrNone == iStatus.Int())
+        {
+        ReadData();
+        }
+    else
+        {
+        OstTrace1(TRACE_ERROR, CNCMDATARECEIVER_RUNL, "iStatus.Int()=%d", iStatus.Int());
+        iParent.DataError(iStatus.Int());
+        }
+    }
+
+/**
+ * Cancel the outgoing read request
+ */
+void CNcmDataReceiver::DoCancel()
+    {
+    OstTraceFunctionEntry0(CNCMDATARECEIVER_DOCANCEL);
+    iPort.ReadCancel(iEpIn.BufferNumber());
+    }
+
+void CNcmDataReceiver::Stop()
+    {
+    OstTraceFunctionEntry0(CNCMDATARECEIVER_STOP);
+    Cancel();
+    iNtbParser->Reset();
+    TInt ret = iEpIn.Close();
+
+    OstTraceFunctionExit0(CNCMDATARECEIVER_STOP_DUP01);
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/src/ncmdatasender.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,439 @@
+/*
+* 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
+@internalComponent
+*/
+
+
+#include <e32base.h>
+
+#ifndef __OVER_DUMMYUSBSCLDD__
+#include <d32usbc.h>
+#else
+#include <dummyusbsclddapi.h>
+#endif
+
+#include "ncmdatasender.h"
+#include "ncmntb16builder.h"
+#include "ncmdatainterface.h"
+#include "ncmbuffermanager.h"
+#include "ncmntbbuildsimplepolicy.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "ncmdatasenderTraces.h"
+#endif
+
+
+//
+//write buffer alignment value should get from share chunk LDD, current LDD has no API for this
+//use a pagesize here instead
+//
+const TInt KAlignSize = 1024;
+
+
+// ======== MEMBER FUNCTIONS ========
+//
+
+CNcmDataSender::CNcmDataSender(RDevUsbcScClient& aPort, CNcmDataInterface& aParent) : CActive(EPriorityStandard),
+                                            iPort(aPort),
+                                            iParent(aParent)
+    {
+    CActiveScheduler::Add(this);
+    }
+
+CNcmDataSender* CNcmDataSender::NewL(RDevUsbcScClient& aPort, CNcmDataInterface& aParent)
+    {
+    OstTraceFunctionEntry0( CNCMDATASENDER_NEWL_ENTRY );
+    CNcmDataSender *self = new (ELeave) CNcmDataSender(aPort, aParent);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    OstTraceFunctionExit0( CNCMDATASENDER_NEWL_EXIT );
+    return self;
+    }
+
+void CNcmDataSender::ConstructL()
+    {
+
+    iNtbBuilder = CNcmNtb16Builder::NewL(*this);
+    iBufferManager = CNcmBufferManager::NewL();
+    iBufferManager->SetAlignSize(KAlignSize);
+    iBuildPolicy = CNcmNtbBuildSimplePolicy::NewL(*iNtbBuilder);
+    iBuildPolicy->NtbBuilder().SetBuildPolicy(*iBuildPolicy);
+    iStarted = EFalse;
+    iStopSending = EFalse;
+    iIsSending = EFalse;
+    }
+
+CNcmDataSender::~CNcmDataSender()
+    {
+    Cancel();
+    delete iNtbBuilder;
+    delete iBufferManager;
+    delete iBuildPolicy;
+    }
+
+//
+// Start the sender
+//
+void CNcmDataSender::Start()
+    {
+    OstTraceFunctionEntry1( CNCMDATASENDER_START_ENTRY, this );
+    if (iStarted)
+        {
+        OstTrace0( TRACE_ERROR, CNCMDATASENDER_START, "Alrealy start, return directly." );
+        OstTraceFunctionExit1( CNCMDATASENDER_START_EXIT, this );
+        return;
+        }
+
+    if (iStopSending)
+        {
+        iParent.ResumeSending();
+        iStopSending = EFalse;
+        }
+
+    TInt ret = iPort.OpenEndpoint(iEpOut, EEndpoint1);
+    if (ret != KErrNone)
+        {
+        OstTrace1( TRACE_FATAL, CNCMDATASENDER_START1, "OpenEndpoint error %d", ret );
+        iParent.DataError(ret);
+        OstTraceFunctionExit1( CNCMDATASENDER_START_EXIT_DUP1, this );
+        return;
+        }
+
+    TAny* buf = NULL;
+    TUint size;
+    ret = iEpOut.GetInBufferRange(buf, size);
+    if (ret != KErrNone)
+        {
+        OstTrace1( TRACE_FATAL, CNCMDATASENDER_START2, "iEpOut.GetInBufferRange failed ret=%d", ret );
+        iParent.DataError(ret);
+        OstTraceFunctionExit1( CNCMDATASENDER_START_EXIT_DUP2, this );
+        return;
+        }
+    else if (size < NtbInMaxSize())
+        {
+        OstTrace0( TRACE_FATAL, CNCMDATASENDER_START3, "LDD buffer size is small than NTB size" );
+        iParent.DataError(KErrArgument);
+        OstTraceFunctionExit1( CNCMDATASENDER_START_EXIT_DUP3, this );
+        return;
+        }
+    OstTraceExt2( TRACE_NORMAL, CNCMDATASENDER_START4, "GetInBufferRange at 0x%x size %d", (TUint)buf, size);
+
+
+    iBufferManager->InitBufferArea(buf, size);
+    ret = iBufferManager->SetBufferCellSize(NtbInMaxSize());
+    if (ret != KErrNone)
+        {
+        OstTrace1( TRACE_FATAL, CNCMDATASENDER_START5, "iBufferManager->SetBufferCellSize failed ret=%d", ret );
+        iParent.DataError(KErrArgument);
+        OstTraceFunctionExit1( CNCMDATASENDER_START_EXIT_DUP4, this );
+        return;
+        }
+    iBuildPolicy->UpdateBufferSize(NtbInMaxSize());
+    iBuildPolicy->UpdateTotalBufferCount(iBufferManager->FreeBufferCount());
+    iStarted = ETrue;
+    OstTraceFunctionExit1( CNCMDATASENDER_START_EXIT_DUP5, this );
+    }
+
+
+void CNcmDataSender::RunL()
+    {
+    OstTraceFunctionEntry1( CNCMDATASENDER_RUNL_ENTRY, this );
+    OstTrace1( TRACE_NORMAL, CNCMDATASENDER_RUNL, "CNcmDataSender::RunL:Status=%d", iStatus.Int());
+
+    if(iStatus.Int() != KErrNone)
+        {
+        if (KErrCancel == iStatus.Int() )
+            {
+            }
+        else
+            {
+            iParent.DataError(iStatus.Int());
+            }
+        OstTraceFunctionExit1( CNCMDATASENDER_RUNL_EXIT, this );
+        return;
+        }
+    SendNtbComplete();
+    OstTraceFunctionExit1( CNCMDATASENDER_RUNL_EXIT_DUP1, this );
+    }
+
+//
+//Start a New Ntb in Builder
+//
+
+TInt CNcmDataSender::StartNewNtb()
+    {
+    OstTraceFunctionEntry1( CNCMDATASENDER_STARTNEWNTB_ENTRY, this );
+    TNcmBuffer ncmBuffer;
+    TInt ret = iBufferManager->GetBuffer(ncmBuffer);
+	if (ret == KErrNone || ret == KErrCongestion)
+        {
+        iNtbBuilder->StartNewNtb(ncmBuffer);
+        }
+    else
+        {
+        OstTrace1( TRACE_FATAL, CNCMDATASENDER_STARTNEWNTB, "iBufferManager->GetBuffer failed ret=%d", ret);
+        }
+    OstTraceFunctionExit1( CNCMDATASENDER_STARTNEWNTB_EXIT, this );
+    return ret;
+    }
+
+
+//add a Ethernet packet to current NTB
+//
+
+TInt CNcmDataSender::Send(RMBufChain& aPacket)
+    {
+    OstTraceFunctionEntry1( CNCMDATASENDER_SEND_ENTRY, this );
+
+    if (!iStarted)
+        {
+        OstTrace0( TRACE_WARNING, CNCMDATASENDER_SEND1, "Sender is not started" );
+        iStopSending = ETrue;
+        OstTraceFunctionExit1( CNCMDATASENDER_SEND_EXIT, this );
+        return KErrNotReady;
+        }
+
+    TInt ret = KErrNone;
+    if (!iNtbBuilder->IsNtbStarted())
+        {
+        ret = StartNewNtb();
+        if (ret != KErrNone && ret != KErrCongestion)
+            {
+            OstTraceFunctionExit1( CNCMDATASENDER_SEND_EXIT_DUP1, this );
+            return ret;
+            }
+        }
+
+    TBool isCongestion = (ret == KErrCongestion)?ETrue:EFalse;
+
+    ret = iNtbBuilder->AppendPacket(aPacket);
+
+    if (ret == KErrBufferFull)
+        {
+    //current NTB is full and can't add new packet, start a new NTB and insert packet to it
+        ret = StartNewNtb();
+        if (ret == KErrNone)
+            {
+            ret = iNtbBuilder->AppendPacket(aPacket);
+            }
+        else if (ret == KErrCongestion)
+            {
+            isCongestion = ETrue;
+            ret = iNtbBuilder->AppendPacket(aPacket);
+            }
+        }
+
+    if (isCongestion && ret == KErrNone)
+        {
+        OstTrace0( TRACE_NORMAL, CNCMDATASENDER_SEND2, "CNcmDataSender::Send congestion" );
+        iStopSending = ETrue;
+        OstTraceFunctionExit1( CNCMDATASENDER_SEND_EXIT_DUP2, this );
+        return KErrCongestion;
+        }
+    OstTraceFunctionExit1( CNCMDATASENDER_SEND_EXIT_DUP3, this );
+    return ret;
+    }
+
+//
+//Cancel the outgoing request of sending
+//
+
+void CNcmDataSender::DoCancel()
+    {
+    OstTraceFunctionEntry1( CNCMDATASENDER_DOCANCEL_ENTRY, this );
+    iPort.WriteCancel(iEpOut.BufferNumber());
+    OstTraceFunctionExit1( CNCMDATASENDER_DOCANCEL_EXIT, this );
+    }
+
+void CNcmDataSender::SendNtbPayload(TNcmBuffer& aBuf)
+    {
+    OstTraceFunctionEntry1( CNCMDATASENDER_SENDNTBPAYLOAD_ENTRY, this );
+    OstTraceExt2( TRACE_NORMAL, CNCMDATASENDER_SENDNTBPAYLOAD, "SendNtbPayload:%08x, len=%d", (TUint)aBuf.iPtr, aBuf.iLen);
+
+    if (iIsSending)
+        {
+        OstTrace0( TRACE_NORMAL, CNCMDATASENDER_SENDNTBPAYLOAD1, "SendNtbPayload: there is NTB on sending, store the buffer" );
+        iTxArray.Append(aBuf);
+        OstTraceFunctionExit1( CNCMDATASENDER_SENDNTBPAYLOAD_EXIT, this );
+        return;
+        }
+
+    iSendingBuffer = aBuf;
+    iIsSending = ETrue;
+
+    iStatus = KRequestPending;
+    TInt ret;
+    //
+    //   compliant to NCM spec with Zlp case
+    //
+    if (aBuf.iLen == NtbInMaxSize())
+        {
+        OstTrace0( TRACE_NORMAL, CNCMDATASENDER_SENDNTBPAYLOAD2, "iEpOut.WriteBuffer without zlp" );
+        ret = iEpOut.WriteBuffer((TAny*)aBuf.iPtr, aBuf.iLen, EFalse, iStatus);
+        }
+    else
+        {
+        OstTrace0( TRACE_NORMAL, CNCMDATASENDER_SENDNTBPAYLOAD3, "iEpOut.WriteBuffer with zlp" );
+        ret = iEpOut.WriteBuffer((TAny*)aBuf.iPtr, aBuf.iLen, ETrue, iStatus);
+        }
+    if (ret == KErrNone && !IsActive())
+        {
+        SetActive();
+        }
+    else
+        {
+        OstTrace1( TRACE_FATAL, CNCMDATASENDER_SENDNTBPAYLOAD4, "iEpOut.WriteBuffer failed ret = %d", ret);
+        iParent.DataError(ret);
+        }
+    OstTraceFunctionExit1( CNCMDATASENDER_SENDNTBPAYLOAD_EXIT_DUP1, this );
+    return;
+    }
+
+//
+// called when a sender request is completed by LDD
+//
+
+void CNcmDataSender::SendNtbComplete()
+    {
+    OstTraceFunctionEntry1( CNCMDATASENDER_SENDNTBCOMPLETE_ENTRY, this );
+
+    iIsSending = EFalse;
+    iBufferManager->FreeBuffer(iSendingBuffer);
+    iBuildPolicy->UpdateFreeBufferCount(iBufferManager->FreeBufferCount());
+
+    // when buffer manage has enough buffers, notify networking to stop flow control
+    if (!iBufferManager->IsCongestion() && iStopSending)
+        {
+        iStopSending = EFalse;
+        iParent.ResumeSending();
+        }
+    if (iTxArray.Count())
+        {
+        OstTrace0( TRACE_NORMAL, CNCMDATASENDER_SENDNTBCOMPLETE3, "send NTB in sending queue" );
+        SendNtbPayload(iTxArray[0]);
+        iTxArray.Remove(0);
+        }
+    OstTraceFunctionExit1( CNCMDATASENDER_SENDNTBCOMPLETE_EXIT, this );
+    }
+
+void CNcmDataSender::GetNtbParam(TNcmNtbInParam& aParam)
+    {
+    iNtbBuilder->GetNtbParam(aParam);
+    }
+
+TInt CNcmDataSender::SetNtbInMaxSize(TInt aSize, TBool aIsAltZero)
+    {
+    OstTraceFunctionEntry1( CNCMDATASENDER_SETNTBINMAXSIZE_ENTRY, this );
+    OstTrace1( TRACE_NORMAL, CNCMDATASENDER_SETNTBINMAXSIZE, "SetNtbInMaxSize %d", aSize);
+
+    TInt ret = iNtbBuilder->SetNtbInMaxSize(aSize);
+    if (ret != KErrNone)
+        {
+        OstTrace1( TRACE_FATAL, CNCMDATASENDER_SETNTBINMAXSIZE1, "iNtbBuilder->SetNtbInMaxSize failed %d", ret);
+        OstTraceFunctionExit1( CNCMDATASENDER_SETNTBINMAXSIZE_EXIT, this );
+        return ret;
+        }
+
+//
+//if sender is not started, endpoint buffer is not setup, so does not call SetBufferCellSize
+//
+    if (!iStarted)
+        {
+        OstTraceFunctionExit1( CNCMDATASENDER_SETNTBINMAXSIZE_EXIT_DUP1, this );
+        return KErrNone;
+        }
+
+//    if not in alternate setting 0, there may be data in buffer, so doesn't reset buffers.
+    if (!aIsAltZero)
+        {
+        OstTraceFunctionExit1( CNCMDATASENDER_SETNTBINMAXSIZE_EXIT_DUP2, this );
+        return KErrNone;
+        }
+
+    OstTraceFunctionExit1( CNCMDATASENDER_SETNTBINMAXSIZE_EXIT_DUP4, this );
+    return KErrNone;
+    }
+
+
+void CNcmDataSender::Stop()
+    {
+    OstTraceFunctionEntry1( CNCMDATASENDER_STOP_ENTRY, this );
+    Cancel();
+    iBuildPolicy->Cancel();
+    iNtbBuilder->Reset();
+    iTxArray.Reset();
+    iEpOut.Close();
+    iStopSending = EFalse;
+    iStarted = EFalse;
+    iIsSending = EFalse;
+    OstTraceFunctionExit1( CNCMDATASENDER_STOP_EXIT, this );
+    }
+
+// call this function to notify the buffer size of In endpoint buffer size of LDD and adjust the MaxInNtbSize supported
+// report to host
+
+TInt CNcmDataSender::SetInEpBufferSize(TUint aSize)
+    {
+    OstTraceFunctionEntry1( CNCMDATASENDER_SETINEPBUFFERSIZE_ENTRY, this );
+    TInt ret = KErrNone;
+    TUint size = aSize;
+
+	OstTrace1( TRACE_NORMAL, CNCMDATASENDER_SETINEPBUFFERSIZE, "SetInEpBufferSize aSize=%d", aSize);
+
+
+// the buffer may not aligned, so decrease max possible offset due to aligment
+    size -= KAlignSize-1;
+    TInt ntbSize = iNtbBuilder->NtbInMaxSize();
+    TInt cellSize = KAlignSize;
+    TInt minNtbInMaxSize = iNtbBuilder->MinNtbInMaxSize();
+    TInt count;
+    TBool find = EFalse;
+    while (ntbSize >= minNtbInMaxSize)
+        {
+        cellSize = (ntbSize+KAlignSize-1)&~(KAlignSize-1);
+        count = size / cellSize;
+        if (count < iBufferManager->RequiredBufferCount())
+            {
+            ntbSize /= 2;
+            continue;
+            }
+        find = ETrue;
+        break;
+        }
+
+    if (ntbSize == iNtbBuilder->NtbInMaxSize())
+        {
+        ret = KErrNone;
+        }
+    else if (find)
+        {
+        ret = iNtbBuilder->SetNtbInMaxSize(cellSize);
+        }
+    else
+        {
+        ret = KErrGeneral;
+        }
+    OstTraceFunctionExit1( CNCMDATASENDER_SETINEPBUFFERSIZE_EXIT, this );
+    return ret;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/src/ncmengine.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,506 @@
+/*
+* 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:
+*
+*/
+
+#include "ncmengine.h"
+#include "ncmpktdrv.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "ncmengineTraces.h"
+#endif
+
+
+
+const TUint8 KDataIFAltSet1 = 1;
+
+/**
+Create a new CNcmControlEngine object.
+*/
+CNcmEngine *CNcmEngine::NewL(CNcmPktDrv& aPktDrv)
+    {
+    OstTraceFunctionEntry0( CNCMENGINE_NEWL );
+
+    CNcmEngine *self=new (ELeave) CNcmEngine(aPktDrv);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+
+    OstTraceFunctionExit1( CNCMENGINE_NEWL_DUP01, self );
+    return self;
+    }
+
+/**
+Create the CNcmEngine object.
+*/
+void CNcmEngine::ConstructL()
+    {
+    OstTraceFunctionEntry0( CNCMENGINE_CONSTRUCTL );
+
+    RandomMacAddressL(iSymbianMacAddress);
+
+    iSharedStateManager = CNcmSharedStateManager::NewL(*this);
+    iDataInterface = CNcmDataInterface::NewL(*this, iDataLdd);
+    iCommInterface = CNcmCommunicationInterface::NewL(*this, iCommLdd);
+
+    OstTraceFunctionExit0( CNCMENGINE_CONSTRUCTL_DUP01 );
+    }
+
+/**
+Constructor.
+@param aPktDrv Pointer to NCM Packet Driver.
+*/
+CNcmEngine::CNcmEngine(CNcmPktDrv& aPktDrv) : CActive(CActive::EPriorityStandard),
+                                    iPktDrv(aPktDrv)
+    {
+    CActiveScheduler::Add(this);
+    }
+
+/**
+Destructor.
+*/
+CNcmEngine::~CNcmEngine()
+    {
+    OstTraceFunctionEntry0( CNCMENGINE_CNCMENGINE_DUP10 );
+
+    //double check for possibly missed by PktDrvBase's StopInterface;
+    Stop();
+
+    delete iCommInterface;
+    delete iDataInterface;
+    delete iSharedStateManager;
+
+    OstTraceFunctionExit0( CNCMENGINE_CNCMENGINE_DUP11 );
+    }
+
+/**
+ * Initialize the DataInterface's and CommInterface's LDD instances with transferred handle.
+ */
+void CNcmEngine::InitLddL(const RMessagePtr2& aMsg)
+    {
+    OstTraceFunctionEntry0( CNCMENGINE_INITLDDL );
+
+    const TUint KCommLddOffset = 0;                     //0
+    const TUint KCommChunkOffset = KCommLddOffset + 1;  //1
+    const TUint KDataLddOffset = KCommChunkOffset + 1;  //2
+    const TUint KDataChunkOffset = KDataLddOffset + 1;  //3
+    const TUint KHandlesInStackCount = 3;
+
+    User::LeaveIfError(iCommLdd.Open(aMsg, KCommLddOffset, EOwnerProcess));
+    CleanupClosePushL(iCommLdd);
+
+    RChunk* chunk;
+    //Get the Ldd's RChunk, but don't own it.
+    User::LeaveIfError(iCommLdd.GetDataTransferChunk(chunk));
+
+    User::LeaveIfError(chunk->Open(aMsg, KCommChunkOffset, FALSE, EOwnerProcess));
+    CleanupClosePushL(*chunk);
+
+    User::LeaveIfError(iDataLdd.Open(aMsg, KDataLddOffset, EOwnerProcess));
+    CleanupClosePushL(iDataLdd);
+
+    User::LeaveIfError(iDataLdd.GetDataTransferChunk(chunk));
+    User::LeaveIfError(chunk->Open(aMsg, KDataChunkOffset, FALSE, EOwnerProcess));
+
+    CleanupStack::Pop(KHandlesInStackCount);
+
+    OstTraceFunctionExit0( CNCMENGINE_INITLDDL_DUP01 );
+    }
+
+/**
+ * Start Engine to initialize LDD, and start monitor LDD device status changes.
+ */
+TInt CNcmEngine::Start(RMessagePtr2& aMsg)
+    {
+    OstTraceFunctionEntry0( CNCMENGINE_START );
+
+    __ASSERT_DEBUG(iEngineState == ENcmStateUninitialized, User::Panic(KEnginePanic, __LINE__));
+    if (ENcmStateUninitialized != iEngineState)
+        {
+        OstTraceFunctionExitExt( CNCMENGINE_START_DUP10, this, KErrNotSupported );
+        return KErrNotSupported;
+        }
+
+    TRAPD(err, InitLddL(aMsg));
+    if (KErrNone != err)
+        {
+        OstTrace1( TRACE_ERROR, CNCMENGINE_START_DUP01, "InitLdd return error=%d;", err );
+        return err;
+        }
+
+    if (KErrNone != iCommLdd.DeviceStatus(reinterpret_cast<TUsbcDeviceState&>(iDeviceState)))
+        {
+        RChunk* commChunk = NULL;
+        RChunk* dataChunk = NULL;
+        iCommLdd.GetDataTransferChunk(commChunk);
+        iDataLdd.GetDataTransferChunk(dataChunk);
+        commChunk->Close();
+        dataChunk->Close();
+        iDataLdd.Close();
+        iCommLdd.Close();
+        OstTraceFunctionExitExt( CNCMENGINE_START_DUP11, this, KErrNotReady );
+        return KErrNotReady;
+        }
+    OstTrace1( TRACE_NORMAL, CNCMENGINE_START_DUP02, "CommLdd DeviceStatus=%d", iDeviceState);
+
+    if (EUsbcDeviceStateConfigured == iDeviceState)
+        {
+        iStatus = KRequestPending;
+        TRequestStatus* reportStatus = &iStatus;
+        SetActive();
+
+        User::RequestComplete(reportStatus, KErrNone);
+        }
+    else
+        {
+        iCommLdd.AlternateDeviceStatusNotify(iStatus, iDeviceState);
+        SetActive();
+        }
+
+    iDataInterface->ActivateLdd();
+
+    iEngineState = ENcmStateStarting;
+
+    OstTraceFunctionExitExt( CNCMENGINE_START_DUP12, this, KErrNone );
+    return KErrNone;
+    }
+
+/**
+ * Monitor the USB device State, Start/Stop Communication/Data Interface
+ */
+void CNcmEngine::RunL()
+    {
+    OstTraceExt2( TRACE_NORMAL, CNCMENGINE_RUNL, "iDeviceState=%d;iStatus.Int()=%d", iDeviceState, iStatus.Int() );
+
+    if (KErrNone == iStatus.Int())
+        {
+        iCommLdd.AlternateDeviceStatusNotify(iStatus, iDeviceState);
+        SetActive();
+        }
+    else
+        {
+        iPktDrv.FatalErrorNotification(iStatus.Int());
+        Stop();
+        return;
+        }
+
+    switch(iDeviceState)
+        {
+        case EUsbcDeviceStateConfigured:
+            if (!iCommInterface->IsStarted())
+                {
+                iCommInterface->Start();
+
+                StartDataLayer();
+                }
+            break;
+
+        case EUsbcDeviceStateSuspended:
+            StopDataLayer();
+            break;
+
+        case EUsbcDeviceStateUndefined:
+
+			iDataLdd.ResetAltSetting();
+            StopDataLayer();
+            if (iCommInterface->IsStarted())
+                {
+                iCommInterface->Stop();
+                }
+            break;
+
+        default:
+            //do nothing here.
+            break;
+        }
+    }
+
+/**
+AO cancel
+*/
+void CNcmEngine::DoCancel()
+    {
+    OstTraceFunctionEntry0( CNCMENGINE_DOCANCEL );
+    iCommLdd.AlternateDeviceStatusNotifyCancel();
+    }
+
+/**
+ * Fatal error report from Control Channel
+ */
+void CNcmEngine::ControlError(TInt aError)
+    {
+    OstTrace1( TRACE_NORMAL, CNCMENGINE_CONTROLERROR, "aError=%d", aError );
+
+    iPktDrv.FatalErrorNotification(aError);
+    Stop();
+    }
+
+/**
+ *Enter the started state.
+ */
+void CNcmEngine::DoNcmStarted()
+    {
+    OstTraceFunctionEntry0( CNCMENGINE_DONCMSTARTED );
+
+    iDataInterface->Start();
+    TInt speed = 0;
+    iDataInterface->GetSpeed(speed);
+
+    iCommInterface->SendSpeedNotification(speed, speed);
+    iCommInterface->SendConnectionNotification(ETrue);
+
+    __ASSERT_DEBUG(((iEngineState==ENcmStateStarting) || (iEngineState==ENcmStatePaused)), User::Panic(KEnginePanic, __LINE__));
+    iEngineState = ENcmStateStarted;
+    iSharedStateManager->NotifyNcmConnected();
+    }
+
+/**
+ *Start the data channel
+ */
+void CNcmEngine::StartDataLayer()
+    {
+    OstTraceFunctionEntry0( CNCMENGINE_STARTDATALAYER );
+
+    if (iDataInterface->IsStarted())
+        {
+        OstTrace0( TRACE_WARNING, CNCMENGINE_STARTDATALAYER_DUP01, "The DataIf has already been started!" );
+
+        __ASSERT_DEBUG(0, User::Panic(KEnginePanic, __LINE__));
+        return;
+        }
+
+    if (KDataIFAltSet1 != iDataInterface->AltSetting())
+        {
+        OstTrace0( TRACE_NORMAL, CNCMENGINE_STARTDATALAYER_DUP02, "Data Interface is not ready to start; it's fine!!" );
+        return;
+        }
+
+    TInt ret = iSharedStateManager->NotifyDhcpProvisionRequested();
+    if (KErrAlreadyExists == ret)
+        {
+        DoNcmStarted();
+        }
+    else
+        {
+        if (KErrNone != ret)
+            {
+            //minus error when try to set IPBearerCoexistence P&S key. just continue...
+            OstTrace1( TRACE_WARNING, CNCMENGINE_STARTDATALAYER_DUP03, "SharedStateManager issued dhcp request return error:;ret=%d", ret );
+            }
+
+        iCommInterface->SendConnectionNotification(EFalse);
+
+        if (ENcmStatePaused == iEngineState)
+            {
+            iEngineState = ENcmStateStarting;
+            }
+        }
+    }
+
+/**
+ *Stop the data channel
+ */
+void CNcmEngine::StopDataLayer()
+    {
+    OstTraceFunctionEntry0( CNCMENGINE_STOPDATALAYER );
+
+    if (iDataInterface->IsStarted())
+        {
+        __ASSERT_DEBUG((iEngineState==ENcmStateStarted), User::Panic(KEnginePanic, __LINE__));
+        iEngineState = ENcmStatePaused;
+        iSharedStateManager->NotifyNcmDisconnected(KErrNone);
+
+        iDataInterface->Stop();
+        }
+    }
+
+/**
+ *Stop NCM
+ */
+void CNcmEngine::Stop()
+    {
+    OstTraceFunctionEntry0( CNCMENGINE_STOP );
+
+    if (ENcmStateStarted == iEngineState ||
+        ENcmStatePaused == iEngineState ||
+        ENcmStateStarting == iEngineState)
+        {
+        Cancel();
+        iDataInterface->Cancel();
+
+        if (iDataInterface->IsStarted())
+            {
+            iDataInterface->Stop();
+            }
+
+        if (iCommInterface->IsStarted())
+            {
+            iCommInterface->Stop();
+            }
+
+        RChunk* commChunk = NULL;
+        RChunk* dataChunk = NULL;
+
+        iCommLdd.GetDataTransferChunk(commChunk);
+        iDataLdd.GetDataTransferChunk(dataChunk);
+        commChunk->Close();
+        dataChunk->Close();
+        iDataLdd.Close();
+        iCommLdd.Close();
+        }
+
+    if (ENcmStateStarted == iEngineState ||
+        ENcmStateStarting == iEngineState)
+        {
+        iSharedStateManager->NotifyNcmDisconnected(KErrNone);
+        }
+    iEngineState = ENcmStateStopped;
+    }
+
+/**
+ * Send the ethernet frame to USB Host.
+*/
+TInt CNcmEngine::Send(RMBufChain &aPacket)
+    {
+    OstTraceExt2( TRACE_NORMAL, CNCMENGINE_SEND, "aPacket=%x;aPacket.Length()=%d", ( TUint )&( aPacket ), aPacket.Length() );
+
+    return iDataInterface->Send(aPacket);
+    }
+
+/**
+Get the Hardware address of the LAN Device
+@return MAC address of the Symbian device
+*/
+TUint8* CNcmEngine::InterfaceAddress()
+    {
+    OstTraceExt3( TRACE_NORMAL, CNCMENGINE_INTERFACEADDRESS, "Local MAC is 02:00:00:%02X:%02X:%02X.", iSymbianMacAddress[3], iSymbianMacAddress[4], iSymbianMacAddress[5]);
+    return static_cast<TUint8*>(&iSymbianMacAddress[0]);
+    }
+
+void CNcmEngine::RandomMacAddressL(TNcmMacAddress& aMacAddress)
+    {
+    OstTrace1( TRACE_NORMAL, CNCMENGINE_RANDOMMACADDRESSL, "aMacAddress=%x", ( TUint )&( aMacAddress ) );
+    //random the MAC address
+    aMacAddress.SetLength(KEthernetAddressLength);
+    const TUint KOUILength = 3;
+    const TInt len = KEthernetAddressLength - KOUILength;
+
+    TPtr8 ptr(&aMacAddress[0] + KOUILength,  len, len);
+    TRandom::RandomL(ptr);
+
+    //mark it as locally managed address
+    aMacAddress[0] = 0x02;
+    aMacAddress[1] = 0x00;
+    aMacAddress[2] = 0x00;
+    }
+
+/** MControlInterfaceObserver
+ * Set Ntb Input Size. See NCM1.0 spec.
+ */
+TInt CNcmEngine::HandleSetNtbInputSize(TDes8& aSize)
+    {
+    OstTraceFunctionEntry1( CNCMENGINE_HANDLESETNTBINPUTSIZE, ( TUint )&( aSize ) );
+
+    return iDataInterface->SetNtbInputSize(aSize);
+    }
+
+/**
+ * Set Ntb Parameters. See NCM1.0 spec.
+ */
+TInt CNcmEngine::HandleGetNtbParam(TDes8& aReturnBuf)
+    {
+    OstTraceFunctionEntry1( CNCMENGINE_HANDLEGETNTBPARAM, ( TUint )&( aReturnBuf ) );
+
+    return iDataInterface->GetNtbParam(aReturnBuf);
+    }
+
+/**
+ * Get Ntb Input Size. See NCM1.0 spec.
+ */
+TInt CNcmEngine::HandleGetNtbInputSize(TDes8& aSize)
+    {
+    OstTraceFunctionEntry1( CNCMENGINE_HANDLEGETNTBINPUTSIZE, ( TUint )&( aSize ) );
+
+    return iDataInterface->GetNtbInputSize(aSize);
+    }
+
+/**
+ * Enable NCM connection by setting NCM speed & connection, when notified that DHCP Provison done successfully.
+ */
+void CNcmEngine::NotifyDhcpStarted()
+    {
+    OstTraceFunctionEntry0( CNCMENGINE_NOTIFYDHCPSTARTED );
+    __ASSERT_DEBUG(!iDataInterface->IsStarted(), User::Panic(KEnginePanic, __LINE__));
+    if (iDeviceState != EUsbcDeviceStateConfigured || KDataIFAltSet1 != iDataInterface->AltSetting())
+        {
+        OstTraceExt2( TRACE_WARNING, CNCMENGINE_NOTIFYDHCPSTARTED_DUP01, "NotifyDhcpStarted comes so later;iDeviceState=%d;iDataInterface->AltSetting()=%d", iDeviceState, iDataInterface->AltSetting() );
+        return;
+        }
+
+    DoNcmStarted();
+    }
+
+/**
+ *Upwards notify
+ * @param aPacket A Reference to a buffer holding data.
+ */
+void CNcmEngine::ProcessReceivedDatagram(RMBufPacket& aPacket)
+    {
+    OstTraceExt2( TRACE_NORMAL, CNCMENGINE_PROCESSRECEIVEDDATAGRAM, "aPacket=%x;aPacket.Length()=%d", ( TUint )&( aPacket ), aPacket.Length() );
+    iPktDrv.ReceiveEthFrame(aPacket);
+    }
+
+/**
+ * Resume Sending is a notification call into NIF from the lower layer telling the NIF that a
+ * previous sending congestion situation has been cleared and it can accept more downstack data.
+ */
+void CNcmEngine::ResumeSending()
+    {
+    OstTraceFunctionEntry0( CNCMENGINE_RESUMESENDING );
+    iPktDrv.ResumeSending();
+    }
+
+/**
+ * Error report from Data Channel
+ */
+void CNcmEngine::DataError(TInt aError)
+    {
+    OstTrace1( TRACE_ERROR, CNCMENGINE_DATAERROR, "CNcmEngine::DataError;aError=%d", aError );
+
+    iPktDrv.FatalErrorNotification(aError);
+    }
+/**
+ * Handle the data interface alt setting changes.
+ */
+void CNcmEngine::HandleAltSetting(TInt aIfAltSet)
+    {
+    OstTraceExt3( TRACE_NORMAL, CNCMENGINE_HANDLEALTSETTING, "CNcmEngine::HandleAltSetting;aIfAltSet=%d;iDataInterface->AltSetting()=%d;iDeviceState=%d", aIfAltSet, iDataInterface->AltSetting(), (TInt) iDeviceState );
+
+    if (KDataIFAltSet1 == aIfAltSet)
+        {
+        StartDataLayer();
+        }
+    else
+        {
+        StopDataLayer();
+        }
+    }
+
+TInt CNcmEngine::SetInEpBufferSize(TUint aSize)
+    {
+    OstTrace1( TRACE_NORMAL, CNCMENGINE_SETINEPBUFFERSIZE, "aSize=%u", aSize );
+    return iDataInterface->SetInEpBufferSize(aSize);
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/src/ncmnotificationdescriptor.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,77 @@
+/*
+* 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:
+* implementation for NCM notification message class 
+*
+*/
+
+
+/**
+@file
+@internalComponent
+*/
+
+
+#include <es_sock.h>
+#include "ncmnotificationdescriptor.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+//
+
+
+//
+// This function packs the TUSBNotificationNetworkConnection class into a descriptor with 
+// the correct byte alignment for transmission on the USB bus.
+
+
+TDes8& TUSBNotificationNetworkConnection::Des()
+    {
+    TUint index = 0;
+
+    iBuffer.SetLength(KUSBNotificationNetworkConnection);
+    iBuffer[index++] = iRequestType;
+    iBuffer[index++] = iNotification;
+    LittleEndian::Put16(&iBuffer[index], iValue);
+    index += 2;
+    LittleEndian::Put16(&iBuffer[index], iIndex);
+    index += 2;
+    LittleEndian::Put16(&iBuffer[index], iLength);
+    return iBuffer;
+    }
+
+//
+//This function packs the TUSBNotificationConnectionSpeedChange class into a descriptor with 
+//the correct byte alignment for transmission on the USB bus.
+
+TDes8& TUSBNotificationConnectionSpeedChange::Des()
+    {
+    TUint index = 0;
+
+    iBuffer.SetLength(KUSBNotificationConnectionSpeedChange);
+    iBuffer[index++] = iRequestType;
+    iBuffer[index++] = iNotification;
+    LittleEndian::Put16(&iBuffer[index], iValue);
+    index += 2;
+    LittleEndian::Put16(&iBuffer[index], iIndex);
+    index += 2;
+    LittleEndian::Put16(&iBuffer[index], iLength);
+    index += 2;
+    LittleEndian::Put32(&iBuffer[index], iUSBitRate);
+    index += 4;
+    LittleEndian::Put32(&iBuffer[index], iDSBitRate);
+    return iBuffer;
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/src/ncmntb16builder.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,269 @@
+/*
+* 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:
+* implementation for NTB16 build  class
+*
+*/
+
+
+
+/**
+@file
+@internalComponent
+*/
+
+
+
+#include <es_sock.h>
+#ifndef __OVER_DUMMYUSBSCLDD__
+#include <nifmbuf.h>
+#else
+#include <usb/testncm/ethinter.h>
+#endif
+#include "ncmntb16builder.h"
+#include "ncmntbbuildpolicy.h"
+#include "ncmpktdrvcommon.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "ncmntb16builderTraces.h"
+#endif
+
+
+const TInt KNtb16InMaxSize = 32768;
+
+
+const TInt KNth16Signature = 0x484D434E;
+const TInt KNth16Length = 0x0C;
+
+const TInt KNdp16Signature = 0x304D434E;
+const TInt KNdp16HeaderSize = 8;
+const TInt KNdp16EntrySize = 4;
+const TInt KNdp16InDivisor = 4;
+const TInt KNdp16InRemainder = 0;
+const TInt KNdp16InAlignment = 4;
+
+
+// ======== MEMBER FUNCTIONS ========
+//
+
+
+CNcmNtbBuilder* CNcmNtb16Builder::NewL(MNcmNtbBuildObserver& aObserver)
+    {
+    OstTraceFunctionEntry1( CNCMNTB16BUILDER_NEWL_ENTRY, ( TUint )&( aObserver ) );
+    CNcmNtb16Builder *self=new (ELeave) CNcmNtb16Builder(aObserver);
+    self->ConstructL();
+    OstTraceFunctionExit0( CNCMNTB16BUILDER_NEWL_EXIT );
+    return self;    
+    }
+
+CNcmNtb16Builder::CNcmNtb16Builder(MNcmNtbBuildObserver& aObserver)
+    : CNcmNtbBuilder(aObserver)
+    {
+    }
+
+void CNcmNtb16Builder::ConstructL()
+    {
+    iNtbInMaxSize = KNtb16InMaxSize;
+    iNdpInDivisor = KNdp16InDivisor;
+    iNdpInPayloadRemainder = KNdp16InRemainder;
+    iNdpInAlignment = KNdp16InAlignment;  
+    }
+
+CNcmNtb16Builder::~CNcmNtb16Builder()
+    {
+    iPacketsArray.Reset();
+    }
+
+
+TInt CNcmNtb16Builder::SetNtbInMaxSize(TInt aSize)
+    {
+    OstTraceFunctionEntry1( CNCMNTB16BUILDER_SETNTBINMAXSIZE_ENTRY, this );
+    if (aSize > KNtb16InMaxSize || aSize < MinNtbInMaxSize())
+        {
+        OstTraceFunctionExit1( CNCMNTB16BUILDER_SETNTBINMAXSIZE_EXIT, this );
+        return KErrArgument;
+        }
+    iNtbInMaxSize = aSize;
+    OstTraceFunctionExit1( CNCMNTB_DUP116BUILDER_SETNTBINMAXSIZE_EXIT, this );
+    return KErrNone;
+    }
+
+//
+//construct NTB header information
+//
+
+void CNcmNtb16Builder::BuildNtbHeader()
+    {
+    OstTraceFunctionEntry1( CNCMNTB16BUILDER_BUILDNTBHEADER_ENTRY, this );
+    TPtr8 buf(iBuffer.iPtr, KNth16Length, KNth16Length);
+    TInt pos = 0;
+    LittleEndian::Put32(&buf[pos], KNth16Signature);
+    pos += 4;
+    LittleEndian::Put16(&buf[pos], KNth16Length);
+    pos += 2;
+    LittleEndian::Put16(&buf[pos], iSequence);
+    pos += 2;
+    LittleEndian::Put32(&buf[pos], iNdpOffset+iNdpLength);
+    pos += 2;
+    LittleEndian::Put16(&buf[pos], iNdpOffset);
+    pos += 2;
+
+    OstTraceExt3( TRACE_NORMAL, CNCMNTB16BUILDER_BUILDNTBHEADER, "CNcmNtb16Builder::BuildNtbHeader %d %d %d", iSequence, iNdpOffset, iNdpOffset+iNdpLength );
+    OstTraceFunctionExit1( CNCMNTB16BUILDER_BUILDNTBHEADER_EXIT, this );
+    }
+
+
+//
+//construct NDP inforamtion
+//
+
+void CNcmNtb16Builder::BuildNdp()
+    {
+    OstTraceFunctionEntry1( CNCMNTB16BUILDER_BUILDNDP_ENTRY, this );
+    TPtr8 buf(iBuffer.iPtr+iNdpOffset, iNdpLength, iNdpLength);
+    TInt pos = 0;
+
+    LittleEndian::Put32(&buf[pos], KNdp16Signature);
+    pos += 4;
+    LittleEndian::Put16(&buf[pos], iNdpLength);
+    pos += 2;
+    LittleEndian::Put16(&buf[pos], 0);
+    pos += 2;
+     
+    TInt i;
+    for (i=0 ; i<iPacketsArray.Count() ; i++)
+        {
+        LittleEndian::Put16(&buf[pos], iPacketsArray[i].iWDatagramIndex);
+        pos += 2;
+        LittleEndian::Put16(&buf[pos], iPacketsArray[i].iWDatagramLength);
+        pos += 2;
+        }
+    LittleEndian::Put16(&buf[pos], 0);
+    pos += 2;
+    LittleEndian::Put16(&buf[pos], 0);
+    pos += 2;
+    OstTraceFunctionExit1( CNCMNTB16BUILDER_BUILDNDP_EXIT, this );
+    }
+
+
+//
+//Append a datagram to NTB
+//
+
+TInt CNcmNtb16Builder::AppendPacket(const RMBufChain& aPacket)
+    {
+    OstTraceFunctionEntry1( CNCMNTB16BUILDER_APPENDPACKET_ENTRY, this );
+// datagram must align with  iNdpInDivisor and remainder is iNdpInPayloadRemainder, refer to NCM spec 3.34 for detail   
+    TInt len = aPacket.Length();
+    TInt alignedDataOffset;
+    int remainder = iDatagramOffset%iNdpInDivisor;
+    if (iNdpInPayloadRemainder < remainder)
+        {
+        alignedDataOffset = iDatagramOffset + iNdpInDivisor - remainder + iNdpInPayloadRemainder;  
+        }
+    else
+        {
+        alignedDataOffset = iDatagramOffset + (iNdpInPayloadRemainder-remainder);
+        }
+    TInt newDatagramOffset = alignedDataOffset+len;
+// NDP must align with  iNdpInAlignment, refer to NCM spec Table 6-3 for detail         
+    TInt newNdpOffset = (newDatagramOffset+iNdpInAlignment-1)&~(iNdpInAlignment-1);
+
+//    must have a zero entry in the end of NDP, so the NDP length is added with KNdp16EntrySize
+    TInt newNdpLen = iNdpLength + KNdp16EntrySize;
+
+//   iBuffer.iMaxLength and iNtbInMaxSize may not same.
+    if (newNdpLen+newNdpOffset > iBuffer.iMaxLength || newNdpLen+newNdpOffset > iNtbInMaxSize)
+        {
+        CompleteNtbBuild();
+        OstTraceFunctionExit1( CNCMNTB16BUILDER_APPENDPACKET_EXIT, this );
+        return KErrBufferFull;
+        }
+
+    TPtr8 ptr((TUint8*)(alignedDataOffset+iBuffer.iPtr), len, len);
+    aPacket.CopyOut(ptr);
+    TDatagramEntry entry;
+    entry.iWDatagramIndex = alignedDataOffset;
+    entry.iWDatagramLength = len;
+    iPacketsArray.Append(entry);
+    iNdpOffset = newNdpOffset;
+    iNdpLength = newNdpLen;     
+    iDatagramOffset = newDatagramOffset;
+    if (iBuildPolicy)
+        {
+        iBuildPolicy->UpdateNtb(iNdpOffset+iNdpLength);
+        }
+    OstTraceFunctionExit1( CNCMNTB_DUP116BUILDER_APPENDPACKET_EXIT, this );
+    return KErrNone;
+    }
+
+//
+//complete a NTB, is called by buildpolicy or current NTB is full.
+//
+
+
+void CNcmNtb16Builder::CompleteNtbBuild()
+    {
+    OstTraceFunctionEntry1( CNCMNTB16BUILDER_COMPLETENTBBUILD_ENTRY, this );
+    
+    BuildNtbHeader();
+    BuildNdp();
+    iBuffer.iLen = iNdpOffset+iNdpLength;
+    SendNtbPayload();
+    CNcmNtbBuilder::CompleteNtbBuild();    
+    OstTraceFunctionExit1( CNCMNTB16BUILDER_COMPLETENTBBUILD_EXIT, this );
+    }
+
+
+//
+//start a new ntb, is called by sender
+//
+
+void CNcmNtb16Builder::StartNewNtb(const TNcmBuffer& aBuffer)
+    {
+    OstTraceFunctionEntry1( CNCMNTB16BUILDER_STARTNEWNTB_ENTRY, this );
+    
+    iBuffer = aBuffer;
+    iNdpOffset = 0;
+    iNdpLength = 0;
+    iPacketsArray.Reset();
+    iDatagramOffset = KNth16Length;
+// NDP must align with  iNdpInAlignment, refer to NCM spec Table 6-3 for detail     
+    iNdpOffset = (iDatagramOffset+iNdpInAlignment-1)&~(iNdpInAlignment-1);
+//    must have a zero entry in the end of NDP, so the NDP length is added with KNdp16EntrySize
+    iNdpLength = KNdp16HeaderSize + KNdp16EntrySize;
+    
+    if (iBuildPolicy)
+        {
+        iBuildPolicy->StartNewNtb();
+        }
+    CNcmNtbBuilder::StartNewNtb(aBuffer);
+    OstTraceFunctionExit1( CNCMNTB16BUILDER_STARTNEWNTB_EXIT, this );
+    }
+
+
+void CNcmNtb16Builder::Reset()
+    {
+    OstTraceFunctionEntry1( CNCMNTB16BUILDER_RESET_ENTRY, this );
+    iNtbInMaxSize = KNtb16InMaxSize;
+    iNdpOffset = 0;
+    iNdpLength = 0;    
+    iDatagramOffset = 0;    
+    iPacketsArray.Reset();
+    CNcmNtbBuilder::Reset();
+    OstTraceFunctionExit1( CNCMNTB16BUILDER_RESET_EXIT, this );
+    }
+    
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/src/ncmntbbuilder.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* 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:
+* implementation for NTB build  base class
+*
+*/
+
+
+/**
+@file
+@internalComponent
+*/
+
+
+
+#include "ncmntbbuilder.h"
+#include "ncmdatasender.h"
+#include "ncmpktdrvcommon.h"
+#include "ncmntbbuildpolicy.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+//
+
+
+CNcmNtbBuilder::CNcmNtbBuilder(MNcmNtbBuildObserver& aObserver)
+    : iObserver(aObserver)
+    {
+    iSequence = 0xFFFF;
+    }
+
+CNcmNtbBuilder::~CNcmNtbBuilder()
+    {
+    }
+
+void CNcmNtbBuilder::SendNtbPayload()
+    {
+    iObserver.SendNtbPayload(iBuffer);
+    }
+
+void CNcmNtbBuilder::StartNewNtb(const TNcmBuffer& aBuffer)
+    {
+    iSequence++;
+    iBuffer = aBuffer;
+    iNtbStarted = ETrue;
+    }
+
+void CNcmNtbBuilder::GetNtbParam(TNcmNtbInParam& aParam)
+    {
+    aParam.iNtbInMaxSize = iNtbInMaxSize;
+    aParam.iNdpInDivisor = iNdpInDivisor;
+    aParam.iNdpInPayloadRemainder = iNdpInPayloadRemainder;
+    aParam.iNdpInAlignment = iNdpInAlignment;
+    }
+
+void CNcmNtbBuilder::Reset()
+    {
+    iNtbStarted = EFalse;   
+    iSequence = 0xFFFF;
+    }
+
+void CNcmNtbBuilder::CompleteNtbBuild()
+    {    
+    iNtbStarted = EFalse;
+    iBuildPolicy->CompleteNtbBuild();    
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/src/ncmntbbuildpolicy.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* 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:
+* implementation for NTB build policy base class
+*
+*/
+
+
+/**
+@file
+@internalComponent
+*/
+
+
+#include "ncmntbbuildpolicy.h"
+
+// ======== MEMBER FUNCTIONS ========
+//
+
+CNcmNtbBuildPolicy::CNcmNtbBuildPolicy(CNcmNtbBuilder& aBuilder)
+    : CActive(CActive::EPriorityStandard), iNtbBuilder(aBuilder)
+    {
+    }
+
+CNcmNtbBuildPolicy::~CNcmNtbBuildPolicy()
+    {
+    }
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/src/ncmntbbuildsimplepolicy.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,160 @@
+/*
+* 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:
+* implementation for simple NTB build policy
+*
+*/
+
+
+/**
+@file
+@internalComponent
+*/
+
+
+#include "ncmntbbuildsimplepolicy.h"
+#include "ncmntbbuilder.h"
+#include "ncmpktdrvcommon.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "ncmntbbuildsimplepolicyTraces.h"
+#endif
+
+
+
+const TInt KMaxPacketsOfNtb = 10;
+const TInt KMaxPacketDelay = 1000;
+const TInt KMinFreeBuffers = 5;
+
+
+_LIT(KSimPolicyPanic, "CNcmNtbBuildSimplePolicy");
+const TInt KTimerError = 1;
+
+
+// ======== MEMBER FUNCTIONS ========
+//
+
+
+CNcmNtbBuildPolicy* CNcmNtbBuildSimplePolicy::NewL(CNcmNtbBuilder& aNtbBuilder)
+    {
+    OstTraceFunctionEntry1( CNCMNTBBUILDSIMPLEPOLICY_NEWL_ENTRY, ( TUint )&( aNtbBuilder ) );
+    CNcmNtbBuildSimplePolicy *self=new (ELeave) CNcmNtbBuildSimplePolicy(aNtbBuilder);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+    OstTraceFunctionExit0( CNCMNTBBUILDSIMPLEPOLICY_NEWL_EXIT );
+    return self;    
+    }
+
+CNcmNtbBuildSimplePolicy::CNcmNtbBuildSimplePolicy(CNcmNtbBuilder& aNtbBuilder)
+    : CNcmNtbBuildPolicy(aNtbBuilder)
+    {
+    CActiveScheduler::Add(this);
+    }
+
+CNcmNtbBuildSimplePolicy::~CNcmNtbBuildSimplePolicy()
+    {
+    OstTraceFunctionEntry1( CNCMNTBBUILDSIMPLEPOLICY_CNCMNTBBUILDSIMPLEPOLICY_ENTRY, this );
+    Cancel();
+    iTimer.Close();
+    OstTraceFunctionExit1( CNCMNTBBUILDSIMPLEPOLICY_CNCMNTBBUILDSIMPLEPOLICY_EXIT, this );
+    }
+
+void CNcmNtbBuildSimplePolicy::DoCancel()
+    {
+    OstTraceFunctionEntry1( CNCMNTBBUILDSIMPLEPOLICY_DOCANCEL_ENTRY, this );
+    iTimer.Cancel();
+    iPacketsCount = 0;    
+    OstTraceFunctionExit1( CNCMNTBBUILDSIMPLEPOLICY_DOCANCEL_EXIT, this );
+    }
+
+
+void CNcmNtbBuildSimplePolicy::ConstructL()
+    {
+    User::LeaveIfError(iTimer.CreateLocal());
+    }
+
+void CNcmNtbBuildSimplePolicy::RunL()
+    {
+    OstTraceFunctionEntry1( CNCMNTBBUILDSIMPLEPOLICY_RUNL_ENTRY, this );
+    OstTrace1( TRACE_NORMAL, CNCMNTBBUILDSIMPLEPOLICY_RUNL, "CNcmNtbBuildSimplePolicy::RunL Status=%d", iStatus.Int() );
+
+    if(iStatus.Int() != KErrNone)
+        {
+        User::Panic(KSimPolicyPanic, KTimerError);
+        OstTraceFunctionExit1( CNCMNTBBUILDSIMPLEPOLICY_RUNL_EXIT, this );
+        return;
+        }
+
+    if (iPacketsCount > 0)
+        {
+        iNtbBuilder.CompleteNtbBuild();
+        }
+    OstTraceFunctionExit1( CNCMNTBBUILDSIMPLEPOLICY_RUNL_EXIT_DUP1, this );
+    }
+
+void CNcmNtbBuildSimplePolicy::CompleteNtbBuild()
+    {
+    OstTraceFunctionEntry1( CNCMNTBBUILDSIMPLEPOLICY_COMPLETENTBBUILD_ENTRY, this );
+    
+    Cancel();
+    iPacketsCount = 0;
+    OstTraceFunctionExit1( CNCMNTBBUILDSIMPLEPOLICY_COMPLETENTBBUILD_EXIT, this );
+    }
+
+
+void CNcmNtbBuildSimplePolicy::StartNewNtb()
+    {
+    OstTraceFunctionEntry1( CNCMNTBBUILDSIMPLEPOLICY_STARTNEWNTB_ENTRY, this );    
+    OstTraceFunctionExit1( CNCMNTBBUILDSIMPLEPOLICY_STARTNEWNTB_EXIT, this );
+    }
+
+void CNcmNtbBuildSimplePolicy::UpdateNtb(TInt aSize)
+    {
+    OstTraceFunctionEntryExt( CNCMNTBBUILDSIMPLEPOLICY_UPDATENTB_ENTRY, this );
+    OstTrace1( TRACE_NORMAL, CNCMNTBBUILDSIMPLEPOLICY_UPDATENTB, "CNcmNtbBuildSimplePolicy::UpdateNtb aSize=%d", aSize );
+
+    if (iPacketsCount == 0)
+        {
+        iStatus = KRequestPending;
+        iTimer.After(iStatus, KMaxPacketDelay);
+        SetActive();
+        }
+    
+    if (KMaxPacketsOfNtb <= ++iPacketsCount && aSize >= iBufferSize/2)
+        {
+        iNtbBuilder.CompleteNtbBuild();
+        }
+   else if (iFreeBufferCount >= KMinFreeBuffers && aSize >= iBufferSize/8)
+        {
+        iNtbBuilder.CompleteNtbBuild();
+        }
+    OstTraceFunctionExit1( CNCMNTBBUILDSIMPLEPOLICY_UPDATENTB_EXIT, this );
+    }
+    
+void CNcmNtbBuildSimplePolicy::UpdateBufferSize(TInt aSize)
+    {
+    iBufferSize = aSize;
+    }
+
+void CNcmNtbBuildSimplePolicy::UpdateFreeBufferCount(TInt aCount)
+    {
+    iFreeBufferCount = aCount;
+	}
+
+void CNcmNtbBuildSimplePolicy::UpdateTotalBufferCount(TInt aCount)
+    {
+    iTotalBufferCount = aCount;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/src/ncmntbparser.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,629 @@
+/*
+* 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:
+*
+*/
+
+#include "ncmntbparser.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "ncmntbparserTraces.h"
+#endif
+
+
+#ifdef _DEBUG
+_LIT(KNTBParsePanic, "NtbParsePanic");
+#endif
+
+
+const TUint  KNcmNtb16HeadLength = sizeof(TNcmNth16);
+const TUint  KNcmNtb16NdpMiniLength = sizeof(TNcmNdp16);
+const TUint  KNcmNtb16NdpDatagramOffset = 4 + 2 + 2;//dwSignature + wLength + wNextNdpIndex;
+const TUint  KNcmNtb16NdpDatagramLength = 2 + 2;//wDatagram0Index + wDatagram0Length;
+const TUint  KNcmNtb16NdpDatagramLenOffset = 2;//wDatagram0Index
+const TUint8 KLetterN = 0x4E;
+const TUint8 KLetterC = 0x43;
+const TUint8 KLetterM = 0x4D;
+const TUint8 KLetterH = 0x48;
+const TUint8 KLetter0 = 0x30;
+
+CNcmNtb16Parser* CNcmNtb16Parser::NewL(MNcmNdpFrameObserver& aObserver)
+    {
+    return new(ELeave)CNcmNtb16Parser(aObserver);
+    }
+
+CNcmNtb16Parser::~CNcmNtb16Parser()
+    {
+    Reset();
+    }
+
+CNcmNtbParser::~CNcmNtbParser()
+    {
+    }
+
+TUint CNcmNtb16Parser::NtbOutMaxSize() const
+    {
+    return iMaxSize;
+    }
+
+/**
+ * Parsing a buffer as NCM Ntb16 data format.
+ * NOTE: this function has "memory" because the Shared Chunk LDD can't guarantee the buffer as a whole USB Transfer.
+ *       this function tries to parse the buffer as much as possible and save the buffer if it can't be parsed exactly.
+ * @param   [in] aBuf, the buffer to be parsed, which can't be released(free) until the ExpireBuffer() is called.
+ * @param   [in] aBufLen, the buffer length.
+ * @param   [in] aZlp, flag of Zlp used to indicate a USB transfer completion.
+ * @return  KErrNone, no error occurs during parsing this buffer.
+ *          other, Symbian system error code.
+ */
+TInt CNcmNtb16Parser::Parse(const TUint8* aBuf, TInt aBufLen, TBool aZlp)
+    {
+    TInt ret = KErrNone;
+    TInt dataLen = iDataLen + aBufLen - (iQueLen==0?iDataOffset:0);
+    OstTraceExt3( TRACE_NORMAL, CNCMNTB16PARSER_PARSE, "==>Parse:aBuf=0x%08x, aBufLen=%d, aZlp=%d.", (TUint)aBuf, aBufLen, aZlp);
+    OstTraceExt5( TRACE_NORMAL, CNCMNTB16PARSER_PARSE_DUP01, " iState=%d, dataLen=%d, iDataLen=%d, iQueLen=%d, iDataOffset=%d", iState, dataLen, iDataLen, iQueLen, iDataOffset);
+
+    //Zlp comes so late, so updated here.
+    if (aZlp)
+        {
+        iNth.wBlockLength = dataLen;
+        __ASSERT_DEBUG(iNth.wBlockLength < iMaxSize, User::Panic(KNTBParsePanic, __LINE__));
+        }
+
+    switch(iState)
+        {
+        //iNth is not ready.
+        case ENcmNtb16ParseStateUninitialized:
+            if (dataLen >= KNcmNtb16HeadLength)
+                {
+                ret = ParseNcmNtb16Header(aBuf, aBufLen, aZlp);
+                }
+            else
+                {
+                ret = QueueBuf(aBuf, aBufLen);
+                }
+            break;
+
+        //iNth is ready, but iNdp not.
+        case ENcmNtb16ParseStateNdpParsing:
+            if (dataLen >= iNth.wNdpIndex + KNcmNtb16NdpMiniLength)
+                {
+                ret = ParseNcmNtb16Ndp(aBuf, aBufLen);
+                }
+            else
+                {
+                ret = QueueBuf(aBuf, aBufLen);
+                }
+            break;
+
+        //iNdp is ready, try to seek datagram.
+        case ENcmNtb16ParseStateNdpSeeking:
+            ret = ParseNcmNtb16NdpDatagram(aBuf, aBufLen);
+            break;
+
+        //iNth is ready, ignore the remaining bytes for errors or NULL NDP.
+        case ENcmNtb16ParseStateSkipBytes:
+            __ASSERT_DEBUG(0==iQueLen, User::Panic(KNTBParsePanic, __LINE__));
+            __ASSERT_DEBUG(0==iDataLen||0==iDataOffset, User::Panic(KNTBParsePanic, __LINE__));
+            //buffer contains the following NTB data.
+            if (dataLen > iNth.wBlockLength)
+                {
+                iDataOffset += iNth.wBlockLength - iDataLen;
+                Reset();
+                ret = Parse(aBuf, aBufLen);
+                }
+            else if (dataLen == iNth.wBlockLength)
+                {
+                Reset();
+                iDataOffset = 0;
+                iObserver.ExpireBuffer((TAny*)aBuf);
+                }
+            else
+                {
+                iDataLen += aBufLen;
+                iObserver.ExpireBuffer((TAny*)aBuf);
+                }
+            break;
+
+        default:
+            __ASSERT_DEBUG(0, User::Panic(KNTBParsePanic, __LINE__));
+            break;
+        }
+    OstTraceExt3(TRACE_NORMAL, CNCMNTB16PARSER_PARSE_DUP02, "<==Parse:iDataLen=%d, iQueLen=%d, iDataOffset=%d.", (TInt)iDataLen, iQueLen, iDataOffset);
+
+    return ret;
+    }
+
+//Reset the parser to clear the queue and indicators.
+void CNcmNtb16Parser::Reset(TInt aType)
+    {
+    if (ENcmNtb16TypeResetAll == aType)
+        {
+        iState = ENcmNtb16ParseStateUninitialized;
+        iDataLen = 0;
+        }
+
+    if (iQueLen > 0)
+        {
+        for (TInt i = 0; i < iQueLen; i++)
+            {
+            iObserver.ExpireBuffer((TAny*)(iBufQueue[i].Ptr()));
+            }
+        iBufQueue.Reset();
+        iQueLen = 0;
+        iDataOffset = 0;
+        }
+    }
+
+//Search NCM header:"NCMH".
+TInt CNcmNtb16Parser::SearchNcmHead(const TUint8* aBuf, TInt aBufLen)
+    {
+    TInt dataLen = aBufLen + (iQueLen==0?(0-iDataOffset):iDataLen);
+    const TInt KNotFound = 0;
+    const TInt KShrinkQueue = 1;
+    const TInt KFound = 2;
+    TInt ii = 1;//first one(0) has already tested(not matched) before entering this function.
+    TInt ret = KNotFound;
+
+    const TUint KMatchLastOne = 1;
+    const TUint KMatchLastTwo = 2;
+    const TUint KMatchLastThree = 3;
+
+    while (KNotFound == ret)
+        {
+        while (ii < dataLen && KLetterN != DataTUint8(ii, aBuf, aBufLen))
+            {
+            ii++;
+            }
+        if (ii == dataLen)
+            {
+            Reset();
+            iDataOffset = 0;
+            iObserver.ExpireBuffer((TAny*)aBuf);
+            return KErrCorrupt;
+            }
+        else if (ii + KMatchLastOne == dataLen)//last one matched 'N'
+            {
+            ret = KShrinkQueue;
+            }
+        else if (ii + KMatchLastTwo == dataLen)
+            {
+            if (KLetterC == DataTUint8(ii+KMatchLastOne, aBuf, aBufLen))//'NC' matched.
+                {
+                ret = KShrinkQueue;
+                }
+            else
+                {
+                ii++;
+                }
+            }
+        else if (ii + KMatchLastThree == dataLen)
+            {
+            if (KLetterC != DataTUint8(ii+KMatchLastOne, aBuf, aBufLen))
+                {
+                ii++;
+                }
+            else if (KLetterM != DataTUint8(ii+KMatchLastTwo, aBuf, aBufLen))
+                {
+                ii += 2;
+                }
+            else //'NCM' matched.
+                {
+                ret = KShrinkQueue;
+                }
+            }
+        else
+            {
+            if (KLetterC != DataTUint8(ii+KMatchLastOne, aBuf, aBufLen))
+                {
+                ii ++;
+                }
+            else if (KLetterM != DataTUint8(ii+KMatchLastTwo, aBuf, aBufLen))
+                {
+                ii += 2;
+                }
+            else if (KLetterH != DataTUint8(ii+KMatchLastThree, aBuf, aBufLen))
+                {
+                ii += 3;
+                }
+            else
+                {
+                ret = KFound;
+                }
+            }
+        }
+
+    OstTraceExt5(TRACE_NORMAL, CNCMNTB16PARSER_SEARCHNCMHEAD, "Search:ii=%d, dataLen=%d,iDataLen=%d,iDataOffset=%d,iQueLen=%d", ii, dataLen, iDataLen, iDataOffset, iQueLen);
+
+    switch(ret)
+        {
+        case KShrinkQueue:
+            {
+            TInt err = QueueBuf(aBuf, aBufLen);
+            if (KErrNone != err)
+                {
+                return err;
+                }
+            }
+            //fall-through!! no break!!
+        case KFound:
+            {
+            TInt newOffset = ii + iDataOffset;
+            iDataLen += (iDataLen!=0?iDataOffset:0);
+            while(iQueLen && iBufQueue[0].Length() <= newOffset)
+                {
+                iObserver.ExpireBuffer((TAny*)iBufQueue[0].Ptr());
+                newOffset -= iBufQueue[0].Length();
+                iDataLen -= iBufQueue[0].Length();
+                iBufQueue.Remove(0);
+                iQueLen--;
+                }
+            iDataOffset = newOffset;
+            iDataLen -= (iQueLen!=0?iDataOffset:0);
+            __ASSERT_DEBUG((iQueLen==0&&iDataLen==0)||(iQueLen>0&&iDataLen>0), User::Panic(KNTBParsePanic, __LINE__));
+            if (KFound ==  ret)
+                {
+                return Parse(aBuf, aBufLen);
+                }
+            }
+            break;
+
+        default:
+            __ASSERT_DEBUG(0, User::Panic(KNTBParsePanic, __LINE__));
+            break;
+        }
+
+    return KErrNone;
+    }
+
+TInt CNcmNtb16Parser::ParseNcmNtb16Header(const TUint8* aBuf, TInt aBufLen, TBool aZlp)
+    {
+    const TUint KLetterNOffset = 0;                   //0
+    const TUint KLetterCOffset = KLetterNOffset + 1;  //1
+    const TUint KLetterMOffset = KLetterCOffset + 1;  //2
+    const TUint KLetterHOffset = KLetterMOffset + 1;  //3
+    const TUint KHeaderLengthOffset = KLetterHOffset + 1;//4
+    const TUint KSequeceOffset = KHeaderLengthOffset + 2;//6
+    const TUint KBlockLengthOffset = KSequeceOffset + 2;//8
+    const TUint KNdpIndexOffset = KBlockLengthOffset + 2;//10
+    //NCMH
+    if (KLetterN != DataTUint8(KLetterNOffset, aBuf, aBufLen) ||
+            KLetterC != DataTUint8(KLetterCOffset, aBuf, aBufLen) ||
+            KLetterM != DataTUint8(KLetterMOffset, aBuf, aBufLen) ||
+            KLetterH != DataTUint8(KLetterHOffset, aBuf, aBufLen))
+        {
+        //NOT a valid NTB header signature. Try to search NCMH in the buffer...
+        OstTrace0(TRACE_ERROR, CNCMNTB16PARSER_PARSENCMNTB16HEADER, "BAD error, missed NCMH!!");
+        return SearchNcmHead(aBuf, aBufLen);
+        }
+
+#ifdef _DEBUG
+    iNth.wHeaderLength = DataTUint16(KHeaderLengthOffset, aBuf, aBufLen);
+    iNth.wSequence = DataTUint16(KSequeceOffset, aBuf, aBufLen);
+    //keep silence for release. not critical error.
+    __ASSERT_DEBUG(iNth.wHeaderLength == 0xC, User::Panic(KNTBParsePanic, __LINE__));
+#endif
+
+#ifdef _DEBUG
+    OstTrace1(TRACE_NORMAL, CNCMNTB16PARSER_PARSENCMNTB16HEADER_DUP01, "iNth.wBlockLength=%d", DataTUint16(KBlockLengthOffset, aBuf, aBufLen));
+#endif
+
+    //using Zlp first.
+    if (aZlp)
+        {
+        iNth.wBlockLength = iDataLen + aBufLen - (iQueLen==0?iDataOffset:0);
+        __ASSERT_DEBUG(iNth.wBlockLength < iMaxSize, User::Panic(KNTBParsePanic, __LINE__));
+        }
+    else
+        {
+        iNth.wBlockLength = DataTUint16(KBlockLengthOffset, aBuf, aBufLen);
+        if (0 == iNth.wBlockLength)
+            {
+            iNth.wBlockLength = iMaxSize;
+            }
+        }
+    iNth.wNdpIndex = DataTUint16(KNdpIndexOffset, aBuf, aBufLen);
+
+#ifdef _DEBUG
+    iNth.Dump();
+#endif
+
+    if ((iNth.wNdpIndex >= 0xC) &&
+        (iNth.wNdpIndex + KNcmNtb16NdpMiniLength <= iNth.wBlockLength))
+        {
+        iState = ENcmNtb16ParseStateNdpParsing;
+        }
+    else //underflow or overflow
+        {
+        Reset(ENcmNtb16TypeResetQueue);
+        iState = ENcmNtb16ParseStateSkipBytes;
+        }
+
+    return Parse(aBuf, aBufLen);
+    }
+
+TInt CNcmNtb16Parser::ParseNcmNtb16Ndp(const TUint8* aBuf, TInt aBufLen)
+    {
+    const TUint KLetterNOffset = 0;                  //0
+    const TUint KLetterCOffset = KLetterNOffset + 1; //1
+    const TUint KLetterMOffset = KLetterCOffset + 1; //2
+    const TUint KLetterZeroOffset = KLetterMOffset + 1; //3
+    const TUint KLengthOffset = KLetterZeroOffset + 1;//4
+
+    //NCM0
+    if (KLetterN != DataTUint8(iNth.wNdpIndex + KLetterNOffset, aBuf, aBufLen) ||
+            KLetterC != DataTUint8(iNth.wNdpIndex+KLetterCOffset, aBuf, aBufLen) ||
+            KLetterM != DataTUint8(iNth.wNdpIndex+KLetterMOffset, aBuf, aBufLen) ||
+            KLetter0 != DataTUint8(iNth.wNdpIndex+KLetterZeroOffset, aBuf, aBufLen))
+        {
+        //Not valid NDP! Skip this NTB.
+        Reset(ENcmNtb16TypeResetQueue);
+        iState = ENcmNtb16ParseStateSkipBytes;
+        return Parse(aBuf, aBufLen);
+        }
+
+    iNdp.wLength = DataTUint16(iNth.wNdpIndex+KLengthOffset, aBuf, aBufLen);
+    if (iNdp.wLength < 0x10)
+        {
+        //Not valid ndp header, Skip this NTB.
+        Reset(ENcmNtb16TypeResetQueue);
+        iState = ENcmNtb16ParseStateSkipBytes;
+        return Parse(aBuf, aBufLen);
+        }
+    iNdpBound  = iNth.wNdpIndex + iNdp.wLength;
+
+#ifdef _DEBUG
+    if (iNdpBound > iNth.wBlockLength)
+        {
+        //warning: overflow..
+        }
+    const TUint KNextNdpIndexOffset = KLengthOffset + 2;//6
+    iNdp.wNextNdpIndex = DataTUint16(iNth.wNdpIndex + KNextNdpIndexOffset, aBuf, aBufLen);
+    __ASSERT_DEBUG(iNdp.wNextNdpIndex==0, User::Panic(KNTBParsePanic, __LINE__));
+
+    iNdp.Dump();
+#endif
+
+    iNdpDataOffset = iNth.wNdpIndex + KNcmNtb16NdpDatagramOffset;
+    iState = ENcmNtb16ParseStateNdpSeeking;
+    return Parse(aBuf, aBufLen);
+    }
+
+//parse NdpDatagram
+TInt CNcmNtb16Parser::ParseNcmNtb16NdpDatagram(const TUint8* aBuf, TInt aBufLen)
+    {
+    TInt dataLen = aBufLen + (iQueLen==0?(0-iDataOffset):iDataLen);
+    TInt  ret = KErrNone;
+    OstTraceExt3(TRACE_NORMAL, CNCMNTB16PARSER_PARSENCMNTB16NDPDATAGRAM, "ParseNcmNtb16NdpDatagram:iNdpState=%d, iDataLen=%d, dataLen=%d", iNdpState, iDataLen, dataLen);
+
+    switch(iNdpState)
+        {
+        case ENcmNtb16ParseNdpStateUninitialized:
+            {
+            TUint datagramBound = iNdpDataOffset+ KNcmNtb16NdpDatagramLength;
+            if (iNdpDataOffset >= iNdpBound || datagramBound > iNth.wBlockLength)
+                {
+                //finish this NTB.
+                Reset(ENcmNtb16TypeResetQueue);
+                iState = ENcmNtb16ParseStateSkipBytes;
+                ret = Parse(aBuf, aBufLen);
+                }
+            else if (datagramBound <= dataLen)
+                {
+                iDatagramIndex = DataTUint16(iNdpDataOffset, aBuf, aBufLen);
+                iDatagramLength = DataTUint16(iNdpDataOffset+KNcmNtb16NdpDatagramLenOffset, aBuf, aBufLen);
+                OstTraceExt2(TRACE_NORMAL, CNCMNTB16PARSER_PARSENCMNTB16NDPDATAGRAM_DUP01, "Index=%d, Length=%d", iDatagramIndex, iDatagramLength);
+                // NULL NDP;
+                if (iDatagramIndex == 0 || iDatagramLength == 0)
+                    {
+                    Reset(ENcmNtb16TypeResetQueue);
+                    iState = ENcmNtb16ParseStateSkipBytes;
+                    ret = Parse(aBuf, aBufLen);
+                    }
+                else if (iDatagramIndex + iDatagramLength <= iNth.wBlockLength)
+                    {
+                    TRAPD(err, iPacket.CreateL(iDatagramLength));
+                    if (KErrNone == err)
+                        {
+                        iNdpState = ENcmNtb16ParseNdpStateDatagramed;
+                        ret = ParseNcmNtb16NdpDatagram(aBuf, aBufLen);
+                        }
+                    else
+                        {
+                        iPacket.Free();
+
+                        iNdpDataOffset += KNcmNtb16NdpDatagramLength;//skip this ethernet frame, do nothing else.
+                        ret = ParseNcmNtb16NdpDatagram(aBuf, aBufLen);
+                        }
+
+                    }
+                else
+                    {
+                    //skip this datagram because of overflow.
+                    iNdpDataOffset += KNcmNtb16NdpDatagramLength;
+                    ret = ParseNcmNtb16NdpDatagram(aBuf, aBufLen);
+                    }
+                }
+            else
+                {
+                ret = QueueBuf(aBuf, aBufLen);
+                }
+            }
+            break;
+
+        case ENcmNtb16ParseNdpStateDatagramed:
+            ret = DataPacket(aBuf, aBufLen);
+            if (KErrCompletion == ret)
+                {
+                iPacket.Pack();
+                iObserver.ProcessEtherFrame(iPacket);
+
+                iNdpDataOffset += KNcmNtb16NdpDatagramLength;
+                iNdpState = ENcmNtb16ParseNdpStateUninitialized;
+                ret = ParseNcmNtb16NdpDatagram(aBuf, aBufLen);
+                }
+            break;
+        }
+
+    return ret;
+    }
+
+//queue buffer.
+TInt CNcmNtb16Parser::QueueBuf(const TUint8* aBuf, TInt aBufLen)
+    {
+    __ASSERT_DEBUG(iQueLen==0?(iDataLen==0):ETrue, User::Panic(KNTBParsePanic, __LINE__));
+    TPtrC8 ptr(aBuf, aBufLen);
+    TInt ret = iBufQueue.Append(ptr);
+    if(KErrNone != ret)
+        {
+        OstTrace1(TRACE_ERROR, CNCMNTB16PARSER_QUEUEBUF, "Append Queue Error: ret=%d!!", ret);
+        Reset();
+        return ret;
+        }
+    iDataLen += aBufLen - (iQueLen==0?iDataOffset:0);
+    iQueLen ++;
+    return KErrNone;
+    }
+
+TUint8 CNcmNtb16Parser::DataTUint8(TUint aOffset, const TUint8* aBuf, TInt aBufLen)
+    {
+    if (0 == iQueLen)
+        {
+        return aBuf[iDataOffset + aOffset];
+        }
+    else if (iDataLen <= aOffset)
+        {
+        return aBuf[aOffset - iDataLen];
+        }
+    else
+        {
+        TInt    i = 1;
+        TPtrC8* pPtr = &iBufQueue[0];
+        TUint   totalOffset = pPtr->Length() - iDataOffset;
+        while(totalOffset <= aOffset)
+            {
+            pPtr = &iBufQueue[i];
+            totalOffset += pPtr->Length();
+            i++;
+            __ASSERT_DEBUG(i<=iQueLen, User::Panic(KNTBParsePanic, __LINE__));
+            }
+        return pPtr->Ptr()[pPtr->Length() + aOffset - totalOffset];
+        }
+    }
+
+TUint16 CNcmNtb16Parser::DataTUint16(TUint aOffset, const TUint8* aBuf, TInt aBufLen)
+    {
+    if (0 == iQueLen)
+        {
+        return LittleEndian::Get16(aBuf + aOffset + iDataOffset);
+        }
+    else if (iDataLen <= aOffset)
+        {
+        return LittleEndian::Get16(aBuf + aOffset - iDataLen);
+        }
+    else
+        {
+        TUint16 ret = 0;
+        TInt    i = 1;
+        TPtrC8* pPtr = &iBufQueue[0];
+        TUint   totalOffset = pPtr->Length() - iDataOffset;
+
+        while(totalOffset <= aOffset)
+            {
+            pPtr = &iBufQueue[i];
+            totalOffset += pPtr->Length();
+            i++;
+            __ASSERT_DEBUG(i<=iQueLen, User::Panic(KNTBParsePanic, __LINE__));
+            }
+        ret = pPtr->Ptr()[pPtr->Length() + aOffset - totalOffset];
+        if (totalOffset > aOffset + 1)
+            {
+            ret += ((pPtr->Ptr()[pPtr->Length() + aOffset - totalOffset + 1])<<8)&0xFF00;
+            }
+        else if (i < iQueLen)
+            {
+            pPtr = &iBufQueue[i];
+            ret += ((pPtr->Ptr()[0])<<8)&0xFF00;
+            }
+        else
+            {
+            ret += (aBuf[0]<<8)&0xFF00;
+            }
+
+        return ret;
+        }
+    }
+
+TInt CNcmNtb16Parser::DataPacket(const TUint8* aBuf, TInt aBufLen)
+    {
+    TInt dataLen = aBufLen + (iQueLen==0?(0-iDataOffset):iDataLen);
+    OstTraceExt5(TRACE_NORMAL, CNCMNTB16PARSER_DATAPACKET, "DataPacket:dataLen=%d, index=%d, len=%d, iDataLen=%d, iDataOffset=%d", dataLen, iDatagramIndex, iDatagramLength, iDataLen, iDataOffset);
+    if (dataLen < iDatagramIndex + iDatagramLength)
+        {
+        return QueueBuf(aBuf, aBufLen);
+        }
+
+    if (0 == iQueLen)
+        {
+        iPacket.CopyIn(TPtrC8(aBuf + iDatagramIndex + iDataOffset, iDatagramLength));
+        }
+    else if (iDataLen <= iDatagramIndex)
+        {
+        iPacket.CopyIn(TPtrC8(aBuf + iDatagramIndex - iDataLen, iDatagramLength));
+        }
+    else
+        {
+        TInt    i = 1;
+        TPtrC8* pPtr = &iBufQueue[0];
+        TUint   totalOffset = pPtr->Length() - iDataOffset;
+
+        while (totalOffset <= iDatagramIndex)
+            {
+            pPtr = &iBufQueue[i];
+            totalOffset += pPtr->Length();
+            i++;
+            __ASSERT_DEBUG(i<=iQueLen, User::Panic(KNTBParsePanic, __LINE__));
+            }
+        if (totalOffset >= iDatagramIndex + iDatagramLength)
+            {
+            iPacket.CopyIn(TPtrC8(pPtr->Ptr() + pPtr->Length() + iDatagramIndex - totalOffset, iDatagramLength));
+            }
+        else
+            {
+            TInt   len = totalOffset - iDatagramIndex;
+            iPacket.CopyIn(TPtrC8(pPtr->Ptr() + pPtr->Length() + iDatagramIndex - totalOffset, len));
+
+            while(i < iQueLen && iBufQueue[i].Length() + len <= iDatagramLength)
+                {
+                iPacket.CopyIn(iBufQueue[i], len);
+                len += iBufQueue[i].Length();
+                i++;
+                }
+
+            if (len < iDatagramLength)
+                {
+                if (i < iQueLen)
+                    {
+                    iPacket.CopyIn(TPtrC8(iBufQueue[i].Ptr(), iDatagramLength-len), len);
+                    }
+                else
+                    {
+                    iPacket.CopyIn(TPtrC8(aBuf, iDatagramLength - len), len);
+                    }
+                }
+            }
+        }
+
+    return KErrCompletion;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/src/ncmpktdrv.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,273 @@
+/*
+* 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:
+*
+*/
+
+#include "ncmpktdrv.h"
+
+#include "ncmengine.h"
+#include "ncmserver.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "ncmpktdrvTraces.h"
+#endif
+
+
+/**
+Constructor. Packet Driver object.
+*/
+CNcmPktDrv::CNcmPktDrv(CPktDrvFactory& aFactory) : CPktDrvBase(aFactory)
+    {
+    }
+
+/**
+Destructor.
+*/
+CNcmPktDrv::~CNcmPktDrv()
+    {
+    delete iNcmServer;
+    delete iEngine;
+    }
+
+/**
+Construction of the CNcmDrvBase object
+@param aParent Pointer to the CLANLinkCommon class.
+*/
+void CNcmPktDrv::ConstructL(CLANLinkCommon* aParent)
+    {
+    OstTraceFunctionEntry0(CNCMPKTDRV_CONSTRUCTL);
+
+    iParent = aParent;
+    iEngine = CNcmEngine::NewL(*this);
+    iNcmServer = CNcmServer::NewL(*iEngine);
+    }
+
+/**
+Call to LDD or subordinate object to start/initialise the Physical device
+*/
+TInt CNcmPktDrv::StartInterface()
+    {
+    OstTraceFunctionEntry0(CNCMPKTDRV_STARTINTERFACE);
+
+    TRAPD(err, iParent->FoundMACAddrL());
+    if (KErrNone != err)
+        {
+        return err;
+        }
+
+    OstTrace0(TRACE_NORMAL, CNCMPKTDRV_STARTINTERFACE_DUP02, "CNcmPktDrv, calling LinkLayerUp");
+    iParent->LinkLayerUp();
+    OstTraceFunctionExit0(CNCMPKTDRV_STARTINTERFACE_DUP01);
+    return err;
+    }
+
+/**
+Call to LDD or subordinate object to stop/de-initialise the Physical device
+*/
+TInt CNcmPktDrv::StopInterface()
+    {
+    OstTraceFunctionEntry0(CNCMPKTDRV_STOPINTERFACE);
+
+    iEngine->Stop();
+
+    return KErrNone;
+    }
+
+/**
+Call to LDD or subordinate object to reset/re-initialise the Physical device
+*/
+TInt CNcmPktDrv::ResetInterface()
+    {
+    return KErrNone;
+    }
+
+/**
+EtherII MAC layer comments say we should free the packet buffer
+RMBuf could contain a chain so get into a contiguous buffer
+@param aPacket Reference to a chain of data buffers to be passed to the line.
+@return 0 Tells the higher layer to send no more data.
+        1 Tells higher layer that it can send more data.
+*/
+TInt CNcmPktDrv::Send(RMBufChain &aPacket)
+    {
+    TInt error = iEngine->Send(aPacket);
+    aPacket.Free();
+
+    return error;
+    }
+
+/**
+Read the Available data.
+@param aBuffer A Reference to a buffer holding data.
+*/
+void CNcmPktDrv::ReceiveEthFrame(RMBufPacket& aPacket)
+    {
+    iParent->Process(aPacket);
+    }
+
+/**
+Resume Sending is a notification call into NIF from the lower layer telling the NIF that a
+previous sending congestion situation has been cleared and it can accept more downstack data.
+*/
+void CNcmPktDrv::ResumeSending()
+    {
+    iParent->ResumeSending();
+    }
+
+/**
+Call to LDD or subordinate object to set the receive mode of the LAN Device
+@param aMode The mode to be set for the LAN Device.
+@return KErrNotSupported LAN Device does not support.
+*/
+TInt CNcmPktDrv::SetRxMode(TRxMode /*aMode*/)
+    {
+    return KErrNotSupported;
+    }
+
+/**
+Call to LDD or subordinate object to Get the receive mode of the LAN Device
+@return KErrNotSupported LAN Device does not support.
+*/
+TInt CNcmPktDrv::GetRxMode() const
+    {
+    return KErrNotSupported;
+    }
+
+/**
+Call to LDD or subordinate object to get the Hardware address of the LAN Device
+@return NULL Failure.
+        (NULL Terminated Binary String) The Hardware Address of the interface. LAN Device
+        Specific
+*/
+TUint8* CNcmPktDrv::GetInterfaceAddress()const
+    {
+    return iEngine->InterfaceAddress();
+    }
+
+/**
+Call to LDD or subordinate object to set the Hardware address of the LAN Device.
+@param THWAddr Address of where the Multicast list should be written.
+@return KErrNone         if Successful
+        KErrNotSupported LAN Device does not support.
+        Implementation specific Error Code  Failure
+*/
+TInt CNcmPktDrv::SetInterfaceAddress(const THWAddr&)
+    {
+    return KErrNotSupported;
+    }
+
+/**
+Call to LDD or subordinate object to retrieve the Multicast List from the LAN Device
+@param aAddr Address of where the Multicast list should be written.
+@param n Output Parameter , number of Addresses written
+@return KErrNone         if Successful
+        KErrNotSupported LAN Device does not support.
+        Implementation specific Error Code  Failure
+*/
+TInt CNcmPktDrv::GetMulticastList(const THWAddr* /*aAddr*/, TInt& /*n*/) const
+    {
+    return KErrNotSupported;
+    }
+
+/**
+Call to LDD or subordinate object to set the Multicast List for the LAN Device.
+@param aAddr Address of where the Multicast list should be written.
+@param n Output Parameter , number of Addresses written
+@return KErrNone         if Successful
+        KErrNotSupported LAN Device does not support.
+        Implementation specific Error Code  Failure
+*/
+TInt CNcmPktDrv::SetMulticastList(const THWAddr* /*aAddr*/, TInt /*n*/)
+    {
+    return KErrNotSupported;
+    }
+
+/**
+Call to LDD or subordinate object to power up the LAN Device.
+@return KErrNone         if Successful
+        KErrNotSupported LAN Device does not support.
+        Implementation specific Error Code  Failure
+*/
+TInt CNcmPktDrv::InterfacePowerUp()
+    {
+    return KErrNotSupported;
+    }
+
+/**
+Call to LDD or subordinate object to power down the LAN Device
+@return KErrNone         if Successful
+        KErrNotSupported LAN Device does not support.
+        Implementation specific Error Code  Failure
+*/
+TInt CNcmPktDrv::InterfacePowerDown()
+    {
+    return KErrNotSupported;
+    }
+
+/**
+Call to LDD or subordinate object to suspend the LAN Device.
+@return KErrNone         if Successful
+        KErrNotSupported LAN Device does not support.
+        Implementation specific Error Code  Failure
+*/
+TInt CNcmPktDrv::InterfaceSleep()
+    {
+    return KErrNotSupported;
+    }
+
+/**
+Call to LDD or subordinate object to resume the LAN Device.
+@return KErrNone         if Successful
+        KErrNotSupported LAN Device does not support.
+        Implementation specific Error Code  Failure
+*/
+TInt CNcmPktDrv::InterfaceResume()
+    {
+    return KErrNotSupported;
+    }
+
+/**
+Receive notifications from agent
+*/
+TInt CNcmPktDrv::Notification(enum TAgentToNifEventType aEvent, void* aInfo)
+    {
+    TInt retval = KErrNotSupported;
+
+    return retval;
+    }
+
+/**
+Receive Control() calls from agent/nifman/connection
+*/
+TInt CNcmPktDrv::Control(TUint /*aLevel*/,TUint /*aName*/,TDes8& /*aOption*/, TAny* /*aSource*/)
+    {
+    return KErrNotSupported;
+    }
+
+/**
+Report the progress of packet driver to NCM Class Controller for fatal error
+*/
+void CNcmPktDrv::FatalErrorNotification(TInt aError)
+    {
+    iParent->IfProgress(ENcmPktDrvFatalError, aError);
+    }
+
+#ifdef __OVER_DUMMYUSBSCLDD__
+TInt CNcmPktDrv::State() const
+    {
+    return iEngine->State();
+    }
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/src/ncmpktdrvfactory.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* 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:
+*
+*/
+
+#include "ncmpktdrvfactory.h"
+#include "ncmpktdrv.h"
+
+
+/**
+@file
+@internalComponent
+*/
+extern "C"
+    {
+    IMPORT_C CPktDrvFactory * NewNcmPktDrvFactoryL(); ///< Force export
+    }
+
+/**
+Library file is opened and this is the the first and only export.
+@internalComponent
+@return A pointer to CPktDrvFactory object.
+*/
+EXPORT_C CPktDrvFactory* NewNcmPktDrvFactoryL()
+    {
+    return new (ELeave) CNcmPktDrvFactory;
+    }
+
+/**
+Create the packet driver object
+@param aParent Pointer to the parent Ethint NIF class.
+@return A pointer to CPktDrvBase object.
+*/
+CPktDrvBase* CNcmPktDrvFactory::NewDriverL(CLANLinkCommon* aParent)
+    {
+    CNcmPktDrv *drv = new (ELeave) CNcmPktDrv(*this);
+    CleanupStack::PushL(drv);
+    drv->ConstructL(aParent);
+    CleanupStack::Pop(drv);
+    return drv;
+    }
+
+
+/**
+Packet Driver version number.
+@return Version number of the Packet Driver
+*/
+TVersion CNcmPktDrvFactory::Version() const
+    {
+    return(TVersion(KNcmDrvMajorVersionNumber,KNcmDrvMinorVersionNumber,KNcmDrvBuildVersionNumber));
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/src/ncmsharedstatemanager.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,234 @@
+/*
+* 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:
+*
+*/
+
+#include "ncmsharedstatemanager.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "ncmsharedstatemanagerTraces.h"
+#endif
+
+
+
+#ifdef _DEBUG
+_LIT(KPanicSharedState, "SharedStatePanic");
+#endif
+
+CNcmSharedStateManager* CNcmSharedStateManager::NewL(MShareStateObserver& aEngine)
+    {
+    CNcmSharedStateManager* self = new(ELeave) CNcmSharedStateManager(aEngine);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CNcmSharedStateManager::CNcmSharedStateManager(MShareStateObserver& aEngine) : CActive(CActive::EPriorityStandard),
+                                          iNotifyMsg(RMessage2()), iEngine(aEngine)
+    {
+    CActiveScheduler::Add(this);
+    }
+
+
+CNcmSharedStateManager::~CNcmSharedStateManager()
+    {
+    OstTraceFunctionEntry0(CNCMSHAREDSTATEMANAGER_CNCMSHAREDSTATEMANAGER);
+
+    Cancel();
+
+    iProperty.Close();
+    iProperty.Delete(KKeyNcmConnectionEvent);
+
+    delete iCoexistBearer;
+    OstTraceFunctionExit0(CNCMSHAREDSTATEMANAGER_CNCMSHAREDSTATEMANAGER_DUP01);
+    }
+
+
+void CNcmSharedStateManager::ConstructL()
+    {
+    OstTraceFunctionEntry0(CNCMSHAREDSTATEMANAGER_CONSTRUCTL);
+
+    TInt  ccStartRequested  = ENcmStartRequested;
+    User::LeaveIfError(RProperty::Get(KUsbmanSvrUid, KKeyNcmSharedState, ccStartRequested));
+    if (ccStartRequested != ENcmStartRequested)
+        {
+        User::Leave(KErrNotReady);
+        }
+
+    User::LeaveIfError(iProperty.Define(KKeyNcmConnectionEvent, RProperty::EByteArray, KAllowAllPolicy, KNetworkControlPolicy));
+    User::LeaveIfError(iProperty.Attach(RProcess().SecureId(), KKeyNcmConnectionEvent, EOwnerThread));
+
+    iCoexistBearer = CNcmCoexistBearerWatcher::NewL();
+
+    iNcmState().iIapId = 0;
+    OstTraceFunctionExit0(CNCMSHAREDSTATEMANAGER_CONSTRUCTL_DUP01);
+    }
+
+/**
+Maintains the shared state between the NCM class controller and packet driver.
+*/
+void CNcmSharedStateManager::RunL()
+    {
+    TInt err = iStatus.Int();
+
+    OstTrace1(TRACE_NORMAL, CNCMSHAREDSTATEMANAGER_RUNL, "iStatus.Int()=%d", iStatus.Int());
+
+    if (KErrNone == err)
+        {
+        DoDhcpProvisionRequest();
+        }
+    else if (KErrCancel != err)
+        {
+        NotifyNcmDisconnected(err);
+        }
+    }
+
+/**
+Stop checking the shared state
+*/
+void CNcmSharedStateManager::DoCancel()
+    {
+    iCoexistBearer->Cancel();
+    }
+
+TInt CNcmSharedStateManager::NotifyDhcpProvisionRequested()
+    {
+    OstTraceFunctionEntry0(CNCMSHAREDSTATEMANAGER_NOTIFYDHCPPROVISIONREQUESTED);
+
+    TInt ret = iCoexistBearer->SetIpOverUsbActive(iStatus);
+
+    if (ret == KErrCompletion)
+        {
+        return DoDhcpProvisionRequest();
+        }
+    else if (ret == KErrNone)
+        {
+        //notify the upper apps BTPAN is used by others.
+        NotifyNcmDisconnected(KErrInUse);
+        SetActive();
+        }
+    else
+        {
+        NotifyNcmDisconnected(ret);
+        }
+
+    OstTraceFunctionEntry0(CNCMSHAREDSTATEMANAGER_NOTIFYDHCPPROVISIONREQUESTED_DUP01);
+    return ret;
+    }
+
+TInt CNcmSharedStateManager::DoDhcpProvisionRequest()
+    {
+    if (iNotifyMsg.IsNull())
+        {
+        __ASSERT_DEBUG(0, User::Panic(KPanicSharedState, __LINE__));
+
+        //return AlreadyExists, so that Engine can start immediately.
+        return KErrAlreadyExists;
+        }
+    else
+        {
+        iNotifyMsg.Complete(KErrNone);
+        iNotifyMsg = RMessage2();
+        }
+
+    return KErrNone;
+    }
+
+
+void CNcmSharedStateManager::NotifyNcmConnected()
+    {
+    iNcmState().iState = ENcmStateConnected;
+    iProperty.Set(iNcmState);
+    }
+
+void CNcmSharedStateManager::NotifyNcmDisconnected(TInt aReason)
+    {
+    iNcmState().iState = ENcmStateDisconnected;
+    iNcmState().iErrCode = aReason;
+    iProperty.Set(iNcmState);
+
+    if (iCoexistBearer->IsIpOverUsbActived())
+        {
+        iCoexistBearer->SetIpOverUsbDeactive();
+        }
+    else
+        {
+        Cancel();
+        }
+    }
+
+TInt CNcmSharedStateManager::SetStateValue(TInt aType, TInt aValue)
+    {
+    OstTraceExt2(TRACE_NORMAL, CNCMSHAREDSTATEMANAGER_SETSTATEVALUE, "SetStateValue: type=%d, val=%d", aType, aValue);
+
+    const TInt KTypeIapId = 0;
+    const TInt KTypeDhcpReturn = 1;
+    TInt ret = KErrNone;
+    switch(aType)
+        {
+        case KTypeIapId:
+            //don't assign more than once.
+            __ASSERT_DEBUG(iNcmState().iIapId==0, User::Panic(KPanicSharedState, __LINE__));
+            iNcmState().iIapId = aValue;
+            break;
+
+        case KTypeDhcpReturn:
+            if (KErrNone == aValue)
+                {
+                iEngine.NotifyDhcpStarted();
+                }
+            else
+                {
+                OstTrace1(TRACE_WARNING, CNCMSHAREDSTATEMANAGER_SETSTATEVALUE_DUP01, "Dhcp Provision Request return error:%d", aValue);
+                NotifyNcmDisconnected(aValue);
+                }
+            break;
+
+        default:
+            OstTraceExt2(TRACE_ERROR, CNCMSHAREDSTATEMANAGER_SETSTATEVALUE_DUP02, "unknow type:%d, value:%d", aType, aValue);
+            __ASSERT_DEBUG(0, User::Panic(KPanicSharedState, __LINE__));
+            break;
+        }
+
+    return ret;
+    }
+
+TInt CNcmSharedStateManager::RegisterNotify(const RMessage2& aMsg)
+    {
+    if (!iNotifyMsg.IsNull())
+        {
+        return KErrInUse;
+        }
+
+    iNotifyMsg = aMsg;
+
+    return KErrNone;
+    }
+
+TInt CNcmSharedStateManager::DeRegisterNotify()
+    {
+    if (iNotifyMsg.IsNull())
+        {
+        return KErrNotReady;
+        }
+    else
+        {
+        iNotifyMsg.Complete(KErrCancel);
+        iNotifyMsg = RMessage2();
+        }
+
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/traces/OstTraceDefinitions.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,7 @@
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <opensystemtrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/pktdrv/traces/fixed_id.definitions	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,307 @@
+#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt.
+[GROUP]TRACE_ERROR=0x40
+[GROUP]TRACE_FATAL=0x1
+[GROUP]TRACE_FLOW=0x7
+[GROUP]TRACE_NORMAL=0x3
+[GROUP]TRACE_WARNING=0x41
+[TRACE]TRACE_ERROR[0x40]_CNCMCOEXISTBEARERWATCHER_CONSTRUCTL_DUP02=0x1
+[TRACE]TRACE_ERROR[0x40]_CNCMCOEXISTBEARERWATCHER_DOACTIVE=0x2
+[TRACE]TRACE_ERROR[0x40]_CNCMCOEXISTBEARERWATCHER_DOACTIVE_DUP01=0x3
+[TRACE]TRACE_ERROR[0x40]_CNCMCOEXISTBEARERWATCHER_DOACTIVE_DUP02=0x4
+[TRACE]TRACE_ERROR[0x40]_CNCMCOEXISTBEARERWATCHER_DOACTIVE_DUP03=0x5
+[TRACE]TRACE_ERROR[0x40]_CNCMCOMMUNICATIONINTERFACE_DECODESETUP=0x6
+[TRACE]TRACE_ERROR[0x40]_CNCMCOMMUNICATIONINTERFACE_WRITEINTERRUPTDATA1=0x7
+[TRACE]TRACE_ERROR[0x40]_CNCMCOMMUNICATIONINTERFACE_WRITEINTERRUPTDATA2=0x8
+[TRACE]TRACE_ERROR[0x40]_CNCMDATARECEIVER_READDATA_DUP03=0xa
+[TRACE]TRACE_ERROR[0x40]_CNCMDATARECEIVER_RUNL=0xb
+[TRACE]TRACE_ERROR[0x40]_CNCMDATARECEIVER_START_DUP01=0x9
+[TRACE]TRACE_ERROR[0x40]_CNCMDATASENDER_START=0xc
+[TRACE]TRACE_ERROR[0x40]_CNCMENGINE_DATAERROR=0xe
+[TRACE]TRACE_ERROR[0x40]_CNCMENGINE_START_DUP01=0xd
+[TRACE]TRACE_ERROR[0x40]_CNCMNTB16PARSER_PARSENCMNTB16HEADER=0xf
+[TRACE]TRACE_ERROR[0x40]_CNCMNTB16PARSER_QUEUEBUF=0x10
+[TRACE]TRACE_ERROR[0x40]_CNCMSHAREDSTATEMANAGER_SETSTATEVALUE_DUP02=0x11
+[TRACE]TRACE_FATAL[0x1]_CNCMBUFFERMANAGER_SETBUFFERCELLSIZE1=0x1
+[TRACE]TRACE_FATAL[0x1]_CNCMCOMMINTERFACESENDERANDRECEIVER_READ_DUP1=0x3
+[TRACE]TRACE_FATAL[0x1]_CNCMCOMMINTERFACESENDERANDRECEIVER_START1=0x2
+[TRACE]TRACE_FATAL[0x1]_CNCMCOMMINTERFACESENDERANDRECEIVER_WRITE1=0x4
+[TRACE]TRACE_FATAL[0x1]_CNCMCOMMINTERFACESENDERANDRECEIVER_WRITE2=0x5
+[TRACE]TRACE_FATAL[0x1]_CNCMCOMMINTERFACESENDERANDRECEIVER_WRITE3=0x6
+[TRACE]TRACE_FATAL[0x1]_CNCMCOMMINTERFACESENDERANDRECEIVER_WRITE4=0x7
+[TRACE]TRACE_FATAL[0x1]_CNCMCOMMUNICATIONINTERFACE_READSETUP=0x9
+[TRACE]TRACE_FATAL[0x1]_CNCMCOMMUNICATIONINTERFACE_START1=0x8
+[TRACE]TRACE_FATAL[0x1]_CNCMCOMMUNICATIONINTERFACE_WRITEINTERRUPTDATA=0xa
+[TRACE]TRACE_FATAL[0x1]_CNCMDATASENDER_SENDNTBPAYLOAD4=0x10
+[TRACE]TRACE_FATAL[0x1]_CNCMDATASENDER_SETNTBINMAXSIZE1=0x11
+[TRACE]TRACE_FATAL[0x1]_CNCMDATASENDER_START1=0xb
+[TRACE]TRACE_FATAL[0x1]_CNCMDATASENDER_START2=0xc
+[TRACE]TRACE_FATAL[0x1]_CNCMDATASENDER_START3=0xd
+[TRACE]TRACE_FATAL[0x1]_CNCMDATASENDER_START5=0xe
+[TRACE]TRACE_FATAL[0x1]_CNCMDATASENDER_STARTNEWNTB=0xf
+[TRACE]TRACE_FLOW[0x7]_CNCMBUFFERMANAGER_CNCMBUFFERMANAGER_ENTRY=0x3
+[TRACE]TRACE_FLOW[0x7]_CNCMBUFFERMANAGER_CNCMBUFFERMANAGER_EXIT=0x4
+[TRACE]TRACE_FLOW[0x7]_CNCMBUFFERMANAGER_FREEBUFFER_ENTRY=0x8
+[TRACE]TRACE_FLOW[0x7]_CNCMBUFFERMANAGER_FREEBUFFER_EXIT=0x9
+[TRACE]TRACE_FLOW[0x7]_CNCMBUFFERMANAGER_GETBUFFER_ENTRY=0x5
+[TRACE]TRACE_FLOW[0x7]_CNCMBUFFERMANAGER_GETBUFFER_EXIT=0x6
+[TRACE]TRACE_FLOW[0x7]_CNCMBUFFERMANAGER_GETBUFFER_EXIT_DUP1=0x7
+[TRACE]TRACE_FLOW[0x7]_CNCMBUFFERMANAGER_NEWL_ENTRY=0x1
+[TRACE]TRACE_FLOW[0x7]_CNCMBUFFERMANAGER_NEWL_EXIT=0x2
+[TRACE]TRACE_FLOW[0x7]_CNCMBUFFERMANAGER_SETBUFFERCELLSIZE_ENTRY=0xa
+[TRACE]TRACE_FLOW[0x7]_CNCMBUFFERMANAGER_SETBUFFERCELLSIZE_EXIT=0xb
+[TRACE]TRACE_FLOW[0x7]_CNCMBUFFERMANAGER_SETBUFFERCELLSIZE_EXIT_DUP1=0xc
+[TRACE]TRACE_FLOW[0x7]_CNCMCOEXISTBEARERWATCHER_CONSTRUCTL=0xd
+[TRACE]TRACE_FLOW[0x7]_CNCMCOEXISTBEARERWATCHER_CONSTRUCTL_DUP01=0xe
+[TRACE]TRACE_FLOW[0x7]_CNCMCOEXISTBEARERWATCHER_DOCANCEL=0x12
+[TRACE]TRACE_FLOW[0x7]_CNCMCOEXISTBEARERWATCHER_SETIPOVERUSBACTIVE=0xf
+[TRACE]TRACE_FLOW[0x7]_CNCMCOEXISTBEARERWATCHER_SETIPOVERUSBACTIVE_DUP02=0x10
+[TRACE]TRACE_FLOW[0x7]_CNCMCOEXISTBEARERWATCHER_SETIPOVERUSBACTIVE_DUP03=0x11
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMINTERFACESENDERANDRECEIVER_DOCANCEL_ENTRY=0x28
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMINTERFACESENDERANDRECEIVER_DOCANCEL_EXIT=0x29
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMINTERFACESENDERANDRECEIVER_READDATA_ENTRY=0x21
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMINTERFACESENDERANDRECEIVER_READDATA_EXIT=0x22
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMINTERFACESENDERANDRECEIVER_READDATA_EXIT_DUP1=0x23
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMINTERFACESENDERANDRECEIVER_READDATA_EXIT_DUP2=0x24
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMINTERFACESENDERANDRECEIVER_READDATA_EXIT_DUP3=0x25
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMINTERFACESENDERANDRECEIVER_READ_ENTRY=0x18
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMINTERFACESENDERANDRECEIVER_READ_EXIT=0x19
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMINTERFACESENDERANDRECEIVER_READ_EXIT_DUP1=0x1a
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMINTERFACESENDERANDRECEIVER_RUNL_ENTRY=0x26
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMINTERFACESENDERANDRECEIVER_RUNL_EXIT=0x27
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMINTERFACESENDERANDRECEIVER_START_ENTRY=0x13
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMINTERFACESENDERANDRECEIVER_START_EXIT=0x14
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMINTERFACESENDERANDRECEIVER_START_EXIT_DUP1=0x15
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMINTERFACESENDERANDRECEIVER_STOP_ENTRY=0x16
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMINTERFACESENDERANDRECEIVER_STOP_EXIT=0x17
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMINTERFACESENDERANDRECEIVER_WRITE_ENTRY=0x1b
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMINTERFACESENDERANDRECEIVER_WRITE_EXIT=0x1c
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMINTERFACESENDERANDRECEIVER_WRITE_EXIT_DUP1=0x1d
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMINTERFACESENDERANDRECEIVER_WRITE_EXIT_DUP2=0x1e
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMINTERFACESENDERANDRECEIVER_WRITE_EXIT_DUP3=0x1f
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMINTERFACESENDERANDRECEIVER_WRITE_EXIT_DUP4=0x20
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_CNCMCOMMUNICATIONINTERFACE_ENTRY=0x2c
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_CNCMCOMMUNICATIONINTERFACE_EXIT=0x2d
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_CONTROLMSGERROR_ENTRY=0x46
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_CONTROLMSGERROR_EXIT=0x47
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_DECODESETUP_ENTRY=0x35
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_DECODESETUP_EXIT=0x36
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_DOCANCEL_ENTRY=0x3f
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_DOCANCEL_EXIT=0x40
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_GETINTERFACENUMBER_ENTRY=0x4f
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_GETINTERFACENUMBER_EXIT=0x50
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_GETINTERFACENUMBER_EXIT_DUP1=0x51
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_GETINTERFACENUMBER_EXIT_DUP2=0x52
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_GETINTERFACENUMBER_EXIT_DUP3=0x53
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_NEWL_ENTRY=0x2a
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_NEWL_EXIT=0x2b
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_PARSEDATAOUT_ENTRY=0x39
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_PARSEDATAOUT_EXIT=0x3a
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_READDATAOUT_ENTRY=0x37
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_READDATAOUT_EXIT=0x38
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_READSETUP_ENTRY=0x32
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_READSETUP_EXIT=0x33
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_READSETUP_EXIT_DUP1=0x34
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_RUNL_ENTRY=0x43
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_RUNL_EXIT=0x44
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_RUNL_EXIT_DUP1=0x45
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_SENDCONNECTIONNOTIFICATION_ENTRY=0x3b
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_SENDSPEEDNOTIFICATION_ENTRY=0x3c
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_START_ENTRY=0x2e
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_START_EXIT=0x2f
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_START_EXIT_DUP1=0x30
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_START_EXIT_DUP2=0x31
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_STOP_ENTRY=0x41
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_STOP_EXIT=0x42
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_WRITEDATAIN_ENTRY=0x3d
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_WRITEDATAIN_EXIT=0x3e
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_WRITEINTERRUPTDATA_ENTRY=0x48
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_WRITEINTERRUPTDATA_EXIT=0x49
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_WRITEINTERRUPTDATA_EXIT_DUP1=0x4a
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_WRITEINTERRUPTDATA_EXIT_DUP2=0x4b
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_WRITEINTERRUPTDATA_EXIT_DUP3=0x4c
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_WRITEINTERRUPTDATA_EXIT_DUP4=0x4d
+[TRACE]TRACE_FLOW[0x7]_CNCMCOMMUNICATIONINTERFACE_WRITEINTERRUPTDATA_EXIT_DUP5=0x4e
+[TRACE]TRACE_FLOW[0x7]_CNCMDATAINTERFACE_CNCMDATAINTERFACE_DUP01=0x56
+[TRACE]TRACE_FLOW[0x7]_CNCMDATAINTERFACE_CNCMDATAINTERFACE_DUP02=0x57
+[TRACE]TRACE_FLOW[0x7]_CNCMDATAINTERFACE_CONSTRUCTL=0x54
+[TRACE]TRACE_FLOW[0x7]_CNCMDATAINTERFACE_CONSTRUCTL_DUP01=0x55
+[TRACE]TRACE_FLOW[0x7]_CNCMDATAINTERFACE_START=0x58
+[TRACE]TRACE_FLOW[0x7]_CNCMDATAINTERFACE_START_DUP01=0x59
+[TRACE]TRACE_FLOW[0x7]_CNCMDATAINTERFACE_STOP=0x5a
+[TRACE]TRACE_FLOW[0x7]_CNCMDATAINTERFACE_STOP_DUP01=0x5b
+[TRACE]TRACE_FLOW[0x7]_CNCMDATARECEIVER_CNCMDATARECEIVER_DUP01=0x5e
+[TRACE]TRACE_FLOW[0x7]_CNCMDATARECEIVER_DOCANCEL=0x64
+[TRACE]TRACE_FLOW[0x7]_CNCMDATARECEIVER_NEWL=0x5c
+[TRACE]TRACE_FLOW[0x7]_CNCMDATARECEIVER_NEWL_DUP01=0x5d
+[TRACE]TRACE_FLOW[0x7]_CNCMDATARECEIVER_READDATA=0x62
+[TRACE]TRACE_FLOW[0x7]_CNCMDATARECEIVER_READDATA_DUP01=0x63
+[TRACE]TRACE_FLOW[0x7]_CNCMDATARECEIVER_START=0x5f
+[TRACE]TRACE_FLOW[0x7]_CNCMDATARECEIVER_START_DUP02=0x60
+[TRACE]TRACE_FLOW[0x7]_CNCMDATARECEIVER_START_DUP03=0x61
+[TRACE]TRACE_FLOW[0x7]_CNCMDATARECEIVER_STOP=0x65
+[TRACE]TRACE_FLOW[0x7]_CNCMDATARECEIVER_STOP_DUP01=0x66
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_DOCANCEL_ENTRY=0x7a
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_DOCANCEL_EXIT=0x7b
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_NEWL_ENTRY=0x67
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_NEWL_EXIT=0x68
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_RUNL_ENTRY=0x70
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_RUNL_EXIT=0x71
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_RUNL_EXIT_DUP1=0x72
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_SENDNTBCOMPLETE_ENTRY=0x7f
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_SENDNTBCOMPLETE_EXIT=0x80
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_SENDNTBPAYLOAD_ENTRY=0x7c
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_SENDNTBPAYLOAD_EXIT=0x7d
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_SENDNTBPAYLOAD_EXIT_DUP1=0x7e
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_SEND_ENTRY=0x75
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_SEND_EXIT=0x76
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_SEND_EXIT_DUP1=0x77
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_SEND_EXIT_DUP2=0x78
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_SEND_EXIT_DUP3=0x79
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_SETINEPBUFFERSIZE_ENTRY=0x88
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_SETINEPBUFFERSIZE_EXIT=0x89
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_SETNTBINMAXSIZE_ENTRY=0x81
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_SETNTBINMAXSIZE_EXIT=0x82
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_SETNTBINMAXSIZE_EXIT_DUP1=0x83
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_SETNTBINMAXSIZE_EXIT_DUP2=0x84
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_SETNTBINMAXSIZE_EXIT_DUP4=0x85
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_STARTNEWNTB_ENTRY=0x73
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_STARTNEWNTB_EXIT=0x74
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_START_ENTRY=0x69
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_START_EXIT=0x6a
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_START_EXIT_DUP1=0x6b
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_START_EXIT_DUP2=0x6c
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_START_EXIT_DUP3=0x6d
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_START_EXIT_DUP4=0x6e
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_START_EXIT_DUP5=0x6f
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_STOP_ENTRY=0x86
+[TRACE]TRACE_FLOW[0x7]_CNCMDATASENDER_STOP_EXIT=0x87
+[TRACE]TRACE_FLOW[0x7]_CNCMENGINE_CNCMENGINE_DUP10=0x8e
+[TRACE]TRACE_FLOW[0x7]_CNCMENGINE_CNCMENGINE_DUP11=0x8f
+[TRACE]TRACE_FLOW[0x7]_CNCMENGINE_CONSTRUCTL=0x8c
+[TRACE]TRACE_FLOW[0x7]_CNCMENGINE_CONSTRUCTL_DUP01=0x8d
+[TRACE]TRACE_FLOW[0x7]_CNCMENGINE_DOCANCEL=0x96
+[TRACE]TRACE_FLOW[0x7]_CNCMENGINE_DONCMSTARTED=0x97
+[TRACE]TRACE_FLOW[0x7]_CNCMENGINE_HANDLEGETNTBINPUTSIZE=0x9d
+[TRACE]TRACE_FLOW[0x7]_CNCMENGINE_HANDLEGETNTBPARAM=0x9c
+[TRACE]TRACE_FLOW[0x7]_CNCMENGINE_HANDLESETNTBINPUTSIZE=0x9b
+[TRACE]TRACE_FLOW[0x7]_CNCMENGINE_INITLDDL=0x90
+[TRACE]TRACE_FLOW[0x7]_CNCMENGINE_INITLDDL_DUP01=0x91
+[TRACE]TRACE_FLOW[0x7]_CNCMENGINE_NEWL=0x8a
+[TRACE]TRACE_FLOW[0x7]_CNCMENGINE_NEWL_DUP01=0x8b
+[TRACE]TRACE_FLOW[0x7]_CNCMENGINE_NOTIFYDHCPSTARTED=0x9e
+[TRACE]TRACE_FLOW[0x7]_CNCMENGINE_RESUMESENDING=0x9f
+[TRACE]TRACE_FLOW[0x7]_CNCMENGINE_START=0x92
+[TRACE]TRACE_FLOW[0x7]_CNCMENGINE_STARTDATALAYER=0x98
+[TRACE]TRACE_FLOW[0x7]_CNCMENGINE_START_DUP10=0x93
+[TRACE]TRACE_FLOW[0x7]_CNCMENGINE_START_DUP11=0x94
+[TRACE]TRACE_FLOW[0x7]_CNCMENGINE_START_DUP12=0x95
+[TRACE]TRACE_FLOW[0x7]_CNCMENGINE_STOP=0x9a
+[TRACE]TRACE_FLOW[0x7]_CNCMENGINE_STOPDATALAYER=0x99
+[TRACE]TRACE_FLOW[0x7]_CNCMNTB16BUILDER_APPENDPACKET_ENTRY=0xa9
+[TRACE]TRACE_FLOW[0x7]_CNCMNTB16BUILDER_APPENDPACKET_EXIT=0xaa
+[TRACE]TRACE_FLOW[0x7]_CNCMNTB16BUILDER_BUILDNDP_ENTRY=0xa7
+[TRACE]TRACE_FLOW[0x7]_CNCMNTB16BUILDER_BUILDNDP_EXIT=0xa8
+[TRACE]TRACE_FLOW[0x7]_CNCMNTB16BUILDER_BUILDNTBHEADER_ENTRY=0xa5
+[TRACE]TRACE_FLOW[0x7]_CNCMNTB16BUILDER_BUILDNTBHEADER_EXIT=0xa6
+[TRACE]TRACE_FLOW[0x7]_CNCMNTB16BUILDER_COMPLETENTBBUILD_ENTRY=0xac
+[TRACE]TRACE_FLOW[0x7]_CNCMNTB16BUILDER_COMPLETENTBBUILD_EXIT=0xad
+[TRACE]TRACE_FLOW[0x7]_CNCMNTB16BUILDER_NEWL_ENTRY=0xa0
+[TRACE]TRACE_FLOW[0x7]_CNCMNTB16BUILDER_NEWL_EXIT=0xa1
+[TRACE]TRACE_FLOW[0x7]_CNCMNTB16BUILDER_RESET_ENTRY=0xb0
+[TRACE]TRACE_FLOW[0x7]_CNCMNTB16BUILDER_RESET_EXIT=0xb1
+[TRACE]TRACE_FLOW[0x7]_CNCMNTB16BUILDER_SETNTBINMAXSIZE_ENTRY=0xa2
+[TRACE]TRACE_FLOW[0x7]_CNCMNTB16BUILDER_SETNTBINMAXSIZE_EXIT=0xa3
+[TRACE]TRACE_FLOW[0x7]_CNCMNTB16BUILDER_STARTNEWNTB_ENTRY=0xae
+[TRACE]TRACE_FLOW[0x7]_CNCMNTB16BUILDER_STARTNEWNTB_EXIT=0xaf
+[TRACE]TRACE_FLOW[0x7]_CNCMNTBBUILDSIMPLEPOLICY_CNCMNTBBUILDSIMPLEPOLICY_ENTRY=0xb4
+[TRACE]TRACE_FLOW[0x7]_CNCMNTBBUILDSIMPLEPOLICY_CNCMNTBBUILDSIMPLEPOLICY_EXIT=0xb5
+[TRACE]TRACE_FLOW[0x7]_CNCMNTBBUILDSIMPLEPOLICY_COMPLETENTBBUILD_ENTRY=0xbb
+[TRACE]TRACE_FLOW[0x7]_CNCMNTBBUILDSIMPLEPOLICY_COMPLETENTBBUILD_EXIT=0xbc
+[TRACE]TRACE_FLOW[0x7]_CNCMNTBBUILDSIMPLEPOLICY_DOCANCEL_ENTRY=0xb6
+[TRACE]TRACE_FLOW[0x7]_CNCMNTBBUILDSIMPLEPOLICY_DOCANCEL_EXIT=0xb7
+[TRACE]TRACE_FLOW[0x7]_CNCMNTBBUILDSIMPLEPOLICY_NEWL_ENTRY=0xb2
+[TRACE]TRACE_FLOW[0x7]_CNCMNTBBUILDSIMPLEPOLICY_NEWL_EXIT=0xb3
+[TRACE]TRACE_FLOW[0x7]_CNCMNTBBUILDSIMPLEPOLICY_RUNL_ENTRY=0xb8
+[TRACE]TRACE_FLOW[0x7]_CNCMNTBBUILDSIMPLEPOLICY_RUNL_EXIT=0xb9
+[TRACE]TRACE_FLOW[0x7]_CNCMNTBBUILDSIMPLEPOLICY_RUNL_EXIT_DUP1=0xba
+[TRACE]TRACE_FLOW[0x7]_CNCMNTBBUILDSIMPLEPOLICY_STARTNEWNTB_ENTRY=0xbd
+[TRACE]TRACE_FLOW[0x7]_CNCMNTBBUILDSIMPLEPOLICY_STARTNEWNTB_EXIT=0xbe
+[TRACE]TRACE_FLOW[0x7]_CNCMNTBBUILDSIMPLEPOLICY_UPDATENTB_ENTRY=0xbf
+[TRACE]TRACE_FLOW[0x7]_CNCMNTBBUILDSIMPLEPOLICY_UPDATENTB_EXIT=0xc0
+[TRACE]TRACE_FLOW[0x7]_CNCMNTB_DUP116BUILDER_APPENDPACKET_EXIT=0xab
+[TRACE]TRACE_FLOW[0x7]_CNCMNTB_DUP116BUILDER_SETNTBINMAXSIZE_EXIT=0xa4
+[TRACE]TRACE_FLOW[0x7]_CNCMPKTDRV_CONSTRUCTL=0xc1
+[TRACE]TRACE_FLOW[0x7]_CNCMPKTDRV_STARTINTERFACE=0xc2
+[TRACE]TRACE_FLOW[0x7]_CNCMPKTDRV_STARTINTERFACE_DUP01=0xc3
+[TRACE]TRACE_FLOW[0x7]_CNCMPKTDRV_STOPINTERFACE=0xc4
+[TRACE]TRACE_FLOW[0x7]_CNCMSESSION_SERVICEL=0xcb
+[TRACE]TRACE_FLOW[0x7]_CNCMSHAREDSTATEMANAGER_CNCMSHAREDSTATEMANAGER=0xc5
+[TRACE]TRACE_FLOW[0x7]_CNCMSHAREDSTATEMANAGER_CNCMSHAREDSTATEMANAGER_DUP01=0xc6
+[TRACE]TRACE_FLOW[0x7]_CNCMSHAREDSTATEMANAGER_CONSTRUCTL=0xc7
+[TRACE]TRACE_FLOW[0x7]_CNCMSHAREDSTATEMANAGER_CONSTRUCTL_DUP01=0xc8
+[TRACE]TRACE_FLOW[0x7]_CNCMSHAREDSTATEMANAGER_NOTIFYDHCPPROVISIONREQUESTED=0xc9
+[TRACE]TRACE_FLOW[0x7]_CNCMSHAREDSTATEMANAGER_NOTIFYDHCPPROVISIONREQUESTED_DUP01=0xca
+[TRACE]TRACE_NORMAL[0x3]_CNCMBUFFERMANAGER_INITBUFFERAREA=0x1
+[TRACE]TRACE_NORMAL[0x3]_CNCMBUFFERMANAGER_ISCONGESTION=0x3
+[TRACE]TRACE_NORMAL[0x3]_CNCMBUFFERMANAGER_SETBUFFERCELLSIZE=0x2
+[TRACE]TRACE_NORMAL[0x3]_CNCMCOEXISTBEARERWATCHER_RUNL=0x6
+[TRACE]TRACE_NORMAL[0x3]_CNCMCOEXISTBEARERWATCHER_RUNL_DUP01=0x7
+[TRACE]TRACE_NORMAL[0x3]_CNCMCOEXISTBEARERWATCHER_SETIPOVERUSBACTIVE_DUP01=0x4
+[TRACE]TRACE_NORMAL[0x3]_CNCMCOEXISTBEARERWATCHER_SETIPOVERUSBDEACTIVE=0x5
+[TRACE]TRACE_NORMAL[0x3]_CNCMCOMMINTERFACESENDERANDRECEIVER_READ=0x8
+[TRACE]TRACE_NORMAL[0x3]_CNCMCOMMINTERFACESENDERANDRECEIVER_READDATA=0xa
+[TRACE]TRACE_NORMAL[0x3]_CNCMCOMMINTERFACESENDERANDRECEIVER_READDATA1=0xb
+[TRACE]TRACE_NORMAL[0x3]_CNCMCOMMINTERFACESENDERANDRECEIVER_READDATA2=0xc
+[TRACE]TRACE_NORMAL[0x3]_CNCMCOMMINTERFACESENDERANDRECEIVER_READDATA3=0xd
+[TRACE]TRACE_NORMAL[0x3]_CNCMCOMMINTERFACESENDERANDRECEIVER_READDATA4=0xe
+[TRACE]TRACE_NORMAL[0x3]_CNCMCOMMINTERFACESENDERANDRECEIVER_RUNL=0xf
+[TRACE]TRACE_NORMAL[0x3]_CNCMCOMMINTERFACESENDERANDRECEIVER_RUNL1=0x10
+[TRACE]TRACE_NORMAL[0x3]_CNCMCOMMINTERFACESENDERANDRECEIVER_RUNL2=0x11
+[TRACE]TRACE_NORMAL[0x3]_CNCMCOMMINTERFACESENDERANDRECEIVER_WRITE=0x9
+[TRACE]TRACE_NORMAL[0x3]_CNCMCOMMUNICATIONINTERFACE_CONTROLMSGERROR=0x12
+[TRACE]TRACE_NORMAL[0x3]_CNCMDATAINTERFACE_ACTIVATELDD=0x13
+[TRACE]TRACE_NORMAL[0x3]_CNCMDATAINTERFACE_RUNL=0x14
+[TRACE]TRACE_NORMAL[0x3]_CNCMDATARECEIVER_READDATA_DUP02=0x15
+[TRACE]TRACE_NORMAL[0x3]_CNCMDATASENDER_RUNL=0x17
+[TRACE]TRACE_NORMAL[0x3]_CNCMDATASENDER_SEND2=0x18
+[TRACE]TRACE_NORMAL[0x3]_CNCMDATASENDER_SENDNTBCOMPLETE3=0x1d
+[TRACE]TRACE_NORMAL[0x3]_CNCMDATASENDER_SENDNTBPAYLOAD=0x19
+[TRACE]TRACE_NORMAL[0x3]_CNCMDATASENDER_SENDNTBPAYLOAD1=0x1a
+[TRACE]TRACE_NORMAL[0x3]_CNCMDATASENDER_SENDNTBPAYLOAD2=0x1b
+[TRACE]TRACE_NORMAL[0x3]_CNCMDATASENDER_SENDNTBPAYLOAD3=0x1c
+[TRACE]TRACE_NORMAL[0x3]_CNCMDATASENDER_SETINEPBUFFERSIZE=0x1f
+[TRACE]TRACE_NORMAL[0x3]_CNCMDATASENDER_SETNTBINMAXSIZE=0x1e
+[TRACE]TRACE_NORMAL[0x3]_CNCMDATASENDER_START4=0x16
+[TRACE]TRACE_NORMAL[0x3]_CNCMENGINE_CONTROLERROR=0x22
+[TRACE]TRACE_NORMAL[0x3]_CNCMENGINE_HANDLEALTSETTING=0x28
+[TRACE]TRACE_NORMAL[0x3]_CNCMENGINE_INTERFACEADDRESS=0x25
+[TRACE]TRACE_NORMAL[0x3]_CNCMENGINE_PROCESSRECEIVEDDATAGRAM=0x27
+[TRACE]TRACE_NORMAL[0x3]_CNCMENGINE_RANDOMMACADDRESSL=0x26
+[TRACE]TRACE_NORMAL[0x3]_CNCMENGINE_RUNL=0x21
+[TRACE]TRACE_NORMAL[0x3]_CNCMENGINE_SEND=0x24
+[TRACE]TRACE_NORMAL[0x3]_CNCMENGINE_SETINEPBUFFERSIZE=0x29
+[TRACE]TRACE_NORMAL[0x3]_CNCMENGINE_STARTDATALAYER_DUP02=0x23
+[TRACE]TRACE_NORMAL[0x3]_CNCMENGINE_START_DUP02=0x20
+[TRACE]TRACE_NORMAL[0x3]_CNCMNTB16BUILDER_BUILDNTBHEADER=0x2a
+[TRACE]TRACE_NORMAL[0x3]_CNCMNTB16PARSER_DATAPACKET=0x34
+[TRACE]TRACE_NORMAL[0x3]_CNCMNTB16PARSER_PARSE=0x2d
+[TRACE]TRACE_NORMAL[0x3]_CNCMNTB16PARSER_PARSENCMNTB16HEADER_DUP01=0x31
+[TRACE]TRACE_NORMAL[0x3]_CNCMNTB16PARSER_PARSENCMNTB16NDPDATAGRAM=0x32
+[TRACE]TRACE_NORMAL[0x3]_CNCMNTB16PARSER_PARSENCMNTB16NDPDATAGRAM_DUP01=0x33
+[TRACE]TRACE_NORMAL[0x3]_CNCMNTB16PARSER_PARSE_DUP01=0x2e
+[TRACE]TRACE_NORMAL[0x3]_CNCMNTB16PARSER_PARSE_DUP02=0x2f
+[TRACE]TRACE_NORMAL[0x3]_CNCMNTB16PARSER_SEARCHNCMHEAD=0x30
+[TRACE]TRACE_NORMAL[0x3]_CNCMNTBBUILDSIMPLEPOLICY_RUNL=0x2b
+[TRACE]TRACE_NORMAL[0x3]_CNCMNTBBUILDSIMPLEPOLICY_UPDATENTB=0x2c
+[TRACE]TRACE_NORMAL[0x3]_CNCMPKTDRV_STARTINTERFACE_DUP02=0x35
+[TRACE]TRACE_NORMAL[0x3]_CNCMSESSION_SERVICEL_DUP01=0x38
+[TRACE]TRACE_NORMAL[0x3]_CNCMSHAREDSTATEMANAGER_RUNL=0x36
+[TRACE]TRACE_NORMAL[0x3]_CNCMSHAREDSTATEMANAGER_SETSTATEVALUE=0x37
+[TRACE]TRACE_WARNING[0x41]_CNCMCOEXISTBEARERWATCHER_DOACTIVE_DUP04=0x1
+[TRACE]TRACE_WARNING[0x41]_CNCMCOMMUNICATIONINTERFACE_PARSEDATAOUT=0x3
+[TRACE]TRACE_WARNING[0x41]_CNCMCOMMUNICATIONINTERFACE_START=0x2
+[TRACE]TRACE_WARNING[0x41]_CNCMDATASENDER_SEND1=0x4
+[TRACE]TRACE_WARNING[0x41]_CNCMENGINE_NOTIFYDHCPSTARTED_DUP01=0x7
+[TRACE]TRACE_WARNING[0x41]_CNCMENGINE_STARTDATALAYER_DUP01=0x5
+[TRACE]TRACE_WARNING[0x41]_CNCMENGINE_STARTDATALAYER_DUP03=0x6
+[TRACE]TRACE_WARNING[0x41]_CNCMSHAREDSTATEMANAGER_SETSTATEVALUE_DUP01=0x8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/server/group/server.mmh	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,22 @@
+/*
+* 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:
+*
+*/
+
+USERINCLUDE   ../inc
+
+SOURCEPATH    ../src
+SOURCE        ncmserver.cpp
+SOURCE        ncmsession.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/server/inc/ncmserver.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* 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
+ @internalComponent
+*/
+
+#ifndef NCMSERVER_H
+#define NCMSERVER_H
+
+#include <e32base.h>
+
+class CNcmEngine;
+
+NONSHARABLE_CLASS(CNcmServer) : public CPolicyServer
+    {
+public:
+    static CNcmServer* NewL(CNcmEngine& aEngine);
+    ~CNcmServer();
+
+private:
+    CNcmServer(CNcmEngine& aEngine);
+    
+private:
+    // from CPolicyServer
+    CSession2* NewSessionL(const TVersion &aVersion, const RMessage2& aMessage) const;
+    
+private:
+    // unowned
+    CNcmEngine& iNcmEngine;
+    };
+
+#endif // NCMSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/server/inc/ncmserverconsts.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,64 @@
+/*
+* 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
+ @internalComponent
+*/
+
+#ifndef NCMSERVERCONSTS_H
+#define NCMSERVERCONSTS_H
+
+#include <e32base.h>
+
+_LIT(KNcmServerName, "!NcmInternalSrv");
+
+/** Version numbers. */
+const TInt8 KNcmSrvMajorVersionNumber = 1;
+const TInt8 KNcmSrvMinorVersionNumber = 1;
+const TInt16 KNcmSrvBuildNumber = 0;
+
+/** IPC messages supported by the server. */
+enum TNcmIpc
+    {
+    ENcmTransferHandle              = 0,
+    ENcmSetIapId,
+    ENcmSetDhcpResult,
+    ENcmDhcpProvisionNotify,
+    ENcmDhcpProvisionNotifyCancel,
+    ENcmTransferBufferSize,
+    ENcmNotSupport
+    };
+
+/** Panic category with which the NCM server panics the client. */
+_LIT(KNcmSrvPanic,"NCMInternSrv");
+
+/** Panic codes with which the NCM server panics the client. */
+enum TNcmSvrPanic
+    {
+    /** The client has sent a bad IPC message number. */
+    ENcmBadNcmMessage        = 0
+    };
+
+/** Set value to server. the value is defined by type.*/
+enum TNcmSetType
+    {
+    ENcmSetTypeIapId,
+    ENcmSetTypeDhcpReturn
+    };
+
+#endif // NCMSERVERCONSTS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/server/inc/ncmserversecuritypolicy.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* 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 
+ @internalComponent
+*/
+ 
+#ifndef NCMSERVERSECURITYPOLICY_H
+#define NCMSERVERSECURITYPOLICY_H
+
+#include <e32base.h>
+#include "ncmserverconsts.h"
+
+/** NCM Server Security Policy Definition */
+const TInt KNcmServerRanges[] = 
+    {
+    ENcmTransferHandle,             /** pass */
+    ENcmNotSupport,        /** fail (to KMaxTInt) */
+    };
+
+const TUint KNcmServerRangeCount = sizeof(KNcmServerRanges) / sizeof(KNcmServerRanges[0]);
+
+/** Index numbers into KAcmServerElements[] */
+const TInt KPolicyPass = 0;
+
+/** Mapping IPCs to policy element */
+const TUint8 KNcmServerElementsIndex[KNcmServerRangeCount] = 
+    {
+    KPolicyPass,                  /** All (valid) APIs */
+    CPolicyServer::ENotSupported,   /** remainder of possible IPCs */
+    };
+
+/** Individual policy elements */
+const CPolicyServer::TPolicyElement KNcmServerElements[] = 
+    {
+        { 
+        // These caps are those of USBSVR's process. This is the recommended 
+        // way to check that an API is called by a specific process only. [The 
+        // alternative would be an SID check.]
+        //_INIT_SECURITY_POLICY_C5(ECapabilityCommDD, ECapabilityNetworkControl, ECapabilityNetworkServices, ECapabilityLocalServices, ECapabilityProtServ), CPolicyServer::EFailClient
+        _INIT_SECURITY_POLICY_PASS
+        },
+    };
+
+/** Main policy */
+const CPolicyServer::TPolicy KNcmServerPolicy = 
+    {
+    CPolicyServer::EAlwaysPass, /** Specifies all connect attempts should pass */
+    KNcmServerRangeCount,
+    KNcmServerRanges,
+    KNcmServerElementsIndex,
+    KNcmServerElements,
+    };
+    
+#endif // NCMSERVERSECURITYPOLICY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/server/inc/ncmsession.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* 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
+ @internalComponent
+*/
+
+#ifndef NCMSESSION_H
+#define NCMSESSION_H
+
+#include <e32base.h>
+
+
+class CNcmEngine;
+
+NONSHARABLE_CLASS(CNcmSession) : public CSession2
+    {
+public:
+    static CNcmSession* NewL(CNcmEngine& aEngine);
+    ~CNcmSession();
+
+private:
+    CNcmSession(CNcmEngine& aEngine);
+
+private: // from CSession2
+    /**
+    Called when a message is received from the client.
+    @param aMessage Message received from the client.
+    */
+    void ServiceL(const RMessage2& aMessage);
+
+private:
+    // unowned
+    CNcmEngine& iNcmEngine;
+    };
+
+#endif // NCMSESSION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/server/src/ncmserver.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,77 @@
+/*
+* 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
+ @internalComponent
+*/
+
+
+#include "ncmserver.h"
+#include "ncmsession.h"
+#include "ncmserversecuritypolicy.h"
+#include "ncmserverconsts.h"
+
+
+CNcmServer* CNcmServer::NewL(CNcmEngine& aEngine)
+    {
+    CNcmServer* self = new(ELeave) CNcmServer(aEngine);
+    CleanupStack::PushL(self);
+    TInt err = self->Start(KNcmServerName);
+    // KErrAlreadyExists is a success case (c.f. transient server boilerplate
+    // code).
+    if ( err != KErrAlreadyExists )
+        {
+        User::LeaveIfError(err);
+        }
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CNcmServer::~CNcmServer()
+    {
+    }
+
+CNcmServer::CNcmServer(CNcmEngine& aEngine)
+ :  CPolicyServer(CActive::EPriorityStandard, KNcmServerPolicy, ESharableSessions),
+    iNcmEngine(aEngine)
+    {
+    }
+
+CSession2* CNcmServer::NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const
+    {
+    //Validate session as coming from UsbSvr
+    static _LIT_SECURITY_POLICY_S0(KSidPolicy, 0x101fe1db);
+    TBool auth = KSidPolicy.CheckPolicy(aMessage);
+    if(!auth)
+        {
+        User::Leave(KErrPermissionDenied);
+        }
+
+    // Version number check...
+    TVersion v( KNcmSrvMajorVersionNumber,
+                KNcmSrvMinorVersionNumber,
+                KNcmSrvBuildNumber);
+
+    if ( !User::QueryVersionSupported(v, aVersion) )
+        {
+        User::Leave(KErrNotSupported);
+        }
+
+    CNcmSession* sess = CNcmSession::NewL(iNcmEngine);
+    return sess;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/classimplementation/ncmpktdrv/server/src/ncmsession.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,117 @@
+/*
+* 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
+ @internalComponent
+*/
+
+#include <e32base.h>
+
+#include "ncmserverconsts.h"
+#include "ncmsession.h"
+#include "ncmengine.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "ncmsessionTraces.h"
+#endif
+
+
+
+CNcmSession* CNcmSession::NewL(CNcmEngine& aEngine)
+    {
+    CNcmSession* self = new(ELeave) CNcmSession(aEngine);
+    return self;
+    }
+
+CNcmSession::CNcmSession(CNcmEngine& aEngine)
+    : iNcmEngine(aEngine)
+    {
+    }
+
+CNcmSession::~CNcmSession()
+    {
+    }
+
+void CNcmSession::ServiceL(const RMessage2& aMessage)
+    {
+    OstTraceFunctionEntry0(CNCMSESSION_SERVICEL);
+
+    OstTraceExt3(TRACE_NORMAL,CNCMSESSION_SERVICEL_DUP01, "CNcmSession::ServiceL %d %d %d", aMessage.Function(),
+        aMessage.Int0(), aMessage.Int1());
+
+    switch ( aMessage.Function() )
+        {
+    case ENcmTransferHandle:
+        {
+        RMessagePtr2 messagePtr(aMessage);
+        TInt ret = iNcmEngine.Start(messagePtr);
+
+        aMessage.Complete(ret);
+        break;
+        }
+
+    case ENcmSetIapId:
+        {
+        TInt iap  = aMessage.Int0();
+        TInt ret = iNcmEngine.SetStateToWatcher(ENcmSetTypeIapId, iap);
+
+        aMessage.Complete(ret);
+        }
+        break;
+
+    case ENcmSetDhcpResult:
+        {
+        TInt result = aMessage.Int0();
+        TInt ret =  iNcmEngine.SetStateToWatcher(ENcmSetTypeDhcpReturn, result);
+
+        aMessage.Complete(ret);
+        }
+        break;
+
+    case ENcmDhcpProvisionNotify:
+        {
+        TInt ret = iNcmEngine.RegisterNotify(aMessage);
+
+        if (KErrNone != ret)
+            {
+            aMessage.Complete(ret);
+            }
+        }
+        break;
+
+    case ENcmDhcpProvisionNotifyCancel:
+        {
+        iNcmEngine.DeRegisterNotify();
+        aMessage.Complete(KErrNone);
+        }
+        break;
+
+    case ENcmTransferBufferSize:
+        {
+        TInt size  = aMessage.Int0();
+        TInt ret = iNcmEngine.SetInEpBufferSize(size);
+        aMessage.Complete(ret);
+        }
+        break;
+
+    default:
+        // Unknown function, panic the user
+        aMessage.Panic(KNcmSrvPanic, ENcmBadNcmMessage);
+        break;
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/group/bld.inf	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* 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:
+*
+*/
+
+#if !(defined(WINS) || defined(WINSCW))	
+#include "../classimplementation/group/bld.inf"
+#include "../classcontroller/group/bld.inf"
+#endif
+
+PRJ_EXPORTS
+../public/usbncm.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(usb/usbncm.h)
+
+PRJ_MMPFILES
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/inc/ncmcommon.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,79 @@
+/*
+* 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
+@internalTechnology
+ */
+
+#ifndef NCMCOMMON_H
+#define NCMCOMMON_H
+
+#ifndef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
+#error "NCM needs the 3-plane comms environment!"
+#endif
+
+#include <usb/usbncm.h>
+
+#ifndef __OVER_DUMMYUSBSCLDD__
+#include <comms-infras/nifprvar.h>
+#include <d32ethernet.h> //FOR KEthernetAddressLength
+#else
+#include <usb/testncm/ethinter.h>
+#endif
+
+//property's category UID.
+//This Property is used to indicate the Packet Driver that it's started by NCM Class Controller.
+#ifdef OVERDUMMY_NCMCC
+static const TUid KUsbmanSvrUid = {0x2002EA88}; //
+#else
+static const TUid KUsbmanSvrUid = {0x101fe1db};
+#endif // OVERDUMMY_NCMCC
+
+//property's sub-key.
+static const TUint KKeyNcmSharedState = 0x2002C340;
+
+//Platform Security for the property.
+static _LIT_SECURITY_POLICY_PASS(KAllowAllPolicy);
+static _LIT_SECURITY_POLICY_C1(KNetworkControlPolicy, ECapabilityNetworkControl);
+static _LIT_SECURITY_POLICY_C1(KCommDDPolicy, ECapabilityCommDD);
+
+
+/**
+NCM network device MAC address.
+*/
+typedef TBuf8<KEthernetAddressLength> TNcmMacAddress;
+
+/**
+NCM SharedState between NCM Class Controller and Packet Driver.
+*/
+enum TNcmSharedState
+    {
+    ENcmStateIntial = 0,
+    ENcmStartRequested = 1, // NCM class controller is request NCM packet driver
+    ENcmStateEndMark
+    };
+
+/**
+ Packet driver progress to Comms
+ */
+enum TNcmNifProgress
+    {
+    ENcmPktDrvFatalError    = KMinNifProgress   // NCM packet driver fatal error
+    };
+
+#endif // NCMCOMMON_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/inc/ncminternalsrv.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,92 @@
+/*
+* 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
+ @internalTechnology
+*/
+
+#ifndef NCMINTERNALSRV_H
+#define NCMINTERNALSRV_H
+
+#include <e32base.h>
+
+/**
+Client-side interface of the NCM internal server for the communication between the NCM Class Controller and the Packet Driver.
+*/
+NONSHARABLE_CLASS(RNcmInternalSrv) : public RSessionBase
+    {
+public:
+    IMPORT_C RNcmInternalSrv();
+    IMPORT_C ~RNcmInternalSrv();
+
+public:
+    /**
+    Connect the handle to the server.
+    Must be called before all other methods (except Version and Close).
+    @return Symbian error code
+    */
+    IMPORT_C TInt Connect();
+    /**
+    Getter for the version of the server.
+    @return Version of the server
+    */
+    IMPORT_C TVersion Version() const;
+
+public:
+    /**
+     Transfer the Ldd's handles from NCM Class Controller to the Packet Driver.
+     @param[in]   aCommHandle, the Communication Interface handle.
+     @param[in]   aCommChunk, the Communication Interface's RChunk handle.
+     @param[in]   aDataHandle, the Data Interface handle.
+     @param[in]   aDataChunk, the Data Interface's RChunk handle.
+     @return      KErrNone, successfully transferred handle to Packet Driver.
+                  others, system-wide error code.
+    */
+    IMPORT_C TInt TransferHandle(RHandleBase& aCommHandle, RHandleBase& aCommChunk, RHandleBase& aDataHandle, RHandleBase& aDataChunk);
+    /**
+    Set this RConnection's IapId to Packet Driver.
+    @param[in]    aIapId, the RConnection's, which loads the Packet Driver, IapId.
+    @return       KErrNone, successfully set IapId.
+                  others, system-wide error code.
+    */
+    IMPORT_C TInt SetIapId(TUint aIapId);
+    /**
+    Set the DHCP Provision result to Packet Driver.
+    @param[in]    aResult, the result of DHCP Provision done by Class Controller.
+    @return       KErrNone, successfully set the result to Packet Driver.
+                  others, system-wide error code.
+    */
+    IMPORT_C TInt SetDhcpResult(TInt aResult);
+    /**
+    Register the notification of doing DHCP Provision.
+    @param[in,out] aStatus, the request status to be registered.
+    */
+    IMPORT_C void DhcpProvisionNotify(TRequestStatus& aStatus);
+    /**
+    Cancel the registration of DHCP Provision.
+    */
+    IMPORT_C void DhcpProvisionNotifyCancel();
+    /**
+    Transfer the buffer size of in endpoint of data interface.
+    */
+    IMPORT_C TInt TransferBufferSize(TUint aSize);
+
+private:
+    };
+
+#endif // NCMINTERNALSRV_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/ncm/public/usbncm.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,164 @@
+/*
+* 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
+@publishedPartner
+*/
+
+#ifndef USBNCM_H
+#define USBNCM_H
+
+//INCLUDES
+#include <e32std.h>
+
+/** Defines the exported P&S key and data structure of the value. */
+namespace UsbNcm
+    {
+    /** The property's category UID.
+     *  This property is to notify the NCM connection state.
+     */
+    static const TUid  KCatNcmSvrUid = {0x101F7989};
+
+    /** The property's sub-key.*/
+    static const TUint KKeyNcmConnectionEvent = 0x2002C33F;
+
+
+    /** NCM connection state.*/
+    enum TNcmConnectionState
+      {
+      ENcmStateDisconnected = 0,
+      ENcmStateConnected,
+      ENcmStateMax
+      };
+
+    /**
+     * Defines the NCM connection event, which contains the IapId, NCM connection state and corresponding error code.
+     * The NCM connection is a special one which can not only be used by RConnection, but also needed to monitor the P&S to fetch its state changing.
+     * Once the P&S published the ENcmStateConnected, the iIapId is also available for starting this connection.
+     * Otherwise, if the P&S published the ENcmStateDisconnected, the iErrCode should be checked to notify the failure reason:
+     *            KErrNone, normally disconnected probably because of USB cable unpluged.
+     *            KErrInUse, means the other component(currently, BtPan or RNDIS) hold the other P&S key so that the DHCP Provision can't be done by NCM.
+     *            system-wide error code, please check Developer Library.
+     *            It is also possible that this P&S key is deleted when fetching its value because of the NCM connection closed by its driver.
+     *
+     * @see below sample code.
+     */
+    struct TNcmConnectionEvent
+      {
+      TUint32                iIapId;
+      TNcmConnectionState    iState;
+      TInt                   iErrCode;
+      TUint8                 reserved[20];
+      };
+    } // namespace UsbNcm
+
+/**
+ Example Usage:
+ @code
+ //header file.
+ #include <usb/usbncm.h>
+ using namespace UsbNcm;
+
+ CMySampleClass: public CActive
+     {
+     private:
+        RProperty                      iProperty;
+        RConnection                    iConnection;
+        TPckgBuf<TNcmConnectionEvent>  iNcmEvent;
+        RSocket                        iSocket;
+     }
+ @endcode
+
+ @code
+ #include "mysampleclass.h"
+
+ void CMySampleClass::ContructL()
+    {
+    User::LeaveIfError(iProperty.Attach(KCatNcmSvrUid, KKeyNcmConnectionEvent, EOwnerThread));
+
+    iProperty.Get(iNcmEvent);
+    if (ENcmStateConnected == iNcmEvent.iState)
+        {
+        TRequestStatus* pStatus = &iStatus;
+        iStatus = KRequestPending;
+        User::RequestComplete(pStatus, KErrNone);
+        }
+    else
+        {
+        iProperty.Subscribe(iStatus);
+        SetActive();
+        }
+    }
+
+ void CMySampleClass::RunL()
+    {
+    if (KErrNone == iStatus.Int())
+        {
+        iProperty.Get(iNcmEvent);
+
+        switch(iNcmEvent.iState)
+            {
+            case ENcmStateConnected:
+                StartConnection();
+                break;
+
+            case ENcmStateDisconnected:
+                if (KErrInUse == iNcmEvent.u.iErrCode)
+                    {
+                    //Show error UI with msg like "BtPan or Rndis is active, pls deactive it then re-try....", etc.
+                    }
+                else
+                    {
+                    //Show error UI with other msg as you like.
+                    //StopConnection();
+                    }
+                break;
+            }
+        }
+    }
+
+ //Sample code, not all string in this panic show on.
+ LIT(KNotFoundNcm, "NotFoundPanic - The NCM connection was not found!");
+
+ TInt CMySampleClass::StartConnection()
+    {
+    //the number of connections.
+    TInt cnt = 0;
+    iConnection.EnumerateConnections(cnt);
+
+    TInt index = 1;
+    for (index = 1; index <= cnt; index++)
+        {
+        TPckgBuf<TConnectionInfo> info;
+        iConnection.GetConnectionInfo(index, info);
+        if (info().iIapId == iNcmEvent.iIapId)
+            {
+            iConnection.Attach(info, RConnection::EAttachTypeNormal);
+            break;
+            }
+        }
+    __ASSERT_ALWAYS(index <= cnt, User::Panic(KErrNotFound, KNotFoundNcm));
+
+    TInt ret = iSocket.Open(...., iConnection);
+    //.....
+    return ret;
+    }
+ @endcode
+*/
+#endif // USBNCM_H
--- a/usbmgmt/usbmgr/device/classdrivers/obex/classcontroller/group/ObexClassController.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/obex/classcontroller/group/ObexClassController.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -34,6 +34,7 @@
 SOURCE			CUsbObexClassController.cpp
 
 USERINCLUDE         ../inc
+USERINCLUDE 		../traces
 
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
@@ -44,5 +45,3 @@
 
 LIBRARY			euser.lib 
 LIBRARY			usbclasscontroller.lib
-
-#include <usb/usblogger.mmh>
--- a/usbmgmt/usbmgr/device/classdrivers/obex/classcontroller/src/CUsbObexClassController.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/obex/classcontroller/src/CUsbObexClassController.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -23,18 +23,17 @@
 #include "CUsbObexClassController.h"
 #include <usb_std.h>
 #include <d32usbc.h>
-#include <usb/usblogger.h>
-
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "OBEXCC");
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "CUsbObexClassControllerTraces.h"
 #endif
 
-
+#ifdef _DEBUG
 // Panic category only used in debug builds
-#ifdef _DEBUG
 _LIT( KObexCcPanicCategory, "UsbObexCc" );
 #endif
 
+
 /**
  * Panic codes for the USB OBEX Class Controller.
  */
@@ -59,10 +58,10 @@
 CUsbObexClassController* CUsbObexClassController::NewL(
 	MUsbClassControllerNotify& aOwner)
 	{
-	LOG_STATIC_FUNC_ENTRY
-
+	OstTraceFunctionEntry0( REF_CUSBOBEXCLASSCONTROLLER_NEWL_ENTRY );
 	CUsbObexClassController* self =
 		new (ELeave) CUsbObexClassController(aOwner);
+	OstTraceFunctionExit0( REF_CUSBOBEXCLASSCONTROLLER_NEWL_EXIT );
 	return self;
 	}
 
@@ -75,7 +74,9 @@
 		MUsbClassControllerNotify& aOwner)
 	: CUsbClassControllerPlugIn(aOwner, KObexClassPriority)
 	{
+	OstTraceFunctionEntry0( REF_CUSBOBEXCLASSCONTROLLER_CUSBOBEXCLASSCONTROLLER_CONS_ENTRY );
 	iState = EUsbServiceIdle;
+	OstTraceFunctionExit0( REF_CUSBOBEXCLASSCONTROLLER_CUSBOBEXCLASSCONTROLLER_CONS_EXIT );
 	}
 
 /**
@@ -83,6 +84,8 @@
  */
 CUsbObexClassController::~CUsbObexClassController()
 	{
+	OstTraceFunctionEntry0( REF_CUSBOBEXCLASSCONTROLLER_CUSBOBEXCLASSCONTROLLER_DES_ENTRY );
+	
 	Cancel();
 	if (iState == EUsbServiceStarted) 
 		{
@@ -92,6 +95,7 @@
 		iLdd2.ReleaseInterface(0);
 		iLdd2.Close();
 		}
+	OstTraceFunctionExit0( REF_CUSBOBEXCLASSCONTROLLER_CUSBOBEXCLASSCONTROLLER_DES_EXIT );
 	}
 
 /**
@@ -104,12 +108,16 @@
 
 TInt CUsbObexClassController::SetUpClassAndInterface()
 	{
+	OstTraceFunctionEntry0( REF_CUSBOBEXCLASSCONTROLLER_SETUPCLASSANDINTERFACE_ENTRY );
+	
 	TUsbcInterfaceInfoBuf ifc;
 	
 	HBufC16* string = KUsbObexIfc().Alloc();
 	if (!string)
+		{
+		OstTraceFunctionExit0( REF_CUSBOBEXCLASSCONTROLLER_SETUPCLASSANDINTERFACE_EXIT );
 		return KErrNoMemory;
-	
+		}
 	ifc().iString = string;
 	ifc().iClass.iClassNum = KObexClassNumber;		
 	ifc().iClass.iSubClassNum = KObexSubClassNumber;
@@ -131,6 +139,7 @@
 
 	if (err != KErrNone) 
 		{ 
+		OstTraceFunctionExit0( REF_CUSBOBEXCLASSCONTROLLER_SETUPCLASSANDINTERFACE_EXIT_DUP1 );
 		return err;
 		}
 
@@ -164,12 +173,14 @@
 	err= iLdd.SetCSInterfaceDescriptorBlock(0, desc);
 	if (err!= KErrNone)
 		{
+        OstTraceFunctionExit0( REF_CUSBOBEXCLASSCONTROLLER_SETUPCLASSANDINTERFACE_EXIT_DUP2 );
         return err;
         }
 
 	err = iLdd2.Open(0);
 	if (err != KErrNone)
 		{
+        OstTraceFunctionExit0( REF_CUSBOBEXCLASSCONTROLLER_SETUPCLASSANDINTERFACE_EXIT_DUP3 );
         return err;
         }
 
@@ -190,26 +201,33 @@
 	if (err != KErrNone) 
 		{
 		iLdd2.Close();
+		OstTraceFunctionExit0( REF_CUSBOBEXCLASSCONTROLLER_SETUPCLASSANDINTERFACE_EXIT_DUP4 );
 		return err;
 		}
 
 	TUsbDeviceCaps dCaps;
 	TInt ret = iLdd.DeviceCaps(dCaps);
-	if (ret != KErrNone) 
+	if (ret != KErrNone)
+		{
+		OstTraceFunctionExit0( REF_CUSBOBEXCLASSCONTROLLER_SETUPCLASSANDINTERFACE_EXIT_DUP5 );
 		return ret;
-	
+		}
 	
 	TInt n = dCaps().iTotalEndpoints;
-	if (n < KObexMinNumEndpoints) 
+	if (n < KObexMinNumEndpoints)
+		{
+		OstTraceFunctionExit0( REF_CUSBOBEXCLASSCONTROLLER_SETUPCLASSANDINTERFACE_EXIT_DUP6 );
 		return KErrGeneral;
-	
+		}
 	// Endpoints
 	TUsbcEndpointData data[KUsbcMaxEndpoints];
 	TPtr8 dataptr(REINTERPRET_CAST(TUint8*, data), sizeof(data), sizeof(data));
 	ret = iLdd.EndpointCaps(dataptr);
-	if (ret!= KErrNone) 
+	if (ret!= KErrNone)
+		{
+		OstTraceFunctionExit0( REF_CUSBOBEXCLASSCONTROLLER_SETUPCLASSANDINTERFACE_EXIT_DUP7 );
 		return ret;
-
+		}
 	// Set the active interface
 	
     TUsbcInterfaceInfoBuf dataifc2;
@@ -248,7 +266,10 @@
 		}
 		
     if (!(foundIn && foundOut)) 
+    	{
+		OstTraceFunctionExit0( REF_CUSBOBEXCLASSCONTROLLER_SETUPCLASSANDINTERFACE_EXIT_DUP8 );
 		return KErrGeneral;
+    	}
 	
 	dataifc2().iString = NULL;
 	dataifc2().iClass.iClassNum = KObexDataClass;		
@@ -265,9 +286,12 @@
 		{
 		iLdd2.ReleaseInterface(0);
 		iLdd2.Close();
+		OstTraceFunctionExit0( REF_CUSBOBEXCLASSCONTROLLER_SETUPCLASSANDINTERFACE_EXIT_DUP9 );
 		return err;
 
 		}
+
+	OstTraceFunctionExit0( REF_CUSBOBEXCLASSCONTROLLER_SETUPCLASSANDINTERFACE_EXIT_DUP10 );
 	return KErrNone;
 	}
 
@@ -278,10 +302,14 @@
  */
 void CUsbObexClassController::Start(TRequestStatus& aStatus)
 	{	
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( REF_CUSBOBEXCLASSCONTROLLER_START_ENTRY );
+	
 	//Start() should never be called if started, starting or stopping (or in state EUsbServiceFatalError)
-	__ASSERT_DEBUG( iState == EUsbServiceIdle, _USB_PANIC(KObexCcPanicCategory, EBadApiCallStart) );
+	if (iState != EUsbServiceIdle)
+		{	
+		OstTrace1( TRACE_FATAL, CUSBOBEXCLASSCONTROLLER_START, "CUsbObexClassController::Start;iState=%d", (TInt)iState );
+		__ASSERT_DEBUG( EFalse, User::Panic(KObexCcPanicCategory, EBadApiCallStart) );
+		}
 	
 	TRequestStatus* reportStatus = &aStatus;
 	
@@ -292,6 +320,7 @@
 		{
 		User::RequestComplete(reportStatus, err);
 		iState = EUsbServiceIdle;
+		OstTraceFunctionExit0( REF_CUSBOBEXCLASSCONTROLLER_START_EXIT );
 		return;      
 		} 
 		
@@ -301,6 +330,7 @@
 		iState = EUsbServiceIdle;
 		User::RequestComplete(reportStatus, err);
 
+		OstTraceFunctionExit0( REF_CUSBOBEXCLASSCONTROLLER_START_EXIT_DUP1 );
 		return;	
 		}
 
@@ -311,11 +341,13 @@
 		iState = EUsbServiceIdle;
 		User::RequestComplete(reportStatus, err);
 		
+		OstTraceFunctionExit0( REF_CUSBOBEXCLASSCONTROLLER_START_EXIT_DUP2 );
 		return;
 		}
 		
 	iState = EUsbServiceStarted;
 	User::RequestComplete(reportStatus, KErrNone);
+	OstTraceFunctionExit0( REF_CUSBOBEXCLASSCONTROLLER_START_EXIT_DUP3 );
 	}
 
 
@@ -326,10 +358,13 @@
  */
 void CUsbObexClassController::Stop(TRequestStatus& aStatus)
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( REF_CUSBOBEXCLASSCONTROLLER_STOP_ENTRY );
 	//Stop() should never be called if stopping, idle or starting (or in state EUsbServiceFatalError)
-	__ASSERT_DEBUG( iState == EUsbServiceStarted, _USB_PANIC(KObexCcPanicCategory, EBadApiCallStop) );
+	if (iState != EUsbServiceStarted)
+		{
+		OstTrace1( TRACE_FATAL, REF_CUSBOBEXCLASSCONTROLLER_STOP, "CUsbObexClassController::Stop;iState=%d", (TInt)iState );
+		__ASSERT_DEBUG( EFalse, User::Panic(KObexCcPanicCategory, EBadApiCallStop) );
+		}
 
 	TRequestStatus* ReportStatus = &aStatus;
 
@@ -346,6 +381,7 @@
 	iState = EUsbServiceIdle;
 
 	User::RequestComplete(ReportStatus, KErrNone);
+	OstTraceFunctionExit0( REF_CUSBOBEXCLASSCONTROLLER_STOP_EXIT );
 	}
 
 
@@ -356,8 +392,10 @@
  */
 void CUsbObexClassController::GetDescriptorInfo(TUsbDescriptor& aDescriptorInfo) const
 	{
+	OstTraceFunctionEntry0( REF_CUSBOBEXCLASSCONTROLLER_GETDESCRIPTORINFO_ENTRY );
 	aDescriptorInfo.iNumInterfaces = KObexNumInterfaces;
 	aDescriptorInfo.iLength = KObexDescriptorLength;
+	OstTraceFunctionExit0( REF_CUSBOBEXCLASSCONTROLLER_GETDESCRIPTORINFO_EXIT );
 	}
 
 /**
@@ -367,7 +405,10 @@
  */
 void CUsbObexClassController::RunL()
 	{
-	__ASSERT_DEBUG(EFalse, _USB_PANIC(KObexCcPanicCategory, EUnusedFunction));
+	OstTraceFunctionEntry0( REF_CUSBOBEXCLASSCONTROLLER_RUNL_ENTRY );
+	OstTrace0( TRACE_FATAL, REF_CUSBOBEXCLASSCONTROLLER_RUNL, "CUsbObexClassController::RunL;EUnusedFunction" );
+	__ASSERT_DEBUG( EFalse, User::Panic(KObexCcPanicCategory, EUnusedFunction) );
+	OstTraceFunctionExit0( REF_CUSBOBEXCLASSCONTROLLER_RUNL_EXIT );
 	}
 
 /**
@@ -377,7 +418,10 @@
  */
 void CUsbObexClassController::DoCancel()
 	{
-	__ASSERT_DEBUG(EFalse, _USB_PANIC(KObexCcPanicCategory, EUnusedFunction));
+	OstTraceFunctionEntry0( REF_CUSBOBEXCLASSCONTROLLER_DOCANCEL_ENTRY );
+	OstTrace0( TRACE_FATAL, REF_CUSBOBEXCLASSCONTROLLER_DOCANCEL, "CUsbObexClassController::DoCancel;EUnusedFunction" );
+	__ASSERT_DEBUG( EFalse, User::Panic(KObexCcPanicCategory, EUnusedFunction) );
+	OstTraceFunctionExit0( REF_CUSBOBEXCLASSCONTROLLER_DOCANCEL_EXIT );
 	}
 
 /**
@@ -389,6 +433,9 @@
 
 TInt CUsbObexClassController::RunError(TInt /*aError*/)
 	{
-	__ASSERT_DEBUG(EFalse, _USB_PANIC(KObexCcPanicCategory, EUnusedFunction));
+	OstTraceFunctionEntry0( REF_CUSBOBEXCLASSCONTROLLER_RUNERROR_ENTRY );
+	OstTrace0( TRACE_FATAL, REF_CUSBOBEXCLASSCONTROLLER_RUNERROR, "CUsbObexClassController::RunError;EUnusedFunction" );
+	__ASSERT_DEBUG( EFalse, User::Panic(KObexCcPanicCategory, EUnusedFunction) );
+	OstTraceFunctionExit0( REF_CUSBOBEXCLASSCONTROLLER_RUNERROR_EXIT );
 	return KErrNone;
 	}
--- a/usbmgmt/usbmgr/device/classdrivers/obex/classcontroller/src/CUsbObexClassImpCollection.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/obex/classcontroller/src/CUsbObexClassImpCollection.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -25,6 +25,11 @@
 #include <ecom/ecom.h>
 #include <ecom/implementationproxy.h>
 #include "CUsbObexClassController.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "CUsbObexClassImpCollectionTraces.h"
+#endif
+
 
 // Define the private interface UIDs
 const TImplementationProxy UsbCCImplementationTable[] =
@@ -34,8 +39,9 @@
 
 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
     {
+	OstTraceFunctionEntry0( CUSBOBEXCLASSIMPCOLLECTION_IMPLEMENTATIONGROUPPROXY_ENTRY );
     aTableCount = sizeof(UsbCCImplementationTable) / sizeof(TImplementationProxy);
-
+    OstTraceFunctionExit0( CUSBOBEXCLASSIMPCOLLECTION__IMPLEMENTATIONGROUPPROXY_EXIT );
     return UsbCCImplementationTable;
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/obex/classcontroller/traces/OstTraceDefinitions.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,7 @@
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <opensystemtrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/obex/classcontroller/traces/fixed_id.definitions	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,43 @@
+#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt.
+[GROUP]TRACE_FATAL=0x81
+[GROUP]TRACE_FLOW=0x8a
+[TRACE]TRACE_FATAL[0x81]_CUSBOBEXCLASSCONTROLLER_START=0x1
+[TRACE]TRACE_FATAL[0x81]_REF_CUSBOBEXCLASSCONTROLLER_DOCANCEL=0x4
+[TRACE]TRACE_FATAL[0x81]_REF_CUSBOBEXCLASSCONTROLLER_RUNERROR=0x5
+[TRACE]TRACE_FATAL[0x81]_REF_CUSBOBEXCLASSCONTROLLER_RUNL=0x3
+[TRACE]TRACE_FATAL[0x81]_REF_CUSBOBEXCLASSCONTROLLER_STOP=0x2
+[TRACE]TRACE_FLOW[0x8A]_CUSBOBEXCLASSIMPCOLLECTION_IMPLEMENTATIONGROUPPROXY_ENTRY=0x22
+[TRACE]TRACE_FLOW[0x8A]_CUSBOBEXCLASSIMPCOLLECTION__IMPLEMENTATIONGROUPPROXY_EXIT=0x23
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBOBEXCLASSCONTROLLER_CUSBOBEXCLASSCONTROLLER_CONS_ENTRY=0x3
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBOBEXCLASSCONTROLLER_CUSBOBEXCLASSCONTROLLER_CONS_EXIT=0x4
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBOBEXCLASSCONTROLLER_CUSBOBEXCLASSCONTROLLER_DES_ENTRY=0x5
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBOBEXCLASSCONTROLLER_CUSBOBEXCLASSCONTROLLER_DES_EXIT=0x6
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBOBEXCLASSCONTROLLER_DOCANCEL_ENTRY=0x1e
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBOBEXCLASSCONTROLLER_DOCANCEL_EXIT=0x1f
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBOBEXCLASSCONTROLLER_GETDESCRIPTORINFO_ENTRY=0x1a
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBOBEXCLASSCONTROLLER_GETDESCRIPTORINFO_EXIT=0x1b
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBOBEXCLASSCONTROLLER_NEWL_ENTRY=0x1
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBOBEXCLASSCONTROLLER_NEWL_EXIT=0x2
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBOBEXCLASSCONTROLLER_RUNERROR_ENTRY=0x20
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBOBEXCLASSCONTROLLER_RUNERROR_EXIT=0x21
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBOBEXCLASSCONTROLLER_RUNL_ENTRY=0x1c
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBOBEXCLASSCONTROLLER_RUNL_EXIT=0x1d
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBOBEXCLASSCONTROLLER_SETUPCLASSANDINTERFACE_ENTRY=0x7
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBOBEXCLASSCONTROLLER_SETUPCLASSANDINTERFACE_EXIT=0x8
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBOBEXCLASSCONTROLLER_SETUPCLASSANDINTERFACE_EXIT_DUP1=0x9
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBOBEXCLASSCONTROLLER_SETUPCLASSANDINTERFACE_EXIT_DUP10=0x12
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBOBEXCLASSCONTROLLER_SETUPCLASSANDINTERFACE_EXIT_DUP2=0xa
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBOBEXCLASSCONTROLLER_SETUPCLASSANDINTERFACE_EXIT_DUP3=0xb
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBOBEXCLASSCONTROLLER_SETUPCLASSANDINTERFACE_EXIT_DUP4=0xc
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBOBEXCLASSCONTROLLER_SETUPCLASSANDINTERFACE_EXIT_DUP5=0xd
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBOBEXCLASSCONTROLLER_SETUPCLASSANDINTERFACE_EXIT_DUP6=0xe
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBOBEXCLASSCONTROLLER_SETUPCLASSANDINTERFACE_EXIT_DUP7=0xf
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBOBEXCLASSCONTROLLER_SETUPCLASSANDINTERFACE_EXIT_DUP8=0x10
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBOBEXCLASSCONTROLLER_SETUPCLASSANDINTERFACE_EXIT_DUP9=0x11
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBOBEXCLASSCONTROLLER_START_ENTRY=0x13
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBOBEXCLASSCONTROLLER_START_EXIT=0x14
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBOBEXCLASSCONTROLLER_START_EXIT_DUP1=0x15
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBOBEXCLASSCONTROLLER_START_EXIT_DUP2=0x16
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBOBEXCLASSCONTROLLER_START_EXIT_DUP3=0x17
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBOBEXCLASSCONTROLLER_STOP_ENTRY=0x18
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBOBEXCLASSCONTROLLER_STOP_EXIT=0x19
--- a/usbmgmt/usbmgr/device/classdrivers/whcm/classcontroller/SRC/CUsbWHCMClassController.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/whcm/classcontroller/SRC/CUsbWHCMClassController.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -20,18 +20,16 @@
  @file
 */
 
-#include "CUsbWHCMClassController.h"
 #include <usb_std.h>
 #include <cusbclasscontrolleriterator.h>
 #include <musbclasscontrollernotify.h>
-#include <usb/usblogger.h>
-
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "WHCMCC");
+#include "CUsbWHCMClassController.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "CUsbWHCMClassControllerTraces.h"
 #endif
 
 _LIT(KUsbLDDName, "eusbc");
-
 _LIT( KWhcmCcPanicCategory, "UsbWhcmCc" );
 
 /**
@@ -56,7 +54,7 @@
 CUsbWHCMClassController* CUsbWHCMClassController::NewL(
 	MUsbClassControllerNotify& aOwner)
 	{
-	LOG_STATIC_FUNC_ENTRY
+	OstTraceFunctionEntry0( CUSBWHCMCLASSCONTROLLER_NEWL_ENTRY );
 
 	CUsbWHCMClassController* self =
 		new (ELeave) CUsbWHCMClassController(aOwner);
@@ -64,6 +62,7 @@
 	CleanupStack::PushL(self);
 	self->ConstructL();
 	CleanupStack::Pop();
+	OstTraceFunctionExit0( CUSBWHCMCLASSCONTROLLER_NEWL_EXIT );
 	return self;
 	}
 
@@ -76,7 +75,9 @@
 		MUsbClassControllerNotify& aOwner)
 	: CUsbClassControllerPlugIn(aOwner, KWHCMPriority)
 	{
+	OstTraceFunctionEntry0( CUSBWHCMCLASSCONTROLLER_CUSBWHCMCLASSCONTROLLER_CONS_ENTRY );
 	iState = EUsbServiceIdle;
+	OstTraceFunctionExit0( CUSBWHCMCLASSCONTROLLER_CUSBWHCMCLASSCONTROLLER_CONS_EXIT );
 	}
 
 /**
@@ -84,14 +85,25 @@
  */
 void CUsbWHCMClassController::ConstructL()
 	{
+	OstTraceFunctionEntry0( CUSBWHCMCLASSCONTROLLER_CONSTRUCTL_ENTRY );
 	// Load the device driver
 	TInt err = User::LoadLogicalDevice(KUsbLDDName);
 	if (err != KErrNone && err != KErrAlreadyExists) 
 		{
-		LEAVEL(err);      
+		OstTrace1( TRACE_NORMAL, CUSBWHCMCLASSCONTROLLER_CONSTRUCTL, 
+					"CUsbWHCMClassController::ConstructL;err=%d", err );   
+		User::Leave(err);
 		} 
 
-	LEAVEIFERRORL(iLdd.Open(0));
+	
+	err = iLdd.Open(0);
+	if (err < 0)
+		{
+		OstTrace1( TRACE_NORMAL, CUSBWHCMCLASSCONTROLLER_CONSTRUCTL_DUP1, 
+					"CUsbWHCMClassController::ConstructL;err=%d", err );
+		User::Leave(err);
+		}
+	OstTraceFunctionExit0( CUSBWHCMCLASSCONTROLLER_CONSTRUCTL_EXIT );
 	}
 
 /**
@@ -99,14 +111,15 @@
  */
 CUsbWHCMClassController::~CUsbWHCMClassController()
 	{
+	OstTraceFunctionEntry0( CUSBWHCMCLASSCONTROLLER_CUSBWHCMCLASSCONTROLLER_DES_ENTRY );
 	Cancel();
-
 	if (iState == EUsbServiceStarted)
 		{
 		// Must release all interfaces before closing the LDD to avoid a crash.
 		iLdd.ReleaseInterface(0);
 		}
 	iLdd.Close();
+	OstTraceFunctionExit0( CUSBWHCMCLASSCONTROLLER_CUSBWHCMCLASSCONTROLLER_DES_EXIT );
 	}
 
 /**
@@ -116,25 +129,29 @@
  */
 void CUsbWHCMClassController::Start(TRequestStatus& aStatus)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBWHCMCLASSCONTROLLER_START_ENTRY );
 		
 	//Start() should never be called if started, starting or stopping (or in state EUsbServiceFatalError)
-	__ASSERT_DEBUG( iState == EUsbServiceIdle, _USB_PANIC(KWhcmCcPanicCategory, EBadApiCallStart) );
+	if (iState != EUsbServiceIdle)
+		{
+		OstTrace1( TRACE_FATAL, CUSBWHCMCLASSCONTROLLER_START, "CUsbWHCMClassController::Start;iState=%d", (TInt)iState );
+		__ASSERT_DEBUG( EFalse, User::Panic(KWhcmCcPanicCategory, EBadApiCallStart) );
+		}
 	
 	TRequestStatus* reportStatus = &aStatus;
 
 	iState = EUsbServiceStarting;
-
 	TRAPD(err, SetUpWHCMDescriptorL());
-
 	if (err != KErrNone) 
 		{
 		iState = EUsbServiceIdle;
 		User::RequestComplete(reportStatus, err);
+		OstTraceFunctionExit0( CUSBWHCMCLASSCONTROLLER_START_EXIT );
 		return;
 		}
 	iState = EUsbServiceStarted;
 	User::RequestComplete(reportStatus, KErrNone);
+	OstTraceFunctionExit0( CUSBWHCMCLASSCONTROLLER_START_EXIT_DUP1 );
 	}
 
 /**
@@ -144,10 +161,14 @@
  */
 void CUsbWHCMClassController::Stop(TRequestStatus& aStatus)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBWHCMCLASSCONTROLLER_STOP_ENTRY );
 
 	//Stop() should never be called if stopping, idle or starting (or in state EUsbServiceFatalError)
-	__ASSERT_DEBUG( iState == EUsbServiceStarted, _USB_PANIC(KWhcmCcPanicCategory, EBadApiCallStop) );
+	if (iState != EUsbServiceStarted)
+		{
+		OstTrace1( TRACE_FATAL, CUSBWHCMCLASSCONTROLLER_STOP, "CUsbWHCMClassController::Stop;iState=%d", (TInt)iState );
+		__ASSERT_DEBUG( EFalse, User::Panic(KWhcmCcPanicCategory, EBadApiCallStart) );
+		}
 
 	TRequestStatus* reportStatus = &aStatus;
 
@@ -159,6 +180,7 @@
 	aStatus = KRequestPending;
 
 	User::RequestComplete(reportStatus, KErrNone);
+	OstTraceFunctionExit0( CUSBWHCMCLASSCONTROLLER_STOP_EXIT );
 	}
 
 /**
@@ -169,6 +191,8 @@
 void CUsbWHCMClassController::GetDescriptorInfo(
 	TUsbDescriptor& /*aDescriptorInfo*/) const
 	{
+	OstTraceFunctionEntry0( CUSBWHCMCLASSCONTROLLER_GETDESCRIPTORINFO_ENTRY );
+	OstTraceFunctionExit0( CUSBWHCMCLASSCONTROLLER_GETDESCRIPTORINFO_EXIT );
 	}
 
 /**
@@ -177,7 +201,8 @@
 void CUsbWHCMClassController::RunL()
 	{
 	// This function should never be called.
-	_USB_PANIC(KWhcmCcPanicCategory, EUnusedFunction);
+	OstTrace0( TRACE_FATAL, CUSBWHCMCLASSCONTROLLER_RUNL, "CUsbWHCMClassController::RunL;EUnusedFunction");
+	User::Panic(KWhcmCcPanicCategory, EUnusedFunction);
 	}
 
 /**
@@ -187,7 +212,8 @@
 void CUsbWHCMClassController::DoCancel()
 	{
 	// This function should never be called.
-	_USB_PANIC(KWhcmCcPanicCategory, EUnusedFunction);
+	OstTrace0( TRACE_FATAL, CUSBWHCMCLASSCONTROLLER_DOCANCEL, "CUsbWHCMClassController::DoCancel;EUnusedFunction");
+	User::Panic(KWhcmCcPanicCategory, EUnusedFunction);
 	}
 
 /**
@@ -197,8 +223,8 @@
 TInt CUsbWHCMClassController::RunError(TInt /*aError*/)
 	{
 	// This function should never be called.
-	_USB_PANIC(KWhcmCcPanicCategory, EUnusedFunction);
-
+	OstTrace0( TRACE_FATAL, CUSBWHCMCLASSCONTROLLER_RUNERROR, "CUsbWHCMClassController::RunError;EUnusedFunction");
+	User::Panic(KWhcmCcPanicCategory, EUnusedFunction);
 	return KErrNone;
 	}
 
@@ -208,6 +234,8 @@
  * Setup the WHCM Class Descriptors.
  */
     {
+	OstTraceFunctionEntry0( CUSBWHCMCLASSCONTROLLER_SETUPWHCMDESCROPTORL_ENTRY );
+	
 	// Set up and register the WHCM interface descriptor
 
     TUsbcInterfaceInfoBuf ifc;
@@ -221,11 +249,23 @@
 	// from EP0.
 	ifc().iFeatureWord |= KUsbcInterfaceInfo_NoEp0RequestsPlease;
 
-	LEAVEIFERRORL(iLdd.SetInterface(0, ifc));
+	TInt	err = iLdd.SetInterface(0, ifc);
+	if (err < 0)
+		{
+		OstTrace1( TRACE_NORMAL, CUSBWHCMCLASSCONTROLLER_SETUPWHCMDESCROPTORL, 
+					"CUsbWHCMClassController::SetUpWHCMDescriptorL;err=%d", (TInt)err );
+		User::Leave(err);
+		}
 
 	// Get the interface number from the LDD for later reference
 	TBuf8<100> interface_descriptor;
-	LEAVEIFERRORL(iLdd.GetInterfaceDescriptor(0, interface_descriptor));
+	err = iLdd.GetInterfaceDescriptor(0, interface_descriptor);
+	if (err < 0)
+		{
+		OstTrace1( TRACE_NORMAL, CUSBWHCMCLASSCONTROLLER_SETUPWHCMDESCROPTORL_DUP1, 
+					"CUsbWHCMClassController::SetUpWHCMDescriptorL;err=%d", (TInt)err );
+		User::Leave(err);
+		}
 	
 		
 	TUint8 WHCM_int_no = interface_descriptor[2];
@@ -279,5 +319,12 @@
 	desc[10] = union_len;
 
 	// Register the whole class-specific interface block
-    LEAVEIFERRORL(iLdd.SetCSInterfaceDescriptorBlock(0, desc));	
+	err = iLdd.SetCSInterfaceDescriptorBlock(0, desc);
+    if (err < 0)
+    	{
+		OstTrace1( TRACE_NORMAL, CUSBWHCMCLASSCONTROLLER_SETUPWHCMDESCROPTORL_DUP2, 
+					"CUsbWHCMClassController::SetUpWHCMDescriptorL;err=%d", (TInt)err );
+		User::Leave(err);
+    	}
+    OstTraceFunctionExit0( CUSBWHCMCLASSCONTROLLER_SETUPWHCMDESCROPTORL_EXIT );
 	}
--- a/usbmgmt/usbmgr/device/classdrivers/whcm/classcontroller/SRC/CUsbWHCMClassImpCollection.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/whcm/classcontroller/SRC/CUsbWHCMClassImpCollection.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -25,6 +25,10 @@
 #include <ecom/ecom.h>
 #include <ecom/implementationproxy.h>
 #include "CUsbWHCMClassController.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "CUsbWHCMClassImpCollectionTraces.h"
+#endif
 
 // Define the private interface UIDs
 const TImplementationProxy UsbCCImplementationTable[] =
@@ -34,8 +38,9 @@
 
 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
     {
+	OstTraceFunctionEntry0( CBUSWHCMCLASSIMPCOLLECTION_IMPLEMENTATUIONGROUPPROXY_ENTRY );
     aTableCount = sizeof(UsbCCImplementationTable) / sizeof(TImplementationProxy);
-
+    OstTraceFunctionEntry0( CBUSWHCMCLASSIMPCOLLECTION_IMPLEMENTATUIONGROUPPROXY_EXIT );
     return UsbCCImplementationTable;
     }
 
--- a/usbmgmt/usbmgr/device/classdrivers/whcm/classcontroller/group/WHCMClassController.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/whcm/classcontroller/group/WHCMClassController.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -33,7 +33,8 @@
 SOURCE			CUsbWHCMClassImpCollection.cpp
 SOURCE			CUsbWHCMClassController.cpp
 
-USERINCLUDE		../INC
+USERINCLUDE			../INC
+USERINCLUDE 		../traces
 
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
@@ -44,5 +45,3 @@
 
 LIBRARY			euser.lib 
 LIBRARY			usbclasscontroller.lib
-
-#include <usb/usblogger.mmh>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/whcm/classcontroller/traces/OstTraceDefinitions.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,7 @@
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <opensystemtrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/device/classdrivers/whcm/classcontroller/traces/fixed_id.definitions	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,33 @@
+#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt.
+[GROUP]TRACE_FATAL=0x81
+[GROUP]TRACE_FLOW=0x8a
+[GROUP]TRACE_NORMAL=0x86
+[TRACE]TRACE_FATAL[0x81]_CUSBWHCMCLASSCONTROLLER_DOCANCEL=0x4
+[TRACE]TRACE_FATAL[0x81]_CUSBWHCMCLASSCONTROLLER_RUNERROR=0x5
+[TRACE]TRACE_FATAL[0x81]_CUSBWHCMCLASSCONTROLLER_RUNL=0x3
+[TRACE]TRACE_FATAL[0x81]_CUSBWHCMCLASSCONTROLLER_START=0x1
+[TRACE]TRACE_FATAL[0x81]_CUSBWHCMCLASSCONTROLLER_STOP=0x2
+[TRACE]TRACE_FLOW[0x8A]_CBUSWHCMCLASSIMPCOLLECTION_IMPLEMENTATUIONGROUPPROXY_ENTRY=0x12
+[TRACE]TRACE_FLOW[0x8A]_CBUSWHCMCLASSIMPCOLLECTION_IMPLEMENTATUIONGROUPPROXY_EXIT=0x13
+[TRACE]TRACE_FLOW[0x8A]_CUSBWHCMCLASSCONTROLLER_CONSTRUCTL_ENTRY=0x5
+[TRACE]TRACE_FLOW[0x8A]_CUSBWHCMCLASSCONTROLLER_CONSTRUCTL_EXIT=0x6
+[TRACE]TRACE_FLOW[0x8A]_CUSBWHCMCLASSCONTROLLER_CUSBWHCMCLASSCONTROLLER_CONS_ENTRY=0x3
+[TRACE]TRACE_FLOW[0x8A]_CUSBWHCMCLASSCONTROLLER_CUSBWHCMCLASSCONTROLLER_CONS_EXIT=0x4
+[TRACE]TRACE_FLOW[0x8A]_CUSBWHCMCLASSCONTROLLER_CUSBWHCMCLASSCONTROLLER_DES_ENTRY=0x7
+[TRACE]TRACE_FLOW[0x8A]_CUSBWHCMCLASSCONTROLLER_CUSBWHCMCLASSCONTROLLER_DES_EXIT=0x8
+[TRACE]TRACE_FLOW[0x8A]_CUSBWHCMCLASSCONTROLLER_GETDESCRIPTORINFO_ENTRY=0xe
+[TRACE]TRACE_FLOW[0x8A]_CUSBWHCMCLASSCONTROLLER_GETDESCRIPTORINFO_EXIT=0xf
+[TRACE]TRACE_FLOW[0x8A]_CUSBWHCMCLASSCONTROLLER_NEWL_ENTRY=0x1
+[TRACE]TRACE_FLOW[0x8A]_CUSBWHCMCLASSCONTROLLER_NEWL_EXIT=0x2
+[TRACE]TRACE_FLOW[0x8A]_CUSBWHCMCLASSCONTROLLER_SETUPWHCMDESCROPTORL_ENTRY=0x10
+[TRACE]TRACE_FLOW[0x8A]_CUSBWHCMCLASSCONTROLLER_SETUPWHCMDESCROPTORL_EXIT=0x11
+[TRACE]TRACE_FLOW[0x8A]_CUSBWHCMCLASSCONTROLLER_START_ENTRY=0x9
+[TRACE]TRACE_FLOW[0x8A]_CUSBWHCMCLASSCONTROLLER_START_EXIT=0xa
+[TRACE]TRACE_FLOW[0x8A]_CUSBWHCMCLASSCONTROLLER_START_EXIT_DUP1=0xb
+[TRACE]TRACE_FLOW[0x8A]_CUSBWHCMCLASSCONTROLLER_STOP_ENTRY=0xc
+[TRACE]TRACE_FLOW[0x8A]_CUSBWHCMCLASSCONTROLLER_STOP_EXIT=0xd
+[TRACE]TRACE_NORMAL[0x86]_CUSBWHCMCLASSCONTROLLER_CONSTRUCTL=0x1
+[TRACE]TRACE_NORMAL[0x86]_CUSBWHCMCLASSCONTROLLER_CONSTRUCTL_DUP1=0x2
+[TRACE]TRACE_NORMAL[0x86]_CUSBWHCMCLASSCONTROLLER_SETUPWHCMDESCROPTORL=0x3
+[TRACE]TRACE_NORMAL[0x86]_CUSBWHCMCLASSCONTROLLER_SETUPWHCMDESCROPTORL_DUP1=0x4
+[TRACE]TRACE_NORMAL[0x86]_CUSBWHCMCLASSCONTROLLER_SETUPWHCMDESCROPTORL_DUP2=0x5
--- a/usbmgmt/usbmgr/group/BLD.INF	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/group/BLD.INF	Tue Aug 31 17:01:47 2010 +0300
@@ -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)
--- a/usbmgmt/usbmgr/group/Usbman.iby	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/group/Usbman.iby	Tue Aug 31 17:01:47 2010 +0300
@@ -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,121 @@
 #include <c32.iby>
 #include <ecom.iby>
 
-// Resources are in a separate file, for easier customisation
-#include <usbmanrsc.iby>
-#include <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
+
+
+#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 <usbacm.iby>
+
+#include <usbncm.iby>
+
+#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 <dummyccinifiles.iby>
+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 <fdf.iby>
+		REM Host Mass Storage binaries
+		#ifdef WITH_MASS_STORAGE
+			#include <usbhostmsmm.iby>
+			#include <msfdc.iby>
+		#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)
+
+#endif // !defined(__USB) || !defined(EUSBC)
 
 #endif // __USBMAN_IBY__
--- a/usbmgmt/usbmgr/group/Usbmanbin.iby	Thu Jul 15 20:42:20 2010 +0300
+++ /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(SYMBIAN_EXCLUDE_USB) || !defined(EUSBC)
-REM Feature USB is not included in this ROM (usbman.iby)
-#else
-
-#include <usbacm.iby>
-
-#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 <dummyccinifiles.iby>
-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 <fdf.iby>
-		REM Host Mass Storage binaries
-		#ifdef WITH_MASS_STORAGE
-			#include <usbhostmsmm.iby>
-			#include <msfdc.iby>
-		#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 <ether802.iby>
-
-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 // SYMBIAN_EXCLUDE_USB
-
-#endif // __USBMANBIN_IBY__
--- a/usbmgmt/usbmgr/group/Usbmanrsc.iby	Thu Jul 15 20:42:20 2010 +0300
+++ /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(SYMBIAN_EXCLUDE_USB) || !defined(EUSBC)
-REM Feature USB is not included in this ROM (usbman.iby)
-#else
-
-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
-		  	#ifdef SYMBIAN_EXCLUDE_MTP
-		  		#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 // SYMBIAN_EXCLUDE_MTP
-				#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 // SYMBIAN_EXCLUDE_MTP
-		#endif // USB_EXCLUDE_DEFAULT_PERSONALITIES
-	#endif //__EXAMPLE_OBEX_CC__	
-#endif //__TEST_USB_ZLP__
-
-#endif // SYMBIAN_EXCLUDE_USB
-
-#endif // __USBMANRSC_IBY__
--- a/usbmgmt/usbmgr/group/usb.iby	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/group/usb.iby	Tue Aug 31 17:01:47 2010 +0300
@@ -28,10 +28,10 @@
 REM *** Now for things which should only be included if the device
 REM *** supports USB, to save ROM space...
 
-#if defined(SYMBIAN_EXCLUDE_USB) || !defined(EUSBC)
+#if !defined(__USB) || !defined(EUSBC)
 REM Feature USB is not included in this ROM (usb.iby)
-#else
+#else // defined(__USB) && defined(EUSBC)
 REM USB component can be added here.
-#endif // SYMBIAN_EXCLUDE_USB
+#endif // !defined(__USB) || !defined(EUSBC)
 
 #endif
--- a/usbmgmt/usbmgr/group/usb_manager.history.xml	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/group/usb_manager.history.xml	Tue Aug 31 17:01:47 2010 +0300
@@ -220,7 +220,7 @@
     - Added new .rss file (usbmanmtp.rss) which contains additional personality definition for the MTP personality
     - Extended usbsvrbase.mmp to build the new .rss file as usbmanmtp.rsc
     - Added more definitions to the usbman*.rls localisation files to cover the new MTP personality
-    - Amended usbman.iby to choose the usbman.rsc file in the final ROM depending on the presence or absence of the SYMBIAN_EXCLUDE_MTP macro at ROM build time.
+    - Amended usbman.iby to choose the usbman.rsc file in the final ROM depending on the presence or absence of the __MTP_PROTOCOL_SUPPORT macro at ROM build time.
   </defect>
 
   <defect number="PDEF101314" title="NotifyDataAvailable() is not supported by CAcmPort" revision="005">
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/group/usbperipheral.iby	Tue Aug 31 17:01:47 2010 +0300
@@ -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 <bldvariant.hrh>
+
+#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
--- a/usbmgmt/usbmgr/host/fdf/production/client/group/usbhoststack.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/client/group/usbhoststack.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
--- a/usbmgmt/usbmgr/host/fdf/production/client/group/usbhoststack_base.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/client/group/usbhoststack_base.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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,11 +29,10 @@
 
 USERINCLUDE		../../server/public
 USERINCLUDE		../public
+USERINCLUDE   ../traces
 
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
 DEFFILE			usbhoststack.def
 
 LIBRARY 		euser.lib
-
-#include <usb/usblogger.mmh>
--- a/usbmgmt/usbmgr/host/fdf/production/client/group/usbhoststack_over_dummyusbdi.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/client/group/usbhoststack_over_dummyusbdi.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
--- a/usbmgmt/usbmgr/host/fdf/production/client/public/usbhosterrors.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/client/public/usbhosterrors.h	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
--- a/usbmgmt/usbmgr/host/fdf/production/client/public/usbhoststack.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/client/public/usbhoststack.h	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
--- a/usbmgmt/usbmgr/host/fdf/production/client/src/session.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/client/src/session.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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,21 +21,22 @@
 */
 
 #include <e32base.h>
-#include <usb/usblogger.h>
 #include "usbhoststack.h"
 #include "fdfapi.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "sessionTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "usbhstcli");
-#endif
+
 
 /**
 Starts the server process.
 */
 static TInt StartServer()
 	{
-	LOG_STATIC_FUNC_ENTRY
-
+    OstTraceFunctionEntry0( _FDF_STARTSERVER_ENTRY );
+    
 	const TUidType serverUid(KNullUid, KNullUid, KUsbFdfUid);
 
 	//
@@ -45,10 +46,12 @@
 	//
 	RProcess server;
 	TInt err = server.Create(KUsbFdfImg, KNullDesC, serverUid);
-	LOGTEXT2(_L8("\terr = %d"), err);
+	
+	OstTrace1( TRACE_NORMAL, _FDF_STARTSERVER, "\terr = %d", err );
 
 	if ( err != KErrNone )
 		{
+		OstTraceFunctionExit0( _FDF_STARTSERVER_EXIT );
 		return err;
 		}
 
@@ -57,12 +60,14 @@
 
 	if ( stat != KRequestPending )
 		{
-		LOGTEXT(_L8("\taborting startup"));
+		OstTrace0( TRACE_NORMAL, _FDF_STARTSERVER_DUP1, "\taborting startup" );
+		
 		server.Kill(0); 	// abort startup
 		}
 	else
 		{
-		LOGTEXT(_L8("\tresuming"));
+		OstTrace0( TRACE_NORMAL, _FDF_STARTSERVER_DUP2, "\tresuming" );
+		
 		server.Resume();	// logon OK - start the server
 		}
 
@@ -71,12 +76,15 @@
 	// we can't use the 'exit reason' if the server panicked as this
 	// is the panic 'reason' and may be '0' which cannot be distinguished
 	// from KErrNone
-	LOGTEXT2(_L8("\tstat.Int = %d"), stat.Int());
+	OstTrace1( TRACE_NORMAL, _FDF_STARTSERVER_DUP3, "\tstat.Int = %d", stat.Int());
+	
 	err = (server.ExitType() == EExitPanic) ? KErrServerTerminated : stat.Int();
 
 	server.Close();
 
-	LOGTEXT2(_L8("\terr = %d"), err);
+	OstTrace1( TRACE_NORMAL, _FDF_STARTSERVER_DUP4, "\terr = %d", err );
+	
+	OstTraceFunctionExit0( _FDF_STARTSERVER_EXIT_DUP1 );
 	return err;
 	}
 
@@ -85,17 +93,16 @@
  :	iDeviceEventPckg(TDeviceEventInformation()),
 	iDevmonEventPckg(0)
 	{
-	LOGTEXT(_L8("*** Search on '***USB HOST STACK' to find device events."));
-
-	LOG_LINE
-	LOG_FUNC
+    OstTraceFunctionEntry0( RUSBHOSTSTACK_RUSBHOSTSTACK_ENTRY );
+    
+	OstTrace0( TRACE_NORMAL, RUSBHOSTSTACK_RUSBHOSTSTACK, "*** Search on '***USB HOST STACK' to find device events." );
+	    
 	}
 
 EXPORT_C TVersion RUsbHostStack::Version() const
 	{
-	LOG_LINE
-	LOG_FUNC
-
+    OstTraceFunctionEntry0( RUSBHOSTSTACK_VERSION_ENTRY );
+        
 	return(TVersion(	KUsbFdfSrvMajorVersionNumber,
 						KUsbFdfSrvMinorVersionNumber,
 						KUsbFdfSrvBuildNumber
@@ -105,12 +112,12 @@
 
 EXPORT_C TInt RUsbHostStack::Connect()
 	{
-	LOG_LINE
-	LOG_FUNC;
-
+    OstTraceFunctionEntry0( RUSBHOSTSTACK_CONNECT_ENTRY );
+            
 	TInt err = DoConnect();
 
-	LOGTEXT2(_L8("\terr = %d"), err);
+	OstTrace1( TRACE_NORMAL, RUSBHOSTSTACK_CONNECT, "\terr = %d", err);
+	    
 	return err;
 	}
 
@@ -120,7 +127,8 @@
 */
 TInt RUsbHostStack::DoConnect()
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry0( RUSBHOSTSTACK_DOCONNECT_ENTRY);
+    
 
 	TInt retry = 2;
 
@@ -128,26 +136,32 @@
 		{
 		// Use message slots from the global pool.
 		TInt err = CreateSession(KUsbFdfServerName, Version(), -1);
-		LOGTEXT2(_L8("\terr = %d"), err);
-
+		OstTrace1( TRACE_NORMAL, RUSBHOSTSTACK_DOCONNECT, "\terr = %d", err );
+		
 		if ((err != KErrNotFound) && (err != KErrServerTerminated))
 			{
-			LOGTEXT(_L8("\treturning after CreateSession"));
+			OstTrace0( TRACE_NORMAL, RUSBHOSTSTACK_DOCONNECT_DUP1, "\treturning after CreateSession" );
+			
+			OstTraceFunctionExit0( RUSBHOSTSTACK_DOCONNECT_EXIT);
 			return err;
 			}
 
 		if (--retry == 0)
 			{
-			LOGTEXT(_L8("\treturning after running out of retries"));
+			OstTrace0( TRACE_NORMAL, RUSBHOSTSTACK_DOCONNECT_DUP2, "\treturning after running out of retries" );
+			
+			OstTraceFunctionExit0( RUSBHOSTSTACK_DOCONNECT_EXIT_DUP1 );
 			return err;
 			}
 
 		err = StartServer();
-		LOGTEXT2(_L8("\terr = %d"), err);
-
+		OstTrace1( TRACE_NORMAL, RUSBHOSTSTACK_DOCONNECT_DUT3, "\terr = %d", err );
+		        
 		if ((err != KErrNone) && (err != KErrAlreadyExists))
 			{
-			LOGTEXT(_L8("\treturning after StartServer"));
+			OstTrace0( TRACE_NORMAL, RUSBHOSTSTACK_DOCONNECT_DUP4, "\treturning after StartServer" );
+			            
+			OstTraceFunctionExit0( RUSBHOSTSTACK_DOCONNECT_EXIT_DUP2 );
 			return err;
 			}
 		}
@@ -155,83 +169,85 @@
 
 EXPORT_C TInt RUsbHostStack::EnableDriverLoading()
 	{
-	LOG_LINE
-	LOG_FUNC
+    OstTraceFunctionEntry0( RUSBHOSTSTACK_ENABLEDRIVERLOADING_ENTRY );
+    
+	TInt ret = SendReceive(EUsbFdfSrvEnableDriverLoading);
+	OstTrace1( TRACE_NORMAL, RUSBHOSTSTACK_ENABLEDRIVERLOADING, "\tret = %d", ret );
 
-	TInt ret = SendReceive(EUsbFdfSrvEnableDriverLoading);
-	LOGTEXT2(_L8("\tret = %d"), ret);
+	OstTraceFunctionExit0( RUSBHOSTSTACK_ENABLEDRIVERLOADING_EXIT );
 	return ret;
 	}
 
 EXPORT_C void RUsbHostStack::DisableDriverLoading()
 	{
-	LOG_LINE
-	LOG_FUNC
+    OstTraceFunctionEntry0( RUSBHOSTSTACK_DISABLEDRIVERLOADING_ENTRY );
 
 	TInt ret = SendReceive(EUsbFdfSrvDisableDriverLoading);
-	LOGTEXT2(_L8("\tret = %d"), ret);
+	OstTrace1( TRACE_NORMAL, RUSBHOSTSTACK_DISABLEDRIVERLOADING, "\tret = %d", ret );
 	(void)ret;
+	OstTraceFunctionExit0( RUSBHOSTSTACK_DISABLEDRIVERLOADING_EXIT );
 	}
 
 EXPORT_C void RUsbHostStack::NotifyDeviceEvent(TRequestStatus& aStat, TDeviceEventInformation& aDeviceEventInformation)
 	{
-	LOG_LINE
-	LOG_FUNC
-
+    OstTraceFunctionEntry0( RUSBHOSTSTACK_NOTIFYDEVICEEVENT_ENTRY );
+    
 	TIpcArgs args;
 	iDeviceEventPckg.Set((TUint8*)&aDeviceEventInformation, sizeof(TDeviceEventInformation), sizeof(TDeviceEventInformation));
 	args.Set(0, &iDeviceEventPckg);
 
 	SendReceive(EUsbFdfSrvNotifyDeviceEvent, args, aStat);
+	OstTraceFunctionExit0( RUSBHOSTSTACK_NOTIFYDEVICEEVENT_EXIT );
 	}
 
 EXPORT_C void RUsbHostStack::NotifyDeviceEventCancel()
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( RUSBHOSTSTACK_NOTIFYDEVICEEVENTCANCEL_ENTRY );
+	
 	TInt ret = SendReceive(EUsbFdfSrvNotifyDeviceEventCancel);
-	LOGTEXT2(_L8("\tret = %d"), ret);
+	OstTrace1( TRACE_NORMAL, RUSBHOSTSTACK_NOTIFYDEVICEEVENTCANCEL, "\tret = %d", ret);
 	(void)ret;
+	OstTraceFunctionExit0( RUSBHOSTSTACK_NOTIFYDEVICEEVENTCANCEL_EXIT );
 	}
 
 EXPORT_C void RUsbHostStack::NotifyDevmonEvent(TRequestStatus& aStat, TInt& aEvent)
 	{
-	LOG_LINE
-	LOG_FUNC
-
+    OstTraceFunctionEntry0( RUSBHOSTSTACK_NOTIFYDEVMONEVENT_ENTRY );
+  
 	TIpcArgs args;
 	iDevmonEventPckg.Set((TUint8*)&aEvent, sizeof(TInt), sizeof(TInt));
 	args.Set(0, &iDevmonEventPckg);
 
 	SendReceive(EUsbFdfSrvNotifyDevmonEvent, args, aStat);
+	OstTraceFunctionExit0( RUSBHOSTSTACK_NOTIFYDEVMONEVENT_EXIT );
 	}
 
 EXPORT_C void RUsbHostStack::NotifyDevmonEventCancel()
 	{
-	LOG_LINE
-	LOG_FUNC
-
+    OstTraceFunctionEntry0( RUSBHOSTSTACK_NOTIFYDEVMONEVENTCANCEL_ENTRY );
+    
 	TInt ret = SendReceive(EUsbFdfSrvNotifyDevmonEventCancel);
-	LOGTEXT2(_L8("\tret = %d"), ret);
+	OstTrace1( TRACE_NORMAL, RUSBHOSTSTACK_NOTIFYDEVMONEVENTCANCEL, "\tret = %d", ret);
 	(void)ret;
+	OstTraceFunctionExit0( RUSBHOSTSTACK_NOTIFYDEVMONEVENTCANCEL_EXIT );
 	}
 
 EXPORT_C TInt RUsbHostStack::GetSupportedLanguages(TUint aDeviceId, RArray<TUint>& aLangIds)
 	{
-	LOG_LINE
-	LOG_FUNC
-
+    OstTraceFunctionEntry0( RUSBHOSTSTACK_GETSUPPORTEDLANGUAGES_ENTRY );
+    
 	aLangIds.Reset();
 
 	TUint singleLangIdOrNumLangs = 0;
 	TPckg<TUint> singleLangIdOrNumLangsBuf(singleLangIdOrNumLangs);
 	TInt ret = SendReceive(EUsbFdfSrvGetSingleSupportedLanguageOrNumberOfSupportedLanguages, TIpcArgs(aDeviceId, &singleLangIdOrNumLangsBuf));
-	LOGTEXT2(_L8("\tsingleLangIdOrNumLangs = %d"), singleLangIdOrNumLangs);
+	OstTrace1( TRACE_NORMAL, RUSBHOSTSTACK_GETSUPPORTEDLANGUAGES, "\tsingleLangIdOrNumLangs = %d", singleLangIdOrNumLangs);
+	    
 	switch ( ret )
 		{
 	case KErrNotFound:
-		LOGTEXT2(_L8("\tThere is no language available or the wrong device id %d was supplied"),aDeviceId);
+		OstTrace1( TRACE_NORMAL, RUSBHOSTSTACK_GETSUPPORTEDLANGUAGES_DUP1, "\tThere is no language available or the wrong device id %d was supplied",aDeviceId);
+		    
 		ret = KErrNotFound;
 		break;
 
@@ -263,18 +279,21 @@
 		break;
 		}
 
-	LOGTEXT2(_L8("\tret = %d"), ret);
+	OstTrace1( TRACE_NORMAL, RUSBHOSTSTACK_GETSUPPORTEDLANGUAGES_DUP2, "\tret = %d", ret);
+	    
+	OstTraceFunctionExit0( RUSBHOSTSTACK_GETSUPPORTEDLANGUAGES_EXIT );
 	return ret;
 	}
 
 TInt RUsbHostStack::CopyLangIdsToArray(RArray<TUint>& aLangIds, const TDesC8& aBuffer)
 	{
-	LOG_FUNC
-
+    OstTraceFunctionEntry0( RUSBHOSTSTACK_COPYLANGIDSTOARRAY_ENTRY );
+    
 	ASSERT(!(aBuffer.Size() % 4));
 	const TUint numLangs = aBuffer.Size() / 4;
-	LOGTEXT2(_L8("\tnumLangs = %d"), numLangs);
-
+	
+	OstTrace1( TRACE_NORMAL, RUSBHOSTSTACK_COPYLANGIDSTOARRAY, "\tnumLangs = %d", numLangs );
+	
 	TInt ret = KErrNone;
 	const TUint* ptr = reinterpret_cast<const TUint*>(aBuffer.Ptr());
 	for ( TUint ii = 0 ; ii < numLangs ; ++ii )
@@ -287,46 +306,51 @@
 			}
 		}
 
-	LOGTEXT2(_L8("\tret = %d"), ret);
+	OstTrace1( TRACE_NORMAL, RUSBHOSTSTACK_COPYLANGIDSTOARRAY_DUP1, "\tret = %d", ret );
+	    
+	OstTraceFunctionExit0( RUSBHOSTSTACK_COPYLANGIDSTOARRAY_EXIT );
 	return ret;
 	}
 
 EXPORT_C TInt RUsbHostStack::GetManufacturerStringDescriptor(TUint aDeviceId, TUint aLangId, TName& aString)
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( RUSBHOSTSTACK_GETMANUFACTURERSTRINGDESCRIPTOR_ENTRY );
+	
 	TInt ret = SendReceive(EUsbFdfSrvGetManufacturerStringDescriptor, TIpcArgs(aDeviceId, aLangId, &aString));
-#ifdef __FLOG_ACTIVE
 	if ( !ret )
 		{
-		LOGTEXT2(_L("\taString = \"%S\""), &aString);
-		}
-#endif
-	LOGTEXT2(_L8("\tret = %d"), ret);
+        OstTraceExt1( TRACE_NORMAL, RUSBHOSTSTACK_GETMANUFACTURERSTRINGDESCRIPTOR, "RUsbHostStack::GetManufacturerStringDescriptor;aString=%S", aString );
+        
+        }
+	
+	OstTrace1( TRACE_NORMAL, RUSBHOSTSTACK_GETMANUFACTURERSTRINGDESCRIPTOR_DUP1, "\tret = %d", ret );
+	        
+	OstTraceFunctionExit0( RUSBHOSTSTACK_GETMANUFACTURERSTRINGDESCRIPTOR_EXIT );
 	return ret;
 	}
 
 EXPORT_C TInt RUsbHostStack::GetProductStringDescriptor(TUint aDeviceId, TUint aLangId, TName& aString)
 	{
-	LOG_LINE
-	LOG_FUNC
-
+    OstTraceFunctionEntry0( RUSBHOSTSTACK_GETPRODUCTSTRINGDESCRIPTOR_ENTRY );
+    
 	TInt ret = SendReceive(EUsbFdfSrvGetProductStringDescriptor, TIpcArgs(aDeviceId, aLangId, &aString));
-#ifdef __FLOG_ACTIVE
 	if ( !ret )
 		{
-		LOGTEXT2(_L("\taString = \"%S\""), &aString);
+		OstTraceExt1( TRACE_NORMAL, RUSBHOSTSTACK_GETPRODUCTSTRINGDESCRIPTOR, "\taString = \"%S\"", aString );
+	
+		
 		}
-#endif
-	LOGTEXT2(_L8("\tret = %d"), ret);
+	OstTrace1( TRACE_NORMAL, RUSBHOSTSTACK_GETPRODUCTSTRINGDESCRIPTOR_DUP1, "\tret = %d", ret );
+	
+	        
+	OstTraceFunctionExit0( RUSBHOSTSTACK_GETPRODUCTSTRINGDESCRIPTOR_EXIT );
 	return ret;
 	}
 
 EXPORT_C TInt RUsbHostStack::GetOtgDescriptor(TUint aDeviceId, TOtgDescriptor& aDescriptor)
 	{
-	LOG_LINE
-	LOG_FUNC
+    OstTraceFunctionEntry0( RUSBHOSTSTACK_GETOTGDESCRIPTOR_ENTRY );
+    
 
 	TPckg<TOtgDescriptor> otgDescriptorPckg(aDescriptor);
 	
@@ -335,14 +359,14 @@
 	args.Set(1, &otgDescriptorPckg);
 
 	TInt ret = SendReceive(EUsbFdfSrvGetOtgDescriptor, args);
-#ifdef __FLOG_ACTIVE
 	if ( !ret )
 		{
-		LOGTEXT2(_L("\taDescriptor.iDeviceId = %d"), aDescriptor.iDeviceId);
-		LOGTEXT2(_L("\taDescriptor.iAttributes = %d"), aDescriptor.iAttributes);
+        OstTrace1( TRACE_NORMAL, RUSBHOSTSTACK_GETOTGDESCRIPTOR, "\taDescriptor.iDeviceId = %d", aDescriptor.iDeviceId );
+        OstTrace1( TRACE_NORMAL, RUSBHOSTSTACK_GETOTGDESCRIPTOR_DUP1, "\taDescriptor.iAttributes = %d", aDescriptor.iAttributes );
 		}
-#endif
-	LOGTEXT2(_L8("\tret = %d"), ret);
+	OstTrace1( TRACE_NORMAL, RUSBHOSTSTACK_GETOTGDESCRIPTOR_DUP2, "\tret = %d", ret );
+	        
+	OstTraceFunctionExit0( RUSBHOSTSTACK_GETOTGDESCRIPTOR_EXIT );
 	return ret;
 	}
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/fdf/production/client/traces/OstTraceDefinitions.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,7 @@
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <opensystemtrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/fdf/production/client/traces/fixed_id.definitions	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,73 @@
+#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt.
+[GROUP]TRACE_FLOW=0x8a
+[GROUP]TRACE_NORMAL=0x86
+[TRACE]TRACE_FLOW[0x8A]_RUSBHOSTSTACK_CONNECT_ENTRY=0x6
+[TRACE]TRACE_FLOW[0x8A]_RUSBHOSTSTACK_COPYLANGIDSTOARRAY_ENTRY=0x19
+[TRACE]TRACE_FLOW[0x8A]_RUSBHOSTSTACK_COPYLANGIDSTOARRAY_EXIT=0x1a
+[TRACE]TRACE_FLOW[0x8A]_RUSBHOSTSTACK_DISABLEDRIVERLOADING_ENTRY=0xd
+[TRACE]TRACE_FLOW[0x8A]_RUSBHOSTSTACK_DISABLEDRIVERLOADING_EXIT=0xe
+[TRACE]TRACE_FLOW[0x8A]_RUSBHOSTSTACK_DOCONNECT_ENTRY=0x7
+[TRACE]TRACE_FLOW[0x8A]_RUSBHOSTSTACK_DOCONNECT_EXIT=0x8
+[TRACE]TRACE_FLOW[0x8A]_RUSBHOSTSTACK_DOCONNECT_EXIT_DUP1=0x24
+[TRACE]TRACE_FLOW[0x8A]_RUSBHOSTSTACK_DOCONNECT_EXIT_DUP2=0x25
+[TRACE]TRACE_FLOW[0x8A]_RUSBHOSTSTACK_ENABLEDRIVERLOADING_ENTRY=0xb
+[TRACE]TRACE_FLOW[0x8A]_RUSBHOSTSTACK_ENABLEDRIVERLOADING_EXIT=0xc
+[TRACE]TRACE_FLOW[0x8A]_RUSBHOSTSTACK_GETMANUFACTURERSTRINGDESCRIPTOR_ENTRY=0x1b
+[TRACE]TRACE_FLOW[0x8A]_RUSBHOSTSTACK_GETMANUFACTURERSTRINGDESCRIPTOR_EXIT=0x1c
+[TRACE]TRACE_FLOW[0x8A]_RUSBHOSTSTACK_GETOTGDESCRIPTOR_ENTRY=0x1f
+[TRACE]TRACE_FLOW[0x8A]_RUSBHOSTSTACK_GETOTGDESCRIPTOR_EXIT=0x20
+[TRACE]TRACE_FLOW[0x8A]_RUSBHOSTSTACK_GETPRODUCTSTRINGDESCRIPTOR_ENTRY=0x1d
+[TRACE]TRACE_FLOW[0x8A]_RUSBHOSTSTACK_GETPRODUCTSTRINGDESCRIPTOR_EXIT=0x1e
+[TRACE]TRACE_FLOW[0x8A]_RUSBHOSTSTACK_GETSUPPORTEDLANGUAGES_ENTRY=0x17
+[TRACE]TRACE_FLOW[0x8A]_RUSBHOSTSTACK_GETSUPPORTEDLANGUAGES_EXIT=0x18
+[TRACE]TRACE_FLOW[0x8A]_RUSBHOSTSTACK_NOTIFYDEVICEEVENTCANCEL_ENTRY=0x11
+[TRACE]TRACE_FLOW[0x8A]_RUSBHOSTSTACK_NOTIFYDEVICEEVENTCANCEL_EXIT=0x12
+[TRACE]TRACE_FLOW[0x8A]_RUSBHOSTSTACK_NOTIFYDEVICEEVENT_ENTRY=0xf
+[TRACE]TRACE_FLOW[0x8A]_RUSBHOSTSTACK_NOTIFYDEVICEEVENT_EXIT=0x10
+[TRACE]TRACE_FLOW[0x8A]_RUSBHOSTSTACK_NOTIFYDEVMONEVENTCANCEL_ENTRY=0x15
+[TRACE]TRACE_FLOW[0x8A]_RUSBHOSTSTACK_NOTIFYDEVMONEVENTCANCEL_EXIT=0x16
+[TRACE]TRACE_FLOW[0x8A]_RUSBHOSTSTACK_NOTIFYDEVMONEVENT_ENTRY=0x13
+[TRACE]TRACE_FLOW[0x8A]_RUSBHOSTSTACK_NOTIFYDEVMONEVENT_EXIT=0x14
+[TRACE]TRACE_FLOW[0x8A]_RUSBHOSTSTACK_RUSBHOSTSTACK_ENTRY=0x4
+[TRACE]TRACE_FLOW[0x8A]_RUSBHOSTSTACK_VERSION_ENTRY=0x5
+[TRACE]TRACE_FLOW[0x8A]__FDF_STARTSERVER_ENTRY=0x21
+[TRACE]TRACE_FLOW[0x8A]__FDF_STARTSERVER_EXIT=0x22
+[TRACE]TRACE_FLOW[0x8A]__FDF_STARTSERVER_EXIT_DUP1=0x23
+[TRACE]TRACE_NORMAL[0x86]_RUSBHOSTSTACK_CONNECT=0x7
+[TRACE]TRACE_NORMAL[0x86]_RUSBHOSTSTACK_COPYLANGIDSTOARRAY=0x16
+[TRACE]TRACE_NORMAL[0x86]_RUSBHOSTSTACK_COPYLANGIDSTOARRAY_DUP1=0x17
+[TRACE]TRACE_NORMAL[0x86]_RUSBHOSTSTACK_DISABLEDRIVERLOADING=0xe
+[TRACE]TRACE_NORMAL[0x86]_RUSBHOSTSTACK_DOCONNECT=0x8
+[TRACE]TRACE_NORMAL[0x86]_RUSBHOSTSTACK_DOCONNECT_DUP1=0x9
+[TRACE]TRACE_NORMAL[0x86]_RUSBHOSTSTACK_DOCONNECT_DUP2=0xa
+[TRACE]TRACE_NORMAL[0x86]_RUSBHOSTSTACK_DOCONNECT_DUP4=0xc
+[TRACE]TRACE_NORMAL[0x86]_RUSBHOSTSTACK_DOCONNECT_DUT3=0xb
+[TRACE]TRACE_NORMAL[0x86]_RUSBHOSTSTACK_ENABLEDRIVERLOADING=0xd
+[TRACE]TRACE_NORMAL[0x86]_RUSBHOSTSTACK_GETMANUFACTURERSTRINGDESCRIPTOR=0x19
+[TRACE]TRACE_NORMAL[0x86]_RUSBHOSTSTACK_GETMANUFACTURERSTRINGDESCRIPTOR_DUP1=0x1a
+[TRACE]TRACE_NORMAL[0x86]_RUSBHOSTSTACK_GETOTGDESCRIPTOR=0x18
+[TRACE]TRACE_NORMAL[0x86]_RUSBHOSTSTACK_GETOTGDESCRIPTOR_DUP1=0x1b
+[TRACE]TRACE_NORMAL[0x86]_RUSBHOSTSTACK_GETOTGDESCRIPTOR_DUP2=0x1c
+[TRACE]TRACE_NORMAL[0x86]_RUSBHOSTSTACK_GETPRODUCTSTRINGDESCRIPTOR=0x1d
+[TRACE]TRACE_NORMAL[0x86]_RUSBHOSTSTACK_GETPRODUCTSTRINGDESCRIPTOR_DUP1=0x15
+[TRACE]TRACE_NORMAL[0x86]_RUSBHOSTSTACK_GETSUPPORTEDLANGUAGES=0x11
+[TRACE]TRACE_NORMAL[0x86]_RUSBHOSTSTACK_GETSUPPORTEDLANGUAGES_DUP1=0x12
+[TRACE]TRACE_NORMAL[0x86]_RUSBHOSTSTACK_GETSUPPORTEDLANGUAGES_DUP2=0x13
+[TRACE]TRACE_NORMAL[0x86]_RUSBHOSTSTACK_NOTIFYDEVICEEVENTCANCEL=0xf
+[TRACE]TRACE_NORMAL[0x86]_RUSBHOSTSTACK_NOTIFYDEVMONEVENTCANCEL=0x10
+[TRACE]TRACE_NORMAL[0x86]_RUSBHOSTSTACK_RUSBHOSTSTACK=0x6
+[TRACE]TRACE_NORMAL[0x86]__FDF_STARTSERVER=0x1e
+[TRACE]TRACE_NORMAL[0x86]__FDF_STARTSERVER_DUP1=0x1f
+[TRACE]TRACE_NORMAL[0x86]__FDF_STARTSERVER_DUP2=0x20
+[TRACE]TRACE_NORMAL[0x86]__FDF_STARTSERVER_DUP3=0x21
+[TRACE]TRACE_NORMAL[0x86]__FDF_STARTSERVER_DUP4=0x22
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_DUP1_RUSBHOSTSTACK_DOCONNECT_EXIT=0x9
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_DUP1__STARTSERVER_EXIT=0x3
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_DUP2_RUSBHOSTSTACK_DOCONNECT_EXIT=0xa
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]__STARTSERVER_ENTRY=0x1
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]__STARTSERVER_EXIT=0x2
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]__STARTSERVER=0x1
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]__STARTSERVER_DUP1=0x2
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]__STARTSERVER_DUP2=0x3
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]__STARTSERVER_DUP3=0x4
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]__STARTSERVER_DUP4=0x5
--- a/usbmgmt/usbmgr/host/fdf/production/fdcbase/group/bld.inf	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/fdcbase/group/bld.inf	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
--- a/usbmgmt/usbmgr/host/fdf/production/fdcbase/group/fdcbase.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/fdcbase/group/fdcbase.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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,5 +37,6 @@
 LIBRARY 		euser.lib
 LIBRARY 		ecom.lib
 
-#include <usb/usblogger.mmh>
+USERINCLUDE   ../traces
+
 #include <usbhost/internal/fdfcaps.mmh>
--- a/usbmgmt/usbmgr/host/fdf/production/fdcbase/group/fdcbase_base_bld.inf	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/fdcbase/group/fdcbase_base_bld.inf	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
--- a/usbmgmt/usbmgr/host/fdf/production/fdcbase/group/fdcbase_over_dummyusbdi_bld.inf	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/fdcbase/group/fdcbase_over_dummyusbdi_bld.inf	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
--- a/usbmgmt/usbmgr/host/fdf/production/fdcbase/public/fdcinterface.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/fdcbase/public/fdcinterface.h	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
--- a/usbmgmt/usbmgr/host/fdf/production/fdcbase/public/fdcplugin.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/fdcbase/public/fdcplugin.h	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
--- a/usbmgmt/usbmgr/host/fdf/production/fdcbase/public/fdcplugin.hrh	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/fdcbase/public/fdcplugin.hrh	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
--- a/usbmgmt/usbmgr/host/fdf/production/fdcbase/public/fdcpluginobserver.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/fdcbase/public/fdcpluginobserver.h	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
--- a/usbmgmt/usbmgr/host/fdf/production/fdcbase/src/fdcplugin.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/fdcbase/src/fdcplugin.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
@@ -24,30 +24,32 @@
 #include <ecom/ecom.h>
 #include <usbhost/internal/fdcplugin.h>
 #include <usbhost/internal/fdcpluginobserver.h>
-#include <usb/usblogger.h>
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "fdcplugin");
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "fdcpluginTraces.h"
 #endif
 
+
 EXPORT_C CFdcPlugin::~CFdcPlugin()
 	{
-	LOG_FUNC
-
+    OstTraceFunctionEntry0( CFDCPLUGIN_CFDCPLUGIN_DES_ENTRY );
+    
 	REComSession::DestroyedImplementation(iInstanceId);
 	}
 
 EXPORT_C CFdcPlugin::CFdcPlugin(MFdcPluginObserver& aObserver)
 :	iObserver(aObserver)
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry0( CFDCPLUGIN_CFDCPLUGIN_CONS_ENTRY );
+    
 	}
 
 EXPORT_C CFdcPlugin* CFdcPlugin::NewL(TUid aImplementationUid, MFdcPluginObserver& aObserver)
 	{
-	LOG_STATIC_FUNC_ENTRY
-
-	LOGTEXT2(_L8("\t\tFDC implementation UID: 0x%08x"), aImplementationUid);
+    OstTraceFunctionEntry0( CFDCPLUGIN_NEWL_ENTRY );
+    
+    OstTrace1( TRACE_NORMAL, CFDCPLUGIN_NEWL, "\t\tFDC implementation UID: 0x%08x", aImplementationUid.iUid);
 
 	CFdcPlugin* plugin = reinterpret_cast<CFdcPlugin*>(
 		REComSession::CreateImplementationL(
@@ -57,7 +59,8 @@
 			)
 		);
 
-	LOGTEXT2(_L8("\tplugin = 0x%08x"), plugin);
+	OstTrace1( TRACE_NORMAL, CFDCPLUGIN_NEWL_DUP1, "\tplugin = 0x%08x", plugin);
+
 	return plugin;
 	}
 
--- a/usbmgmt/usbmgr/host/fdf/production/fdcbase/src/fdcpluginobserver.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/fdcbase/src/fdcpluginobserver.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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,15 +21,16 @@
 */
 
 #include <usbhost/internal/fdcpluginobserver.h>
-#include <usb/usblogger.h>
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "fdcplugin");
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "fdcpluginobserverTraces.h"
 #endif
 
+
 EXPORT_C TUint32 MFdcPluginObserver::TokenForInterface(TUint8 aInterface)
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry1( MFDCPLUGINOBSERVER_TOKENFORINTERFACE_ENTRY, this );
 	
 	return MfpoTokenForInterface(aInterface);
 	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/fdf/production/fdcbase/traces/OstTraceDefinitions.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,7 @@
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <opensystemtrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/fdf/production/fdcbase/traces/fixed_id.definitions	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,16 @@
+#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt.
+[GROUP]TRACE_FLOW=0x8a
+[GROUP]TRACE_NORMAL=0x86
+[TRACE]TRACE_FLOW[0x8A]_CFDCPLUGIN_CFDCPLUGIN_CONS_ENTRY=0xb
+[TRACE]TRACE_FLOW[0x8A]_CFDCPLUGIN_CFDCPLUGIN_DES_ENTRY=0xa
+[TRACE]TRACE_FLOW[0x8A]_CFDCPLUGIN_NEWL_ENTRY=0x5
+[TRACE]TRACE_FLOW[0x8A]_MFDCPLUGINOBSERVER_TOKENFORINTERFACE_ENTRY=0x8
+[TRACE]TRACE_NORMAL[0x86]_CFDCPLUGIN_NEWL=0x3
+[TRACE]TRACE_NORMAL[0x86]_CFDCPLUGIN_NEWL_DUP1=0x2
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CFDCPLUGIN_CFDCPLUGIN_ENTRY=0x1
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CFDCPLUGIN_CFDCPLUGIN_ENTRY_DUP1=0x9
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CFDCPLUGIN_CFDCPLUGIN_ENTRY_DUP1_EXIT=0x4
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CFDCPLUGIN_CFDCPLUGIN_EXIT=0x2
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CFDCPLUGIN_NEWL_EXIT=0x6
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_DUP1_CFDCPLUGIN_CFDCPLUGIN_ENTRY=0x7
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CFDCPLUGIN_NEWL=0x1
--- a/usbmgmt/usbmgr/host/fdf/production/server/group/fdf.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/server/group/fdf.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
--- a/usbmgmt/usbmgr/host/fdf/production/server/group/fdf_base.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/server/group/fdf_base.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
@@ -22,7 +22,6 @@
 */
 
 #include <usbhost/internal/fdfcaps.mmh>
-#include <usb/usblogger.mmh>
 
 TARGETTYPE		exe
 VENDORID		0x70000001
@@ -41,6 +40,7 @@
 SOURCE			utils.cpp
 
 USERINCLUDE 	../inc
+USERINCLUDE 	../traces
 USERINCLUDE 	../public
 USERINCLUDE		../../client/public
 
@@ -51,7 +51,4 @@
 LIBRARY 		euser.lib
 LIBRARY			ecom.lib
 LIBRARY			fdcbase.lib
-
-#ifdef __FLOGGER_INCLUDED
 LIBRARY			efsrv.lib
-#endif
--- a/usbmgmt/usbmgr/host/fdf/production/server/group/fdf_over_dummyusbdi.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/server/group/fdf_over_dummyusbdi.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
--- a/usbmgmt/usbmgr/host/fdf/production/server/group/fdf_over_dummyusbdi_bld.inf	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/server/group/fdf_over_dummyusbdi_bld.inf	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
--- a/usbmgmt/usbmgr/host/fdf/production/server/inc/activewaitforbusevent.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/server/inc/activewaitforbusevent.h	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
--- a/usbmgmt/usbmgr/host/fdf/production/server/inc/activewaitforecomevent.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/server/inc/activewaitforecomevent.h	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
--- a/usbmgmt/usbmgr/host/fdf/production/server/inc/deviceproxy.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/server/inc/deviceproxy.h	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
--- a/usbmgmt/usbmgr/host/fdf/production/server/inc/event.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/server/inc/event.h	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
--- a/usbmgmt/usbmgr/host/fdf/production/server/inc/eventqueue.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/server/inc/eventqueue.h	Tue Aug 31 17:01:47 2010 +0300
@@ -65,7 +65,9 @@
 	CEventQueue(CFdf& aFdf);
 
 private:
+#ifdef _DEBUG
 	void Log();
+#endif
 	void PokeSession();
 
 private: // unowned
--- a/usbmgmt/usbmgr/host/fdf/production/server/inc/fdcproxy.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/server/inc/fdcproxy.h	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
--- a/usbmgmt/usbmgr/host/fdf/production/server/inc/fdf.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/server/inc/fdf.h	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
--- a/usbmgmt/usbmgr/host/fdf/production/server/inc/fdfserver.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/server/inc/fdfserver.h	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
--- a/usbmgmt/usbmgr/host/fdf/production/server/inc/fdfsession.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/server/inc/fdfsession.h	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
--- a/usbmgmt/usbmgr/host/fdf/production/server/inc/utils.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/server/inc/utils.h	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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,47 +37,7 @@
 #define CLEANUPSTACK_POP2(a, b) 	CleanupStack::Pop(2);
 #endif // _DEBUG
 
-// What we want for internal programming errors in a server is a set of macros 
-// which, to save effort all round, use __LINE__ as the panic code, and a 
-// file-specific panic category. To make this non-standard pattern as helpful 
-// to users as possible, we append ' line#' to the category. That means we 
-// first have to check that the category is 10 characters long or less, so 
-// that the whole thing is legible to users when it appears on the screen.
-template <TBool> struct ASSERTION_FAILURE;
-TEMPLATE_SPECIALIZATION struct ASSERTION_FAILURE<ETrue>{};
-template <TInt> struct __assertion_test;
-#define COMPILE_ASSERT( B ) void __compile_assert(::__assertion_test<sizeof(::ASSERTION_FAILURE<(B)>)>)
 
-// We want a 10-character string (but allow for the NULL terminator).
-#define PANICCATEGORY(aaa) COMPILE_ASSERT(sizeof(L##aaa)/2 <= 11); _LIT(KPanicCat, aaa) 
-
-// A handy panic-self macro- the category is KPanicCat with " line#" appended; 
-// the code is the line number. 
-#define PANIC_LINENUM \
-	{ \
-	_LIT(KLnNo, " line#"); \
-	TBuf<KMaxExitCategoryName> cat = KPanicCat(); \
-	cat.Append(KLnNo()); \
-	_USB_PANIC(cat, __LINE__); \
-	}
-
-// A handy assertion macro that panics with a locally-defined panic category 
-// and the line number.
-#define ASSERT_ALWAYS(a) \
-	{ \
-	if ( !(a) ) \
-		{ \
-		PANIC_LINENUM; \
-		} \
-	}
-
-#ifdef _DEBUG
-#define ASSERT_DEBUG(a) ASSERT_ALWAYS(a)
-#define DEBUG_PANIC_LINENUM PANIC_LINENUM
-#else
-#define ASSERT_DEBUG(a)
-#define DEBUG_PANIC_LINENUM
-#endif // _DEBUG
 
 // Undefine the e32def.h-defined ASSERT macro to make sure no-one uses it 
 // under the mistaken impression that it's useful. Use our informative one 
--- a/usbmgmt/usbmgr/host/fdf/production/server/public/fdfapi.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/server/public/fdfapi.h	Tue Aug 31 17:01:47 2010 +0300
@@ -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;
--- a/usbmgmt/usbmgr/host/fdf/production/server/src/activewaitforbusevent.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/server/src/activewaitforbusevent.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
@@ -18,10 +18,12 @@
 #include "activewaitforbusevent.h"
 #include <usb/usblogger.h>
 #include "utils.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "activewaitforbuseventTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "fdf      ");
-#endif
+
 
 
 CActiveWaitForBusEvent::CActiveWaitForBusEvent(RUsbHubDriver& aHubDriver,
@@ -32,16 +34,18 @@
 	iBusEvent(aBusEvent),
 	iObserver(aObserver)
 	{
-	LOG_FUNC
-
+    OstTraceFunctionEntry0( CACTIVEWAITFORBUSEVENT_CACTIVEWAITFORBUSEVENT_CONS_ENTRY );
+    
 	CActiveScheduler::Add(this);
+	OstTraceFunctionExit0( CACTIVEWAITFORBUSEVENT_CACTIVEWAITFORBUSEVENT_CONS_EXIT );
 	}
 
 CActiveWaitForBusEvent::~CActiveWaitForBusEvent()
 	{
-	LOG_FUNC
-
+    OstTraceFunctionEntry0( CACTIVEWAITFORBUSEVENT_CACTIVEWAITFORBUSEVENT_DES_ENTRY );
+    
 	Cancel();
+	OstTraceFunctionExit0( CACTIVEWAITFORBUSEVENT_CACTIVEWAITFORBUSEVENT_DES_EXIT );
 	}
 
 CActiveWaitForBusEvent* CActiveWaitForBusEvent::NewL(RUsbHubDriver& aHubDriver,
@@ -54,24 +58,26 @@
 
 void CActiveWaitForBusEvent::Wait()
 	{
-	LOG_FUNC
-
+    OstTraceFunctionEntry0( CACTIVEWAITFORBUSEVENT_WAIT_ENTRY );
+    
 	iHubDriver.WaitForBusEvent(iBusEvent, iStatus);
 	SetActive();
+	OstTraceFunctionExit0( CACTIVEWAITFORBUSEVENT_WAIT_EXIT );
 	}
 
 void CActiveWaitForBusEvent::RunL()
 	{
-	LOG_LINE
-	LOG_FUNC
-	LOGTEXT3(_L8("\tiStatus = %d , iBusEvent.iError=%d "), iStatus.Int(),iBusEvent.iError);
-
+	OstTraceFunctionEntry0( CACTIVEWAITFORBUSEVENT_RUNL_ENTRY );
+	OstTraceExt2( TRACE_NORMAL, CACTIVEWAITFORBUSEVENT_RUNL, "\tiStatus = %d , iBusEvent.iError=%d ", iStatus.Int(),iBusEvent.iError );
+	
 	iObserver.MbeoBusEvent();
+	OstTraceFunctionExit0( CACTIVEWAITFORBUSEVENT_RUNL_EXIT );
 	}
 
 void CActiveWaitForBusEvent::DoCancel()
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry0( CACTIVEWAITFORBUSEVENT_DOCANCEL_ENTRY );
 
 	iHubDriver.CancelWaitForBusEvent();
+	OstTraceFunctionExit0( CACTIVEWAITFORBUSEVENT_DOCANCEL_EXIT );
 	}
--- a/usbmgmt/usbmgr/host/fdf/production/server/src/activewaitforecomevent.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/server/src/activewaitforecomevent.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
@@ -15,16 +15,13 @@
 *
 */
 
-
+#include <usb/usblogger.h>
 #include "activewaitforecomevent.h"
-#include <usb/usblogger.h>
 #include "utils.h"
-
-
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "fdf      ");
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "activewaitforecomeventTraces.h"
 #endif
-
 #ifdef _DEBUG
 _LIT( KFdfEcomEventAOPanicCategory, "FdfEcomEventAO" );
 #endif
@@ -33,17 +30,20 @@
 :	CActive(CActive::EPriorityStandard),
 	iObserver(aObserver)
 	{
-	LOG_FUNC
-
+    OstTraceFunctionEntry0( CACTIVEWAITFORECOMEVENT_CACTIVEWAITFORECOMEVENT_CONS_ENTRY );
+    
 	CActiveScheduler::Add(this);
+	OstTraceFunctionExit0( CACTIVEWAITFORECOMEVENT_CACTIVEWAITFORECOMEVENT_CONS_EXIT );
 	}
 
 CActiveWaitForEComEvent::~CActiveWaitForEComEvent()
 	{
-	LOG_FUNC
-	Cancel();
+	OstTraceFunctionEntry0( CACTIVEWAITFORECOMEVENT_CACTIVEWAITFORECOMEVENT_DES_ENTRY );
+	
+    Cancel();
 	iEComSession.Close();
 	REComSession::FinalClose();
+	OstTraceFunctionExit0( CACTIVEWAITFORECOMEVENT_CACTIVEWAITFORECOMEVENT_DES_EXIT );
 	}
 
 CActiveWaitForEComEvent* CActiveWaitForEComEvent::NewL(MEComEventObserver& aObserver)
@@ -63,30 +63,36 @@
 
 void CActiveWaitForEComEvent::Wait()
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry0( CACTIVEWAITFORECOMEVENT_WAIT_ENTRY );
+    
 	iEComSession.NotifyOnChange(iStatus);
 	SetActive();
+	OstTraceFunctionExit0( CACTIVEWAITFORECOMEVENT_WAIT_EXIT );
 	}
 
 void CActiveWaitForEComEvent::RunL()
 	{
-	LOG_LINE
-	LOG_FUNC
-	iObserver.EComEventReceived();
+	OstTraceFunctionEntry0( CACTIVEWAITFORECOMEVENT_RUNL_ENTRY );
+	
+    iObserver.EComEventReceived();
 	Wait();
+	OstTraceFunctionExit0( CACTIVEWAITFORECOMEVENT_RUNL_EXIT );
 	}
 
 void CActiveWaitForEComEvent::DoCancel()
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry0( CACTIVEWAITFORECOMEVENT_DOCANCEL_ENTRY );
+    
 	iEComSession.CancelNotifyOnChange(iStatus);
+	OstTraceFunctionExit0( CACTIVEWAITFORECOMEVENT_DOCANCEL_EXIT );
 	}
 
 TInt CActiveWaitForEComEvent::RunError(TInt aError)
 	{
-	LOG_LINE
-	LOG_FUNC
-	LOGTEXT2(_L8("ECOM change notification error = %d "), aError);
-	__ASSERT_DEBUG(EFalse, _USB_PANIC(KFdfEcomEventAOPanicCategory, aError));
+	OstTraceFunctionEntry0( CACTIVEWAITFORECOMEVENT_RUNERROR_ENTRY );
+	OstTrace1( TRACE_FATAL, CACTIVEWAITFORECOMEVENT_RUNERROR, "ECOM change notification error = %d ", aError );
+	
+    __ASSERT_DEBUG(EFalse,User::Panic(KFdfEcomEventAOPanicCategory, aError));
+	OstTraceFunctionExit0( CACTIVEWAITFORECOMEVENT_RUNERROR_EXIT );
 	return KErrNone;
 	}
--- a/usbmgmt/usbmgr/host/fdf/production/server/src/deviceproxy.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/server/src/deviceproxy.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
@@ -20,48 +20,54 @@
  @internalComponent
 */
 
-#include "deviceproxy.h"
+
 #include <usb/usblogger.h>
 #include <usbhostdefs.h>
 #include "utils.h"
 #include "event.h"
-
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "fdf      ");
+#include "deviceproxy.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "deviceproxyTraces.h"
 #endif
 
 #ifdef _DEBUG
-PANICCATEGORY("devproxy");
-#endif
-
-#ifdef __FLOG_ACTIVE
 #define LOG Log()
+_LIT(KPanicCategory,"devproxy");
 #else
 #define LOG
 #endif
 
+
+
 CDeviceProxy* CDeviceProxy::NewL(RUsbHubDriver& aHubDriver, TUint aDeviceId)
 	{
-	LOG_STATIC_FUNC_ENTRY
-
+    OstTraceFunctionEntry0( CDEVICEPROXY_NEWL_ENTRY );
+    
 	CDeviceProxy* self = new(ELeave) CDeviceProxy(aDeviceId);
 	CleanupStack::PushL(self);
 	self->ConstructL(aHubDriver);
 	CLEANUPSTACK_POP1(self);
+	OstTraceFunctionExit0( CDEVICEPROXY_NEWL_EXIT );
 	return self;
 	}
 
 CDeviceProxy::CDeviceProxy(TUint aDeviceId)
 :	iId(aDeviceId)
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry0( CDEVICEPROXY_CDEVICEPROXY_CONS_ENTRY );    
 	}
 
 void CDeviceProxy::ConstructL(RUsbHubDriver& aHubDriver)
 	{
-	LOG_FUNC
-
-	LEAVEIFERRORL(iHandle.Open(aHubDriver, iId));
+    OstTraceFunctionEntry0( CDEVICEPROXY_CONSTRUCTL_ENTRY );
+    
+    TInt err=iHandle.Open(aHubDriver, iId);
+    if (err<0)
+        {
+        OstTrace1( TRACE_NORMAL, CDEVICEPROXY_CONSTRUCTL, "handle open with error %d", err );
+        User::Leave(err);
+        }
 
 	// Pre-allocate objects relating to this device for the event queue.
 	iAttachmentEvent = new(ELeave) TDeviceEvent;
@@ -79,12 +85,13 @@
 	ReadStringDescriptorsL();
 
 	LOG;
+	OstTraceFunctionExit0( CDEVICEPROXY_CONSTRUCTL_EXIT );
 	}
 
 void CDeviceProxy::ReadStringDescriptorsL()
 	{
-	LOG_FUNC
-
+    OstTraceFunctionEntry0( CDEVICEPROXY_READSTRINGDESCRIPTORSL_ENTRY );
+    
 	// wait 10 ms before reading any string descriptors
 	// to avoid IOP issues with some USB devices (e.g. PNY Attache)
 	User::After(10000);
@@ -101,8 +108,16 @@
 	// language IDs.
 	TBuf8<256> stringBuf;
 	TUsbStringDescriptor* stringDesc = NULL;
-	ASSERT_DEBUG(iHandle.Handle());
-	LEAVEIFERRORL(iHandle.GetStringDescriptor(stringDesc, stringBuf, 0));
+	
+	if(!(iHandle.Handle()))
+	    {
+        OstTrace0( TRACE_FATAL, CDEVICEPROXY_READSTRINGDESCRIPTORSL_DUP1, "Empty handler" );
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory, __LINE__));
+	    }
+
+	TInt err=iHandle.GetStringDescriptor(stringDesc, stringBuf, 0);
+	LEAVEIFERRORL(err, OstTrace1( TRACE_ERROR, CDEVICEPROXY_READSTRINGDESCRIPTORSL_DUP6, 
+	"iHandle.GetStringDescriptor error %d", err ););
 	CleanupStack::PushL(*stringDesc);
 
 	// Copy the language IDs into our array.
@@ -110,7 +125,8 @@
 	TInt16 langId = stringDesc->GetLangId(index);
 	while ( langId != KErrNotFound )
 		{
-		LOGTEXT2(_L8("\tsupported language: 0x%04x"), langId);
+        OstTrace1( TRACE_NORMAL, CDEVICEPROXY_READSTRINGDESCRIPTORSL, "\tsupported language: 0x%04x", langId );
+        
 		iLangIds.AppendL(langId); // stored as TUint
 		++index;
 		langId = stringDesc->GetLangId(index);
@@ -120,17 +136,38 @@
 
 	// Get the actual strings for each supported language.
 	TUsbDeviceDescriptor deviceDescriptor;
-	ASSERT_DEBUG(iHandle.Handle());
-	LEAVEIFERRORL(iHandle.GetDeviceDescriptor(deviceDescriptor));
+	if(!(iHandle.Handle()))
+	    {
+        OstTrace0( TRACE_FATAL, CDEVICEPROXY_READSTRINGDESCRIPTORSL_DUP2, "Empty handler" );
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory, __LINE__));
+	    }
+	    
+	err=iHandle.GetDeviceDescriptor(deviceDescriptor);
+	LEAVEIFERRORL(err, OstTrace1( TRACE_ERROR, CDEVICEPROXY_READSTRINGDESCRIPTORSL_DUP7, 
+	"iHandle.GetDeviceDescriptor error %d", err ););
+	
 	TUint8 manufacturerStringDescriptorIndex = deviceDescriptor.ManufacturerIndex();
 	TUint8 productStringDescriptorIndex = deviceDescriptor.ProductIndex();
 	TUint8 serialNumberStringDescriptorIndex = deviceDescriptor.SerialNumberIndex();
 	PopulateStringDescriptorsL(manufacturerStringDescriptorIndex, iManufacturerStrings);
 	PopulateStringDescriptorsL(productStringDescriptorIndex, iProductStrings);
 	PopulateStringDescriptorsL(serialNumberStringDescriptorIndex, iSerialNumberStrings);
-	ASSERT_DEBUG(iManufacturerStrings.Count() == iLangIds.Count());
-	ASSERT_DEBUG(iProductStrings.Count() == iLangIds.Count());
-	ASSERT_DEBUG(iSerialNumberStrings.Count() == iLangIds.Count());
+	if(!(iManufacturerStrings.Count() == iLangIds.Count()))
+	    {
+        OstTrace0( TRACE_FATAL, CDEVICEPROXY_READSTRINGDESCRIPTORSL_DUP3, "iLangIds error" );
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory, __LINE__));
+	    }
+	if(!(iProductStrings.Count() == iLangIds.Count()))
+	    {
+        OstTrace0( TRACE_FATAL, CDEVICEPROXY_READSTRINGDESCRIPTORSL_DUP4, "iLangIds error" );
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory, __LINE__));
+	    }
+    if(!(iSerialNumberStrings.Count() == iLangIds.Count()))
+        {
+        OstTrace0( TRACE_FATAL, CDEVICEPROXY_READSTRINGDESCRIPTORSL_DUP5, "iLangIds error" );
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory, __LINE__));
+        }
+	OstTraceFunctionExit0( CDEVICEPROXY_READSTRINGDESCRIPTORSL_EXIT );
 	}
 
 // Populates the given array with the supported language variants of the given
@@ -139,8 +176,8 @@
 // supported but serial number strings to *not* be.)
 void CDeviceProxy::PopulateStringDescriptorsL(TUint8 aStringDescriptorIndex, RArray<TName>& aStringArray)
 	{
-	LOG_FUNC
-
+    OstTraceFunctionEntry0( CDEVICEPROXY_POPULATESTRINGDESCRIPTORSL_ENTRY );
+    
 	const TUint langCount = iLangIds.Count();
 	for ( TUint ii = 0 ; ii < langCount ; ++ii )
 		{
@@ -152,17 +189,20 @@
 			string = KNullDesC();
 			}
 		else
-			{
-			LEAVEIFERRORL(err);
+			{            
+			LEAVEIFERRORL(err, OstTrace1( TRACE_NORMAL, CDEVICEPROXY_POPULATESTRINGDESCRIPTORSL, "err=%d", err ););
 			}
 
-		LEAVEIFERRORL(aStringArray.Append(string));
+		err=aStringArray.Append(string);
+		LEAVEIFERRORL(err, OstTrace0( TRACE_NORMAL, CDEVICEPROXY_POPULATESTRINGDESCRIPTORSL_DUP1, "aStringArray append error"););
 		}
+	OstTraceFunctionExit0( CDEVICEPROXY_POPULATESTRINGDESCRIPTORSL_EXIT );
 	}
 
 CDeviceProxy::~CDeviceProxy()
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry0( CDEVICEPROXY_CDEVICEPROXY_DES_ENTRY );
+    
 	LOG;
 
 	// In the design, the event objects should all have had ownership taken
@@ -182,76 +222,95 @@
 	iSerialNumberStrings.Reset();
 
 	iHandle.Close();
+	OstTraceFunctionExit0( CDEVICEPROXY_CDEVICEPROXY_DES_EXIT );
 	}
 
 TInt CDeviceProxy::GetDeviceDescriptor(TUsbDeviceDescriptor& aDescriptor)
 	{
-	LOG_FUNC
-
-	ASSERT_DEBUG(iHandle.Handle());
+    OstTraceFunctionEntry0( CDEVICEPROXY_GETDEVICEDESCRIPTOR_ENTRY );
+    if(!(iHandle.Handle()))
+        {
+        OstTrace0( TRACE_FATAL, CDEVICEPROXY_GETDEVICEDESCRIPTOR_DUP1, "Empty handler" );
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory, __LINE__));
+        }
 	TInt err = iHandle.GetDeviceDescriptor(aDescriptor);
 
-	LOGTEXT2(_L8("\terr = %d"), err);
+	OstTrace1( TRACE_NORMAL, CDEVICEPROXY_GETDEVICEDESCRIPTOR, "\terr = %d", err );
+	
+	OstTraceFunctionExit0( CDEVICEPROXY_GETDEVICEDESCRIPTOR_EXIT );
 	return err;
 	}
 
 TInt CDeviceProxy::GetConfigurationDescriptor(TUsbConfigurationDescriptor& aDescriptor) const
 	{
-	LOG_FUNC
-
-	ASSERT_DEBUG(iHandle.Handle());
+    OstTraceFunctionEntry0( CDEVICEPROXY_GETCONFIGURATIONDESCRIPTOR_ENTRY );
+    if(!(iHandle.Handle()))
+        {
+        OstTrace0( TRACE_FATAL, CDEVICEPROXY_GETCONFIGURATIONDESCRIPTOR, "Empty handler" );
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory, __LINE__));
+        }
 	TInt err = const_cast<RUsbDevice&>(iHandle).GetConfigurationDescriptor(aDescriptor);
 
-	LOGTEXT2(_L8("\terr = %d"), err);
+	OstTrace1( TRACE_NORMAL, CDEVICEPROXY_GETCONFIGURATIONDESCRIPTOR_DUP1, "\terr = %d", err );
+	
+	OstTraceFunctionExit0( CDEVICEPROXY_GETCONFIGURATIONDESCRIPTOR_EXIT );
 	return err;
 	}
 
 TInt CDeviceProxy::GetTokenForInterface(TUint aIndex, TUint32& aToken) const
 	{
-	LOG_FUNC
-
-	ASSERT_DEBUG(iHandle.Handle());
-	// We shouldn't need to worry about whether the device is suspended or
+	OstTraceFunctionEntry0( CDEVICEPROXY_GETTOKENFORINTERFACE_ENTRY );
+    if(!(iHandle.Handle()))
+        {
+        OstTrace0( TRACE_FATAL, CDEVICEPROXY_GETTOKENFORINTERFACE_DUP1, "Empty handler" );
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory, __LINE__));
+        }
+    // We shouldn't need to worry about whether the device is suspended or
 	// resumed before doing this. This function is only called if we find FDs
 	// for the device, in which case we wouldn't have suspended it in the
 	// first place.
 	TInt err = const_cast<RUsbDevice&>(iHandle).GetTokenForInterface(aIndex, aToken);
 
-	LOGTEXT2(_L8("\terr = %d"), err);
+	OstTrace1( TRACE_NORMAL, CDEVICEPROXY_GETTOKENFORINTERFACE, "\terr = %d", err );
+	
+	OstTraceFunctionExit0( CDEVICEPROXY_GETTOKENFORINTERFACE_EXIT );
 	return err;
 	}
 
 const RArray<TUint>& CDeviceProxy::GetSupportedLanguages() const
 	{
-	LOG_FUNC
-
+    OstTraceFunctionEntry0( CDEVICEPROXY_GETSUPPORTEDLANGUAGES_ENTRY );
+    
 	return iLangIds;
 	}
 
 void CDeviceProxy::GetManufacturerStringDescriptorL(TUint32 aLangId, TName& aString) const
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CDEVICEPROXY_GETMANUFACTURERSTRINGDESCRIPTORL_ENTRY );
+	
 	GetStringDescriptorFromCacheL(aLangId, aString, iManufacturerStrings);
+	OstTraceFunctionExit0( CDEVICEPROXY_GETMANUFACTURERSTRINGDESCRIPTORL_EXIT );
 	}
 
 void CDeviceProxy::GetProductStringDescriptorL(TUint32 aLangId, TName& aString) const
 	{
-	LOG_FUNC
-
+    OstTraceFunctionEntry0( CDEVICEPROXY_GETPRODUCTSTRINGDESCRIPTORL_ENTRY );
+    
 	GetStringDescriptorFromCacheL(aLangId, aString, iProductStrings);
+	OstTraceFunctionExit0( CDEVICEPROXY_GETPRODUCTSTRINGDESCRIPTORL_EXIT );
 	}
 
 void CDeviceProxy::GetSerialNumberStringDescriptorL(TUint32 aLangId, TName& aString) const
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CDEVICEPROXY_GETSERIALNUMBERSTRINGDESCRIPTORL_ENTRY );
+	
 	GetStringDescriptorFromCacheL(aLangId, aString, iSerialNumberStrings);
+	OstTraceFunctionExit0( CDEVICEPROXY_GETSERIALNUMBERSTRINGDESCRIPTORL_EXIT );
 	}
 
 void CDeviceProxy::GetOtgDescriptorL(TOtgDescriptor& aDescriptor) const
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CDEVICEPROXY_GETOTGDESCRIPTORL_ENTRY );
 	
 	if (iOtgDescriptor)
 		{
@@ -259,8 +318,10 @@
 		}
 	else
 		{
-		LEAVEL(KErrNotSupported);
+        OstTrace1( TRACE_NORMAL, CDEVICEPROXY_GETOTGDESCRIPTORL, "Error=%d", KErrNotSupported );
+        User::Leave(KErrNotSupported);
 		}
+	OstTraceFunctionExit0( CDEVICEPROXY_GETOTGDESCRIPTORL_EXIT );
 	}
 
 void CDeviceProxy::SetOtgDescriptorL(const TUsbOTGDescriptor& aDescriptor)
@@ -279,31 +340,44 @@
 // Used during instantiation to read supported strings.
 void CDeviceProxy::GetStringDescriptorFromUsbdL(TUint32 aLangId, TName& aString, TUint8 aStringDescriptorIndex) const
 	{
-	LOG_FUNC
-	LOGTEXT3(_L8("\taLangId = 0x%04x, aStringDescriptorIndex = %d"), aLangId, aStringDescriptorIndex);
-
+	OstTraceFunctionEntry0( CDEVICEPROXY_GETSTRINGDESCRIPTORFROMUSBDL_ENTRY );
+	
+	OstTraceExt2( TRACE_NORMAL, CDEVICEPROXY_GETSTRINGDESCRIPTORFROMUSBDL, "\taLangId = 0x%d, aStringDescriptorIndex = %d", aLangId, aStringDescriptorIndex );
+	
 	// If the string is not defined by the device, leave.
 	if ( aStringDescriptorIndex == 0 )
 		{
-		LEAVEL(KErrNotFound);
+        OstTrace1( TRACE_NORMAL, CDEVICEPROXY_GETSTRINGDESCRIPTORFROMUSBDL_DUP1, "err=%d", KErrNotFound );
+ 		User::Leave(KErrNotFound);
 		}
 
 	TBuf8<255> stringBuf;
 	TUsbStringDescriptor* stringDesc = NULL;
-	ASSERT_DEBUG(iHandle.Handle());
-	LEAVEIFERRORL(const_cast<RUsbDevice&>(iHandle).GetStringDescriptor(stringDesc, stringBuf, aStringDescriptorIndex, aLangId));
+	if(!(iHandle.Handle()))
+	    {
+        OstTrace0( TRACE_FATAL, CDEVICEPROXY_GETSTRINGDESCRIPTORFROMUSBDL_DUP2, "Empty handler" );
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory, __LINE__));
+	    }
+	TInt err=const_cast<RUsbDevice&>(iHandle).GetStringDescriptor(stringDesc, stringBuf, aStringDescriptorIndex, aLangId);
+	if(err<0)
+	    {
+        OstTrace0( TRACE_NORMAL, CDEVICEPROXY_GETSTRINGDESCRIPTORFROMUSBDL_DUP4, "GetStringDescriptor error" );
+        User::Leave(err);
+	    }
 	stringDesc->StringData(aString);
 	stringDesc->DestroyTree();
 	delete stringDesc;
-	LOGTEXT2(_L("\taString = \"%S\""), &aString);
+	OstTraceExt1( TRACE_NORMAL, CDEVICEPROXY_GETSTRINGDESCRIPTORFROMUSBDL_DUP3, "\taString = \"%S\"", aString );
+	OstTraceFunctionExit0( CDEVICEPROXY_GETSTRINGDESCRIPTORFROMUSBDL_EXIT );
 	}
 
 // Called indirectly by users of this class to query a string descriptor.
 void CDeviceProxy::GetStringDescriptorFromCacheL(TUint32 aLangId, TName& aString, const RArray<TName>& aStringArray) const
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8("\taLangId = 0x%04x"), aLangId);
-
+    OstTraceFunctionEntry0( CDEVICEPROXY_GETSTRINGDESCRIPTORFROMCACHEL_ENTRY );
+    
+    OstTrace1( TRACE_NORMAL, CDEVICEPROXY_GETSTRINGDESCRIPTORFROMCACHEL_DUP1, "\taLangId = 0x%04x", aLangId );
+    
 	// If the lang ID is not supported by the device, leave. At the same time
 	// find the index of the required string in the given string array.
 	const TUint langCount = iLangIds.Count();
@@ -317,21 +391,29 @@
 		}
 	if ( index == langCount )
 		{
-		LEAVEL(KErrNotFound);
+  		OstTrace0( TRACE_NORMAL, CDEVICEPROXY_GETSTRINGDESCRIPTORFROMCACHEL, "CDeviceProxy::GetStringDescriptorFromCacheL" );
+		User::Leave(KErrNotFound);
 		}
 
 	aString = aStringArray[index];
-	LOGTEXT2(_L("\taString = \"%S\""), &aString);
+	OstTraceExt1( TRACE_NORMAL, CDEVICEPROXY_GETSTRINGDESCRIPTORFROMCACHEL_DUP2, "\taString = \"%S\"", aString );
+	
+	OstTraceFunctionExit0( CDEVICEPROXY_GETSTRINGDESCRIPTORFROMCACHEL_EXIT );
 	}
 
 TInt CDeviceProxy::Suspend()
 	{
-	LOG_FUNC
-
-	ASSERT_DEBUG(iHandle.Handle());
+	OstTraceFunctionEntry0( CDEVICEPROXY_SUSPEND_ENTRY );
+	if(!(iHandle.Handle()))
+	    {
+        OstTrace0( TRACE_FATAL, CDEVICEPROXY_SUSPEND_DUP1, "Empty handler" );
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory, __LINE__));
+	    }
 	TInt ret = iHandle.Suspend();
 
-	LOGTEXT2(_L8("\tret = %d"), ret);
+	OstTrace1( TRACE_NORMAL, CDEVICEPROXY_SUSPEND, "\tret = %d", ret );
+	
+	OstTraceFunctionExit0( CDEVICEPROXY_SUSPEND_EXIT );
 	return ret;
 	}
 
@@ -342,73 +424,100 @@
 
 void CDeviceProxy::SetDriverLoadingEventData(TDriverLoadStatus aStatus, TInt aError)
 	{
-	LOG_FUNC
-	LOGTEXT3(_L8("\taStatus = %d, aError = %d"), aStatus, aError);
-
-	ASSERT_DEBUG(iDriverLoadingEvent);
-	iDriverLoadingEvent->iInfo.iDriverLoadStatus = aStatus;
+	OstTraceFunctionEntry0( CDEVICEPROXY_SETDRIVERLOADINGEVENTDATA_ENTRY );
+	
+    OstTraceExt2( TRACE_NORMAL, CDEVICEPROXY_SETDRIVERLOADINGEVENTDATA, "\taStatus = %d, aError = %d", aStatus, aError );
+    if(!iDriverLoadingEvent)
+        {
+        OstTrace0( TRACE_FATAL, CDEVICEPROXY_SETDRIVERLOADINGEVENTDATA_DUP1, "Empty Driver Loading Event" );
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory, __LINE__));
+        }
+ 	iDriverLoadingEvent->iInfo.iDriverLoadStatus = aStatus;
 	iDriverLoadingEvent->iInfo.iError = aError;
 
 	LOG;
+	OstTraceFunctionExit0( CDEVICEPROXY_SETDRIVERLOADINGEVENTDATA_EXIT );
 	}
 
 TDeviceEvent* CDeviceProxy::GetAttachmentEventObject()
 	{
-	LOG_FUNC
-	LOG;
+	OstTraceFunctionEntry0( CDEVICEPROXY_GETATTACHMENTEVENTOBJECT_ENTRY );
+	
+    LOG;
+    if(!iAttachmentEvent)
+        {
+        OstTrace0( TRACE_FATAL, CDEVICEPROXY_GETATTACHMENTEVENTOBJECT_DUP1, "Empty Attechment Event" );
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory, __LINE__));
+        }
 
-	ASSERT_DEBUG(iAttachmentEvent);
 	TDeviceEvent* const obj = iAttachmentEvent;
 	iAttachmentEvent = NULL;
-	LOGTEXT2(_L8("\tobj = 0x%08x"), obj);
+	OstTrace1( TRACE_NORMAL, CDEVICEPROXY_GETATTACHMENTEVENTOBJECT, "\tobj = 0x%08x", obj );
+	
+	OstTraceFunctionExit0( CDEVICEPROXY_GETATTACHMENTEVENTOBJECT_EXIT );
 	return obj;
 	}
 
 TDeviceEvent* CDeviceProxy::GetDriverLoadingEventObject()
 	{
-	LOG_FUNC
-	LOG;
+	OstTraceFunctionEntry0( CDEVICEPROXY_GETDRIVERLOADINGEVENTOBJECT_ENTRY );
+	
+    LOG;
+    if(!iDriverLoadingEvent)
+        {
+        OstTrace0( TRACE_FATAL, CDEVICEPROXY_GETDRIVERLOADINGEVENTOBJECT, "Empty Driver Loading Event" );
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory, __LINE__));
+        }
 
-	ASSERT_DEBUG(iDriverLoadingEvent);
 	TDeviceEvent* const obj = iDriverLoadingEvent;
 	iDriverLoadingEvent = NULL;
-	LOGTEXT2(_L8("\tobj = 0x%08x"), obj);
+	OstTrace1( TRACE_NORMAL, CDEVICEPROXY_GETDRIVERLOADINGEVENTOBJECT_DUP1, "\tobj = 0x%08x", obj );
+	
+	OstTraceFunctionExit0( CDEVICEPROXY_GETDRIVERLOADINGEVENTOBJECT_EXIT );
 	return obj;
 	}
 
 TDeviceEvent* CDeviceProxy::GetDetachmentEventObject()
 	{
-	LOG_FUNC
-	LOG;
+	OstTraceFunctionEntry0( CDEVICEPROXY_GETDETACHMENTEVENTOBJECT_ENTRY );
+    LOG;
 
-	ASSERT_DEBUG(iDetachmentEvent);
+    if(!iDetachmentEvent)
+        {
+        OstTrace0( TRACE_FATAL, CDEVICEPROXY_GETDETACHMENTEVENTOBJECT, "Empty Detachment Event" );
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory, __LINE__));
+        }
 	TDeviceEvent* const obj = iDetachmentEvent;
 	iDetachmentEvent = NULL;
-	LOGTEXT2(_L8("\tobj = 0x%08x"), obj);
+	
+	OstTrace1( TRACE_NORMAL, CDEVICEPROXY_GETDETACHMENTEVENTOBJECT_DUP1, "\tobj = 0x%08x", obj );
+	
+	OstTraceFunctionExit0( CDEVICEPROXY_GETDETACHMENTEVENTOBJECT_EXIT );
 	return obj;
 	}
 
-#ifdef __FLOG_ACTIVE
 
 void CDeviceProxy::Log()
 	{
-	LOG_FUNC
-
-	LOGTEXT2(_L8("\tiId = %d"), iId);
-	LOGTEXT2(_L8("\tiHandle.Handle() = %d"), iHandle.Handle());
-	if ( iAttachmentEvent )
+    OstTraceFunctionEntry0( CDEVICEPROXY_LOG_ENTRY );
+    
+    OstTrace1( TRACE_DUMP, CDEVICEPROXY_LOG, "\tiId = %d", iId );
+    OstTrace1( TRACE_DUMP, CDEVICEPROXY_LOG_DUP1, "\tiHandle.Handle() = %d", iHandle.Handle() );
+    
+    if ( iAttachmentEvent )
 		{
-		LOGTEXT(_L8("\tlogging iAttachmentEvent"));
-		iAttachmentEvent->Log();
+        OstTrace0( TRACE_DUMP, CDEVICEPROXY_LOG_DUP2, "\tlogging iAttachmentEvent" );
+ 		iAttachmentEvent->Log();
 		}
 	if ( iDriverLoadingEvent )
 		{
-		LOGTEXT(_L8("\tlogging iDriverLoadingEvent"));
+        OstTrace0( TRACE_DUMP, CDEVICEPROXY_LOG_DUP3, "\tlogging iDriverLoadingEvent" );
+
 		iDriverLoadingEvent->Log();
 		}
 	if ( iDetachmentEvent )
 		{
-		LOGTEXT(_L8("\tlogging iDetachmentEvent"));
+        OstTrace0( TRACE_DUMP, CDEVICEPROXY_LOG_DUP4, "\tlogging iDetachmentEvent" );
 		iDetachmentEvent->Log();
 		}
 	const TUint langCount = iLangIds.Count();
@@ -421,24 +530,26 @@
 	// This has been done to protect in case there have been an incomplete construction etc..
 	// when logging the data
 
-	LOGTEXT2(_L8("\tlangCount = %d"), langCount);
+	OstTrace1( TRACE_DUMP, CDEVICEPROXY_LOG_DUP5, "C\tlangCount = %d", langCount );
+	
 	for ( TUint ii = 0 ; ii < langCount ; ++ii )
 		{
-		LOGTEXT2(_L("\tlang ID 0x%04x:"), iLangIds[ii]);
+        OstTrace1( TRACE_FLOW, CDEVICEPROXY_LOG_DUP6, "\tlang ID 0x%04x:", iLangIds[ii] );
+        
 		if(ii<manufacturerCount)
 			{
-			LOGTEXT2(_L("\t\tmanufacturer string: \"%S\""), &iManufacturerStrings[ii]);
-			}
+            OstTraceExt1( TRACE_FLOW, CDEVICEPROXY_LOG_DUP7, "\t\tmanufacturer string: \"%S\"", iManufacturerStrings[ii] );
+            }
 		if(ii<productCount)
 			{
-			LOGTEXT2(_L("\t\tproduct string: \"%S\""), &iProductStrings[ii]);
-			}
+            OstTraceExt1( TRACE_FLOW, CDEVICEPROXY_LOG_DUP8, "\t\tproduct string: \"%S\"", iProductStrings[ii]);
+		 	}
 		if(ii<serialNumberCount)
 			{
-			LOGTEXT2(_L("\t\tserial number string: \"%S\""), &iSerialNumberStrings[ii]);
+            OstTraceExt1( TRACE_FLOW, CDEVICEPROXY_LOG_DUP9, "\t\tserial number string: \"%S\"", iSerialNumberStrings[ii]);
 			}
 
 		}
+	OstTraceFunctionExit0( CDEVICEPROXY_LOG_EXIT );
 	}
 
-#endif
--- a/usbmgmt/usbmgr/host/fdf/production/server/src/event.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/server/src/event.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
@@ -15,45 +15,46 @@
 *
 */
 
+#include <usb/usblogger.h>
 #include "event.h"
-#include <usb/usblogger.h>
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "eventTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "fdf      ");
-#endif
 
 TDeviceEvent::TDeviceEvent()
 	{
-	LOG_FUNC
-	}
+    OstTraceFunctionEntry0( TDEVICEEVENT_TDEVICEEVENT_CONS_ENTRY );
+ 	}
 
 TDeviceEvent::~TDeviceEvent()
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry0( TDEVICEEVENT_TDEVICEEVENT_DES_ENTRY );
 	}
 
-#ifdef __FLOG_ACTIVE
-
 void TDeviceEvent::Log() const
 	{
-	LOGTEXT2(_L8("\tLogging event 0x%08x"), this);
-	LOGTEXT2(_L8("\t\tdevice ID = %d"), iInfo.iDeviceId);
-	LOGTEXT2(_L8("\t\tevent type = %d"), iInfo.iEventType);
-
+    OstTrace1( TRACE_DUMP, TDEVICEEVENT_LOG, "\tLogging event 0x%08x", this );
+    OstTrace1( TRACE_DUMP, TDEVICEEVENT_LOG_DUP1, "\t\tdevice ID = %d", iInfo.iDeviceId );
+    OstTrace1( TRACE_DUMP, TDEVICEEVENT_LOG_DUP2, "\t\tevent type = %d", iInfo.iEventType );
+        
 	switch ( iInfo.iEventType )
 		{
 	case EDeviceAttachment:
-		LOGTEXT2(_L8("\t\terror = %d"), iInfo.iError);
-		if ( !iInfo.iError )
+	    OstTrace1( TRACE_DUMP, TDEVICEEVENT_LOG_DUP3, "\t\terror = %d", iInfo.iError );
+	        
+	    if ( !iInfo.iError )
 			{
-			LOGTEXT2(_L8("\t\tVID = 0x%04x"), iInfo.iVid);
-			LOGTEXT2(_L8("\t\tPID = 0x%04x"), iInfo.iPid);
+            OstTrace1( TRACE_DUMP, TDEVICEEVENT_LOG_DUP4, "\t\tVID = 0x%04x", iInfo.iVid );
+            OstTrace1( TRACE_DUMP, TDEVICEEVENT_LOG_DUP5, "\t\tPID = 0x%04x", iInfo.iPid );
 			}
 		break;
 
 	case EDriverLoad:
-		LOGTEXT2(_L8("\t\terror = %d"), iInfo.iError);
-		LOGTEXT2(_L8("\t\t\tdriver load status = %d"), iInfo.iDriverLoadStatus);
+	    OstTrace1( TRACE_DUMP, TDEVICEEVENT_LOG_DUP6, "\t\terror = %d", iInfo.iError );
+	    OstTrace1( TRACE_DUMP, TDEVICEEVENT_LOG_DUP7, "\t\t\tdriver load status = %d", iInfo.iDriverLoadStatus);
+	                
 		break;
 
 	case EDeviceDetachment: // No break deliberate.
@@ -62,4 +63,3 @@
 		}
 	}
 
-#endif // __FLOG_ACTIVE
--- a/usbmgmt/usbmgr/host/fdf/production/server/src/eventqueue.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/server/src/eventqueue.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -15,33 +15,33 @@
 *
 */
 
+#include <usb/usblogger.h>
 #include "eventqueue.h"
-#include <usb/usblogger.h>
 #include "fdf.h"
 #include "fdfsession.h"
 #include "utils.h"
-
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "fdf      ");
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "eventqueueTraces.h"
 #endif
 
-#ifdef __FLOG_ACTIVE
+#ifdef _DEBUG
 #define LOG Log()
+_LIT(KPanicCategory, "eventqueue");
 #else
 #define LOG
 #endif
 
-#ifdef _DEBUG
-PANICCATEGORY("eventq");
-#endif
+
 
 class CFdfSession;
 
 CEventQueue* CEventQueue::NewL(CFdf& aFdf)
 	{
-	LOG_STATIC_FUNC_ENTRY
-
+    OstTraceFunctionEntry0( CEVENTQUEUE_NEWL_ENTRY );
+    
 	CEventQueue* self = new(ELeave) CEventQueue(aFdf);
+	OstTraceFunctionExit0( CEVENTQUEUE_NEWL_EXIT );
 	return self;
 	}
 
@@ -49,12 +49,12 @@
 :	iFdf(aFdf),
 	iDeviceEvents(_FOFF(TDeviceEvent, iLink))
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CEVENTQUEUE_CEVENTQUEUE_CONS_ENTRY );
 	}
 
 CEventQueue::~CEventQueue()
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry0( CEVENTQUEUE_CEVENTQUEUE_DES_ENTRY );
 
 	// There will be things left on the queue at this time if USBMAN shuts us
 	// down without having picked up everything that was on the queue.
@@ -66,14 +66,16 @@
 		{
 		delete event;
 		}
+	OstTraceFunctionExit0( CEVENTQUEUE_CEVENTQUEUE_DES_EXIT );
 	}
 
 // Increments the count of failed attachments.
 void CEventQueue::AttachmentFailure(TInt aError)
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8("\taError = %d"), aError);
-	LOG;
+	OstTraceFunctionEntry0( CEVENTQUEUE_ATTACHMENTFAILURE_ENTRY );
+	OstTrace1( TRACE_NORMAL, CEVENTQUEUE_ATTACHMENTFAILURE, "\taError = %d", aError );
+	
+    LOG;
 
 	TUint index = 0;
 	switch ( aError )
@@ -114,7 +116,8 @@
 
 	default:
 		// we must deal with every error we are ever given
-		LOGTEXT2(_L8("\tFDF did not expect this error %d as a fail attachment"), aError);
+	    OstTrace1( TRACE_NORMAL, CEVENTQUEUE_ATTACHMENTFAILURE_DUP1, "\tFDF did not expect this error %d as a fail attachment", aError );
+	    
 		index = KAttachmentFailureGeneralError;
 		break;
 		}
@@ -122,20 +125,23 @@
 
 	PokeSession();
 	LOG;
+	OstTraceFunctionExit0( CEVENTQUEUE_ATTACHMENTFAILURE_EXIT );
 	}
 
 // Called to add an event to the tail of the queue.
 // Takes ownership of aEvent.
 void CEventQueue::AddDeviceEvent(TDeviceEvent& aEvent)
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8("\t&aEvent = 0x%08x"), &aEvent);
+    OstTraceFunctionEntry0( CEVENTQUEUE_ADDDEVICEEVENT_ENTRY );
+
+	OstTrace1( TRACE_NORMAL, CEVENTQUEUE_ADDDEVICEEVENT, "\t&aEvent = 0x%08x", &aEvent );
 	LOG;
 
 	iDeviceEvents.AddLast(aEvent);
 
 	PokeSession();
 	LOG;
+	OstTraceFunctionExit0( CEVENTQUEUE_ADDDEVICEEVENT_EXIT );
 	}
 
 // Poke the session object (if it exists) to complete any outstanding event
@@ -143,8 +149,7 @@
 // It only makes sense to call this function if there's some event to give up.
 void CEventQueue::PokeSession()
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CEVENTQUEUE_POKESESSION_ENTRY );
 	// If the session exists, and has a notification outstanding, give them
 	// the head event.
 	CFdfSession* sess = iFdf.Session();
@@ -167,6 +172,7 @@
 				}
 			}
 		}
+	OstTraceFunctionExit0( CEVENTQUEUE_POKESESSION_EXIT );
 	}
 
 // This is called to get a device event. Attachment failures are given up
@@ -175,7 +181,7 @@
 // in aEvent.
 TBool CEventQueue::GetDeviceEvent(TDeviceEvent& aEvent)
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry0( CEVENTQUEUE_GETDEVICEEVENT_ENTRY );
 	LOG;
 
 	TBool ret = EFalse;
@@ -230,13 +236,13 @@
 			case KNumberOfAttachmentFailureTypes:
 			default:
 				// this switch should deal with every error type we store
-				ASSERT_DEBUG(0);
-
+			    OstTrace0( TRACE_FATAL, CEVENTQUEUE_GETDEVICEEVENT, "Empty handler" );
+			    __ASSERT_DEBUG(EFalse, User::Panic(KPanicCategory,__LINE__));
 				}
 
 			ret = ETrue;
 			aEvent.iInfo.iEventType = EDeviceAttachment;
-			LOGTEXT2(_L8("\treturning attachment failure event (code %d)"), aEvent.iInfo.iError);
+			OstTrace1( TRACE_NORMAL, CEVENTQUEUE_GETDEVICEEVENT_DUP1, "\treturning attachment failure event (code %d)", aEvent.iInfo.iError );
 			// Only give the client one error at a time.
 			break;
 			}
@@ -245,7 +251,7 @@
 	if ( !ret && !iDeviceEvents.IsEmpty() )
 		{
 		TDeviceEvent* const event = iDeviceEvents.First();
-		LOGTEXT2(_L8("\tevent = 0x%08x"), event);
+		OstTrace1( TRACE_NORMAL, CEVENTQUEUE_GETDEVICEEVENT_DUP2, "\tevent = 0x%08x", event );
 		iDeviceEvents.Remove(*event);
 		(void)Mem::Copy(&aEvent, event, sizeof(TDeviceEvent));
 		delete event;
@@ -253,14 +259,15 @@
 		}
 
 	LOG;
-	LOGTEXT2(_L8("\treturning %d"), ret);
+	OstTrace1( TRACE_NORMAL, CEVENTQUEUE_GETDEVICEEVENT_DUP3, "\treturning %d", ret );
+	OstTraceFunctionExit0( CEVENTQUEUE_GETDEVICEEVENT_EXIT );
 	return ret;
 	}
 
 TBool CEventQueue::GetDevmonEvent(TInt& aEvent)
 	{
-	LOG_FUNC
-	LOG;
+    OstTraceFunctionEntry0( CEVENTQUEUE_GETDEVMONEVENT_ENTRY );
+    LOG;
 
 	TBool ret = EFalse;
 
@@ -294,8 +301,8 @@
 			
 			case KNumberOfDevmonEventTypes:
 			default:
-				LOGTEXT2(_L8("\tUnexpected devmon error, not handled properly %d"), ii);
-				ASSERT_DEBUG(0);
+			    OstTrace1( TRACE_FATAL, CEVENTQUEUE_GETDEVMONEVENT, "\tUnexpected devmon error, not handled properly %d", ii );
+			    __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
 				aEvent = KErrUsbDeviceRejected;
 				// this switch should deal with every error type we store
 				}
@@ -307,16 +314,17 @@
 		}
 
 	LOG;
-	LOGTEXT2(_L8("\treturning %d"), ret);
+	OstTrace1( TRACE_NORMAL, CEVENTQUEUE_GETDEVMONEVENT_DUP1, "\treturning %d", ret );
+	OstTraceFunctionExit0( CEVENTQUEUE_GETDEVMONEVENT_EXIT );
 	return ret;
 	}
 
 void CEventQueue::AddDevmonEvent(TInt aEvent)
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8("\taEvent = %d"), aEvent);
-
-	// Increment the relevant count.
+    OstTraceFunctionEntry0( CEVENTQUEUE_ADDDEVMONEVENT_ENTRY );
+    OstTrace1( TRACE_NORMAL, CEVENTQUEUE_ADDDEVMONEVENT, "\taEvent = %d", aEvent );
+ 
+    // Increment the relevant count.
 	TInt index = 0;
 	switch ( aEvent )
 		{
@@ -341,30 +349,35 @@
 			break;			
 
 		default:
-			LOGTEXT2(_L8("\tUnexpected devmon error, not handled properly %d"), aEvent);
-			ASSERT_DEBUG(0);
-			// this switch should deal with every type of event we ever receive from devmon
-			}
+		    
+		    OstTrace1( TRACE_FATAL, CEVENTQUEUE_ADDDEVMONEVENT_DUP1, "Unexpected devmon error, not handled properly %d", aEvent );
+		    // this switch should deal with every type of event we ever receive from devmon
+		    __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+            }
 
 	TUint& eventCount = iDevmonEventCount[index];
-	ASSERT_DEBUG(eventCount < KMaxTUint);
+	if(!(eventCount < KMaxTUint))
+	    {
+        OstTrace1( TRACE_FATAL, CEVENTQUEUE_ADDDEVMONEVENT_DUP2, "eventCount is too big;eventCount=%d", eventCount );
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+	    }
 	++eventCount;
 	PokeSession();
+	OstTraceFunctionExit0( CEVENTQUEUE_ADDDEVMONEVENT_EXIT );
 	}
 
-#ifdef __FLOG_ACTIVE
-
+#ifdef _DEBUG
 void CEventQueue::Log()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CEVENTQUEUE_LOG_ENTRY );
 
 	for ( TUint ii = 0 ; ii < KNumberOfAttachmentFailureTypes ; ++ii )
 		{
 		const TInt& errorCount = iAttachmentFailureCount[ii];
 		if ( errorCount )
 			{
-			LOGTEXT3(_L8("\tNumber of attachment failures of type %d is %d"), ii, errorCount);
-			}
+            OstTraceExt2( TRACE_DUMP, CEVENTQUEUE_LOG, "Number of attachment failures of type %d is %d", ii, errorCount );
+            }
 		}
 
 	for ( TUint ii = 0 ; ii < KNumberOfDevmonEventTypes ; ++ii )
@@ -372,7 +385,7 @@
 		const TInt& eventCount = iDevmonEventCount[ii];
 		if ( eventCount )
 			{
-			LOGTEXT3(_L8("\tNumber of devmon events of type %d is %d"), ii, eventCount);
+            OstTraceExt2( TRACE_DUMP, CEVENTQUEUE_LOG_DUP1, "Number of devmon events of type %d is %d", ii, eventCount );
 			}
 		}
 
@@ -382,11 +395,12 @@
 	TDeviceEvent* event;
 	while ( ( event = iter++ ) != NULL )
 		{
-		LOGTEXT2(_L8("\tLogging event at position %d"), pos);
-		event->Log();
+		OstTrace1( TRACE_DUMP, DUP1_CEVENTQUEUE_LOG_DUP2, "Logging event at position %d", pos );
+		
+        event->Log();
 		++pos;
 		}
+	OstTraceFunctionExit0( CEVENTQUEUE_LOG_EXIT );
 	}
+#endif
 
-#endif // __FLOG_ACTIVE
-
--- a/usbmgmt/usbmgr/host/fdf/production/server/src/fdcproxy.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/server/src/fdcproxy.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
@@ -19,65 +19,63 @@
  @file
  @internalComponent
 */
+#include <ecom/ecom.h>
+#include <usbhost/internal/fdcplugin.h>
+#include <usbhost/internal/fdcinterface.h>
 
 #include "fdcproxy.h"
-#include <ecom/ecom.h>
 #include "utils.h"
-#include <usbhost/internal/fdcplugin.h>
-#include <usbhost/internal/fdcinterface.h>
 #include "fdf.h"
 #include "utils.h"
-
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "fdf      ");
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "fdcproxyTraces.h"
 #endif
 
-#ifdef __FLOG_ACTIVE
-#define LOG	Log()
-#else
-#define LOG
-#endif
 
 #ifdef _DEBUG
+#define LOG	Log()
 #define INVARIANT Invariant()
-#else
+#else 
+#define LOG
 #define INVARIANT
 #endif
 
-PANICCATEGORY("fdcproxy");
-
-
+_LIT(KPanicCategory, "fdcproxy");
 
 CFdcProxy* CFdcProxy::NewL(CFdf& aFdf, CImplementationInformation& aImplInfo)
 	{
-	LOG_STATIC_FUNC_ENTRY
+    OstTraceFunctionEntry0( CFDCPROXY_NEWL_ENTRY );
 
 	CFdcProxy* self = new(ELeave) CFdcProxy(aFdf);
 	CleanupStack::PushL(self);
 	self->ConstructL(aImplInfo);
-#ifdef __FLOG_ACTIVE
+#ifdef _DEBUG
 	self->INVARIANT;
 #endif
 	CleanupStack::Pop(self);
+	OstTraceFunctionExit0( CFDCPROXY_NEWL_EXIT );
 	return self;
 	}
 
 
 void CFdcProxy::ConstructL(CImplementationInformation& aImplInfo)
 	{
-	LOG_FUNC
-	
-	LOGTEXT2(_L8("\t\tFDC implementation UID: 0x%08x"), aImplInfo.ImplementationUid());
-	LOGTEXT2(_L("\t\tFDC display name: \"%S\""), &aImplInfo.DisplayName());
-	LOGTEXT2(_L8("\t\tFDC default_data: \"%S\""), &aImplInfo.DataType());
-	LOGTEXT2(_L8("\t\tFDC version: %d"), aImplInfo.Version());
-	LOGTEXT2(_L8("\t\tFDC disabled: %d"), aImplInfo.Disabled());
-	TDriveName drvName = aImplInfo.Drive().Name();
- 	LOGTEXT2(_L8("\t\tFDC drive: %S"), &drvName);
-	LOGTEXT2(_L8("\t\tFDC rom only: %d"), aImplInfo.RomOnly());
-	LOGTEXT2(_L8("\t\tFDC rom based: %d"), aImplInfo.RomBased());
-	LOGTEXT2(_L8("\t\tFDC vendor ID: %08x"), (TUint32)aImplInfo.VendorId());
-		
+    OstTraceFunctionEntry0( CFDCPROXY_CONSTRUCTL_ENTRY );
+    
+    OstTrace1( TRACE_DUMP, CFDCPROXY_CONSTRUCTL, "FDC implementation UID: 0x%08x", aImplInfo.ImplementationUid().iUid );
+    OstTraceExt1( TRACE_DUMP, CFDCPROXY_CONSTRUCTL_DUP1, "FDC display name: \"%S\"", aImplInfo.DisplayName() );
+    OstTraceExt1( TRACE_DUMP, CFDCPROXY_CONSTRUCTL_DUP2, "FDC default_data: \"%s\"", aImplInfo.DataType() );
+    OstTrace1( TRACE_DUMP, CFDCPROXY_CONSTRUCTL_DUP3, "FDC version: %d", aImplInfo.Version() );
+    OstTrace1( TRACE_DUMP, CFDCPROXY_CONSTRUCTL_DUP4, "FDC disabled: %d", aImplInfo.Disabled());
+    TDriveName drvName = aImplInfo.Drive().Name();
+        
+    OstTraceExt1( TRACE_DUMP, CFDCPROXY_CONSTRUCTL_DUP5, "FDC drive: %S", drvName );
+    OstTrace1( TRACE_DUMP, CFDCPROXY_CONSTRUCTL_DUP6, "FDC rom only: %d", aImplInfo.RomOnly() );
+    OstTrace1( TRACE_DUMP, CFDCPROXY_CONSTRUCTL_DUP7, "FDC rom based: %d", aImplInfo.RomBased() );
+    OstTrace1( TRACE_DUMP, CFDCPROXY_CONSTRUCTL_DUP8, "FDC vendor ID: %08x", (TUint32)aImplInfo.VendorId() );
+                        
+    	
 	// Before PREQ2080 a reference to the CImplementationInformation object was held. This is no longer
 	// possible because as soon as REComSession::ListImplementations() is called the reference will be
 	// invalid.		
@@ -85,20 +83,21 @@
 	iVersion = aImplInfo.Version();
 	iDefaultData.CreateL(aImplInfo.DataType());
 	iRomBased = aImplInfo.RomBased();
+	OstTraceFunctionExit0( CFDCPROXY_CONSTRUCTL_EXIT );
 	}
 
 CFdcProxy::CFdcProxy(CFdf& aFdf)
 :	iFdf(aFdf),
 	i0thInterface(-1) // -1 means unassigned
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry0( CFDCPROXY_CFDCPROXY_CONS_ENTRY );
 	}
 
 
 CFdcProxy::~CFdcProxy()
 	{
-	LOG_FUNC
-	INVARIANT;
+    OstTraceFunctionEntry0( CFDCPROXY_CFDCPROXY_DES_ENTRY );
+    INVARIANT;
 
 	// Only executed when the FDF is finally shutting down.
 	// By this time detachment of all devices should have been signalled to
@@ -106,12 +105,22 @@
 	// If is safe to assert this because iPlugin and iDeviceIds are not
 	// allocated on construction so this doesn't have to safe against partial
 	// construction.
-	ASSERT_DEBUG(!iPlugin);
-	ASSERT_DEBUG(iDeviceIds.Count() == 0);
-	iDeviceIds.Close();
+	
+    if(iPlugin)
+        {
+        OstTrace0( TRACE_FATAL, CFDCPROXY_CFDCPROXY_DUP2, "Plugin should empty" );
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+        }
+    if(!(iDeviceIds.Count() == 0))
+        {
+        OstTrace0( TRACE_FATAL, CFDCPROXY_CFDCPROXY_DUP3, "DeviceCount should be 0" );
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+        }
+    iDeviceIds.Close();
 	iDefaultData.Close();
 
 	INVARIANT;
+	OstTraceFunctionExit0( CFDCPROXY_CFDCPROXY_DES_EXIT );
 	}
 
 
@@ -120,15 +129,17 @@
 		const TUsbDeviceDescriptor& aDeviceDescriptor,
 		const TUsbConfigurationDescriptor& aConfigurationDescriptor)
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8("\taDeviceId = %d"), aDeviceId);
+	OstTraceFunctionEntry0( CFDCPROXY_NEWFUNCTION_ENTRY );
+
+	OstTrace1( TRACE_NORMAL, CFDCPROXY_NEWFUNCTION, "aDeviceId = %d", aDeviceId );
 	INVARIANT;
 
 	// Create a plugin object if required, call Mfi1NewFunction on it, and
 	// update our iDeviceIds.
 	TRAPD(err, NewFunctionL(aDeviceId, aInterfaces, aDeviceDescriptor, aConfigurationDescriptor));
 	INVARIANT;
-	LOGTEXT2(_L8("\terr = %d"), err);
+	OstTrace1( TRACE_NORMAL, CFDCPROXY_NEWFUNCTION_DUP1, "err = %d", err );
+	OstTraceFunctionExit0( CFDCPROXY_NEWFUNCTION_EXIT );
 	return err;
 	}
 
@@ -138,7 +149,7 @@
 		const TUsbDeviceDescriptor& aDeviceDescriptor,
 		const TUsbConfigurationDescriptor& aConfigurationDescriptor)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CFDCPROXY_NEWFUNCTIONL_ENTRY );
 
 	// We may already have aDeviceId in our collection of device IDs, if the
 	// device is offering multiple Functions of the same type. In this case we
@@ -159,8 +170,9 @@
 			break;
 			}
 		}
-	LOGTEXT2(_L8("\talreadyKnowThisDevice = %d"), alreadyKnowThisDevice);
-
+	
+	OstTrace1( TRACE_NORMAL, CFDCPROXY_NEWFUNCTIONL, "alreadyKnowThisDevice = %d", alreadyKnowThisDevice );
+	
 	TArrayRemove arrayRemove(iDeviceIds, aDeviceId);
 	if ( !alreadyKnowThisDevice )
 		{
@@ -168,7 +180,9 @@
 		// Logically, it should be done *after* we call Mfi1NewFunction on the
 		// plugin, but we can't have the failable step of adding the device ID
 		// to the array after telling the FDC.
-		LEAVEIFERRORL(iDeviceIds.Append(aDeviceId));
+        TInt error=iDeviceIds.Append(aDeviceId);
+    	LEAVEIFERRORL(error,OstTrace0( TRACE_NORMAL, CFDCPROXY_NEWFUNCTIONL_DUT1, "iDeviceIds append fails" ););
+         
 		// This cleanup item removes aDeviceId from iDeviceIds on a leave.
 		CleanupRemovePushL(arrayRemove);
 		}
@@ -179,53 +193,75 @@
 	if ( !plugin )
 		{
 		neededToMakePlugin = ETrue;
-		LOGTEXT2(_L8("\t\tFDC implementation UID: 0x%08x"), iImplementationUid);
+		OstTrace1( TRACE_NORMAL, CFDCPROXY_NEWFUNCTIONL_DUP2, "FDC implementation UID: 0x%08x", iImplementationUid.iUid );
 		plugin = CFdcPlugin::NewL(iImplementationUid, *this);
 		CleanupStack::PushL(plugin);
 		iface = reinterpret_cast<MFdcInterfaceV1*>(plugin->GetInterface(TUid::Uid(KFdcInterfaceV1)));
 		}
-	ASSERT_DEBUG(iface);
+	
+	if(!iface)
+	    {
+        OstTrace0( TRACE_FATAL, CFDCPROXY_NEWFUNCTIONL_DUP3, "Empty interface" );
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+	    }
+
+	
 	TInt err = KErrNone;
 
 	// Log the interfaces they're being offered.
-#ifdef __FLOG_ACTIVE
 	const TUint ifCount = aInterfaces.Count();
-	LOGTEXT2(_L8("\toffering %d interfaces:"), ifCount);
+	OstTrace1( TRACE_NORMAL, CFDCPROXY_NEWFUNCTIONL_DUP4, "offering %d interfaces:", ifCount );
 	for ( TUint ii = 0 ; ii < ifCount ; ++ii )
 		{
-		LOGTEXT2(_L8("\t\tinterface %d"), aInterfaces[ii]);
+        OstTrace1( TRACE_NORMAL, CFDCPROXY_NEWFUNCTIONL_DUP5, "interface %d", aInterfaces[ii] );
 		}
-#endif
 
 	iInMfi1NewFunction = ETrue;
 	// Check that the FDC always claims the 0th interface.
-	ASSERT_DEBUG(i0thInterface == -1);
+	if(!(i0thInterface == -1))
+	    {
+        OstTrace0( TRACE_FATAL, CFDCPROXY_NEWFUNCTIONL_DUP6, "the FDC not claims the 0th interface" );
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+	    }
+
 	i0thInterface = aInterfaces[0];
 	err = iface->Mfi1NewFunction(   aDeviceId,
 									aInterfaces.Array(), // actually pass them a TArray for const access
 									aDeviceDescriptor,
 									aConfigurationDescriptor);
-	LOGTEXT2(_L8("\terr = %d"), err);
+	OstTrace1( TRACE_NORMAL, CFDCPROXY_NEWFUNCTIONL_DUP11, "err = %d", err);
 	iInMfi1NewFunction = EFalse;
 	// The implementation of Mfi1NewFunction may not leave.
 //	ASSERT_ALWAYS(leave_err == KErrNone);
 	// This is set back to -1 when the FDC claims the 0th interface.
-	ASSERT_DEBUG(i0thInterface == -1);
-
+	if(!(i0thInterface == -1))
+	    {
+        OstTrace0( TRACE_FATAL, CFDCPROXY_NEWFUNCTIONL_DUP7, "the FDC not claims the 0th interface" );
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+	    }
+	
 	// If this leaves, then:
 	// (a) aDeviceId will be removed from iDeviceIds (if we needed to add it).
 	// (b) the FDF will get the leave code.
 	// If this doesn't leave, then iPlugin, iInterface and iDeviceIds are
 	// populated OK and the FDF will get KErrNone.
-	LEAVEIFERRORL(err);
+	LEAVEIFERRORL(err,OstTrace0( TRACE_NORMAL, CFDCPROXY_NEWFUNCTIONL_DUP8,"iface->Mfi1NewFunction function fails"););
 
 	if ( neededToMakePlugin )
 		{
 		CLEANUPSTACK_POP1(plugin);
 		// Now everything failable has been done we can assign iPlugin and
 		// iInterface.
-		ASSERT_DEBUG(plugin);
-		ASSERT_DEBUG(iface);
+		if(!plugin)
+		    {
+            OstTrace0( TRACE_FATAL, CFDCPROXY_NEWFUNCTIONL_DUP9,"Empty plugin");
+            __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+		    }
+		if(!iface)
+		    {
+            OstTrace0( TRACE_FATAL, CFDCPROXY_NEWFUNCTIONL_DUP10,"Empty iface");
+            __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+		    }
 		iPlugin = plugin;
 		iInterface = iface;
 		}
@@ -233,6 +269,7 @@
 		{
 		CLEANUPSTACK_POP1(&arrayRemove);
 		}
+	OstTraceFunctionExit0( CFDCPROXY_NEWFUNCTIONL_EXIT );
 	}
 
 
@@ -241,8 +278,9 @@
 // detachment to the plugin.
 void CFdcProxy::DeviceDetached(TUint aDeviceId)
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8("\taDeviceId = %d"), aDeviceId);
+    OstTraceFunctionEntry0( CFDCPROXY_DEVICEDETACHED_ENTRY );
+    OstTrace1( TRACE_NORMAL, CFDCPROXY_DEVICEDETACHED, "aDeviceId = %d", aDeviceId );
+
 	INVARIANT;
 	
 	const TUint count = iDeviceIds.Count();
@@ -250,8 +288,13 @@
 		{
 		if ( iDeviceIds[ii] == aDeviceId )
 			{
-			LOGTEXT(_L8("\tmatching device id- calling Mfi1DeviceDetached!"));
-			ASSERT_DEBUG(iInterface);
+            OstTrace0( TRACE_FATAL, CFDCPROXY_DEVICEDETACHED_DUP1, "matching device id- calling Mfi1DeviceDetached!");
+            if(!iInterface)
+                {
+                OstTrace0( TRACE_NORMAL, CFDCPROXY_DEVICEDETACHED_DUP2, "Empty iInterface" );
+                __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+                }
+ 
 			iInterface->Mfi1DeviceDetached(aDeviceId);
 			// The implementation of Mfi1DeviceDetached may not leave.
 //			ASSERT_ALWAYS(err == KErrNone);
@@ -259,8 +302,8 @@
 			break;
 			}
 		}
-
-	LOGTEXT2(_L8("\tiDeviceIds.Count() = %d"), iDeviceIds.Count());
+	OstTrace1( TRACE_NORMAL, CFDCPROXY_DEVICEDETACHED_DUP3, "iDeviceIds.Count() = %d", iDeviceIds.Count() );
+	
 	if ( iDeviceIds.Count() == 0 )
 		{
 		delete iPlugin;
@@ -275,10 +318,10 @@
 		}
 
 	INVARIANT;
+	OstTraceFunctionExit0( CFDCPROXY_DEVICEDETACHED_EXIT );
 	}
 
 
-#ifdef _DEBUG
 void CFdcProxy::Invariant() const
 	{
 	// If the class invariant fails hopefully it will be clear why from
@@ -288,7 +331,7 @@
 	// Either these are all 0 or none of them are:
 	// iDeviceIds.Count, iPlugin, iInterface
 	
-	ASSERT_DEBUG(
+	if(!(
 					(
 						iDeviceIds.Count() != 0 && iPlugin && iInterface
 					)
@@ -296,7 +339,12 @@
 					(
 						iDeviceIds.Count() == 0 && !iPlugin && !iInterface
 					)
-		);
+		))
+	    {
+        OstTrace0( TRACE_FATAL, CFDCPROXY_INVARIANT, "iDeviceIds count error" );
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+	    }
+
 
 	// Each device ID appears only once in the device ID array.
 	const TUint count = iDeviceIds.Count();
@@ -304,7 +352,12 @@
 		{
 		for ( TUint jj = ii+1 ; jj < count ; ++jj )
 			{
-			ASSERT_DEBUG(iDeviceIds[ii] != iDeviceIds[jj]);
+			if(!(iDeviceIds[ii] != iDeviceIds[jj]))
+			    {
+                OstTrace0( TRACE_FATAL, CFDCPROXY_INVARIANT_DUP1, "Repeated iDeviceIDs" );
+                __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+			    }
+
 			}
 		}
 	}
@@ -312,17 +365,17 @@
 
 void CFdcProxy::Log() const
 	{
-	LOGTEXT2(_L8("\tLogging CFdcProxy 0x%08x:"), this);
+    OstTrace1( TRACE_DUMP, CFDCPROXY_LOG, "Logging CFdcProxy 0x%08x:", this );
 	const TUint count = iDeviceIds.Count();
-	LOGTEXT2(_L8("\t\tiDeviceIds.Count() = %d"), count);
+	OstTrace1( TRACE_DUMP, CFDCPROXY_LOG_DUP1, "iDeviceIds.Count() = %d", count );
+
 	for ( TUint i = 0 ; i < count ; ++i )
 		{
-		LOGTEXT3(_L8("\t\t\tiDeviceIds[%d] = %d"), i, iDeviceIds[i]);
+        OstTraceExt2( TRACE_DUMP, CFDCPROXY_LOG_DUP2, "iDeviceIds[%u] = %u", i, iDeviceIds[i] );
 		}
-	LOGTEXT2(_L8("\t\tiPlugin = 0x%08x"), iPlugin);
-	LOGTEXT2(_L8("\t\tiInterface = 0x%08x"), iInterface);
+	OstTrace1( TRACE_DUMP, CFDCPROXY_LOG_DUP3, "iPlugin = 0x%08x", iPlugin );
+	OstTrace1( TRACE_DUMP, CFDCPROXY_LOG_DUP4, "iInterface = 0x%08x", iInterface );
 	}
-#endif // _DEBUG
 
 
 const TDesC8& CFdcProxy::DefaultDataField() const
@@ -384,11 +437,16 @@
 	
 TUint32 CFdcProxy::MfpoTokenForInterface(TUint8 aInterface)
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry0( CFDCPROXY_MFPOTOKENFORINTERFACE_ENTRY );
 
 	// This function must only be called from an implementation of
 	// Mfi1NewInterface.
-	ASSERT_ALWAYS(iInMfi1NewFunction);
+	if(!iInMfi1NewFunction)
+	    {
+        OstTrace0( TRACE_FATAL, CFDCPROXY_MFPOTOKENFORINTERFACE, "Empty iInMfi1NewFunction" );
+        User::Panic(KPanicCategory,__LINE__);
+	    }
+
 	// Support our check that the FDC claims the 0th interface.
 	if ( aInterface == i0thInterface )
 		{
@@ -401,8 +459,8 @@
 
 const RArray<TUint>& CFdcProxy::MfpoGetSupportedLanguagesL(TUint aDeviceId)
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CFDCPROXY_MFPOGETSUPPORTEDLANGUAGESL_ENTRY );
+	
 	CheckDeviceIdL(aDeviceId);
 
 	return iFdf.GetSupportedLanguagesL(aDeviceId);
@@ -411,60 +469,61 @@
 
 TInt CFdcProxy::MfpoGetManufacturerStringDescriptor(TUint aDeviceId, TUint aLangId, TName& aString)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CFDCPROXY_MFPOGETMANUFACTURERSTRINGDESCRIPTOR_ENTRY );
 
 	TRAPD(err,
 		CheckDeviceIdL(aDeviceId);
 		iFdf.GetManufacturerStringDescriptorL(aDeviceId, aLangId, aString)
 		);
 
-#ifdef __FLOG_ACTIVE
 	if ( !err )
 		{
-		LOGTEXT2(_L("\taString = \"%S\""), &aString);
-		}
-#endif
-	LOGTEXT2(_L8("\terr = %d"), err);
+        OstTraceExt1( TRACE_NORMAL, CFDCPROXY_MFPOGETMANUFACTURERSTRINGDESCRIPTOR, "aString = \"%S\"", aString );
+ 		}
+
+	OstTrace1( TRACE_NORMAL, CFDCPROXY_MFPOGETMANUFACTURERSTRINGDESCRIPTOR_DUP1, "err = %d", err );
+	
+	OstTraceFunctionExit0( CFDCPROXY_MFPOGETMANUFACTURERSTRINGDESCRIPTOR_EXIT );
 	return err;
 	}
 
 
 TInt CFdcProxy::MfpoGetProductStringDescriptor(TUint aDeviceId, TUint aLangId, TName& aString)
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CFDCPROXY_MFPOGETPRODUCTSTRINGDESCRIPTOR_ENTRY );
+	
 	TRAPD(err,
 		CheckDeviceIdL(aDeviceId);
 		iFdf.GetProductStringDescriptorL(aDeviceId, aLangId, aString)
 		);
 
-#ifdef __FLOG_ACTIVE
 	if ( !err )
 		{
-		LOGTEXT2(_L("\taString = \"%S\""), &aString);
+		OstTraceExt1( TRACE_NORMAL, CFDCPROXY_MFPOGETPRODUCTSTRINGDESCRIPTOR, "aString = \"%S\"", aString );
 		}
-#endif
-	LOGTEXT2(_L8("\terr = %d"), err);
+
+	OstTrace1( TRACE_NORMAL, CFDCPROXY_MFPOGETPRODUCTSTRINGDESCRIPTOR_DUP1, "err = %d", err );
+	OstTraceFunctionExit0( CFDCPROXY_MFPOGETPRODUCTSTRINGDESCRIPTOR_EXIT );
 	return err;
 	}
 
 
 TInt CFdcProxy::MfpoGetSerialNumberStringDescriptor(TUint aDeviceId, TUint aLangId, TName& aString)
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry0( CFDCPROXY_MFPOGETSERIALNUMBERSTRINGDESCRIPTOR_ENTRY );
 
 	TRAPD(err,
 		CheckDeviceIdL(aDeviceId);
 		iFdf.GetSerialNumberStringDescriptorL(aDeviceId, aLangId, aString)
 		);
 
-#ifdef __FLOG_ACTIVE
 	if ( !err )
 		{
-		LOGTEXT2(_L("\taString = \"%S\""), &aString);
-		}
-#endif
-	LOGTEXT2(_L8("\terr = %d"), err);
+        OstTraceExt1( TRACE_NORMAL, CFDCPROXY_MFPOGETSERIALNUMBERSTRINGDESCRIPTOR, "aString = \"%S\"", aString );
+ 		}
+
+	OstTrace1( TRACE_NORMAL, CFDCPROXY_MFPOGETSERIALNUMBERSTRINGDESCRIPTOR_DUP1, "err = %d", err );
+	OstTraceFunctionExit0( CFDCPROXY_MFPOGETSERIALNUMBERSTRINGDESCRIPTOR_EXIT );
 	return err;
 	}
 
@@ -475,9 +534,9 @@
 */
 void CFdcProxy::CheckDeviceIdL(TUint aDeviceId) const
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8("\taDeviceId = %d"), aDeviceId);
-
+	OstTraceFunctionEntry0( CFDCPROXY_CHECKDEVICEIDL_ENTRY );
+	OstTrace1( TRACE_NORMAL, CFDCPROXY_CHECKDEVICEIDL, "aDeviceId = %d", aDeviceId );
+	
 	TBool found = EFalse;
 	const TUint count = iDeviceIds.Count();
 	for ( TUint i = 0 ; i < count ; ++i )
@@ -490,8 +549,10 @@
 		}
 	if ( !found )
 		{
-		LEAVEL(KErrNotFound);
+        OstTrace1( TRACE_NORMAL, CFDCPROXY_CHECKDEVICEIDL_DUP1, "DeviceId=%d not found", aDeviceId);
+        User::Leave(KErrNotFound);
 		}
+	OstTraceFunctionExit0( CFDCPROXY_CHECKDEVICEIDL_EXIT );
 	}
 
 
--- a/usbmgmt/usbmgr/host/fdf/production/server/src/fdf.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/server/src/fdf.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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,15 +25,16 @@
 #include "utils.h"
 #include <usbhost/internal/fdcplugin.hrh>
 #include "eventqueue.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "fdfTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "fdf      ");
-#endif
 
 _LIT(KDriverUsbhubLddFileName,"usbhubdriver");
 _LIT(KDriverUsbdiLddFileName,"usbdi");
 
-PANICCATEGORY("fdf");
+_LIT(KPanicCategory, "fdf");
 
 const TUint KVendorSpecificDeviceClassValue = 0xFF;
 const TUint KVendorSpecificInterfaceClassValue = 0xFF;
@@ -42,24 +43,26 @@
 // Factory function for TInterfaceInfo objects.
 CFdf::TInterfaceInfo* CFdf::TInterfaceInfo::NewL(RPointerArray<CFdf::TInterfaceInfo>& aInterfaces)
 	{
-	LOG_STATIC_FUNC_ENTRY
+    OstTraceFunctionEntry0( CFDF_TINTERFACEINFO_NEWL_ENTRY );
 
 	TInterfaceInfo* self = new(ELeave) TInterfaceInfo;
 	CleanupStack::PushL(self);
 	aInterfaces.AppendL(self);
 	CLEANUPSTACK_POP1(self);
+	OstTraceFunctionExit0( CFDF_TINTERFACEINFO_NEWL_EXIT );
 	return self;
 	}
 
 
 CFdf* CFdf::NewL()
 	{
-	LOG_STATIC_FUNC_ENTRY
+    OstTraceFunctionEntry0( CFDF_NEWL_ENTRY );
 
 	CFdf* self = new(ELeave) CFdf;
 	CleanupStack::PushL(self);
 	self->ConstructL();
 	CLEANUPSTACK_POP1(self);
+	OstTraceFunctionExit0( CFDF_NEWL_EXIT );
 	return self;
 	}
 
@@ -67,26 +70,30 @@
 :	iDevices(_FOFF(CDeviceProxy, iLink)),
 	iFunctionDrivers(_FOFF(CFdcProxy, iLink))
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry0( CFDF_CFDF_CONS_ENTRY );
 	}
 
 void CFdf::ConstructL()
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CFDF_CONSTRUCTL_ENTRY );
+	
 #ifndef __OVER_DUMMYUSBDI__
 	// If we're using the DummyUSBDI we don't need the real USBDI.
 	TInt err = User::LoadLogicalDevice(KDriverUsbhubLddFileName);
 	if ( err != KErrAlreadyExists )
 		{
-		LEAVEIFERRORL(err);
+        LEAVEIFERRORL(err,OstTrace1( TRACE_NORMAL, CFDF_CONSTRUCTL, "Error when loading KDriverUsbhubLddFileName OVER DUMMYUSBDI; err=%d", err ););
 		}
 #endif // __OVER_DUMMYUSBDI__
 
-	LEAVEIFERRORL(iHubDriver.Open());
+	TInt errDr=iHubDriver.Open();
+	LEAVEIFERRORL(errDr,OstTrace1( TRACE_NORMAL, CFDF_CONSTRUCTL_DUP1, "Error when open iHubDriver; errDr=%d", errDr ););
 
 #ifdef __OVER_DUMMYUSBDI__
-	LEAVEIFERRORL(iHubDriver.StartHost());
+	//LEAVEIFERRORL(iHubDriver.StartHost());
+	TInt errHo=iHubDriver.StartHost();
+	LEAVEIFERRORL(errHo,OstTrace1( TRACE_NORMAL, CFDF_CONSTRUCTL_DUP2, "Fail in iHubDriver.StartHost in dummy; errHo=%d", errHo ););
+
 #endif
 
 	iActiveWaitForBusEvent = CActiveWaitForBusEvent::NewL(iHubDriver, iBusEvent, *this);
@@ -98,24 +105,27 @@
 	iActiveWaitForEComEvent->Wait();
 	
 	iEventQueue = CEventQueue::NewL(*this);
+	OstTraceFunctionExit0( CFDF_CONSTRUCTL_EXIT );
 	}
 
 void CFdf::CreateFunctionDriverProxiesL()
 	{
-
-	LOG_FUNC
+    OstTraceFunctionEntry0( CFDF_CREATEFUNCTIONDRIVERPROXIESL_ENTRY );
 	REComSession::ListImplementationsL(TUid::Uid(KFdcEcomInterfaceUid), iImplInfoArray);
 	const TUint count = iImplInfoArray.Count();
-	LOGTEXT2(_L8("\tiImplInfoArray.Count() upon FDF creation  = %d"), count);
-#ifdef __FLOG_ACTIVE
+	OstTrace1( TRACE_NORMAL, CFDF_CREATEFUNCTIONDRIVERPROXIESL, "\tiImplInfoArray.Count() upon FDF creation  = %d", count );
+#ifdef _DEBUG
 	if ( count == 0 )
 		{
-		LOGTEXT(_L8("\tTHERE ARE NO FUNCTION DRIVERS PRESENT IN THE SYSTEM"));
-		}
+        OstTrace0( TRACE_NORMAL, CFDF_CREATEFUNCTIONDRIVERPROXIESL_DUP1, "\tTHERE ARE NO FUNCTION DRIVERS PRESENT IN THE SYSTEM" );
+        }
 	else
 		{
-		for (TInt kk = 0; kk < count; ++kk)
-			LOGTEXT3(_L8("\t\tFDC implementation Index:%d UID: 0x%08x"), kk, iImplInfoArray[kk]->ImplementationUid());				
+		for (TInt32 kk = 0; kk < count; ++kk)
+			OstTraceExt2( TRACE_NORMAL, CFDF_CREATEFUNCTIONDRIVERPROXIESL_DUP2,
+			        "FDC implementation UID: 0x%08x Index:%d ", 
+			        iImplInfoArray[kk]->ImplementationUid().iUid, kk);
+			
 		}
 #endif
 
@@ -131,11 +141,12 @@
    		else
    			iFunctionDrivers.AddLast(*proxy);
    		}
+	OstTraceFunctionExit0( CFDF_CREATEFUNCTIONDRIVERPROXIESL_EXIT );
 	}
 
 CFdf::~CFdf()
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry0( CFDF_CFDF_DES_ENTRY );
 
 	// Mimic the detachment of each attached device.
 	TSglQueIter<CDeviceProxy> deviceIter(iDevices);
@@ -144,7 +155,7 @@
 	while ( ( device = deviceIter++ ) != NULL )
 		{
 		const TUint deviceId = device->DeviceId();
-		LOGTEXT2(_L8("\tmimicking detachment of device with id %d"), device);
+		OstTrace1( TRACE_NORMAL, CFDF_CFDF, "mimicking detachment of device with id %d", device );
 		TellFdcsOfDeviceDetachment(deviceId);
 		iDevices.Remove(*device);
 		delete device;
@@ -174,10 +185,9 @@
 #ifndef __OVER_DUMMYUSBDI__
 	//If we're using the DummyUSBDI the real USBDI isn't loaded.
 	TInt err = User::FreeLogicalDevice(KDriverUsbhubLddFileName);
-	LOGTEXT2(_L8("\tFreeLogicalDevice( usbhubdriver ) returned %d"), err);
-	
+	OstTrace1( TRACE_NORMAL, CFDF_CFDF_DUP1, "FreeLogicalDevice( usbhubdriver ) returned %d", err );
 	err = User::FreeLogicalDevice(KDriverUsbdiLddFileName);
-	LOGTEXT2(_L8("\tFreeLogicalDevice( usbdi ) returned %d"), err);
+	OstTrace1( TRACE_NORMAL, CFDF_CFDF_DUP2, "FreeLogicalDevice( usbdi ) returned %d", err );
 #endif // __OVER_DUMMYUSBDI__
 	
 	delete iEventQueue;
@@ -185,31 +195,33 @@
 	// This is a worthwhile check to do at this point. If we ever don't clean
 	// up iInterfaces at the *right* time, then this will be easier to debug
 	// than a memory leak.
-	ASSERT_DEBUG(iInterfaces.Count() == 0);
+	if(!(iInterfaces.Count() == 0))
+	    {
+        OstTrace1( TRACE_FATAL, CFDF_CFDF_DUP3, "Memory leak from interface;Interface remains %d", iInterfaces.Count() );
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+	    }
 
 	iImplInfoArray.ResetAndDestroy();
 	REComSession::FinalClose();
+	OstTraceFunctionExit0( CFDF_CFDF_DES_EXIT );
 	}
 
 void CFdf::EnableDriverLoading()
 	{
-	LOG_FUNC
-
+    OstTraceFunctionEntry0( CFDF_ENABLEDRIVERLOADING_ENTRY );
 	iDriverLoadingEnabled = ETrue;
 	}
 
 void CFdf::DisableDriverLoading()
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CFDF_DISABLEDRIVERLOADING_ENTRY );
 	iDriverLoadingEnabled = EFalse;
 	}
 
 void CFdf::SetSession(CFdfSession* aSession)
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8("\taSession = 0x%08x"), aSession);
-
+	OstTraceFunctionEntry0( CFDF_SETSESSION_ENTRY );
+	OstTrace1( TRACE_NORMAL, CFDF_SETSESSION, "aSession = 0x%08x", aSession );
 	iSession = aSession;
 	}
 
@@ -220,17 +232,27 @@
 
 TBool CFdf::GetDeviceEvent(TDeviceEvent& aEvent)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CFDF_GETDEVICEEVENT_ENTRY );
+	if(!iEventQueue)
+	    {
+        OstTrace0( TRACE_FATAL, CFDF_GETDEVICEEVENT, "iEventQueue is empty" );
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+	    }
 
-	ASSERT_DEBUG(iEventQueue);
 	return iEventQueue->GetDeviceEvent(aEvent);
 	}
 
 TBool CFdf::GetDevmonEvent(TInt& aEvent)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CFDF_GETDEVMONEVENT_ENTRY );
+	
+	if(!iEventQueue)
+	    {
+        OstTrace0( TRACE_FATAL, CFDF_GETDEVMONEVENT, "iEventQueue is empty" );
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+	    }
 
-	ASSERT_DEBUG(iEventQueue);
+	
 	return iEventQueue->GetDevmonEvent(aEvent);
 	}
 	
@@ -246,40 +268,39 @@
 
 void CFdf::HandleEComEventReceivedL()
 	{
-	LOG_FUNC
-	
+	OstTraceFunctionEntry0( CFDF_HANDLEECOMEVENTRECEIVEDL_ENTRY );
+
 	// There is no way to filter ecom notification to only receive ones we are interested in, also there is no way
 	// to query ecom as to what has changed. Hence there is no option but to call ListImplementations().
 	iImplInfoArray.ResetAndDestroy();		
 			
 	REComSession::ListImplementationsL(TUid::Uid(KFdcEcomInterfaceUid), iImplInfoArray);	
 	TUint implementationsCount = iImplInfoArray.Count();
-	LOGTEXT2(_L8("\tiImplInfoArray.Count() after ECom notification= %d"), implementationsCount);
+	OstTrace1( TRACE_NORMAL, CFDF_HANDLEECOMEVENTRECEIVEDL, "iImplInfoArray.Count() after ECom notification= %d", implementationsCount );
 	
-#ifdef __FLOG_ACTIVE
 	if ( implementationsCount == 0 )
 		{
-		LOGTEXT(_L8("\tTHERE ARE NO FUNCTION DRIVERS PRESENT IN THE SYSTEM"));
-		}
+        OstTrace0( TRACE_NORMAL, CFDF_HANDLEECOMEVENTRECEIVEDL_DUP1, "THERE ARE NO FUNCTION DRIVERS PRESENT IN THE SYSTEM" );
+ 		}
 		
 	TSglQueIter<CFdcProxy> proxiesIterDebug(iFunctionDrivers);
 	CFdcProxy* fdcDebug = NULL;		
 	while ( ( fdcDebug = proxiesIterDebug++ ) != NULL )
 		{
 		TUid fdcUid = fdcDebug->ImplUid();
-		LOGTEXT2(_L8("\t\tOld FDC Proxy implementation UID: 0x%08x"), fdcUid.iUid);
+		OstTrace1( TRACE_NORMAL, CFDF_HANDLEECOMEVENTRECEIVEDL_DUP2, "Old FDC Proxy implementation UID: 0x%08x", fdcUid.iUid );
 		TInt fdcVersion = fdcDebug->Version();
-		LOGTEXT2(_L8("\t\tFDC Proxy version UID: %d"), fdcVersion);
-		}		
-	LOGTEXT(_L8("\t\t------------------------------------------------------------------"));
+		OstTrace1( TRACE_NORMAL, CFDF_HANDLEECOMEVENTRECEIVEDL_DUP3, "FDC Proxy version UID: %d", fdcVersion );
+		}
+	OstTrace0( TRACE_NORMAL, CFDF_HANDLEECOMEVENTRECEIVEDL_DUP4, "------------------------------------------------------------------" );
+
 	for (TInt kk = 0; kk < implementationsCount; ++kk)
 		{
 		TUid fdcUid2 = iImplInfoArray[kk]->ImplementationUid();
-		LOGTEXT2(_L8("\t\tNew FDC Proxy implementation UID: 0x%08x"), fdcUid2.iUid);
+		OstTrace1( TRACE_NORMAL, CFDF_HANDLEECOMEVENTRECEIVEDL_DUP5, "New FDC Proxy implementation UID: 0x%08x", fdcUid2.iUid );
 		TInt fdcVersion2 = iImplInfoArray[kk]->Version();
-		LOGTEXT2(_L8("\t\tFDC Proxy version UID: %d"), fdcVersion2);					
+		OstTrace1( TRACE_NORMAL, CFDF_HANDLEECOMEVENTRECEIVEDL_DUP6, "FDC Proxy version UID: %d", fdcVersion2 );
 		}
-#endif
 
 	// See if any relevant FDCs (or upgrades) have been installed or uninstalled:	
 	
@@ -379,15 +400,16 @@
 				iFunctionDrivers.AddLast(*proxy);			
 			}
 		}
+	OstTraceFunctionExit0( CFDF_HANDLEECOMEVENTRECEIVEDL_EXIT );
 	}
 
 // A bus event has occurred.
 void CFdf::MbeoBusEvent()
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8("\tiBusEvent.iEventType = %d"), iBusEvent.iEventType);
-	LOGTEXT2(_L8("\tiBusEvent.iError = %d"), iBusEvent.iError);
-	LOGTEXT2(_L8("\tiBusEvent.iDeviceHandle = %d"), iBusEvent.iDeviceHandle);
+    OstTraceFunctionEntry0( CFDF_MBEOBUSEVENT_ENTRY );
+    OstTrace1( TRACE_NORMAL, CFDF_MBEOBUSEVENT, "iBusEvent.iEventType = %d", iBusEvent.iEventType );
+    OstTrace1( TRACE_NORMAL, CFDF_MBEOBUSEVENT_DUP1, "iBusEvent.iError = %d", iBusEvent.iError );
+    OstTrace1( TRACE_NORMAL, CFDF_MBEOBUSEVENT_DUP2, "iBusEvent.iDeviceHandle = %d", iBusEvent.iDeviceHandle );
 
 	switch ( iBusEvent.iEventType )
 		{
@@ -400,7 +422,11 @@
 			else
 				{
 				// It was an attachment failure. Simply tell the event queue.
-				ASSERT_DEBUG(iEventQueue);
+				if(!iEventQueue)
+				    {
+                    OstTrace0( TRACE_FATAL, CFDF_MBEOBUSEVENT_DUP3, "Empty iEventQueue" );
+                    __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+				    }
 				iEventQueue->AttachmentFailure(iBusEvent.iError);
 				}
 			break;
@@ -410,7 +436,12 @@
 			// pseudo-detached due to an overcurrent condition (for instance) then
 			// the overcurrent condition is indicated through the devmon API (i.e.
 			// EDevMonEvent) and the detachment is still 'KErrNone'.
-			ASSERT_DEBUG(iBusEvent.iError == KErrNone);
+			if(!(iBusEvent.iError == KErrNone))
+			    {
+                OstTrace0( TRACE_NORMAL, CFDF_MBEOBUSEVENT_DUP4, "iBusEvent error" );
+                __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+			    }
+
 			HandleDeviceDetachment(iBusEvent.iDeviceHandle);
 			break;
 	
@@ -427,6 +458,7 @@
 	// TBusEvent from the previous completion. (Otherwise it might get
 	// overwritten.)
 	iActiveWaitForBusEvent->Wait();
+	OstTraceFunctionExit0( CFDF_MBEOBUSEVENT_EXIT );
 	}
 
 // This is the central handler for device attachment.
@@ -435,16 +467,21 @@
 // The second phase is driver loading.
 void CFdf::HandleDeviceAttachment(TUint aDeviceId)
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry0( CFDF_HANDLEDEVICEATTACHMENT_ENTRY );
 	// This is filled in by HandleDeviceAttachmentL on success.
 	CDeviceProxy* device;
 	TRAPD(err, HandleDeviceAttachmentL(aDeviceId, device));
 	if ( err )
 		{
-		LOGTEXT2(_L8("\terr = %d"), err);
+        OstTrace1( TRACE_NORMAL, CFDF_HANDLEDEVICEATTACHMENT, "err = %d", err );
 		// There was an attachment failure, so we just increment the count of
 		// attachment failures.
-		ASSERT_DEBUG(iEventQueue);
+		if(!iEventQueue)
+		    {
+            OstTrace0( TRACE_FATAL, CFDF_HANDLEDEVICEATTACHMENT_DUP1, "Empty iEventQueue" );
+            __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+		    }
+
 		iEventQueue->AttachmentFailure(err);
 		// If we failed the attachment phase, we can't try to load drivers for
 		// the device.
@@ -456,7 +493,12 @@
 		// device proxy created by HandleDeviceAttachmentL to the event queue.
 		// This event object is always populated with the correct status and
 		// error.
-		ASSERT_DEBUG(device);
+		if(!device)
+		    {
+            OstTrace0( TRACE_FATAL, CFDF_HANDLEDEVICEATTACHMENT_DUP2, "Empty device" );
+            __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+		    }
+
 		DoDriverLoading(*device);
 		}
 
@@ -465,62 +507,90 @@
 	// HandleDeviceAttachmentL.
 	iCurrentDevice = NULL;
 	iInterfaces.ResetAndDestroy();
+	OstTraceFunctionExit0( CFDF_HANDLEDEVICEATTACHMENT_EXIT );
 	}
 
 // This does the 'device attachment' phase of the new device attachment only.
 void CFdf::HandleDeviceAttachmentL(TUint aDeviceId, CDeviceProxy*& aDevice)
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CFDF_HANDLEDEVICEATTACHMENTL_ENTRY );
 	// Create the device proxy
 	aDevice = CDeviceProxy::NewL(iHubDriver, aDeviceId);
 	CleanupStack::PushL(aDevice);
 	iCurrentDevice = aDevice;
 	// Get necessary descriptors (for this phase)
-	LEAVEIFERRORL(aDevice->GetDeviceDescriptor(iDD));
-	LOGTEXT2(_L8("\tiDD.USBBcd = 0x%04x"), iDD.USBBcd());
-	LOGTEXT2(_L8("\tiDD.DeviceClass = 0x%02x"), iDD.DeviceClass());
-	LOGTEXT2(_L8("\tiDD.DeviceSubClass = 0x%02x"), iDD.DeviceSubClass());
-	LOGTEXT2(_L8("\tiDD.DeviceProtocol = 0x%02x"), iDD.DeviceProtocol());
-	LOGTEXT2(_L8("\tiDD.MaxPacketSize0 = %d"), iDD.MaxPacketSize0());
-	LOGTEXT2(_L8("\tiDD.VendorId = 0x%04x"), iDD.VendorId());
-	LOGTEXT2(_L8("\tiDD.ProductId = 0x%04x"), iDD.ProductId());
-	LOGTEXT2(_L8("\tiDD.DeviceBcd = 0x%04x"), iDD.DeviceBcd());
-	LOGTEXT2(_L8("\tiDD.ManufacturerIndex = %d"), iDD.ManufacturerIndex());
-	LOGTEXT2(_L8("\tiDD.ProductIndex = %d"), iDD.ProductIndex());
-	LOGTEXT2(_L8("\tiDD.SerialNumberIndex = %d"), iDD.SerialNumberIndex());
-	LOGTEXT2(_L8("\tiDD.NumConfigurations = %d"), iDD.NumConfigurations());
-	LEAVEIFERRORL(aDevice->GetConfigurationDescriptor(iCD));
-	LOGTEXT2(_L8("\tiCD.TotalLength = %d"), iCD.TotalLength());
-	LOGTEXT2(_L8("\tiCD.NumInterfaces = %d"), iCD.NumInterfaces());
-	LOGTEXT2(_L8("\tiCD.ConfigurationValue = %d"), iCD.ConfigurationValue());
-	LOGTEXT2(_L8("\tiCD.ConfigurationIndex = %d"), iCD.ConfigurationIndex());
-	LOGTEXT2(_L8("\tiCD.Attributes = %d"), iCD.Attributes());
-	LOGTEXT2(_L8("\tiCD.MaxPower = %d"), iCD.MaxPower());
+	TInt err=aDevice->GetDeviceDescriptor(iDD);
+	if (err<0)
+	    {
+        OstTrace1( TRACE_NORMAL, CFDF_HANDLEDEVICEATTACHMENTL, "GetDeviceDescriptor error=%d", err );
+        User::Leave(err);
+	    }
 
+	OstTrace1( TRACE_DUMP, CFDF_HANDLEDEVICEATTACHMENTL_DUP1, "iDD.USBBcd = 0x%04x", iDD.USBBcd() );
+	OstTrace1( TRACE_DUMP, CFDF_HANDLEDEVICEATTACHMENTL_DUP2, "iDD.DeviceClass = 0x%02x", iDD.DeviceClass() );
+	OstTrace1( TRACE_DUMP, CFDF_HANDLEDEVICEATTACHMENTL_DUP3, "iDD.DeviceSubClass = 0x%02x", iDD.DeviceSubClass() );
+	OstTrace1( TRACE_DUMP, CFDF_HANDLEDEVICEATTACHMENTL_DUP4, "iDD.DeviceProtocol = 0x%02x", iDD.DeviceProtocol() );
+	OstTrace1( TRACE_DUMP, CFDF_HANDLEDEVICEATTACHMENTL_DUP5, "iDD.MaxPacketSize0 = %d", iDD.MaxPacketSize0() );
+	OstTrace1( TRACE_DUMP, CFDF_HANDLEDEVICEATTACHMENTL_DUP6, "iDD.VendorId = 0x%04x", iDD.VendorId() );
+	OstTrace1( TRACE_DUMP, CFDF_HANDLEDEVICEATTACHMENTL_DUP7, "iDD.ProductId = 0x%04x", iDD.ProductId() );
+	OstTrace1( TRACE_DUMP, CFDF_HANDLEDEVICEATTACHMENTL_DUP8, "iDD.DeviceBcd = 0x%04x", iDD.DeviceBcd() );
+	OstTrace1( TRACE_DUMP, CFDF_HANDLEDEVICEATTACHMENTL_DUP9, "iDD.ManufacturerIndex = %d", iDD.ManufacturerIndex() );
+	OstTrace1( TRACE_DUMP, CFDF_HANDLEDEVICEATTACHMENTL_DUP10, "iDD.ProductIndex = %d", iDD.ProductIndex() );
+	OstTrace1( TRACE_DUMP, CFDF_HANDLEDEVICEATTACHMENTL_DUP11, "iDD.SerialNumberIndex = %d", iDD.SerialNumberIndex() );
+	OstTrace1( TRACE_DUMP, CFDF_HANDLEDEVICEATTACHMENTL_DUP12, "iDD.NumConfigurations = %d", iDD.NumConfigurations() );
+	err=aDevice->GetConfigurationDescriptor(iCD);
+	if(err<0)
+	    {
+        OstTrace1( TRACE_NORMAL, CFDF_HANDLEDEVICEATTACHMENTL_DUP13, "GetConfigurationDescriptor error=%d", err);
+	    User::Leave(err);
+	    }
+
+	OstTrace1( TRACE_DUMP, CFDF_HANDLEDEVICEATTACHMENTL_DUP14, "iCD.TotalLength = %d", iCD.TotalLength() );
+	OstTrace1( TRACE_DUMP, CFDF_HANDLEDEVICEATTACHMENTL_DUP15, "iCD.NumInterfaces = %d", iCD.NumInterfaces() );
+	OstTrace1( TRACE_DUMP, CFDF_HANDLEDEVICEATTACHMENTL_DUP16, "iCD.ConfigurationValue = %d", iCD.ConfigurationValue() );
+	OstTrace1( TRACE_DUMP, CFDF_HANDLEDEVICEATTACHMENTL_DUP17, "iCD.ConfigurationIndex = %d", iCD.ConfigurationIndex() );
+	OstTrace1( TRACE_DUMP, CFDF_HANDLEDEVICEATTACHMENTL_DUP18, "iCD.Attributes = %d", iCD.Attributes() );
+	OstTrace1( TRACE_DUMP, CFDF_HANDLEDEVICEATTACHMENTL_DUP19, "iCD.MaxPower = %d", iCD.MaxPower() );
+	        
 	const TUint8 numberOfInterfaces = iCD.NumInterfaces();
-	LOGTEXT2(_L8("\tnumberOfInterfaces (field in config descriptor) = %d)"), numberOfInterfaces);
+	OstTrace1( TRACE_DUMP, CFDF_HANDLEDEVICEATTACHMENTL_DUP20, "numberOfInterfaces (field in config descriptor) = %d)", numberOfInterfaces );
 	if ( numberOfInterfaces == 0 )
 		{
-		LEAVEL(KErrUsbConfigurationHasNoInterfaces);
+	    OstTrace0( TRACE_NORMAL, CFDF_HANDLEDEVICEATTACHMENTL_DUP21, "Error: Usb Configuration Has No Interfaces");
+	    User::Leave(KErrUsbConfigurationHasNoInterfaces);
 		}
 
 	// Walk the configuration bundle. Collect information on each interface
 	// (its number, class, subclass and protocol). This populates iInterfaces.
-	ASSERT_DEBUG(iInterfaces.Count() == 0);
-	ASSERT_ALWAYS(iCurrentDevice);
+	if(!(iInterfaces.Count() == 0))
+	    {
+        OstTrace0( TRACE_FATAL, CFDF_HANDLEDEVICEATTACHMENTL_DUP22, "Error: Usb Configuration Has No Interfaces");
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+	    }
+
+	if(!iCurrentDevice)
+	    {
+        OstTrace0( TRACE_FATAL, CFDF_HANDLEDEVICEATTACHMENTL_DUP23, "Empty iCurrentDevice");
+        User::Panic(KPanicCategory,__LINE__);
+	    }
+
 	ParseL(iCD);
 
 	// Log iInterfaces.
 	const TUint interfaceCount = iInterfaces.Count();
-	LOGTEXT2(_L8("\tinterfaceCount (parsed from bundle) = %d"), interfaceCount);
-#ifdef __FLOG_ACTIVE
-	LOGTEXT(_L8("\tLogging iInterfaces:"));
+	OstTrace1( TRACE_DUMP, CFDF_HANDLEDEVICEATTACHMENTL_DUP24, "interfaceCount (parsed from bundle) = %d", interfaceCount );
+#ifdef _DEBUG
+	OstTrace0( TRACE_DUMP, CFDF_HANDLEDEVICEATTACHMENTL_DUP25, "Logging iInterfaces:");
 	for ( TUint ii = 0 ; ii < interfaceCount ; ++ii )
 		{
 		const TInterfaceInfo* ifInfo = iInterfaces[ii];
-		ASSERT_DEBUG(ifInfo);
-		LOGTEXT6(_L8("\t\tiInterfaces[%d]: number %d, interface class 0x%02x subclass 0x%02x protocol 0x%02x"),
+		if(!ifInfo)
+		    {
+            OstTrace0( TRACE_FATAL, CFDF_HANDLEDEVICEATTACHMENTL_DUP26, "Empty ifInfo");
+            __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+		    }
+		
+		OstTraceExt5(TRACE_DUMP, CFDF_HANDLEDEVICEATTACHMENTL_DUP27, "\t\tiInterfaces[%d]: number %d, interface class 0x%02x subclass 0x%02x protocol 0x%02x",
 			ii,
 			ifInfo->iNumber,
 			ifInfo->iClass,
@@ -529,12 +599,13 @@
 			);
 		}
 #endif
-
+	
 	// Check that the config's NumInterfaces is the same as the actual number
 	// of interface descriptors we found. We rely on this later on.
 	if ( numberOfInterfaces != interfaceCount )
 		{
-		LEAVEL(KErrUsbInterfaceCountMismatch);
+        OstTrace0( TRACE_NORMAL, CFDF_HANDLEDEVICEATTACHMENTL_DUP28, "KErrUsbInterfaceCountMismatch");
+		User::Leave(KErrUsbInterfaceCountMismatch);
 		}
 
 	// Check that each interface number in iInterfaces is unique.
@@ -543,14 +614,25 @@
 		for ( TUint ii = 0 ; ii < interfaceCount ; ++ii )
 			{
 			const TInterfaceInfo* lhs = iInterfaces[ii];
-			ASSERT_DEBUG(lhs);
+			if(!lhs)
+			    {
+                OstTrace0( TRACE_FATAL, CFDF_HANDLEDEVICEATTACHMENTL_DUP29, "Empty lhs");
+                __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+			    }
+
 			for ( TUint jj = ii+1 ; jj < interfaceCount ; ++jj )
 				{
 				const TInterfaceInfo* rhs = iInterfaces[jj];
-				ASSERT_DEBUG(rhs);
+				if(!rhs)
+				    {
+                    OstTrace0( TRACE_FATAL, CFDF_HANDLEDEVICEATTACHMENTL_DUP30, "Empty rhs");
+                    __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+				    }
+
 				if ( lhs->iNumber == rhs->iNumber )
 					{
-					LEAVEL(KErrUsbDuplicateInterfaceNumbers);
+                    OstTrace1( TRACE_NORMAL, CFDF_HANDLEDEVICEATTACHMENTL_DUP31, "KErrUsbDuplicateInterfaceNumbers; iNumber=%d", lhs->iNumber);
+					User::Leave(KErrUsbDuplicateInterfaceNumbers);
 					}
 				}
 			}
@@ -564,7 +646,7 @@
 		TInt err = User::LoadLogicalDevice(KDriverUsbdiLddFileName);
 		if ( err != KErrAlreadyExists )
 			{
-			LEAVEIFERRORL(err);
+			LEAVEIFERRORL(err,OstTrace1( TRACE_NORMAL, CFDF_HANDLEDEVICEATTACHMENTL_DUP32, "Load Logical Device error; error=%d", err););
 			}
 		}
 #endif // __OVER_DUMMYUSBDI__
@@ -575,19 +657,31 @@
 	iDevices.AddLast(*aDevice);
 	// Also put an event on the event queue.
 	TDeviceEvent* const attachmentEvent = aDevice->GetAttachmentEventObject();
-	ASSERT_DEBUG(attachmentEvent);
+	
+	if(!attachmentEvent)
+	    {
+        OstTrace0( TRACE_FATAL, CFDF_HANDLEDEVICEATTACHMENTL_DUP33, "Empty attachmentEvent");
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+	    }
+
 	attachmentEvent->iInfo.iVid = iDD.VendorId();
 	attachmentEvent->iInfo.iPid = iDD.ProductId();
 	attachmentEvent->iInfo.iError = KErrNone;
-	ASSERT_DEBUG(iEventQueue);
+	if(!iEventQueue)
+	    {
+        OstTrace0( TRACE_FATAL, CFDF_HANDLEDEVICEATTACHMENTL_DUP34, "Empty iEventQueue");
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+	    }
+
 	iEventQueue->AddDeviceEvent(*attachmentEvent);
-	LOGTEXT2(_L8("***USB HOST STACK: SUCCESSFUL ATTACHMENT OF DEVICE (id %d)"), aDeviceId);
+	OstTrace1( TRACE_DUMP, CFDF_HANDLEDEVICEATTACHMENTL_DUP35, "***USB HOST STACK: SUCCESSFUL ATTACHMENT OF DEVICE (id %d)", aDeviceId );
+	
+	OstTraceFunctionExit0( CFDF_HANDLEDEVICEATTACHMENTL_EXIT );
 	}
 
 void CFdf::DoDriverLoading(CDeviceProxy& aDevice)
 	{
-	LOG_FUNC
-
+    OstTraceFunctionEntry0( CFDF_DODRIVERLOADING_ENTRY );
 	// Leaving or returning from DoDriverLoadingL is the trigger to put the
 	// 'driver loading' event object on the event queue. It must already have
 	// been populated correctly (the actual error code it left with doesn't
@@ -595,7 +689,12 @@
 	TRAP_IGNORE(DoDriverLoadingL(aDevice));
 	
 	TDeviceEvent* const driverLoadingEvent = aDevice.GetDriverLoadingEventObject();
-	ASSERT_DEBUG(driverLoadingEvent);
+	if(!driverLoadingEvent)
+	    {
+        OstTrace0( TRACE_FATAL, CFDF_DODRIVERLOADING, "Empty driverLoadingEvent" );
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+	    }
+
 	// The driver loading event object says whether driver loading succeeded
 	// (all interfaces were claimed without error), partly succeeded (not all
 	// interfaces were claimed without error), or failed (no interfaces were
@@ -608,22 +707,29 @@
 		// power-saving reasons and is not critical.
 		(void)aDevice.Suspend();
 		}
-	ASSERT_DEBUG(iEventQueue);
+	if(!iEventQueue)
+	    {
+        OstTrace0( TRACE_FATAL, CFDF_DODRIVERLOADING_DUP1, "Empty iEventQueue" );
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+	    }
+
 	iEventQueue->AddDeviceEvent(*driverLoadingEvent);
+	OstTraceFunctionExit0( CFDF_DODRIVERLOADING_EXIT );
 	}
 
 
 void CFdf::DoDriverLoadingL(CDeviceProxy& aDevice)
 	{
-	LOG_FUNC
-
+    OstTraceFunctionEntry0( CFDF_DODRIVERLOADINGL_ENTRY );
 	// Check whether driver loading is enabled.
 	if ( !iDriverLoadingEnabled )
 		{
 		// Complete driver load failure scenario.
 		aDevice.SetDriverLoadingEventData(EDriverLoadFailure, KErrUsbDriverLoadingDisabled);
-		LEAVEL(KErrGeneral);
-	}
+		
+		OstTrace1( TRACE_NORMAL, CFDF_DODRIVERLOADINGL, "Leave with error %d", KErrGeneral );
+		User::Leave(KErrGeneral);
+		}
 
 
 	// Set this member up so that when the FDC calls TokenForInterface we call
@@ -649,7 +755,8 @@
 	if (aDevice.HasIADFlag() && !functionDriverFound)
 		{
 		aDevice.SetDriverLoadingEventData(EDriverLoadFailure, KErrUsbUnsupportedDevice);
-		LEAVEL(KErrGeneral);		
+		OstTrace0( TRACE_NORMAL, CFDF_DODRIVERLOADINGL_DUP1, "Leave with function Driver not Found" );
+		User::Leave(KErrGeneral);
 		}
 	// If a device FD is found then it is supposed to claim all the interfaces, if it didn't then report
 	// a partial success but don't offer unclaimed interfaces to any other FD.
@@ -667,14 +774,19 @@
 	// Whether all interfaces were taken, some, or none, collectedErr may have
 	// an error in it or KErrNone. We use specific error codes in some cases.			
 	TUint unclaimedInterfaces = UnclaimedInterfaceCount();
-	LOGTEXT2(_L8("\tunclaimedInterfaces = %d"), unclaimedInterfaces);
-	LOGTEXT2(_L8("\tanySuccess = %d"), anySuccess);
-	LOGTEXT2(_L8("\tcollectedErr = %d"), collectedErr);
-	ASSERT_DEBUG(unclaimedInterfaces <= interfaceCount);
+	OstTrace1( TRACE_DUMP, CFDF_DODRIVERLOADINGL_DUP2, "unclaimedInterfaces = %d", unclaimedInterfaces );
+	OstTrace1( TRACE_DUMP, CFDF_DODRIVERLOADINGL_DUP3, "anySuccess = %d", anySuccess );
+	OstTrace1( TRACE_DUMP, CFDF_DODRIVERLOADINGL_DUP4, "collectedErr = %d", collectedErr );
+	if(!(unclaimedInterfaces <= interfaceCount))
+	    {
+        OstTrace0( TRACE_FATAL, CFDF_DODRIVERLOADINGL_DUP5, "interface Count error" );
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+	    }
+
 
 	if(iDeviceDetachedTooEarly)
 		{
-		LOGTEXT(_L8("\tDevice has been detached too early!"));
+        OstTrace0( TRACE_NORMAL, CFDF_DODRIVERLOADINGL_DUP6, "Device has been detached too early!" );
 		iDeviceDetachedTooEarly = EFalse;
 		// the choice of having the status to be EDriverLoadPartialSuccess
 		// was not to clash with trying to suspend the device because
@@ -690,6 +802,7 @@
 		SetFailureStatus(unclaimedInterfaces, interfaceCount, anySuccess, collectedErr, aDevice);
 		}// iDeviceDetachedTooEarly
 
+	OstTraceFunctionExit0( CFDF_DODRIVERLOADINGL_EXIT );
 	}
 
 // Recursive function, originally called with the configuration descriptor.
@@ -697,26 +810,26 @@
 // bundle.
 void CFdf::ParseL(TUsbGenericDescriptor& aDesc)
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8("\t&aDesc = 0x%08x"), &aDesc);
-	LOGTEXT2(_L8("\taDesc.ibDescriptorType = %d"), aDesc.ibDescriptorType);
-	LOGTEXT2(_L8("\taDesc.iFirstChild = 0x%08x"), aDesc.iFirstChild);
-	LOGTEXT2(_L8("\taDesc.iNextPeer = 0x%08x"), aDesc.iNextPeer);
-
-	if ( aDesc.ibDescriptorType == EInterface )
+    OstTraceFunctionEntry0( CFDF_PARSEL_ENTRY );
+    OstTrace1( TRACE_DUMP, CFDF_PARSEL, "&aDesc = 0x%08x", &aDesc );
+    OstTrace1( TRACE_DUMP, CFDF_PARSEL_DUP1, "aDesc.ibDescriptorType = %d", aDesc.ibDescriptorType );
+    OstTrace1( TRACE_DUMP, CFDF_PARSEL_DUP2, "aDesc.iFirstChild = 0x%08x", aDesc.iFirstChild );
+    OstTrace1( TRACE_DUMP, CFDF_PARSEL_DUP3, "aDesc.iNextPeer = 0x%08x", aDesc.iNextPeer );
+    
+    if ( aDesc.ibDescriptorType == EInterface )
 		{
 		// Add interface information to collection, but only if it's alternate
 		// setting 0.
 		const TUsbInterfaceDescriptor& ifDesc = static_cast<TUsbInterfaceDescriptor&>(aDesc);
 		if ( ifDesc.AlternateSetting() == 0 ) // hard-coded '0' means the default (initial configuration) setting
 			{
-			LOGTEXT2(_L8("\tifDesc.InterfaceNumber = %d"), ifDesc.InterfaceNumber());
-			LOGTEXT2(_L8("\tifDesc.NumEndpoints = %d"), ifDesc.NumEndpoints());
-			LOGTEXT2(_L8("\tifDesc.InterfaceClass = 0x%02x"), ifDesc.InterfaceClass());
-			LOGTEXT2(_L8("\tifDesc.InterfaceSubClass = 0x%02x"), ifDesc.InterfaceSubClass());
-			LOGTEXT2(_L8("\tifDesc.InterfaceProtocol = 0x%02x"), ifDesc.InterfaceProtocol());
-			LOGTEXT2(_L8("\tifDesc.Interface = %d"), ifDesc.Interface());
-
+            OstTrace1( TRACE_DUMP, CFDF_PARSEL_DUP4, "ifDesc.InterfaceNumber = %d", ifDesc.InterfaceNumber() );
+            OstTrace1( TRACE_DUMP, CFDF_PARSEL_DUP5, "ifDesc.NumEndpoints = %d", ifDesc.NumEndpoints() );
+            OstTrace1( TRACE_DUMP, CFDF_PARSEL_DUP6, "ifDesc.InterfaceClass = 0x%02x", ifDesc.InterfaceClass() );
+            OstTrace1( TRACE_DUMP, CFDF_PARSEL_DUP7, "ifDesc.InterfaceSubClass = 0x%02x", ifDesc.InterfaceSubClass() );
+            OstTrace1( TRACE_DUMP, CFDF_PARSEL_DUP8, "ifDesc.InterfaceProtocol = 0x%02x", ifDesc.InterfaceProtocol() );
+            OstTrace1( TRACE_DUMP, CFDF_PARSEL_DUP9, "ifDesc.Interface = %d", ifDesc.Interface() );
+            
 			TInterfaceInfo* ifInfo = TInterfaceInfo::NewL(iInterfaces);
 			ifInfo->iNumber = ifDesc.InterfaceNumber();
 			ifInfo->iClass = ifDesc.InterfaceClass();
@@ -735,10 +848,9 @@
 		{
 		// OTG descriptor found
 		const TUsbOTGDescriptor& otgDesc = static_cast<TUsbOTGDescriptor&>(aDesc);
-
-		LOGTEXT2(_L8("\totgDesc.Attributes = %b"), otgDesc.Attributes());
-		LOGTEXT2(_L8("\totgDesc.HNPSupported = %d"), otgDesc.HNPSupported());
-		LOGTEXT2(_L8("\totgDesc.SRPSupported = %d"), otgDesc.SRPSupported());
+		OstTrace1( TRACE_DUMP, CFDF_PARSEL_DUP10, "otgDesc.Attributes = %d", otgDesc.Attributes() );
+		OstTrace1( TRACE_DUMP, CFDF_PARSEL_DUP11, "otgDesc.HNPSupported = %d", otgDesc.HNPSupported() );
+		OstTrace1( TRACE_DUMP, CFDF_PARSEL_DUP12, "otgDesc.SRPSupported = %d", otgDesc.SRPSupported() );
 		
 		iCurrentDevice->SetOtgDescriptorL(otgDesc);
 		}
@@ -754,6 +866,7 @@
 		{
 		ParseL(*nextPeer);
 		}
+	OstTraceFunctionExit0( CFDF_PARSEL_EXIT );
 	}
 
 // Method that uses only one array to hold the unclaimed interface numbers.
@@ -763,13 +876,17 @@
 													RArray<TUint>& aInterfacesNumberArray, 
 													TInterfaceSearchKeys aKey)	
 	{
-	LOG_FUNC
-
+    OstTraceFunctionEntry0( CFDF_FINDDRIVERSFORINTERFACESUSINGSPECIFICKEYL_ENTRY );
+ 
 	const TUint interfaceCount = iInterfaces.Count();
 	for ( TUint ii = 0 ; ii < interfaceCount ; ++ii )
 		{
 		TInterfaceInfo* ifInfo = iInterfaces[ii];		
-		ASSERT_DEBUG(ifInfo);
+		if(!ifInfo)
+		    {
+            OstTrace0( TRACE_FATAL, CFDF_FINDDRIVERSFORINTERFACESUSINGSPECIFICKEYL, "Empty ifInfo" );
+            __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+		    }
 		
 		if ((ifInfo->iClaimed) ||
 			(aKey == EVendorInterfacesubclassInterfaceprotocol && ifInfo->iClass != KVendorSpecificInterfaceClassValue)||	
@@ -785,8 +902,7 @@
 
 		TBuf8<KMaxSearchKeyLength> searchKey;
 		FormatInterfaceSearchKey(searchKey, aKey, *ifInfo);
-
-		LOGTEXT2(_L8("\tsearchKey = \"%S\""), &searchKey);
+		OstTraceExt1( TRACE_NORMAL, CFDF_FINDDRIVERSFORINTERFACESUSINGSPECIFICKEYL_DUP1, "searchKey = \"%S\"", searchKey );
 		// RArray<TUint>* array = &aInterfacesNumberArray;
 
 		FindDriverForInterfaceUsingSpecificKey(aDevice, aCollectedErr, aAnySuccess, aInterfacesNumberArray, searchKey);
@@ -795,6 +911,7 @@
 		// the searching have been done.		
 		RebuildUnClaimedInterfacesArrayL(aDevice, aInterfacesNumberArray, ii+1);
 		}
+	OstTraceFunctionExit0( CFDF_FINDDRIVERSFORINTERFACESUSINGSPECIFICKEYL_EXIT );
 	}
 
 
@@ -808,9 +925,8 @@
 								   RArray<TUint>& aInterfacesGivenToFdc,
 								   const TDesC8& aSearchKey)
 	{
-
-	LOG_FUNC
-	LOGTEXT2(_L8("\taSearchKey = \"%S\""), &aSearchKey);
+    OstTraceFunctionEntry0( CFDF_FINDDRIVERFORINTERFACEUSINGSPECIFICKEY_ENTRY );
+	OstTraceExt1( TRACE_NORMAL, CFDF_FINDDRIVERFORINTERFACEUSINGSPECIFICKEY, "aSearchKey = \"%S\"", aSearchKey );
 
 	// Find an FDC matching this search key.
 	TSglQueIter<CFdcProxy> iter(iFunctionDrivers);
@@ -819,7 +935,8 @@
 
 	while ( ( fdc = iter++ ) != NULL )
 		{
-		LOGTEXT2(_L8("\tFDC's default_data field = \"%S\""), &fdc->DefaultDataField());
+        OstTraceExt1( TRACE_NORMAL, CFDF_FINDDRIVERFORINTERFACEUSINGSPECIFICKEY_DUP1, "FDC's default_data field = \"%S\"", fdc->DefaultDataField() );
+
 #ifdef _DEBUG
 	// having these two together in the debug window is helpful for interactive debugging
 	TBuf8<KMaxSearchKeyLength > fd_key;
@@ -846,27 +963,28 @@
 				{
 				aDevice.SetMultipleDriversFlag();
 				}
-			
-			LOGTEXT2(_L8("\tfound matching FDC (0x%08x)"), fdc);
-#ifdef __FLOG_ACTIVE
+			OstTrace1( TRACE_NORMAL, CFDF_FINDDRIVERFORINTERFACEUSINGSPECIFICKEY_DUP2, "found matching FDC (0x%08x)", fdc );
+
 			const TUint count = aInterfacesGivenToFdc.Count();
-			LOGTEXT2(_L8("\tlogging aInterfacesGivenToFdc (interfaces being offered to the FDC): count = %d"), count);
+			OstTrace1( TRACE_NORMAL, CFDF_FINDDRIVERFORINTERFACEUSINGSPECIFICKEY_DUP3, "logging aInterfacesGivenToFdc (interfaces being offered to the FDC): count = %d", count );
 			for ( TUint ii = 0 ; ii < count ; ++ii )
 				{
-				LOGTEXT3(_L8("\t\tindex %d: interface number %d"), ii, aInterfacesGivenToFdc[ii]);
-				}
-#endif
+                OstTraceExt2( TRACE_NORMAL, CFDF_FINDDRIVERFORINTERFACEUSINGSPECIFICKEY_DUP4, 
+                        "index %u: interface number %u", 
+                        ii, aInterfacesGivenToFdc[ii] );
+			    }
 			TInt err = fdc->NewFunction(aDevice.DeviceId(), aInterfacesGivenToFdc, iDD, iCD);
-			LOGTEXT2(_L8("\tNewFunction returned %d"), err);
+			OstTrace1( TRACE_NORMAL, CFDF_FINDDRIVERFORINTERFACEUSINGSPECIFICKEY_DUP5, "NewFunction returned %d", err );
+			            
 			// To correctly determine whether the driver load for the whole
 			// configuration was a complete failure, a partial success or a
 			// complete success, we need to collect any non-KErrNone error
 			// from this, and whether any handovers worked at all.
 			if ( err == KErrNone )
 				{
-#ifdef __FLOG_ACTIVE
-				LOGTEXT3(_L8("***USB HOST STACK: THE FOLLOWING INTERFACES OF DEVICE %d WERE SUCCESSFULLY PASSED TO FUNCTION DRIVER WITH IMPL UID 0x%08x"),
-					aDevice.DeviceId(), fdc->ImplUid());
+                OstTraceExt2(TRACE_NORMAL, CFDF_FINDDRIVERFORINTERFACEUSINGSPECIFICKEY_DUP6, 
+                        "***USB HOST STACK: THE FOLLOWING INTERFACES OF DEVICE %u WERE SUCCESSFULLY PASSED TO FUNCTION DRIVER WITH IMPL UID 0x%08x",
+					(TInt32) aDevice.DeviceId(), fdc->ImplUid().iUid);
 				// We want to log each interface that's in
 				// aInterfacesGivenToFdc AND is marked claimed in iInterfaces.
 				for ( TUint ii = 0 ; ii < aInterfacesGivenToFdc.Count() ; ++ii )
@@ -875,16 +993,20 @@
 					for ( TUint jj = 0 ; jj < iInterfaces.Count() ; ++jj )
 						{
 						const TInterfaceInfo* ifInfo = iInterfaces[jj];
-						ASSERT_DEBUG(ifInfo);
+						
+						if(!ifInfo)
+						    {
+                            OstTrace0( TRACE_FATAL, CFDF_FINDDRIVERFORINTERFACEUSINGSPECIFICKEY_DUP7, "Empty ifInfo" );
+                            __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+						    }
 						if (	ifNum == ifInfo->iNumber
 							&&	ifInfo->iClaimed
 							)
 							{
-							LOGTEXT2(_L8("***USB HOST STACK: bInterfaceNumber %d"), ifNum);
+                            OstTrace1( TRACE_NORMAL, CFDF_FINDDRIVERFORINTERFACEUSINGSPECIFICKEY_DUP8, "***USB HOST STACK: bInterfaceNumber %d", ifNum );
 							}
 						}
 					}
-#endif
 				aAnySuccess = ETrue;
 				}
 			else
@@ -895,13 +1017,13 @@
 			break;
 			}
 		}
+	OstTraceFunctionExit0( CFDF_FINDDRIVERFORINTERFACEUSINGSPECIFICKEY_EXIT );
 	}
 
 void CFdf::HandleDeviceDetachment(TUint aDeviceId)
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8("\taDeviceId = %d"), aDeviceId);
-
+    OstTraceFunctionEntry0( CFDF_HANDLEDEVICEDETACHMENT_ENTRY );
+    OstTrace1( TRACE_NORMAL, CFDF_HANDLEDEVICEDETACHMENT, "aDeviceId = %d", aDeviceId );
 
 #ifdef _DEBUG
 	TBool found = EFalse;
@@ -919,16 +1041,24 @@
 #ifdef _DEBUG
 			found = ETrue;
 #endif
-			LOGTEXT(_L8("\tfound matching device proxy"));
-
+			OstTrace0( TRACE_NORMAL, CFDF_HANDLEDEVICEDETACHMENT_DUP1, "found matching device proxy" );
+			
 			iDevices.Remove(*device);
 			// Before destroying the device proxy, take the detachment event
 			// stored in it for the event queue.
 			TDeviceEvent* const detachmentEvent = device->GetDetachmentEventObject();
-			ASSERT_DEBUG(detachmentEvent);
-			ASSERT_DEBUG(iEventQueue);
+			if(!detachmentEvent)
+			    {
+                OstTrace0( TRACE_FATAL, CFDF_HANDLEDEVICEDETACHMENT_DUP2, "Empty detachmentEvent" );
+                __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+			    }
+			if(!iEventQueue)
+			    {
+                OstTrace0( TRACE_FATAL, CFDF_HANDLEDEVICEDETACHMENT_DUP3, "Empty iEventQueue" );
+                __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+			    }
 			iEventQueue->AddDeviceEvent(*detachmentEvent);
-			LOGTEXT2(_L8("***USB HOST STACK: DETACHMENT OF DEVICE (id %d)"), aDeviceId);
+			OstTrace1( TRACE_NORMAL, CFDF_HANDLEDEVICEDETACHMENT_DUP4, "***USB HOST STACK: DETACHMENT OF DEVICE (id %d)", aDeviceId );
 			delete device;
 
 			TellFdcsOfDeviceDetachment(aDeviceId);
@@ -939,7 +1069,7 @@
 			if (iDevices.IsEmpty())
 				{
 				TInt err = User::FreeLogicalDevice(KDriverUsbdiLddFileName);
-				LOGTEXT2(_L8("\tFreeLogicalDevice( usbdi ) returned %d"), err);
+				OstTrace1( TRACE_NORMAL, CFDF_HANDLEDEVICEDETACHMENT_DUP5, "FreeLogicalDevice( usbdi ) returned %d", err );
 				}
 #endif // __OVER_DUMMYUSBDI__
 			
@@ -950,25 +1080,32 @@
 #ifdef _DEBUG
 	if ( !found )
 		{
-		LOGTEXT(_L8("\tno matching device proxy found"));
+        OstTrace0( TRACE_NORMAL, CFDF_HANDLEDEVICEDETACHMENT_DUP6, "no matching device proxy found" );
 		}
 #endif
+	
+	OstTraceFunctionExit0( CFDF_HANDLEDEVICEDETACHMENT_EXIT );
 	}
 
 void CFdf::HandleDevmonEvent(TInt aEvent)
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8("\taEvent = %d"), aEvent);
+	OstTraceFunctionEntry0( CFDF_HANDLEDEVMONEVENT_ENTRY );
+	OstTrace1( TRACE_NORMAL, CFDF_HANDLEDEVMONEVENT, "aEvent = %d", aEvent );
 
-	ASSERT_DEBUG(iEventQueue);
+	if(!iEventQueue)
+	    {
+        OstTrace0( TRACE_FATAL, CFDF_HANDLEDEVMONEVENT_DUP1, "Empty iEventQueue" );
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+	    }
 	iEventQueue->AddDevmonEvent(aEvent);
+	OstTraceFunctionExit0( CFDF_HANDLEDEVMONEVENT_EXIT );
 	}
 
 void CFdf::TellFdcsOfDeviceDetachment(TUint aDeviceId)
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8("\taDeviceId = %d"), aDeviceId);
-
+	OstTraceFunctionEntry0( CFDF_TELLFDCSOFDEVICEDETACHMENT_ENTRY );
+	OstTrace1( TRACE_NORMAL, CFDF_TELLFDCSOFDEVICEDETACHMENT, "aDeviceId = %d", aDeviceId );
+	
 	TSglQueIter<CFdcProxy> iter(iFunctionDrivers);
 	iter.SetToFirst();
 	CFdcProxy* fdc;
@@ -982,12 +1119,14 @@
 			}
 		}			
 		
+	OstTraceFunctionExit0( CFDF_TELLFDCSOFDEVICEDETACHMENT_EXIT );
 	}
 
 TUint32 CFdf::TokenForInterface(TUint8 aInterface)
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8("\taInterface = %d"), aInterface);
+	OstTraceFunctionEntry0( CFDF_TOKENFORINTERFACE_ENTRY );
+	OstTrace1( TRACE_NORMAL, CFDF_TOKENFORINTERFACE, "aInterface = %d", aInterface );
+	
 	TUint32 token = 0;
 
 	// Check that the interface was in the array given to the FD and mark it
@@ -997,21 +1136,37 @@
 	for ( TUint ii = 0 ; ii < interfaceCount ; ++ii )
 		{
 		TInterfaceInfo* ifInfo = iInterfaces[ii];
-		ASSERT_DEBUG(ifInfo);
+		if(!ifInfo)
+		    {
+            OstTrace0( TRACE_FATAL, CFDF_TOKENFORINTERFACE_DUP1, "Empty ifInfo" );
+            __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+		    }
 		if ( ifInfo->iNumber == aInterface )
 			{
 			found = ETrue;
 			// The FDC tried to claim an interface that was already claimed.
-			ASSERT_ALWAYS(!ifInfo->iClaimed);
+			if(ifInfo->iClaimed)
+			    {
+                OstTrace0( TRACE_FATAL, CFDF_TOKENFORINTERFACE_DUP2, "iClaimed error" );
+                User::Panic(KPanicCategory,__LINE__);
+			    }
 			ifInfo->iClaimed = ETrue;
 			break;
 			}
 		}
 	// Could not find interface in the interface array- the FDC tried to claim
 	// an interface it had not been offered.
-	ASSERT_ALWAYS(found);
+	if(!found)
+	    {
+        OstTrace0( TRACE_FATAL, CFDF_TOKENFORINTERFACE_DUP3, "not found" );
+        User::Panic(KPanicCategory,__LINE__);
+	    }
 
-	ASSERT_DEBUG(iCurrentDevice);
+	if(!iCurrentDevice)
+	    {
+        OstTrace0( TRACE_FATAL, CFDF_TOKENFORINTERFACE_DUP4, "Empty iCurrentDevice" );
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+	    }
 
 	// GetTokenForInterface will return error in the following cases:
 	// 1/ KErrBadHandle: invalid device handle (the CDeviceProxy asserts that
@@ -1039,21 +1194,23 @@
 			break;
 
 		default:
-			LOGTEXT3(_L8("\tUnexpected error %d when requesting token for aInterface %d"),err,aInterface);
-			ASSERT_ALWAYS(0);
+			OstTraceExt2( TRACE_FATAL, CFDF_TOKENFORINTERFACE_DUP5, "Unexpected error %d when requesting token for aInterface %d",err,aInterface);
+			User::Panic(KPanicCategory,__LINE__);
 			break;
 		}
 
-	LOGTEXT3(_L8("\tToken for interface %d is = %d"),aInterface, token);
-
+	OstTraceExt2( TRACE_NORMAL, CFDF_TOKENFORINTERFACE_DUP6, 
+	        "Token for interface %hhu is = %u",aInterface, token);
+	
+	OstTraceFunctionExit0( CFDF_TOKENFORINTERFACE_EXIT );
 	return token;
 	}
 
 CDeviceProxy* CFdf::DeviceProxyL(TUint aDeviceId) const
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8("\taDeviceId = %d"), aDeviceId);
-
+	OstTraceFunctionEntry0( CFDF_DEVICEPROXYL_ENTRY );
+	OstTrace1( TRACE_NORMAL, CFDF_DEVICEPROXYL, "aDeviceId = %d", aDeviceId );
+	
 	TSglQueIter<CDeviceProxy> iter(const_cast<CFdf*>(this)->iDevices);
 	iter.SetToFirst();
 	CDeviceProxy* device = NULL;
@@ -1061,66 +1218,74 @@
 		{
 		if ( device->DeviceId() == aDeviceId )
 			{
-			LOGTEXT2(_L8("\tdevice = 0x%08x"), device);
+            OstTrace1( TRACE_NORMAL, CFDF_DEVICEPROXYL_DUP1, "device = 0x%08x", device );
+			OstTraceFunctionExit0( CFDF_DEVICEPROXYL_EXIT );
 			return device;
 			}
 		}
-	LEAVEL(KErrNotFound);
+	OstTrace0( TRACE_NORMAL, CFDF_DEVICEPROXYL_DUP2, "KErrNotFound");
+	User::Leave(KErrNotFound);
+	OstTraceFunctionExit0( CFDF_DEVICEPROXYL_EXIT_DUP1 );
 	return NULL; // avoid warning
 	}
 
 const RArray<TUint>& CFdf::GetSupportedLanguagesL(TUint aDeviceId) const
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8("\taDeviceId = %d"), aDeviceId);
-
+	OstTraceFunctionEntry0( CFDF_GETSUPPORTEDLANGUAGESL_ENTRY );
+	OstTrace1( TRACE_NORMAL, CFDF_GETSUPPORTEDLANGUAGESL, "aDeviceId = %d", aDeviceId );
+	
 	CDeviceProxy* deviceProxy = DeviceProxyL(aDeviceId);
 	return deviceProxy->GetSupportedLanguages();
 	}
 
 void CFdf::GetManufacturerStringDescriptorL(TUint aDeviceId, TUint32 aLangId, TName& aString) const
 	{
-	LOG_FUNC
-	LOGTEXT3(_L8("\taDeviceId = %d, aLangId = 0x%04x"), aDeviceId, aLangId);
-
+	OstTraceFunctionEntry0( CFDF_GETMANUFACTURERSTRINGDESCRIPTORL_ENTRY );
+	OstTraceExt2( TRACE_NORMAL, CFDF_GETMANUFACTURERSTRINGDESCRIPTORL, 
+	        "aDeviceId = %u, aLangId = 0x%08x", (TUint32)aDeviceId, aLangId );
+		
 	CDeviceProxy* deviceProxy = DeviceProxyL(aDeviceId);
 	deviceProxy->GetManufacturerStringDescriptorL(aLangId, aString);
-	LOGTEXT2(_L("\taString = \"%S\""), &aString);
+	OstTraceExt1( TRACE_NORMAL, CFDF_GETMANUFACTURERSTRINGDESCRIPTORL_DUP1, "aString = \"%S\"", aString );
+	OstTraceFunctionExit0( CFDF_GETMANUFACTURERSTRINGDESCRIPTORL_EXIT );
 	}
 
 void CFdf::GetProductStringDescriptorL(TUint aDeviceId, TUint32 aLangId, TName& aString) const
 	{
-	LOG_FUNC
-	LOGTEXT3(_L8("\taDeviceId = %d, aLangId = 0x%04x"), aDeviceId, aLangId);
+	OstTraceFunctionEntry0( CFDF_GETPRODUCTSTRINGDESCRIPTORL_ENTRY );
+	OstTraceExt2( TRACE_NORMAL, CFDF_GETPRODUCTSTRINGDESCRIPTORL, 
+	        "aDeviceId = %u, aLangId = 0x%04x", (TUint32)aDeviceId, aLangId );
 
 	CDeviceProxy* deviceProxy = DeviceProxyL(aDeviceId);
 	deviceProxy->GetProductStringDescriptorL(aLangId, aString);
-	LOGTEXT2(_L("\taString = \"%S\""), &aString);
+	OstTraceExt1( TRACE_NORMAL, CFDF_GETPRODUCTSTRINGDESCRIPTORL_DUP1, "aString = \"%S\"", aString );
+	OstTraceFunctionExit0( CFDF_GETPRODUCTSTRINGDESCRIPTORL_EXIT );
 	}
 
 void CFdf::GetOtgDeviceDescriptorL(TInt aDeviceId, TOtgDescriptor& aDescriptor) const
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CFDF_GETOTGDEVICEDESCRIPTORL_ENTRY );
 	
 	DeviceProxyL(aDeviceId)->GetOtgDescriptorL(aDescriptor);
+	OstTraceFunctionExit0( CFDF_GETOTGDEVICEDESCRIPTORL_EXIT );
 	}
 
 void CFdf::GetSerialNumberStringDescriptorL(TUint aDeviceId, TUint32 aLangId, TName& aString) const
 	{
-	LOG_FUNC
-	LOGTEXT3(_L8("\taDeviceId = %d, aLangId = 0x%04x"), aDeviceId, aLangId);
+	OstTraceFunctionEntry0( CFDF_GETSERIALNUMBERSTRINGDESCRIPTORL_ENTRY );
+	OstTraceExt2( TRACE_NORMAL, CFDF_GETSERIALNUMBERSTRINGDESCRIPTORL, 
+	        "aDeviceId = %u, aLangId = 0x%08x", (TUint32)aDeviceId, aLangId );
 
 	CDeviceProxy* deviceProxy = DeviceProxyL(aDeviceId);
 	deviceProxy->GetSerialNumberStringDescriptorL(aLangId, aString);
-	LOGTEXT2(_L("\taString = \"%S\""), &aString);
+	OstTraceExt1( TRACE_NORMAL, CFDF_GETSERIALNUMBERSTRINGDESCRIPTORL_DUP1, "aString = \"%S\"", aString );
+	OstTraceFunctionExit0( CFDF_GETSERIALNUMBERSTRINGDESCRIPTORL_EXIT );
 	}
 
 void CFdf::SearchForInterfaceFunctionDriversL(CDeviceProxy& aDevice, TBool& aAnySuccess, TInt& aCollectedErr)
 	{
 	RArray<TUint> interfacesNumberArray;	
 	CleanupClosePushL(interfacesNumberArray);
-
-
 	
 	for ( TUint ii = 0 ; ii < iInterfaces.Count() ; ++ii )
 		{
@@ -1172,8 +1337,9 @@
 	TInt err = aArray.Append(aInterfaceNo);
 	if ( err )
 		{
-		aDevice.SetDriverLoadingEventData(EDriverLoadFailure, err);
-		LEAVEL(err);
+		aDevice.SetDriverLoadingEventData(EDriverLoadFailure, err);	
+		OstTrace1( TRACE_NORMAL, CFDF_APPENDINTERFACENUMBERTOARRAYL, "Leave with error: %d", err );
+		User::Leave(err);
 		}
 	}
 	
@@ -1215,15 +1381,15 @@
 			{
 			if (fdc->MarkedForDeletion())
 				continue;
-			LOGTEXT2(_L8("\tFDC's default_data field = \"%S\""), &fdc->DefaultDataField());
-#ifdef _DEBUG
+			OstTraceExt1( TRACE_NORMAL, CFDF_SEARCHFORADEVICEFUNCTIONDRIVERL, "FDC's default_data field = \"%S\"", fdc->DefaultDataField());
+			
 	// having these two together in the debug window is helpful for interactive debugging
 	TBuf8<KMaxSearchKeyLength> fd_key;
 	fd_key.Append(fdc->DefaultDataField().Ptr(), fdc->DefaultDataField().Length() > KMaxSearchKeyLength ? KMaxSearchKeyLength : fdc->DefaultDataField().Length());	
 	TBuf8<KMaxSearchKeyLength> search_key;
 	search_key.Append(searchKeyString.Ptr(), searchKeyString.Length() > KMaxSearchKeyLength ? KMaxSearchKeyLength : searchKeyString.Length());
 	TInt version = fdc->Version();
-#endif
+
 			if (searchKeyString.CompareF(fdc->DefaultDataField()) == 0)
 				{
 				
@@ -1241,9 +1407,9 @@
 					}
 				
 				foundFdc = ETrue;
-				LOGTEXT2(_L8("\tfound matching FDC (0x%08x)"), fdc);
+				OstTrace1( TRACE_NORMAL, CFDF_SEARCHFORADEVICEFUNCTIONDRIVERL_DUP1, "found matching FDC (0x%08x)", fdc );
 				TInt err = fdc->NewFunction(aDevice.DeviceId(), interfaces, iDD, iCD);
-				LOGTEXT2(_L8("\tNewFunction returned %d"), err);
+				OstTrace1( TRACE_NORMAL, CFDF_SEARCHFORADEVICEFUNCTIONDRIVERL_DUP2, "NewFunction returned %d", err);
 				// To correctly determine whether the driver load for the whole
 				// configuration was a complete failure, a partial success or a
 				// complete success, we need to collect any non-KErrNone error
@@ -1291,7 +1457,8 @@
 //
 void CFdf::FormatDeviceSearchKey(TDes8& aSearchKey, TDeviceSearchKeys aDeviceSearchKeys)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CFDF_FORMATDEVICESEARCHKEY_ENTRY );
+	
 	switch (aDeviceSearchKeys)
 		{
 		case EVendorProductDevice:
@@ -1331,12 +1498,13 @@
 			break;
 			}
 		default:
-			{
-			ASSERT_DEBUG(EFalse);
+			{	
+			OstTrace1( TRACE_FATAL, CFDF_FORMATDEVICESEARCHKEY, "Invalid aDeviceSearchKeys=%d", aDeviceSearchKeys );
+			__ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
 			}		
 		}
-		
-	LOGTEXT2(_L8("\taSearchKey = \"%S\""), &aSearchKey);		
+	OstTraceExt1( TRACE_NORMAL, CFDF_FORMATDEVICESEARCHKEY_DUP1, "aSearchKey = \"%s\"", aSearchKey );
+	OstTraceFunctionExit0( CFDF_FORMATDEVICESEARCHKEY_EXIT );
 	}
 	
 	
@@ -1348,7 +1516,8 @@
 //	
 void CFdf::FormatInterfaceSearchKey(TDes8& aSearchKey, TInterfaceSearchKeys aSearchKeys, const TInterfaceInfo& aIfInfo)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CFDF_FORMATINTERFACESEARCHKEY_ENTRY );
+	
 	switch (aSearchKeys)
 		{
 		case EVendorProductDeviceConfigurationvalueInterfacenumber:
@@ -1389,28 +1558,37 @@
 			}
 		default:
 			{
-			ASSERT_DEBUG(EFalse);
+			OstTrace1( TRACE_FATAL, CFDF_FORMATINTERFACESEARCHKEY, "Invalid aSearchKeys=%d", aSearchKeys );
+			__ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
 			}
 		}
-	LOGTEXT2(_L8("\taSearchKey = \"%S\""), &aSearchKey);		
+	OstTraceExt1( TRACE_NORMAL, CFDF_FORMATINTERFACESEARCHKEY_DUP1, "aSearchKey = \"%s\"", aSearchKey );
+	OstTraceFunctionExit0( CFDF_FORMATINTERFACESEARCHKEY_EXIT );
 	}
 
 
 TUint CFdf::UnclaimedInterfaceCount() const
 	{
-	LOG_FUNC	
+	OstTraceFunctionEntry0( CFDF_UNCLAIMEDINTERFACECOUNT_ENTRY );
+		
 	TUint unclaimedInterfaces = 0;
 	for ( TUint ii = 0 ; ii < iInterfaces.Count() ; ++ii )
 		{
 		TInterfaceInfo* ifInfo = iInterfaces[ii];
-		ASSERT_DEBUG(ifInfo);
+		
+		if(!ifInfo)
+		    {
+            OstTrace0( TRACE_FATAL, CFDF_UNCLAIMEDINTERFACECOUNT, "Empty ifInfo" );
+            __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+		    }
 		if ( !ifInfo->iClaimed )
 			{
-			LOGTEXT2(_L8("\tunclaimed interface: ifInfo->iNumber = %d"), ifInfo->iNumber);
+            OstTrace1( TRACE_NORMAL, CFDF_UNCLAIMEDINTERFACECOUNT_DUP1, "unclaimed interface: ifInfo->iNumber = %d", ifInfo->iNumber );
 			++unclaimedInterfaces;
 			}
 		}
-	LOGTEXT2(_L("\tunclaimedInterfaces = \"%d\""), unclaimedInterfaces);			
+	OstTrace1( TRACE_NORMAL, CFDF_UNCLAIMEDINTERFACECOUNT_DUP2, "unclaimedInterfaces = \"%d\"", unclaimedInterfaces );
+	OstTraceFunctionExit0( CFDF_UNCLAIMEDINTERFACECOUNT_EXIT );
 	return unclaimedInterfaces;
 	}
 	
--- a/usbmgmt/usbmgr/host/fdf/production/server/src/fdfserver.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/server/src/fdfserver.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
@@ -26,32 +26,36 @@
 #include "utils.h"
 #include "fdfapi.h"
 #include "fdf.h"
-
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "fdf      ");
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "fdfserverTraces.h"
 #endif
 
 #ifdef _DEBUG
-PANICCATEGORY("fdfsrv");
+_LIT(KPanicCategory, "fdfsrv");
 #endif
 
+
 void CFdfServer::NewLC()
 	{
-	LOG_STATIC_FUNC_ENTRY
-
+	OstTraceFunctionEntry0( CFDFSERVER_NEWLC_ENTRY );
+	
 	CFdfServer* self = new(ELeave) CFdfServer;
 	CleanupStack::PushL(self);
 	// StartL is where the kernel checks that there isn't already an instance
 	// of the same server running, so do it before ConstructL.
 	self->StartL(KUsbFdfServerName);
 	self->ConstructL();
+	OstTraceFunctionExit0( CFDFSERVER_NEWLC_EXIT );
 	}
 
 CFdfServer::~CFdfServer()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CFDFSERVER_CFDFSERVER_DES_ENTRY );
+	
 
 	delete iFdf;
+	OstTraceFunctionExit0( CFDFSERVER_CFDFSERVER_DES_EXIT );
 	}
 
 CFdfServer::CFdfServer()
@@ -61,23 +65,25 @@
 
 void CFdfServer::ConstructL()
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CFDFSERVER_CONSTRUCTL_ENTRY );
+	
 	iFdf = CFdf::NewL();
+	OstTraceFunctionExit0( CFDFSERVER_CONSTRUCTL_EXIT );
 	}
 
 CSession2* CFdfServer::NewSessionL(const TVersion& aVersion,
 	const RMessage2& aMessage) const
 	{
-	LOG_LINE
-	LOG_FUNC;
-	LOGTEXT4(_L8("\taVersion = (%d,%d,%d)"), aVersion.iMajor, aVersion.iMinor, aVersion.iBuild);
+	OstTraceFunctionEntry0( CFDFSERVER_NEWSESSIONL_ENTRY );
+	OstTraceExt3( TRACE_NORMAL, CFDFSERVER_NEWSESSIONL, "aVersion = (%d,%d,%d)", aVersion.iMajor, aVersion.iMinor, aVersion.iBuild );
 	(void)aMessage;
 
 	// Check if we already have a session open.
 	if ( iSession )
 		{
-		LEAVEL(KErrInUse);
+		OstTrace0( TRACE_NORMAL, CFDFSERVER_NEWSESSIONL_DUP1, 
+		        "Session in use");
+		User::Leave(KErrInUse);
 		}
 
 	// In the production system, check the secure ID of the prospective
@@ -96,7 +102,8 @@
 	// check OFF to allow any client to pass and thereby break our
 	// architecture.
 	TInt error = ( aMessage.SecureId() == KUsbsvrSecureId ) ? KErrNone : KErrPermissionDenied;
-	LEAVEIFERRORL(error);
+	LEAVEIFERRORL(error,OstTrace0( TRACE_NORMAL, CFDFSERVER_NEWSESSIONL_DUP2, 
+            "SecureId error"););
 #endif // __TEST_FDF__
 
 #endif // __OVER_DUMMYUSBDI__
@@ -108,27 +115,41 @@
 
 	if ( !User::QueryVersionSupported(v, aVersion) )
 		{
-		LEAVEL(KErrNotSupported);
+		OstTrace0( TRACE_NORMAL, CFDFSERVER_NEWSESSIONL_DUP3, 
+                "Version not supported");
+		User::Leave(KErrNotSupported);
 		}
 
 	CFdfServer* ncThis = const_cast<CFdfServer*>(this);
 	ncThis->iSession = new(ELeave) CFdfSession(*iFdf, *ncThis);
-	ASSERT_DEBUG(ncThis->iFdf);
+	if(!ncThis->iFdf)
+	    {
+        OstTrace0( TRACE_FATAL, CFDFSERVER_NEWSESSIONL_DUP4,"ncThis->iFdf is empty"); 
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+	    }
+            
 	ncThis->iFdf->SetSession(iSession);
 
-	LOGTEXT2(_L8("\tiSession = 0x%08x"), iSession);
+	OstTrace1( TRACE_NORMAL, CFDFSERVER_NEWSESSIONL_DUP5, "iSession = 0x%08x", iSession );
+	OstTraceFunctionExit0( CFDFSERVER_NEWSESSIONL_EXIT );
 	return iSession;
 	}
 
 void CFdfServer::SessionClosed()
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry0( CFDFSERVER_SESSIONCLOSED_ENTRY );
 
-	ASSERT_DEBUG(iSession);
+	if(!iSession)
+	    {
+        OstTrace0( TRACE_FATAL, CFDFSERVER_SESSIONCLOSED,"Empty iSession" ); 
+        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+	    }
+	        
 	iSession = NULL;
 	iFdf->SetSession(NULL);
 
-	LOGTEXT(_L8("\tno remaining sessions- shutting down"));
+	OstTrace0( TRACE_NORMAL, CFDFSERVER_SESSIONCLOSED_DUP1, "no remaining sessions- shutting down" );
+	
 	// This returns control to the server boilerplate in main.cpp. This
 	// destroys all the objects, which includes signalling device detachment
 	// to any extant FDCs.
@@ -137,4 +158,5 @@
 	// that's created immediately before calling CActiveScheduler::Start in
 	// main.cpp.
 	CActiveScheduler::Stop();
+	OstTraceFunctionExit0( CFDFSERVER_SESSIONCLOSED_EXIT );
 	}
--- a/usbmgmt/usbmgr/host/fdf/production/server/src/fdfsession.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/server/src/fdfsession.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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,36 +28,37 @@
 #include "fdfapi.h"
 #include "fdf.h"
 #include "event.h"
-
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "fdf      ");
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "fdfsessionTraces.h"
 #endif
 
 #ifdef _DEBUG
-PANICCATEGORY("fdfsession");
+_LIT(KPanicCategory, "fdfsession");
 #endif
 
 CFdfSession::CFdfSession(CFdf& aFdf, CFdfServer& aServer)
  :	iFdf(aFdf),
 	iServer(aServer)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CFDFSESSION_CFDFSESSION_CONS_ENTRY );
+	
+	OstTraceFunctionExit0( CFDFSESSION_CFDFSESSION_CONS_EXIT );
 	}
 
 CFdfSession::~CFdfSession()
 	{
-	LOG_LINE
-	LOG_FUNC;
-
+	OstTraceFunctionEntry0( CFDFSESSION_CFDFSESSION_DES_ENTRY );
+	
 	iServer.SessionClosed();
+	OstTraceFunctionExit0( CFDFSESSION_CFDFSESSION_DES_EXIT );
 	}
 
 void CFdfSession::ServiceL(const RMessage2& aMessage)
 	{
-	LOG_LINE
-	LOG_FUNC;
-	LOGTEXT2(_L8("\taMessage.Function() = %d"), aMessage.Function());
-
+	OstTraceFunctionEntry0( CFDFSESSION_SERVICEL_ENTRY );
+	OstTrace1( TRACE_NORMAL, CFDFSESSION_SERVICEL, "aMessage.Function() = %d", aMessage.Function() );
+	
 	// Switch on the IPC number and call a 'message handler'. Message handlers
 	// complete aMessage (either with Complete or Panic), or make a note of
 	// the message for later asynchronous completion.
@@ -71,12 +72,22 @@
 		// This is a sync API- check that the message has been completed.
 		// (NB We don't check the converse for async APIs because the message
 		// may have been panicked synchronously.)
-		ASSERT_DEBUG(aMessage.Handle() == 0);
+		if(!(aMessage.Handle() == 0))
+		    {
+            OstTrace0( TRACE_FATAL, CFDFSESSION_SERVICEL_DUP1, 
+                        "Empty aMessage.Handle" );
+            __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+		    }
 		break;
 
 	case EUsbFdfSrvDisableDriverLoading:
 		DisableDriverLoading(aMessage);
-		ASSERT_DEBUG(aMessage.Handle() == 0);
+		if(!(aMessage.Handle() == 0))
+		    {
+		    OstTrace0( TRACE_FATAL, CFDFSESSION_SERVICEL_DUP2, 
+		              "Empty aMessage.Handle" );
+		    __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+		    }
 		break;
 
 	case EUsbFdfSrvNotifyDeviceEvent:
@@ -85,7 +96,12 @@
 
 	case EUsbFdfSrvNotifyDeviceEventCancel:
 		NotifyDeviceEventCancel(aMessage);
-		ASSERT_DEBUG(aMessage.Handle() == 0);
+		if(!(aMessage.Handle() == 0))
+		    {
+		    OstTrace0( TRACE_FATAL, CFDFSESSION_SERVICEL_DUP3, 
+                        "Empty aMessage.Handle" );
+		    __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+		    }
 		break;
 
 	case EUsbFdfSrvNotifyDevmonEvent:
@@ -94,39 +110,71 @@
 
 	case EUsbFdfSrvNotifyDevmonEventCancel:
 		NotifyDevmonEventCancel(aMessage);
-		ASSERT_DEBUG(aMessage.Handle() == 0);
+		if(!(aMessage.Handle() == 0))
+		    {
+		    OstTrace0( TRACE_FATAL, CFDFSESSION_SERVICEL_DUP4, 
+		              "Empty aMessage.Handle" );
+		    __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+		    }
 		break;
 
 	case EUsbFdfSrvGetSingleSupportedLanguageOrNumberOfSupportedLanguages:
 		GetSingleSupportedLanguageOrNumberOfSupportedLanguages(aMessage);
-		ASSERT_DEBUG(aMessage.Handle() == 0);
+		if(!(aMessage.Handle() == 0))
+		    {
+		    OstTrace0( TRACE_FATAL, CFDFSESSION_SERVICEL_DUP5, 
+		               "Empty aMessage.Handle" );
+		    __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+		    }
 		break;
 
 	case EUsbFdfSrvGetSupportedLanguages:
 		GetSupportedLanguages(aMessage);
-		ASSERT_DEBUG(aMessage.Handle() == 0);
+		if(!(aMessage.Handle() == 0))
+		    {
+		    OstTrace0( TRACE_FATAL, CFDFSESSION_SERVICEL_DUP6, 
+		              "Empty aMessage.Handle" );
+		    __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+		    }
 		break;
 
 	case EUsbFdfSrvGetManufacturerStringDescriptor:
 		GetManufacturerStringDescriptor(aMessage);
-		ASSERT_DEBUG(aMessage.Handle() == 0);
+		if(!(aMessage.Handle() == 0))
+		    {
+		    OstTrace0( TRACE_FATAL, CFDFSESSION_SERVICEL_DUP7, 
+		              "Empty aMessage.Handle" );
+		    __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+		    }		
 		break;
 
 	case EUsbFdfSrvGetProductStringDescriptor:
 		GetProductStringDescriptor(aMessage);
-		ASSERT_DEBUG(aMessage.Handle() == 0);
+		if(!(aMessage.Handle() == 0))
+		    {
+		    OstTrace0( TRACE_FATAL, CFDFSESSION_SERVICEL_DUP8, 
+		              "Empty aMessage.Handle" );
+		    __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+		    }
 		break;
 		
 	case EUsbFdfSrvGetOtgDescriptor:
 		GetOtgDeviceDescriptor(aMessage);
-		ASSERT_DEBUG(aMessage.Handle() == 0);
+		if(!(aMessage.Handle() == 0))
+		    {
+		    OstTrace0( TRACE_FATAL, CFDFSESSION_SERVICEL_DUP9, 
+		              "Empty aMessage.Handle" );
+		    __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+		    }
 		break;
 
 	// Heap failure testing APIs.
 	case EUsbFdfSrvDbgFailNext:
 #ifdef _DEBUG
 		{
-		LOGTEXT2(_L8("\tfail next (simulating failure after %d allocation(s))"), aMessage.Int0());
+		OstTrace1( TRACE_NORMAL, CFDFSESSION_SERVICEL_DUP10, 
+		                        "fail next (simulating failure after %d allocation(s))", 
+		                        aMessage.Int0() );
 		if ( aMessage.Int0() == 0 )
 			{
 			__UHEAP_RESET;
@@ -136,7 +184,7 @@
 			__UHEAP_FAILNEXT(aMessage.Int0());
 			}
 		}
-#endif // _DEBUG
+#endif
 		CompleteClient(aMessage, KErrNone);
 		break;
 
@@ -144,60 +192,70 @@
 		{
 		TInt err = KErrNone;
 #ifdef _DEBUG
-		LOGTEXT(_L8("\tallocate on the heap"));
+		OstTrace0( TRACE_NORMAL, CFDFSESSION_SERVICEL_DUP11, "allocate on the heap" );
 		TInt* x = NULL;
 		TRAP(err, x = new(ELeave) TInt);
 		delete x;
-
-#endif // _DEBUG
+#endif
 		CompleteClient(aMessage, err);
 		}
 		break;
 
 	default:
-		PANIC_MSG(aMessage, KUsbFdfServerName, EBadIpc);
+		OstTrace0( TRACE_FATAL, CFDFSESSION_SERVICEL_DUP12, 
+		           "Invalid message function" );
+		aMessage.Panic(KUsbFdfServerName,EBadIpc);
+        
 		break;
 		}
+	OstTraceFunctionExit0( CFDFSESSION_SERVICEL_EXIT );
 	}
 
 void CFdfSession::CompleteClient(const RMessage2& aMessage, TInt aError)
 	{
-	LOGTEXT2(_L8("\tcompleting client message with %d"), aError);
-	aMessage.Complete(aError);
+    OstTrace1( TRACE_NORMAL, CFDFSESSION_COMPLETECLIENT, "completing client message with %d", aError );
+ 	aMessage.Complete(aError);
 	}
 
 void CFdfSession::EnableDriverLoading(const RMessage2& aMessage)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CFDFSESSION_ENABLEDRIVERLOADING_ENTRY );
 
 	iFdf.EnableDriverLoading();
 
 	CompleteClient(aMessage, KErrNone);
+	OstTraceFunctionExit0( CFDFSESSION_ENABLEDRIVERLOADING_EXIT );
 	}
 
 void CFdfSession::DisableDriverLoading(const RMessage2& aMessage)
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CFDFSESSION_DISABLEDRIVERLOADING_ENTRY );
+	
 	iFdf.DisableDriverLoading();
 
 	CompleteClient(aMessage, KErrNone);
+	OstTraceFunctionExit0( CFDFSESSION_DISABLEDRIVERLOADING_EXIT );
 	}
 
 TBool CFdfSession::NotifyDeviceEventOutstanding() const
 	{
 	const TBool ret = ( iNotifyDeviceEventMsg.Handle() != 0 );
-	LOGTEXT2(_L("CFdfSession::NotifyDeviceEventOutstanding returning %d"), ret);
+	OstTrace1( TRACE_NORMAL, CFDFSESSION_NOTIFYDEVICEEVENTOUTSTANDING, 
+	        "CFdfSession::NotifyDeviceEventOutstanding returning %d", ret );
+	
 	return ret;
 	}
 
 void CFdfSession::NotifyDeviceEvent(const RMessage2& aMessage)
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CFDFSESSION_NOTIFYDEVICEEVENT_ENTRY );
+	
 	if ( iNotifyDeviceEventMsg.Handle() )
 		{
-		PANIC_MSG(iNotifyDeviceEventMsg, KUsbFdfServerName, ENotifyDeviceEventAlreadyOutstanding);
+        OstTrace0( TRACE_FATAL, CFDFSESSION_NOTIFYDEVICEEVENT, 
+                "Empty iNotifyDeviceEventMsg" );
+		iNotifyDeviceEventMsg.Panic( KUsbFdfServerName, 
+		        ENotifyDeviceEventAlreadyOutstanding);
 		}
 	else
 		{
@@ -208,68 +266,90 @@
 			CompleteDeviceEventNotification(event);
 			}
 		}
+	OstTraceFunctionExit0( CFDFSESSION_NOTIFYDEVICEEVENT_EXIT );
 	}
 
 void CFdfSession::NotifyDeviceEventCancel(const RMessage2& aMessage)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CFDFSESSION_NOTIFYDEVICEEVENTCANCEL_ENTRY );
 
 	if ( iNotifyDeviceEventMsg.Handle() )
 		{
 		CompleteClient(iNotifyDeviceEventMsg, KErrCancel);
 		}
 	CompleteClient(aMessage, KErrNone);
+	OstTraceFunctionExit0( CFDFSESSION_NOTIFYDEVICEEVENTCANCEL_EXIT );
 	}
 
 void CFdfSession::DeviceEvent(const TDeviceEvent& aEvent)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CFDFSESSION_DEVICEEVENT_ENTRY );
 
 	// This function should only be called if there is a request outstanding.
-	ASSERT_DEBUG(iNotifyDeviceEventMsg.Handle());
-
+	if(!iNotifyDeviceEventMsg.Handle())
+	    {
+	    OstTrace0( TRACE_FATAL, CFDFSESSION_DEVICEEVENT, 
+	                "iNotifyDeviceEventMsg.Handle" );
+	    __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+	    }
 	CompleteDeviceEventNotification(aEvent);
+	OstTraceFunctionExit0( CFDFSESSION_DEVICEEVENT_EXIT );
 	}
 
 void CFdfSession::CompleteDeviceEventNotification(const TDeviceEvent& aEvent)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CFDFSESSION_COMPLETEDEVICEEVENTNOTIFICATION_ENTRY );
+	
 
 	TRAPD(err, CompleteDeviceEventNotificationL(aEvent));
 	if ( err )
 		{
-		PANIC_MSG(iNotifyDeviceEventMsg, KUsbFdfServerName, EBadNotifyDeviceEventData);
+        OstTrace0( TRACE_FATAL, CFDFSESSION_COMPLETEDEVICEEVENTNOTIFICATION, 
+                "CompleteDeviceEventNotificationL error" );
+		iNotifyDeviceEventMsg.Panic( KUsbFdfServerName, 
+		        EBadNotifyDeviceEventData);
 		}
+	OstTraceFunctionExit0( CFDFSESSION_COMPLETEDEVICEEVENTNOTIFICATION_EXIT );
 	}
 
 void CFdfSession::CompleteDeviceEventNotificationL(const TDeviceEvent& aEvent)
 	{
-	LOG_FUNC
-
+    OstTraceFunctionEntry0( CFDFSESSION_COMPLETEDEVICEEVENTNOTIFICATIONL_ENTRY );
+	
 	// iNotifyDeviceEventMsg has one IPC arg: a TDeviceEventInformation
-
-	ASSERT_DEBUG(iNotifyDeviceEventMsg.Handle());
+	if(!iNotifyDeviceEventMsg.Handle())
+	    {
+	    OstTrace0( TRACE_FATAL, CFDFSESSION_COMPLETEDEVICEEVENTNOTIFICATIONL, 
+            "Empty iNotifyDeviceEventMsg.Handle" );
+	    __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+	    }
 
 	TPckg<TDeviceEventInformation> info(aEvent.iInfo);
 	iNotifyDeviceEventMsg.WriteL(0, info);
 
 	CompleteClient(iNotifyDeviceEventMsg, KErrNone);
+	OstTraceFunctionExit0( CFDFSESSION_COMPLETEDEVICEEVENTNOTIFICATIONL_EXIT );
 	}
 
 TBool CFdfSession::NotifyDevmonEventOutstanding() const
 	{
 	const TBool ret = ( iNotifyDevmonEventMsg.Handle() != 0 );
-	LOGTEXT2(_L("CFdfSession::NotifyDevmonEventOutstanding returning %d"), ret);
+	OstTrace1( TRACE_NORMAL, CFDFSESSION_NOTIFYDEVMONEVENTOUTSTANDING, 
+	        "CFdfSession::NotifyDevmonEventOutstanding returning %d", ret );
 	return ret;
 	}
 
 void CFdfSession::NotifyDevmonEvent(const RMessage2& aMessage)
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CFDFSESSION_NOTIFYDEVMONEVENT_ENTRY );
+	
 	if ( iNotifyDevmonEventMsg.Handle() )
 		{
-		PANIC_MSG(iNotifyDevmonEventMsg, KUsbFdfServerName, ENotifyDevmonEventAlreadyOutstanding);
+        OstTrace0( TRACE_FATAL, CFDFSESSION_NOTIFYDEVMONEVENT, 
+	              "iNotifyDevmonEventMsg.Handle should empty" );
+		iNotifyDevmonEventMsg.Panic( KUsbFdfServerName, 
+		        ENotifyDevmonEventAlreadyOutstanding);
+		        
 		}
 	else
 		{
@@ -280,59 +360,80 @@
 			CompleteDevmonEventNotification(event);
 			}
 		}
+	OstTraceFunctionExit0( CFDFSESSION_NOTIFYDEVMONEVENT_EXIT );
 	}
 
 void CFdfSession::NotifyDevmonEventCancel(const RMessage2& aMessage)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CFDFSESSION_NOTIFYDEVMONEVENTCANCEL_ENTRY );
+	
 
 	if ( iNotifyDevmonEventMsg.Handle() )
 		{
 		CompleteClient(iNotifyDevmonEventMsg, KErrCancel);
 		}
 	CompleteClient(aMessage, KErrNone);
+	OstTraceFunctionExit0( CFDFSESSION_NOTIFYDEVMONEVENTCANCEL_EXIT );
 	}
 
 void CFdfSession::DevmonEvent(TInt aError)
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CFDFSESSION_DEVMONEVENT_ENTRY );
+	
 	// This function should only be called if there is a request outstanding.
-	ASSERT_DEBUG(iNotifyDevmonEventMsg.Handle());
+	
+	
+	if(!iNotifyDevmonEventMsg.Handle())
+	    {
+	    OstTrace0( TRACE_FATAL, CFDFSESSION_DEVMONEVENT, 
+	                "Empty iNotifyDevmonEventMsg.Handle()" );
+	    __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+	    }
 
 	CompleteDevmonEventNotification(aError);
+	OstTraceFunctionExit0( CFDFSESSION_DEVMONEVENT_EXIT );
 	}
 
 void CFdfSession::CompleteDevmonEventNotification(TInt aError)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CFDFSESSION_COMPLETEDEVMONEVENTNOTIFICATION_ENTRY );
+	
 
 	TRAPD(err, CompleteDevmonEventNotificationL(aError));
 	if ( err )
 		{
-		PANIC_MSG(iNotifyDevmonEventMsg, KUsbFdfServerName, EBadNotifyDevmonEventData);
+        OstTrace0( TRACE_FATAL, CFDFSESSION_COMPLETEDEVMONEVENTNOTIFICATION, 
+	              "Bad Notify Devmon Event Data" );
+		iNotifyDevmonEventMsg.Panic(KUsbFdfServerName, 
+		        EBadNotifyDevmonEventData);
 		}
+	OstTraceFunctionExit0( CFDFSESSION_COMPLETEDEVMONEVENTNOTIFICATION_EXIT );
 	}
 
 void CFdfSession::CompleteDevmonEventNotificationL(TInt aEvent)
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CFDFSESSION_COMPLETEDEVMONEVENTNOTIFICATIONL_ENTRY );
+	
 	// iNotifyDevmonEventMsg has the following IPC args:
 	// 0- TInt& aError
-
-	ASSERT_DEBUG(iNotifyDevmonEventMsg.Handle());
+	if(!iNotifyDevmonEventMsg.Handle())
+	    {
+	    OstTrace0( TRACE_FATAL, CFDFSESSION_COMPLETEDEVMONEVENTNOTIFICATIONL, 
+	              "Empty iNotifyDevmonEventMsg.Handle" );
+	    __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+	    }
 
 	TPckg<TInt> event(aEvent);
 	iNotifyDevmonEventMsg.WriteL(0, event);
 
 	CompleteClient(iNotifyDevmonEventMsg, KErrNone);
+	OstTraceFunctionExit0( CFDFSESSION_COMPLETEDEVMONEVENTNOTIFICATIONL_EXIT );
 	}
 
 void CFdfSession::GetSingleSupportedLanguageOrNumberOfSupportedLanguages(const RMessage2& aMessage)
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGES_ENTRY );
+	
 	// To save IPC operations between client and server, we make use of the
 	// fact that the majority of devices only support a single language.
 	// The client is expected to have a buffer big enough to hold a single
@@ -348,30 +449,37 @@
 	// them all.
 	TRAPD(err, GetSingleSupportedLanguageOrNumberOfSupportedLanguagesL(aMessage));
 	CompleteClient(aMessage, err);
+	OstTraceFunctionExit0( CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGES_EXIT );
 	}
 
 void CFdfSession::GetSingleSupportedLanguageOrNumberOfSupportedLanguagesL(const RMessage2& aMessage)
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGESL_ENTRY );
+	
 	const TUint deviceId = aMessage.Int0();
-	LOGTEXT2(_L8("\tdeviceId = %d"), deviceId);
+	OstTrace1( TRACE_NORMAL, CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGESL, 
+	        "deviceId = %d", deviceId );
 	const RArray<TUint>& langIds = iFdf.GetSupportedLanguagesL(deviceId);
 	const TUint count = langIds.Count();
-	LOGTEXT2(_L8("\tcount = %d"), count);
+	OstTrace1( TRACE_NORMAL, CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGESL_DUP1, 
+	        "count = %d", count );
 	switch ( count )
 		{
 	case 0:
 		// Nothing to write to the client's address space, complete with
-		LEAVEL(KErrNotFound);
-		break;
+	    OstTrace0( TRACE_NORMAL, CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGESL_DUP2, 
+                "Nothing to write to the client's address space" );
+		User::Leave(KErrNotFound);
+	    break;
 
 	case 1:
 		{
 		// Write the single supported language to the client, complete with
 		// KErrNone (or error of course, if their buffer isn't big enough).
 		TPckg<TUint> buf(langIds[0]);
-		LEAVEIFERRORL(aMessage.Write(1, buf));
+		TInt err=aMessage.Write(1, buf);
+		LEAVEIFERRORL(err,OstTrace1( TRACE_ERROR, CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGESL_DUP3, 
+                "aMessage.Write with err: %d", err ););
 		}
 		break;
 
@@ -382,31 +490,40 @@
 		// This is the point at which this mechanism depends on
 		// RMessagePtr2::WriteL itself not leaving with KErrTooBig!
 		TPckg<TUint> buf(count);
-		LEAVEIFERRORL(aMessage.Write(1, buf));
-		LEAVEL(KErrTooBig);
+		TInt error=aMessage.Write(1, buf);
+		
+		LEAVEIFERRORL(error, OstTrace1( TRACE_ERROR, CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGESL_DUP4, 
+                "aMessage.Write with err: %d", error ););
+		OstTrace0( TRACE_ERROR, CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGESL_DUP5, 
+                "message error too big" );
+		User::Leave(KErrTooBig);
 		}
 		break;
 		}
+	OstTraceFunctionExit0( CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGESL_EXIT );
 	}
 
 void CFdfSession::GetSupportedLanguages(const RMessage2& aMessage)
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CFDFSESSION_GETSUPPORTEDLANGUAGES_ENTRY );
+	
 	TRAPD(err, GetSupportedLanguagesL(aMessage));
 	CompleteClient(aMessage, err);
+	OstTraceFunctionExit0( CFDFSESSION_GETSUPPORTEDLANGUAGES_EXIT );
 	}
 
 void CFdfSession::GetSupportedLanguagesL(const RMessage2& aMessage)
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CFDFSESSION_GETSUPPORTEDLANGUAGESL_ENTRY );
+	
 	const TUint deviceId = aMessage.Int0();
-	LOGTEXT2(_L8("\tdeviceId = %d"), deviceId);
+	OstTrace1( TRACE_NORMAL, CFDFSESSION_GETSUPPORTEDLANGUAGESL, 
+	        "deviceId = %d", deviceId );
 	const RArray<TUint>& langIds = iFdf.GetSupportedLanguagesL(deviceId);
 
 	const TUint count = langIds.Count();
-	LOGTEXT2(_L8("\tcount = %d"), count);
+	OstTrace1( TRACE_NORMAL, CFDFSESSION_GETSUPPORTEDLANGUAGESL_DUP1, 
+	        "count = %d", count );
 	RBuf8 buf;
 	buf.CreateL(count * sizeof(TUint));
 	CleanupClosePushL(buf);
@@ -416,38 +533,50 @@
 		}
 
 	// Write back to the client.
-	LEAVEIFERRORL(aMessage.Write(1, buf));
+	TInt err=aMessage.Write(1, buf);
+	LEAVEIFERRORL(err,OstTrace1( TRACE_ERROR, CFDFSESSION_GETSUPPORTEDLANGUAGESL_DUP2, 
+            "aMessage.Write with error: %d", err ););
 	CleanupStack::PopAndDestroy(&buf);
+	OstTraceFunctionExit0( CFDFSESSION_GETSUPPORTEDLANGUAGESL_EXIT );
 	}
 
 void CFdfSession::GetManufacturerStringDescriptor(const RMessage2& aMessage)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CFDFSESSION_GETMANUFACTURERSTRINGDESCRIPTOR_ENTRY );
+	
 
 	GetStringDescriptor(aMessage, EManufacturer);
+	OstTraceFunctionExit0( CFDFSESSION_GETMANUFACTURERSTRINGDESCRIPTOR_EXIT );
 	}
 
 void CFdfSession::GetProductStringDescriptor(const RMessage2& aMessage)
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry0( CFDFSESSION_GETPRODUCTSTRINGDESCRIPTOR_ENTRY );
+    
 
 	GetStringDescriptor(aMessage, EProduct);
+	OstTraceFunctionExit0( CFDFSESSION_GETPRODUCTSTRINGDESCRIPTOR_EXIT );
 	}
 
 void CFdfSession::GetStringDescriptor(const RMessage2& aMessage, TStringType aStringType)
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CFDFSESSION_GETSTRINGDESCRIPTOR_ENTRY );
+	
 	TRAPD(err, GetStringDescriptorL(aMessage, aStringType));
 	CompleteClient(aMessage, err);
+	OstTraceFunctionExit0( CFDFSESSION_GETSTRINGDESCRIPTOR_EXIT );
 	}
 
 void CFdfSession::GetStringDescriptorL(const RMessage2& aMessage, TStringType aStringType)
 	{
-	LOG_FUNC
-
-	ASSERT_DEBUG(aStringType == EManufacturer || aStringType == EProduct);
-
+	OstTraceFunctionEntry0( CFDFSESSION_GETSTRINGDESCRIPTORL_ENTRY );
+	
+	if(!(aStringType == EManufacturer || aStringType == EProduct))
+	    {
+	    OstTrace0( TRACE_FATAL, CFDFSESSION_GETSTRINGDESCRIPTORL, 
+	                    "String Type error" );
+	    __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__));
+	    }
 	TName string;
 	const TUint deviceId = aMessage.Int0();
 	const TUint langId = aMessage.Int1();
@@ -459,13 +588,18 @@
 		{
 		iFdf.GetProductStringDescriptorL(deviceId, langId, string);
 		}
-	LOGTEXT2(_L("\tstring = \"%S\""), &string);
-	LEAVEIFERRORL(aMessage.Write(2, string));
+	OstTraceExt1( TRACE_NORMAL, CFDFSESSION_GETSTRINGDESCRIPTORL_DUP1, 
+	        "string = \"%S\"", string );
+
+	TInt err=aMessage.Write(2, string);
+	LEAVEIFERRORL(err,OstTrace1( TRACE_ERROR, CFDFSESSION_GETSTRINGDESCRIPTORL_DUP2, 
+	        "Message write with err: %d", err ););
+	OstTraceFunctionExit0( CFDFSESSION_GETSTRINGDESCRIPTORL_EXIT );
 	}
 
 void CFdfSession::GetOtgDeviceDescriptor(const RMessage2& aMessage)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CFDFSESSION_GETOTGDEVICEDESCRIPTOR_ENTRY );
 	
 	TOtgDescriptor otgDesc;
 	const TUint deviceId = aMessage.Int0();
@@ -476,4 +610,5 @@
 		err = aMessage.Write(1, buf);
 		}
 	CompleteClient(aMessage, err);
+	OstTraceFunctionExit0( CFDFSESSION_GETOTGDEVICEDESCRIPTOR_EXIT );
 	}
--- a/usbmgmt/usbmgr/host/fdf/production/server/src/main.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/server/src/main.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
@@ -23,16 +23,18 @@
 #include <e32base.h>
 #include "fdfserver.h"
 #include <usb/usblogger.h>
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "mainTraces.h"
+#endif
+
 
 static void RunFdfL();
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "fdf      ");
-#endif
 
 GLDEF_C TInt E32Main()
 	{
-	LOGTEXT(_L8(">>E32Main"));
+    OstTrace0( TRACE_NORMAL, FDF_SERVER_SRC_E32MAIN, ">>E32Main" );
 
 	TInt ret = KErrNoMemory;
 
@@ -43,22 +45,17 @@
 	if ( cleanup )
 		{
 		// Create the logger object
-#ifdef __FLOG_ACTIVE
-		(void)CUsbLog::Connect();
-#endif
 
 		TRAP(ret, RunFdfL());
 
-#ifdef __FLOG_ACTIVE
-		CUsbLog::Close();
-#endif
 
 		delete cleanup;
 		}
 
 	__UHEAP_MARKEND;
 
-	LOGTEXT2(_L8("<<E32Main ret = %d"), ret);
+	OstTrace1( TRACE_NORMAL, FDF_SERVER_SRC_E32MAIN_DUP1, 
+	        "<<E32Main ret = %d", ret );
 	return ret;
 	}
 
--- a/usbmgmt/usbmgr/host/fdf/production/server/src/utils.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/production/server/src/utils.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
@@ -22,16 +22,13 @@
 
 #include "utils.h"
 #include <usb/usblogger.h>
-
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "fdf      ");
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "utilsTraces.h"
 #endif
 
-#ifdef __FLOG_ACTIVE
+
 #define LOG Log()
-#else
-#define LOG
-#endif
 
 //*****************************************************************************
 // Code relating to the cleanup stack item which 'Remove's a given TUint from 
@@ -49,8 +46,8 @@
 
 void Remove(TAny* aArrayRemove)
 	{
-	LOG_STATIC_FUNC_ENTRY
-
+	OstTraceFunctionEntry0( FDF_UTILS_REMOVE_ENTRY );
+	
 	TArrayRemove* arrayRemove = reinterpret_cast<TArrayRemove*>(aArrayRemove);
 
 	const TUint count = arrayRemove->iDeviceIds.Count();
@@ -58,11 +55,12 @@
 		{
 		if ( arrayRemove->iDeviceIds[ii] == arrayRemove->iDeviceId )
 			{
-			LOGTEXT(_L8("\tmatching device id"));
+            OstTrace0( TRACE_NORMAL, FDF_UTILS_REMOVE, "::matching device id" );
 			arrayRemove->iDeviceIds.Remove(ii);
 			break;
 			}
 		}
+	OstTraceFunctionExit0( FDF_UTILS_REMOVE_EXIT );
 	}
 
 void CleanupRemovePushL(TArrayRemove& aArrayRemove)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/fdf/production/server/traces/OstTraceDefinitions.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,7 @@
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <opensystemtrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/fdf/production/server/traces/fixed_id.definitions	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,620 @@
+#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt.
+[GROUP]TRACE_DUMP=0x89
+[GROUP]TRACE_ERROR=0x82
+[GROUP]TRACE_FATAL=0x81
+[GROUP]TRACE_FLOW=0x8a
+[GROUP]TRACE_NORMAL=0x86
+[TRACE]TRACE_DUMP[0x89]_CDEVICEPROXY_LOG=0x1
+[TRACE]TRACE_DUMP[0x89]_CDEVICEPROXY_LOG_DUP1=0x2
+[TRACE]TRACE_DUMP[0x89]_CDEVICEPROXY_LOG_DUP2=0x3
+[TRACE]TRACE_DUMP[0x89]_CDEVICEPROXY_LOG_DUP3=0x4
+[TRACE]TRACE_DUMP[0x89]_CDEVICEPROXY_LOG_DUP4=0x5
+[TRACE]TRACE_DUMP[0x89]_CDEVICEPROXY_LOG_DUP5=0x6
+[TRACE]TRACE_DUMP[0x89]_CEVENTQUEUE_LOG=0xf
+[TRACE]TRACE_DUMP[0x89]_CEVENTQUEUE_LOG_DUP1=0x10
+[TRACE]TRACE_DUMP[0x89]_CFDCPROXY_CONSTRUCTL=0x12
+[TRACE]TRACE_DUMP[0x89]_CFDCPROXY_CONSTRUCTL_DUP1=0x13
+[TRACE]TRACE_DUMP[0x89]_CFDCPROXY_CONSTRUCTL_DUP2=0x14
+[TRACE]TRACE_DUMP[0x89]_CFDCPROXY_CONSTRUCTL_DUP3=0x15
+[TRACE]TRACE_DUMP[0x89]_CFDCPROXY_CONSTRUCTL_DUP4=0x16
+[TRACE]TRACE_DUMP[0x89]_CFDCPROXY_CONSTRUCTL_DUP5=0x17
+[TRACE]TRACE_DUMP[0x89]_CFDCPROXY_CONSTRUCTL_DUP6=0x18
+[TRACE]TRACE_DUMP[0x89]_CFDCPROXY_CONSTRUCTL_DUP7=0x19
+[TRACE]TRACE_DUMP[0x89]_CFDCPROXY_CONSTRUCTL_DUP8=0x1a
+[TRACE]TRACE_DUMP[0x89]_CFDCPROXY_LOG=0x1b
+[TRACE]TRACE_DUMP[0x89]_CFDCPROXY_LOG_DUP1=0x1c
+[TRACE]TRACE_DUMP[0x89]_CFDCPROXY_LOG_DUP2=0x1d
+[TRACE]TRACE_DUMP[0x89]_CFDCPROXY_LOG_DUP3=0x1e
+[TRACE]TRACE_DUMP[0x89]_CFDCPROXY_LOG_DUP4=0x1f
+[TRACE]TRACE_DUMP[0x89]_CFDF_DODRIVERLOADINGL_DUP2=0x38
+[TRACE]TRACE_DUMP[0x89]_CFDF_DODRIVERLOADINGL_DUP3=0x39
+[TRACE]TRACE_DUMP[0x89]_CFDF_DODRIVERLOADINGL_DUP4=0x3a
+[TRACE]TRACE_DUMP[0x89]_CFDF_HANDLEDEVICEATTACHMENTL_DUP1=0x20
+[TRACE]TRACE_DUMP[0x89]_CFDF_HANDLEDEVICEATTACHMENTL_DUP10=0x29
+[TRACE]TRACE_DUMP[0x89]_CFDF_HANDLEDEVICEATTACHMENTL_DUP11=0x2a
+[TRACE]TRACE_DUMP[0x89]_CFDF_HANDLEDEVICEATTACHMENTL_DUP12=0x2b
+[TRACE]TRACE_DUMP[0x89]_CFDF_HANDLEDEVICEATTACHMENTL_DUP14=0x2d
+[TRACE]TRACE_DUMP[0x89]_CFDF_HANDLEDEVICEATTACHMENTL_DUP15=0x32
+[TRACE]TRACE_DUMP[0x89]_CFDF_HANDLEDEVICEATTACHMENTL_DUP16=0x2e
+[TRACE]TRACE_DUMP[0x89]_CFDF_HANDLEDEVICEATTACHMENTL_DUP17=0x2f
+[TRACE]TRACE_DUMP[0x89]_CFDF_HANDLEDEVICEATTACHMENTL_DUP18=0x30
+[TRACE]TRACE_DUMP[0x89]_CFDF_HANDLEDEVICEATTACHMENTL_DUP19=0x31
+[TRACE]TRACE_DUMP[0x89]_CFDF_HANDLEDEVICEATTACHMENTL_DUP2=0x21
+[TRACE]TRACE_DUMP[0x89]_CFDF_HANDLEDEVICEATTACHMENTL_DUP20=0x33
+[TRACE]TRACE_DUMP[0x89]_CFDF_HANDLEDEVICEATTACHMENTL_DUP24=0x34
+[TRACE]TRACE_DUMP[0x89]_CFDF_HANDLEDEVICEATTACHMENTL_DUP25=0x35
+[TRACE]TRACE_DUMP[0x89]_CFDF_HANDLEDEVICEATTACHMENTL_DUP27=0x36
+[TRACE]TRACE_DUMP[0x89]_CFDF_HANDLEDEVICEATTACHMENTL_DUP3=0x22
+[TRACE]TRACE_DUMP[0x89]_CFDF_HANDLEDEVICEATTACHMENTL_DUP35=0x37
+[TRACE]TRACE_DUMP[0x89]_CFDF_HANDLEDEVICEATTACHMENTL_DUP4=0x23
+[TRACE]TRACE_DUMP[0x89]_CFDF_HANDLEDEVICEATTACHMENTL_DUP5=0x24
+[TRACE]TRACE_DUMP[0x89]_CFDF_HANDLEDEVICEATTACHMENTL_DUP6=0x25
+[TRACE]TRACE_DUMP[0x89]_CFDF_HANDLEDEVICEATTACHMENTL_DUP7=0x26
+[TRACE]TRACE_DUMP[0x89]_CFDF_HANDLEDEVICEATTACHMENTL_DUP8=0x27
+[TRACE]TRACE_DUMP[0x89]_CFDF_HANDLEDEVICEATTACHMENTL_DUP9=0x28
+[TRACE]TRACE_DUMP[0x89]_CFDF_PARSEL=0x3b
+[TRACE]TRACE_DUMP[0x89]_CFDF_PARSEL_DUP1=0x3c
+[TRACE]TRACE_DUMP[0x89]_CFDF_PARSEL_DUP10=0x45
+[TRACE]TRACE_DUMP[0x89]_CFDF_PARSEL_DUP11=0x46
+[TRACE]TRACE_DUMP[0x89]_CFDF_PARSEL_DUP12=0x47
+[TRACE]TRACE_DUMP[0x89]_CFDF_PARSEL_DUP2=0x3d
+[TRACE]TRACE_DUMP[0x89]_CFDF_PARSEL_DUP3=0x3e
+[TRACE]TRACE_DUMP[0x89]_CFDF_PARSEL_DUP4=0x3f
+[TRACE]TRACE_DUMP[0x89]_CFDF_PARSEL_DUP5=0x40
+[TRACE]TRACE_DUMP[0x89]_CFDF_PARSEL_DUP6=0x41
+[TRACE]TRACE_DUMP[0x89]_CFDF_PARSEL_DUP7=0x42
+[TRACE]TRACE_DUMP[0x89]_CFDF_PARSEL_DUP8=0x43
+[TRACE]TRACE_DUMP[0x89]_CFDF_PARSEL_DUP9=0x44
+[TRACE]TRACE_DUMP[0x89]_DUP1_CEVENTQUEUE_LOG_DUP2=0x11
+[TRACE]TRACE_DUMP[0x89]_TDEVICEEVENT_LOG=0x7
+[TRACE]TRACE_DUMP[0x89]_TDEVICEEVENT_LOG_DUP1=0x8
+[TRACE]TRACE_DUMP[0x89]_TDEVICEEVENT_LOG_DUP2=0x9
+[TRACE]TRACE_DUMP[0x89]_TDEVICEEVENT_LOG_DUP3=0xa
+[TRACE]TRACE_DUMP[0x89]_TDEVICEEVENT_LOG_DUP4=0xb
+[TRACE]TRACE_DUMP[0x89]_TDEVICEEVENT_LOG_DUP5=0xc
+[TRACE]TRACE_DUMP[0x89]_TDEVICEEVENT_LOG_DUP6=0xd
+[TRACE]TRACE_DUMP[0x89]_TDEVICEEVENT_LOG_DUP7=0xe
+[TRACE]TRACE_ERROR[0x82]_CDEVICEPROXY_READSTRINGDESCRIPTORSL_DUP6=0x6
+[TRACE]TRACE_ERROR[0x82]_CDEVICEPROXY_READSTRINGDESCRIPTORSL_DUP7=0x7
+[TRACE]TRACE_ERROR[0x82]_CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGESL_DUP3=0x1
+[TRACE]TRACE_ERROR[0x82]_CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGESL_DUP4=0x2
+[TRACE]TRACE_ERROR[0x82]_CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGESL_DUP5=0x3
+[TRACE]TRACE_ERROR[0x82]_CFDFSESSION_GETSTRINGDESCRIPTORL_DUP2=0x5
+[TRACE]TRACE_ERROR[0x82]_CFDFSESSION_GETSUPPORTEDLANGUAGESL_DUP2=0x4
+[TRACE]TRACE_FATAL[0x81]_CACTIVEWAITFORECOMEVENT_RUNERROR=0x4b
+[TRACE]TRACE_FATAL[0x81]_CDEVICEPROXY_GETATTACHMENTEVENTOBJECT_DUP1=0xd
+[TRACE]TRACE_FATAL[0x81]_CDEVICEPROXY_GETCONFIGURATIONDESCRIPTOR=0x17
+[TRACE]TRACE_FATAL[0x81]_CDEVICEPROXY_GETDETACHMENTEVENTOBJECT=0xf
+[TRACE]TRACE_FATAL[0x81]_CDEVICEPROXY_GETDEVICEDESCRIPTOR_DUP1=0x7
+[TRACE]TRACE_FATAL[0x81]_CDEVICEPROXY_GETDRIVERLOADINGEVENTOBJECT=0xe
+[TRACE]TRACE_FATAL[0x81]_CDEVICEPROXY_GETSTRINGDESCRIPTORFROMUSBDL_DUP2=0xa
+[TRACE]TRACE_FATAL[0x81]_CDEVICEPROXY_GETTOKENFORINTERFACE_DUP1=0x9
+[TRACE]TRACE_FATAL[0x81]_CDEVICEPROXY_READSTRINGDESCRIPTORSL_DUP1=0x1
+[TRACE]TRACE_FATAL[0x81]_CDEVICEPROXY_READSTRINGDESCRIPTORSL_DUP2=0x3
+[TRACE]TRACE_FATAL[0x81]_CDEVICEPROXY_READSTRINGDESCRIPTORSL_DUP3=0x4
+[TRACE]TRACE_FATAL[0x81]_CDEVICEPROXY_READSTRINGDESCRIPTORSL_DUP4=0x5
+[TRACE]TRACE_FATAL[0x81]_CDEVICEPROXY_READSTRINGDESCRIPTORSL_DUP5=0x6
+[TRACE]TRACE_FATAL[0x81]_CDEVICEPROXY_SETDRIVERLOADINGEVENTDATA_DUP1=0xc
+[TRACE]TRACE_FATAL[0x81]_CDEVICEPROXY_SUSPEND_DUP1=0xb
+[TRACE]TRACE_FATAL[0x81]_CEVENTQUEUE_ADDDEVMONEVENT_DUP1=0x4d
+[TRACE]TRACE_FATAL[0x81]_CEVENTQUEUE_ADDDEVMONEVENT_DUP2=0x4e
+[TRACE]TRACE_FATAL[0x81]_CEVENTQUEUE_GETDEVICEEVENT=0x10
+[TRACE]TRACE_FATAL[0x81]_CEVENTQUEUE_GETDEVMONEVENT=0x4c
+[TRACE]TRACE_FATAL[0x81]_CFDCPROXY_CFDCPROXY_DUP2=0x11
+[TRACE]TRACE_FATAL[0x81]_CFDCPROXY_CFDCPROXY_DUP3=0x12
+[TRACE]TRACE_FATAL[0x81]_CFDCPROXY_DEVICEDETACHED_DUP1=0x26
+[TRACE]TRACE_FATAL[0x81]_CFDCPROXY_INVARIANT=0x27
+[TRACE]TRACE_FATAL[0x81]_CFDCPROXY_INVARIANT_DUP1=0x28
+[TRACE]TRACE_FATAL[0x81]_CFDCPROXY_MFPOTOKENFORINTERFACE=0x4f
+[TRACE]TRACE_FATAL[0x81]_CFDCPROXY_NEWFUNCTIONL_DUP10=0x1c
+[TRACE]TRACE_FATAL[0x81]_CFDCPROXY_NEWFUNCTIONL_DUP3=0x18
+[TRACE]TRACE_FATAL[0x81]_CFDCPROXY_NEWFUNCTIONL_DUP6=0x19
+[TRACE]TRACE_FATAL[0x81]_CFDCPROXY_NEWFUNCTIONL_DUP7=0x1a
+[TRACE]TRACE_FATAL[0x81]_CFDCPROXY_NEWFUNCTIONL_DUP9=0x1b
+[TRACE]TRACE_FATAL[0x81]_CFDFSERVER_NEWSESSIONL_DUP4=0x3e
+[TRACE]TRACE_FATAL[0x81]_CFDFSERVER_SESSIONCLOSED=0x3f
+[TRACE]TRACE_FATAL[0x81]_CFDFSESSION_COMPLETEDEVICEEVENTNOTIFICATION=0x43
+[TRACE]TRACE_FATAL[0x81]_CFDFSESSION_COMPLETEDEVICEEVENTNOTIFICATIONL=0x44
+[TRACE]TRACE_FATAL[0x81]_CFDFSESSION_COMPLETEDEVMONEVENTNOTIFICATION=0x47
+[TRACE]TRACE_FATAL[0x81]_CFDFSESSION_COMPLETEDEVMONEVENTNOTIFICATIONL=0x48
+[TRACE]TRACE_FATAL[0x81]_CFDFSESSION_DEVICEEVENT=0x42
+[TRACE]TRACE_FATAL[0x81]_CFDFSESSION_DEVMONEVENT=0x46
+[TRACE]TRACE_FATAL[0x81]_CFDFSESSION_GETSTRINGDESCRIPTORL=0x49
+[TRACE]TRACE_FATAL[0x81]_CFDFSESSION_NOTIFYDEVICEEVENT=0x41
+[TRACE]TRACE_FATAL[0x81]_CFDFSESSION_NOTIFYDEVMONEVENT=0x45
+[TRACE]TRACE_FATAL[0x81]_CFDFSESSION_SERVICEL_DUP1=0x50
+[TRACE]TRACE_FATAL[0x81]_CFDFSESSION_SERVICEL_DUP12=0x40
+[TRACE]TRACE_FATAL[0x81]_CFDFSESSION_SERVICEL_DUP2=0x51
+[TRACE]TRACE_FATAL[0x81]_CFDFSESSION_SERVICEL_DUP3=0x52
+[TRACE]TRACE_FATAL[0x81]_CFDFSESSION_SERVICEL_DUP4=0x53
+[TRACE]TRACE_FATAL[0x81]_CFDFSESSION_SERVICEL_DUP5=0x54
+[TRACE]TRACE_FATAL[0x81]_CFDFSESSION_SERVICEL_DUP6=0x55
+[TRACE]TRACE_FATAL[0x81]_CFDFSESSION_SERVICEL_DUP7=0x56
+[TRACE]TRACE_FATAL[0x81]_CFDFSESSION_SERVICEL_DUP8=0x57
+[TRACE]TRACE_FATAL[0x81]_CFDFSESSION_SERVICEL_DUP9=0x58
+[TRACE]TRACE_FATAL[0x81]_CFDF_CFDF_DUP3=0x29
+[TRACE]TRACE_FATAL[0x81]_CFDF_DODRIVERLOADING=0x24
+[TRACE]TRACE_FATAL[0x81]_CFDF_DODRIVERLOADINGL_DUP5=0x2f
+[TRACE]TRACE_FATAL[0x81]_CFDF_DODRIVERLOADING_DUP1=0x25
+[TRACE]TRACE_FATAL[0x81]_CFDF_FINDDRIVERFORINTERFACEUSINGSPECIFICKEY_DUP7=0x31
+[TRACE]TRACE_FATAL[0x81]_CFDF_FINDDRIVERSFORINTERFACESUSINGSPECIFICKEYL=0x30
+[TRACE]TRACE_FATAL[0x81]_CFDF_FORMATDEVICESEARCHKEY=0x3d
+[TRACE]TRACE_FATAL[0x81]_CFDF_FORMATINTERFACESEARCHKEY=0x3b
+[TRACE]TRACE_FATAL[0x81]_CFDF_GETDEVICEEVENT=0x2a
+[TRACE]TRACE_FATAL[0x81]_CFDF_GETDEVMONEVENT=0x2b
+[TRACE]TRACE_FATAL[0x81]_CFDF_HANDLEDEVICEATTACHMENTL_DUP22=0x1d
+[TRACE]TRACE_FATAL[0x81]_CFDF_HANDLEDEVICEATTACHMENTL_DUP23=0x1e
+[TRACE]TRACE_FATAL[0x81]_CFDF_HANDLEDEVICEATTACHMENTL_DUP26=0x1f
+[TRACE]TRACE_FATAL[0x81]_CFDF_HANDLEDEVICEATTACHMENTL_DUP29=0x20
+[TRACE]TRACE_FATAL[0x81]_CFDF_HANDLEDEVICEATTACHMENTL_DUP30=0x21
+[TRACE]TRACE_FATAL[0x81]_CFDF_HANDLEDEVICEATTACHMENTL_DUP33=0x22
+[TRACE]TRACE_FATAL[0x81]_CFDF_HANDLEDEVICEATTACHMENTL_DUP34=0x23
+[TRACE]TRACE_FATAL[0x81]_CFDF_HANDLEDEVICEATTACHMENT_DUP1=0x2d
+[TRACE]TRACE_FATAL[0x81]_CFDF_HANDLEDEVICEATTACHMENT_DUP2=0x2e
+[TRACE]TRACE_FATAL[0x81]_CFDF_HANDLEDEVICEDETACHMENT_DUP2=0x32
+[TRACE]TRACE_FATAL[0x81]_CFDF_HANDLEDEVICEDETACHMENT_DUP3=0x33
+[TRACE]TRACE_FATAL[0x81]_CFDF_HANDLEDEVMONEVENT_DUP1=0x4a
+[TRACE]TRACE_FATAL[0x81]_CFDF_MBEOBUSEVENT_DUP3=0x2c
+[TRACE]TRACE_FATAL[0x81]_CFDF_TOKENFORINTERFACE_DUP1=0x34
+[TRACE]TRACE_FATAL[0x81]_CFDF_TOKENFORINTERFACE_DUP2=0x35
+[TRACE]TRACE_FATAL[0x81]_CFDF_TOKENFORINTERFACE_DUP3=0x36
+[TRACE]TRACE_FATAL[0x81]_CFDF_TOKENFORINTERFACE_DUP4=0x37
+[TRACE]TRACE_FATAL[0x81]_CFDF_TOKENFORINTERFACE_DUP5=0x38
+[TRACE]TRACE_FATAL[0x81]_CFDF_UNCLAIMEDINTERFACECOUNT=0x3c
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEWAITFORBUSEVENT_CACTIVEWAITFORBUSEVENT_CONS_ENTRY=0x90
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEWAITFORBUSEVENT_CACTIVEWAITFORBUSEVENT_CONS_EXIT=0x91
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEWAITFORBUSEVENT_CACTIVEWAITFORBUSEVENT_DES_ENTRY=0x92
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEWAITFORBUSEVENT_CACTIVEWAITFORBUSEVENT_DES_EXIT=0x93
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEWAITFORBUSEVENT_DOCANCEL_ENTRY=0x9
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEWAITFORBUSEVENT_DOCANCEL_EXIT=0xa
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEWAITFORBUSEVENT_RUNL_ENTRY=0x7
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEWAITFORBUSEVENT_RUNL_EXIT=0x8
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEWAITFORBUSEVENT_WAIT_ENTRY=0x5
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEWAITFORBUSEVENT_WAIT_EXIT=0x6
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEWAITFORECOMEVENT_CACTIVEWAITFORECOMEVENT_CONS_ENTRY=0x94
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEWAITFORECOMEVENT_CACTIVEWAITFORECOMEVENT_CONS_EXIT=0x95
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEWAITFORECOMEVENT_CACTIVEWAITFORECOMEVENT_DES_ENTRY=0x96
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEWAITFORECOMEVENT_CACTIVEWAITFORECOMEVENT_DES_EXIT=0x97
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEWAITFORECOMEVENT_DOCANCEL_ENTRY=0x15
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEWAITFORECOMEVENT_DOCANCEL_EXIT=0x16
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEWAITFORECOMEVENT_RUNERROR_ENTRY=0x17
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEWAITFORECOMEVENT_RUNERROR_EXIT=0x18
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEWAITFORECOMEVENT_RUNL_ENTRY=0x13
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEWAITFORECOMEVENT_RUNL_EXIT=0x14
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEWAITFORECOMEVENT_WAIT_ENTRY=0x11
+[TRACE]TRACE_FLOW[0x8A]_CACTIVEWAITFORECOMEVENT_WAIT_EXIT=0x12
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_CDEVICEPROXY_CONS_ENTRY=0x111
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_CDEVICEPROXY_DES_ENTRY=0x98
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_CDEVICEPROXY_DES_EXIT=0x99
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_CONSTRUCTL_ENTRY=0x1c
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_CONSTRUCTL_EXIT=0x1d
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_GETATTACHMENTEVENTOBJECT_ENTRY=0x41
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_GETATTACHMENTEVENTOBJECT_EXIT=0x42
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_GETCONFIGURATIONDESCRIPTOR_ENTRY=0x26
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_GETCONFIGURATIONDESCRIPTOR_EXIT=0x27
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_GETDETACHMENTEVENTOBJECT_ENTRY=0x45
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_GETDETACHMENTEVENTOBJECT_EXIT=0x46
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_GETDEVICEDESCRIPTOR_ENTRY=0x24
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_GETDEVICEDESCRIPTOR_EXIT=0x25
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_GETDRIVERLOADINGEVENTOBJECT_ENTRY=0x43
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_GETDRIVERLOADINGEVENTOBJECT_EXIT=0x44
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_GETMANUFACTURERSTRINGDESCRIPTORL_ENTRY=0x2b
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_GETMANUFACTURERSTRINGDESCRIPTORL_EXIT=0x2c
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_GETOTGDESCRIPTORL_ENTRY=0x31
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_GETOTGDESCRIPTORL_EXIT=0x32
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_GETPRODUCTSTRINGDESCRIPTORL_ENTRY=0x2d
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_GETPRODUCTSTRINGDESCRIPTORL_EXIT=0x2e
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_GETSERIALNUMBERSTRINGDESCRIPTORL_ENTRY=0x2f
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_GETSERIALNUMBERSTRINGDESCRIPTORL_EXIT=0x30
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_GETSTRINGDESCRIPTORFROMCACHEL_ENTRY=0x3b
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_GETSTRINGDESCRIPTORFROMCACHEL_EXIT=0x3c
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_GETSTRINGDESCRIPTORFROMUSBDL_ENTRY=0x33
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_GETSTRINGDESCRIPTORFROMUSBDL_EXIT=0x34
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_GETSUPPORTEDLANGUAGES_ENTRY=0x2a
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_GETTOKENFORINTERFACE_ENTRY=0x28
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_GETTOKENFORINTERFACE_EXIT=0x29
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_LOG_DUP6=0x36
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_LOG_DUP7=0x37
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_LOG_DUP8=0x38
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_LOG_DUP9=0x39
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_LOG_ENTRY=0x35
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_LOG_EXIT=0x3a
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_NEWL_ENTRY=0x19
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_NEWL_EXIT=0x1a
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_POPULATESTRINGDESCRIPTORSL_ENTRY=0x20
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_POPULATESTRINGDESCRIPTORSL_EXIT=0x21
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_READSTRINGDESCRIPTORSL_ENTRY=0x1e
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_READSTRINGDESCRIPTORSL_EXIT=0x1f
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_SETDRIVERLOADINGEVENTDATA_ENTRY=0x3f
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_SETDRIVERLOADINGEVENTDATA_EXIT=0x40
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_SUSPEND_ENTRY=0x3d
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_SUSPEND_EXIT=0x3e
+[TRACE]TRACE_FLOW[0x8A]_CEVENTQUEUE_ADDDEVICEEVENT_ENTRY=0x51
+[TRACE]TRACE_FLOW[0x8A]_CEVENTQUEUE_ADDDEVICEEVENT_EXIT=0x52
+[TRACE]TRACE_FLOW[0x8A]_CEVENTQUEUE_ADDDEVMONEVENT_ENTRY=0x59
+[TRACE]TRACE_FLOW[0x8A]_CEVENTQUEUE_ADDDEVMONEVENT_EXIT=0x5a
+[TRACE]TRACE_FLOW[0x8A]_CEVENTQUEUE_ATTACHMENTFAILURE_ENTRY=0x4e
+[TRACE]TRACE_FLOW[0x8A]_CEVENTQUEUE_ATTACHMENTFAILURE_EXIT=0x50
+[TRACE]TRACE_FLOW[0x8A]_CEVENTQUEUE_CEVENTQUEUE_CONS_ENTRY=0x9c
+[TRACE]TRACE_FLOW[0x8A]_CEVENTQUEUE_CEVENTQUEUE_DES_ENTRY=0x9d
+[TRACE]TRACE_FLOW[0x8A]_CEVENTQUEUE_CEVENTQUEUE_DES_EXIT=0x9e
+[TRACE]TRACE_FLOW[0x8A]_CEVENTQUEUE_GETDEVICEEVENT_ENTRY=0x55
+[TRACE]TRACE_FLOW[0x8A]_CEVENTQUEUE_GETDEVICEEVENT_EXIT=0x56
+[TRACE]TRACE_FLOW[0x8A]_CEVENTQUEUE_GETDEVMONEVENT_ENTRY=0x57
+[TRACE]TRACE_FLOW[0x8A]_CEVENTQUEUE_GETDEVMONEVENT_EXIT=0x58
+[TRACE]TRACE_FLOW[0x8A]_CEVENTQUEUE_LOG_ENTRY=0x5b
+[TRACE]TRACE_FLOW[0x8A]_CEVENTQUEUE_LOG_EXIT=0x5c
+[TRACE]TRACE_FLOW[0x8A]_CEVENTQUEUE_NEWL_ENTRY=0x49
+[TRACE]TRACE_FLOW[0x8A]_CEVENTQUEUE_NEWL_EXIT=0x4a
+[TRACE]TRACE_FLOW[0x8A]_CEVENTQUEUE_POKESESSION_ENTRY=0x53
+[TRACE]TRACE_FLOW[0x8A]_CEVENTQUEUE_POKESESSION_EXIT=0x54
+[TRACE]TRACE_FLOW[0x8A]_CFDCPROXY_CFDCPROXY_CONS_ENTRY=0x9f
+[TRACE]TRACE_FLOW[0x8A]_CFDCPROXY_CFDCPROXY_DES_ENTRY=0xa0
+[TRACE]TRACE_FLOW[0x8A]_CFDCPROXY_CFDCPROXY_DES_EXIT=0xa1
+[TRACE]TRACE_FLOW[0x8A]_CFDCPROXY_CHECKDEVICEIDL_ENTRY=0x72
+[TRACE]TRACE_FLOW[0x8A]_CFDCPROXY_CHECKDEVICEIDL_EXIT=0x73
+[TRACE]TRACE_FLOW[0x8A]_CFDCPROXY_CONSTRUCTL_ENTRY=0x5f
+[TRACE]TRACE_FLOW[0x8A]_CFDCPROXY_CONSTRUCTL_EXIT=0x60
+[TRACE]TRACE_FLOW[0x8A]_CFDCPROXY_DEVICEDETACHED_ENTRY=0x68
+[TRACE]TRACE_FLOW[0x8A]_CFDCPROXY_DEVICEDETACHED_EXIT=0x69
+[TRACE]TRACE_FLOW[0x8A]_CFDCPROXY_MFPOGETMANUFACTURERSTRINGDESCRIPTOR_ENTRY=0x6c
+[TRACE]TRACE_FLOW[0x8A]_CFDCPROXY_MFPOGETMANUFACTURERSTRINGDESCRIPTOR_EXIT=0x6d
+[TRACE]TRACE_FLOW[0x8A]_CFDCPROXY_MFPOGETPRODUCTSTRINGDESCRIPTOR_ENTRY=0x6e
+[TRACE]TRACE_FLOW[0x8A]_CFDCPROXY_MFPOGETPRODUCTSTRINGDESCRIPTOR_EXIT=0x6f
+[TRACE]TRACE_FLOW[0x8A]_CFDCPROXY_MFPOGETSERIALNUMBERSTRINGDESCRIPTOR_ENTRY=0x70
+[TRACE]TRACE_FLOW[0x8A]_CFDCPROXY_MFPOGETSERIALNUMBERSTRINGDESCRIPTOR_EXIT=0x71
+[TRACE]TRACE_FLOW[0x8A]_CFDCPROXY_MFPOGETSUPPORTEDLANGUAGESL_ENTRY=0x6b
+[TRACE]TRACE_FLOW[0x8A]_CFDCPROXY_MFPOTOKENFORINTERFACE_ENTRY=0x6a
+[TRACE]TRACE_FLOW[0x8A]_CFDCPROXY_NEWFUNCTIONL_ENTRY=0x66
+[TRACE]TRACE_FLOW[0x8A]_CFDCPROXY_NEWFUNCTIONL_EXIT=0x67
+[TRACE]TRACE_FLOW[0x8A]_CFDCPROXY_NEWFUNCTION_ENTRY=0x64
+[TRACE]TRACE_FLOW[0x8A]_CFDCPROXY_NEWFUNCTION_EXIT=0x65
+[TRACE]TRACE_FLOW[0x8A]_CFDCPROXY_NEWL_ENTRY=0x5d
+[TRACE]TRACE_FLOW[0x8A]_CFDCPROXY_NEWL_EXIT=0x5e
+[TRACE]TRACE_FLOW[0x8A]_CFDFSERVER_CFDFSERVER_DES_ENTRY=0xc7
+[TRACE]TRACE_FLOW[0x8A]_CFDFSERVER_CFDFSERVER_DES_EXIT=0xc8
+[TRACE]TRACE_FLOW[0x8A]_CFDFSERVER_CONSTRUCTL_ENTRY=0xc9
+[TRACE]TRACE_FLOW[0x8A]_CFDFSERVER_CONSTRUCTL_EXIT=0xca
+[TRACE]TRACE_FLOW[0x8A]_CFDFSERVER_NEWLC_ENTRY=0xc5
+[TRACE]TRACE_FLOW[0x8A]_CFDFSERVER_NEWLC_EXIT=0xc6
+[TRACE]TRACE_FLOW[0x8A]_CFDFSERVER_NEWSESSIONL_ENTRY=0xcb
+[TRACE]TRACE_FLOW[0x8A]_CFDFSERVER_NEWSESSIONL_EXIT=0xcc
+[TRACE]TRACE_FLOW[0x8A]_CFDFSERVER_SESSIONCLOSED_ENTRY=0xcd
+[TRACE]TRACE_FLOW[0x8A]_CFDFSERVER_SESSIONCLOSED_EXIT=0xce
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_CFDFSESSION_CONS_ENTRY=0xcf
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_CFDFSESSION_CONS_EXIT=0xd0
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_CFDFSESSION_DES_ENTRY=0xd1
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_CFDFSESSION_DES_EXIT=0xd2
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_COMPLETEDEVICEEVENTNOTIFICATIONL_ENTRY=0xf1
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_COMPLETEDEVICEEVENTNOTIFICATIONL_EXIT=0xf2
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_COMPLETEDEVICEEVENTNOTIFICATION_ENTRY=0xef
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_COMPLETEDEVICEEVENTNOTIFICATION_EXIT=0xf0
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_COMPLETEDEVMONEVENTNOTIFICATIONL_ENTRY=0xfb
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_COMPLETEDEVMONEVENTNOTIFICATIONL_EXIT=0xfc
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_COMPLETEDEVMONEVENTNOTIFICATION_ENTRY=0xf9
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_COMPLETEDEVMONEVENTNOTIFICATION_EXIT=0xfa
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_DEVICEEVENT_ENTRY=0xdd
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_DEVICEEVENT_EXIT=0xde
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_DEVMONEVENT_ENTRY=0xf7
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_DEVMONEVENT_EXIT=0xf8
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_DISABLEDRIVERLOADING_ENTRY=0xd7
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_DISABLEDRIVERLOADING_EXIT=0xd8
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_ENABLEDRIVERLOADING_ENTRY=0xd5
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_ENABLEDRIVERLOADING_EXIT=0xd6
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_GETMANUFACTURERSTRINGDESCRIPTOR_ENTRY=0x105
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_GETMANUFACTURERSTRINGDESCRIPTOR_EXIT=0x106
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_GETOTGDEVICEDESCRIPTOR_ENTRY=0x10d
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_GETOTGDEVICEDESCRIPTOR_EXIT=0x10e
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_GETPRODUCTSTRINGDESCRIPTOR_ENTRY=0x107
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_GETPRODUCTSTRINGDESCRIPTOR_EXIT=0x108
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGESL_ENTRY=0xff
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGESL_EXIT=0x100
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGES_ENTRY=0xfd
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGES_EXIT=0xfe
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_GETSTRINGDESCRIPTORL_ENTRY=0x10b
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_GETSTRINGDESCRIPTORL_EXIT=0x10c
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_GETSTRINGDESCRIPTOR_ENTRY=0x109
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_GETSTRINGDESCRIPTOR_EXIT=0x10a
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_GETSUPPORTEDLANGUAGESL_ENTRY=0x103
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_GETSUPPORTEDLANGUAGESL_EXIT=0x104
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_GETSUPPORTEDLANGUAGES_ENTRY=0x101
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_GETSUPPORTEDLANGUAGES_EXIT=0x102
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_NOTIFYDEVICEEVENTCANCEL_ENTRY=0xdb
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_NOTIFYDEVICEEVENTCANCEL_EXIT=0xdc
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_NOTIFYDEVICEEVENT_ENTRY=0xd9
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_NOTIFYDEVICEEVENT_EXIT=0xda
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_NOTIFYDEVMONEVENTCANCEL_ENTRY=0xf5
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_NOTIFYDEVMONEVENTCANCEL_EXIT=0xf6
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_NOTIFYDEVMONEVENT_ENTRY=0xf3
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_NOTIFYDEVMONEVENT_EXIT=0xf4
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_SERVICEL_ENTRY=0xd3
+[TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_SERVICEL_EXIT=0xd4
+[TRACE]TRACE_FLOW[0x8A]_CFDF_CFDF_CONS_ENTRY=0xa2
+[TRACE]TRACE_FLOW[0x8A]_CFDF_CFDF_DES_ENTRY=0xa3
+[TRACE]TRACE_FLOW[0x8A]_CFDF_CFDF_DES_EXIT=0xa4
+[TRACE]TRACE_FLOW[0x8A]_CFDF_CONSTRUCTL_ENTRY=0x79
+[TRACE]TRACE_FLOW[0x8A]_CFDF_CONSTRUCTL_EXIT=0x7a
+[TRACE]TRACE_FLOW[0x8A]_CFDF_CREATEFUNCTIONDRIVERPROXIESL_ENTRY=0x7b
+[TRACE]TRACE_FLOW[0x8A]_CFDF_CREATEFUNCTIONDRIVERPROXIESL_EXIT=0x7c
+[TRACE]TRACE_FLOW[0x8A]_CFDF_DEVICEPROXYL_ENTRY=0xb3
+[TRACE]TRACE_FLOW[0x8A]_CFDF_DEVICEPROXYL_EXIT=0xb4
+[TRACE]TRACE_FLOW[0x8A]_CFDF_DEVICEPROXYL_EXIT_DUP1=0xb5
+[TRACE]TRACE_FLOW[0x8A]_CFDF_DISABLEDRIVERLOADING_ENTRY=0x80
+[TRACE]TRACE_FLOW[0x8A]_CFDF_DODRIVERLOADINGL_ENTRY=0x8e
+[TRACE]TRACE_FLOW[0x8A]_CFDF_DODRIVERLOADINGL_EXIT=0x8f
+[TRACE]TRACE_FLOW[0x8A]_CFDF_DODRIVERLOADING_ENTRY=0x8c
+[TRACE]TRACE_FLOW[0x8A]_CFDF_DODRIVERLOADING_EXIT=0x8d
+[TRACE]TRACE_FLOW[0x8A]_CFDF_ENABLEDRIVERLOADING_ENTRY=0x7f
+[TRACE]TRACE_FLOW[0x8A]_CFDF_FINDDRIVERFORINTERFACEUSINGSPECIFICKEY_ENTRY=0xa9
+[TRACE]TRACE_FLOW[0x8A]_CFDF_FINDDRIVERFORINTERFACEUSINGSPECIFICKEY_EXIT=0xaa
+[TRACE]TRACE_FLOW[0x8A]_CFDF_FINDDRIVERSFORINTERFACESUSINGSPECIFICKEYL_ENTRY=0xa7
+[TRACE]TRACE_FLOW[0x8A]_CFDF_FINDDRIVERSFORINTERFACESUSINGSPECIFICKEYL_EXIT=0xa8
+[TRACE]TRACE_FLOW[0x8A]_CFDF_FORMATDEVICESEARCHKEY_ENTRY=0xbf
+[TRACE]TRACE_FLOW[0x8A]_CFDF_FORMATDEVICESEARCHKEY_EXIT=0xc0
+[TRACE]TRACE_FLOW[0x8A]_CFDF_FORMATINTERFACESEARCHKEY_ENTRY=0xc1
+[TRACE]TRACE_FLOW[0x8A]_CFDF_FORMATINTERFACESEARCHKEY_EXIT=0xc2
+[TRACE]TRACE_FLOW[0x8A]_CFDF_GETDEVICEEVENT_ENTRY=0x82
+[TRACE]TRACE_FLOW[0x8A]_CFDF_GETDEVMONEVENT_ENTRY=0x83
+[TRACE]TRACE_FLOW[0x8A]_CFDF_GETMANUFACTURERSTRINGDESCRIPTORL_ENTRY=0xb7
+[TRACE]TRACE_FLOW[0x8A]_CFDF_GETMANUFACTURERSTRINGDESCRIPTORL_EXIT=0xb8
+[TRACE]TRACE_FLOW[0x8A]_CFDF_GETOTGDEVICEDESCRIPTORL_ENTRY=0xbb
+[TRACE]TRACE_FLOW[0x8A]_CFDF_GETOTGDEVICEDESCRIPTORL_EXIT=0xbc
+[TRACE]TRACE_FLOW[0x8A]_CFDF_GETPRODUCTSTRINGDESCRIPTORL_ENTRY=0xb9
+[TRACE]TRACE_FLOW[0x8A]_CFDF_GETPRODUCTSTRINGDESCRIPTORL_EXIT=0xba
+[TRACE]TRACE_FLOW[0x8A]_CFDF_GETSERIALNUMBERSTRINGDESCRIPTORL_ENTRY=0xbd
+[TRACE]TRACE_FLOW[0x8A]_CFDF_GETSERIALNUMBERSTRINGDESCRIPTORL_EXIT=0xbe
+[TRACE]TRACE_FLOW[0x8A]_CFDF_GETSUPPORTEDLANGUAGESL_ENTRY=0xb6
+[TRACE]TRACE_FLOW[0x8A]_CFDF_HANDLEDEVICEATTACHMENTL_ENTRY=0x8a
+[TRACE]TRACE_FLOW[0x8A]_CFDF_HANDLEDEVICEATTACHMENTL_EXIT=0x8b
+[TRACE]TRACE_FLOW[0x8A]_CFDF_HANDLEDEVICEATTACHMENT_ENTRY=0x88
+[TRACE]TRACE_FLOW[0x8A]_CFDF_HANDLEDEVICEATTACHMENT_EXIT=0x89
+[TRACE]TRACE_FLOW[0x8A]_CFDF_HANDLEDEVICEDETACHMENT_ENTRY=0xab
+[TRACE]TRACE_FLOW[0x8A]_CFDF_HANDLEDEVICEDETACHMENT_EXIT=0xac
+[TRACE]TRACE_FLOW[0x8A]_CFDF_HANDLEDEVMONEVENT_ENTRY=0xad
+[TRACE]TRACE_FLOW[0x8A]_CFDF_HANDLEDEVMONEVENT_EXIT=0xae
+[TRACE]TRACE_FLOW[0x8A]_CFDF_HANDLEECOMEVENTRECEIVEDL_ENTRY=0x84
+[TRACE]TRACE_FLOW[0x8A]_CFDF_HANDLEECOMEVENTRECEIVEDL_EXIT=0x85
+[TRACE]TRACE_FLOW[0x8A]_CFDF_MBEOBUSEVENT_ENTRY=0x86
+[TRACE]TRACE_FLOW[0x8A]_CFDF_MBEOBUSEVENT_EXIT=0x87
+[TRACE]TRACE_FLOW[0x8A]_CFDF_NEWL_ENTRY=0x76
+[TRACE]TRACE_FLOW[0x8A]_CFDF_NEWL_EXIT=0x77
+[TRACE]TRACE_FLOW[0x8A]_CFDF_PARSEL_ENTRY=0xa5
+[TRACE]TRACE_FLOW[0x8A]_CFDF_PARSEL_EXIT=0xa6
+[TRACE]TRACE_FLOW[0x8A]_CFDF_SETSESSION_ENTRY=0x81
+[TRACE]TRACE_FLOW[0x8A]_CFDF_TELLFDCSOFDEVICEDETACHMENT_ENTRY=0xaf
+[TRACE]TRACE_FLOW[0x8A]_CFDF_TELLFDCSOFDEVICEDETACHMENT_EXIT=0xb0
+[TRACE]TRACE_FLOW[0x8A]_CFDF_TINTERFACEINFO_NEWL_ENTRY=0x74
+[TRACE]TRACE_FLOW[0x8A]_CFDF_TINTERFACEINFO_NEWL_EXIT=0x75
+[TRACE]TRACE_FLOW[0x8A]_CFDF_TOKENFORINTERFACE_ENTRY=0xb1
+[TRACE]TRACE_FLOW[0x8A]_CFDF_TOKENFORINTERFACE_EXIT=0xb2
+[TRACE]TRACE_FLOW[0x8A]_CFDF_UNCLAIMEDINTERFACECOUNT_ENTRY=0xc3
+[TRACE]TRACE_FLOW[0x8A]_CFDF_UNCLAIMEDINTERFACECOUNT_EXIT=0xc4
+[TRACE]TRACE_FLOW[0x8A]_FDF_UTILS_REMOVE_ENTRY=0x10f
+[TRACE]TRACE_FLOW[0x8A]_FDF_UTILS_REMOVE_EXIT=0x110
+[TRACE]TRACE_FLOW[0x8A]_TDEVICEEVENT_TDEVICEEVENT_CONS_ENTRY=0x9a
+[TRACE]TRACE_FLOW[0x8A]_TDEVICEEVENT_TDEVICEEVENT_DES_ENTRY=0x9b
+[TRACE]TRACE_NORMAL[0x86]_CACTIVEWAITFORBUSEVENT_RUNL=0x1
+[TRACE]TRACE_NORMAL[0x86]_CDEVICEPROXY_CONSTRUCTL=0x6d
+[TRACE]TRACE_NORMAL[0x86]_CDEVICEPROXY_GETATTACHMENTEVENTOBJECT=0x11
+[TRACE]TRACE_NORMAL[0x86]_CDEVICEPROXY_GETCONFIGURATIONDESCRIPTOR_DUP1=0x2a
+[TRACE]TRACE_NORMAL[0x86]_CDEVICEPROXY_GETDETACHMENTEVENTOBJECT_DUP1=0x14
+[TRACE]TRACE_NORMAL[0x86]_CDEVICEPROXY_GETDEVICEDESCRIPTOR=0x4
+[TRACE]TRACE_NORMAL[0x86]_CDEVICEPROXY_GETDRIVERLOADINGEVENTOBJECT_DUP1=0x13
+[TRACE]TRACE_NORMAL[0x86]_CDEVICEPROXY_GETOTGDESCRIPTORL=0x7
+[TRACE]TRACE_NORMAL[0x86]_CDEVICEPROXY_GETSTRINGDESCRIPTORFROMCACHEL=0x9
+[TRACE]TRACE_NORMAL[0x86]_CDEVICEPROXY_GETSTRINGDESCRIPTORFROMCACHEL_DUP1=0xd
+[TRACE]TRACE_NORMAL[0x86]_CDEVICEPROXY_GETSTRINGDESCRIPTORFROMCACHEL_DUP2=0xe
+[TRACE]TRACE_NORMAL[0x86]_CDEVICEPROXY_GETSTRINGDESCRIPTORFROMUSBDL=0x8
+[TRACE]TRACE_NORMAL[0x86]_CDEVICEPROXY_GETSTRINGDESCRIPTORFROMUSBDL_DUP1=0xc
+[TRACE]TRACE_NORMAL[0x86]_CDEVICEPROXY_GETSTRINGDESCRIPTORFROMUSBDL_DUP3=0x12
+[TRACE]TRACE_NORMAL[0x86]_CDEVICEPROXY_GETSTRINGDESCRIPTORFROMUSBDL_DUP4=0x60
+[TRACE]TRACE_NORMAL[0x86]_CDEVICEPROXY_GETTOKENFORINTERFACE=0x6
+[TRACE]TRACE_NORMAL[0x86]_CDEVICEPROXY_POPULATESTRINGDESCRIPTORSL=0xb
+[TRACE]TRACE_NORMAL[0x86]_CDEVICEPROXY_POPULATESTRINGDESCRIPTORSL_DUP1=0x6c
+[TRACE]TRACE_NORMAL[0x86]_CDEVICEPROXY_READSTRINGDESCRIPTORSL=0x3
+[TRACE]TRACE_NORMAL[0x86]_CDEVICEPROXY_SETDRIVERLOADINGEVENTDATA=0x10
+[TRACE]TRACE_NORMAL[0x86]_CDEVICEPROXY_SUSPEND=0xf
+[TRACE]TRACE_NORMAL[0x86]_CEVENTQUEUE_ADDDEVICEEVENT=0x16
+[TRACE]TRACE_NORMAL[0x86]_CEVENTQUEUE_ADDDEVMONEVENT=0x1c
+[TRACE]TRACE_NORMAL[0x86]_CEVENTQUEUE_ATTACHMENTFAILURE=0x15
+[TRACE]TRACE_NORMAL[0x86]_CEVENTQUEUE_ATTACHMENTFAILURE_DUP1=0xab
+[TRACE]TRACE_NORMAL[0x86]_CEVENTQUEUE_GETDEVICEEVENT_DUP1=0x17
+[TRACE]TRACE_NORMAL[0x86]_CEVENTQUEUE_GETDEVICEEVENT_DUP2=0x18
+[TRACE]TRACE_NORMAL[0x86]_CEVENTQUEUE_GETDEVICEEVENT_DUP3=0x19
+[TRACE]TRACE_NORMAL[0x86]_CEVENTQUEUE_GETDEVMONEVENT_DUP1=0x1b
+[TRACE]TRACE_NORMAL[0x86]_CFDCPROXY_CHECKDEVICEIDL=0x3b
+[TRACE]TRACE_NORMAL[0x86]_CFDCPROXY_CHECKDEVICEIDL_DUP1=0x3c
+[TRACE]TRACE_NORMAL[0x86]_CFDCPROXY_DEVICEDETACHED=0x2f
+[TRACE]TRACE_NORMAL[0x86]_CFDCPROXY_DEVICEDETACHED_DUP2=0x31
+[TRACE]TRACE_NORMAL[0x86]_CFDCPROXY_DEVICEDETACHED_DUP3=0x32
+[TRACE]TRACE_NORMAL[0x86]_CFDCPROXY_MFPOGETMANUFACTURERSTRINGDESCRIPTOR=0x36
+[TRACE]TRACE_NORMAL[0x86]_CFDCPROXY_MFPOGETMANUFACTURERSTRINGDESCRIPTOR_DUP1=0x37
+[TRACE]TRACE_NORMAL[0x86]_CFDCPROXY_MFPOGETPRODUCTSTRINGDESCRIPTOR=0x38
+[TRACE]TRACE_NORMAL[0x86]_CFDCPROXY_MFPOGETPRODUCTSTRINGDESCRIPTOR_DUP1=0x39
+[TRACE]TRACE_NORMAL[0x86]_CFDCPROXY_MFPOGETSERIALNUMBERSTRINGDESCRIPTOR=0x3a
+[TRACE]TRACE_NORMAL[0x86]_CFDCPROXY_MFPOGETSERIALNUMBERSTRINGDESCRIPTOR_DUP1=0x3d
+[TRACE]TRACE_NORMAL[0x86]_CFDCPROXY_NEWFUNCTION=0x20
+[TRACE]TRACE_NORMAL[0x86]_CFDCPROXY_NEWFUNCTIONL=0x2e
+[TRACE]TRACE_NORMAL[0x86]_CFDCPROXY_NEWFUNCTIONL_DUP11=0x61
+[TRACE]TRACE_NORMAL[0x86]_CFDCPROXY_NEWFUNCTIONL_DUP2=0x2c
+[TRACE]TRACE_NORMAL[0x86]_CFDCPROXY_NEWFUNCTIONL_DUP4=0x2d
+[TRACE]TRACE_NORMAL[0x86]_CFDCPROXY_NEWFUNCTIONL_DUP5=0x25
+[TRACE]TRACE_NORMAL[0x86]_CFDCPROXY_NEWFUNCTIONL_DUP8=0x26
+[TRACE]TRACE_NORMAL[0x86]_CFDCPROXY_NEWFUNCTIONL_DUT1=0x2b
+[TRACE]TRACE_NORMAL[0x86]_CFDCPROXY_NEWFUNCTION_DUP1=0x21
+[TRACE]TRACE_NORMAL[0x86]_CFDFSERVER_NEWSESSIONL=0x8c
+[TRACE]TRACE_NORMAL[0x86]_CFDFSERVER_NEWSESSIONL_DUP1=0x8d
+[TRACE]TRACE_NORMAL[0x86]_CFDFSERVER_NEWSESSIONL_DUP2=0x8e
+[TRACE]TRACE_NORMAL[0x86]_CFDFSERVER_NEWSESSIONL_DUP3=0x8f
+[TRACE]TRACE_NORMAL[0x86]_CFDFSERVER_NEWSESSIONL_DUP5=0x90
+[TRACE]TRACE_NORMAL[0x86]_CFDFSERVER_SESSIONCLOSED_DUP1=0x91
+[TRACE]TRACE_NORMAL[0x86]_CFDFSESSION_COMPLETECLIENT=0x9e
+[TRACE]TRACE_NORMAL[0x86]_CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGESL=0xa3
+[TRACE]TRACE_NORMAL[0x86]_CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGESL_DUP1=0xa4
+[TRACE]TRACE_NORMAL[0x86]_CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGESL_DUP2=0xa5
+[TRACE]TRACE_NORMAL[0x86]_CFDFSESSION_GETSTRINGDESCRIPTORL_DUP1=0xa8
+[TRACE]TRACE_NORMAL[0x86]_CFDFSESSION_GETSUPPORTEDLANGUAGESL=0xa6
+[TRACE]TRACE_NORMAL[0x86]_CFDFSESSION_GETSUPPORTEDLANGUAGESL_DUP1=0xa7
+[TRACE]TRACE_NORMAL[0x86]_CFDFSESSION_NOTIFYDEVICEEVENTOUTSTANDING=0x9f
+[TRACE]TRACE_NORMAL[0x86]_CFDFSESSION_NOTIFYDEVMONEVENTOUTSTANDING=0xa2
+[TRACE]TRACE_NORMAL[0x86]_CFDFSESSION_SERVICEL=0x92
+[TRACE]TRACE_NORMAL[0x86]_CFDFSESSION_SERVICEL_DUP10=0x9c
+[TRACE]TRACE_NORMAL[0x86]_CFDFSESSION_SERVICEL_DUP11=0x9d
+[TRACE]TRACE_NORMAL[0x86]_CFDF_APPENDINTERFACENUMBERTOARRAYL=0x84
+[TRACE]TRACE_NORMAL[0x86]_CFDF_CFDF=0x44
+[TRACE]TRACE_NORMAL[0x86]_CFDF_CFDF_DUP1=0x45
+[TRACE]TRACE_NORMAL[0x86]_CFDF_CFDF_DUP2=0x46
+[TRACE]TRACE_NORMAL[0x86]_CFDF_CONSTRUCTL=0x3e
+[TRACE]TRACE_NORMAL[0x86]_CFDF_CONSTRUCTL_DUP1=0x3f
+[TRACE]TRACE_NORMAL[0x86]_CFDF_CONSTRUCTL_DUP2=0x40
+[TRACE]TRACE_NORMAL[0x86]_CFDF_CREATEFUNCTIONDRIVERPROXIESL=0x41
+[TRACE]TRACE_NORMAL[0x86]_CFDF_CREATEFUNCTIONDRIVERPROXIESL_DUP1=0x42
+[TRACE]TRACE_NORMAL[0x86]_CFDF_CREATEFUNCTIONDRIVERPROXIESL_DUP2=0x79
+[TRACE]TRACE_NORMAL[0x86]_CFDF_DEVICEPROXYL=0x7a
+[TRACE]TRACE_NORMAL[0x86]_CFDF_DEVICEPROXYL_DUP1=0x7b
+[TRACE]TRACE_NORMAL[0x86]_CFDF_DEVICEPROXYL_DUP2=0x7c
+[TRACE]TRACE_NORMAL[0x86]_CFDF_DODRIVERLOADINGL=0x62
+[TRACE]TRACE_NORMAL[0x86]_CFDF_DODRIVERLOADINGL_DUP1=0x63
+[TRACE]TRACE_NORMAL[0x86]_CFDF_DODRIVERLOADINGL_DUP6=0x64
+[TRACE]TRACE_NORMAL[0x86]_CFDF_FINDDRIVERFORINTERFACEUSINGSPECIFICKEY=0x66
+[TRACE]TRACE_NORMAL[0x86]_CFDF_FINDDRIVERFORINTERFACEUSINGSPECIFICKEY_DUP1=0x67
+[TRACE]TRACE_NORMAL[0x86]_CFDF_FINDDRIVERFORINTERFACEUSINGSPECIFICKEY_DUP2=0x68
+[TRACE]TRACE_NORMAL[0x86]_CFDF_FINDDRIVERFORINTERFACEUSINGSPECIFICKEY_DUP3=0x69
+[TRACE]TRACE_NORMAL[0x86]_CFDF_FINDDRIVERFORINTERFACEUSINGSPECIFICKEY_DUP4=0x6a
+[TRACE]TRACE_NORMAL[0x86]_CFDF_FINDDRIVERFORINTERFACEUSINGSPECIFICKEY_DUP5=0x6b
+[TRACE]TRACE_NORMAL[0x86]_CFDF_FINDDRIVERFORINTERFACEUSINGSPECIFICKEY_DUP6=0x6e
+[TRACE]TRACE_NORMAL[0x86]_CFDF_FINDDRIVERFORINTERFACEUSINGSPECIFICKEY_DUP8=0x6f
+[TRACE]TRACE_NORMAL[0x86]_CFDF_FINDDRIVERSFORINTERFACESUSINGSPECIFICKEYL_DUP1=0x65
+[TRACE]TRACE_NORMAL[0x86]_CFDF_FORMATDEVICESEARCHKEY_DUP1=0x88
+[TRACE]TRACE_NORMAL[0x86]_CFDF_FORMATINTERFACESEARCHKEY_DUP1=0x8b
+[TRACE]TRACE_NORMAL[0x86]_CFDF_GETMANUFACTURERSTRINGDESCRIPTORL=0x7e
+[TRACE]TRACE_NORMAL[0x86]_CFDF_GETMANUFACTURERSTRINGDESCRIPTORL_DUP1=0x7f
+[TRACE]TRACE_NORMAL[0x86]_CFDF_GETPRODUCTSTRINGDESCRIPTORL=0x80
+[TRACE]TRACE_NORMAL[0x86]_CFDF_GETPRODUCTSTRINGDESCRIPTORL_DUP1=0x81
+[TRACE]TRACE_NORMAL[0x86]_CFDF_GETSERIALNUMBERSTRINGDESCRIPTORL=0x82
+[TRACE]TRACE_NORMAL[0x86]_CFDF_GETSERIALNUMBERSTRINGDESCRIPTORL_DUP1=0x83
+[TRACE]TRACE_NORMAL[0x86]_CFDF_GETSUPPORTEDLANGUAGESL=0x7d
+[TRACE]TRACE_NORMAL[0x86]_CFDF_HANDLEDEVICEATTACHMENT=0x57
+[TRACE]TRACE_NORMAL[0x86]_CFDF_HANDLEDEVICEATTACHMENTL=0x5a
+[TRACE]TRACE_NORMAL[0x86]_CFDF_HANDLEDEVICEATTACHMENTL_DUP13=0x5b
+[TRACE]TRACE_NORMAL[0x86]_CFDF_HANDLEDEVICEATTACHMENTL_DUP21=0x5c
+[TRACE]TRACE_NORMAL[0x86]_CFDF_HANDLEDEVICEATTACHMENTL_DUP28=0x5d
+[TRACE]TRACE_NORMAL[0x86]_CFDF_HANDLEDEVICEATTACHMENTL_DUP31=0x5e
+[TRACE]TRACE_NORMAL[0x86]_CFDF_HANDLEDEVICEATTACHMENTL_DUP32=0x5f
+[TRACE]TRACE_NORMAL[0x86]_CFDF_HANDLEDEVICEDETACHMENT=0x70
+[TRACE]TRACE_NORMAL[0x86]_CFDF_HANDLEDEVICEDETACHMENT_DUP1=0x71
+[TRACE]TRACE_NORMAL[0x86]_CFDF_HANDLEDEVICEDETACHMENT_DUP4=0x72
+[TRACE]TRACE_NORMAL[0x86]_CFDF_HANDLEDEVICEDETACHMENT_DUP5=0x73
+[TRACE]TRACE_NORMAL[0x86]_CFDF_HANDLEDEVICEDETACHMENT_DUP6=0x74
+[TRACE]TRACE_NORMAL[0x86]_CFDF_HANDLEDEVMONEVENT=0x75
+[TRACE]TRACE_NORMAL[0x86]_CFDF_HANDLEECOMEVENTRECEIVEDL=0x4b
+[TRACE]TRACE_NORMAL[0x86]_CFDF_HANDLEECOMEVENTRECEIVEDL_DUP1=0x4c
+[TRACE]TRACE_NORMAL[0x86]_CFDF_HANDLEECOMEVENTRECEIVEDL_DUP2=0x4d
+[TRACE]TRACE_NORMAL[0x86]_CFDF_HANDLEECOMEVENTRECEIVEDL_DUP3=0x4e
+[TRACE]TRACE_NORMAL[0x86]_CFDF_HANDLEECOMEVENTRECEIVEDL_DUP4=0x4f
+[TRACE]TRACE_NORMAL[0x86]_CFDF_HANDLEECOMEVENTRECEIVEDL_DUP5=0x50
+[TRACE]TRACE_NORMAL[0x86]_CFDF_HANDLEECOMEVENTRECEIVEDL_DUP6=0x51
+[TRACE]TRACE_NORMAL[0x86]_CFDF_MBEOBUSEVENT=0x52
+[TRACE]TRACE_NORMAL[0x86]_CFDF_MBEOBUSEVENT_DUP1=0x53
+[TRACE]TRACE_NORMAL[0x86]_CFDF_MBEOBUSEVENT_DUP2=0x54
+[TRACE]TRACE_NORMAL[0x86]_CFDF_MBEOBUSEVENT_DUP4=0x56
+[TRACE]TRACE_NORMAL[0x86]_CFDF_SEARCHFORADEVICEFUNCTIONDRIVERL=0x85
+[TRACE]TRACE_NORMAL[0x86]_CFDF_SEARCHFORADEVICEFUNCTIONDRIVERL_DUP1=0xac
+[TRACE]TRACE_NORMAL[0x86]_CFDF_SEARCHFORADEVICEFUNCTIONDRIVERL_DUP2=0xad
+[TRACE]TRACE_NORMAL[0x86]_CFDF_SETSESSION=0x48
+[TRACE]TRACE_NORMAL[0x86]_CFDF_TELLFDCSOFDEVICEDETACHMENT=0x77
+[TRACE]TRACE_NORMAL[0x86]_CFDF_TOKENFORINTERFACE=0x78
+[TRACE]TRACE_NORMAL[0x86]_CFDF_TOKENFORINTERFACE_DUP6=0xaa
+[TRACE]TRACE_NORMAL[0x86]_CFDF_UNCLAIMEDINTERFACECOUNT_DUP1=0x89
+[TRACE]TRACE_NORMAL[0x86]_CFDF_UNCLAIMEDINTERFACECOUNT_DUP2=0x8a
+[TRACE]TRACE_NORMAL[0x86]_FDF_SERVER_SRC_E32MAIN=0xa0
+[TRACE]TRACE_NORMAL[0x86]_FDF_SERVER_SRC_E32MAIN_DUP1=0xa1
+[TRACE]TRACE_NORMAL[0x86]_FDF_UTILS_REMOVE=0xa9
+[[OBSOLETE]][GROUP]a=0xdf
+[[OBSOLETE]][TRACE]TRACE_DUMP[0x89]_CFDF_HANDLEDEVICEATTACHMENTL_DUP13=0x2c
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CDEVICEPROXY_GETCONFIGURATIONDESCRIPTOR_DUP1=0x8
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CDEVICEPROXY_NEWL=0x2
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CFDCPROXY_NEWFUNCTIONL_DUP3=0x13
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CFDCPROXY_NEWFUNCTIONL_DUP4=0x16
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CFDCPROXY_NEWFUNCTIONL_DUP6=0x14
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CFDCPROXY_NEWFUNCTIONL_DUP7=0x15
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CFDF_FORMATDEVICESEARCHKEY=0x3a
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CFDF_TOKENFORINTERFACE_DUP6=0x39
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEWAITFORBUSEVENT_CACTIVEWAITFORBUSEVENT_ENTRY=0x1
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEWAITFORBUSEVENT_CACTIVEWAITFORBUSEVENT_ENTRY_DUP1=0xb
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEWAITFORBUSEVENT_CACTIVEWAITFORBUSEVENT_EXIT=0x2
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEWAITFORBUSEVENT_CACTIVEWAITFORBUSEVENT_EXIT_DUP1=0xc
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEWAITFORECOMEVENT_CACTIVEWAITFORECOMEVENT_ENTRY=0xd
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEWAITFORECOMEVENT_CACTIVEWAITFORECOMEVENT_ENTRY_DUP1=0xf
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEWAITFORECOMEVENT_CACTIVEWAITFORECOMEVENT_EXIT=0xe
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEWAITFORECOMEVENT_CACTIVEWAITFORECOMEVENT_EXIT_DUP1=0x10
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_CDEVICEPROXY_ENTRY=0x1b
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_CDEVICEPROXY_ENTRY_DUP1=0x22
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CDEVICEPROXY_CDEVICEPROXY_ENTRY_DUP1_EXIT=0x23
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CEVENTQUEUE_ATTACHMENTFAILURE_DUP1=0x4f
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CEVENTQUEUE_CEVENTQUEUE_ENTRY=0x4b
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CEVENTQUEUE_CEVENTQUEUE_EXIT=0x4d
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CFDCPROXY_CFDCPROXY_DUP1_EXIT=0x63
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CFDCPROXY_CFDCPROXY_ENTRY=0x61
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CFDCPROXY_CFDCPROXY_ENTRY_DUP1=0x62
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_COMPLETEDEVICEEVENTNOTIFICATION=0xdf
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_COMPLETEDEVICEEVENTNOTIFICATIONL=0xe0
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_COMPLETEDEVMONEVENTNOTIFICATION=0xe4
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_COMPLETEDEVMONEVENTNOTIFICATIONL=0xe5
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_DEVMONEVENT=0xe3
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_GETMANUFACTURERSTRINGDESCRIPTOR=0xea
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_GETOTGDEVICEDESCRIPTOR=0xee
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_GETPRODUCTSTRINGDESCRIPTOR=0xeb
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGES=0xe6
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGESL=0xe7
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_GETSTRINGDESCRIPTOR=0xec
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_GETSTRINGDESCRIPTORL=0xed
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_GETSUPPORTEDLANGUAGES=0xe8
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_GETSUPPORTEDLANGUAGESL=0xe9
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_NOTIFYDEVMONEVENT=0xe1
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CFDFSESSION_NOTIFYDEVMONEVENTCANCEL=0xe2
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CFDF_CFDF_ENTRY=0x78
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CFDF_CFDF_ENTRY_DUP1=0x7d
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CFDF_CFDF_ENTRY_DUP1_EXIT=0x7e
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_DUP1_CACTIVEWAITFORBUSEVENT_CACTIVEWAITFORBUSEVENT_ENTRY=0x3
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_DUP1_CACTIVEWAITFORBUSEVENT_CACTIVEWAITFORBUSEVENT_EXIT=0x4
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_DUP1_CEVENTQUEUE_CEVENTQUEUE_ENTRY=0x4c
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_TDEVICEEVENT_TDEVICEEVENT_ENTRY=0x47
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_TDEVICEEVENT_TDEVICEEVENT_ENTRY_DUP1=0x48
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CACTIVEWAITFORECOMEVENT_RUNERROR=0x2
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CDEVICEPROXY_GETCONFIGURATIONDESCRIPTOR=0x5
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CDEVICEPROXY_GETSTRINGDESCRIPTORFROMUSBDL_DUP2=0xa
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CEVENTQUEUE_ADDDEVMONEVENT_DUP1=0x1f
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CEVENTQUEUE_ADDDEVMONEVENT_DUP2=0x1e
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CEVENTQUEUE_GETDEVMONEVENT=0x1a
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CFDCPROXY_DEVICEDETACHED_DUP1=0x30
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CFDCPROXY_INVARIANT=0x33
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CFDCPROXY_INVARIANT_DUP1=0x34
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CFDCPROXY_MFPOTOKENFORINTERFACE=0x35
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CFDCPROXY_NEWFUNCTIONL_DUP2=0x23
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CFDCPROXY_NEWFUNCTIONL_DUP3=0x28
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CFDCPROXY_NEWFUNCTIONL_DUP4=0x24
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CFDCPROXY_NEWFUNCTIONL_DUP6=0x29
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CFDCPROXY_NEWFUNCTIONL_DUT1=0x22
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CFDCPROXY_NEWFUNCTIONL_DUT2=0x27
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CFDFSESSION_SERVICEL_DUP1=0x93
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CFDFSESSION_SERVICEL_DUP2=0x94
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CFDFSESSION_SERVICEL_DUP3=0x95
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CFDFSESSION_SERVICEL_DUP4=0x96
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CFDFSESSION_SERVICEL_DUP5=0x97
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CFDFSESSION_SERVICEL_DUP6=0x98
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CFDFSESSION_SERVICEL_DUP7=0x99
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CFDFSESSION_SERVICEL_DUP8=0x9a
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CFDFSESSION_SERVICEL_DUP9=0x9b
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CFDF_CFDF_DUP3=0x47
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CFDF_CREATEFUNCTIONDRIVERPROXIESL_DUP2=0x43
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CFDF_GETDEVICEEVENT=0x49
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CFDF_GETDEVMONEVENT=0x4a
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CFDF_HANDLEDEVICEATTACHMENT_DUP1=0x58
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CFDF_HANDLEDEVICEATTACHMENT_DUP2=0x59
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CFDF_HANDLEDEVMONEVENT_DUP1=0x76
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CFDF_MBEOBUSEVENT_DUP3=0x55
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP1_CFDF_SEARCHFORADEVICEFUNCTIONDRIVERL_DUP1=0x86
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP1_CFDF_SEARCHFORADEVICEFUNCTIONDRIVERL_DUP2=0x87
+[[OBSOLETE]][TRACE]a[0xDE]_b=0x1
+[[OBSOLETE]][TRACE]a[0xDF]_b=0x1
--- a/usbmgmt/usbmgr/host/fdf/reference/reffdc/group/reffdc.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/reference/reffdc/group/reffdc.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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,9 +35,10 @@
 
 RESOURCE		reffdc.rss
 
-SYSTEMINCLUDE	\epoc32\include
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
 USERINCLUDE		..\inc
+USERINCLUDE		..\traces
 
 LIBRARY 		euser.lib
 LIBRARY			fdcbase.lib
@@ -45,4 +46,4 @@
 NOEXPORTLIBRARY
 
 #include <usbhost/internal/fdfcaps.mmh>
-#include <usb/usblogger.mmh>
+
--- a/usbmgmt/usbmgr/host/fdf/reference/reffdc/src/reffdc.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/reference/reffdc/src/reffdc.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
@@ -23,27 +23,29 @@
 #include "reffdc.h"
 #include <usb/usblogger.h>
 #include <usbhost/internal/fdcpluginobserver.h>
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "reffdcTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "reffdc   ");
-#endif
+
 
 CRefFdc* CRefFdc::NewL(MFdcPluginObserver& aObserver)
 	{
-	LOG_LINE
-	LOG_STATIC_FUNC_ENTRY
-
+	OstTraceFunctionEntry0( CREFFDC_NEWL_ENTRY );
+	
 	CRefFdc* self = new(ELeave) CRefFdc(aObserver);
 	CleanupStack::PushL(self);
 	self->ConstructL();
 	CleanupStack::Pop(self);
+	OstTraceFunctionExit0( CREFFDC_NEWL_EXIT );
 	return self;
 	}
 
 CRefFdc::~CRefFdc()
 	{
-	LOG_LINE
-	LOG_FUNC
+	OstTraceFunctionEntry0( CREFFDC_CREFFDC_DES_ENTRY );
+	OstTraceFunctionExit0( CREFFDC_CREFFDC_DES_EXIT );
 	}
 
 CRefFdc::CRefFdc(MFdcPluginObserver& aObserver)
@@ -53,7 +55,10 @@
 
 void CRefFdc::ConstructL()
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry0( CREFFDC_CONSTRUCTL_ENTRY );
+    
+	
+	OstTraceFunctionExit0( CREFFDC_CONSTRUCTL_EXIT );
 	}
 
 TInt CRefFdc::Mfi1NewFunction(TUint aDeviceId,
@@ -61,16 +66,20 @@
 		const TUsbDeviceDescriptor& aDeviceDescriptor,
 		const TUsbConfigurationDescriptor& aConfigurationDescriptor)
 	{
-	LOG_LINE
-	LOG_FUNC
-	LOGTEXT2(_L8("\t***** Ref FD offered chance to claim one function from device with ID %d"), aDeviceId);
+	OstTraceFunctionEntry0( CREFFDC_MFI1NEWFUNCTION_ENTRY );
+	OstTrace1( TRACE_NORMAL, CREFFDC_MFI1NEWFUNCTION, 
+	        "***** Ref FD offered chance to claim one function from device with ID %d", 
+	        aDeviceId );
+	
 	(void)aDeviceId;
 
 	TRAPD(err, NewFunctionL(aDeviceId, aInterfaces, aDeviceDescriptor, aConfigurationDescriptor));
 
 	// If any error is returned, RUsbInterface (etc) handles opened from this 
 	// call must be closed.
-	LOGTEXT2(_L8("\terr = %d"), err);
+	OstTrace1( TRACE_NORMAL, CREFFDC_MFI1NEWFUNCTION_DUP1, 
+	            "err = %d", err );
+	OstTraceFunctionExit0( CREFFDC_MFI1NEWFUNCTION_EXIT );
 	return err;
 	}
 
@@ -79,9 +88,8 @@
 		const TUsbDeviceDescriptor& /*aDeviceDescriptor*/,
 		const TUsbConfigurationDescriptor& /*aConfigurationDescriptor*/)
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CREFFDC_NEWFUNCTIONL_ENTRY );
+	
 	// We are obliged to claim the first interface because it has 
 	// interface class/subclass(/protocol) settings matching our default_data 
 	// field.
@@ -101,58 +109,70 @@
 	// subsystem-specific purposes.
 	const RArray<TUint>& langIds = Observer().GetSupportedLanguagesL(aDeviceId);
 	const TUint langCount = langIds.Count();
-	LOGTEXT2(_L8("\tdevice supports %d language(s):"), langCount);
+	OstTrace1( TRACE_NORMAL, CREFFDC_NEWFUNCTIONL, 
+	        "device supports %d language(s):", langCount );
+	
 	for ( TUint ii = 0 ; ii < langCount ; ++ii )
 		{
-		LOGTEXT2(_L8("\t\tlang code: 0x%04x"), langIds[ii]);
-		TName string;
+        OstTrace1( TRACE_NORMAL, CREFFDC_NEWFUNCTIONL_DUP1, 
+	            "lang code: 0x%04x", langIds[ii] );
+	   
+        TName string;
 		TInt err = Observer().GetManufacturerStringDescriptor(aDeviceId, langIds[ii], string);
 		if ( !err )
 			{
-			LOGTEXT2(_L("\t\t\tmanufacturer string descriptor = \"%S\""), &string);
-			err = Observer().GetProductStringDescriptor(aDeviceId, langIds[ii], string);
+            OstTraceExt1( TRACE_NORMAL, CREFFDC_NEWFUNCTIONL_DUP2, 
+		                "manufacturer string descriptor = \"%S\"", string );
+		    err = Observer().GetProductStringDescriptor(aDeviceId, langIds[ii], string);
 			if ( !err )
 				{
-				LOGTEXT2(_L("\t\t\tproduct string descriptor = \"%S\""), &string);
+                OstTraceExt1( TRACE_NORMAL, CREFFDC_NEWFUNCTIONL_DUP3, 
+			                        "product string descriptor = \"%S\"", string );
 				err = Observer().GetSerialNumberStringDescriptor(aDeviceId, langIds[ii], string);
 				if ( !err )
 					{
-					LOGTEXT2(_L("\t\t\tserial number string descriptor = \"%S\""), &string);
+                    OstTraceExt1( TRACE_NORMAL, CREFFDC_NEWFUNCTIONL_DUP4, 
+				                   "serial number string descriptor = \"%S\"", string );
 					}
 				else
 					{
-					LOGTEXT2(_L("\t\t\tGetSerialNumberStringDescriptor returned %d"), err);
+                    OstTrace1( TRACE_NORMAL, CREFFDC_NEWFUNCTIONL_DUP5, 
+				               "GetSerialNumberStringDescriptor returned %d", err );
 					}
 				}
 			else
 				{
-				LOGTEXT2(_L("\t\t\tGetProductStringDescriptor returned %d"), err);
-				}
+                OstTrace1( TRACE_NORMAL, CREFFDC_NEWFUNCTIONL_DUP6, 
+			                "GetProductStringDescriptor returned %d", err );
+			    }
 			}
 		else
 			{
-			LOGTEXT2(_L("\t\t\tGetManufacturerStringDescriptor returned %d"), err);
+            OstTrace1( TRACE_NORMAL, CREFFDC_NEWFUNCTIONL_DUP7, 
+		                            "GetManufacturerStringDescriptor returned %d", err );
 			}
 		}
+	OstTraceFunctionExit0( CREFFDC_NEWFUNCTIONL_EXIT );
 	}
 
 void CRefFdc::Mfi1DeviceDetached(TUint aDeviceId)
 	{
-	LOG_LINE
-	LOG_FUNC
-	LOGTEXT2(_L8("\t***** Ref FD notified of detachment of device with ID %d"), aDeviceId);
+	OstTraceFunctionEntry0( CREFFDC_MFI1DEVICEDETACHED_ENTRY );
+	OstTrace1( TRACE_NORMAL, CREFFDC_MFI1DEVICEDETACHED, 
+	        "***** Ref FD notified of detachment of device with ID %d", aDeviceId );
 	(void)aDeviceId;
 
 	// Any RUsbInterface (etc) handles opened as a result of any calls to 
 	// MfiNewFunction with this device ID should be closed.
+	OstTraceFunctionExit0( CREFFDC_MFI1DEVICEDETACHED_EXIT );
 	}
 
 TAny* CRefFdc::GetInterface(TUid aUid)
 	{
-	LOG_LINE
-	LOG_FUNC;
-	LOGTEXT2(_L8("\taUid = 0x%08x"), aUid);
-
+	OstTraceFunctionEntry0( CREFFDC_GETINTERFACE_ENTRY );
+	OstTrace1( TRACE_NORMAL, CREFFDC_GETINTERFACE, 
+	        "aUid = 0x%08x", aUid.iUid );
+	
 	TAny* ret = NULL;
 	if ( aUid == TUid::Uid(KFdcInterfaceV1) )
 		{
@@ -161,6 +181,9 @@
 			);
 		}
 
-	LOGTEXT2(_L8("\tret = [0x%08x]"), ret);
+	OstTrace1( TRACE_NORMAL, CREFFDC_GETINTERFACE_DUP1, 
+	            "ret = [0x%08x]", ret );
+	    
+	OstTraceFunctionExit0( CREFFDC_GETINTERFACE_EXIT );
 	return ret;
 	}
--- a/usbmgmt/usbmgr/host/fdf/reference/reffdc/src/reffdcmain.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/fdf/reference/reffdc/src/reffdcmain.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/fdf/reference/reffdc/traces/OstTraceDefinitions.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,7 @@
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <opensystemtrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/fdf/reference/reffdc/traces/fixed_id.definitions	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,32 @@
+#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt.
+[GROUP]TRACE_FLOW=0x8a
+[GROUP]TRACE_NORMAL=0x86
+[TRACE]TRACE_FLOW[0x8A]_CREFFDC_CONSTRUCTL_ENTRY=0x5
+[TRACE]TRACE_FLOW[0x8A]_CREFFDC_CONSTRUCTL_EXIT=0x6
+[TRACE]TRACE_FLOW[0x8A]_CREFFDC_CREFFDC_DES_ENTRY=0xf
+[TRACE]TRACE_FLOW[0x8A]_CREFFDC_CREFFDC_DES_EXIT=0x10
+[TRACE]TRACE_FLOW[0x8A]_CREFFDC_GETINTERFACE_ENTRY=0xd
+[TRACE]TRACE_FLOW[0x8A]_CREFFDC_GETINTERFACE_EXIT=0xe
+[TRACE]TRACE_FLOW[0x8A]_CREFFDC_MFI1DEVICEDETACHED_ENTRY=0xb
+[TRACE]TRACE_FLOW[0x8A]_CREFFDC_MFI1DEVICEDETACHED_EXIT=0xc
+[TRACE]TRACE_FLOW[0x8A]_CREFFDC_MFI1NEWFUNCTION_ENTRY=0x7
+[TRACE]TRACE_FLOW[0x8A]_CREFFDC_MFI1NEWFUNCTION_EXIT=0x8
+[TRACE]TRACE_FLOW[0x8A]_CREFFDC_NEWFUNCTIONL_ENTRY=0x9
+[TRACE]TRACE_FLOW[0x8A]_CREFFDC_NEWFUNCTIONL_EXIT=0xa
+[TRACE]TRACE_FLOW[0x8A]_CREFFDC_NEWL_ENTRY=0x1
+[TRACE]TRACE_FLOW[0x8A]_CREFFDC_NEWL_EXIT=0x2
+[TRACE]TRACE_NORMAL[0x86]_CREFFDC_GETINTERFACE=0xc
+[TRACE]TRACE_NORMAL[0x86]_CREFFDC_GETINTERFACE_DUP1=0xd
+[TRACE]TRACE_NORMAL[0x86]_CREFFDC_MFI1DEVICEDETACHED=0xb
+[TRACE]TRACE_NORMAL[0x86]_CREFFDC_MFI1NEWFUNCTION=0x1
+[TRACE]TRACE_NORMAL[0x86]_CREFFDC_MFI1NEWFUNCTION_DUP1=0x2
+[TRACE]TRACE_NORMAL[0x86]_CREFFDC_NEWFUNCTIONL=0x3
+[TRACE]TRACE_NORMAL[0x86]_CREFFDC_NEWFUNCTIONL_DUP1=0x4
+[TRACE]TRACE_NORMAL[0x86]_CREFFDC_NEWFUNCTIONL_DUP2=0x5
+[TRACE]TRACE_NORMAL[0x86]_CREFFDC_NEWFUNCTIONL_DUP3=0x6
+[TRACE]TRACE_NORMAL[0x86]_CREFFDC_NEWFUNCTIONL_DUP4=0x7
+[TRACE]TRACE_NORMAL[0x86]_CREFFDC_NEWFUNCTIONL_DUP5=0x8
+[TRACE]TRACE_NORMAL[0x86]_CREFFDC_NEWFUNCTIONL_DUP6=0x9
+[TRACE]TRACE_NORMAL[0x86]_CREFFDC_NEWFUNCTIONL_DUP7=0xa
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CREFFDC_CREFFDC_CONS_ENTRY=0x3
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CREFFDC_CREFFDC_EXIT=0x4
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msfdc/group/msfdc.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msfdc/group/msfdc.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-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"
@@ -39,6 +39,8 @@
 USERINCLUDE		../inc
 USERINCLUDE		../../msmm/client/public
 USERINCLUDE		../../msmm/server/public
+USERINCLUDE		../traces
+
 
 LIBRARY 		euser.lib 
 
@@ -47,4 +49,3 @@
 NOEXPORTLIBRARY
 
 #include <usbhost/internal/fdfcaps.mmh>
-#include <usb/usblogger.mmh>
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msfdc/src/msfdc.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msfdc/src/msfdc.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-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"
@@ -26,10 +26,12 @@
 #include <usbhost/internal/fdcpluginobserver.h>
 #include <d32usbdi.h>
 #include <d32usbdescriptors.h>
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "msfdcTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "MsFdc");
-#endif
+
 /**
   NewL function of CMsFdc, allocate the memory that needed for instantiating this object.
  
@@ -39,12 +41,13 @@
  */
 CMsFdc* CMsFdc::NewL(MFdcPluginObserver& aObserver)
 	{
-	LOG_STATIC_FUNC_ENTRY
-
+	OstTraceFunctionEntry0( CMSFDC_NEWL_ENTRY );
+	
 	CMsFdc* self = new(ELeave) CMsFdc(aObserver);
 	CleanupStack::PushL(self);
 	self->ConstructL();
 	CleanupStack::Pop(self);
+	OstTraceFunctionExit0( CMSFDC_NEWL_EXIT );
 	return self;
 	} 
 
@@ -53,13 +56,11 @@
  */
 CMsFdc::~CMsFdc()
 	{
-	LOG_FUNC
-	
+	OstTraceFunctionEntry0( CMSFDC_CMSFDC_DES_ENTRY );
 	iMsmmSession.Disconnect();
-	LOGTEXT(_L("Disconnected to MSMM OK"));
-#ifdef __FLOG_ACTIVE
-	CUsbLog::Close();
-#endif
+	OstTrace0( TRACE_NORMAL, CMSFDC_CMSFDC, "Disconnected to MSMM OK" );
+
+	OstTraceFunctionExit0( CMSFDC_CMSFDC_DES_EXIT );
 	}
 /**
   Constructor of CMsFdc.
@@ -73,23 +74,22 @@
  */
 void CMsFdc::ConstructL()
 	{
-
-#ifdef __FLOG_ACTIVE
-	CUsbLog::Connect();
-#endif
-	LOG_FUNC
+	OstTraceFunctionEntry0( CMSFDC_CONSTRUCTL_ENTRY );
 	
 	//Set up the connection with mount manager
 	TInt error = iMsmmSession.Connect();
 	if ( error )
 		{
-		LOGTEXT2(_L("Failed to connect to MSMM %d"),error);
-		User::Leave(error);
+        OstTrace1( TRACE_NORMAL, CMSFDC_CONSTRUCTL, 
+                "Failed to connect to MSMM %d",error );
+        User::Leave(error);
 		}
 	else
 		{
-		LOGTEXT(_L("Connected to MSMM OK"));
-		}
+        OstTrace0( TRACE_NORMAL, CMSFDC_CONSTRUCTL_DUP1, 
+                "Connected to MSMM OK" );
+ 		}
+	OstTraceFunctionExit0( CMSFDC_CONSTRUCTL_EXIT );
 	}
 /**
   Get called when FDF is trying to load the driver for Mass Storage Device. 
@@ -106,17 +106,23 @@
 		const TUsbDeviceDescriptor& aDeviceDescriptor,
 		const TUsbConfigurationDescriptor& aConfigurationDescriptor)
 	{
-	LOG_FUNC // this is the evidence that the message got through.
-	LOGTEXT2(_L8("\t***** Mass Storage FD notified of device (ID %d) attachment!"), aDeviceId);
-	
+	OstTraceFunctionEntry0( CMSFDC_MFI1NEWFUNCTION_ENTRY );
+	 
+	// this is the evidence that the message got through.
+	OstTrace1( TRACE_NORMAL, CMSFDC_MFI1NEWFUNCTION, 
+	        "***** Mass Storage FD notified of device (ID %d) attachment!", aDeviceId );	
 
 	// Mass Storage FDC only claims one interface.
-	LOGTEXT2(_L8("\t***** Mass Storage FD interface to request token is %d"), aInterfaces[0]);
+	OstTrace1( TRACE_NORMAL, CMSFDC_MFI1NEWFUNCTION_DUP1, 
+	            "***** Mass Storage FD interface to request token is %d", aInterfaces[0] );    
 	TUint32 token = Observer().TokenForInterface(aInterfaces[0]);
-	LOGTEXT2(_L8("\t***** Mass Storage FD tokenInterface  %d"), token);
+	OstTrace1( TRACE_NORMAL, CMSFDC_MFI1NEWFUNCTION_DUP2, 
+	        "***** Mass Storage FD tokenInterface  %d", token );
 	if (token == 0)
 		{
-		LOGTEXT(_L8("\t***** Mass Storage FDC device containing this function is removed."));
+        OstTrace0( TRACE_ERROR, CMSFDC_MFI1NEWFUNCTION_DUP3, 
+	            "***** Mass Storage FDC device containing this function is removed." );
+		OstTraceFunctionExit0( CMSFDC_MFI1NEWFUNCTION_EXIT );
 		return KErrGeneral;
 		}
 
@@ -126,7 +132,9 @@
 
 	if (error)
 		{
-		LOGTEXT(_L8("\t***** Mass Storage FDC getting language array failed"));
+        OstTrace0( TRACE_ERROR, CMSFDC_MFI1NEWFUNCTION_DUP4, 
+	                "***** Mass Storage FDC getting language array failed" );
+		OstTraceFunctionExit0( CMSFDC_MFI1NEWFUNCTION_EXIT_DUP1 );
 		return error;
 		}
 	
@@ -134,7 +142,9 @@
 	TRAP(error, data = new (ELeave) TUSBMSDeviceDescription);
 	if (error)
 		{
-		LOGTEXT(_L8("\t***** Mass Storage FDC Memory allocation Failed"));		
+        OstTrace0( TRACE_ERROR, CMSFDC_MFI1NEWFUNCTION_DUP5, 
+	                    "***** Mass Storage FDC Memory allocation Failed" );
+		OstTraceFunctionExit0( CMSFDC_MFI1NEWFUNCTION_EXIT_DUP2 );
 		return error;
 		}
 
@@ -144,27 +154,33 @@
 	
 	if (error)
 		{
-		LOGTEXT(_L8("\t***** Mass Storage FDC getting Serial Number failed"));
+        OstTrace0( TRACE_ERROR, CMSFDC_MFI1NEWFUNCTION_DUP6, 
+                    "***** Mass Storage FDC getting Serial Number Failed" );
 		delete data;
+		OstTraceFunctionExit0( CMSFDC_MFI1NEWFUNCTION_EXIT_DUP3 );
 		return error;
 		}
 	else
 		{
-		LOGTEXT2(_L("\t***** Mass Storage FDC Serial String is %S"), &data->iSerialNumber);
-		}
+        OstTraceExt1( TRACE_ERROR, CMSFDC_MFI1NEWFUNCTION_DUP7, 
+	                    "***** Mass Storage FDC Serial String is %S", data->iSerialNumber );
+	    }
 	//Get Product string descriptor
 	error = Observer().GetProductStringDescriptor(aDeviceId, defaultlangid, data->iProductString);
 	
 
 	if (error)
 		{
-		LOGTEXT(_L8("\t***** Mass Storage FDC getting Product string failed"));
-		delete data;
+        OstTrace0( TRACE_ERROR, CMSFDC_MFI1NEWFUNCTION_DUP8, 
+	                    "***** Mass Storage FDC getting Product string Failed" );
+	    delete data;
+		OstTraceFunctionExit0( CMSFDC_MFI1NEWFUNCTION_EXIT_DUP4 );
 		return error;
 		}
 	else
 		{
-		LOGTEXT2(_L("\t***** Mass Storage FDC Product String is %S"), &data->iProductString);
+        OstTraceExt1( TRACE_NORMAL, CMSFDC_MFI1NEWFUNCTION_DUP9, 
+	                        "***** Mass Storage FDC Product String is %S", data->iProductString );
 		}
 
 	//Get Manufacturer string descriptor
@@ -173,14 +189,16 @@
 	
 	if (error)
 		{
-		LOGTEXT(_L8("\t***** Mass Storage FDC getting Manufacturer string failed"));
+        OstTrace0( TRACE_ERROR, CMSFDC_MFI1NEWFUNCTION_DUP10, 
+                    "***** Mass Storage FDC getting Manufacturer string Failed" );
 		delete data;
+		OstTraceFunctionExit0( CMSFDC_MFI1NEWFUNCTION_EXIT_DUP5 );
 		return error;
 		}
 	else
 		{
-		LOGTEXT2(_L("\t***** Mass Storage FDC Manufacturer String is %S"), 
-				&data->iManufacturerString);		
+        OstTraceExt1( TRACE_NORMAL, CMSFDC_MFI1NEWFUNCTION_DUP11, 
+	                            "***** Mass Storage FDC Manufacturer String is %S", data->iManufacturerString );
 		}	
 	
 	/************************Remote Wakeup Attribute acquiring***********************/
@@ -192,26 +210,32 @@
     error = interface_ep0.Open(token);
     if (error)
     	{
-		LOGTEXT(_L8("\t***** Mass Storage FDC Open interface handle failed"));
-		delete data;
+        OstTrace0( TRACE_ERROR, CMSFDC_MFI1NEWFUNCTION_DUP12, 
+                        "***** Mass Storage FDC Open interface handle Failed" );
+    	delete data;
+		OstTraceFunctionExit0( CMSFDC_MFI1NEWFUNCTION_EXIT_DUP6 );
 		return error;
     	}
     else
     	{
-		LOGTEXT(_L8("\t***** Mass Storage FDC Open interface handle OK"));
+        OstTrace0( TRACE_NORMAL, CMSFDC_MFI1NEWFUNCTION_DUP13, 
+                         "***** Mass Storage FDC Open interface handle OK" );
     	}
 
     error = interface_ep0.GetInterfaceDescriptor(ifDescriptor);
+	interface_ep0.Close();
     if (error)
     	{
-		LOGTEXT(_L8("\t***** Mass Storage FDC get interface descriptor failed"));
-		interface_ep0.Close();
+        OstTrace0( TRACE_ERROR, CMSFDC_MFI1NEWFUNCTION_DUP14, 
+                        "***** Mass Storage FDC get interface descriptor Failed" );
 		delete data;
+		OstTraceFunctionExit0( CMSFDC_MFI1NEWFUNCTION_EXIT_DUP7 );
 		return error;
     	}
     else
     	{
-		LOGTEXT(_L8("\t***** Mass Storage FDC get interface descriptor OK"));
+        OstTrace0( TRACE_NORMAL, CMSFDC_MFI1NEWFUNCTION_DUP15, 
+                         "***** Mass Storage FDC get interface descriptor OK" );
     	}
 	
 	/*********************************************************************************/
@@ -237,8 +261,8 @@
 	
 	error = iMsmmSession.AddFunction(*data, aInterfaces[0], token);
 	
-	interface_ep0.Close();
 	delete data;
+	OstTraceFunctionExit0( CMSFDC_MFI1NEWFUNCTION_EXIT_DUP8 );
 	return error;
 	}
 /**
@@ -248,10 +272,13 @@
  */
 void CMsFdc::Mfi1DeviceDetached(TUint aDeviceId)
 	{
-	LOG_FUNC // this is the evidence that the message got through.
-	LOGTEXT2(_L8("\t***** Mass Storage FD notified of device (ID %d) detachment!"), aDeviceId);
+	OstTraceFunctionEntry0( CMSFDC_MFI1DEVICEDETACHED_ENTRY );
+    // this is the evidence that the message got through.
+	OstTrace1( TRACE_NORMAL, CMSFDC_MFI1DEVICEDETACHED, 
+	        "***** Mass Storage FD notified of device (ID %d) detachment!", aDeviceId );
 	iMsmmSession.RemoveDevice(aDeviceId);
 
+	OstTraceFunctionExit0( CMSFDC_MFI1DEVICEDETACHED_EXIT );
 	}
 
 /**
@@ -262,10 +289,9 @@
  */
 TAny* CMsFdc::GetInterface(TUid aUid)
 	{
-	LOG_LINE
-	LOG_FUNC;
-	LOGTEXT2(_L8("\taUid = 0x%08x"), aUid);
-
+	OstTraceFunctionEntry0( CMSFDC_GETINTERFACE_ENTRY );
+	OstTrace1( TRACE_NORMAL, CMSFDC_GETINTERFACE, "aUid = 0x%08x", aUid.iUid );
+	
 	TAny* ret = NULL;
 	if ( aUid == TUid::Uid(KFdcInterfaceV1) )
 		{
@@ -273,8 +299,9 @@
 			static_cast<MFdcInterfaceV1*>(this)
 			);
 		}
-
-	LOGTEXT2(_L8("\tret = [0x%08x]"), ret);
+	OstTrace1( TRACE_NORMAL, CMSFDC_GETINTERFACE_DUP1, 
+        "ret = [0x%08x]", ret );
+	OstTraceFunctionExit0( CMSFDC_GETINTERFACE_EXIT );
 	return ret;
 	}
 /**
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msfdc/src/msfdcmain.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msfdc/src/msfdcmain.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-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"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msfdc/traces/OstTraceDefinitions.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,7 @@
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <opensystemtrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msfdc/traces/fixed_id.definitions	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,54 @@
+#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt.
+[GROUP]TRACE_ERROR=0x82
+[GROUP]TRACE_FLOW=0x8a
+[GROUP]TRACE_NORMAL=0x86
+[TRACE]TRACE_ERROR[0x82]_CMSFDC_MFI1NEWFUNCTION_DUP10=0x7
+[TRACE]TRACE_ERROR[0x82]_CMSFDC_MFI1NEWFUNCTION_DUP12=0x8
+[TRACE]TRACE_ERROR[0x82]_CMSFDC_MFI1NEWFUNCTION_DUP14=0x9
+[TRACE]TRACE_ERROR[0x82]_CMSFDC_MFI1NEWFUNCTION_DUP3=0x1
+[TRACE]TRACE_ERROR[0x82]_CMSFDC_MFI1NEWFUNCTION_DUP4=0x2
+[TRACE]TRACE_ERROR[0x82]_CMSFDC_MFI1NEWFUNCTION_DUP5=0x3
+[TRACE]TRACE_ERROR[0x82]_CMSFDC_MFI1NEWFUNCTION_DUP6=0x4
+[TRACE]TRACE_ERROR[0x82]_CMSFDC_MFI1NEWFUNCTION_DUP7=0x5
+[TRACE]TRACE_ERROR[0x82]_CMSFDC_MFI1NEWFUNCTION_DUP8=0x6
+[TRACE]TRACE_FLOW[0x8A]_CMSFDC_CMSFDC_DES_ENTRY=0x3
+[TRACE]TRACE_FLOW[0x8A]_CMSFDC_CMSFDC_DES_EXIT=0x4
+[TRACE]TRACE_FLOW[0x8A]_CMSFDC_CONSTRUCTL_ENTRY=0x5
+[TRACE]TRACE_FLOW[0x8A]_CMSFDC_CONSTRUCTL_EXIT=0x6
+[TRACE]TRACE_FLOW[0x8A]_CMSFDC_GETINTERFACE_ENTRY=0x1b
+[TRACE]TRACE_FLOW[0x8A]_CMSFDC_GETINTERFACE_EXIT=0x1c
+[TRACE]TRACE_FLOW[0x8A]_CMSFDC_MFI1DEVICEDETACHED_ENTRY=0x19
+[TRACE]TRACE_FLOW[0x8A]_CMSFDC_MFI1DEVICEDETACHED_EXIT=0x1a
+[TRACE]TRACE_FLOW[0x8A]_CMSFDC_MFI1NEWFUNCTION_ENTRY=0x7
+[TRACE]TRACE_FLOW[0x8A]_CMSFDC_MFI1NEWFUNCTION_EXIT=0x8
+[TRACE]TRACE_FLOW[0x8A]_CMSFDC_MFI1NEWFUNCTION_EXIT_DUP1=0x11
+[TRACE]TRACE_FLOW[0x8A]_CMSFDC_MFI1NEWFUNCTION_EXIT_DUP2=0x12
+[TRACE]TRACE_FLOW[0x8A]_CMSFDC_MFI1NEWFUNCTION_EXIT_DUP3=0x13
+[TRACE]TRACE_FLOW[0x8A]_CMSFDC_MFI1NEWFUNCTION_EXIT_DUP4=0x14
+[TRACE]TRACE_FLOW[0x8A]_CMSFDC_MFI1NEWFUNCTION_EXIT_DUP5=0x15
+[TRACE]TRACE_FLOW[0x8A]_CMSFDC_MFI1NEWFUNCTION_EXIT_DUP6=0x16
+[TRACE]TRACE_FLOW[0x8A]_CMSFDC_MFI1NEWFUNCTION_EXIT_DUP7=0x17
+[TRACE]TRACE_FLOW[0x8A]_CMSFDC_MFI1NEWFUNCTION_EXIT_DUP8=0x18
+[TRACE]TRACE_FLOW[0x8A]_CMSFDC_NEWL_ENTRY=0x1
+[TRACE]TRACE_FLOW[0x8A]_CMSFDC_NEWL_EXIT=0x2
+[TRACE]TRACE_NORMAL[0x86]_CMSFDC_CMSFDC=0x1
+[TRACE]TRACE_NORMAL[0x86]_CMSFDC_CONSTRUCTL=0x2
+[TRACE]TRACE_NORMAL[0x86]_CMSFDC_CONSTRUCTL_DUP1=0x3
+[TRACE]TRACE_NORMAL[0x86]_CMSFDC_GETINTERFACE=0xc
+[TRACE]TRACE_NORMAL[0x86]_CMSFDC_GETINTERFACE_DUP1=0xd
+[TRACE]TRACE_NORMAL[0x86]_CMSFDC_MFI1DEVICEDETACHED=0xb
+[TRACE]TRACE_NORMAL[0x86]_CMSFDC_MFI1NEWFUNCTION=0x4
+[TRACE]TRACE_NORMAL[0x86]_CMSFDC_MFI1NEWFUNCTION_DUP1=0x5
+[TRACE]TRACE_NORMAL[0x86]_CMSFDC_MFI1NEWFUNCTION_DUP11=0x8
+[TRACE]TRACE_NORMAL[0x86]_CMSFDC_MFI1NEWFUNCTION_DUP13=0x9
+[TRACE]TRACE_NORMAL[0x86]_CMSFDC_MFI1NEWFUNCTION_DUP15=0xa
+[TRACE]TRACE_NORMAL[0x86]_CMSFDC_MFI1NEWFUNCTION_DUP2=0x6
+[TRACE]TRACE_NORMAL[0x86]_CMSFDC_MFI1NEWFUNCTION_DUP9=0x7
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_DUP1_CMSFDC_MFI1NEWFUNCTION_EXIT=0x9
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_DUP2_CMSFDC_MFI1NEWFUNCTION_EXIT=0xa
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_DUP3_CMSFDC_MFI1NEWFUNCTION_EXIT=0xb
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_DUP4_CMSFDC_MFI1NEWFUNCTION_EXIT=0xc
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_DUP5_CMSFDC_MFI1NEWFUNCTION_EXIT=0xd
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_DUP6_CMSFDC_MFI1NEWFUNCTION_EXIT=0xe
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_DUP7_CMSFDC_MFI1NEWFUNCTION_EXIT=0xf
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_DUP8_CMSFDC_MFI1NEWFUNCTION_EXIT=0x10
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/bwins/msmmicsession_over_dummycomponentu.def	Tue Aug 31 17:01:47 2010 +0300
@@ -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
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/eabi/msmmicsession_over_dummycomponentu.def	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,6 @@
+EXPORTS
+	_ZN16RHostMassStorage10DisconnectEv @ 1 NONAME
+	_ZN16RHostMassStorage14EjectUsbDrivesEv @ 2 NONAME
+	_ZN16RHostMassStorage7ConnectEv @ 3 NONAME
+	_ZNK16RHostMassStorage7VersionEv @ 4 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/eabi/msmmindicatorsessionu.def	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,6 @@
+EXPORTS
+	_ZN16RHostMassStorage10DisconnectEv @ 1 NONAME
+	_ZN16RHostMassStorage14EjectUsbDrivesEv @ 2 NONAME
+	_ZN16RHostMassStorage7ConnectEv @ 3 NONAME
+	_ZNK16RHostMassStorage7VersionEv @ 4 NONAME
+
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/group/bld.inf	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/group/bld.inf	Tue Aug 31 17:01:47 2010 +0300
@@ -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)
 
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/group/msmmclient_base.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/group/msmmclient_base.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-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"
@@ -20,8 +20,6 @@
  @internalComponent
 */
 
-#include <usb/usblogger.mmh>
-
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
 LIBRARY	euser.lib
@@ -33,5 +31,6 @@
 USERINCLUDE ../../inc
 USERINCLUDE ../public
 USERINCLUDE ../../server/public
+USERINCLUDE ../traces
 
 VENDORID 0x70000001 
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/group/msmmclient_over_dummycomponent.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/group/msmmclient_over_dummycomponent.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/group/msmmindicatorclient.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -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" 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/group/msmmindicatorclient_base.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2008-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
+ @internalComponent
+*/
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+LIBRARY	euser.lib
+
+SOURCEPATH ../src
+
+SOURCE msmmindicatorclient.cpp
+
+USERINCLUDE ../../inc
+USERINCLUDE ../public
+USERINCLUDE ../../server/public
+USERINCLUDE ../traces
+
+VENDORID 0x70000001 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/group/msmmindicatorclient_over_dummycomponent.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/public/msmmindicatorclient.h	Tue Aug 31 17:01:47 2010 +0300
@@ -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 <e32std.h>
+
+/**
+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
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/src/msmmclient.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/src/msmmclient.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-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"
@@ -26,11 +26,12 @@
 #include <e32cmn.h>
 
 #include "srvdef.h"
- 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "UsbHostMsmmClient");
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "msmmclientTraces.h"
 #endif
 
+ 
 // Costants
 const TInt KConnectRetry = 0x2;
 
@@ -40,7 +41,7 @@
 
 static TInt StartServer()
     {
-    LOG_STATIC_FUNC_ENTRY
+    OstTraceFunctionEntry0( MSMMCLIENT_SRC_STARTSERVER_ENTRY );
     
     TInt ret = KErrNone;
 
@@ -53,6 +54,7 @@
     // Was server process created OK?
     if (KErrNone != ret)
         {
+        OstTraceFunctionExit0( MSMMCLIENT_SRC_STARTSERVER_EXIT );
         return ret;
         }
 
@@ -77,6 +79,7 @@
     TInt exitReason = (EExitPanic == server.ExitType()) ? 
             KErrGeneral : serverDiedRequestStatus.Int();
     server.Close();
+    OstTraceFunctionExit0( MSMMCLIENT_SRC_STARTSERVER_EXIT_DUP1 );
     return exitReason;
     }
 
@@ -87,7 +90,7 @@
 
 EXPORT_C TInt RMsmmSession::Connect()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( RMSMMSESSION_CONNECT_ENTRY );
     
     TInt retry = KConnectRetry; // Attempt connect twice then give up
     TInt ret(KErrNone);
@@ -113,25 +116,28 @@
 
     if (KErrNone != ret)
         {
-        LOGTEXT2(_L("Underlying error value = %d"), ret)
+        OstTrace1( TRACE_ERROR, RMSMMSESSION_CONNECT, 
+                "Underlying error value = %d", ret );
+        
         ret = KErrCouldNotConnect;
         }
     
+    OstTraceFunctionExit0( RMSMMSESSION_CONNECT_EXIT );
     return ret; 
     }
 
 EXPORT_C TInt RMsmmSession::Disconnect()
     {
-    LOG_FUNC
-    
+    OstTraceFunctionEntry0( RMSMMSESSION_DISCONNECT_ENTRY );
     Close();
+    OstTraceFunctionExit0( RMSMMSESSION_DISCONNECT_EXIT );
     return KErrNone;
     }
 
 // Called to provide the version number of the server we require for this API
 EXPORT_C TVersion RMsmmSession::Version() const
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( RMSMMSESSION_VERSION_ENTRY );
     
     return TVersion(KMsmmServMajorVersionNumber,
                     KMsmmServMinorVersionNumber,
@@ -142,7 +148,7 @@
         const TUSBMSDeviceDescription& aDevice,
         TUint8 aInterfaceNumber, TUint32 aInterfaceToken)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( RMSMMSESSION_ADDFUNCTION_ENTRY );
     
     TInt ret(KErrNone);
     
@@ -154,12 +160,13 @@
 
     ret = SendReceive(EHostMsmmServerAddFunction, usbmsIpcArgs);
     
+    OstTraceFunctionExit0( RMSMMSESSION_ADDFUNCTION_EXIT );
     return ret;
     }
 
 EXPORT_C TInt RMsmmSession::RemoveDevice(TUint aDevice)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( RMSMMSESSION_REMOVEDEVICE_ENTRY );
     
     TInt ret(KErrNone);
 
@@ -167,28 +174,31 @@
 
     ret = SendReceive(EHostMsmmServerRemoveDevice, usbmsIpcArgs);
     
+    OstTraceFunctionExit0( RMSMMSESSION_REMOVEDEVICE_EXIT );
     return ret;
     }
 
 EXPORT_C TInt RMsmmSession::__DbgFailNext(TInt aCount)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( RMSMMSESSION_DBGFAILNEXT_ENTRY );
     
 #ifdef _DEBUG
     return SendReceive(EHostMsmmServerDbgFailNext, TIpcArgs(aCount));
 #else
     (void)aCount;
+    OstTraceFunctionExit0( RMSMMSESSION_DBGFAILNEXT_EXIT );
     return KErrNone;
 #endif
     }
 
 EXPORT_C TInt RMsmmSession::__DbgAlloc()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( RMSMMSESSION_DBGALLOC_ENTRY );
     
 #ifdef _DEBUG
     return SendReceive(EHostMsmmServerDbgAlloc);
 #else
+    OstTraceFunctionExit0( RMSMMSESSION_DBGALLOC_EXIT );
     return KErrNone;
 #endif
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/src/msmmindicatorclient.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,116 @@
+/*
+* Copyright (c) 2008-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
+ @internalComponent
+*/
+
+#include <usb/usblogger.h>
+#include <e32cmn.h>
+
+#include "srvdef.h"
+#include "msmmindicatorclient.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "msmmindicatorclientTraces.h"
+#endif
+
+ 
+
+// Costants
+const TInt KConnectRetry = 0x2;
+
+
+//---------------------------------------------------------------------------
+// RHostMassStorage
+//
+// Public member functions
+
+EXPORT_C TInt RHostMassStorage::Connect()
+    {
+    OstTraceFunctionEntry0( RHOSTMASSSTORAGE_CONNECT_ENTRY );
+    
+    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))
+            {
+            OstTrace1( TRACE_NORMAL, RHOSTMASSSTORAGE_CONNECT, 
+                    "Underlying error value = %d", ret );
+            return KErrNotReady;
+            }
+        if ( KErrNone == ret )
+            {
+            break;
+            }
+        if ((--retry) == 0)
+            {
+            break;
+            }
+        }    
+    OstTraceFunctionExit0( RHOSTMASSSTORAGE_CONNECT_EXIT );
+    return ret; 
+    }
+
+EXPORT_C TInt RHostMassStorage::Disconnect()
+    {
+    OstTraceFunctionEntry0( RHOSTMASSSTORAGE_DISCONNECT_ENTRY );
+    
+    Close();
+    OstTraceFunctionExit0( RHOSTMASSSTORAGE_DISCONNECT_EXIT );
+    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
+    {
+    OstTraceFunctionEntry0( RHOSTMASSSTORAGE_VERSION_ENTRY );
+    
+    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()
+    {
+    OstTraceFunctionEntry0( RHOSTMASSSTORAGE_EJECTUSBDRIVES_ENTRY );
+    
+    TInt ret(KErrNone);
+
+    TIpcArgs usbmsIpcArgs;
+
+    ret = Send(EHostMsmmServerEjectUsbDrives, usbmsIpcArgs);
+    
+    OstTraceFunctionExit0( RHOSTMASSSTORAGE_EJECTUSBDRIVES_EXIT );
+    return ret;
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/traces/OstTraceDefinitions.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,7 @@
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <opensystemtrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/traces/fixed_id.definitions	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,28 @@
+#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt.
+[GROUP]TRACE_FLOW=0x8a
+[GROUP]TRACE_NORMAL=0x86
+[TRACE]TRACE_FLOW[0x8A]_RHOSTMASSSTORAGE_CONNECT_ENTRY=0x11
+[TRACE]TRACE_FLOW[0x8A]_RHOSTMASSSTORAGE_CONNECT_EXIT=0x12
+[TRACE]TRACE_FLOW[0x8A]_RHOSTMASSSTORAGE_DISCONNECT_ENTRY=0x13
+[TRACE]TRACE_FLOW[0x8A]_RHOSTMASSSTORAGE_DISCONNECT_EXIT=0x14
+[TRACE]TRACE_FLOW[0x8A]_RHOSTMASSSTORAGE_EJECTUSBDRIVES_ENTRY=0x16
+[TRACE]TRACE_FLOW[0x8A]_RHOSTMASSSTORAGE_EJECTUSBDRIVES_EXIT=0x17
+[TRACE]TRACE_FLOW[0x8A]_RHOSTMASSSTORAGE_VERSION_ENTRY=0x15
+[TRACE]TRACE_NORMAL[0x86]_RHOSTMASSSTORAGE_CONNECT=0x1
+[[OBSOLETE]][TRACE]TRACE_ERROR[0x82]_RMSMMSESSION_CONNECT=0x1
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_MSMMCLIENT_SRC_STARTSERVER_ENTRY=0x1
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_MSMMCLIENT_SRC_STARTSERVER_EXIT=0x2
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_MSMMCLIENT_SRC_STARTSERVER_EXIT_DUP1=0x3
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_RMSMMSESSION_ADDFUNCTION_ENTRY=0x9
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_RMSMMSESSION_ADDFUNCTION_EXIT=0xa
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_RMSMMSESSION_CONNECT_ENTRY=0x4
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_RMSMMSESSION_CONNECT_EXIT=0x5
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_RMSMMSESSION_DBGALLOC_ENTRY=0xf
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_RMSMMSESSION_DBGALLOC_EXIT=0x10
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_RMSMMSESSION_DBGFAILNEXT_ENTRY=0xd
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_RMSMMSESSION_DBGFAILNEXT_EXIT=0xe
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_RMSMMSESSION_DISCONNECT_ENTRY=0x6
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_RMSMMSESSION_DISCONNECT_EXIT=0x7
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_RMSMMSESSION_REMOVEDEVICE_ENTRY=0xb
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_RMSMMSESSION_REMOVEDEVICE_EXIT=0xc
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_RMSMMSESSION_VERSION_ENTRY=0x8
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/group/bld.inf	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/group/bld.inf	Tue Aug 31 17:01:47 2010 +0300
@@ -23,10 +23,10 @@
 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
+
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/group/msmm_over_dummycomponent_bld.inf	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/group/msmm_over_dummycomponent_bld.inf	Tue Aug 31 17:01:47 2010 +0300
@@ -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
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/group/usbhostmsmm.iby	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/group/usbhostmsmm.iby	Tue Aug 31 17:01:47 2010 +0300
@@ -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
 
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/inc/srvdef.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/inc/srvdef.h	Tue Aug 31 17:01:47 2010 +0300
@@ -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
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/referencepolicyplugin/group/referencepolicyplugin.mmh	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/referencepolicyplugin/group/referencepolicyplugin.mmh	Tue Aug 31 17:01:47 2010 +0300
@@ -24,7 +24,6 @@
 UID 0x10009D8d 0x10285c46
 
 #include "../../server/public/hostmscaps.mmh"
-#include <usb/usblogger.mmh>
 
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
@@ -41,6 +40,8 @@
 
 USERINCLUDE ../inc
 USERINCLUDE ../../inc
+USERINCLUDE ../traces
+
 SOURCEPATH ../data
 
 NOEXPORTLIBRARY
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/referencepolicyplugin/group/refpp_over_dummycomponent.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/referencepolicyplugin/group/refpp_over_dummycomponent.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -29,4 +29,6 @@
 	TARGET dummyreferencepolicyplugin.rsc
 END
 
+LIBRARY    dummynotifier.lib
+
 MACRO   __OVER_DUMMYCOMPONENT__
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/referencepolicyplugin/inc/refppnotificationman.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/referencepolicyplugin/inc/refppnotificationman.h	Tue Aug 31 17:01:47 2010 +0300
@@ -27,6 +27,10 @@
 #include <usb/hostms/msmm_policy_def.h>
 #include <usb/hostms/srverr.h>
 
+#ifdef __OVER_DUMMYCOMPONENT__
+    #include <usb/hostms/dummycomponent/dummynotifier.h>
+#endif
+
 typedef RArray<THostMsErrorDataPckg> THostMsErrDataQueue;
 const TInt KMaxResponseStringLen = 16;
 
@@ -54,7 +58,11 @@
 private:
     THostMsErrDataQueue iErrorQueue;
     TBuf8<16> iResponse;
+#ifdef __OVER_DUMMYCOMPONENT__
+    RDummyNotifier iNotifier;
+#else
     RNotifier iNotifier;
+#endif
     };
 
 #endif /*REFPPNOTIFICATIONMAN_H*/
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/referencepolicyplugin/src/proxy.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/referencepolicyplugin/src/proxy.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-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"
@@ -27,10 +27,12 @@
 
 #include "referencepolicyplugin.h"
 #include "referenceplugin.hrh"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "proxyTraces.h"
+#endif
+
  
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "UsbHostMsmmRefPP");
-#endif
 
 // Provides a key value pair table, this is used to identify
 // the correct construction function for the requested interface.
@@ -44,9 +46,11 @@
 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
         TInt& aTableCount)
     {
-    LOGTEXT(_L(">>ImplementationGroupProxy()"));
+    OstTrace0( TRACE_NORMAL, REF_REFERENCEPOLICYPLUGIN_SRC_IMPLEMENTATIONGROUPPROXY, 
+            ">>ImplementationGroupProxy()" );
     aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
-    LOGTEXT(_L("<<ImplementationGroupProxy()"));
+    OstTrace0( TRACE_NORMAL, REF_REFERENCEPOLICYPLUGIN_SRC_IMPLEMENTATIONGROUPPROXY_DUP1, 
+                "<<ImplementationGroupProxy()" );
     return ImplementationTable;
     }
 
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/referencepolicyplugin/src/referencepolicyplugin.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/referencepolicyplugin/src/referencepolicyplugin.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-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"
@@ -27,10 +27,12 @@
 #include <usb/hostms/msmm_policy_def.h>
 #include "refppnotificationman.h"
 #include "srvpanic.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "referencepolicypluginTraces.h"
+#endif
+
  
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "UsbHostMsmmRefPP");
-#endif
 
 //  Global Variables
 const TUid KHostMsRepositoryUid = {0x10285c46};
@@ -47,29 +49,34 @@
 
 CReferencePolicyPlugin::~CReferencePolicyPlugin()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_CREFERENCEPOLICYPLUGIN_DES_ENTRY );
+    
     Cancel();
     ClearHistory(); // Remove all buffered history record.
     delete iRepository;
     delete iNotificationMan;
     iFs.Close();
+    OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_CREFERENCEPOLICYPLUGIN_DES_EXIT );
     }
 
 CReferencePolicyPlugin* CReferencePolicyPlugin::NewL()
     {
-    LOG_STATIC_FUNC_ENTRY
+    OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_NEWL_ENTRY );
+    
     CReferencePolicyPlugin* self = new (ELeave) CReferencePolicyPlugin;
     CleanupStack::PushL(self);
     self->ConstructL();
     CleanupStack::Pop(self);
     
+    OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_NEWL_EXIT );
     return self;
     }
 
 void CReferencePolicyPlugin::RetrieveDriveLetterL(TText& aDriveName,
         const TPolicyRequestData& aData, TRequestStatus& aStatus)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_RETRIEVEDRIVELETTERL_TTEXT_TPOLICYREQUESTDATA_TREQUESTSTATUS_ENTRY );
+    
     Cancel();
     aStatus = KRequestPending;
     iClientStatus = &aStatus;    
@@ -78,18 +85,22 @@
     // In a licensee owned policy plugin, it shall complete client 
     // request in RunL() in general 
     Complete(KErrNone);
+    OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_RETRIEVEDRIVELETTERL_TTEXT_TPOLICYREQUESTDATA_TREQUESTSTATUS_EXIT );
     }
 
 void CReferencePolicyPlugin::CancelRetrieveDriveLetter()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_CANCELRETRIEVEDRIVELETTER_ENTRY );
+    
     Cancel();
+    OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_CANCELRETRIEVEDRIVELETTER_EXIT );
     }
 
 void CReferencePolicyPlugin::SaveLatestMountInfoL(
         const TPolicyMountRecord& aData, TRequestStatus& aStatus)
     {
-    LOG_FUNC    
+    OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_SAVELATESTMOUNTINFOL_TPOLICYMOUNTRECORD_TREQUESTSTATUS_ENTRY );
+    
     Cancel();
     aStatus = KRequestPending;
     iClientStatus = &aStatus;
@@ -98,56 +109,70 @@
     // In a licensee owned policy plugin, it shall complete client 
     // request in RunL() in general 
     Complete(KErrNone);
+    OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_SAVELATESTMOUNTINFOL_TPOLICYMOUNTRECORD_TREQUESTSTATUS_EXIT );
     }
 
 void CReferencePolicyPlugin::CancelSaveLatestMountInfo()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_CANCELSAVELATESTMOUNTINFO_ENTRY );
+    
     Cancel();
+    OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_CANCELSAVELATESTMOUNTINFO_EXIT );
     }
 
 void CReferencePolicyPlugin::SendErrorNotificationL(
         const THostMsErrData& aErrData)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_SENDERRORNOTIFICATIONL_ENTRY );
+    
     iNotificationMan->SendErrorNotificationL(aErrData);
+    OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_SENDERRORNOTIFICATIONL_EXIT );
     }
 
 void CReferencePolicyPlugin::GetSuspensionPolicy(TSuspensionPolicy& aPolicy)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_GETSUSPENSIONPOLICY_ENTRY );
+    
     aPolicy = iSuspensionPolicy;
+    OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_GETSUSPENSIONPOLICY_EXIT );
     }
 
 void CReferencePolicyPlugin::DoCancel()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_DOCANCEL_ENTRY );
+    
     // No more work need to do in current implementation of reference
     // policy plugin. 
     // In a licensee owned policy plugin, it shall complete client 
     // request here with KErrCancel.
+    OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_DOCANCEL_EXIT );
     }
 
 void CReferencePolicyPlugin::RunL()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_RUNL_ENTRY );
+    
     // No more work need to do in current implementation of reference
     // policy plugin. 
     // In a licensee owned policy plugin, it shall complete client 
     // request here with a proper error code.
+    OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_RUNL_EXIT );
     }
 
 CReferencePolicyPlugin::CReferencePolicyPlugin() :
 CMsmmPolicyPluginBase(),
 iHistory(KHistoryGranularity)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_CREFERENCEPOLICYPLUGIN_CONS_ENTRY );
+    
     CActiveScheduler::Add(this);
+    OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_CREFERENCEPOLICYPLUGIN_CONS_EXIT );
     }
 
 void CReferencePolicyPlugin::ConstructL()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_CONSTRUCTL_ENTRY );
+    
     iRepository = CRepository::NewL(KHostMsRepositoryUid);
     User::LeaveIfError(iFs.Connect());
     iNotificationMan = CMsmmPolicyNotificationManager::NewL();
@@ -160,13 +185,14 @@
     User::LeaveIfError(iRepository->Get(
             KMediaPollingTimeUid, value));
     iSuspensionPolicy.iStatusPollingInterval = value;
+    OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_CONSTRUCTL_EXIT );
     }
 
 void CReferencePolicyPlugin::RetrieveDriveLetterL(TText& aDriveName,
         const TPolicyRequestData& aData)
     {
-    LOG_FUNC
-
+    OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_RETRIEVEDRIVELETTERL_TTEXT_TPOLICYREQUESTDATA_ENTRY );
+    
     TDriveList availableNames;
     FilterFsForbiddenDriveListL(availableNames);
 
@@ -201,15 +227,17 @@
             aDriveName = history.iDriveName;
             }
         }
+    OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_RETRIEVEDRIVELETTERL_TTEXT_TPOLICYREQUESTDATA_EXIT );
     }
 
 void CReferencePolicyPlugin::SaveLatestMountInfoL(
         const TPolicyMountRecord& aData)
     {
-    LOG_FUNC
-
+  OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_SAVELATESTMOUNTINFOL_TPOLICYMOUNTRECORD_ENTRY );
+  
     if (iMaxHistoryRecCount == 0) // This policy disable history
         {
+        OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_SAVELATESTMOUNTINFOL_TPOLICYMOUNTRECORD_EXIT );
         return;
         }
     
@@ -243,24 +271,30 @@
         TPckg<TPolicyMountRecord> historyPckg(*iHistory[index]);
         User::LeaveIfError(iRepository->Set(historyRecordUid++, historyPckg));
         }
+    OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_SAVELATESTMOUNTINFOL_TPOLICYMOUNTRECORD_EXIT_DUP1 );
     }
 
 void CReferencePolicyPlugin::Complete(TInt aError)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_COMPLETE_ENTRY );
+    
     User::RequestComplete(iClientStatus, aError);
+    OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_COMPLETE_EXIT );
     }
 
 void CReferencePolicyPlugin::PrepareAvailableDriveList()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_PREPAREAVAILABLEDRIVELIST_ENTRY );
+    
     iAvailableDrvList.SetLength(KMaxDrives);
     iAvailableDrvList.Fill(0, KMaxDrives);
+    OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_PREPAREAVAILABLEDRIVELIST_EXIT );
     }
 
 void CReferencePolicyPlugin::AvailableDriveListL()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_AVAILABLEDRIVELISTL_ENTRY );
+    
     TBuf8<KPermittedDrvRangeBufLen> permittedRange;
     TDriveList forbiddenList;
 
@@ -280,12 +314,14 @@
                 }
             }
         }
+    OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_AVAILABLEDRIVELISTL_EXIT );
     }
 
 void CReferencePolicyPlugin::FilterFsForbiddenDriveListL(
         TDriveList& aAvailableNames)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_FILTERFSFORBIDDENDRIVELISTL_ENTRY );
+    
     TDriveList names;
     names.SetLength(KMaxDrives);
 
@@ -302,13 +338,15 @@
         }
     names.SetLength(count);
     aAvailableNames = names;
+    OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_FILTERFSFORBIDDENDRIVELISTL_EXIT );
     }
 
 void CReferencePolicyPlugin::FindFirstNotUsedDriveLetter(
         const TDriveList& aAvailableNames,
         TText& aDriveName)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_FINDFIRSTNOTUSEDDRIVELETTER_ENTRY );
+    
     TDriveList usedLetter;
     TUint index = 0;
     for (index = 0; index < iHistory.Count(); index++)
@@ -321,15 +359,18 @@
         if (usedLetter.Locate(aAvailableNames[index]) == KErrNotFound)
             {
             aDriveName = aAvailableNames[index];
+            OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_FINDFIRSTNOTUSEDDRIVELETTER_EXIT );
             return; // A unused drive letter found out
             }
         }
+    OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_FINDFIRSTNOTUSEDDRIVELETTER_EXIT_DUP1 );
     }
 
 // Retrieve history from CR
 void CReferencePolicyPlugin::RetrieveHistoryL()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_RETRIEVEHISTORYL_ENTRY );
+    
     // Read history record number from CR
     TInt historyCount(0);
     User::LeaveIfError(
@@ -352,21 +393,25 @@
             CleanupStack::Pop(record);
             }
         }
+    OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_RETRIEVEHISTORYL_EXIT );
     }
 
 // Remove all buffered history
 void CReferencePolicyPlugin::ClearHistory()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_CLEARHISTORY_ENTRY );
+    
     iHistory.ResetAndDestroy();
     iHistory.Close();
+    OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_CLEARHISTORY_EXIT );
     }
 
 // Search in history for a logic unit	
 TInt CReferencePolicyPlugin::SearchHistoryByLogicUnit(
         const TPolicyRequestData& aLogicUnit) const
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CREFERENCEPOLICYPLUGIN_SEARCHHISTORYBYLOGICUNIT_ENTRY );
+    
     TInt ret(KErrNotFound);
     TUint count = iHistory.Count();
     for (TUint index = 0; index < count; index ++)
@@ -383,10 +428,12 @@
                 (logicalUnit.iOtgInformation == aLogicUnit.iOtgInformation))
             {
             // Matched
+            OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_SEARCHHISTORYBYLOGICUNIT_EXIT );
             return index;
             }
         }
     // Can't find any matched records
+    OstTraceFunctionExit0( REF_CREFERENCEPOLICYPLUGIN_SEARCHHISTORYBYLOGICUNIT_EXIT_DUP1 );
     return ret;
     }
 
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/referencepolicyplugin/src/refppnotificationman.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/referencepolicyplugin/src/refppnotificationman.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-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"
@@ -24,11 +24,12 @@
 #include <usb/usblogger.h>
 #include <usb/hostms/policypluginnotifier.hrh>
 #include "srvpanic.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "refppnotificationmanTraces.h"
+#endif
 
- 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "UsbHostMsmmRefPP");
-#endif
+
 
 #ifdef __OVER_DUMMYCOMPONENT__
 const TUid KMountPolicyNotifierUid = {0x1028653E};
@@ -38,89 +39,112 @@
 
 CMsmmPolicyNotificationManager::~CMsmmPolicyNotificationManager()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_CMSMMPOLICYNOTIFICATIONMANAGER_DES_ENTRY );
+    
     Cancel();
     iErrorQueue.Close();
     iNotifier.Close();
+    OstTraceFunctionExit0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_CMSMMPOLICYNOTIFICATIONMANAGER_DES_EXIT );
     }
 
 CMsmmPolicyNotificationManager* CMsmmPolicyNotificationManager::NewL()
     {
-    LOG_STATIC_FUNC_ENTRY
+    OstTraceFunctionEntry0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_NEWL_ENTRY );
+    
     CMsmmPolicyNotificationManager* self = 
         CMsmmPolicyNotificationManager::NewLC();
     CleanupStack::Pop(self);
     
+    OstTraceFunctionExit0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_NEWL_EXIT );
     return self;
     }
 
 CMsmmPolicyNotificationManager* CMsmmPolicyNotificationManager::NewLC()
     {
-    LOG_STATIC_FUNC_ENTRY
+    OstTraceFunctionEntry0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_NEWLC_ENTRY );
+    
     CMsmmPolicyNotificationManager* self = 
         new (ELeave) CMsmmPolicyNotificationManager();
     CleanupStack::PushL(self);
     self->ConstructL();
     
+    OstTraceFunctionExit0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_NEWLC_EXIT );
     return self;
     }
 
 void CMsmmPolicyNotificationManager::SendErrorNotificationL(
         const THostMsErrData& aErrData)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_SENDERRORNOTIFICATIONL_ENTRY );
+    
 
     // Print error notification data to log
-    LOGTEXT2(_L("Err:iError = %d"), aErrData.iError);
-    LOGTEXT2(_L("Err:iE32Error = %d"), aErrData.iE32Error);
-    LOGTEXT2(_L("Err:iDriveName = %d"), aErrData.iDriveName);
-    LOGTEXT2(_L("Err:iManufacturerString = %S"), &aErrData.iManufacturerString);
-    LOGTEXT2(_L("Err:iProductString = %S"), &aErrData.iProductString);
-    
+    OstTrace1( TRACE_NORMAL, REF_CMSMMPOLICYNOTIFICATIONMANAGER_SENDERRORNOTIFICATIONL, 
+            "Err:iError = %d", aErrData.iError );
+    OstTrace1( TRACE_NORMAL, REF_CMSMMPOLICYNOTIFICATIONMANAGER_SENDERRORNOTIFICATIONL_DUP1, 
+            "Err:iE32Error = %d", aErrData.iE32Error );
+    OstTrace1( TRACE_NORMAL, REF_CMSMMPOLICYNOTIFICATIONMANAGER_SENDERRORNOTIFICATIONL_DUP2, 
+            "Err:iDriveName = %d", aErrData.iDriveName );
+    OstTraceExt1( TRACE_NORMAL, REF_CMSMMPOLICYNOTIFICATIONMANAGER_SENDERRORNOTIFICATIONL_DUP3, 
+            "Err:iManufacturerString = %S", aErrData.iManufacturerString );
+    OstTraceExt1( TRACE_NORMAL, REF_CMSMMPOLICYNOTIFICATIONMANAGER_SENDERRORNOTIFICATIONL_DUP4, 
+            "Err:iProductString = %S", aErrData.iProductString );
+            
     THostMsErrorDataPckg errPckg = aErrData;
     iErrorQueue.AppendL(errPckg);
     if (!IsActive())
     	{
     	SendNotification();
     	}
+    OstTraceFunctionExit0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_SENDERRORNOTIFICATIONL_EXIT );
     }
 
 void CMsmmPolicyNotificationManager::RunL()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_RUNL_ENTRY );
+    
     iErrorQueue.Remove(0);
     if (iErrorQueue.Count() > 0)
         {
         SendNotification();
         }
+    OstTraceFunctionExit0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_RUNL_EXIT );
     }
 
 void CMsmmPolicyNotificationManager::DoCancel()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_DOCANCEL_ENTRY );
+    
     iErrorQueue.Reset();
     iNotifier.CancelNotifier(KMountPolicyNotifierUid);
+    OstTraceFunctionExit0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_DOCANCEL_EXIT );
     }
 
 CMsmmPolicyNotificationManager::CMsmmPolicyNotificationManager():
 CActive(EPriorityStandard)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_CMSMMPOLICYNOTIFICATIONMANAGER_ENTRY );
+    
     CActiveScheduler::Add(this);
+    OstTraceFunctionExit0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_CMSMMPOLICYNOTIFICATIONMANAGER_EXIT );
     }
 
 void CMsmmPolicyNotificationManager::ConstructL()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_CONSTRUCTL_ENTRY );
+    
     User::LeaveIfError(iNotifier.Connect());
+    OstTraceFunctionExit0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_CONSTRUCTL_EXIT );
     }
 
 void CMsmmPolicyNotificationManager::SendNotification()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_SENDNOTIFICATION_ENTRY );
+    
     iNotifier.StartNotifierAndGetResponse(
         iStatus, KMountPolicyNotifierUid, iErrorQueue[0], iResponse);
     SetActive();
+    OstTraceFunctionExit0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_SENDNOTIFICATION_EXIT );
     }
 
 // End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/referencepolicyplugin/traces/OstTraceDefinitions.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,7 @@
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <opensystemtrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/referencepolicyplugin/traces/fixed_id.definitions	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,86 @@
+#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt.
+[GROUP]TRACE_FLOW=0x8a
+[GROUP]TRACE_NORMAL=0x86
+[TRACE]TRACE_FLOW[0x8A]_REF_CMSMMPOLICYNOTIFICATIONMANAGER_CMSMMPOLICYNOTIFICATIONMANAGER_DES_ENTRY=0x30
+[TRACE]TRACE_FLOW[0x8A]_REF_CMSMMPOLICYNOTIFICATIONMANAGER_CMSMMPOLICYNOTIFICATIONMANAGER_DES_EXIT=0x31
+[TRACE]TRACE_FLOW[0x8A]_REF_CMSMMPOLICYNOTIFICATIONMANAGER_CMSMMPOLICYNOTIFICATIONMANAGER_ENTRY=0x3c
+[TRACE]TRACE_FLOW[0x8A]_REF_CMSMMPOLICYNOTIFICATIONMANAGER_CMSMMPOLICYNOTIFICATIONMANAGER_EXIT=0x3d
+[TRACE]TRACE_FLOW[0x8A]_REF_CMSMMPOLICYNOTIFICATIONMANAGER_CONSTRUCTL_ENTRY=0x3e
+[TRACE]TRACE_FLOW[0x8A]_REF_CMSMMPOLICYNOTIFICATIONMANAGER_CONSTRUCTL_EXIT=0x3f
+[TRACE]TRACE_FLOW[0x8A]_REF_CMSMMPOLICYNOTIFICATIONMANAGER_DOCANCEL_ENTRY=0x3a
+[TRACE]TRACE_FLOW[0x8A]_REF_CMSMMPOLICYNOTIFICATIONMANAGER_DOCANCEL_EXIT=0x3b
+[TRACE]TRACE_FLOW[0x8A]_REF_CMSMMPOLICYNOTIFICATIONMANAGER_NEWLC_ENTRY=0x34
+[TRACE]TRACE_FLOW[0x8A]_REF_CMSMMPOLICYNOTIFICATIONMANAGER_NEWLC_EXIT=0x35
+[TRACE]TRACE_FLOW[0x8A]_REF_CMSMMPOLICYNOTIFICATIONMANAGER_NEWL_ENTRY=0x32
+[TRACE]TRACE_FLOW[0x8A]_REF_CMSMMPOLICYNOTIFICATIONMANAGER_NEWL_EXIT=0x33
+[TRACE]TRACE_FLOW[0x8A]_REF_CMSMMPOLICYNOTIFICATIONMANAGER_RUNL_ENTRY=0x38
+[TRACE]TRACE_FLOW[0x8A]_REF_CMSMMPOLICYNOTIFICATIONMANAGER_RUNL_EXIT=0x39
+[TRACE]TRACE_FLOW[0x8A]_REF_CMSMMPOLICYNOTIFICATIONMANAGER_SENDERRORNOTIFICATIONL_ENTRY=0x36
+[TRACE]TRACE_FLOW[0x8A]_REF_CMSMMPOLICYNOTIFICATIONMANAGER_SENDERRORNOTIFICATIONL_EXIT=0x37
+[TRACE]TRACE_FLOW[0x8A]_REF_CMSMMPOLICYNOTIFICATIONMANAGER_SENDNOTIFICATION_ENTRY=0x40
+[TRACE]TRACE_FLOW[0x8A]_REF_CMSMMPOLICYNOTIFICATIONMANAGER_SENDNOTIFICATION_EXIT=0x41
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_AVAILABLEDRIVELISTL_ENTRY=0x22
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_AVAILABLEDRIVELISTL_EXIT=0x23
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_CANCELRETRIEVEDRIVELETTER_ENTRY=0x7
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_CANCELRETRIEVEDRIVELETTER_EXIT=0x8
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_CANCELSAVELATESTMOUNTINFO_ENTRY=0xb
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_CANCELSAVELATESTMOUNTINFO_EXIT=0xc
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_CLEARHISTORY_ENTRY=0x2b
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_CLEARHISTORY_EXIT=0x2c
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_COMPLETE_ENTRY=0x1e
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_COMPLETE_EXIT=0x1f
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_CONSTRUCTL_ENTRY=0x17
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_CONSTRUCTL_EXIT=0x18
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_CREFERENCEPOLICYPLUGIN_CONS_ENTRY=0x15
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_CREFERENCEPOLICYPLUGIN_CONS_EXIT=0x16
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_CREFERENCEPOLICYPLUGIN_DES_ENTRY=0x1
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_CREFERENCEPOLICYPLUGIN_DES_EXIT=0x2
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_DOCANCEL_ENTRY=0x11
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_DOCANCEL_EXIT=0x12
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_FILTERFSFORBIDDENDRIVELISTL_ENTRY=0x24
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_FILTERFSFORBIDDENDRIVELISTL_EXIT=0x25
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_FINDFIRSTNOTUSEDDRIVELETTER_ENTRY=0x26
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_FINDFIRSTNOTUSEDDRIVELETTER_EXIT=0x27
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_FINDFIRSTNOTUSEDDRIVELETTER_EXIT_DUP1=0x28
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_GETSUSPENSIONPOLICY_ENTRY=0xf
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_GETSUSPENSIONPOLICY_EXIT=0x10
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_NEWL_ENTRY=0x3
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_NEWL_EXIT=0x4
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_PREPAREAVAILABLEDRIVELIST_ENTRY=0x20
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_PREPAREAVAILABLEDRIVELIST_EXIT=0x21
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_RETRIEVEDRIVELETTERL_TTEXT_TPOLICYREQUESTDATA_ENTRY=0x58
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_RETRIEVEDRIVELETTERL_TTEXT_TPOLICYREQUESTDATA_EXIT=0x59
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_RETRIEVEDRIVELETTERL_TTEXT_TPOLICYREQUESTDATA_TREQUESTSTATUS_ENTRY=0x54
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_RETRIEVEDRIVELETTERL_TTEXT_TPOLICYREQUESTDATA_TREQUESTSTATUS_EXIT=0x55
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_RETRIEVEHISTORYL_ENTRY=0x29
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_RETRIEVEHISTORYL_EXIT=0x2a
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_RUNL_ENTRY=0x13
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_RUNL_EXIT=0x14
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_SAVELATESTMOUNTINFOL_TPOLICYMOUNTRECORD_ENTRY=0x5a
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_SAVELATESTMOUNTINFOL_TPOLICYMOUNTRECORD_EXIT=0x5b
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_SAVELATESTMOUNTINFOL_TPOLICYMOUNTRECORD_EXIT_DUP1=0x5c
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_SAVELATESTMOUNTINFOL_TPOLICYMOUNTRECORD_TREQUESTSTATUS_ENTRY=0x56
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_SAVELATESTMOUNTINFOL_TPOLICYMOUNTRECORD_TREQUESTSTATUS_EXIT=0x57
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_SEARCHHISTORYBYLOGICUNIT_ENTRY=0x2d
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_SEARCHHISTORYBYLOGICUNIT_EXIT=0x2e
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_SEARCHHISTORYBYLOGICUNIT_EXIT_DUP1=0x2f
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_SENDERRORNOTIFICATIONL_ENTRY=0xd
+[TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_SENDERRORNOTIFICATIONL_EXIT=0xe
+[TRACE]TRACE_NORMAL[0x86]_REF_CMSMMPOLICYNOTIFICATIONMANAGER_SENDERRORNOTIFICATIONL=0x3
+[TRACE]TRACE_NORMAL[0x86]_REF_CMSMMPOLICYNOTIFICATIONMANAGER_SENDERRORNOTIFICATIONL_DUP1=0x4
+[TRACE]TRACE_NORMAL[0x86]_REF_CMSMMPOLICYNOTIFICATIONMANAGER_SENDERRORNOTIFICATIONL_DUP2=0x5
+[TRACE]TRACE_NORMAL[0x86]_REF_CMSMMPOLICYNOTIFICATIONMANAGER_SENDERRORNOTIFICATIONL_DUP3=0x6
+[TRACE]TRACE_NORMAL[0x86]_REF_CMSMMPOLICYNOTIFICATIONMANAGER_SENDERRORNOTIFICATIONL_DUP4=0x7
+[TRACE]TRACE_NORMAL[0x86]_REF_REFERENCEPOLICYPLUGIN_SRC_IMPLEMENTATIONGROUPPROXY=0x1
+[TRACE]TRACE_NORMAL[0x86]_REF_REFERENCEPOLICYPLUGIN_SRC_IMPLEMENTATIONGROUPPROXY_DUP1=0x2
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CREFERENCEPOLICYPLUGIN_RETRIEVEDRIVELETTERL_ENTRY=0x42
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_RETRIEVEDRIVELETTERL_DUP1_ENTRY=0x4f
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_RETRIEVEDRIVELETTERL_DUP1_EXIT=0x50
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_RETRIEVEDRIVELETTERL_ENTRY=0x4d
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_RETRIEVEDRIVELETTERL_EXIT=0x4e
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_SAVELATESTMOUNTINFOL_DUP1_ENTRY=0x51
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_SAVELATESTMOUNTINFOL_DUP1_EXIT=0x52
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_SAVELATESTMOUNTINFOL_DUP1_EXIT_DUP1=0x53
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_SAVELATESTMOUNTINFOL_ENTRY=0x4b
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_SAVELATESTMOUNTINFOL_EXIT=0x4c
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_REF_CREFERENCEPOLICYPLUGIN_SAVELATESTMOUNTINFOL_EXIT_DUP1=0x1d
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/group/bld.inf	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +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:
-*
-*/
-
-/**
- @file
- @internalComponent
-*/
-
-PRJ_PLATFORMS
-ARMV5 GCCXML
-
-PRJ_TESTEXPORTS
-refppnotifier.iby  /epoc32/rom/include/refppnotifier.iby
-
-PRJ_TESTMMPFILES
-
-#if defined(SYMBIAN_ENABLE_USB_OTG_HOST) && !defined(WINS) && !defined(X86GCC)
-refppnotifier.mmp
-#endif
\ No newline at end of file
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/group/refppnotifier.iby	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +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:
-*
-*/
-
-/**
- @file
- @internalComponent
-*/
-
-#ifndef __REFPPNOTIFIER_IBY__
-#define __REFPPNOTIFIER_IBY__
-
-#include <ecom.iby>
-#ifdef _DEBUG
-ECOM_PLUGIN_UDEB(refppnotifier.dll, refppnotifier.rsc)
-#else
-ECOM_PLUGIN(refppnotifier.dll, refppnotifier.rsc)
-#endif
-
-data=DATAZ_\resource\apps\dialog.rsc		"\resource\apps\dialog.rsc"
-
-#endif // __REFPPNOTIFIER_IBY__
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/group/refppnotifier.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +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:
-*
-*/
-
-/**
- @file
- @internalComponent
-*/
- 
-TARGET		  	refppnotifier.dll
-TARGETTYPE	  	PLUGIN
-UID 			0x10009D8D 0x10285ddd
-
-CAPABILITY		ProtServ TrustedUI
-
-
-OS_LAYER_SYSTEMINCLUDE_SYMBIAN
-APP_LAYER_SYSTEMINCLUDE_SYMBIAN
-
-SOURCEPATH	  ../src
-SOURCE  refppnotifier.cpp refppdialog.cpp
-
-RESOURCE		refppnotifier.rss
-
-START RESOURCE 	dialog.rss
-HEADER
-TARGETPATH 		/resource/apps
-END
-
-LIBRARY    euser.lib
-LIBRARY    ecom.lib
-LIBRARY    eikdlg.lib
-LIBRARY    eiksrv.lib
-LIBRARY    eikcoctl.lib
-LIBRARY    cone.lib
-LIBRARY    eikcdlg.lib 
-
-USERINCLUDE ../inc
-
-NOEXPORTLIBRARY
-
-VENDORID 0x70000001 
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/inc/refppdialog.h	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +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:
-*
-*/
-
-/**
- @file
- @internalComponent
-*/
-
-#ifndef CREFPPDIALOG_H
-#define CREFPPDIALOG_H
-
-// INCLUDES
-#include <techview/eikdialg.h>
-// CLASS DECLARATION
-
-/**
-  The CRefPPDialog class
-  This is a subclass derived from CEikDialog, it is used by notifier to display
-  the message of Errors from MS mount manager.
- */
-class CRefPPDialog : public CEikDialog
-	{
-public:
-
-	~CRefPPDialog();
-	static CRefPPDialog* NewL(TBool* aDlgFlag);
-	static CRefPPDialog* NewLC(TBool* aDlgFlag);
-
-private:
-
-	CRefPPDialog(TBool* aDlgFlag);
-	void ConstructL();
-protected:
-	virtual TBool OkToExitL(TInt aButtonId);
-private:
-	TBool* iDlgFlagInOwner;
-
-	}; // class CRefPPDialog
-
-#endif // CREFPPDIALOG_H
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/inc/refppnotifier.h	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +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:
-*
-*/
-
-/**
- @file
- @internalComponent
-*/
-
-#ifndef REFPPNOTIFIER_H
-#define REFPPNOTIFIER_H
-
-#include <techview/eikdialg.h>
-#include <eiknotapi.h>
-#include "refppdialog.h"
-
-/**
-  The CMsmmRefPolicyPluginNotifier class
-  This is a subclass derived from MEikSrvNotifierBase2, it is used as a ECOM
-  plug-in of notify service to provide the function of showing a dialog when 
-  error occured in MS mount manager.
- */
-NONSHARABLE_CLASS (CMsmmRefPolicyPluginNotifier) : public MEikSrvNotifierBase2
-    {
-public:
-	~CMsmmRefPolicyPluginNotifier();
-	static CMsmmRefPolicyPluginNotifier* NewL();
-	static CMsmmRefPolicyPluginNotifier* NewLC();
-	
-public:
-    
-    // from MEikSrvNotifierBase2
-	void Release();
-	TNotifierInfo RegisterL();
-	TNotifierInfo Info() const;
-	TPtrC8 StartL(const TDesC8& aBuffer);
-	void StartL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage);
-	void Cancel();
-	TPtrC8 UpdateL(const TDesC8& aBuffer);
-	
-private:
-    CMsmmRefPolicyPluginNotifier();
-    void ConstructL();
-    
-private:
-    TNotifierInfo iInfo;
-    RMessagePtr2  iMessage;
-    CCoeEnv* iCoeEnv;
-    TInt iOffset;
-    TBool iDialogIsVisible;
-    CRefPPDialog* iDialogPtr;
-    };
-
-#endif /*REFPPNOTIFIER_H*/
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/inc/refppnotifier.hrh	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +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:
-*
-*/
-
-/**
- @file
- @internalComponent
-*/
-
-#ifndef REFPPNOTIFIER_HRH
-#define REFPPNOTIFIER_HRH
-
-// Implementation UID for reference notifier of Policy plug-in
-#define KUidMsmmReferenceNotifierImp 0x10285DDE
-
-enum
-{
-	EReferencePPNotifierButton,			//ID of button on dialog
-	EReferencePPNotifierMsg			//ID of the label on dialog
-};
-
-#endif /*REFPPNOTIFIER_HRH*/
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/src/dialog.rss	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +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:
-* Reference policy plugin notifier implementation resource file
-*
-*/
-
-/**
- @file
- @internalComponent
-*/
-
-#include <techview/eikon.rh>
-#include <techview/eikon.rsg>
-#include <techview/techviewctl.rh>
-#include <eikcoctl.rsg>
-#include "refppnotifier.hrh"
-NAME REFN
-
-RESOURCE RSS_SIGNATURE { }
-
-RESOURCE TBUF16 { buf=""; }
-
-RESOURCE DLG_BUTTONS r_dialog_buttons
-{
-buttons = 
-    {
-    DLG_BUTTON
-        {
-        id = EReferencePPNotifierButton;
-        button = CMBUT {txt = "OK";};
-        hotkey='1';
-        }
-    };
-}
-
-RESOURCE DIALOG r_notifier_dialog
-    {
-    title = "MSMM message";
-    buttons = r_dialog_buttons;
-    items = 
-        {
-        DLG_LINE
-            {
-            type = EEikCtLabel;
-            id = EReferencePPNotifierMsg;
-            control = LABEL
-                {
-                standard_font = EEikLabelFontAnnotation;
-                txt = "NULL";
-                };
-            }
-        };
-    }
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/src/refppdialog.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +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:
-*
-*/
-
-/**
- @file
- @internalComponent
-*/
-
-#include "refppdialog.h"
-/**
-  Constructor 
- */
-CRefPPDialog::CRefPPDialog(TBool* aDlgFlag):iDlgFlagInOwner(aDlgFlag)
-	{
-	}
-/**
-  Destructor
- */
-CRefPPDialog::~CRefPPDialog()
-	{
-	}
-/**
-  This is a static method used by refppnotifier to initialize a CRefDialog object. 
- 
-  @param	aDlgFlag  	 	The flag in the owner of this dialog. This flag is used
-                            to indicate if the dialog has been closed by the user
-                            by click the button on the dialog.
-  
-  @return	A pointer to the newly initialized object.
- */
-CRefPPDialog* CRefPPDialog::NewLC(TBool* aDlgFlag)
-	{
-	CRefPPDialog* self = new (ELeave)CRefPPDialog(aDlgFlag);
-	CleanupStack::PushL(self);
-	self->ConstructL();
-	return self;
-	}
-/**
-  This is a static method used by refppnotifier to initialize a CRefDialog object. 
- 
-  @param	aDlgFlag  	 	The flag in the owner of this dialog. This flag is used
-                            to indicate if the dialog has been closed by the user
-                            by click the button on the dialog.
-  
-  @return	A pointer to the newly initialized object.
- */
-CRefPPDialog* CRefPPDialog::NewL(TBool* aDlgFlag)
-	{
-	CRefPPDialog* self=CRefPPDialog::NewLC(aDlgFlag);
-	CleanupStack::Pop(self);
-	return self;
-	}
-/**
-  Method for the second phase construction. 
- */
-void CRefPPDialog::ConstructL()
-	{
-	}
-/**
-  Get called when the dialog is closed by user closing the dialog. Must return ETrue to
-  allow the dialog to close.
-  
-  @param      aButtonId        the button pressed when OkToExitL() is called.
-  
-  @return     TBool            ETrue  to let the dialog close.
-                               EFalse to keep the dialog on screen.      
-  
- */
-TBool CRefPPDialog::OkToExitL(TInt /*aButtonId*/)
-	{
-	*iDlgFlagInOwner = EFalse;
-	return ETrue;
-	}
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/src/refppnotifier.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,268 +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:
-*
-*/
-
-/**
- @file
- @internalComponent
-*/
-
-#include "refppnotifier.h"
-#include <ecom/implementationproxy.h>
-#include "refppnotifier.hrh"
-#include <techview/eikinfo.h>
-#include <dialog.rsg>
-#include <techview/eiklabel.h>
-#include <usb/hostms/srverr.h>
-#include <usb/hostms/policypluginnotifier.hrh>
-const TUid KMsmmRefNotifierChannel = {0x10009D48}; //0x10208C14
-/**
-  Initialize and put the notifiers in this DLL into the array and return it.
-  
-  @return  CArrayPtr<MEikSrvNotifierBase2>*   The array contents the notifiers in this dll.      
- */
-CArrayPtr<MEikSrvNotifierBase2>* NotifierArray()
-    {
-    CArrayPtrFlat<MEikSrvNotifierBase2>* subjects=NULL;
-    TRAPD(err, subjects = new(ELeave) CArrayPtrFlat<MEikSrvNotifierBase2>(1));
-    if( err == KErrNone )
-        {
-        TRAP(err, subjects->AppendL(CMsmmRefPolicyPluginNotifier::NewL()));
-        return(subjects);
-        }
-    else
-        {
-        return NULL;
-        }
-    }
-
-//Adding ECOM SUPPORT
-/**
-  Build up the table contains the implementation ID and the notifier array.
- */
-const TImplementationProxy ImplementationTable[] =
-    {
-    IMPLEMENTATION_PROXY_ENTRY(KUidMsmmReferenceNotifierImp, NotifierArray)
-    };
-
-/**
-  Initialize and put the notifiers in this DLL into the array and return it.
-  @param  aTableCount    a TInt reference, when return it contains the entry number in the 
-                             array of ImplementationTable[].
-  @return     CArrayPtr<MEikSrvNotifierBase2>*   The table of implementations.      
- */
-EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
-    {
-    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
-    return ImplementationTable;
-    }
-
-// Member functions
-/**
-  Static method to initialize a CMsmmRefPolicyPluginNotifier object. This method may leave. 
- 
-  @return     CMsmmRefPolicyPluginNotifier*   a pointer to an object of CMsmmRefPolicyPluginNotifier
- */
-CMsmmRefPolicyPluginNotifier* CMsmmRefPolicyPluginNotifier::NewL()
-    {
-    CMsmmRefPolicyPluginNotifier* self = CMsmmRefPolicyPluginNotifier::NewLC();
-    CleanupStack::Pop(self);
-    return self;
-    }
-/**
-  Static method to initialize a CMsmmRefPolicyPluginNotifier object. This method may leave. 
-
-  @return     CMsmmRefPolicyPluginNotifier*   a pointer to an object of CMsmmRefPolicyPluginNotifier
- */
-CMsmmRefPolicyPluginNotifier* CMsmmRefPolicyPluginNotifier::NewLC()
-    {
-    CMsmmRefPolicyPluginNotifier* self = new (ELeave) CMsmmRefPolicyPluginNotifier();
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    return self;
-    }
-/**
-  Constructor.
- */
-CMsmmRefPolicyPluginNotifier::CMsmmRefPolicyPluginNotifier():iDialogIsVisible(EFalse),iDialogPtr(0)
-    {
-    iCoeEnv = CCoeEnv::Static();
-    }
-
-/**
-  Destructor.
- */
-CMsmmRefPolicyPluginNotifier::~CMsmmRefPolicyPluginNotifier()
-    {
-    iCoeEnv->DeleteResourceFile(iOffset);    
-    if (iDialogIsVisible)
-    	{
-    	delete iDialogPtr;
-    	}
-    }
-
-/**
-  This method is called when client of this notifier disconnect from notify server.
- */
-void CMsmmRefPolicyPluginNotifier::Release()
-    {
-    delete this;
-    }
-
-/**
-  This method is called when notify server starts and get all the plug-ins of notifiers.
-  By calling this method notify server knows the ID, channel and priority of this notifier.
- */
-MEikSrvNotifierBase2::TNotifierInfo CMsmmRefPolicyPluginNotifier::RegisterL()
-    {
-    iInfo.iUid      = TUid::Uid(KUidMountPolicyNotifier);
-    iInfo.iChannel  = KMsmmRefNotifierChannel;
-    iInfo.iPriority = ENotifierPriorityLow;
-    return iInfo;
-    }
-
-/**
-  This method just returns the same TNotifierInfo as it is in RegisterL().
- */
-MEikSrvNotifierBase2::TNotifierInfo CMsmmRefPolicyPluginNotifier::Info() const
-    {
-    return iInfo;
-    }
-
-/**
-  Starts the notifier.
-
-   This is called as a result of a client-side call to RNotifier::StartNotifier(), 
-   which the client uses to start a notifier from which it does not expect a response.
-
-   The function is synchronous, but it should be implemented so that it completes as 
-   soon as possible, allowing the notifier framework to enforce its priority mechanism.
-
-   It is not possible to to wait for a notifier to complete before returning from this
-   function unless the notifier is likely to finish implementing its functionality immediately.
-
-  @param   aBuffer    the message sent from client.
-
-  @return      TPtrC8     Defines an empty or null literal descriptor 
-                          for use with 8-bit descriptors
- */
-TPtrC8 CMsmmRefPolicyPluginNotifier::StartL(const TDesC8& /*aBuffer*/)
-    {
-    return KNullDesC8();
-    }
-/**
-  Starts the notifier.
-
-  This is called as a result of a client-side call to the asynchronous function 
-  RNotifier::StartNotifierAndGetResponse(). This means that the client is waiting, 
-  asynchronously, for the notifier to tell the client that it has finished its work.
-
-  It is important to return from this function as soon as possible, and derived 
-  classes may find it useful to take a copy of the reply-slot number and the 
-  RMessage object.
-
-  The implementation of a derived class must make sure that Complete() is called 
-  on the RMessage object when the notifier is deactivated.
-
-  This function may be called multiple times if more than one client starts 
-  the notifier.
-
-  @param   aBuffer    Data that can be passed from the client-side. The format 
-                          and meaning of any data is implementation dependent. 
-                          
-              aReplySlot  Identifies which message argument to use for the reply. 
-                          This message argument will refer to a modifiable descriptor, 
-                          a TDes8 type, into which data can be returned. The format and 
-                          meaning of any returned data is implementation dependent.
-                          
-             aMessage     Encapsulates a client request. 
-*/
-void CMsmmRefPolicyPluginNotifier::StartL(const TDesC8& aBuffer, 
-                                          TInt /*aReplySlot*/, 
-                                          const RMessagePtr2& aMessage)
-    {
-    // extract the notifier request parameters
-    iMessage   = aMessage;
-
-    const TUint8* Buffer= aBuffer.Ptr();
-    const THostMsErrData* Data = reinterpret_cast<const THostMsErrData*>(Buffer);
-    
-    HBufC16* HeapBuf = HBufC16::NewL(aBuffer.Length());
-    CleanupStack::PushL(HeapBuf);
-    _LIT(KFormat1,"MSMMErr:%d SymbianErr:%d %S %S on Drive %c");
-    TPtr16 PtrBuf = HeapBuf->Des();
-    
-    PtrBuf.Format(KFormat1,Data->iError,Data->iE32Error,&Data->iProductString,&Data->iManufacturerString,Data->iDriveName);
-    
-    if (iDialogIsVisible && iDialogPtr)
-    	{
-    	delete iDialogPtr;
-	    }
-    iDialogPtr = CRefPPDialog::NewL(&iDialogIsVisible);
-    iDialogPtr->PrepareLC(R_NOTIFIER_DIALOG);
-    CEikLabel *pLabel = static_cast<CEikLabel *> (iDialogPtr->ControlOrNull(EReferencePPNotifierMsg));
-    pLabel->SetTextL(PtrBuf);
-    
-    iDialogPtr->RunLD();
-    iDialogIsVisible = ETrue;
-    
-    CleanupStack::Pop(HeapBuf);
-
-    // complete    
-    iMessage.Complete(KErrNone);
-    }
-
-/**
-  Cancels an active notifier.
-
-  This is called as a result of a client-side call to RNotifier::CancelNotifier().
-
-  An implementation should free any relevant resources and complete any outstanding 
-  messages, if relevant. 
- */
-void CMsmmRefPolicyPluginNotifier::Cancel()
-    {
-    if (iDialogIsVisible && iDialogPtr)
-	    {
-    	delete iDialogPtr;
-	    iDialogPtr = NULL;
-	    }
-    }
-
-/**
-  Updates a currently active notifier with new data.This is called as a result 
-  of a client-side call to RNotifier::UpdateNotifier().
- 
-  @param aBuffer   Data that can be passed from the client-side. The format 
-                       and meaning of any data is implementation dependent. 
-  
-  @return    KNullDesC8()  Defines an empty or null literal descriptor for use 
-                           with 8-bit descriptors.  
- */
-TPtrC8 CMsmmRefPolicyPluginNotifier::UpdateL(const TDesC8& /*aBuffer*/)
-    {
-    return KNullDesC8();
-    }
-/**
-  Second phase construction.
- */    
-void CMsmmRefPolicyPluginNotifier::ConstructL()
-    {
-    _LIT(KResFileName,"z:\\resource\\apps\\dialog.rsc");
-    iOffset=iCoeEnv->AddResourceFileL(KResFileName);
-    }
-
-// End of file
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/src/refppnotifier.rss	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +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:
-* Reference policy plugin notifier implementation resource file
-*
-*/
-
-/**
- @file
- @internalComponent
-*/
-
-#include <ecom/registryinfo.rh>
-#include <usb/hostms/policypluginnotifier.hrh>
-#include "refppnotifier.hrh"
-#include "uikon.hrh"
-
-RESOURCE REGISTRY_INFO theInfo
-    {
-    // UID for the DLL
-    dll_uid = 0x10285ddd;
-    // Declare array of interface info
-    interfaces = 
-        {
-        INTERFACE_INFO
-            {
-            // UID of interface that is implemented
-            interface_uid = KUikonUidPluginInterfaceNotifiers;
-            implementations = 
-                {
-                IMPLEMENTATION_INFO
-                    {
-                    implementation_uid = KUidMsmmReferenceNotifierImp;
-                    version_no         = 1;
-                    display_name       = "Reference notifier";
-                    default_data       = "Referencenotifier";
-                    opaque_data        = "";
-                    }
-                };
-            }
-        };
-    }
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/group/msmmserver_base.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/group/msmmserver_base.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-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"
@@ -23,7 +23,6 @@
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
 #include "../public/hostmscaps.mmh"
-#include <usb/usblogger.mmh>
 
 LIBRARY    euser.lib
 LIBRARY    ecom.lib
@@ -33,6 +32,7 @@
 SOURCE main.cpp 
 SOURCE msmmserver.cpp
 SOURCE msmmsession.cpp
+SOURCE msmmdismountusbdrives.cpp
 SOURCE eventqueue.cpp
 SOURCE eventhandler.cpp
 SOURCE msmmterminator.cpp
@@ -44,5 +44,6 @@
 USERINCLUDE ../inc
 USERINCLUDE ../public
 USERINCLUDE ../../inc
+USERINCLUDE ../traces
 
 VENDORID 0x70000001
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/group/msmmserver_over_dummycomponent.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/group/msmmserver_over_dummycomponent.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -27,6 +27,7 @@
 UID			 0 0x1028653F
 
 LIBRARY		 dummymsc.lib
+LIBRARY		 dummyfilesysclient.lib
 #include "msmmserver_base.mmp"
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/inc/msmmdismountusbdrives.h	Tue Aug 31 17:01:47 2010 +0300
@@ -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 <e32base.h> 
+#ifdef __OVER_DUMMYCOMPONENT__
+#include "usb/hostms/dummycomponent/dummyfsclient.h"
+#else
+#include <f32file.h> 
+#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<TUSBMSDeviceDescription> 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
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/inc/msmmserver.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/inc/msmmserver.h	Tue Aug 31 17:01:47 2010 +0300
@@ -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
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/inc/srvsec.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/inc/srvsec.h	Tue Aug 31 17:01:47 2010 +0300
@@ -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,
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/public/srverr.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/public/srverr.h	Tue Aug 31 17:01:47 2010 +0300
@@ -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
     };
     
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/eventhandler.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/eventhandler.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-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"
@@ -27,27 +27,32 @@
 #include "msmmengine.h"
 #include "subcommands.h"
 #include "msmmnodebase.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "eventhandlerTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "UsbHostMsmmServer");
-#endif
+
 
 // Push a sub-command into the queue and transfer the owership 
 // to the queue
 void RSubCommandQueue::PushL(TSubCommandBase* aCommand)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( RSUBCOMMANDQUEUE_PUSHL_ENTRY );
+    
     CleanupStack::PushL(aCommand);
     iQueue.AppendL(aCommand);
     CleanupStack::Pop(aCommand);
+    OstTraceFunctionExit0( RSUBCOMMANDQUEUE_PUSHL_EXIT );
     }
 
 // Pop the head entity from the queue and destroy it
 void RSubCommandQueue::Pop()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( RSUBCOMMANDQUEUE_POP_ENTRY );  
     if (iQueue.Count() == 0)
         {
+        OstTraceFunctionExit0( RSUBCOMMANDQUEUE_POP_EXIT );
         return;
         }
     
@@ -55,39 +60,45 @@
     iQueue.Remove(0);
     delete command;
     command = NULL;
+    OstTraceFunctionExit0( RSUBCOMMANDQUEUE_POP_EXIT_DUP1 );
     }
     
 // Insert a sub-command sequence after head entities
 void RSubCommandQueue::InsertAfterHeadL(TSubCommandBase* aCommand)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( RSUBCOMMANDQUEUE_INSERTAFTERHEADL_ENTRY );
+    
     if (!aCommand)
         {
         User::Leave(KErrArgument);
         }
     
     iQueue.InsertL(aCommand, 1);
+    OstTraceFunctionExit0( RSUBCOMMANDQUEUE_INSERTAFTERHEADL_EXIT );
     }
     
 // Execute the head sub-comment
 void RSubCommandQueue::ExecuteHeadL()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( RSUBCOMMANDQUEUE_EXECUTEHEADL_ENTRY );
     Head().ExecuteL();
+    OstTraceFunctionExit0( RSUBCOMMANDQUEUE_EXECUTEHEADL_EXIT );
     }
     
 // Get a reference of head sub-command in queue
 TSubCommandBase& RSubCommandQueue::Head()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( RSUBCOMMANDQUEUE_HEAD_ENTRY ); 
     return *iQueue[0];
     }
     
 // Destory all entities and release the memory of queue
 void RSubCommandQueue::Release()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( RSUBCOMMANDQUEUE_RELEASE_ENTRY );
+    
     iQueue.ResetAndDestroy();
+    OstTraceFunctionExit0( RSUBCOMMANDQUEUE_RELEASE_EXIT );
     }
 
 /*
@@ -95,36 +106,43 @@
  */
 CDeviceEventHandler::~CDeviceEventHandler()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_CDEVICEEVENTHANDLER_DES_ENTRY );
+    
     Cancel();
     delete iErrNotiData;
     iSubCommandQueue.Release();
+    OstTraceFunctionExit0( CDEVICEEVENTHANDLER_CDEVICEEVENTHANDLER_DES_EXIT );
     }
 
 CDeviceEventHandler* CDeviceEventHandler::NewL(MMsmmSrvProxy& aServer)
     {
-    LOG_STATIC_FUNC_ENTRY
+    OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_NEWL_ENTRY );
+    
     CDeviceEventHandler* self = CDeviceEventHandler::NewLC(aServer);
     CleanupStack::Pop(self);
     
+    OstTraceFunctionExit0( CDEVICEEVENTHANDLER_NEWL_EXIT );
     return self;
     }
 
 CDeviceEventHandler* CDeviceEventHandler::NewLC(MMsmmSrvProxy& aServer)
     {
-    LOG_STATIC_FUNC_ENTRY
+    OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_NEWLC_ENTRY );
+    
     CDeviceEventHandler* self = 
         new (ELeave) CDeviceEventHandler(aServer);
     CleanupStack::PushL(self);
     self->ConstructL();
     
+    OstTraceFunctionExit0( CDEVICEEVENTHANDLER_NEWLC_EXIT );
     return self;
     }
 
 void CDeviceEventHandler::CreateSubCmdForRetrieveDriveLetterL(
         TInt aLogicalUnitCount)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_CREATESUBCMDFORRETRIEVEDRIVELETTERL_ENTRY );
+    
     TRetrieveDriveLetter* command(NULL);
     THostMsSubCommandParam parameter(iServer, *this, *this, iIncomingEvent);
     for (TInt index = 0; index < aLogicalUnitCount; index++)
@@ -132,49 +150,60 @@
         command = new (ELeave) TRetrieveDriveLetter(parameter, index);
         iSubCommandQueue.PushL(command);
         }
+    OstTraceFunctionExit0( CDEVICEEVENTHANDLER_CREATESUBCMDFORRETRIEVEDRIVELETTERL_EXIT );
     }
 
 void CDeviceEventHandler::CreateSubCmdForMountingLogicalUnitL(TText aDrive, 
         TInt aLuNumber)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_CREATESUBCMDFORMOUNTINGLOGICALUNITL_ENTRY );
+    
     THostMsSubCommandParam parameter(iServer, *this, *this, iIncomingEvent);
     TMountLogicalUnit* command = new (ELeave) TMountLogicalUnit(
             parameter, aDrive, aLuNumber);
     iSubCommandQueue.InsertAfterHeadL(command);
+    OstTraceFunctionExit0( CDEVICEEVENTHANDLER_CREATESUBCMDFORMOUNTINGLOGICALUNITL_EXIT );
     }
 
 void CDeviceEventHandler::CreateSubCmdForSaveLatestMountInfoL(TText aDrive, 
         TInt aLuNumber)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_CREATESUBCMDFORSAVELATESTMOUNTINFOL_ENTRY );
+    
     THostMsSubCommandParam parameter(iServer, *this, *this, iIncomingEvent);
     TSaveLatestMountInfo* command = 
         new (ELeave) TSaveLatestMountInfo(parameter, aDrive, aLuNumber);
     iSubCommandQueue.InsertAfterHeadL(command);
+    OstTraceFunctionExit0( CDEVICEEVENTHANDLER_CREATESUBCMDFORSAVELATESTMOUNTINFOL_EXIT );
     }
 
 void CDeviceEventHandler::Start()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_START_ENTRY );
+    
     if (IsActive())
         {
+        OstTraceFunctionExit0( CDEVICEEVENTHANDLER_START_EXIT );
         return;
         }
     iStatus = KRequestPending;
     SetActive();
+    OstTraceFunctionExit0( CDEVICEEVENTHANDLER_START_EXIT_DUP1 );
     }
 
 void CDeviceEventHandler::Complete(TInt aError)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_COMPLETE_ENTRY );
+    
     TRequestStatus* status = &iStatus;
     User::RequestComplete(status, aError);
+    OstTraceFunctionExit0( CDEVICEEVENTHANDLER_COMPLETE_EXIT );
     }
 
 TRequestStatus& CDeviceEventHandler::Status() const
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_STATUS_ENTRY );
+    
     const TRequestStatus& status = iStatus;
     return const_cast<TRequestStatus&>(status);
     }
@@ -182,7 +211,8 @@
 void CDeviceEventHandler::HandleEventL(TRequestStatus& aStatus, 
         const TDeviceEvent& aEvent)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_HANDLEEVENTL_ENTRY );
+    
     if (IsActive())
         {
         // An event is being handled. Currently handler is busy.
@@ -201,6 +231,7 @@
     // Start the handler to handle the incoming event
     Start();
     Complete();
+    OstTraceFunctionExit0( CDEVICEEVENTHANDLER_HANDLEEVENTL_EXIT );
     }
 
 /*
@@ -209,25 +240,28 @@
 
 void CDeviceEventHandler::DoCancel()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_DOCANCEL_ENTRY );
+    
     // Complete client with KErrCancel
     CompleteClient(KErrCancel);
 
     // Cancel current pending command
-    if (iSubCommandQueue.Count())
+	if (iSubCommandQueue.Count())
         {
-        iSubCommandQueue.Head().CancelAsyncCmd();
-        }
+		iSubCommandQueue.Head().CancelAsyncCmd();
+    	}
+	OstTraceFunctionExit0( CDEVICEEVENTHANDLER_DOCANCEL_EXIT );
     }
 
 void CDeviceEventHandler::RunL( )
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_RUNL_ENTRY );
     
     if (iSubCommandQueue.Count() == 0)
         {
         // Error occurs in lastest sub-command's DoExecuteL()
         // Or current command has been cancelled.
+        OstTraceFunctionExit0( CDEVICEEVENTHANDLER_RUNL_EXIT );
         return;
         }
     
@@ -249,26 +283,27 @@
         // Complete client
         CompleteClient();
         }
+    OstTraceFunctionExit0( CDEVICEEVENTHANDLER_RUNL_EXIT_DUP1 );
     }
 
 TInt CDeviceEventHandler::RunError(TInt aError)
     {
-    LOG_FUNC
-
-    if (iSubCommandQueue.Count())
+    OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_RUNERROR_ENTRY );
+    
+	if (iSubCommandQueue.Count())
         {
-        // Retrieve sub-command related error notification data
-        iSubCommandQueue.Head().HandleError(*iErrNotiData, 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();
+    	// 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();
         }
 
     if( IsActive() )
@@ -281,6 +316,7 @@
    	    Complete();
         }
 
+    OstTraceFunctionExit0( CDEVICEEVENTHANDLER_RUNERROR_EXIT );
     return KErrNone;
     }
 
@@ -289,20 +325,25 @@
     CActive(EPriorityStandard),
     iServer(aServer)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_CDEVICEEVENTHANDLER_ENTRY );
+    
     CActiveScheduler::Add(this);
+    OstTraceFunctionExit0( CDEVICEEVENTHANDLER_CDEVICEEVENTHANDLER_EXIT );
     }
 
 void CDeviceEventHandler::ConstructL()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_CONSTRUCTL_ENTRY );
+    
     iErrNotiData = new (ELeave) THostMsErrData;
     ResetHandler();
+    OstTraceFunctionExit0( CDEVICEEVENTHANDLER_CONSTRUCTL_EXIT );
     }
 
 void CDeviceEventHandler::CreateSubCmdForDeviceEventL()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_CREATESUBCMDFORDEVICEEVENTL_ENTRY );
+    
     switch (iIncomingEvent.iEvent)
         {
     case EDeviceEventAddFunction:
@@ -312,19 +353,23 @@
         CreateSubCmdForRemovingUsbMsDeviceL();
         break;
         }
+    OstTraceFunctionExit0( CDEVICEEVENTHANDLER_CREATESUBCMDFORDEVICEEVENTL_EXIT );
     }
 
 void CDeviceEventHandler::CreateSubCmdForAddingUsbMsFunctionL()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_CREATESUBCMDFORADDINGUSBMSFUNCTIONL_ENTRY );
+    
     THostMsSubCommandParam parameter(iServer, *this, *this, iIncomingEvent);
     TRegisterInterface* command = new (ELeave) TRegisterInterface(parameter);
     iSubCommandQueue.PushL(command);
+    OstTraceFunctionExit0( CDEVICEEVENTHANDLER_CREATESUBCMDFORADDINGUSBMSFUNCTIONL_EXIT );
     }
 
 void CDeviceEventHandler::CreateSubCmdForRemovingUsbMsDeviceL()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_CREATESUBCMDFORREMOVINGUSBMSDEVICEL_ENTRY );
+    
     CMsmmEngine& engine = iServer.Engine();
     TUsbMsDevice* device = engine.SearchDevice(iIncomingEvent.iDeviceId);
     if (!device)
@@ -352,18 +397,22 @@
     TRemoveUsbMsDeviceNode* removeNode = 
         new (ELeave) TRemoveUsbMsDeviceNode(parameter, device);
     iSubCommandQueue.PushL(removeNode);
+    OstTraceFunctionExit0( CDEVICEEVENTHANDLER_CREATESUBCMDFORREMOVINGUSBMSDEVICEL_EXIT );
     }
 
 void CDeviceEventHandler::ResetHandler()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_RESETHANDLER_ENTRY );
+    
     ResetHandlerData();
     ResetHandlerError();
+    OstTraceFunctionExit0( CDEVICEEVENTHANDLER_RESETHANDLER_EXIT );
     }
 
 void CDeviceEventHandler::ResetHandlerData()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_RESETHANDLERDATA_ENTRY );
+    
     // Reset event buffer
     iIncomingEvent.iDeviceId = 0;
     iIncomingEvent.iEvent = EDeviceEventEndMark;
@@ -371,25 +420,30 @@
     
     // Destory sub-command queue
     iSubCommandQueue.Release();
+    OstTraceFunctionExit0( CDEVICEEVENTHANDLER_RESETHANDLERDATA_EXIT );
     }
 
 void CDeviceEventHandler::ResetHandlerError()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_RESETHANDLERERROR_ENTRY );
+    
     // Reset error notification data
     iErrNotiData->iDriveName = 0x0;
     iErrNotiData->iError = EHostMsErrorEndMarker;
     iErrNotiData->iE32Error = KErrNone;
     iErrNotiData->iManufacturerString.Zero();
+    OstTraceFunctionExit0( CDEVICEEVENTHANDLER_RESETHANDLERERROR_EXIT );
     }
 
 void CDeviceEventHandler::CompleteClient(TInt aError/* = KErrNone*/)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CDEVICEEVENTHANDLER_COMPLETECLIENT_ENTRY );
+    
     if (iEvtQueueStatus)
         {
         User::RequestComplete(iEvtQueueStatus, aError);
         }
+    OstTraceFunctionExit0( CDEVICEEVENTHANDLER_COMPLETECLIENT_EXIT );
     }
 
 // End of file
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/eventqueue.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/eventqueue.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-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"
@@ -27,47 +27,55 @@
 #include "msmmengine.h"
 #include <usb/hostms/msmmpolicypluginbase.h>
 #include <usb/usblogger.h>
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "eventqueueTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "UsbHostMsmmServer");
-#endif
 
 // Public member functions
 CDeviceEventQueue::~CDeviceEventQueue( )
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CDEVICEEVENTQUEUE_CDEVICEEVENTQUEUE_DES_ENTRY );
+    
     Cancel();
     delete iHandler;
     iEventArray.Close();
+    OstTraceFunctionExit0( CDEVICEEVENTQUEUE_CDEVICEEVENTQUEUE_DES_EXIT );
     }
 
 CDeviceEventQueue* CDeviceEventQueue::NewL(MMsmmSrvProxy& aServer)
     {
-    LOG_STATIC_FUNC_ENTRY
+    OstTraceFunctionEntry0( CDEVICEEVENTQUEUE_NEWL_ENTRY );
+    
     CDeviceEventQueue* self = CDeviceEventQueue::NewLC(aServer);
     CleanupStack::Pop(self);
     
+    OstTraceFunctionExit0( CDEVICEEVENTQUEUE_NEWL_EXIT );
     return self;
     }
 CDeviceEventQueue* CDeviceEventQueue::NewLC(MMsmmSrvProxy& aServer)
     {
-    LOG_STATIC_FUNC_ENTRY
+    OstTraceFunctionEntry0( CDEVICEEVENTQUEUE_NEWLC_ENTRY );
+    
     CDeviceEventQueue* self = new (ELeave) CDeviceEventQueue(aServer);
     CleanupStack::PushL(self);
     self->ConstructL();
     
+    OstTraceFunctionExit0( CDEVICEEVENTQUEUE_NEWLC_EXIT );
     return self;
     }
 
 void CDeviceEventQueue::PushL(const TDeviceEvent& aEvent)
     {
-    LOG_FUNC
-    
+    OstTraceFunctionEntry0( CDEVICEEVENTQUEUE_PUSHL_ENTRY );
+
     // Perform optimization for remove device event
     AppendAndOptimizeL(aEvent);
     
     // Start handling first event in queue
     StartL();
+    OstTraceFunctionExit0( CDEVICEEVENTQUEUE_PUSHL_EXIT );
     }
 
 void CDeviceEventQueue::Finalize()
@@ -95,14 +103,17 @@
 // Protected member functions
 void CDeviceEventQueue::DoCancel()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CDEVICEEVENTQUEUE_DOCANCEL_ENTRY );
+    
     iEventArray.Reset();
     iHandler->Cancel();
+    OstTraceFunctionExit0( CDEVICEEVENTQUEUE_DOCANCEL_EXIT );
     }
 
 void CDeviceEventQueue::RunL()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CDEVICEEVENTQUEUE_RUNL_ENTRY );
+    
     // Check the completion code from CDeviceEventHandler. If there
     // is some error occured. We need issue error notification here.
     TInt err = iStatus.Int();
@@ -116,11 +127,13 @@
         {
         SendEventL();
         }
+    OstTraceFunctionExit0( CDEVICEEVENTQUEUE_RUNL_EXIT );
     }
 
 TInt CDeviceEventQueue::RunError(TInt aError)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CDEVICEEVENTQUEUE_RUNERROR_ENTRY );
+    
     THostMsErrData errData;
     switch (aError)
         {
@@ -144,6 +157,7 @@
     errData.iDriveName = 0x0;
     TInt err(KErrNone);
     TRAP(err, iServer.PolicyPlugin()->SendErrorNotificationL(errData));
+    OstTraceFunctionExit0( CDEVICEEVENTQUEUE_RUNERROR_EXIT );
     return KErrNone;
     }
 
@@ -152,19 +166,24 @@
 CActive(EPriorityStandard),
 iServer(aServer)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CDEVICEEVENTQUEUE_CDEVICEEVENTQUEUE_CONS_ENTRY );
+    
     CActiveScheduler::Add(this);
+    OstTraceFunctionExit0( CDEVICEEVENTQUEUE_CDEVICEEVENTQUEUE_CONS_EXIT );
     }
 
 void CDeviceEventQueue::ConstructL()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CDEVICEEVENTQUEUE_CONSTRUCTL_ENTRY );
+    
     iHandler = CDeviceEventHandler::NewL(iServer);
+    OstTraceFunctionExit0( CDEVICEEVENTQUEUE_CONSTRUCTL_EXIT );
     }
 
 void CDeviceEventQueue::AppendAndOptimizeL(const TDeviceEvent& aEvent)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CDEVICEEVENTQUEUE_APPENDANDOPTIMIZEL_ENTRY );
+    
     if (EDeviceEventRemoveDevice == aEvent.iEvent)
         {
         // Scan the event queue to discard all pending related adding 
@@ -196,19 +215,23 @@
             if (aEvent.iDeviceId == iHandler->Event().iDeviceId && IsActive())
                 {
                 // Discard duplicated removing event.
+                OstTraceFunctionExit0( CDEVICEEVENTQUEUE_APPENDANDOPTIMIZEL_EXIT );
                 return;
                 }
             break;
             }
         }
         iEventArray.AppendL(aEvent);
+    OstTraceFunctionExit0( CDEVICEEVENTQUEUE_APPENDANDOPTIMIZEL_EXIT_DUP1 );
     }
 
 void CDeviceEventQueue::StartL()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CDEVICEEVENTQUEUE_STARTL_ENTRY );
+    
     if (IsActive())
         {
+        OstTraceFunctionExit0( CDEVICEEVENTQUEUE_STARTL_EXIT );
         return;
         }
 
@@ -216,24 +239,29 @@
         {
         SendEventL();
         }
+    OstTraceFunctionExit0( CDEVICEEVENTQUEUE_STARTL_EXIT_DUP1 );
     }
 
 void CDeviceEventQueue::SendEventL()
     {
-    LOG_FUNC     
+    OstTraceFunctionEntry0( CDEVICEEVENTQUEUE_SENDEVENTL_ENTRY );
+         
     // If the handler is available, sending oldest event to it
     iHandler->HandleEventL(iStatus, Pop());
         
     // Activiate the manager again to wait for the handler 
     // finish current event
     SetActive();
+    OstTraceFunctionExit0( CDEVICEEVENTQUEUE_SENDEVENTL_EXIT );
     }
 
 TDeviceEvent CDeviceEventQueue::Pop()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CDEVICEEVENTQUEUE_POP_ENTRY );
+    
     TDeviceEvent event = iEventArray[0];
     iEventArray.Remove(0);
+    OstTraceFunctionExit0( CDEVICEEVENTQUEUE_POP_EXIT );
     return event;
     }
 
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/main.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/main.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-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"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/msmmdismountusbdrives.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,283 @@
+/*
+* Copyright (c) 2007-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:  Active Object to dismount usb drives
+*
+*/
+
+
+#include <usb/usblogger.h>
+#include <usb/hostms/srverr.h>
+#include <usb/hostms/msmmpolicypluginbase.h>
+
+#include "msmmdismountusbdrives.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "msmmdismountusbdrivesTraces.h"
+#endif
+
+
+const TInt KDismountTimeOut   = 6000000; // 6 seconds
+
+
+CMsmmDismountUsbDrives::~CMsmmDismountUsbDrives()
+    {
+    OstTraceFunctionEntry0( CMSMMDISMOUNTUSBDRIVES_CMSMMDISMOUNTUSBDRIVES_DES_ENTRY );
+    
+    Cancel(); 
+    delete iDismountTimer;    
+    iRFs.Close();    
+    OstTraceFunctionExit0( CMSMMDISMOUNTUSBDRIVES_CMSMMDISMOUNTUSBDRIVES_DES_EXIT );
+    }
+
+/**
+ * Symbian two phase constructor
+ */
+CMsmmDismountUsbDrives* CMsmmDismountUsbDrives::NewL()
+    {
+    OstTraceFunctionEntry0( CMSMMDISMOUNTUSBDRIVES_NEWL_ENTRY );
+    
+    CMsmmDismountUsbDrives* self = CMsmmDismountUsbDrives::NewLC();
+    CleanupStack::Pop(self);    
+    OstTraceFunctionExit0( CMSMMDISMOUNTUSBDRIVES_NEWL_EXIT );
+    return self;
+    }
+
+/**
+ * Symbian two phase constructor. Object pushed to cleanup stack
+ */
+CMsmmDismountUsbDrives* CMsmmDismountUsbDrives::NewLC()
+    {
+    OstTraceFunctionEntry0( CMSMMDISMOUNTUSBDRIVES_NEWLC_ENTRY );
+    
+    CMsmmDismountUsbDrives* self = new (ELeave) CMsmmDismountUsbDrives();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    OstTraceFunctionExit0( CMSMMDISMOUNTUSBDRIVES_NEWLC_EXIT );
+    return self;
+    }
+
+/**
+ * Check the status of current dismount request and continue issuing next if no error
+ */
+void CMsmmDismountUsbDrives::RunL()
+    {
+    OstTraceFunctionEntry0( CMSMMDISMOUNTUSBDRIVES_RUNL_ENTRY );
+    
+    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();
+        }
+    OstTraceFunctionExit0( CMSMMDISMOUNTUSBDRIVES_RUNL_EXIT );
+    }
+
+/**
+ * Cancel pending notifier and those in queue 
+ */
+void CMsmmDismountUsbDrives::DoCancel()
+    {
+    OstTraceFunctionEntry0( CMSMMDISMOUNTUSBDRIVES_DOCANCEL_ENTRY );
+    
+    iRFs.NotifyDismountCancel(iStatus);
+    OstTraceFunctionExit0( CMSMMDISMOUNTUSBDRIVES_DOCANCEL_EXIT );
+    }
+
+CMsmmDismountUsbDrives::CMsmmDismountUsbDrives()
+    : CActive(EPriorityStandard)
+    {
+    OstTraceFunctionEntry0( CMSMMDISMOUNTUSBDRIVES_CMSMMDISMOUNTUSBDRIVES_ENTRY );
+    
+    CActiveScheduler::Add(this);    
+    OstTraceFunctionExit0( CMSMMDISMOUNTUSBDRIVES_CMSMMDISMOUNTUSBDRIVES_EXIT );
+    }
+
+void CMsmmDismountUsbDrives::ConstructL()
+    {
+    OstTraceFunctionEntry0( CMSMMDISMOUNTUSBDRIVES_CONSTRUCTL_ENTRY );
+    
+    User::LeaveIfError( iRFs.Connect());
+    iDismountTimer = CDismountTimer::NewL(this);
+    OstTraceFunctionExit0( CMSMMDISMOUNTUSBDRIVES_CONSTRUCTL_EXIT );
+    }
+
+/**
+ * Dismount usb drives
+ */
+void CMsmmDismountUsbDrives::DismountUsbDrives(CMsmmPolicyPluginBase& aPlugin, TUSBMSDeviceDescription& aDevice)
+    {    
+    OstTraceFunctionEntry0( CMSMMDISMOUNTUSBDRIVES_DISMOUNTUSBDRIVES_ENTRY );
+    
+    Cancel();
+    iPlugin = &aPlugin;
+    TUSBMSDeviceDescription& device = iDevicePkgInfo();
+    device = aDevice;
+    iDriveIndex = 0;
+    iRFs.DriveList( iDriveList );
+    DoDismount();
+    OstTraceFunctionExit0( CMSMMDISMOUNTUSBDRIVES_DISMOUNTUSBDRIVES_EXIT );
+    }
+
+/**
+ * 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()
+    {
+    OstTraceFunctionEntry0( CMSMMDISMOUNTUSBDRIVES_DODISMOUNT_ENTRY );
+       
+    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  )
+                {
+                OstTrace0( TRACE_NORMAL, CMSMMDISMOUNTUSBDRIVES_DODISMOUNT, 
+                        "CMsmmDismountUsbDrives::DoDismount Dismount notify request" );
+                iRFs.NotifyDismount( iDriveIndex, iStatus, EFsDismountNotifyClients );                
+                iDismountTimer->StartTimer();
+                SetActive();
+                OstTraceFunctionExit0( CMSMMDISMOUNTUSBDRIVES_DODISMOUNT_EXIT );
+                return;
+                }                     
+            }
+        }
+    // Indicates we have gone through all the drives and no more usb drives left to request dismount
+    CompleteDismountRequest( KErrNone );
+    OstTraceFunctionExit0( CMSMMDISMOUNTUSBDRIVES_DODISMOUNT_EXIT_DUP1 );
+    }
+
+
+/**
+ * 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()
+    {
+    OstTraceFunctionEntry0( CMSMMDISMOUNTUSBDRIVES_TIMEREXPIRED_ENTRY );
+    
+    Cancel();
+    iDismountTimer->CancelTimer();    
+    CompleteDismountRequest( KErrInUse );    
+    OstTraceFunctionExit0( CMSMMDISMOUNTUSBDRIVES_TIMEREXPIRED_EXIT );
+    }    
+
+//CDismountTimer
+
+CDismountTimer* CDismountTimer::NewL( MTimerNotifier* aTimeOutNotify)
+    {
+    OstTraceFunctionEntry0( CDISMOUNTTIMER_NEWL_ENTRY );
+        
+    CDismountTimer* self = CDismountTimer::NewLC( aTimeOutNotify );
+    CleanupStack::Pop(self);
+    OstTraceFunctionExit0( CDISMOUNTTIMER_NEWL_EXIT );
+    return self;
+    }
+
+CDismountTimer* CDismountTimer::NewLC( MTimerNotifier* aTimeOutNotify )
+    {
+    OstTraceFunctionEntry0( CDISMOUNTTIMER_NEWLC_ENTRY );
+        
+    CDismountTimer* self = new (ELeave) CDismountTimer( aTimeOutNotify );
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    OstTraceFunctionExit0( CDISMOUNTTIMER_NEWLC_EXIT );
+    return self;
+    }
+
+CDismountTimer::CDismountTimer( MTimerNotifier* aTimeOutNotify):
+    CTimer(EPriorityStandard), 
+    iNotify(aTimeOutNotify)    
+    {
+    OstTraceFunctionEntry0( CDISMOUNTTIMER_CDISMOUNTTIMER_CONS_ENTRY );
+    }    
+
+CDismountTimer::~CDismountTimer()
+    {
+    OstTraceFunctionEntry0( CDISMOUNTTIMER_CDISMOUNTTIMER_DES_ENTRY );
+    
+    Cancel();
+    OstTraceFunctionExit0( CDISMOUNTTIMER_CDISMOUNTTIMER_DES_EXIT );
+    }
+
+void CDismountTimer::ConstructL()
+    {
+    OstTraceFunctionEntry0( CDISMOUNTTIMER_CONSTRUCTL_ENTRY );
+        
+    if ( !iNotify )    
+        {
+        User::Leave(KErrArgument);    
+        }
+    CTimer::ConstructL();
+    CActiveScheduler::Add(this);
+    OstTraceFunctionExit0( CDISMOUNTTIMER_CONSTRUCTL_EXIT );
+    }
+
+void CDismountTimer::RunL()
+    {
+    OstTraceFunctionEntry0( CDISMOUNTTIMER_RUNL_ENTRY );
+    
+    // Timer request has completed, so notify the timer's owner
+    iNotify->TimerExpired();
+    OstTraceFunctionExit0( CDISMOUNTTIMER_RUNL_EXIT );
+    }
+void CDismountTimer::CancelTimer()
+    {
+    OstTraceFunctionEntry0( CDISMOUNTTIMER_CANCELTIMER_ENTRY );
+     
+    Cancel();    
+    OstTraceFunctionExit0( CDISMOUNTTIMER_CANCELTIMER_EXIT );
+    }
+
+void CDismountTimer::StartTimer()
+    {
+    OstTraceFunctionEntry0( CDISMOUNTTIMER_STARTTIMER_ENTRY );
+    
+    After( KDismountTimeOut );  
+    OstTraceFunctionExit0( CDISMOUNTTIMER_STARTTIMER_EXIT );
+    }
+// End of File
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/msmmengine.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/msmmengine.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-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"
@@ -24,54 +24,64 @@
 #include "msmmnodebase.h"
 
 #include <usb/usblogger.h>
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "msmmengineTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "UsbHostMsmmServer");
-#endif
 
 CMsmmEngine::~CMsmmEngine()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CMSMMENGINE_CMSMMENGINE_DES_ENTRY );
+    
     if (iDataEntrys)
         {
         delete iDataEntrys;
         }
+    OstTraceFunctionExit0( CMSMMENGINE_CMSMMENGINE_DES_EXIT );
     }
 
 CMsmmEngine* CMsmmEngine::NewL()
     {
-    LOG_STATIC_FUNC_ENTRY
+    OstTraceFunctionEntry0( CMSMMENGINE_NEWL_ENTRY );
+    
     CMsmmEngine* self = CMsmmEngine::NewLC();
     CleanupStack::Pop(self);
     
+    OstTraceFunctionExit0( CMSMMENGINE_NEWL_EXIT );
     return self;
     }
 
 CMsmmEngine* CMsmmEngine::NewLC()
     {
-    LOG_STATIC_FUNC_ENTRY
+    OstTraceFunctionEntry0( CMSMMENGINE_NEWLC_ENTRY );
+    
     CMsmmEngine* self = new (ELeave) CMsmmEngine();
     CleanupStack::PushL(self);
     self->ConstructL();
     
+    OstTraceFunctionExit0( CMSMMENGINE_NEWLC_EXIT );
     return self;
     }
 
 void CMsmmEngine::AddUsbMsDeviceL(const TUSBMSDeviceDescription& aDevice)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CMSMMENGINE_ADDUSBMSDEVICEL_ENTRY );
+    
     TUsbMsDevice* device = SearchDevice(aDevice.iDeviceId);
     if (!device)
         {
         device = new (ELeave) TUsbMsDevice(aDevice);
         iDataEntrys->AddChild(device);
         }
+    OstTraceFunctionExit0( CMSMMENGINE_ADDUSBMSDEVICEL_EXIT );
     }
 
 TUsbMsInterface* CMsmmEngine::AddUsbMsInterfaceL(TInt aDeviceId, TUint8 aInterfaceNumber,
         TInt32 aInterfaceToken)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CMSMMENGINE_ADDUSBMSINTERFACEL_ENTRY );
+    
     TUsbMsDevice* device = SearchDevice(aDeviceId);
     if (!device)
         {
@@ -87,13 +97,15 @@
         {
         interface = AddUsbMsInterfaceNodeL(device, aInterfaceNumber, aInterfaceToken);
         }
+    OstTraceFunctionExit0( CMSMMENGINE_ADDUSBMSINTERFACEL_EXIT );
     return interface;
     }
 
 void CMsmmEngine::AddUsbMsLogicalUnitL(TInt aDeviceId,
         TInt aInterfaceNumber, TInt aLogicalUnitNumber, TText aDrive)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CMSMMENGINE_ADDUSBMSLOGICALUNITL_ENTRY );
+    
     TUsbMsDevice* device = SearchDevice(aDeviceId);
     if (!device)
         {
@@ -109,17 +121,21 @@
         {
         User::Leave(KErrArgument); // A proper interface node can't be found
         }
+    OstTraceFunctionExit0( CMSMMENGINE_ADDUSBMSLOGICALUNITL_EXIT );
     }
 
 void CMsmmEngine::RemoveUsbMsNode(TMsmmNodeBase* aNodeToBeRemoved)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CMSMMENGINE_REMOVEUSBMSNODE_ENTRY );
+    
     delete aNodeToBeRemoved;
+    OstTraceFunctionExit0( CMSMMENGINE_REMOVEUSBMSNODE_EXIT );
     }
 
 TUsbMsDevice* CMsmmEngine::SearchDevice(TInt aDeviceId) const
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CMSMMENGINE_SEARCHDEVICE_ENTRY );
+    
     return static_cast<TUsbMsDevice*>(
             iDataEntrys->SearchInChildren(aDeviceId));
     }
@@ -127,31 +143,37 @@
 TUsbMsInterface* CMsmmEngine::SearchInterface(TMsmmNodeBase* aDevice, 
         TInt aInterfaceNumber) const
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CMSMMENGINE_SEARCHINTERFACE_ENTRY );
+    
     return static_cast<TUsbMsInterface*>(
             aDevice->SearchInChildren(aInterfaceNumber));
     }
 
 CMsmmEngine::CMsmmEngine()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CMSMMENGINE_CMSMMENGINE_CONS_ENTRY );
+
     }
 
 void CMsmmEngine::ConstructL()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CMSMMENGINE_CONSTRUCTL_ENTRY );
+    
     // Create the root of the whole node tree
     iDataEntrys = new (ELeave) TMsmmNodeBase(0x0);
+    OstTraceFunctionExit0( CMSMMENGINE_CONSTRUCTL_EXIT );
     }
 
 TUsbMsInterface* CMsmmEngine::AddUsbMsInterfaceNodeL(TUsbMsDevice* iParent,
         TInt aInterfaceNumber, TInt aInterfaceToken)
     {
-    LOG_FUNC    
+       OstTraceFunctionEntry0( CMSMMENGINE_ADDUSBMSINTERFACENODEL_ENTRY );
+       
     TUsbMsInterface* interface = new (ELeave) TUsbMsInterface(
             aInterfaceNumber, aInterfaceToken);
     iParent->AddChild(interface);
     
+    OstTraceFunctionExit0( CMSMMENGINE_ADDUSBMSINTERFACENODEL_EXIT );
     return interface;
     }
 
@@ -159,11 +181,13 @@
         TUsbMsInterface* iParent, TInt aLogicalUnitNumber, 
         TText aDrive)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CMSMMENGINE_ADDUSBMSLOGICALUNITNODEL_ENTRY );
+    
     TUsbMsLogicalUnit* logicalUnit = new (ELeave) TUsbMsLogicalUnit(
             aLogicalUnitNumber, aDrive);
     iParent->AddChild(logicalUnit);
     
+    OstTraceFunctionExit0( CMSMMENGINE_ADDUSBMSLOGICALUNITNODEL_EXIT );
     return logicalUnit;
     }
 
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/msmmnodebase.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/msmmnodebase.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-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"
@@ -23,10 +23,12 @@
 #include "msmmnodebase.h"
 
 #include <usb/usblogger.h>
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "msmmnodebaseTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "UsbHostMsmmServer");
-#endif
+
 
 TMsmmNodeBase::TMsmmNodeBase(TInt aIdentifier):
 iIdentifier(aIdentifier),
@@ -35,19 +37,22 @@
 iLastChild(NULL),
 iParent(NULL)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TMSMMNODEBASE_TMSMMNODEBASE_CONS_ENTRY );
     }
 
 TMsmmNodeBase::~TMsmmNodeBase()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TMSMMNODEBASE_TMSMMNODEBASE_DES_ENTRY );
+    
     // Remove current node from the parent node and destroy it.
     DestroyNode(); 
+    OstTraceFunctionExit0( TMSMMNODEBASE_TMSMMNODEBASE_DES_EXIT );
     }
 
 void TMsmmNodeBase::DestroyNode()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TMSMMNODEBASE_DESTROYNODE_ENTRY );
+    
     TMsmmNodeBase* parentNode = iParent; 
     TMsmmNodeBase* iterator(this);
     TMsmmNodeBase* iteratorPrev(NULL);
@@ -91,6 +96,7 @@
         else
             {
             // No matched node
+            OstTraceFunctionExit0( TMSMMNODEBASE_DESTROYNODE_EXIT );
             return;
             }
         }
@@ -111,11 +117,13 @@
                 }
             }
         }
+    OstTraceFunctionExit0( TMSMMNODEBASE_DESTROYNODE_EXIT_DUP1 );
     }
 
 void TMsmmNodeBase::AddChild(TMsmmNodeBase* aChild)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TMSMMNODEBASE_ADDCHILD_ENTRY );
+    
     if (!iFirstChild)
         {
         iFirstChild = aChild;
@@ -126,11 +134,13 @@
         }
     iLastChild = aChild;
     aChild->iParent = this;
+    OstTraceFunctionExit0( TMSMMNODEBASE_ADDCHILD_EXIT );
     }
 
 TMsmmNodeBase* TMsmmNodeBase::SearchInChildren(TInt aIdentifier)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TMSMMNODEBASE_SEARCHINCHILDREN_ENTRY );
+    
     TMsmmNodeBase* iterator(iFirstChild);
     
     while (iterator)
@@ -142,6 +152,7 @@
         iterator = iterator->iNextPeer;
         }
     
+    OstTraceFunctionExit0( TMSMMNODEBASE_SEARCHINCHILDREN_EXIT );
     return iterator;
     }
 
@@ -151,7 +162,7 @@
 TMsmmNodeBase(aDevice.iDeviceId),
 iDevice(aDevice)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TUSBMSDEVICE_TUSBMSDEVICE_CONS_ENTRY );
     }
 
 // TUsbMsInterface
@@ -162,13 +173,15 @@
 iInterfaceNumber(aInterfaceNumber),
 iInterfaceToken(aInterfaceToken)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TUSBMSINTERFACE_TUSBMSINTERFACE_CONS_ENTRY );
     }
 
 TUsbMsInterface::~TUsbMsInterface()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TUSBMSINTERFACE_TUSBMSINTERFACE_DES_ENTRY );
+    
     iUsbMsDevice.Close();
+    OstTraceFunctionExit0( TUSBMSINTERFACE_TUSBMSINTERFACE_DES_EXIT );
     }
 
 // TUsbMsLogicalUnit
@@ -178,7 +191,7 @@
 iLogicalUnitNumber(aLogicalUnitNumber),
 iDrive(aDrive)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TUSBMSLOGICALUNIT_TUSBMSLOGICALUNIT_CONS_ENTRY );
     }
 
 // End of file
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/msmmserver.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/msmmserver.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-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,19 +21,21 @@
 */
 
 #include "msmmserver.h"
-#include <usb/hostms/msmmpolicypluginbase.h>
 #include "msmm_internal_def.h"
 #include "msmmsession.h"
 #include "msmmengine.h"
 #include "eventqueue.h"
 #include "msmmterminator.h"
-
-#include <usb/usblogger.h>
+#include "msmmdismountusbdrives.h"
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "UsbHostMsmmServer");
+#include <usb/hostms/msmmpolicypluginbase.h>
+#include <usb/usblogger.h>
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "msmmserverTraces.h"
 #endif
 
+
 //  Static public functions
 TInt CMsmmServer::ThreadFunction()
     {
@@ -44,15 +46,7 @@
     CTrapCleanup* cleanupStack = CTrapCleanup::New();
     if (cleanupStack)
         {
-#ifdef __FLOG_ACTIVE
-        (void)CUsbLog::Connect();
-#endif
-
         TRAP(ret, ThreadFunctionL());
-
-#ifdef __FLOG_ACTIVE
-        CUsbLog::Close();
-#endif
         
         delete cleanupStack;
         }
@@ -67,7 +61,7 @@
 
 void CMsmmServer::ThreadFunctionL()
     {
-    LOG_STATIC_FUNC_ENTRY
+    OstTraceFunctionEntry0( CMSMMSERVER_THREADFUNCTIONL_ENTRY );
     
     TSecureId creatorSID = User::CreatorSecureId();
     if (KFDFWSecureId != creatorSID)
@@ -95,13 +89,35 @@
 
     // Free the server and active scheduler.
     CleanupStack::PopAndDestroy(2, scheduler);
+    OstTraceFunctionExit0( CMSMMSERVER_THREADFUNCTIONL_EXIT );
     }
 
+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()
     {
-    LOG_STATIC_FUNC_ENTRY
+    OstTraceFunctionEntry0( CMSMMSERVER_NEWLC_ENTRY );
+    
     CMsmmServer* self = new (ELeave) CMsmmServer(EPriorityHigh);
     CleanupStack::PushL(self);
     
@@ -109,34 +125,39 @@
     self->StartL(KMsmmServerName);
     self->ConstructL();
     
+    OstTraceFunctionExit0( CMSMMSERVER_NEWLC_EXIT );
     return self;
     }
 
 CMsmmServer::~CMsmmServer()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CMSMMSERVER_CMSMMSERVER_DES_ENTRY );
+    
     delete iPolicyPlugin;
     delete iEventQueue;
     delete iEngine;
     delete iTerminator;
+    delete iDismountErrData;
+    delete iDismountManager;
     REComSession::FinalClose();
 
 #ifndef __OVER_DUMMYCOMPONENT__
     iFs.RemoveProxyDrive(KPROXYDRIVENAME);
     iFs.Close();
 #endif
+    OstTraceFunctionExit0( CMSMMSERVER_CMSMMSERVER_DES_EXIT );
     }
     
     // CMsmmServer APIs
 CSession2* CMsmmServer::NewSessionL(const TVersion& aVersion, 
         const RMessage2& aMessage) const
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CMSMMSERVER_NEWSESSIONL_ENTRY );
     
     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);
         }
@@ -159,22 +180,22 @@
 
 TInt CMsmmServer::SessionNumber() const
     {
-    LOG_FUNC
-    
+    OstTraceFunctionEntry0( CMSMMSERVER_SESSIONNUMBER_ENTRY );
     return iNumSessions;
     }
 
 void CMsmmServer::AddSession()
     {
-    LOG_FUNC
-    
+    OstTraceFunctionEntry0( CMSMMSERVER_ADDSESSION_ENTRY );
+     
     ++iNumSessions;
     iTerminator->Cancel();
+    OstTraceFunctionExit0( CMSMMSERVER_ADDSESSION_EXIT );
     }
 
 void CMsmmServer::RemoveSession()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CMSMMSERVER_REMOVESESSION_ENTRY );
     
     --iNumSessions;
     if (iNumSessions == 0)
@@ -186,25 +207,49 @@
         iTerminator->Cancel();
         iTerminator->Start();
         }
+		
+    OstTraceFunctionExit0( CMSMMSERVER_REMOVESESSION_EXIT );
     }
+	
+	void CMsmmServer::DismountUsbDrivesL(TUSBMSDeviceDescription& aDevice)
+    {
+    OstTraceFunctionEntry0( CMSMMSERVER_DISMOUNTUSBDRIVERSL_ENTRY );
+    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);
+	OstTraceFunctionExit0( CMSMMSERVER_DISMOUNTUSBDRIVERSL_EXIT );
+    }
+
 
 //  Private functions 
 // CMsmmServer Construction
 CMsmmServer::CMsmmServer(TInt aPriority)
     :CPolicyServer(aPriority, KMsmmServerSecurityPolicy, EUnsharableSessions)
     {
-    LOG_FUNC
-    //
+    OstTraceFunctionEntry0( CMSMMSERVER_CMSMMSERVER_CONS_ENTRY );
     }
 
 void CMsmmServer::ConstructL()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CMSMMSERVER_CONSTRUCTL_ENTRY );
     
     iEngine = CMsmmEngine::NewL();
     iEventQueue = CDeviceEventQueue::NewL(*this);
     iTerminator = CMsmmTerminator::NewL(*iEventQueue);
     iPolicyPlugin = CMsmmPolicyPluginBase::NewL();
+    iDismountErrData = new (ELeave) THostMsErrData;
     if (!iPolicyPlugin)
         {
         // Not any policy plugin implementation available
@@ -225,6 +270,7 @@
     
     // Start automatic shutdown timer
     iTerminator->Start();
+    OstTraceFunctionExit0( CMSMMSERVER_CONSTRUCTL_EXIT );
     }
 
 // End of file
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/msmmsession.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/msmmsession.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-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"
@@ -24,36 +24,44 @@
 #include "msmmserver.h"
 #include "msmmengine.h"
 #include "eventqueue.h"
+#include "msmmnodebase.h"
 #include <usb/hostms/srverr.h>
 #include <usb/hostms/msmmpolicypluginbase.h>
-#include "msmmnodebase.h"
-#include <usb/usblogger.h>
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "UsbHostMsmmServer");
+#include <usb/usblogger.h>
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "msmmsessionTraces.h"
 #endif
 
+
+
 CMsmmSession::~CMsmmSession()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CMSMMSESSION_CMSMMSESSION_DES_ENTRY );
+    
     delete iErrData;
     iServer.RemoveSession();
+    OstTraceFunctionExit0( CMSMMSESSION_CMSMMSESSION_DES_EXIT );
     }
 
 CMsmmSession* CMsmmSession::NewL(CMsmmServer& aServer, 
         CDeviceEventQueue& anEventQueue)
     {
-    LOG_STATIC_FUNC_ENTRY
+    OstTraceFunctionEntry0( CMSMMSESSION_NEWL_ENTRY );
+    
     CMsmmSession* self = new(ELeave) CMsmmSession(aServer, anEventQueue);
     CleanupStack::PushL(self);
     self->ConstructL();
     CleanupStack::Pop(self);
+    OstTraceFunctionExit0( CMSMMSESSION_NEWL_EXIT );
     return self;
     }
 
 void CMsmmSession::ServiceL(const RMessage2& aMessage)
     {
-    LOG_STATIC_FUNC_ENTRY
+    OstTraceFunctionEntry0( CMSMMSESSION_SERVICEL_ENTRY );
+    
     TInt ret(KErrNone);
 
 #ifdef _DEBUG
@@ -92,7 +100,10 @@
         delete heapObj;
 #endif // _DEBUG
         break;
-
+        
+    case EHostMsmmServerEjectUsbDrives:
+        iServer.DismountUsbDrivesL(iDevicePkg());
+        break;
     default:
         // Unsupported function number - panic the client
         PanicClient(aMessage, EBadRequest);
@@ -100,11 +111,13 @@
         
     // Complete the request
     aMessage.Complete(ret);
+    OstTraceFunctionExit0( CMSMMSESSION_SERVICEL_EXIT );
     }
 
 void CMsmmSession::ServiceError(const RMessage2 &aMessage, TInt aError)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CMSMMSESSION_SERVICEERROR_ENTRY );
+    
     CMsmmPolicyPluginBase* plugin = iServer.PolicyPlugin();    
     TUSBMSDeviceDescription& device = iDevicePkg();
        
@@ -128,9 +141,15 @@
     iErrData->iProductString = device.iProductString;
     iErrData->iDriveName = 0x0;
    
+    OstTrace1( TRACE_DUMP, CMSMMSESSION_SERVICEERROR, "iErrData->iE32Error = %d", aError );
+    OstTraceExt1( TRACE_DUMP, CMSMMSESSION_SERVICEERROR_DUP1, "iErrData->iManufacturerString=\"%S\"", device.iManufacturerString );
+    OstTraceExt1( TRACE_DUMP, CMSMMSESSION_SERVICEERROR_DUP2, "iErrData->iProductString=\"%S\"", device.iProductString );
+
+        
     TInt err(KErrNone);
     TRAP(err, plugin->SendErrorNotificationL(*iErrData));
     aMessage.Complete(aError);
+    OstTraceFunctionExit0( CMSMMSESSION_SERVICEERROR_EXIT );
     }
 
 CMsmmSession::CMsmmSession(CMsmmServer& aServer, 
@@ -139,19 +158,24 @@
 iEngine(aServer.Engine()),
 iEventQueue(anEventQueue)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CMSMMSESSION_CMSMMSESSION_CONS_ENTRY );
+    
     aServer.AddSession();
+    OstTraceFunctionExit0( CMSMMSESSION_CMSMMSESSION_CONS_EXIT );
     }
 
 void CMsmmSession::ConstructL()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CMSMMSESSION_CONSTRUCTL_ENTRY );
+    
     iErrData = new (ELeave) THostMsErrData;
+    OstTraceFunctionExit0( CMSMMSESSION_CONSTRUCTL_EXIT );
     }
 
 void CMsmmSession::AddUsbMsInterfaceL(const RMessage2& aMessage)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CMSMMSESSION_ADDUSBMSINTERFACEL_ENTRY );
+    
     aMessage.Read(0, iDevicePkg);
     iInterfaceNumber = aMessage.Int1();
     iInterfaceToken = static_cast<TInt32>(aMessage.Int2());
@@ -165,16 +189,19 @@
     TDeviceEvent event(EDeviceEventAddFunction, 
             device.iDeviceId, iInterfaceNumber, iInterfaceToken);
     iEventQueue.PushL(event);
+    OstTraceFunctionExit0( CMSMMSESSION_ADDUSBMSINTERFACEL_EXIT );
     }
 
 void CMsmmSession::RemoveUsbMsDeviceL(const RMessage2& aMessage)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CMSMMSESSION_REMOVEUSBMSDEVICEL_ENTRY );
+    
     iDeviceID = aMessage.Int0();
        
     // Put device event into queue
     TDeviceEvent event(EDeviceEventRemoveDevice, iDeviceID, 0, 0);
     iEventQueue.PushL(event);
+    OstTraceFunctionExit0( CMSMMSESSION_REMOVEUSBMSDEVICEL_EXIT );
     }
 
 // End of file
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/msmmterminator.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/msmmterminator.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-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"
@@ -24,33 +24,39 @@
 #include "eventqueue.h"
 
 #include <usb/usblogger.h>
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "msmmterminatorTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "UsbHostMsmmServer");
-#endif
 
 const TInt KShutdownDelay = 2000000; // approx 2 seconds
 const TInt KMsmmTerminatorPriority = CActive::EPriorityStandard;
 
 CMsmmTerminator* CMsmmTerminator::NewL(const CDeviceEventQueue& anEventQueue)
     {
-    LOG_STATIC_FUNC_ENTRY
+    OstTraceFunctionEntry0( CMSMMTERMINATOR_NEWL_ENTRY );
+    
     CMsmmTerminator* self = new (ELeave) CMsmmTerminator(anEventQueue);
     CleanupStack::PushL(self);
     self->ConstructL();
     CleanupStack::Pop(self);
+    OstTraceFunctionExit0( CMSMMTERMINATOR_NEWL_EXIT );
     return self;
     }
 
 void CMsmmTerminator::Start()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CMSMMTERMINATOR_START_ENTRY );
+    
     After(KShutdownDelay);
+    OstTraceFunctionExit0( CMSMMTERMINATOR_START_EXIT );
     }
 
 void CMsmmTerminator::RunL()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CMSMMTERMINATOR_RUNL_ENTRY );
+    
     if (iEventQueue.Count())
         {
         // There are some events still in the event queue to 
@@ -61,20 +67,25 @@
         {
         CActiveScheduler::Stop();
         }
+    OstTraceFunctionExit0( CMSMMTERMINATOR_RUNL_EXIT );
     }
 
 CMsmmTerminator::CMsmmTerminator(const CDeviceEventQueue& anEventQueue):
 CTimer(KMsmmTerminatorPriority),
 iEventQueue(anEventQueue)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CMSMMTERMINATOR_CMSMMTERMINATOR_CONS_ENTRY );
+    
     CActiveScheduler::Add(this);
+    OstTraceFunctionExit0( CMSMMTERMINATOR_CMSMMTERMINATOR_CONS_EXIT );
     }
 
 void CMsmmTerminator::ConstructL()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( CMSMMTERMINATOR_CONSTRUCTL_ENTRY );
+    
     CTimer::ConstructL();
+    OstTraceFunctionExit0( CMSMMTERMINATOR_CONSTRUCTL_EXIT );
     }
 
 // End of file
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/subcommandbase.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/subcommandbase.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-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"
@@ -26,10 +26,12 @@
 #include "eventhandler.h"
 
 #include <usb/usblogger.h>
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "subcommandbaseTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "UsbHostMsmmServer");
-#endif
+
 
 THostMsSubCommandParam::THostMsSubCommandParam(MMsmmSrvProxy& aServer, 
         MUsbMsEventHandler& aHandler, 
@@ -40,7 +42,7 @@
     iCreator(aCreator),
     iEvent(aEvent)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( THOSTMSSUBCOMMANDPARAM_THOSTMSSUBCOMMANDPARAM_CONS_ENTRY );
     }
 
 TSubCommandBase::TSubCommandBase(THostMsSubCommandParam& aParameter):
@@ -51,7 +53,7 @@
 iIsExecuted(EFalse),
 iIsKeyCommand(ETrue)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TSUBCOMMANDBASE_TSUBCOMMANDBASE_CONS_ENTRY );
     }
 
 void TSubCommandBase::ExecuteL()
@@ -62,26 +64,34 @@
 
 void TSubCommandBase::AsyncCmdCompleteL()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TSUBCOMMANDBASE_ASYNCCMDCOMPLETEL_ENTRY );
+    
     DoAsyncCmdCompleteL();
+    OstTraceFunctionExit0( TSUBCOMMANDBASE_ASYNCCMDCOMPLETEL_EXIT );
     }
 
 void TSubCommandBase::CancelAsyncCmd()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TSUBCOMMANDBASE_CANCELASYNCCMD_ENTRY );
+    
     DoCancelAsyncCmd();
+    OstTraceFunctionExit0( TSUBCOMMANDBASE_CANCELASYNCCMD_EXIT );
     }
 
 void TSubCommandBase::DoAsyncCmdCompleteL()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TSUBCOMMANDBASE_DOASYNCCMDCOMPLETEL_ENTRY );
+    
     // Empty implementation
+    OstTraceFunctionExit0( TSUBCOMMANDBASE_DOASYNCCMDCOMPLETEL_EXIT );
     }
 
 void TSubCommandBase::DoCancelAsyncCmd()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TSUBCOMMANDBASE_DOCANCELASYNCCMD_ENTRY );
+    
     // Empty implementation
+    OstTraceFunctionExit0( TSUBCOMMANDBASE_DOCANCELASYNCCMD_EXIT );
     }
 
 // End of file
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/subcommands.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/subcommands.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-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"
@@ -30,10 +30,11 @@
 #include <usb/hostms/srverr.h>
 
 #include <usb/usblogger.h>
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "subcommandsTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "UsbHostMsmmServer");
-#endif
 
 /**
  *  TRegisterInterface member functions
@@ -43,12 +44,12 @@
 iDeviceNode(NULL),
 iInterfaceNode(NULL)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TREGISTERINTERFACE_TREGISTERINTERFACE_CONS_ENTRY );
     }
 
 void TRegisterInterface::DoExecuteL()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TREGISTERINTERFACE_DOEXECUTEL_ENTRY );
       
     // Add new interface node into data engine
     iInterfaceNode = iServer.Engine().AddUsbMsInterfaceL(iEvent.iDeviceId, 
@@ -74,26 +75,32 @@
     iMsConfig.iRemoteWakeup = device.iRemoteWakeup;
     iMsConfig.iIsOtgClient = device.iIsOtgClient;
 
-    LOGTEXT2(_L8("\t iMsConfig.iProtocolId %d"), iMsConfig.iProtocolId);
-    LOGTEXT2(_L8("\t iMsConfig.iTransportId %d"), iMsConfig.iTransportId);
-    LOGTEXT2(_L8("\t iMsConfig.iRemoteWakeup %d"), iMsConfig.iRemoteWakeup);
-    LOGTEXT2(_L8("\t iMsConfig.iIsOtgClient %d"), iMsConfig.iIsOtgClient);
-
+    OstTrace1( TRACE_NORMAL, TREGISTERINTERFACE_DOEXECUTEL, 
+            "iMsConfig.iProtocolId %d", iMsConfig.iProtocolId );
+    OstTrace1( TRACE_NORMAL, TREGISTERINTERFACE_DOEXECUTEL_DUP1, 
+            "iMsConfig.iTransportId %d", iMsConfig.iTransportId );
+    OstTrace1( TRACE_NORMAL, TREGISTERINTERFACE_DOEXECUTEL_DUP2, 
+            "iMsConfig.iRemoteWakeup %d", iMsConfig.iRemoteWakeup );
+    OstTrace1( TRACE_NORMAL, TREGISTERINTERFACE_DOEXECUTEL_DUP3, 
+            "iMsConfig.iIsOtgClient %d", iMsConfig.iIsOtgClient );
+            
     TSuspensionPolicy suspensionPolicy;
     iServer.PolicyPlugin()->GetSuspensionPolicy(suspensionPolicy);
     iMsConfig.iOtgSuspendTime = suspensionPolicy.iOtgSuspendTime;
     iMsConfig.iStatusPollingInterval = suspensionPolicy.iStatusPollingInterval;
-
-    LOGTEXT2(_L8("\t iMsConfig.iStatusPollingInterval %d"), iMsConfig.iStatusPollingInterval);
-    LOGTEXT2(_L8("\t iMsConfig.iOtgSuspendTime %d"), iMsConfig.iOtgSuspendTime);
-
+    OstTrace1( TRACE_NORMAL, TREGISTERINTERFACE_DOEXECUTEL_DUP4, 
+            "iMsConfig.iStatusPollingInterval %d", iMsConfig.iStatusPollingInterval );
+    OstTrace1( TRACE_NORMAL, TREGISTERINTERFACE_DOEXECUTEL_DUP5, 
+            "iMsConfig.iOtgSuspendTime %d", iMsConfig.iOtgSuspendTime );
+ 
     iHandler.Start();
     iInterfaceNode->iUsbMsDevice.Add(iMsConfig, iHandler.Status());
+    OstTraceFunctionExit0( TREGISTERINTERFACE_DOEXECUTEL_EXIT );
     }
 
 void TRegisterInterface::HandleError(THostMsErrData& aData, TInt aError)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TREGISTERINTERFACE_HANDLEERROR_ENTRY );
     
     switch (aError)
         {
@@ -120,11 +127,12 @@
         iServer.Engine().RemoveUsbMsNode(iInterfaceNode);
         iInterfaceNode = NULL;
         }
+    OstTraceFunctionExit0( TREGISTERINTERFACE_HANDLEERROR_EXIT );
     }
 
 void TRegisterInterface::DoAsyncCmdCompleteL()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TREGISTERINTERFACE_DOASYNCCMDCOMPLETEL_ENTRY );
     
     User::LeaveIfError(iHandler.Status().Int());
     if(iInterfaceNode)
@@ -133,14 +141,16 @@
                 iInterfaceNode->iUsbMsDevice.GetNumLun(iMaxLogicalUnit));
         }
 
-    LOGTEXT2(_L8("\tGetNumLun %d"), iMaxLogicalUnit);
+    OstTrace1( TRACE_NORMAL, TREGISTERINTERFACE_DOASYNCCMDCOMPLETEL, 
+            "GetNumLun %d", iMaxLogicalUnit );
     
     iCreator.CreateSubCmdForRetrieveDriveLetterL(iMaxLogicalUnit);
+    OstTraceFunctionExit0( TREGISTERINTERFACE_DOASYNCCMDCOMPLETEL_EXIT );
     }
 
 void TRegisterInterface::DoCancelAsyncCmd()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TREGISTERINTERFACE_DOCANCELASYNCCMD_ENTRY );
 
     if(iInterfaceNode)
         {
@@ -148,6 +158,7 @@
         iServer.Engine().RemoveUsbMsNode(iInterfaceNode);
         iInterfaceNode = NULL;
         }
+    OstTraceFunctionExit0( TREGISTERINTERFACE_DOCANCELASYNCCMD_EXIT );
     }
 
 /**
@@ -160,12 +171,12 @@
 iLuNumber(aLuNumber),
 iDrive(0)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TRETRIEVEDRIVELETTER_TRETRIEVEDRIVELETTER_CONS_ENTRY );
     }
 
 void TRetrieveDriveLetter::DoExecuteL()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TRETRIEVEDRIVELETTER_DOEXECUTEL_ENTRY );
         
     TUsbMsDevice* deviceEntry(NULL);
     deviceEntry = iServer.Engine().SearchDevice(iEvent.iDeviceId);
@@ -194,11 +205,12 @@
         iServer.PolicyPlugin()->RetrieveDriveLetterL(
                 iDrive, iRequestData, status);
         }
+    OstTraceFunctionExit0( TRETRIEVEDRIVELETTER_DOEXECUTEL_EXIT );
     }
 
 void TRetrieveDriveLetter::HandleError(THostMsErrData& aData, TInt aError)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TRETRIEVEDRIVELETTER_HANDLEERROR_ENTRY );
     
     switch (aError)
         {
@@ -218,22 +230,25 @@
     aData.iManufacturerString = iRequestData.iManufacturerString;
     aData.iProductString = iRequestData.iProductString;
     aData.iDriveName = iDrive;
+    OstTraceFunctionExit0( TRETRIEVEDRIVELETTER_HANDLEERROR_EXIT );
     }
 
 void TRetrieveDriveLetter::DoAsyncCmdCompleteL()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TRETRIEVEDRIVELETTER_DOASYNCCMDCOMPLETEL_ENTRY );
     
     User::LeaveIfError(iHandler.Status().Int());
     
     iCreator.CreateSubCmdForMountingLogicalUnitL(iDrive, iLuNumber);
+    OstTraceFunctionExit0( TRETRIEVEDRIVELETTER_DOASYNCCMDCOMPLETEL_EXIT );
     }
 
 void TRetrieveDriveLetter::DoCancelAsyncCmd()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TRETRIEVEDRIVELETTER_DOCANCELASYNCCMD_ENTRY );
     
     iServer.PolicyPlugin()->CancelRetrieveDriveLetter();
+    OstTraceFunctionExit0( TRETRIEVEDRIVELETTER_DOCANCELASYNCCMD_EXIT );
     }
 
 /**
@@ -246,14 +261,16 @@
 iDrive(aDrive),
 iLuNumber(aLuNumber)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TMOUNTLOGICALUNIT_TMOUNTLOGICALUNIT_CONS_ENTRY );
     
     iIsKeyCommand = EFalse;
+    OstTraceFunctionExit0( TMOUNTLOGICALUNIT_TMOUNTLOGICALUNIT_CONS_EXIT );
     }
 
 void TMountLogicalUnit::DoExecuteL()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TMOUNTLOGICALUNIT_DOEXECUTEL_ENTRY );
+    
     TInt ret(KErrNone);
     RFs& fs = iServer.FileServerSession();
     
@@ -277,16 +294,18 @@
     if ((KErrNone != ret) && (KErrAlreadyExists != ret)
             && (KErrNotReady != ret))
         {
-        User::Leave (ret);
+        if (KErrAbort != ret)
+            User::Leave (ret);
         }
 
     iHandler.Start();
     iHandler.Complete();
+    OstTraceFunctionExit0( TMOUNTLOGICALUNIT_DOEXECUTEL_EXIT );
     }
 
 void TMountLogicalUnit::HandleError(THostMsErrData& aData, TInt aError)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TMOUNTLOGICALUNIT_HANDLEERROR_ENTRY );
     
     switch (aError)
         {
@@ -336,16 +355,18 @@
         aData.iProductString.Copy(deviceNode->iDevice.iProductString);
         }
     aData.iDriveName = iDrive;
+    OstTraceFunctionExit0( TMOUNTLOGICALUNIT_HANDLEERROR_EXIT );
     }
 
 void TMountLogicalUnit::DoAsyncCmdCompleteL()
     {
-    LOG_FUNC
-   
+    OstTraceFunctionEntry0( TMOUNTLOGICALUNIT_DOASYNCCMDCOMPLETEL_ENTRY );
+    
     iServer.Engine().AddUsbMsLogicalUnitL(
             iEvent.iDeviceId, iEvent.iInterfaceNumber, 
             iLuNumber, iDrive);
     iCreator.CreateSubCmdForSaveLatestMountInfoL(iDrive, iLuNumber);
+    OstTraceFunctionExit0( TMOUNTLOGICALUNIT_DOASYNCCMDCOMPLETEL_EXIT );
     }
 
 /**
@@ -359,15 +380,16 @@
 iDrive(aDrive),
 iLuNumber(aLuNumber)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TSAVELATESTMOUNTINFO_TSAVELATESTMOUNTINFO_CONS_ENTRY );
     
     iIsKeyCommand = EFalse;
+    OstTraceFunctionExit0( TSAVELATESTMOUNTINFO_TSAVELATESTMOUNTINFO_CONS_EXIT );
     }
 
 void TSaveLatestMountInfo::DoExecuteL()
     {
-    LOG_FUNC
-        
+    OstTraceFunctionEntry0( TSAVELATESTMOUNTINFO_DOEXECUTEL_ENTRY );
+    
     TUsbMsDevice* deviceEntry(NULL);
     deviceEntry = iServer.Engine().SearchDevice(iEvent.iDeviceId);
     if (!deviceEntry)
@@ -398,18 +420,21 @@
         
         iServer.PolicyPlugin()->SaveLatestMountInfoL(iRecord, status);
         }
+    OstTraceFunctionExit0( TSAVELATESTMOUNTINFO_DOEXECUTEL_EXIT );
     }
 
 void TSaveLatestMountInfo::DoAsyncCmdCompleteL()
     {
-    LOG_FUNC    
+    OstTraceFunctionEntry0( TSAVELATESTMOUNTINFO_DOASYNCCMDCOMPLETEL_ENTRY );
+        
     User::LeaveIfError(iHandler.Status().Int());
+    OstTraceFunctionExit0( TSAVELATESTMOUNTINFO_DOASYNCCMDCOMPLETEL_EXIT );
     }
 
 void TSaveLatestMountInfo::HandleError(THostMsErrData& aData, TInt aError)
     {
-    LOG_FUNC
-        
+    OstTraceFunctionEntry0( TSAVELATESTMOUNTINFO_HANDLEERROR_ENTRY );
+    
     switch (aError)
         {
     case KErrNoMemory:
@@ -425,13 +450,15 @@
     aData.iManufacturerString = iRecord.iLogicUnit.iManufacturerString;
     aData.iProductString = iRecord.iLogicUnit.iProductString;
     aData.iDriveName = iDrive;
+    OstTraceFunctionExit0( TSAVELATESTMOUNTINFO_HANDLEERROR_EXIT );
     }
 
 void TSaveLatestMountInfo::DoCancelAsyncCmd()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TSAVELATESTMOUNTINFO_DOCANCELASYNCCMD_ENTRY );
     
     iServer.PolicyPlugin()->CancelSaveLatestMountInfo();
+    OstTraceFunctionExit0( TSAVELATESTMOUNTINFO_DOCANCELASYNCCMD_EXIT );
     }
 
 
@@ -448,13 +475,13 @@
 iDeviceNode(NULL),
 iInterfaceNode(NULL)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TDEREGISTERINTERFACE_TDEREGISTERINTERFACE_CONS_ENTRY );
     }
 
 void TDeregisterInterface::DoExecuteL()
     {
-    LOG_FUNC
-   
+    OstTraceFunctionEntry0( TDEREGISTERINTERFACE_DOEXECUTEL_ENTRY );
+    
     iDeviceNode = iServer.Engine().SearchDevice(iEvent.iDeviceId);
     if (!iDeviceNode)
         {
@@ -483,12 +510,13 @@
     iHandler.Start();
     // Simulate a async request be completed.
     iHandler.Complete();
+    OstTraceFunctionExit0( TDEREGISTERINTERFACE_DOEXECUTEL_EXIT );
     }
 
 void TDeregisterInterface::HandleError(THostMsErrData& aData, TInt aError)
     {
-    LOG_FUNC
-     
+    OstTraceFunctionEntry0( TDEREGISTERINTERFACE_HANDLEERROR_ENTRY );
+    
     switch (aError)
         {
     case KErrNoMemory:
@@ -507,6 +535,7 @@
         aData.iProductString.Copy(iDeviceNode->iDevice.iProductString);
         }
     aData.iDriveName = 0;
+    OstTraceFunctionExit0( TDEREGISTERINTERFACE_HANDLEERROR_EXIT );
     }
 
 /**
@@ -519,12 +548,13 @@
 TSubCommandBase(aParameter),
 iLogicalUnit(aLogicalUnit)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TDISMOUNTLOGICALUNIT_TDISMOUNTLOGICALUNIT_CONS_ENTRY );
     }
 
 void TDismountLogicalUnit::DoExecuteL()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TDISMOUNTLOGICALUNIT_DOEXECUTEL_ENTRY );
+    
     RFs& fs = iServer.FileServerSession();
     TInt driveNum;
     fs.CharToDrive(iLogicalUnit.iDrive, driveNum);
@@ -541,11 +571,12 @@
     iHandler.Start();
     // Simulate a async request be completed.
     iHandler.Complete();
+    OstTraceFunctionExit0( TDISMOUNTLOGICALUNIT_DOEXECUTEL_EXIT );
     }
 
 void TDismountLogicalUnit::HandleError(THostMsErrData& aData, TInt aError)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TDISMOUNTLOGICALUNIT_HANDLEERROR_ENTRY );
     
     switch (aError)
         {
@@ -566,6 +597,7 @@
         aData.iProductString.Copy(deviceNode->iDevice.iProductString);
         }
     aData.iDriveName = iLogicalUnit.iDrive;
+    OstTraceFunctionExit0( TDISMOUNTLOGICALUNIT_HANDLEERROR_EXIT );
     }
 
 /**
@@ -578,12 +610,13 @@
 TSubCommandBase(aParameter),
 iNodeToBeRemoved(aNodeToBeRemoved)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TREMOVEUSBMSDEVICENODE_TREMOVEUSBMSDEVICENODE_CONS_ENTRY );
     }
 
 void TRemoveUsbMsDeviceNode::DoExecuteL()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( TREMOVEUSBMSDEVICENODE_DOEXECUTEL_ENTRY );
+    
     if(iNodeToBeRemoved)
         {
         iServer.Engine().RemoveUsbMsNode(iNodeToBeRemoved);
@@ -598,11 +631,13 @@
     iHandler.Start();
     // Simulate a async request be completed.
     iHandler.Complete();
+    OstTraceFunctionExit0( TREMOVEUSBMSDEVICENODE_DOEXECUTEL_EXIT );
     }
 
 void TRemoveUsbMsDeviceNode::HandleError(THostMsErrData& aData, TInt aError)
     {
-    LOG_FUNC  
+      OstTraceFunctionEntry0( TREMOVEUSBMSDEVICENODE_HANDLEERROR_ENTRY );
+      
     switch (aError)
         {
     case KErrArgument:
@@ -619,6 +654,7 @@
         aData.iProductString.Copy(deviceNode->iDevice.iProductString);
         }
     aData.iDriveName = 0;
+    OstTraceFunctionExit0( TREMOVEUSBMSDEVICENODE_HANDLEERROR_EXIT );
     }
 
 // End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/traces/OstTraceDefinitions.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,7 @@
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <opensystemtrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/traces/fixed_id.definitions	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,280 @@
+#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt.
+[GROUP]TRACE_DUMP=0x89
+[GROUP]TRACE_FLOW=0x8a
+[GROUP]TRACE_NORMAL=0x86
+[TRACE]TRACE_DUMP[0x89]_CMSMMSESSION_SERVICEERROR=0x1
+[TRACE]TRACE_DUMP[0x89]_CMSMMSESSION_SERVICEERROR_DUP1=0x2
+[TRACE]TRACE_DUMP[0x89]_CMSMMSESSION_SERVICEERROR_DUP2=0x3
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_CDEVICEEVENTHANDLER_DES_ENTRY=0xd
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_CDEVICEEVENTHANDLER_DES_EXIT=0xe
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_CDEVICEEVENTHANDLER_ENTRY=0x28
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_CDEVICEEVENTHANDLER_EXIT=0x29
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_COMPLETECLIENT_ENTRY=0x38
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_COMPLETECLIENT_EXIT=0x39
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_COMPLETE_ENTRY=0x1c
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_COMPLETE_EXIT=0x1d
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_CONSTRUCTL_ENTRY=0x2a
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_CONSTRUCTL_EXIT=0x2b
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_CREATESUBCMDFORADDINGUSBMSFUNCTIONL_ENTRY=0x2e
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_CREATESUBCMDFORADDINGUSBMSFUNCTIONL_EXIT=0x2f
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_CREATESUBCMDFORDEVICEEVENTL_ENTRY=0x2c
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_CREATESUBCMDFORDEVICEEVENTL_EXIT=0x2d
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_CREATESUBCMDFORMOUNTINGLOGICALUNITL_ENTRY=0x15
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_CREATESUBCMDFORMOUNTINGLOGICALUNITL_EXIT=0x16
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_CREATESUBCMDFORREMOVINGUSBMSDEVICEL_ENTRY=0x30
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_CREATESUBCMDFORREMOVINGUSBMSDEVICEL_EXIT=0x31
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_CREATESUBCMDFORRETRIEVEDRIVELETTERL_ENTRY=0x13
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_CREATESUBCMDFORRETRIEVEDRIVELETTERL_EXIT=0x14
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_CREATESUBCMDFORSAVELATESTMOUNTINFOL_ENTRY=0x17
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_CREATESUBCMDFORSAVELATESTMOUNTINFOL_EXIT=0x18
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_DOCANCEL_ENTRY=0x21
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_DOCANCEL_EXIT=0x22
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_HANDLEEVENTL_ENTRY=0x1f
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_HANDLEEVENTL_EXIT=0x20
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_NEWLC_ENTRY=0x11
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_NEWLC_EXIT=0x12
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_NEWL_ENTRY=0xf
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_NEWL_EXIT=0x10
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_RESETHANDLERDATA_ENTRY=0x34
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_RESETHANDLERDATA_EXIT=0x35
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_RESETHANDLERERROR_ENTRY=0x36
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_RESETHANDLERERROR_EXIT=0x37
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_RESETHANDLER_ENTRY=0x32
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_RESETHANDLER_EXIT=0x33
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_RUNERROR_ENTRY=0x26
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_RUNERROR_EXIT=0x27
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_RUNL_ENTRY=0x23
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_RUNL_EXIT=0x24
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_RUNL_EXIT_DUP1=0x25
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_START_ENTRY=0x19
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_START_EXIT=0x1a
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_START_EXIT_DUP1=0x1b
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTHANDLER_STATUS_ENTRY=0x1e
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTQUEUE_APPENDANDOPTIMIZEL_ENTRY=0x4c
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTQUEUE_APPENDANDOPTIMIZEL_EXIT=0x4d
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTQUEUE_APPENDANDOPTIMIZEL_EXIT_DUP1=0x4e
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTQUEUE_CDEVICEEVENTQUEUE_CONS_ENTRY=0x48
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTQUEUE_CDEVICEEVENTQUEUE_CONS_EXIT=0x49
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTQUEUE_CDEVICEEVENTQUEUE_DES_ENTRY=0x3a
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTQUEUE_CDEVICEEVENTQUEUE_DES_EXIT=0x3b
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTQUEUE_CONSTRUCTL_ENTRY=0x4a
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTQUEUE_CONSTRUCTL_EXIT=0x4b
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTQUEUE_DOCANCEL_ENTRY=0x42
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTQUEUE_DOCANCEL_EXIT=0x43
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTQUEUE_NEWLC_ENTRY=0x3e
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTQUEUE_NEWLC_EXIT=0x3f
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTQUEUE_NEWL_ENTRY=0x3c
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTQUEUE_NEWL_EXIT=0x3d
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTQUEUE_POP_ENTRY=0x54
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTQUEUE_POP_EXIT=0x55
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTQUEUE_PUSHL_ENTRY=0x40
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTQUEUE_PUSHL_EXIT=0x41
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTQUEUE_RUNERROR_ENTRY=0x46
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTQUEUE_RUNERROR_EXIT=0x47
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTQUEUE_RUNL_ENTRY=0x44
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTQUEUE_RUNL_EXIT=0x45
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTQUEUE_SENDEVENTL_ENTRY=0x52
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTQUEUE_SENDEVENTL_EXIT=0x53
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTQUEUE_STARTL_ENTRY=0x4f
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTQUEUE_STARTL_EXIT=0x50
+[TRACE]TRACE_FLOW[0x8A]_CDEVICEEVENTQUEUE_STARTL_EXIT_DUP1=0x51
+[TRACE]TRACE_FLOW[0x8A]_CDISMOUNTTIMER_CANCELTIMER_ENTRY=0x104
+[TRACE]TRACE_FLOW[0x8A]_CDISMOUNTTIMER_CANCELTIMER_EXIT=0x105
+[TRACE]TRACE_FLOW[0x8A]_CDISMOUNTTIMER_CDISMOUNTTIMER_CONS_ENTRY=0xfd
+[TRACE]TRACE_FLOW[0x8A]_CDISMOUNTTIMER_CDISMOUNTTIMER_DES_ENTRY=0xfe
+[TRACE]TRACE_FLOW[0x8A]_CDISMOUNTTIMER_CDISMOUNTTIMER_DES_EXIT=0xff
+[TRACE]TRACE_FLOW[0x8A]_CDISMOUNTTIMER_CONSTRUCTL_ENTRY=0x100
+[TRACE]TRACE_FLOW[0x8A]_CDISMOUNTTIMER_CONSTRUCTL_EXIT=0x101
+[TRACE]TRACE_FLOW[0x8A]_CDISMOUNTTIMER_NEWLC_ENTRY=0xfb
+[TRACE]TRACE_FLOW[0x8A]_CDISMOUNTTIMER_NEWLC_EXIT=0xfc
+[TRACE]TRACE_FLOW[0x8A]_CDISMOUNTTIMER_NEWL_ENTRY=0xf9
+[TRACE]TRACE_FLOW[0x8A]_CDISMOUNTTIMER_NEWL_EXIT=0xfa
+[TRACE]TRACE_FLOW[0x8A]_CDISMOUNTTIMER_RUNL_ENTRY=0x102
+[TRACE]TRACE_FLOW[0x8A]_CDISMOUNTTIMER_RUNL_EXIT=0x103
+[TRACE]TRACE_FLOW[0x8A]_CDISMOUNTTIMER_STARTTIMER_ENTRY=0x106
+[TRACE]TRACE_FLOW[0x8A]_CDISMOUNTTIMER_STARTTIMER_EXIT=0x107
+[TRACE]TRACE_FLOW[0x8A]_CMSMMDISMOUNTUSBDRIVES_CMSMMDISMOUNTUSBDRIVES_DES_ENTRY=0xe4
+[TRACE]TRACE_FLOW[0x8A]_CMSMMDISMOUNTUSBDRIVES_CMSMMDISMOUNTUSBDRIVES_DES_EXIT=0xe5
+[TRACE]TRACE_FLOW[0x8A]_CMSMMDISMOUNTUSBDRIVES_CMSMMDISMOUNTUSBDRIVES_ENTRY=0xee
+[TRACE]TRACE_FLOW[0x8A]_CMSMMDISMOUNTUSBDRIVES_CMSMMDISMOUNTUSBDRIVES_EXIT=0xef
+[TRACE]TRACE_FLOW[0x8A]_CMSMMDISMOUNTUSBDRIVES_CONSTRUCTL_ENTRY=0xf0
+[TRACE]TRACE_FLOW[0x8A]_CMSMMDISMOUNTUSBDRIVES_CONSTRUCTL_EXIT=0xf1
+[TRACE]TRACE_FLOW[0x8A]_CMSMMDISMOUNTUSBDRIVES_DISMOUNTUSBDRIVES_ENTRY=0xf2
+[TRACE]TRACE_FLOW[0x8A]_CMSMMDISMOUNTUSBDRIVES_DISMOUNTUSBDRIVES_EXIT=0xf3
+[TRACE]TRACE_FLOW[0x8A]_CMSMMDISMOUNTUSBDRIVES_DOCANCEL_ENTRY=0xec
+[TRACE]TRACE_FLOW[0x8A]_CMSMMDISMOUNTUSBDRIVES_DOCANCEL_EXIT=0xed
+[TRACE]TRACE_FLOW[0x8A]_CMSMMDISMOUNTUSBDRIVES_DODISMOUNT_ENTRY=0xf4
+[TRACE]TRACE_FLOW[0x8A]_CMSMMDISMOUNTUSBDRIVES_DODISMOUNT_EXIT=0xf5
+[TRACE]TRACE_FLOW[0x8A]_CMSMMDISMOUNTUSBDRIVES_DODISMOUNT_EXIT_DUP1=0xf6
+[TRACE]TRACE_FLOW[0x8A]_CMSMMDISMOUNTUSBDRIVES_NEWLC_ENTRY=0xe8
+[TRACE]TRACE_FLOW[0x8A]_CMSMMDISMOUNTUSBDRIVES_NEWLC_EXIT=0xe9
+[TRACE]TRACE_FLOW[0x8A]_CMSMMDISMOUNTUSBDRIVES_NEWL_ENTRY=0xe6
+[TRACE]TRACE_FLOW[0x8A]_CMSMMDISMOUNTUSBDRIVES_NEWL_EXIT=0xe7
+[TRACE]TRACE_FLOW[0x8A]_CMSMMDISMOUNTUSBDRIVES_RUNL_ENTRY=0xea
+[TRACE]TRACE_FLOW[0x8A]_CMSMMDISMOUNTUSBDRIVES_RUNL_EXIT=0xeb
+[TRACE]TRACE_FLOW[0x8A]_CMSMMDISMOUNTUSBDRIVES_TIMEREXPIRED_ENTRY=0xf7
+[TRACE]TRACE_FLOW[0x8A]_CMSMMDISMOUNTUSBDRIVES_TIMEREXPIRED_EXIT=0xf8
+[TRACE]TRACE_FLOW[0x8A]_CMSMMENGINE_ADDUSBMSDEVICEL_ENTRY=0x5c
+[TRACE]TRACE_FLOW[0x8A]_CMSMMENGINE_ADDUSBMSDEVICEL_EXIT=0x5d
+[TRACE]TRACE_FLOW[0x8A]_CMSMMENGINE_ADDUSBMSINTERFACEL_ENTRY=0x5e
+[TRACE]TRACE_FLOW[0x8A]_CMSMMENGINE_ADDUSBMSINTERFACEL_EXIT=0x5f
+[TRACE]TRACE_FLOW[0x8A]_CMSMMENGINE_ADDUSBMSINTERFACENODEL_ENTRY=0x69
+[TRACE]TRACE_FLOW[0x8A]_CMSMMENGINE_ADDUSBMSINTERFACENODEL_EXIT=0x6a
+[TRACE]TRACE_FLOW[0x8A]_CMSMMENGINE_ADDUSBMSLOGICALUNITL_ENTRY=0x60
+[TRACE]TRACE_FLOW[0x8A]_CMSMMENGINE_ADDUSBMSLOGICALUNITL_EXIT=0x61
+[TRACE]TRACE_FLOW[0x8A]_CMSMMENGINE_ADDUSBMSLOGICALUNITNODEL_ENTRY=0x6b
+[TRACE]TRACE_FLOW[0x8A]_CMSMMENGINE_ADDUSBMSLOGICALUNITNODEL_EXIT=0x6c
+[TRACE]TRACE_FLOW[0x8A]_CMSMMENGINE_CMSMMENGINE_CONS_ENTRY=0x66
+[TRACE]TRACE_FLOW[0x8A]_CMSMMENGINE_CMSMMENGINE_DES_ENTRY=0x56
+[TRACE]TRACE_FLOW[0x8A]_CMSMMENGINE_CMSMMENGINE_DES_EXIT=0x57
+[TRACE]TRACE_FLOW[0x8A]_CMSMMENGINE_CONSTRUCTL_ENTRY=0x67
+[TRACE]TRACE_FLOW[0x8A]_CMSMMENGINE_CONSTRUCTL_EXIT=0x68
+[TRACE]TRACE_FLOW[0x8A]_CMSMMENGINE_NEWLC_ENTRY=0x5a
+[TRACE]TRACE_FLOW[0x8A]_CMSMMENGINE_NEWLC_EXIT=0x5b
+[TRACE]TRACE_FLOW[0x8A]_CMSMMENGINE_NEWL_ENTRY=0x58
+[TRACE]TRACE_FLOW[0x8A]_CMSMMENGINE_NEWL_EXIT=0x59
+[TRACE]TRACE_FLOW[0x8A]_CMSMMENGINE_REMOVEUSBMSNODE_ENTRY=0x62
+[TRACE]TRACE_FLOW[0x8A]_CMSMMENGINE_REMOVEUSBMSNODE_EXIT=0x63
+[TRACE]TRACE_FLOW[0x8A]_CMSMMENGINE_SEARCHDEVICE_ENTRY=0x64
+[TRACE]TRACE_FLOW[0x8A]_CMSMMENGINE_SEARCHINTERFACE_ENTRY=0x65
+[TRACE]TRACE_FLOW[0x8A]_CMSMMSERVER_ADDSESSION_ENTRY=0x84
+[TRACE]TRACE_FLOW[0x8A]_CMSMMSERVER_ADDSESSION_EXIT=0x85
+[TRACE]TRACE_FLOW[0x8A]_CMSMMSERVER_CMSMMSERVER_CONS_ENTRY=0x8a
+[TRACE]TRACE_FLOW[0x8A]_CMSMMSERVER_CMSMMSERVER_DES_ENTRY=0x80
+[TRACE]TRACE_FLOW[0x8A]_CMSMMSERVER_CMSMMSERVER_DES_EXIT=0x81
+[TRACE]TRACE_FLOW[0x8A]_CMSMMSERVER_CONSTRUCTL_ENTRY=0x8b
+[TRACE]TRACE_FLOW[0x8A]_CMSMMSERVER_CONSTRUCTL_EXIT=0x8c
+[TRACE]TRACE_FLOW[0x8A]_CMSMMSERVER_DISMOUNTUSBDRIVERSL_ENTRY=0x88
+[TRACE]TRACE_FLOW[0x8A]_CMSMMSERVER_DISMOUNTUSBDRIVERSL_EXIT=0x89
+[TRACE]TRACE_FLOW[0x8A]_CMSMMSERVER_NEWLC_ENTRY=0x7e
+[TRACE]TRACE_FLOW[0x8A]_CMSMMSERVER_NEWLC_EXIT=0x7f
+[TRACE]TRACE_FLOW[0x8A]_CMSMMSERVER_NEWSESSIONL_ENTRY=0x82
+[TRACE]TRACE_FLOW[0x8A]_CMSMMSERVER_REMOVESESSION_ENTRY=0x86
+[TRACE]TRACE_FLOW[0x8A]_CMSMMSERVER_REMOVESESSION_EXIT=0x87
+[TRACE]TRACE_FLOW[0x8A]_CMSMMSERVER_SESSIONNUMBER_ENTRY=0x83
+[TRACE]TRACE_FLOW[0x8A]_CMSMMSERVER_THREADFUNCTIONL_ENTRY=0x7c
+[TRACE]TRACE_FLOW[0x8A]_CMSMMSERVER_THREADFUNCTIONL_EXIT=0x7d
+[TRACE]TRACE_FLOW[0x8A]_CMSMMSESSION_ADDUSBMSINTERFACEL_ENTRY=0x99
+[TRACE]TRACE_FLOW[0x8A]_CMSMMSESSION_ADDUSBMSINTERFACEL_EXIT=0x9a
+[TRACE]TRACE_FLOW[0x8A]_CMSMMSESSION_CMSMMSESSION_CONS_ENTRY=0x108
+[TRACE]TRACE_FLOW[0x8A]_CMSMMSESSION_CMSMMSESSION_CONS_EXIT=0x109
+[TRACE]TRACE_FLOW[0x8A]_CMSMMSESSION_CMSMMSESSION_DES_ENTRY=0x8d
+[TRACE]TRACE_FLOW[0x8A]_CMSMMSESSION_CMSMMSESSION_DES_EXIT=0x8e
+[TRACE]TRACE_FLOW[0x8A]_CMSMMSESSION_CONSTRUCTL_ENTRY=0x97
+[TRACE]TRACE_FLOW[0x8A]_CMSMMSESSION_CONSTRUCTL_EXIT=0x98
+[TRACE]TRACE_FLOW[0x8A]_CMSMMSESSION_NEWL_ENTRY=0x8f
+[TRACE]TRACE_FLOW[0x8A]_CMSMMSESSION_NEWL_EXIT=0x90
+[TRACE]TRACE_FLOW[0x8A]_CMSMMSESSION_REMOVEUSBMSDEVICEL_ENTRY=0x9b
+[TRACE]TRACE_FLOW[0x8A]_CMSMMSESSION_REMOVEUSBMSDEVICEL_EXIT=0x9c
+[TRACE]TRACE_FLOW[0x8A]_CMSMMSESSION_SERVICEERROR_ENTRY=0x93
+[TRACE]TRACE_FLOW[0x8A]_CMSMMSESSION_SERVICEERROR_EXIT=0x94
+[TRACE]TRACE_FLOW[0x8A]_CMSMMSESSION_SERVICEL_ENTRY=0x91
+[TRACE]TRACE_FLOW[0x8A]_CMSMMSESSION_SERVICEL_EXIT=0x92
+[TRACE]TRACE_FLOW[0x8A]_CMSMMTERMINATOR_CMSMMTERMINATOR_CONS_ENTRY=0xa3
+[TRACE]TRACE_FLOW[0x8A]_CMSMMTERMINATOR_CMSMMTERMINATOR_CONS_EXIT=0xa4
+[TRACE]TRACE_FLOW[0x8A]_CMSMMTERMINATOR_CONSTRUCTL_ENTRY=0xa5
+[TRACE]TRACE_FLOW[0x8A]_CMSMMTERMINATOR_CONSTRUCTL_EXIT=0xa6
+[TRACE]TRACE_FLOW[0x8A]_CMSMMTERMINATOR_NEWL_ENTRY=0x9d
+[TRACE]TRACE_FLOW[0x8A]_CMSMMTERMINATOR_NEWL_EXIT=0x9e
+[TRACE]TRACE_FLOW[0x8A]_CMSMMTERMINATOR_RUNL_ENTRY=0xa1
+[TRACE]TRACE_FLOW[0x8A]_CMSMMTERMINATOR_RUNL_EXIT=0xa2
+[TRACE]TRACE_FLOW[0x8A]_CMSMMTERMINATOR_START_ENTRY=0x9f
+[TRACE]TRACE_FLOW[0x8A]_CMSMMTERMINATOR_START_EXIT=0xa0
+[TRACE]TRACE_FLOW[0x8A]_RSUBCOMMANDQUEUE_EXECUTEHEADL_ENTRY=0x8
+[TRACE]TRACE_FLOW[0x8A]_RSUBCOMMANDQUEUE_EXECUTEHEADL_EXIT=0x9
+[TRACE]TRACE_FLOW[0x8A]_RSUBCOMMANDQUEUE_HEAD_ENTRY=0xa
+[TRACE]TRACE_FLOW[0x8A]_RSUBCOMMANDQUEUE_INSERTAFTERHEADL_ENTRY=0x6
+[TRACE]TRACE_FLOW[0x8A]_RSUBCOMMANDQUEUE_INSERTAFTERHEADL_EXIT=0x7
+[TRACE]TRACE_FLOW[0x8A]_RSUBCOMMANDQUEUE_POP_ENTRY=0x3
+[TRACE]TRACE_FLOW[0x8A]_RSUBCOMMANDQUEUE_POP_EXIT=0x4
+[TRACE]TRACE_FLOW[0x8A]_RSUBCOMMANDQUEUE_POP_EXIT_DUP1=0x5
+[TRACE]TRACE_FLOW[0x8A]_RSUBCOMMANDQUEUE_PUSHL_ENTRY=0x1
+[TRACE]TRACE_FLOW[0x8A]_RSUBCOMMANDQUEUE_PUSHL_EXIT=0x2
+[TRACE]TRACE_FLOW[0x8A]_RSUBCOMMANDQUEUE_RELEASE_ENTRY=0xb
+[TRACE]TRACE_FLOW[0x8A]_RSUBCOMMANDQUEUE_RELEASE_EXIT=0xc
+[TRACE]TRACE_FLOW[0x8A]_TDEREGISTERINTERFACE_DOEXECUTEL_ENTRY=0xd6
+[TRACE]TRACE_FLOW[0x8A]_TDEREGISTERINTERFACE_DOEXECUTEL_EXIT=0xd7
+[TRACE]TRACE_FLOW[0x8A]_TDEREGISTERINTERFACE_HANDLEERROR_ENTRY=0xd8
+[TRACE]TRACE_FLOW[0x8A]_TDEREGISTERINTERFACE_HANDLEERROR_EXIT=0xd9
+[TRACE]TRACE_FLOW[0x8A]_TDEREGISTERINTERFACE_TDEREGISTERINTERFACE_CONS_ENTRY=0xd5
+[TRACE]TRACE_FLOW[0x8A]_TDISMOUNTLOGICALUNIT_DOEXECUTEL_ENTRY=0xdb
+[TRACE]TRACE_FLOW[0x8A]_TDISMOUNTLOGICALUNIT_DOEXECUTEL_EXIT=0xdc
+[TRACE]TRACE_FLOW[0x8A]_TDISMOUNTLOGICALUNIT_HANDLEERROR_ENTRY=0xdd
+[TRACE]TRACE_FLOW[0x8A]_TDISMOUNTLOGICALUNIT_HANDLEERROR_EXIT=0xde
+[TRACE]TRACE_FLOW[0x8A]_TDISMOUNTLOGICALUNIT_TDISMOUNTLOGICALUNIT_CONS_ENTRY=0xda
+[TRACE]TRACE_FLOW[0x8A]_THOSTMSSUBCOMMANDPARAM_THOSTMSSUBCOMMANDPARAM_CONS_ENTRY=0xa7
+[TRACE]TRACE_FLOW[0x8A]_TMOUNTLOGICALUNIT_DOASYNCCMDCOMPLETEL_ENTRY=0xc9
+[TRACE]TRACE_FLOW[0x8A]_TMOUNTLOGICALUNIT_DOASYNCCMDCOMPLETEL_EXIT=0xca
+[TRACE]TRACE_FLOW[0x8A]_TMOUNTLOGICALUNIT_DOEXECUTEL_ENTRY=0xc5
+[TRACE]TRACE_FLOW[0x8A]_TMOUNTLOGICALUNIT_DOEXECUTEL_EXIT=0xc6
+[TRACE]TRACE_FLOW[0x8A]_TMOUNTLOGICALUNIT_HANDLEERROR_ENTRY=0xc7
+[TRACE]TRACE_FLOW[0x8A]_TMOUNTLOGICALUNIT_HANDLEERROR_EXIT=0xc8
+[TRACE]TRACE_FLOW[0x8A]_TMOUNTLOGICALUNIT_TMOUNTLOGICALUNIT_CONS_ENTRY=0xc3
+[TRACE]TRACE_FLOW[0x8A]_TMOUNTLOGICALUNIT_TMOUNTLOGICALUNIT_CONS_EXIT=0xc4
+[TRACE]TRACE_FLOW[0x8A]_TMSMMNODEBASE_ADDCHILD_ENTRY=0x73
+[TRACE]TRACE_FLOW[0x8A]_TMSMMNODEBASE_ADDCHILD_EXIT=0x74
+[TRACE]TRACE_FLOW[0x8A]_TMSMMNODEBASE_DESTROYNODE_ENTRY=0x70
+[TRACE]TRACE_FLOW[0x8A]_TMSMMNODEBASE_DESTROYNODE_EXIT=0x71
+[TRACE]TRACE_FLOW[0x8A]_TMSMMNODEBASE_DESTROYNODE_EXIT_DUP1=0x72
+[TRACE]TRACE_FLOW[0x8A]_TMSMMNODEBASE_SEARCHINCHILDREN_ENTRY=0x75
+[TRACE]TRACE_FLOW[0x8A]_TMSMMNODEBASE_SEARCHINCHILDREN_EXIT=0x76
+[TRACE]TRACE_FLOW[0x8A]_TMSMMNODEBASE_TMSMMNODEBASE_CONS_ENTRY=0x6d
+[TRACE]TRACE_FLOW[0x8A]_TMSMMNODEBASE_TMSMMNODEBASE_DES_ENTRY=0x6e
+[TRACE]TRACE_FLOW[0x8A]_TMSMMNODEBASE_TMSMMNODEBASE_DES_EXIT=0x6f
+[TRACE]TRACE_FLOW[0x8A]_TREGISTERINTERFACE_DOASYNCCMDCOMPLETEL_ENTRY=0xb6
+[TRACE]TRACE_FLOW[0x8A]_TREGISTERINTERFACE_DOASYNCCMDCOMPLETEL_EXIT=0xb7
+[TRACE]TRACE_FLOW[0x8A]_TREGISTERINTERFACE_DOCANCELASYNCCMD_ENTRY=0xb8
+[TRACE]TRACE_FLOW[0x8A]_TREGISTERINTERFACE_DOCANCELASYNCCMD_EXIT=0xb9
+[TRACE]TRACE_FLOW[0x8A]_TREGISTERINTERFACE_DOEXECUTEL_ENTRY=0xb2
+[TRACE]TRACE_FLOW[0x8A]_TREGISTERINTERFACE_DOEXECUTEL_EXIT=0xb3
+[TRACE]TRACE_FLOW[0x8A]_TREGISTERINTERFACE_HANDLEERROR_ENTRY=0xb4
+[TRACE]TRACE_FLOW[0x8A]_TREGISTERINTERFACE_HANDLEERROR_EXIT=0xb5
+[TRACE]TRACE_FLOW[0x8A]_TREGISTERINTERFACE_TREGISTERINTERFACE_CONS_ENTRY=0xb1
+[TRACE]TRACE_FLOW[0x8A]_TREMOVEUSBMSDEVICENODE_DOEXECUTEL_ENTRY=0xe0
+[TRACE]TRACE_FLOW[0x8A]_TREMOVEUSBMSDEVICENODE_DOEXECUTEL_EXIT=0xe1
+[TRACE]TRACE_FLOW[0x8A]_TREMOVEUSBMSDEVICENODE_HANDLEERROR_ENTRY=0xe2
+[TRACE]TRACE_FLOW[0x8A]_TREMOVEUSBMSDEVICENODE_HANDLEERROR_EXIT=0xe3
+[TRACE]TRACE_FLOW[0x8A]_TREMOVEUSBMSDEVICENODE_TREMOVEUSBMSDEVICENODE_CONS_ENTRY=0xdf
+[TRACE]TRACE_FLOW[0x8A]_TRETRIEVEDRIVELETTER_DOASYNCCMDCOMPLETEL_ENTRY=0xbf
+[TRACE]TRACE_FLOW[0x8A]_TRETRIEVEDRIVELETTER_DOASYNCCMDCOMPLETEL_EXIT=0xc0
+[TRACE]TRACE_FLOW[0x8A]_TRETRIEVEDRIVELETTER_DOCANCELASYNCCMD_ENTRY=0xc1
+[TRACE]TRACE_FLOW[0x8A]_TRETRIEVEDRIVELETTER_DOCANCELASYNCCMD_EXIT=0xc2
+[TRACE]TRACE_FLOW[0x8A]_TRETRIEVEDRIVELETTER_DOEXECUTEL_ENTRY=0xbb
+[TRACE]TRACE_FLOW[0x8A]_TRETRIEVEDRIVELETTER_DOEXECUTEL_EXIT=0xbc
+[TRACE]TRACE_FLOW[0x8A]_TRETRIEVEDRIVELETTER_HANDLEERROR_ENTRY=0xbd
+[TRACE]TRACE_FLOW[0x8A]_TRETRIEVEDRIVELETTER_HANDLEERROR_EXIT=0xbe
+[TRACE]TRACE_FLOW[0x8A]_TRETRIEVEDRIVELETTER_TRETRIEVEDRIVELETTER_CONS_ENTRY=0xba
+[TRACE]TRACE_FLOW[0x8A]_TSAVELATESTMOUNTINFO_DOASYNCCMDCOMPLETEL_ENTRY=0xcf
+[TRACE]TRACE_FLOW[0x8A]_TSAVELATESTMOUNTINFO_DOASYNCCMDCOMPLETEL_EXIT=0xd0
+[TRACE]TRACE_FLOW[0x8A]_TSAVELATESTMOUNTINFO_DOCANCELASYNCCMD_ENTRY=0xd3
+[TRACE]TRACE_FLOW[0x8A]_TSAVELATESTMOUNTINFO_DOCANCELASYNCCMD_EXIT=0xd4
+[TRACE]TRACE_FLOW[0x8A]_TSAVELATESTMOUNTINFO_DOEXECUTEL_ENTRY=0xcd
+[TRACE]TRACE_FLOW[0x8A]_TSAVELATESTMOUNTINFO_DOEXECUTEL_EXIT=0xce
+[TRACE]TRACE_FLOW[0x8A]_TSAVELATESTMOUNTINFO_HANDLEERROR_ENTRY=0xd1
+[TRACE]TRACE_FLOW[0x8A]_TSAVELATESTMOUNTINFO_HANDLEERROR_EXIT=0xd2
+[TRACE]TRACE_FLOW[0x8A]_TSAVELATESTMOUNTINFO_TSAVELATESTMOUNTINFO_CONS_ENTRY=0xcb
+[TRACE]TRACE_FLOW[0x8A]_TSAVELATESTMOUNTINFO_TSAVELATESTMOUNTINFO_CONS_EXIT=0xcc
+[TRACE]TRACE_FLOW[0x8A]_TSUBCOMMANDBASE_ASYNCCMDCOMPLETEL_ENTRY=0xa9
+[TRACE]TRACE_FLOW[0x8A]_TSUBCOMMANDBASE_ASYNCCMDCOMPLETEL_EXIT=0xaa
+[TRACE]TRACE_FLOW[0x8A]_TSUBCOMMANDBASE_CANCELASYNCCMD_ENTRY=0xab
+[TRACE]TRACE_FLOW[0x8A]_TSUBCOMMANDBASE_CANCELASYNCCMD_EXIT=0xac
+[TRACE]TRACE_FLOW[0x8A]_TSUBCOMMANDBASE_DOASYNCCMDCOMPLETEL_ENTRY=0xad
+[TRACE]TRACE_FLOW[0x8A]_TSUBCOMMANDBASE_DOASYNCCMDCOMPLETEL_EXIT=0xae
+[TRACE]TRACE_FLOW[0x8A]_TSUBCOMMANDBASE_DOCANCELASYNCCMD_ENTRY=0xaf
+[TRACE]TRACE_FLOW[0x8A]_TSUBCOMMANDBASE_DOCANCELASYNCCMD_EXIT=0xb0
+[TRACE]TRACE_FLOW[0x8A]_TSUBCOMMANDBASE_TSUBCOMMANDBASE_CONS_ENTRY=0xa8
+[TRACE]TRACE_FLOW[0x8A]_TUSBMSDEVICE_TUSBMSDEVICE_CONS_ENTRY=0x77
+[TRACE]TRACE_FLOW[0x8A]_TUSBMSINTERFACE_TUSBMSINTERFACE_CONS_ENTRY=0x78
+[TRACE]TRACE_FLOW[0x8A]_TUSBMSINTERFACE_TUSBMSINTERFACE_DES_ENTRY=0x79
+[TRACE]TRACE_FLOW[0x8A]_TUSBMSINTERFACE_TUSBMSINTERFACE_DES_EXIT=0x7a
+[TRACE]TRACE_FLOW[0x8A]_TUSBMSLOGICALUNIT_TUSBMSLOGICALUNIT_CONS_ENTRY=0x7b
+[TRACE]TRACE_NORMAL[0x86]_CMSMMDISMOUNTUSBDRIVES_DODISMOUNT=0x8
+[TRACE]TRACE_NORMAL[0x86]_TREGISTERINTERFACE_DOASYNCCMDCOMPLETEL=0x7
+[TRACE]TRACE_NORMAL[0x86]_TREGISTERINTERFACE_DOEXECUTEL=0x1
+[TRACE]TRACE_NORMAL[0x86]_TREGISTERINTERFACE_DOEXECUTEL_DUP1=0x2
+[TRACE]TRACE_NORMAL[0x86]_TREGISTERINTERFACE_DOEXECUTEL_DUP2=0x3
+[TRACE]TRACE_NORMAL[0x86]_TREGISTERINTERFACE_DOEXECUTEL_DUP3=0x4
+[TRACE]TRACE_NORMAL[0x86]_TREGISTERINTERFACE_DOEXECUTEL_DUP4=0x5
+[TRACE]TRACE_NORMAL[0x86]_TREGISTERINTERFACE_DOEXECUTEL_DUP5=0x6
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CMSMMSESSION_CMSMMSESSION_ENTRY=0x95
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CMSMMSESSION_CMSMMSESSION_EXIT=0x96
--- a/usbmgmt/usbmgr/inifile/src/inifile.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/inifile/src/inifile.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-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,11 +21,11 @@
 */
 
 #include <f32file.h>
+#include <usb/usblogger.h>
 #include "inifile.h"
-#include <usb/usblogger.h>
-
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "IniFile");
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "inifileTraces.h"
 #endif
 
 
@@ -34,14 +34,15 @@
 
 void CIniFile::Panic(TIniPanic aPanic)
 	{
-	_LIT(KIniData,"CIniFile");
-	_USB_PANIC(KIniData,aPanic);
+	_LIT(KIniData,"CIniFile");	
+	OstTrace1( TRACE_NORMAL, CINIFILE_PANIC, "CIniFile::Panic;aPanic=%d", aPanic );
+	User::Panic(KIniData,aPanic );
 	}
 
 CIniFile::CIniFile() 
  :	iPtr(NULL,0)
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry1( CINIFILE_CINIFILE_CONS_ENTRY, this );
 	}
 
 CIniFile::~CIniFile()
@@ -58,12 +59,13 @@
  * @param aName The name of the ini file to be used, e.g. "GPRSBTT.INI".
  */
 	{
-	LOG_STATIC_FUNC_ENTRY
+    OstTraceFunctionEntry0( CINIFILE_NEWL_TDESC_ENTRY );
 
 	CIniFile* self = new(ELeave) CIniFile;
 	CleanupStack::PushL(self);
 	self->ConstructL(aName, KDefaultIniFileDir);
 	CleanupStack::Pop(self);
+	OstTraceFunctionExit0( CINIFILE_NEWL_TDESC_EXIT );
 	return self;
 	}
 
@@ -76,12 +78,13 @@
  * @param aPath The location of the file e.g. "\\system\\data\\".
  */
  {
-	LOG_STATIC_FUNC_ENTRY
+    OstTraceFunctionEntry0( CINIFILE_NEWL_TDESC_TDESC_ENTRY );
 
  	CIniFile* self = new(ELeave) CIniFile;
 	CleanupStack::PushL(self);
 	self->ConstructL(aName, aPath);
 	CleanupStack::Pop(self);
+	OstTraceFunctionExit0( CINIFILE_NEWL_TDESC_TDESC_EXIT );
 	return self;	 	
  }
  
@@ -95,27 +98,53 @@
     iToken = HBufC::NewL(KTokenSize+2);	// 2 extra chars for []
 
 	RFs fs;
-	LEAVEIFERRORL(fs.Connect());
+	TInt err;
+	err = fs.Connect();	
+	if(err < 0)
+	    {
+        OstTrace1( TRACE_NORMAL, CINIFILE_CONSTRUCTL, "CIniFile::ConstructL;fs.Connect() with error=%d", err );
+        User::Leave(err);
+	    }
 	CleanupClosePushL(fs);
 
 	TFindFile ff(fs);
 
-	LEAVEIFERRORL(ff.FindByDir(aName, aPath));
+	err = ff.FindByDir(aName, aPath);
+	if(err < 0)
+	    {
+        OstTrace1( TRACE_NORMAL, CINIFILE_CONSTRUCTL_DUP1, "CIniFile::ConstructL;ff.FindByDir(aName, aPath) with error=%d", err );
+        User::Leave(err);
+	    }
 
 	iName = ff.File().AllocL();
 	
 	RFile file;
 	TInt size;
-	LEAVEIFERRORL(file.Open(fs,*iName,EFileStreamText|EFileRead|EFileShareReadersOnly));
+	err = file.Open(fs,*iName,EFileStreamText|EFileRead|EFileShareReadersOnly);
+	if(err < 0)
+	    {
+        OstTrace1( TRACE_NORMAL, CINIFILE_CONSTRUCTL_DUP2, "CIniFile::ConstructL;file.Open(fs,*iName,EFileStreamText|EFileRead|EFileShareReadersOnly) with error=%d", err );
+        User::Leave(err);
+	    }
 	CleanupClosePushL(file);
 	
-	LEAVEIFERRORL(file.Size(size));
+	err = file.Size(size);
+	if(err < 0)
+	    {
+        OstTrace1( TRACE_NORMAL, CINIFILE_CONSTRUCTL_DUP3, "CIniFile::ConstructL;file.Size(size) with error=%d", err );
+        User::Leave(err);
+	    }
 
 
 	TText* data = REINTERPRET_CAST(TText*, User::AllocL(size));
 	iPtr.Set(data, size/sizeof(TText), size/sizeof(TText));
 	TPtr8 dest(REINTERPRET_CAST(TUint8*,data), 0, size);
-	LEAVEIFERRORL(file.Read(dest)); 
+	err = file.Read(dest);
+	if(err < 0)
+	    {
+        OstTrace1( TRACE_NORMAL, CINIFILE_CONSTRUCTL_DUP4, "CIniFile::ConstructL;file.Read(dest) with error=%d", err );
+        User::Leave(err);
+	    }
 
 	TUint8* ptr = REINTERPRET_CAST(TUint8*,data);
 
--- a/usbmgmt/usbmgr/logger/BWINS/usbloggerU.DEF	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-EXPORTS
-	??0TFunctionLogger@@QAE@ABVTDesC8@@0PAX@Z @ 1 NONAME ; TFunctionLogger::TFunctionLogger(class TDesC8 const &, class TDesC8 const &, void *)
-	??1TFunctionLogger@@QAE@XZ @ 2 NONAME ; TFunctionLogger::~TFunctionLogger(void)
-	?Close@CUsbLog@@SAXXZ @ 3 NONAME ; void CUsbLog::Close(void)
-	?Connect@CUsbLog@@SAHXZ @ 4 NONAME ; int CUsbLog::Connect(void)
-	?HexDump@CUsbLog@@SAXABVTDesC8@@PBG1PBEH@Z @ 5 NONAME ; void CUsbLog::HexDump(class TDesC8 const &, unsigned short const *, unsigned short const *, unsigned char const *, int)
-	?VerboseLeaveIfErrorL@@YAXABVTDesC8@@PADHH@Z @ 6 NONAME ; void VerboseLeaveIfErrorL(class TDesC8 const &, char *, int, int)
-	?VerbosePanic@@YAXABVTDesC8@@PADHHPAEABVTDesC16@@@Z @ 7 NONAME ; void VerbosePanic(class TDesC8 const &, char *, int, int, unsigned char *, class TDesC16 const &)
-	?Write@CUsbLog@@SAXABVTDesC8@@0@Z @ 8 NONAME ; void CUsbLog::Write(class TDesC8 const &, class TDesC8 const &)
-	?Write@CUsbLog@@SAXABVTDesC8@@ABVTDesC16@@@Z @ 9 NONAME ; void CUsbLog::Write(class TDesC8 const &, class TDesC16 const &)
-	?WriteFormat@CUsbLog@@SAXABVTDesC8@@V?$TRefByValue@$$CBVTDesC16@@@@AAY00PAC@Z @ 10 NONAME ; void CUsbLog::WriteFormat(class TDesC8 const &, class TRefByValue<class TDesC16 const >, signed char * [1] &)
-	?WriteFormat@CUsbLog@@SAXABVTDesC8@@V?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 11 NONAME ; void CUsbLog::WriteFormat(class TDesC8 const &, class TRefByValue<class TDesC16 const >, ...)
-	?WriteFormat@CUsbLog@@SAXABVTDesC8@@V?$TRefByValue@$$CBVTDesC8@@@@AAY00PAC@Z @ 12 NONAME ; void CUsbLog::WriteFormat(class TDesC8 const &, class TRefByValue<class TDesC8 const >, signed char * [1] &)
-	?WriteFormat@CUsbLog@@SAXABVTDesC8@@V?$TRefByValue@$$CBVTDesC8@@@@ZZ @ 13 NONAME ; void CUsbLog::WriteFormat(class TDesC8 const &, class TRefByValue<class TDesC8 const >, ...)
-	?VerboseLeaveL@@YAXABVTDesC8@@PADHH@Z @ 14 NONAME ; void VerboseLeaveL(class TDesC8 const &, char *, int, int)
-	?VerboseMsgPanic@@YAXABVTDesC8@@PADHABVRMessage2@@ABVTDesC16@@H@Z @ 15 NONAME ; void VerboseMsgPanic(class TDesC8 const &, char *, int, class RMessage2 const &, class TDesC16 const &, int)
-
--- a/usbmgmt/usbmgr/logger/EABI/usbloggerU.DEF	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-EXPORTS
-	_Z12VerbosePanicRK6TDesC8PciiPhRK7TDesC16 @ 1 NONAME
-	_Z20VerboseLeaveIfErrorLRK6TDesC8Pcii @ 2 NONAME
-	_ZN15TFunctionLoggerC1ERK6TDesC8S2_Pv @ 3 NONAME
-	_ZN15TFunctionLoggerC2ERK6TDesC8S2_Pv @ 4 NONAME
-	_ZN15TFunctionLoggerD1Ev @ 5 NONAME
-	_ZN15TFunctionLoggerD2Ev @ 6 NONAME
-	_ZN7CUsbLog11WriteFormatERK6TDesC811TRefByValueIK7TDesC16ERSt9__va_list @ 7 NONAME
-	_ZN7CUsbLog11WriteFormatERK6TDesC811TRefByValueIK7TDesC16Ez @ 8 NONAME
-	_ZN7CUsbLog11WriteFormatERK6TDesC811TRefByValueIS1_ERSt9__va_list @ 9 NONAME
-	_ZN7CUsbLog11WriteFormatERK6TDesC811TRefByValueIS1_Ez @ 10 NONAME
-	_ZN7CUsbLog5CloseEv @ 11 NONAME
-	_ZN7CUsbLog5WriteERK6TDesC8RK7TDesC16 @ 12 NONAME
-	_ZN7CUsbLog5WriteERK6TDesC8S2_ @ 13 NONAME
-	_ZN7CUsbLog7ConnectEv @ 14 NONAME
-	_ZN7CUsbLog7HexDumpERK6TDesC8PKtS4_PKhi @ 15 NONAME
-	_Z13VerboseLeaveLRK6TDesC8Pcii @ 16 NONAME
-	_Z15VerboseMsgPanicRK6TDesC8PciRK9RMessage2RK7TDesC16i @ 17 NONAME
-
--- a/usbmgmt/usbmgr/logger/group/BLD.INF	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/logger/group/BLD.INF	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2005-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,7 +21,5 @@
 
 PRJ_EXPORTS
 ../public/usblogger.h				SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(usb/usblogger.h)
-usblogger.mmh					/epoc32/include/usb/usblogger.mmh
 
-PRJ_MMPFILES
-usblogger.MMP
+
--- a/usbmgmt/usbmgr/logger/group/usblogger.MMP	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +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:
-* Logging engine for USB.
-*
-*/
-
-/**
- @file
-*/
-
-target usblogger.dll
-
-CAPABILITY All -Tcb
-TARGETTYPE	dll
-
-uid			0x1000008d 0x10281A7D
-
-// MACRO __USB_DEBUG_RDEBUG__
-// Define this macro to get output through the serial port (COM0) 
-
-SOURCEPATH 	../src
-SOURCE 		usblogger.cpp
-
-OS_LAYER_SYSTEMINCLUDE_SYMBIAN
-
-library			euser.lib
-
-VENDORID 0x70000001
-
-#include <comms-infras/commsdebugutility.mmh>
-
-UNPAGED
--- a/usbmgmt/usbmgr/logger/group/usblogger.mmh	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +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:
-* When checking this file into perforce, ensure that
-* LOGGING IS DISABLED FOR RELEASE BUILDS.
-* This file is not to be used outside Symbian.
-* It is largely a copy of commsdebugutility.mmh.
-* When the new logger comes in that provides the functionality we want 
-* (specifically, 'connected' logging using TLS), we can remove our own logger 
-* dll entirely, including this file. [We'll still possibly need a header with 
-* our nice function entry/exit, leave and panic macros though.]
-*
-*/
-
-// Uncomment next line to temporarily engage logging for release builds.
-//#define __FLOGGER_UREL
-// Comment next line to temporarily disengage logging for debug builds
-#define __FLOGGER_UDEB
-
-// Determine whether, and how, flogger is to be included
-#ifdef __FLOGGER_UREL
-	#ifdef __FLOGGER_UDEB
-	#define __FLOGGER_INCLUDED
-	MACRO __FLOG_UREL
-	#endif
-#endif
-#ifdef __FLOGGER_UREL
-	#ifndef __FLOGGER_UDEB
-	#define __FLOGGER_INCLUDED
-	MACRO __FLOG_UREL
-	MACRO __FLOG_NO_UDEB
-	#endif
-#endif
-#ifndef __FLOGGER_UREL
-	#ifndef __FLOGGER_UDEB
-	MACRO __FLOG_NO_UDEB
-	#endif
-#endif
-#ifndef __FLOGGER_UREL
-	#ifdef __FLOGGER_UDEB
-	#define __FLOGGER_INCLUDED
-	#define __FLOGGER_DEBUGGERLIBRARY
-	#endif
-#endif
-
-
-#ifdef __FLOGGER_INCLUDED
-	#ifndef __FLOGGER_SUPPRESS_LIBRARY
-		#ifdef __FLOGGER_DEBUGGERLIBRARY
-			DEBUGLIBRARY usblogger.lib
-		#else
-			LIBRARY usblogger.lib
-		#endif
-	#endif
-#endif
-
--- a/usbmgmt/usbmgr/logger/public/usblogger.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/logger/public/usblogger.h	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2005-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,163 +21,20 @@
 */
 
 
-#ifndef LOGGER_H
-#define LOGGER_H
+#ifndef USBLOGGER_H
+#define USBLOGGER_H
 
 #include <e32base.h>
 
-// Control function entry and exit logging using a compile-time switch.
-#define __LOG_FUNCTIONS__
-
-class TFunctionLogger;
-
-#ifndef __COMMSDEBUGUTILITY_H__		// comms-infras/commsdebugutility.h not included
-#ifdef _DEBUG						// If this is a debug build...
-// Set flogging active.
-#define __FLOG_ACTIVE
-#endif
-#endif
-
-#ifdef __FLOG_ACTIVE
-#define IF_FLOGGING(a) a
-#else
-#define IF_FLOGGING(a)
-#endif
-
-_LIT8(KDefaultLogFile, "USB");
-
-#ifdef __FLOG_ACTIVE
-#define LEAVEIFERRORL(a)				VerboseLeaveIfErrorL(KLogComponent, __FILE__, __LINE__, a)
-#define LEAVEL(a)						VerboseLeaveL(KLogComponent, __FILE__, __LINE__, a)
-#define _USB_PANIC(CAT, CODE) 			VerbosePanic(KLogComponent, __FILE__, __LINE__, CODE, (TText8*)#CODE, CAT)
-#define PANIC_MSG(msg, cat, code)		VerboseMsgPanic(KLogComponent, __FILE__, __LINE__, msg, cat, code);
-#define FLOG(a)							CUsbLog::Write(KDefaultLogFile, a);
-#define FTRACE(a)						{a;}
-#define LOGTEXT(text)						CUsbLog::Write(KLogComponent, text);
-#define LOGTEXT2(text, a)					CUsbLog::WriteFormat(KLogComponent, text, a);
-#define LOGTEXT3(text, a, b)				CUsbLog::WriteFormat(KLogComponent, text, a, b);
-#define LOGTEXT4(text, a, b, c)				CUsbLog::WriteFormat(KLogComponent, text, a, b, c);
-#define LOGTEXT5(text, a, b, c, d)			CUsbLog::WriteFormat(KLogComponent, text, a, b, c, d);
-#define LOGTEXT6(text, a, b, c, d, e)		CUsbLog::WriteFormat(KLogComponent, text, a, b, c, d, e);
-#define LOGTEXT7(text, a, b, c, d, e, f)	CUsbLog::WriteFormat(KLogComponent, text, a, b, c, d, e, f);
-#define LOGHEXDESC(desc)				CUsbLog::HexDump(KLogComponent, 0, 0, desc.Ptr() , desc.Length());
-#define LOGHEXRAW(data, len)			CUsbLog::HexDump(KLogComponent, 0, 0, data, len);
-#else
-#define LEAVEIFERRORL(a)				static_cast<void>(User::LeaveIfError(a))
-#define LEAVEL(a)						User::Leave(a)
-#define _USB_PANIC(CAT, CODE) 			User::Panic(CAT, CODE)
-#define PANIC_MSG(msg, cat, code)		msg.Panic(cat, code);
-#define FLOG(a)
-#define FTRACE(a)
-#define LOGTEXT(text)
-#define LOGTEXT2(text, a)
-#define LOGTEXT3(text, a, b)
-#define LOGTEXT4(text, a, b, c)
-#define LOGTEXT5(text, a, b, c, d)			
-#define LOGTEXT6(text, a, b, c, d, e)		
-#define LOGTEXT7(text, a, b, c, d, e, f)
-#define LOGHEXDESC(desc)
-#define LOGHEXRAW(data, len)
-#endif // __FLOG_ACTIVE
-
-#define FORCED_LOG_FUNC					TFunctionLogger __instrument(KLogComponent, TPtrC8((TUint8*)__PRETTY_FUNCTION__), (TAny*)this);
-#define FORCED_LOG_STATIC_FUNC_ENTRY	TFunctionLogger __instrument(KLogComponent, TPtrC8((TUint8*)__PRETTY_FUNCTION__), (TAny*)NULL);
-
-#if ( defined __FLOG_ACTIVE && defined __LOG_FUNCTIONS__ )
-#define LOG_LINE						CUsbLog::Write(KLogComponent, KNullDesC8());
-#define LOG_FUNC						FORCED_LOG_FUNC
-#define LOG_STATIC_FUNC_ENTRY			FORCED_LOG_STATIC_FUNC_ENTRY
-#else
-#define LOG_LINE
-#define LOG_FUNC
-#define LOG_STATIC_FUNC_ENTRY
-#endif
-
-
+#define LEAVEIFERRORL(err, trace) \
+{ \
+TInt munged_err=(err); \
+if (munged_err < 0) \
+{ \
+trace; \
+User::Leave(munged_err);\
+}\
+}
 
-NONSHARABLE_CLASS(CUsbLog) : public CBase
-	{
-public:
-	IMPORT_C static TInt Connect();
-	IMPORT_C static void Close();
-	
-	IMPORT_C static void Write(const TDesC8& aCmpt, const TDesC8& aText);
-	IMPORT_C static void WriteFormat(const TDesC8& aCmpt, TRefByValue<const TDesC8> aFmt, ...);
-	IMPORT_C static void WriteFormat(const TDesC8& aCmpt, TRefByValue<const TDesC8> aFmt, VA_LIST& aList);
-	IMPORT_C static void Write(const TDesC8& aCmpt, const TDesC16& aText);
-	IMPORT_C static void WriteFormat(const TDesC8& aCmpt, TRefByValue<const TDesC16> aFmt, ...);
-	IMPORT_C static void WriteFormat(const TDesC8& aCmpt, TRefByValue<const TDesC16> aFmt, VA_LIST& aList);
-	IMPORT_C static void HexDump(const TDesC8& aCmpt, const TText* aHeader, const TText* aMargin, const TUint8* aPtr, TInt aLen);
-	};
-
-
-#ifndef NO_FPRINT
-inline void FPrint(const TRefByValue<const TDesC> IF_FLOGGING(aFmt), ...)
-	{
-#ifdef __FLOG_ACTIVE
-	VA_LIST list;
-	VA_START(list,aFmt);
-	CUsbLog::WriteFormat(KDefaultLogFile, aFmt, list);
-#endif
-	}
-#endif
-
-
-#ifndef NO_FHEX_PTR
-inline void FHex(const TUint8* IF_FLOGGING(aPtr), TInt IF_FLOGGING(aLen))
-	{
-#ifdef __FLOG_ACTIVE
-	CUsbLog::HexDump(KDefaultLogFile, 0, 0, aPtr, aLen);
-#endif
-	}
-#endif
-
+#endif  // USBLOGGER_H
 
-#ifndef NO_FHEX_DESC
-inline void FHex(const TDesC8& IF_FLOGGING(aDes))
-	{
-#ifdef __FLOG_ACTIVE
-	FHex(aDes.Ptr(), aDes.Length());
-#endif
-	}
-#endif
-
-
-IMPORT_C void VerboseLeaveIfErrorL(const TDesC8& aCpt, 
-						  char* aFile, 
-						  TInt aLine, 
-						  TInt aReason);
-						  
-IMPORT_C void VerboseLeaveL(const TDesC8& aCpt, 
-						  char* aFile, 
-						  TInt aLine, 
-						  TInt aReason);
-						  
-IMPORT_C void VerbosePanic(const TDesC8& aCpt, 
-				  char* aFile, 
-				  TInt aLine, 
-				  TInt aPanicCode, 
-				  TText8* aPanicName,
-				  const TDesC& aPanicCategory);
-
-IMPORT_C void VerboseMsgPanic(const TDesC8& aCpt, 
-								char* aFile, 
-								TInt  aLine,
-								const RMessage2& aMsg,
-								const TDesC& aCat, 
-								TInt  aPanicCode);
-
-
-NONSHARABLE_CLASS(TFunctionLogger)
-	{
-public:
-	IMPORT_C TFunctionLogger(const TDesC8& aCpt, const TDesC8& aString, TAny* aThis);
-	IMPORT_C ~TFunctionLogger();
-	
-private:
-	TPtrC8 iCpt;
-	TPtrC8 iString;
-	};
-
-#endif	// LOGGER_H
-
--- a/usbmgmt/usbmgr/logger/src/usblogger.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,600 +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:
-*
-*/
-
-/**
- @file
- @internalTechnology
-*/
-
-
-#include <e32base.h>
-#include <comms-infras/commsdebugutility.h>
-#include <usb/usblogger.h>
-
-
-#ifdef __USB_DEBUG_RDEBUG__
-#include <e32debug.h>
-const TInt KUSBLogBufferSize=255;
-class TUSBFlogOverflow8  : public TDes8Overflow
-     {
-public:
-     void Overflow(TDes8& /*aDes*/) { }
-     };
-
-class TUSBFlogOverflow16  : public TDes16Overflow
-     {
-public:
-     void Overflow(TDes16& /*aDes*/) { }
-     };
-void __CUsbLog_DoHexDump(const TDesC8& aCmpt, const TDesC8& aData, const TDesC8& aHeader, const TDesC8& aMargin);
-#endif //__USB_DEBUG_RDEBUG__
-
-
-
-
-#ifdef __FLOG_ACTIVE
-_LIT8(KSubsystem, "USB");
-_LIT8(KLogCmpt, "logengine");
-#endif
-
-
-NONSHARABLE_CLASS(TLogData)
-	{
-	public:
-#ifdef __FLOG_ACTIVE
-		TLogData();
-
-		void SetLogTags(const TDesC8& aCmpt);
-
-		TInt iAccessCount;
-
-		RFileLogger iLogEngine;
-		TBuf8<KMaxTagLength> iCurrentComponent;
-#endif
-	};
-
-
-#ifdef __FLOG_ACTIVE
-TLogData::TLogData()
-	: iAccessCount(0), iCurrentComponent(KNullDesC8)
-	{}
-
-void TLogData::SetLogTags(const TDesC8& aCmpt)
-	{
-	if (aCmpt != iCurrentComponent)
-		{
-		iLogEngine.SetLogTags(KSubsystem, aCmpt.Left(KMaxTagLength));
-		iCurrentComponent = aCmpt.Left(KMaxTagLength);
-		}
-	}
-#endif
-
-#define GETLOG TLogData* __logger = static_cast<TLogData*>(Dll::Tls());
-
-
-
-EXPORT_C /*static*/ TInt CUsbLog::Connect()
-	{
-#ifdef __FLOG_ACTIVE
-	GETLOG;
-
-	if (!__logger)
-		{
-
-		CUsbLog::Write(KLogCmpt, _L8("Opening new logger connection"));
-		__logger = new TLogData();
-		if (!__logger)
-			{
-			CUsbLog::Write(KLogCmpt, _L8("Opening logger connection failed, no memory"));
-			return KErrNoMemory;
-			}
-
-		__logger->iLogEngine.Connect();
-		Dll::SetTls(__logger);
-		}
-
-	__logger->iAccessCount++;
-	CUsbLog::WriteFormat(KLogCmpt, _L8("Opening -- %d instances now open"), __logger->iAccessCount);
-
-	return KErrNone;
-#else
-	return KErrNotSupported;
-#endif
-	}
-
-
-EXPORT_C /*static*/ void CUsbLog::Close()
-	{
-#ifdef __FLOG_ACTIVE
-	GETLOG;
-
-	if (__logger)
-		{
-		TInt& count = __logger->iAccessCount;
-
-		if (count)
-			{
-			count--;
-			CUsbLog::WriteFormat(KLogCmpt, _L8("Closing -- %d instance(s) left open"), count);
-			if (!count)
-				{
-				__logger->iLogEngine.Close();
-				delete __logger;
-				Dll::SetTls(NULL);
-				CUsbLog::Write(KLogCmpt, _L8("Fully closed and deleted, now flogging statically."));
-				}
-			}
-		else
-			{
-			CUsbLog::Write(KLogCmpt, _L8("Not closing -- not opened"));
-			}
-		}
-#endif
-	}
-
-
-EXPORT_C /*static*/ void CUsbLog::Write(const TDesC8& IF_FLOGGING(aCmpt), const TDesC8& IF_FLOGGING(aText))
-	{
-#ifdef __FLOG_ACTIVE
-	GETLOG;
-
-#ifdef __USB_DEBUG_RDEBUG__
-		TBuf8<KUSBLogBufferSize> buf;
-		RThread thread;
-		buf.AppendFormat(_L8("%S\t%S\t%LX\t%S\r\n"), &KSubsystem(), &aCmpt, thread.Id().Id(), &aText);
-		RDebug::RawPrint(buf);
-#endif // __USB_DEBUG_RDEBUG
-
-	if (__logger)
-		{
-		__logger->SetLogTags(aCmpt);
-		__logger->iLogEngine.Write(aText);
-		}
-	else
-		{
-		RFileLogger::Write(KSubsystem, aCmpt, aText);
-		}
-#endif
-	}
-
-
-EXPORT_C /*static*/ void CUsbLog::WriteFormat(const TDesC8& IF_FLOGGING(aCmpt), TRefByValue<const TDesC8> IF_FLOGGING(aFmt), ...)
-	{
-#ifdef __FLOG_ACTIVE
-	VA_LIST list;
-	VA_START(list, aFmt);
-
-	GETLOG;
-
-#ifdef __USB_DEBUG_RDEBUG__
-		TUSBFlogOverflow8 objFlogBody8;
-		TBuf8<KUSBLogBufferSize> buf;
-		RThread thread;
-		buf.AppendFormat(_L8("%S\t%S\t%LX\t"), &KSubsystem(), &aCmpt, thread.Id().Id());
-		buf.AppendFormatList(aFmt, list, &objFlogBody8);
-		buf.Append(_L8("\r\n"));
-		RDebug::RawPrint(buf);
-#endif // __USB_DEBUG_RDEBUG
-
-	if (__logger)
-		{
-		__logger->SetLogTags(aCmpt);
-		__logger->iLogEngine.WriteFormat(aFmt, list);
-		}
-	else
-		{
-		RFileLogger::WriteFormat(KSubsystem, aCmpt, aFmt, list);
-		}
-#endif
-	}
-
-
-EXPORT_C /*static*/ void CUsbLog::WriteFormat(const TDesC8& IF_FLOGGING(aCmpt), TRefByValue<const TDesC8> IF_FLOGGING(aFmt), VA_LIST& IF_FLOGGING(aList))
-	{
-#ifdef __FLOG_ACTIVE
-	GETLOG;
-
-#ifdef __USB_DEBUG_RDEBUG__
-		TUSBFlogOverflow8 objFlogBody8;
-		TBuf8<KUSBLogBufferSize> buf;
-		RThread thread;
-		buf.AppendFormat(_L8("%S\t%S\t%LX\t"), &KSubsystem(), &aCmpt, thread.Id().Id());
-		buf.AppendFormatList(aFmt, aList, &objFlogBody8);
-		buf.Append(_L8("\r\n"));
-		RDebug::RawPrint(buf);
-#endif // __USB_DEBUG_RDEBUG
-
-	if (__logger)
-		{
-		__logger->SetLogTags(aCmpt);
-		__logger->iLogEngine.WriteFormat(aFmt, aList);
-		}
-	else
-		{
-		RFileLogger::WriteFormat(KSubsystem, aCmpt, aFmt, aList);
-		}
-#endif
-	}
-
-
-EXPORT_C /*static*/ void CUsbLog::Write(const TDesC8& IF_FLOGGING(aCmpt), const TDesC16& IF_FLOGGING(aText))
-	{
-#ifdef __FLOG_ACTIVE
-	GETLOG;
-
-#ifdef __USB_DEBUG_RDEBUG__
-		TBuf16<KUSBLogBufferSize> buf;
-		buf.AppendFormat(_L16("(TDesC16): %S\r\n"), &aText);
-		RDebug::RawPrint(buf);
-#endif // __USB_DEBUG_RDEBUG
-
-	if (__logger)
-		{
-		__logger->SetLogTags(aCmpt);
-		__logger->iLogEngine.Write(aText);
-		}
-	else
-		{
-		RFileLogger::WriteFormat(KSubsystem, aCmpt, aText);
-		}
-#endif
-	}
-
-
-EXPORT_C /*static*/ void CUsbLog::WriteFormat(const TDesC8& IF_FLOGGING(aCmpt), TRefByValue<const TDesC16> IF_FLOGGING(aFmt), ...)
-	{
-#ifdef __FLOG_ACTIVE
-	VA_LIST list;
-	VA_START(list, aFmt);
-
-	GETLOG;
-
-#ifdef __USB_DEBUG_RDEBUG__
-		TUSBFlogOverflow16 objFlogBody16;
-		TBuf16<KUSBLogBufferSize> wideBuf;
-		wideBuf.Append(_L16("(TDesC16): "));
-		wideBuf.AppendFormatList(aFmt, list, &objFlogBody16);
-		wideBuf.Append(_L16("\r\n"));
-		RDebug::RawPrint(wideBuf);
-#endif // __USB_DEBUG_RDEBUG
-
-	if (__logger)
-		{
-		__logger->SetLogTags(aCmpt);
-		__logger->iLogEngine.WriteFormat(aFmt, list);
-		}
-	else
-		{
-		RFileLogger::WriteFormat(KSubsystem, aCmpt, aFmt, list);
-		}
-#endif
-	}
-
-
-EXPORT_C /*static*/ void CUsbLog::WriteFormat(const TDesC8& IF_FLOGGING(aCmpt), TRefByValue<const TDesC16> IF_FLOGGING(aFmt), VA_LIST& IF_FLOGGING(aList))
-	{
-#ifdef __FLOG_ACTIVE
-	GETLOG;
-
-#ifdef __USB_DEBUG_RDEBUG__
-		TUSBFlogOverflow16 objFlogBody16;
-		TBuf16<KUSBLogBufferSize> wideBuf;
-		wideBuf.Append(_L16("(TDesC16): "));
-		wideBuf.AppendFormatList(aFmt, aList, &objFlogBody16);
-		wideBuf.Append(_L16("\r\n"));
-		RDebug::RawPrint(wideBuf);
-#endif // __USB_DEBUG_RDEBUG
-
-	if (__logger)
-		{
-		__logger->SetLogTags(aCmpt);
-		__logger->iLogEngine.WriteFormat(aFmt, aList);
-		}
-	else
-		{
-		RFileLogger::WriteFormat(KSubsystem, aCmpt, aFmt, aList);
-		}
-#endif
-	}
-
-
-EXPORT_C /*static*/ void CUsbLog::HexDump(const TDesC8& IF_FLOGGING(aCmpt), const TText* IF_FLOGGING(aHeader), const TText* IF_FLOGGING(aMargin), const TUint8* IF_FLOGGING(aPtr), TInt IF_FLOGGING(aLen))
-	{
-#ifdef __FLOG_ACTIVE
-	GETLOG;
-
-#ifdef __USB_DEBUG_RDEBUG__
-	__CUsbLog_DoHexDump(aCmpt, TPtrC8(aPtr, aLen), TPtrC8(NULL,0), TPtrC8(NULL,0));
-#endif // __USB_DEBUG_RDEBUG
-
-	if (__logger)
-		{
-		__logger->SetLogTags(aCmpt);
-		__logger->iLogEngine.HexDump(aHeader, aMargin, aPtr, aLen);
-		}
-	else
-		{
-		RFileLogger::HexDump(KSubsystem, aCmpt, TPtrC8(aPtr, aLen), KNullDesC8);
-		}
-#endif
-	}
-
-
-#ifdef __USB_DEBUG_RDEBUG__
-
-#define BLANK	_S("")
-const TInt KHexDumpWidth=16;			///< Number of bytes written per line when formatting as hex.
-const TInt KLowestPrintableCharacter = 32; ///< In Hex output, replace chars below space with a dot.
-const TInt KHighestPrintableCharacter = 126; ///< In Hex output, replace chars above 7-bits with a dot.
-
-_LIT8(KFirstFormatString8,"%04x : ");   ///< Format string used in Hexdump to format first part: header and byte numbers.
-_LIT8(KSecondFormatString8,"%02x ");      ///< Format string used in Hexdump to format mid part: each of the 16 bytes as hex
-_LIT8(KThirdFormatString8,"%c");          ///< Format string used in Hexdump to format the last part: each of the 16 bytes as characters
-_LIT8(KThreeSpaces8,"   ");               ///< Format string used in Hexdump to define padding between first and mid parts
-_LIT8(KTwoSpaces8," ");                   ///< Format string used in Hexdump to define padding between hex and char bytes.
-const TText8 KFullStopChar8='.';
-
-void __CUsbLog_DoHexDump(const TDesC8& aCmpt, const TDesC8& aData, const TDesC8& aHeader, const TDesC8& aMargin)
-	{
-#ifdef __FLOG_ACTIVE
-	HBufC8* marginStr = NULL;
-	TBuf8<KMaxHexDumpWidth> buf;
-	TInt aRemainingLen = aData.Length();
-	TInt aHeaderLen = aHeader.Length();
-	TUSBFlogOverflow8 objFlogBody8;
-
-	if (aData.Length()==0)		// nothing to do
-		{
-		return;
-		}
-
-
-	if (aHeaderLen > 0)
-		{
-
-		if (aMargin.Length() == 0)
-			{
-			marginStr = HBufC8::New(aHeader.Length());
-			if (marginStr == NULL)
-				{
-				return;		// abort if No memory
-				}
-			TPtr8 marginStrPtr(marginStr->Des());
-			marginStrPtr.AppendFill(' ',aHeader.Length());
-			}
-		else
-			{
-			marginStr = aMargin.Alloc();
-			}
-		}
-
-
-
-	TUint blockStartPos = 0;
-	while (aRemainingLen>0)
-		{
-		RThread thread;
-		buf.AppendFormat(_L8("%S\t%S\t%LX\t"), &KSubsystem(), &aCmpt, thread.Id().Id());
-		TInt blockLength = (aRemainingLen>KHexDumpWidth ? KHexDumpWidth : aRemainingLen);
-
-		// write the header/margin and print in hex which bytes we are about to write
-		if (blockStartPos == 0)
-			{
-			if (aHeaderLen > 0)
-				{
-				buf.Append(aHeader);
-				}
-			buf.AppendFormat(KFirstFormatString8,&objFlogBody8, blockStartPos);
-			}
-		else
-			{
-			if (marginStr)
-				{
-				buf.Append(*marginStr);
-				}
-			buf.AppendFormat(KFirstFormatString8,&objFlogBody8,blockStartPos);
-			}
-
-		TInt bytePos;
-		// write the bytes as hex
-		for (bytePos = 0; bytePos < blockLength; bytePos++)
-			{
-			buf.AppendFormat(KSecondFormatString8,aData[blockStartPos + bytePos]);
-			}
-		while (bytePos++ < KHexDumpWidth)
-			{
-			buf.Append(KThreeSpaces8);
-			}
-		buf.Append(KTwoSpaces8);
-		// print the bytes as characters, or full stops if outside printable range
-		for (bytePos = 0; bytePos < blockLength; bytePos++)
-			{
-			buf.AppendFormat(KThirdFormatString8,(aData[blockStartPos + bytePos] < KLowestPrintableCharacter || aData[blockStartPos + bytePos] > KHighestPrintableCharacter) ? KFullStopChar8 : aData[blockStartPos + bytePos]);
-			}
-
-		buf.Append(_L8("\r\n"));
-		RDebug::RawPrint(buf);
-
-		buf.SetLength(0);
-		aRemainingLen -= blockLength;
-		blockStartPos += blockLength;
-		}
-	delete marginStr;
-#endif // __FLOG_ACTIVE
-	}
-
-
-
-#endif // __USB_DEBUG_RDEBUG
-
-
-/**
-Leave (if error) verbosely- log name of file and line number just before
-leaving.
-@param aFile The file we're leaving from.
-@param aLine The line number we're leaving from.
-@param aReason The leave code.
-*/
-EXPORT_C void VerboseLeaveIfErrorL(const TDesC8& IF_FLOGGING(aCpt),
-						  char* IF_FLOGGING(aFile),
-						  TInt IF_FLOGGING(aLine),
-						  TInt aReason)
-	{
-	// only leave negative value
-	if ( aReason >= 0 )
-		{
-		return;
-		}
-
-#ifdef __FLOG_ACTIVE
-	_LIT8(KLeavePrefix, "LEAVE: ");
-
-	TPtrC8 fullFileName((const TUint8*)aFile);
-	TPtrC8 fileName(fullFileName.Ptr()+fullFileName.LocateReverse('\\')+1);
-
-	TBuf8<256> buf;
-	buf.Append(KLeavePrefix);
-	buf.AppendFormat(_L8("aReason = %d [file %S, line %d]"), aReason, &fileName,
-		aLine);
-	CUsbLog::Write(aCpt, buf);
-#endif
-
-	// finally
-	User::Leave(aReason);
-	}
-
-/**
-Leave verbosely- log name of file and line number just before
-leaving.
-@param aFile The file we're leaving from.
-@param aLine The line number we're leaving from.
-@param aReason The leave code.
-*/
-EXPORT_C void VerboseLeaveL(const TDesC8& IF_FLOGGING(aCpt),
-						  char* IF_FLOGGING(aFile),
-						  TInt IF_FLOGGING(aLine),
-						  TInt aReason)
-	{
-#ifdef __FLOG_ACTIVE
-	_LIT8(KLeavePrefix, "LEAVE: ");
-
-	TPtrC8 fullFileName((const TUint8*)aFile);
-	TPtrC8 fileName(fullFileName.Ptr()+fullFileName.LocateReverse('\\')+1);
-
-	TBuf8<256> buf;
-	buf.Append(KLeavePrefix);
-	buf.AppendFormat(_L8("aReason = %d [file %S, line %d]"), aReason, &fileName,
-		aLine);
-	CUsbLog::Write(aCpt, buf);
-#endif
-
-	// finally
-	User::Leave(aReason);
-	}
-
-/**
-Panic verbosely- log name of file and line number just before panicking.
-@param aFile The file that's panicking.
-@param aLine The line number that's panicking.
-@param aReason The panic code.
-@param aPanicName The text of the panic code.
-@param aPanicCategory The panic category.
-*/
-EXPORT_C void VerbosePanic(const TDesC8& IF_FLOGGING(aCpt),
-				  char* IF_FLOGGING(aFile),
-				  TInt IF_FLOGGING(aLine),
-				  TInt aPanicCode,
-				  TText8* IF_FLOGGING(aPanicName),
-				  const TDesC& aPanicCategory)
-	{
-#ifdef __FLOG_ACTIVE
-	_LIT8(KPanicPrefix, "PANIC: code ");
-
-	TPtrC8 fullFileName((const TUint8*)aFile);
-	TPtrC8 fileName(fullFileName.Ptr()+fullFileName.LocateReverse('\\')+1);
-
-	TBuf8<256> buf;
-	buf.Append(KPanicPrefix);
-	buf.AppendFormat(_L8("%d = %s [file %S, line %d]"),
-		aPanicCode,
-		aPanicName,
-		&fileName,
-		aLine);
-	CUsbLog::Write(aCpt, buf);
-#endif
-
-	// finally
-	User::Panic(aPanicCategory, aPanicCode);
-	}
-
-
-/**
-Panic the given message verbosely- log name of file and line number just
-before panicking.
-@param aMsg Message to panic.
-@param aFile The file that's panicking.
-@param aLine The line number that's panicking.
-@param aReason The panic code.
-@param aPanicName The text of the panic code.
-@param aPanicCategory The panic category.
-*/
-EXPORT_C void VerboseMsgPanic(const TDesC8& IF_FLOGGING(aCpt),
-								char* IF_FLOGGING(aFile),
-								TInt  IF_FLOGGING(aLine),
-								const RMessage2& aMsg,
-								const TDesC& aCat,
-								TInt  aPanicCode)
-	{
-#ifdef __FLOG_ACTIVE
-	_LIT8(KPanicPrefix, "PANICKING CLIENT: code ");
-
-	TPtrC8 fullFileName((const TUint8*)aFile);
-	TPtrC8 fileName(fullFileName.Ptr()+fullFileName.LocateReverse('\\')+1);
-
-	TBuf8<256> buf;
-	buf.Append(KPanicPrefix);
-	buf.AppendFormat(_L8("%d [file %S, line %d]"),
-		aPanicCode,
-		&fileName,
-		aLine);
-	CUsbLog::Write(aCpt, buf);
-#endif
-	// finally
-	aMsg.Panic(aCat, aPanicCode);
-	}
-
-#ifdef __FLOG_ACTIVE
-_LIT8(KInstrumentIn, ">>%S this = [0x%08x]");
-_LIT8(KInstrumentOut, "<<%S");
-#endif
-
-EXPORT_C TFunctionLogger::TFunctionLogger(const TDesC8& IF_FLOGGING(aCpt), const TDesC8& IF_FLOGGING(aString), TAny* IF_FLOGGING(aThis))
-	{
-#ifdef __FLOG_ACTIVE
-	iCpt.Set(aCpt);
-	iString.Set(aString);
-	CUsbLog::WriteFormat(iCpt, KInstrumentIn, &iString, aThis);
-#endif
-	}
-
-EXPORT_C TFunctionLogger::~TFunctionLogger()
-	{
-#ifdef __FLOG_ACTIVE
-	CUsbLog::WriteFormat(iCpt, KInstrumentOut, &iString);
-#endif
-	}
-
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/group/bld.inf	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +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:
-*
-*/
-
-PRJ_TESTEXPORTS
-
-// TEF ini file.
-..\testdata\UsbRomConfig.ini	\epoc32\winscw\c\testdata\usbromconfig\UsbRomConfig.ini
-
-// TEF scripts files.
-..\scripts\USB_ROMCONFIG_001.script		\epoc32\winscw\c\scripts\usbromconfig\USB_ROMCONFIG_001.script
-..\scripts\USB_ROMCONFIG_002.script		\epoc32\winscw\c\scripts\usbromconfig\USB_ROMCONFIG_002.script
-..\scripts\USB_ROMCONFIG_003.script		\epoc32\winscw\c\scripts\usbromconfig\USB_ROMCONFIG_003.script
-..\scripts\USB_ROMCONFIG_004.script		\epoc32\winscw\c\scripts\usbromconfig\USB_ROMCONFIG_004.script
-..\scripts\USB_INC_ROMCONFIG_001.script		\epoc32\winscw\c\scripts\usbromconfig\USB_INC_ROMCONFIG_001.script
-..\scripts\USB_INC_ROMCONFIG_002.script		\epoc32\winscw\c\scripts\usbromconfig\USB_INC_ROMCONFIG_002.script
-..\scripts\USB_INC_ROMCONFIG_003.script		\epoc32\winscw\c\scripts\usbromconfig\USB_INC_ROMCONFIG_003.script
-..\scripts\USB_INC_ROMCONFIG_004.script		\epoc32\winscw\c\scripts\usbromconfig\USB_INC_ROMCONFIG_004.script
-
-// Rom iby files.
-
-PRJ_TESTMMPFILES
-testserversymbianexcludeusb.mmp
-
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/group/testserversymbianexcludeusb.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +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:
-* ObexTITest.mmp
-*
-*/
-
-TARGET		testserversymbianexcludeusb.exe
-TARGETTYPE	exe
-UID		0x1000008d 0x0F1F777D
-
-VENDORID	0x70000001
-CAPABILITY	All -TCB
-
-SOURCEPATH	../src
-SOURCE		testserversymbianexcludeusb.cpp
-SOURCE		cteststepusbromconfigbase.cpp
-SOURCE		cteststepusbromconfig001.cpp
-SOURCE		cteststepusbromconfig002.cpp
-SOURCE		cteststepusbromconfig003.cpp
-SOURCE		cteststepusbromconfig004.cpp
-
-USERINCLUDE	../inc
-
-OS_LAYER_SYSTEMINCLUDE_SYMBIAN
-
-LIBRARY		euser.lib
-LIBRARY		c32.lib
-LIBRARY		testexecuteutils.lib 
-LIBRARY		testexecutelogclient.lib
-LIBRARY		esock.lib
-LIBRARY		usbman.lib
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/inc/cteststepusbromconfig001.h	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +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:
-*
-*/
-
-#ifndef CTESTSTEPUSBROMCONFIG001_H
-#define CTESTSTEPUSBROMCONFIG001_H
-
-#include "cteststepusbromconfigbase.h"
-
-class CTestStepUsbRomConfig001 : public CTestStepUsbRomConfigBase
-	{
-public:
-	static CTestStepUsbRomConfig001* New(CTestServer& aParent);
-	~CTestStepUsbRomConfig001();
-	TVerdict doTestStepL();
-	
-private:
-	CTestStepUsbRomConfig001(CTestServer& aParent);
-	};
-
-_LIT(KTestName001, "USB_ROMCONFIG_001"); 
-#endif //  CTESTSTEPUSBROMCONFIG001_H
-
-// EOF
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/inc/cteststepusbromconfig002.h	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +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:
-*
-*/
-
-#ifndef CTESTSTEPUSBROMCONFIG002_H
-#define CTESTSTEPUSBROMCONFIG002_H
-
-#include "cteststepusbromconfigbase.h"
-
-class CTestStepUsbRomConfig002 : public CTestStepUsbRomConfigBase
-	{
-public:
-	static CTestStepUsbRomConfig002* New(CTestServer& aParent);
-	~CTestStepUsbRomConfig002();
-	TVerdict doTestStepL();
-	
-private:
-	CTestStepUsbRomConfig002(CTestServer& aParent);
-	};
-
-_LIT(KTestName002, "USB_ROMCONFIG_002"); 
-#endif //  CTESTSTEPUSBROMCONFIG002_H
-
-// EOF
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/inc/cteststepusbromconfig003.h	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +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:
-*
-*/
-
-#ifndef CTESTSTEPUSBROMCONFIG003_H
-#define CTESTSTEPUSBROMCONFIG003_H
-
-#include "cteststepusbromconfigbase.h"
-
-class CTestStepUsbRomConfig003 : public CTestStepUsbRomConfigBase
-	{
-public:
-	static CTestStepUsbRomConfig003* New(CTestServer& aParent);
-	~CTestStepUsbRomConfig003();
-	TVerdict doTestStepL();
-	
-private:
-	CTestStepUsbRomConfig003(CTestServer& aParent);
-	};
-
-_LIT(KTestName003, "USB_ROMCONFIG_003"); 
-#endif //  CTESTSTEPUSBROMCONFIG003_H
-
-// EOF
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/inc/cteststepusbromconfig004.h	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +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:
-*
-*/
-
-#ifndef CTESTSTEPUSBROMCONFIG004_H
-#define CTESTSTEPUSBROMCONFIG004_H
-
-#include "cteststepusbromconfigbase.h"
-
-class CTestStepUsbRomConfig004 : public CTestStepUsbRomConfigBase
-	{
-public:
-	static CTestStepUsbRomConfig004* New(CTestServer& aParent);
-	~CTestStepUsbRomConfig004();
-	TVerdict doTestStepL();
-	
-private:
-	CTestStepUsbRomConfig004(CTestServer& aParent);
-	};
-
-_LIT(KTestName004, "USB_ROMCONFIG_004"); 
-#endif //  CTESTSTEPUSBROMCONFIG004_H
-
-// EOF
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/inc/cteststepusbromconfigbase.h	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +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:
-*
-*/
-
-#ifndef CTESTSTEPUSBROMCONFIGBASE_H
-#define CTESTSTEPUSBROMCONFIGBASE_H
-
-#include <test/testexecutestepbase.h>
-#include <test/testexecuteserverbase.h>
-
-// constants used for logging
-_LIT(KErrNotFoundLit, "KErrNotFound");
-_LIT(KErrNoneLit, "KErrNone");
-_LIT(KErrBadNameLit, "KErrBadName");
-_LIT(KErrNotSupportedLit, "KErrNotSupported");
-
-class CTestStepUsbRomConfigBase : public CTestStep
-	{
-public:
-	~CTestStepUsbRomConfigBase();
-	TVerdict doTestStepL()=0;
-	TVerdict doTestStepPreambleL();
-
-protected:
-	CTestStepUsbRomConfigBase(CTestServer& aParent);
-	void CheckAndSetTestResult();
-	// ideally this should be const, but we need to get the value out of an ini file 
-	// and there's no easy way to do this inside the initialization list
-	TBool iUsbExcluded;	
-	const CTestServer& iParent;		
-	};
-
-#endif //  CTESTSTEPUSBROMCONFIGBASE_H
-
-// EOF
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/inc/testserversymbianexcludeusb.h	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +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:
-*
-*/
-
-#ifndef TESTSERVERSYMBIANEXCLUDEUSB_H
-#define TESTSERVERSYMBIANEXCLUDEUSB_H
-
-#include <test/testexecuteserverbase.h>
-
-/**
-Test Server for the USB tests for PREQ 581: Enable features to be ommitted from a ROM
-
-Nothing more than a wrapper to load the TestExecute steps 
-*/
-class CTestServerSymbianExcludeUsb : public CTestServer
-	{
-public:
-	static CTestServerSymbianExcludeUsb* NewL();
-	virtual CTestStep* CreateTestStep(const TDesC& aStepName);
-	};
-#endif      // TESTSERVERSYMBIANEXCLUDEUSB_H
-// End of File
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/scripts/USB_CIT_P581_UsbExcluded.script	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
-* 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:
-*
-*/
-
-// Run all the USB_ROMCONFIG_* tests
-// Expects a ROM to be built without USB i.e. SYMBIAN_EXCLUDE_USB has been specified
-
-RUN_SCRIPT c:\scripts\usbromconfig\USB_ROMCONFIG_001.script
-
-RUN_SCRIPT c:\scripts\usbromconfig\USB_ROMCONFIG_002.script
-
-RUN_SCRIPT c:\scripts\usbromconfig\USB_ROMCONFIG_003.script
-
-RUN_SCRIPT c:\scripts\usbromconfig\USB_ROMCONFIG_004.script
-
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/scripts/USB_CIT_P581_UsbIncluded.script	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
-* 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:
-*
-*/
-
-// Run all the USB_INC_ROMCONFIG_* tests
-// Expects a standard ROM to be built i.e. SYMBIAN_EXCLUDE_USB has NOT been specified
-
-RUN_SCRIPT c:\scripts\usbromconfig\USB_INC_ROMCONFIG_001.script
-
-RUN_SCRIPT c:\scripts\usbromconfig\USB_INC_ROMCONFIG_002.script
-
-RUN_SCRIPT c:\scripts\usbromconfig\USB_INC_ROMCONFIG_003.script
-
-RUN_SCRIPT c:\scripts\usbromconfig\USB_INC_ROMCONFIG_004.script
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/scripts/USB_INC_ROMCONFIG_001.script	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
-* 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:
-*
-*/
-
-LOAD_SERVER TestServerSymbianExcludeUsb
-
-START_TESTCASE USB-INC-ROMCONFIG-001
-//! @SYMTestCaseID USB-INC-ROMCONFIG-001
-//! @SYMTestCaseDesc RUsb::Connect should succeed on a standard Techview ROM
-//! @SYMREQ 5414
-//! @SYMTestType CIT
-//! @SYMTestPriority 3
-//! @SYMTestStatus Implemented
-//! @SYMTestActions Call RUsb::Connect
-//! @SYMTestExpectedResults Returns KErrNone
-RUN_TEST_STEP 10 TestServerSymbianExcludeUsb USB_ROMCONFIG_001 c:\testdata\usbromconfig\UsbRomConfig.ini UsbIncluded
-END_TESTCASE USB-INC-ROMCONFIG-001
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/scripts/USB_INC_ROMCONFIG_002.script	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
-* 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:
-*
-*/
-
-LOAD_SERVER TestServerSymbianExcludeUsb
-
-START_TESTCASE USB-INC-ROMCONFIG-002
-//! @SYMTestCaseID USB-INC-ROMCONFIG-002
-//! @SYMTestCaseDesc User::LoadLogicalDevice("EUSBC") should succeed on a standard Techview ROM
-//! @SYMREQ 5414
-//! @SYMTestType CIT
-//! @SYMTestPriority 3
-//! @SYMTestStatus Implemented
-//! @SYMTestActions Call User::LoadLogicalDevice("EUSBC")
-//! @SYMTestExpectedResults Returns KErrNone (or KErrAlreadyExists)
-RUN_TEST_STEP 10 TestServerSymbianExcludeUsb USB_ROMCONFIG_002 c:\testdata\usbromconfig\UsbRomConfig.ini UsbIncluded
-END_TESTCASE USB-INC-ROMCONFIG-002
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/scripts/USB_INC_ROMCONFIG_003.script	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
-* 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:
-*
-*/
-
-LOAD_SERVER TestServerSymbianExcludeUsb
-
-START_TESTCASE USB-INC-ROMCONFIG-003
-//! @SYMTestCaseID USB-INC-ROMCONFIG-003
-//! @SYMTestCaseDesc RCommServ::LoadCommModule should succeed for ACM csy on a standard Techview ROM
-//! @SYMREQ 5414
-//! @SYMTestType CIT
-//! @SYMTestPriority 3
-//! @SYMTestStatus Implemented
-//! @SYMTestActions Call RCommServ::LoadCommModule("ECACM")
-//! @SYMTestExpectedResults Returns KErrNone
-RUN_TEST_STEP 10 TestServerSymbianExcludeUsb USB_ROMCONFIG_003 c:\testdata\usbromconfig\UsbRomConfig.ini UsbIncluded
-END_TESTCASE USB-INC-ROMCONFIG-003
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/scripts/USB_INC_ROMCONFIG_004.script	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
-* 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:
-*
-*/
-
-LOAD_SERVER TestServerSymbianExcludeUsb
-
-START_TESTCASE USB-INC-ROMCONFIG-004
-//! @SYMTestCaseID USB-INC-ROMCONFIG-004
-//! @SYMTestCaseDesc RDevUsbcClient::Open should succeed on a standard Techview ROM
-//! @SYMREQ 5414
-//! @SYMTestType CIT
-//! @SYMTestPriority 3
-//! @SYMTestStatus Implemented
-//! @SYMTestActions Call RDevUsbcClient::Open(0)
-//! @SYMTestExpectedResults Returns KErrNone
-RUN_TEST_STEP 10 TestServerSymbianExcludeUsb USB_ROMCONFIG_004 c:\testdata\usbromconfig\UsbRomConfig.ini UsbIncluded
-END_TESTCASE USB-INC-ROMCONFIG-004
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/scripts/USB_ROMCONFIG_001.script	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
-* 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:
-*
-*/
-
-LOAD_SERVER TestServerSymbianExcludeUsb
-
-START_TESTCASE USB-ROMCONFIG-001
-//! @SYMTestCaseID USB-ROMCONFIG-001
-//! @SYMTestCaseDesc RUsb::Connect should fail on a SYMBIAN_EXCLUDE_USB ROM
-//! @SYMREQ 5414
-//! @SYMTestType CIT
-//! @SYMTestPriority 1
-//! @SYMTestStatus Implemented
-//! @SYMTestActions Call RUsb::Connect
-//! @SYMTestExpectedResults Returns KErrNotFound, as USB support has been removed from ROM
-RUN_TEST_STEP 10 TestServerSymbianExcludeUsb USB_ROMCONFIG_001 c:\testdata\usbromconfig\UsbRomConfig.ini UsbExcluded
-END_TESTCASE USB-ROMCONFIG-001
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/scripts/USB_ROMCONFIG_002.script	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
-* 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:
-*
-*/
-
-LOAD_SERVER TestServerSymbianExcludeUsb
-
-START_TESTCASE USB-ROMCONFIG-002
-//! @SYMTestCaseID USB-ROMCONFIG-002
-//! @SYMTestCaseDesc User::LoadLogicalDevice("EUSBC") should fail on a SYMBIAN_EXCLUDE_USB ROM
-//! @SYMREQ 5414
-//! @SYMTestType CIT
-//! @SYMTestPriority 1
-//! @SYMTestStatus Implemented
-//! @SYMTestActions Call User::LoadLogicalDevice("EUSBC")
-//! @SYMTestExpectedResults Returns KErrNotFound, as usb.ldd has been removed from ROM
-RUN_TEST_STEP 10 TestServerSymbianExcludeUsb USB_ROMCONFIG_002 c:\testdata\usbromconfig\UsbRomConfig.ini UsbExcluded
-END_TESTCASE USB-ROMCONFIG-002
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/scripts/USB_ROMCONFIG_003.script	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
-* 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:
-*
-*/
-
-LOAD_SERVER TestServerSymbianExcludeUsb
-
-START_TESTCASE USB-ROMCONFIG-003
-//! @SYMTestCaseID USB-ROMCONFIG-003
-//! @SYMTestCaseDesc RCommServ::LoadCommModule should fail for ACM csy on a SYMBIAN_EXCLUDE_USB ROM
-//! @SYMREQ 5414
-//! @SYMTestType CIT
-//! @SYMTestPriority 1
-//! @SYMTestStatus Implemented
-//! @SYMTestActions Call RCommServ::LoadCommModule("ECACM")
-//! @SYMTestExpectedResults Returns KErrNotFound, as ecacm.csy has been removed from ROM
-RUN_TEST_STEP 10 TestServerSymbianExcludeUsb USB_ROMCONFIG_003 c:\testdata\usbromconfig\UsbRomConfig.ini UsbExcluded
-END_TESTCASE USB-ROMCONFIG-003
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/scripts/USB_ROMCONFIG_004.script	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
-* 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:
-*
-*/
-
-LOAD_SERVER TestServerSymbianExcludeUsb
-
-START_TESTCASE USB-ROMCONFIG-004
-//! @SYMTestCaseID USB-ROMCONFIG-004
-//! @SYMTestCaseDesc RDevUsbcClient::Open should fail on a SYMBIAN_EXCLUDE_USB ROM
-//! @SYMREQ 5414
-//! @SYMTestType CIT
-//! @SYMTestPriority 1
-//! @SYMTestStatus Implemented
-//! @SYMTestActions Call RDevUsbcClient::Open(0)
-//! @SYMTestExpectedResults Returns KErrNotFound, as USB not on ROM
-RUN_TEST_STEP 10 TestServerSymbianExcludeUsb USB_ROMCONFIG_004 c:\testdata\usbromconfig\UsbRomConfig.ini UsbExcluded
-END_TESTCASE USB-ROMCONFIG-004
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/src/cteststepusbromconfig001.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +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:
-*
-*/
-
-#include "cteststepusbromconfig001.h"
-#include <usbman.h>
-
-CTestStepUsbRomConfig001::~CTestStepUsbRomConfig001()
-	{
-    }
-	
-CTestStepUsbRomConfig001::CTestStepUsbRomConfig001(CTestServer& aParent) 
-	: CTestStepUsbRomConfigBase(aParent)
-	{
-	SetTestStepName(KTestName001);
-	}
-
-/**
-Static Constructor
-Note the lack of ELeave. This means that having insufficient memory will return NULL;
-*/
-CTestStepUsbRomConfig001* CTestStepUsbRomConfig001::New(CTestServer& aParent)
-	{
-	return new CTestStepUsbRomConfig001(aParent); 
-	}
-
-/**
-See USB_ROMCONFIG_001.script
-*/
-TVerdict CTestStepUsbRomConfig001::doTestStepL()
-	{
-	INFO_PRINTF1(\
-		_L("&gt;&gt;CTestStepUsbRomConfig001::doTestStepL()"));
-	
-	const TInt expectedError = ( iUsbExcluded ? KErrNotFound : KErrNone );
-	const TDesC* expectedErrorDesPtr = ( iUsbExcluded ? &KErrNotFoundLit : &KErrNoneLit );
-	RUsb usb;	
-	TInt err = usb.Connect();
-	if ( err!=expectedError )
-		{
-		INFO_PRINTF4(\
-			_L("Failed: Expected %S(%d) and got %d when calling RUsb::Connect()"),\
-			expectedErrorDesPtr, expectedError, err);
-		SetTestStepResult(EFail);
-		}
-	if ( usb.Handle() )	
-		{
-		usb.Close();
-		}
-	
-	INFO_PRINTF1(\
-		_L("&lt;&lt;CTestStepUsbRomConfig001::doTestStepL()"));
-	CheckAndSetTestResult();
-	return TestStepResult(); 
-	}
-
-// EOF
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/src/cteststepusbromconfig002.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +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:
-*
-*/
-
-#include "cteststepusbromconfig002.h"
-
-#ifndef __WINS__
-_LIT(KUsbLddName, "EUSBC");
-#else
-_LIT(KUsbLddName, "TESTUSBC");
-#endif
-
-CTestStepUsbRomConfig002::~CTestStepUsbRomConfig002()
-	{
-    }
-	
-CTestStepUsbRomConfig002::CTestStepUsbRomConfig002
-	(CTestServer& aParent) 
-	: CTestStepUsbRomConfigBase(aParent)
-	{
-	SetTestStepName(KTestName002);
-	}
-
-/**
-Static Constructor
-Note the lack of ELeave. This means that having insufficient memory will return NULL;
-*/
-CTestStepUsbRomConfig002* CTestStepUsbRomConfig002::New
-	(CTestServer& aParent)
-	{
-	return new CTestStepUsbRomConfig002(aParent); 
-	}
-
-/**
-See USB_ROMCONFIG_002.script
-*/
-TVerdict CTestStepUsbRomConfig002::doTestStepL()
-	{
-	INFO_PRINTF1(\
-		_L("&gt;&gt;CTestStepUsbRomConfig002::doTestStepL()"));
-	
-	const TInt expectedError = ( iUsbExcluded ? KErrNotFound : KErrNone );
-	const TDesC* expectedErrorDesPtr = ( iUsbExcluded ? &KErrNotFoundLit : &KErrNoneLit );
-	
-	TInt err = User::LoadLogicalDevice(KUsbLddName);
-	if ( (expectedError==KErrNone && err!=KErrNone && err!=KErrAlreadyExists) || 
-		(expectedError!=KErrNone && err!=expectedError) )
-		{
-		INFO_PRINTF5(\
-			_L("Failed: Expected %S(%d) and got %d when calling LoadLogicalDevice(%S)"),\
-			expectedErrorDesPtr, expectedError, err, &KUsbLddName);
-		SetTestStepResult(EFail);
-		}
-	
-	INFO_PRINTF1(\
-		_L("&lt;&lt;CTestStepUsbRomConfig002::doTestStepL()"));
-	CheckAndSetTestResult();
-	return TestStepResult(); 
-	}
-
-// EOF
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/src/cteststepusbromconfig003.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +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:
-*
-*/
-
-#include "cteststepusbromconfig003.h"
-#include <c32comm.h>
-#include <AcmInterface.h>
-
-CTestStepUsbRomConfig003::~CTestStepUsbRomConfig003()
-	{
-    }
-	
-CTestStepUsbRomConfig003::CTestStepUsbRomConfig003
-	(CTestServer& aParent) 
-	: CTestStepUsbRomConfigBase(aParent)
-	{
-	SetTestStepName(KTestName003);
-	}
-
-/**
-Static Constructor
-Note the lack of ELeave. This means that having insufficient memory will return NULL;
-*/
-CTestStepUsbRomConfig003* CTestStepUsbRomConfig003::New
-	(CTestServer& aParent)
-	{
-	return new CTestStepUsbRomConfig003(aParent); 
-	}
-	
-/**
-See USB_ROMCONFIG_003.script
-*/
-TVerdict CTestStepUsbRomConfig003::doTestStepL()
-	{
-	INFO_PRINTF1(\
-		_L("&gt;&gt;CTestStepUsbRomConfig003::doTestStepL()"));
-	
-	const TInt expectedError = ( iUsbExcluded ? KErrNotFound : KErrNone );
-	const TDesC* expectedErrorDesPtr = ( iUsbExcluded ? &KErrNotFoundLit : &KErrNoneLit );
-	
-	RCommServ commServ;
-	commServ.Connect();
-	TInt err = commServ.LoadCommModule(KAcmCsyName);
-	if ( err!=expectedError )
-		{
-		INFO_PRINTF5(\
-			_L("Failed: Expected %S(%d) and got %d when calling LoadCommModule(%S)"),\
-			expectedErrorDesPtr, expectedError, err, &KAcmCsyName);
-		SetTestStepResult(EFail);
-		}
-	commServ.Close();
-		
-	INFO_PRINTF1(\
-		_L("&lt;&lt;CTestStepUsbRomConfig003::doTestStepL()"));
-	CheckAndSetTestResult();
-	return TestStepResult(); 
-	}
-
-// EOF
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/src/cteststepusbromconfig004.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +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:
-*
-*/
-
-#include "cteststepusbromconfig004.h"
-#include <d32usbc.h>
-
-CTestStepUsbRomConfig004::~CTestStepUsbRomConfig004()
-	{
-    }
-	
-CTestStepUsbRomConfig004::CTestStepUsbRomConfig004
-	(CTestServer& aParent) 
-	: CTestStepUsbRomConfigBase(aParent)
-	{
-	SetTestStepName(KTestName004);
-	}
-
-/**
-Static Constructor
-Note the lack of ELeave. This means that having insufficient memory will return NULL;
-*/
-CTestStepUsbRomConfig004* CTestStepUsbRomConfig004::New
-	(CTestServer& aParent)
-	{
-	return new CTestStepUsbRomConfig004(aParent); 
-	}
-	
-/**
-See USB_ROMCONFIG_004.script
-*/
-TVerdict CTestStepUsbRomConfig004::doTestStepL()
-	{
-	INFO_PRINTF1(\
-		_L("&gt;&gt;CTestStepUsbRomConfig004::doTestStepL()"));
-	
-	const TInt expectedError = ( iUsbExcluded ? KErrNotFound : KErrNone );
-	const TDesC* expectedErrorDesPtr = ( iUsbExcluded ? &KErrNotFoundLit : &KErrNoneLit );
-	
-	RDevUsbcClient usbClient;
-	TInt err = usbClient.Open(0);
-	if ( err!=expectedError )
-		{
-		INFO_PRINTF4(\
-			_L("Failed: Expected %S(%d) and got %d when calling RDevUsbcClient::Open(0)"),\
-			expectedErrorDesPtr, expectedError, err);
-		SetTestStepResult(EFail);
-		}
-	if ( usbClient.Handle() )
-		{
-		usbClient.Close();
-		}
-		
-	INFO_PRINTF1(\
-		_L("&lt;&lt;CTestStepUsbRomConfig004::doTestStepL()"));
-	CheckAndSetTestResult();
-	return TestStepResult(); 
-	}
-
-// EOF
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/src/cteststepusbromconfigbase.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +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:
-*
-*/
-
-#include "cteststepusbromconfigbase.h"
-
-_LIT(KUsbExcludedKeyName, "UsbExcluded");
-
-CTestStepUsbRomConfigBase::~CTestStepUsbRomConfigBase()
-	{
-    }
-	
-/**
-Constructor sets the default test result to inconclusive
-Up to the test to either explicitly fail the test or to 
-explicitly pass
-*/
-CTestStepUsbRomConfigBase::CTestStepUsbRomConfigBase(CTestServer& aParent) 
-	: iParent(aParent)
-	{
-	SetTestStepResult(EInconclusive);
-	}
-
-/**
-The ROMConfig tests run in two configurations:
-ROM with component included
-ROM with component excluded
-By specifying the appropriate ini section, the test behaviour can be altered
-*/
-TVerdict CTestStepUsbRomConfigBase::doTestStepPreambleL()
-	{
-	if ( GetBoolFromConfig(ConfigSection(),KUsbExcludedKeyName, iUsbExcluded) )
-		{
-		return EPass;
-		}
-	return EFail;	
-	}
-	
-/**
-Should be called at the end of every test
-Checks if the default (EInconclusive) result is still set
-i.e. test has NOT set the result to EFail
-If still EInconclusive, then sets the result to EPass.
-*/	
-void CTestStepUsbRomConfigBase::CheckAndSetTestResult()	
-	{
-	if ( TestStepResult()==EInconclusive )
-		{
-		SetTestStepResult(EPass);
-		}
-	}
-	
-// EOF
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/src/testserversymbianexcludeusb.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +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:
-*
-*/
-
-#include "testserversymbianexcludeusb.h"
-#include <e32std.h>
-#include <rsshared.h>
-
-// Put all of the test step header files here...
-#include "cteststepusbromconfig001.h"
-#include "cteststepusbromconfig002.h"
-#include "cteststepusbromconfig003.h"
-#include "cteststepusbromconfig004.h"
-
-_LIT(KServerName,"TestServerSymbianExcludeUsb");
-
-TInt LoadDrivers()
-	{
-#ifdef __WINS__
-	#define KPDDName _L("ECDRV")
-	#define KLDDName _L("ECOMM")
-#else
-	#define KPDDName _L("EUART1")
-	#define KLDDName _L("ECOMM")	
-#endif	
-	TInt rerr = KErrNone;
-	
-	rerr = StartC32();
-	if ( rerr!=KErrNone && rerr!=KErrAlreadyExists )
-		{
-		return rerr;	
-		}
-
-	rerr = User::LoadPhysicalDevice(KPDDName);
-	if (rerr != KErrNone && rerr != KErrAlreadyExists)
-		{
-		return rerr;
-		}
-
-	rerr = User::LoadLogicalDevice(KLDDName);	
-	if (rerr != KErrNone && rerr != KErrAlreadyExists)
-		{
-		return rerr;
-		}
-	return KErrNone;	
-	}
-
-
-/**
-Called inside the MainL() function to create and start the test
-@return Instance of the test server
-*/
-CTestServerSymbianExcludeUsb* CTestServerSymbianExcludeUsb::NewL()
-
-	{
-	CTestServerSymbianExcludeUsb* server = new (ELeave) CTestServerSymbianExcludeUsb;
-	CleanupStack::PushL(server);
-	server->ConstructL(KServerName);
-	CleanupStack::Pop(server);
-	return server;
-	}
-
-LOCAL_C void MainL()
-	{
-	CActiveScheduler* sched = new (ELeave) CActiveScheduler;
-	CleanupStack::PushL(sched);
-	CActiveScheduler::Install(sched);
-
-	// this registers the server with the active scheduler and calls SetActive
-	CTestServerSymbianExcludeUsb* server = CTestServerSymbianExcludeUsb::NewL(); 
-
-	// signal to the client that we are ready by
-	// rendevousing process
-	RProcess::Rendezvous(KErrNone);
-	
-	// run the active scheduler
-	sched->Start();
-
-	// clean up
-	delete server;
-	CleanupStack::PopAndDestroy(sched);
-	}
-
-/**
-@return Standard Epoc error code on exit
-*/
-GLDEF_C TInt E32Main()
-	{	
-	TInt rerr = LoadDrivers();
-	if (rerr!=KErrNone)
-		{
-		return rerr;	
-		}
-	
-	__UHEAP_MARK;
-	CTrapCleanup* cleanup = CTrapCleanup::New();
-
-	if (cleanup == NULL)
-		{
-		return KErrNoMemory;
-		}
-
-	TRAPD(err,MainL());
-
-	delete cleanup;
-	__UHEAP_MARKEND;
-	return err;
-	} 
-
-/**
-Implementation of CTestServer pure virtual
-@return A CTestStep derived instance
-*/
-CTestStep* CTestServerSymbianExcludeUsb::CreateTestStep(const TDesC& aStepName)
-	{
-	if ( aStepName==KTestName001 )
-		{
-		return CTestStepUsbRomConfig001::New(*this);
-		}
-	if ( aStepName==KTestName002 )
-		{
-		return CTestStepUsbRomConfig002::New(*this);
-		}
-	if ( aStepName==KTestName003 )
-		{
-		return CTestStepUsbRomConfig003::New(*this);
-		}	
-	if ( aStepName==KTestName004 )
-		{
-		return CTestStepUsbRomConfig004::New(*this);
-		}				
-	return NULL;
-	}
-
-// EOF
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/testdata/UsbRomConfig.ini	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-; 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:
-;
-;
-[UsbIncluded]
-UsbExcluded = False
-
-[UsbExcluded]
-UsbExcluded = True
-
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/xml/UsbRomConfigSuite.xml	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE testSuite SYSTEM "file:///c:/program files/common files/symbian/testSuite.dtd" [ ]>
-
-<testSuite>
-
-	<name>UsbRomConfigSuite</name>
-
-	<testItems>
-		<suite>UsbExcSuite</suite>
-		<suite>UsbIncSuite</suite>
-	</testItems>
-
-	<testExecuteServers>
-		<server>TestServerSymbianExcludeUsb</server>
-	</testExecuteServers>
-
-</testSuite>
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/xml/UsbRomConfigSuite/TestExecuteServers/TestServerSymbianExcludeUsb.xml	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE testExecuteServer SYSTEM "c:\program files\common files\symbian\testExecuteServer.dtd" [ ]>
-
-<testExecuteServer>
-
-	<name>TestServerSymbianExcludeUsb</name>
-
-	<mmpFile>testserversymbianexcludeusb.mmp</mmpFile>
-
-	<bldInfPath>group\bld.inf</bldInfPath>
-
-</testExecuteServer>
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/xml/UsbRomConfigSuite/UsbExcSuite.xml	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE testSuite SYSTEM "file:///c:/program files/common files/symbian/testSuite.dtd" [ ]>
-
-<testSuite>
-
-	<name>UsbExcSuite</name>
-
-	<testItems>
-		<test>UsbRomConfig001</test>
-		<test>UsbRomConfig002</test>
-		<test>UsbRomConfig003</test>
-		<test>UsbRomConfig004</test>
-	</testItems>
-
-</testSuite>
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/xml/UsbRomConfigSuite/UsbExcSuite/UsbRomConfig001.xml	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE testExecuteTest SYSTEM "c:\program files\common files\symbian\testExecuteTest.dtd" [ ]>
-
-<testExecuteTest>
-
-	<name>UsbRomConfig001</name>
-
-	<timeout>30</timeout>
-
-	<testScripts>
-		<script>
-			<hostPath>scripts\USB_ROMCONFIG_001.script</hostPath>
-			<devicePath>c:\scripts\usbromconfig\USB_ROMCONFIG_001.script</devicePath>
-		</script>
-	</testScripts>
-
-	<testServers>
-		<server>TestServerSymbianExcludeUsb</server>
-	</testServers>
-
-	<dependencies>
-		<data>
-			<hostPath>testdata\UsbRomConfig.ini</hostPath>
-			<devicePath>c:\testdata\usbromconfig\UsbRomConfig.ini</devicePath>
-		</data>
-	</dependencies>
-
-</testExecuteTest>
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/xml/UsbRomConfigSuite/UsbExcSuite/UsbRomConfig002.xml	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE testExecuteTest SYSTEM "c:\program files\common files\symbian\testExecuteTest.dtd" [ ]>
-
-<testExecuteTest>
-
-	<name>UsbRomConfig002</name>
-
-	<timeout>30</timeout>
-
-	<testScripts>
-		<script>
-			<hostPath>scripts\USB_ROMCONFIG_002.script</hostPath>
-			<devicePath>c:\scripts\usbromconfig\USB_ROMCONFIG_002.script</devicePath>
-		</script>
-	</testScripts>
-
-	<testServers>
-		<server>TestServerSymbianExcludeUsb</server>
-	</testServers>
-
-	<dependencies>
-		<data>
-			<hostPath>testdata\UsbRomConfig.ini</hostPath>
-			<devicePath>c:\testdata\usbromconfig\UsbRomConfig.ini</devicePath>
-		</data>
-	</dependencies>
-
-</testExecuteTest>
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/xml/UsbRomConfigSuite/UsbExcSuite/UsbRomConfig003.xml	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE testExecuteTest SYSTEM "c:\program files\common files\symbian\testExecuteTest.dtd" [ ]>
-
-<testExecuteTest>
-
-	<name>UsbRomConfig003</name>
-
-	<timeout>30</timeout>
-
-	<testScripts>
-		<script>
-			<hostPath>scripts\USB_ROMCONFIG_003.script</hostPath>
-			<devicePath>c:\scripts\usbromconfig\USB_ROMCONFIG_003.script</devicePath>
-		</script>
-	</testScripts>
-
-	<testServers>
-		<server>TestServerSymbianExcludeUsb</server>
-	</testServers>
-
-	<dependencies>
-		<data>
-			<hostPath>testdata\UsbRomConfig.ini</hostPath>
-			<devicePath>c:\testdata\usbromconfig\UsbRomConfig.ini</devicePath>
-		</data>
-	</dependencies>
-
-</testExecuteTest>
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/xml/UsbRomConfigSuite/UsbExcSuite/UsbRomConfig004.xml	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE testExecuteTest SYSTEM "c:\program files\common files\symbian\testExecuteTest.dtd" [ ]>
-
-<testExecuteTest>
-
-	<name>UsbRomConfig004</name>
-
-	<timeout>30</timeout>
-
-	<testScripts>
-		<script>
-			<hostPath>scripts\USB_ROMCONFIG_004.script</hostPath>
-			<devicePath>c:\scripts\usbromconfig\USB_ROMCONFIG_004.script</devicePath>
-		</script>
-	</testScripts>
-
-	<testServers>
-		<server>TestServerSymbianExcludeUsb</server>
-	</testServers>
-
-	<dependencies>
-		<data>
-			<hostPath>testdata\UsbRomConfig.ini</hostPath>
-			<devicePath>c:\testdata\usbromconfig\UsbRomConfig.ini</devicePath>
-		</data>
-	</dependencies>
-
-</testExecuteTest>
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/xml/UsbRomConfigSuite/UsbIncSuite.xml	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE testSuite SYSTEM "file:///c:/program files/common files/symbian/testSuite.dtd" [ ]>
-
-<testSuite>
-
-	<name>UsbIncSuite</name>
-
-	<testItems>
-		<test>UsbIncRomConfig001</test>
-		<test>UsbIncRomConfig002</test>
-		<test>UsbIncRomConfig003</test>
-		<test>UsbIncRomConfig004</test>
-	</testItems>
-
-</testSuite>
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/xml/UsbRomConfigSuite/UsbIncSuite/UsbIncRomConfig001.xml	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE testExecuteTest SYSTEM "c:\program files\common files\symbian\testExecuteTest.dtd" [ ]>
-
-<testExecuteTest>
-
-	<name>UsbIncRomConfig001</name>
-
-	<timeout>30</timeout>
-
-	<testScripts>
-		<script>
-			<hostPath>scripts\USB_INC_ROMCONFIG_001.script</hostPath>
-			<devicePath>c:\scripts\usbromconfig\USB_INC_ROMCONFIG_001.script</devicePath>
-		</script>
-	</testScripts>
-
-	<testServers>
-		<server>TestServerSymbianExcludeUsb</server>
-	</testServers>
-
-	<dependencies>
-		<data>
-			<hostPath>testdata\UsbRomConfig.ini</hostPath>
-			<devicePath>c:\testdata\usbromconfig\UsbRomConfig.ini</devicePath>
-		</data>
-	</dependencies>
-
-</testExecuteTest>
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/xml/UsbRomConfigSuite/UsbIncSuite/UsbIncRomConfig002.xml	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE testExecuteTest SYSTEM "c:\program files\common files\symbian\testExecuteTest.dtd" [ ]>
-
-<testExecuteTest>
-
-	<name>UsbIncRomConfig002</name>
-
-	<timeout>30</timeout>
-
-	<testScripts>
-		<script>
-			<hostPath>scripts\USB_INC_ROMCONFIG_002.script</hostPath>
-			<devicePath>c:\scripts\usbromconfig\USB_INC_ROMCONFIG_002.script</devicePath>
-		</script>
-	</testScripts>
-
-	<testServers>
-		<server>TestServerSymbianExcludeUsb</server>
-	</testServers>
-
-	<dependencies>
-		<data>
-			<hostPath>testdata\UsbRomConfig.ini</hostPath>
-			<devicePath>c:\testdata\usbromconfig\UsbRomConfig.ini</devicePath>
-		</data>
-	</dependencies>
-
-</testExecuteTest>
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/xml/UsbRomConfigSuite/UsbIncSuite/UsbIncRomConfig003.xml	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE testExecuteTest SYSTEM "c:\program files\common files\symbian\testExecuteTest.dtd" [ ]>
-
-<testExecuteTest>
-
-	<name>UsbIncRomConfig003</name>
-
-	<timeout>30</timeout>
-
-	<testScripts>
-		<script>
-			<hostPath>scripts\USB_INC_ROMCONFIG_003.script</hostPath>
-			<devicePath>c:\scripts\usbromconfig\USB_INC_ROMCONFIG_003.script</devicePath>
-		</script>
-	</testScripts>
-
-	<testServers>
-		<server>TestServerSymbianExcludeUsb</server>
-	</testServers>
-
-	<dependencies>
-		<data>
-			<hostPath>testdata\UsbRomConfig.ini</hostPath>
-			<devicePath>c:\testdata\usbromconfig\UsbRomConfig.ini</devicePath>
-		</data>
-	</dependencies>
-
-</testExecuteTest>
--- a/usbmgmt/usbmgr/test/cit/ROMConfig/xml/UsbRomConfigSuite/UsbIncSuite/UsbIncRomConfig004.xml	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE testExecuteTest SYSTEM "c:\program files\common files\symbian\testExecuteTest.dtd" [ ]>
-
-<testExecuteTest>
-
-	<name>UsbIncRomConfig004</name>
-
-	<timeout>30</timeout>
-
-	<testScripts>
-		<script>
-			<hostPath>scripts\USB_INC_ROMCONFIG_004.script</hostPath>
-			<devicePath>c:\scripts\usbromconfig\USB_INC_ROMCONFIG_004.script</devicePath>
-		</script>
-	</testScripts>
-
-	<testServers>
-		<server>TestServerSymbianExcludeUsb</server>
-	</testServers>
-
-	<dependencies>
-		<data>
-			<hostPath>testdata\UsbRomConfig.ini</hostPath>
-			<devicePath>c:\testdata\usbromconfig\UsbRomConfig.ini</devicePath>
-		</data>
-	</dependencies>
-
-</testExecuteTest>
--- a/usbmgmt/usbmgr/usbman/chargingplugin/group/UsbBatteryChargingPluginBase.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/usbman/chargingplugin/group/UsbBatteryChargingPluginBase.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2005-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"
@@ -44,15 +44,12 @@
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
 // use this line for default implementation
-USERINCLUDE	../inc/default	
+USERINCLUDE	../inc/default 
+USERINCLUDE	../traces	
 
 LIBRARY 		euser.lib 
 LIBRARY 		usbmanextensionplugin.lib 
 LIBRARY			centralrepository.lib
 
-#include <usb/usblogger.mmh>
-
-
-//library	flogger.lib
 
 NOEXPORTLIBRARY
--- a/usbmgmt/usbmgr/usbman/chargingplugin/group/bld.inf	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/usbman/chargingplugin/group/bld.inf	Tue Aug 31 17:01:47 2010 +0300
@@ -20,6 +20,7 @@
 10208DD7.txt				/epoc32/data/z/private/10202be9/10208dd7.txt
 10208DD7.txt				/epoc32/release/winscw/udeb/z/private/10202be9/10208dd7.txt
 10208DD7.txt				/epoc32/release/winscw/urel/z/private/10202be9/10208dd7.txt
+../public/usbchargingpublishedinfo.h                 SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(/)
 
 // ConfML Files
 ../conf/usbmanager_10208dd7.crml	       OS_LAYER_EXPORTS_CRML(usbmanager_10208dd7.crml)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/usbman/chargingplugin/public/usbchargingpublishedinfo.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,195 @@
+/*
+* 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
+    @brief USB charging information header
+    @version 0.2.0
+
+    This header specifies the published information of USB charging plug-in.
+    @publishedPartner
+*/
+
+#ifndef USBCHARGINGPUBLISHEDINFO_H
+#define USBCHARGINGPUBLISHEDINFO_H
+
+#include <e32base.h>
+
+
+/** this is only applicable when charging port is a Standard Downstream Port 
+*/
+enum TUsbConnectionStatus
+    {
+    /** this is the initial value.  */
+    EUsbConnectionStatusNone,
+    
+    /** This status means that this USB device is in suspend state. */
+    EUsbConnectionStatusSuspend,
+    
+    /** This status means that this USB device is in configured state. */
+    EUsbConnectionStatusConfigured
+    };
+
+enum TUsbChargingPortType
+    {
+    /** 
+    * This device is no longer connected to a powered port.
+    * iMinAvailableVbusCurrent, iMaxVbusCurrent and iMinVbusVoltage are 0. 
+    * iUsbConnStatus is EUsbConnectionStatusNone.
+    */
+    EUsbChargingPortTypeNone = 0,
+    
+    /**
+    * This device is connected to a port that can't be recognized.
+    * iMinAvailableVbusCurrent, iMaxVbusCurrent and iMinVbusVoltage are 0. 
+    * iUsbConnStatus is EUsbConnectionStatusNone.
+    */
+    EUsbChargingPortTypeUnsupported,
+    
+    /**
+    * This device is connected to a charging port.
+    * This is not an exact port type and the port may be a dedicated charging port or a charging downstream port. 
+    * For there is more constraint on charging downstream port output, current and voltage are computed according 
+    * to charging downstream port. 
+    * See below for detail.
+    */
+    EUsbChargingPortTypeChargingPort,
+    
+    /**
+    * This device is connected to a dedicated charging port.
+    * iMinAvailableVbusCurrent is 500mA (refer to min IDCHG in table 5-2 of BC1.1).
+    * iMaxVbusCurrent is 1800mA (refer to IDEV_DCHG in table 5-2 of BC1.1). 
+    * iMinVbusVoltage is 2000mV ( refer to VCHG_SHT_DWN in table 5-1 of BC1.1). 
+    * iUsbConnStatus is EUsbConnectionStatusNone. 
+    */
+    EUsbChargingPortTypeDedicatedChargingPort,
+    
+    /**
+    * This device is connected to a charging downstream port.
+    * - If this device works at low speed or full speed mode.
+    *     - iMinAvailableVbusCurrent is 500mA (refer to min IDCHG in table 5-2 of BC1.1).
+    *     - iMaxVbusCurrent is 1500mA (refer to IDEV_HCHG_LFS in table 5-2 of BC1.1). 
+    *     - iMinVbusVoltage is 2000mV (refer to VCHG_SHT_DWN in table 5-1 of BC1.1). 
+    *     - iUsbConnStatus is EUsbConnectionStatusNone. 
+    *
+    * - If this device works at high speed.
+    *     - if USB hardware supports current limit when chirping.
+    *         - iMinAvailableVbusCurrent is 500mA (refer to min IDCHG in table 5-2 of BC1.1).
+    *         - iMaxVbusCurrent is 900mA (refer to IDEV_HCHG_HS in table 5-2 of BC1.1). 
+    *         - iMinVbusVoltage is 2000mV (refer to VCHG_SHT_DWN in table 5-1 of BC1.1). 
+    *         - iUsbConnStatus is EUsbConnectionStatusNone 
+    *     - if USB hardware does not support current limit when chirping
+    *         - iMinAvailableVbusCurrent is 500mA (refer to min IDCHG in table 5-2 of BC1.1).
+    *         - iMaxVbusCurrent is 560mA (refer to IDEV_HCHG_CHRP in table 5-2 of BC1.1).
+    *         - iMinVbusVoltage is 2000mV (refer to VCHG_SHT_DWN in table 5-1 of BC1.1). 
+    *         - iUsbConnStatus is EUsbConnectionStatusNone. 	
+    */
+    EUsbChargingPortTypeChargingDownstreamPort,
+    
+    /** This device is connected to a standard downstream port.
+    * This device negoiates the charging current with standard host by configuration descriptor. There are three numbers of 
+    * milliamps that can be negoiated, 500mA, 100mA and 8mA.  
+    * - if any of the three numbers is acceptted by host.
+    *     - if this device is in configured state.
+    *         - iMinAvailableVbusCurrent and iMaxVbusCurrent are 500mA or 100mA or 8mA. 
+    *         - iUsbConnStatus is EUsbConnectionStatusConfigured.
+    *     - if this device is in suspend state.
+    *         - iMinAvailableVbusCurrent and iMaxVbusCurrent are 2mA (refer to ISUSP in table 5-2 of BC1.1).
+    *         - iUsbConnStatus is EUsbConnectionStatusSuspend.	
+    *     - iMinVbusVoltage is 4500mV in both cases.  4.5 V comes from the port supply requirement 4.75 V with the worst case
+    *     voltage drops for 500 mA current taken into account. That is: 4.75 V - VGNDD - VBUSD = 4.75 V - 0.125 V - 0.125 V = 4.5 V. 
+    *     See Section 7.2.2 Voltage Drop Budget in USB 2.0 spec.
+    *    
+    * - if none of the three numbers is acceptted by host.
+    *     - iMinAvailableVbusCurrent, iMaxVbusCurrent and iMinVbusVoltage are 0 and iUsbConnStatus is EUsbConnectionStatusNone.
+    */
+    EUsbChargingPortTypeStandardDownstreamPort,
+    
+    /** This device is connected to an ACA and ID pin status is RidA. 
+    * When ID pin status is RidA, this device works as A-device and is connected to an ACA. The ACA is connected with a charger 
+    * or a charging downstream port on ACA's charging port and may be connected to a B-device on ACA's accessory port.  
+    * The B-device can draw current from the charger. 
+    * iMinAvailableVbusCurrent is not more than 500mA. This value comes from 500mA (min IDCHG refer to in table 5-2 of BC1.1) minus the current that B-device
+    * can draw. This value is maxpower field of B-device configuration descriptor. If there is no connected B-device, minus 0 from 500mA. 
+    * iMaxVbusCurrent is 1500mA (refer to max IDCHG in table 5-2 of BC1.1). For ACA can't distinguish a charger and a charging downstream
+    * port so we select more contraint output.
+    * iMinVbusVoltage is 2000mV (refer to VCHG_SHT_DWN in table 5-1 of BC1.1). 
+    * iUsbConnStatus is EUsbConnectionStatusNone.
+    */
+    EUsbChargingPortTypeAcaRidA,
+    
+    /** This device is connected to an ACA and ID pin status is RidB
+    * When ID pin status is RidB, this device works as a B-device and is connected to an ACA. The ACA is connected with a charger or a  
+    * charging downstream port on ACA's charging port. ACA may also be connected to A-device on accessory port but A-device VBUS 
+    * powers off. A-device shall not draw current from the accessory port. 
+    * iMinAvailableVbusCurrent is 500mA (refer to min IDCHG in table 5-2 of BC1.1).
+    * iMaxVbusCurrent is 1500mA (refer to max IDCHG in table 5-2 of BC1.1). 
+    * iMinVbusVoltage is 2000mV (refer to VCHG_SHT_DWN in table 5-1 of BC1.1). 
+    * iUsbConnStatus is EUsbConnectionStatusNone.
+    */
+    EUsbChargingPortTypeAcaRidB,
+    
+    /** This device is connected to an ACA and ID pin status is RidC
+    * When ID pin status is RidC, this device work as a B-device and is connected to an ACA. The ACA is connected with a charger or  
+    * a charging downstream port on ACA's charging port and a A-device on accessory port. The A-device VBus powers on. A-device
+    * shall not draw current from accessory port. 
+    * iMinAvailableVbusCurrent is 500mA (refer to min IDCHG in table 5-2 of BC1.1).
+    * iMaxVbusCurrent is 1500mA (refer to max IDCHG in table 5-2 of BC1.1). 
+    * iMinVbusVoltage is 2000mV (refer to VCHG_SHT_DWN in table 5-1 of BC1.1). 
+    * iUsbConnStatus is EUsbConnectionStatusNone.
+    */
+    EUsbChargingPortTypeAcaRidC
+    };
+
+/**    
+* the P&S key category of published charing information.
+*/
+const TUid KPropertyUidUsbBatteryChargingCategory = {0x101fe1db};
+
+/**    
+* the P&S key ID of published charing information.
+*/
+const TUint KPropertyUidUsbBatteryChargingInfo = 1;
+
+/** 
+* the structure of published charing information, data in P&S is a TPckgBuf wrappering this structure  
+*/
+NONSHARABLE_STRUCT(TPublishedUsbChargingInfo)
+    {
+    /** the port type this device connects to. */
+    TUsbChargingPortType  iChargingPortType;
+
+    /** this field is only appliable when this device connects to a standard downstream port. */
+    TUsbConnectionStatus  iUsbConnStatus;
+
+    /**
+    *	This is the number of milliamps in unit 1 mA that can safely be drawn from VBUS 
+    * without needing to observe the VBUS level.
+    */	
+    TUint16 iMinAvailableVbusCurrent;
+
+    /**
+    *	This is the number of milliamps that can be drawn from VBus in unit 1 mA. VBUS Level may drop down and must be monitored
+    * to prevent VBUS Level drop below iMaxVbusCurrent.
+    */
+    TUint16 iMaxVbusCurrent;
+
+    /** VBUS Level must be above this number when charging and this number is in unit 1 mV. */
+    TUint16 iMinVbusVoltage;
+    };
+
+
+#endif // USBCHARGINGPUBLISHEDINFO_H
--- a/usbmgmt/usbmgr/usbman/chargingplugin/src/CUsbBatteryChargingPlugin.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/usbman/chargingplugin/src/CUsbBatteryChargingPlugin.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2005-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"
@@ -18,16 +18,19 @@
 /** @file
 @internalComponent
 */
-
 #include "CUsbBatteryChargingPlugin.h"
-#include "chargingstates.h"
-#include <musbmanextensionpluginobserver.h>
-#include "cusbbatterycharginglicenseehooks.h"
-#include "reenumerator.h"
+#include <e32debug.h> 
+#include <e32def.h>
 #include <usb/usblogger.h>
 #include <e32property.h>
 #include <centralrepository.h>
 #include <usbotgdefs.h>
+#include <musbmanextensionpluginobserver.h>
+
+
+#include "chargingstates.h"
+#include "cusbbatterycharginglicenseehooks.h"
+#include "reenumerator.h"
 
 #ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV          // For host OTG enabled charging plug-in 
 #include "idpinwatcher.h"
@@ -35,15 +38,15 @@
 #endif
 
 #include "vbuswatcher.h"
-#include <e32debug.h> 
-#include <e32def.h>
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "CUsbBatteryChargingPluginTraces.h"
+#endif
+
 
 static const TInt KUsbBatteryChargingConfigurationDescriptorCurrentOffset = 8; // see bMaxPower in section 9.6.3 of USB Spec 2.0
 static const TInt KUsbBatteryChargingCurrentRequestTimeout = 3000000; // 3 seconds
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "USBCHARGE");
-#endif
 
 /**
 Factory function.
@@ -63,8 +66,7 @@
 */
 CUsbBatteryChargingPlugin::~CUsbBatteryChargingPlugin()
     {
-    LOGTEXT(KNullDesC8);
-    LOGTEXT2(_L8(">>CUsbBatteryChargingPlugin::~CUsbBatteryChargingPlugin this = [0x%08x]"), this);
+    OstTraceFunctionEntry1( REF_CUSBBATTERYCHARGINGPLUGIN_CUSBBATTERYCHARGINGPLUGIN_DES_ENTRY, this );
     
     iCurrentValues.Close();
     delete iDeviceReEnumerator;
@@ -99,7 +101,7 @@
 */
 void CUsbBatteryChargingPlugin::ConstructL()
     {
-    LOGTEXT(_L8(">>CUsbBatteryChargingPlugin::ConstructL"));
+   OstTraceFunctionEntry0( REF_CUSBBATTERYCHARGINGPLUGIN_CONSTRUCTL_ENTRY );
    
     // Create state objects
     iPluginStates[EPluginStateIdle] = 
@@ -137,7 +139,8 @@
         }
     else
         {
-        LEAVEL(err);
+        OstTrace1( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_CONSTRUCTL, "CUsbBatteryChargingPlugin::ConstructL;leave with error=%d", err );
+        User::Leave(err );
         }
 
     if(err == KErrNone || err == KErrAlreadyExists)
@@ -151,7 +154,8 @@
         static_cast<void> (RProperty::Delete (
                 KPropertyUidUsbBatteryChargingCategory,
                 KPropertyUidUsbBatteryChargingAvailableCurrent ));
-        LEAVEL(err);
+        OstTrace1( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_CONSTRUCTL_DUP1, "CUsbBatteryChargingPlugin::ConstructL;leave with error=%d", err );
+        User::Leave(err);
         }
     
     err = RProperty::Set(KPropertyUidUsbBatteryChargingCategory,
@@ -166,7 +170,8 @@
         static_cast<void> (RProperty::Delete (
                 KPropertyUidUsbBatteryChargingCategory,
                 KPropertyUidUsbBatteryChargingChargingCurrent ));
-        LEAVEL(err);
+        OstTrace1( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_CONSTRUCTL_DUP2, "CUsbBatteryChargingPlugin::ConstructL;leave with error=%d", err );
+        User::Leave(err );
         }
         
     iRepositoryNotifier = CUsbChargingRepositoryNotifier::NewL (*this,
@@ -201,18 +206,18 @@
     else
         {
         iPluginState = EPluginStateBEndedCableNotPresent;
-        LOGTEXT2(_L8("PluginState => EPluginStateADevice(%d)"), iPluginState);
+        OstTrace1( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_CONSTRUCTL_DUP3, "CUsbBatteryChargingPlugin::ConstructL;PluginState => EPluginStateADevice(%d)", iPluginState );
         }
 
     Observer().RegisterStateObserverL(*this);
 
     iLicenseeHooks = CUsbBatteryChargingLicenseeHooks::NewL();
-    LOGTEXT(_L8("Created licensee specific hooks"));
+    OstTrace0( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_CONSTRUCTL_DUP4, "CUsbBatteryChargingPlugin::ConstructL;Created licensee specific hooks" );
     
     // Set initial recovery state to idle
     PushRecoverState(EPluginStateIdle);
     
-    LOGTEXT(_L8("<<CUsbBatteryChargingPlugin::ConstructL"));
+    OstTraceFunctionExit0( REF_CUSBBATTERYCHARGINGPLUGIN_CONSTRUCTL_EXIT );
     }
 
 // For host OTG enabled charging plug-in
@@ -247,21 +252,32 @@
 */
 void CUsbBatteryChargingPlugin::SetInitialConfigurationL()
     {
-    LOGTEXT(_L8("Setting Initial Configuration"));
+    OstTrace0( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_SETINITIALCONFIGURATIONL, "CUsbBatteryChargingPlugin::SetInitialConfigurationL;Setting Initial Configuration" );
     if (iCurrentValues.Count() > 0)
         {
+        TInt err;
         TInt configDescriptorSize = 0;
-        LEAVEIFERRORL(iLdd.GetConfigurationDescriptorSize(configDescriptorSize));
+        err = iLdd.GetConfigurationDescriptorSize(configDescriptorSize);
+        if(err < 0)
+            {
+            OstTrace1( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_SETINITIALCONFIGURATIONL_DUP1, "CUsbBatteryChargingPlugin::SetInitialConfigurationL;iLdd.GetConfigurationDescriptorSize(configDescriptorSize) with error=%d", err );
+            User::Leave(err);
+            }
         HBufC8* configDescriptor = HBufC8::NewLC(configDescriptorSize);
         TPtr8 ptr(configDescriptor->Des());
 
-        LOGTEXT2(_L8("Getting Configuration Descriptor (size = %d)"),configDescriptorSize);
-        LEAVEIFERRORL(iLdd.GetConfigurationDescriptor(ptr));
+        OstTrace1( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_SETINITIALCONFIGURATIONL_DUP2, "CUsbBatteryChargingPlugin::SetInitialConfigurationL;Getting Configuration Descriptor (size = %d)", configDescriptorSize );
+        err = iLdd.GetConfigurationDescriptor(ptr);
+        if(err < 0)
+            {
+            OstTrace1( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_SETINITIALCONFIGURATIONL_DUP3, "CUsbBatteryChargingPlugin::SetInitialConfigurationL;iLdd.GetConfigurationDescriptor(ptr) with error=%d", err );
+            User::Leave(err);
+            }
 
 // For host OTG enabled charging plug-in
 #ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV
         // Get first power to put in configurator
-        LOGTEXT(_L8("Checking IdPin state:"));
+        OstTrace0( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_SETINITIALCONFIGURATIONL_DUP4, "CUsbBatteryChargingPlugin::SetInitialConfigurationL;Checking IdPin state:" );
         if(iIdPinState == EUsbBatteryChargingIdPinBRole)
 #else
         if (ETrue)
@@ -271,24 +287,29 @@
                 {
                 iCurrentIndexRequested = 0;
                 iRequestedCurrentValue = iCurrentValues[iCurrentIndexRequested];
-                LOGTEXT2(_L8("IdPin state is 0, current set to: %d"), iRequestedCurrentValue);
+                OstTrace1( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_SETINITIALCONFIGURATIONL_DUP5, "CUsbBatteryChargingPlugin::SetInitialConfigurationL;IdPin state is 0, current set to: %d", iRequestedCurrentValue );
                 }
             else
                 {
-                LOGTEXT(_L8("No vailable current found !"));
+                OstTrace0( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_SETINITIALCONFIGURATIONL_DUP6, "CUsbBatteryChargingPlugin::SetInitialConfigurationL;No vailable current found !" );
                 }
             }
         else
             {
             iRequestedCurrentValue = 0;
-            LOGTEXT(_L8("IdPin state is 1, current set to 0"));
+            OstTrace0( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_SETINITIALCONFIGURATIONL_DUP7, "CUsbBatteryChargingPlugin::SetInitialConfigurationL;IdPin state is 1, current set to 0" );
             }
 
         TUint oldCurrentValue = ptr[KUsbBatteryChargingConfigurationDescriptorCurrentOffset] << 1;
         ptr[KUsbBatteryChargingConfigurationDescriptorCurrentOffset] = (iRequestedCurrentValue >> 1);
 
-        LOGTEXT(_L8("Setting Updated Configuration Descriptor"));
-        LEAVEIFERRORL(iLdd.SetConfigurationDescriptor(ptr));
+        OstTrace0( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_SETINITIALCONFIGURATIONL_DUP8, "CUsbBatteryChargingPlugin::SetInitialConfigurationL;Setting Updated Configuration Descriptor" );
+        err = iLdd.SetConfigurationDescriptor(ptr);
+        if(err < 0)
+            {
+            OstTrace1( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_SETINITIALCONFIGURATIONL_DUP9, "CUsbBatteryChargingPlugin::SetInitialConfigurationL;iLdd.SetConfigurationDescriptor(ptr) with error=%d", err );
+            User::Leave(err);
+            }
 
         CleanupStack::PopAndDestroy(configDescriptor); 
         }
@@ -297,19 +318,19 @@
 
 TAny* CUsbBatteryChargingPlugin::GetInterface(TUid aUid)
     {
-    LOGTEXT(KNullDesC8);
-    LOGTEXT3(_L8(">>CUsbBatteryChargingPlugin::GetInterface this = [0x%08x], aUid = 0x%08x"), this, aUid);
+    OstTrace1( TRACE_FLOW, REF_CUSBBATTERYCHARGINGPLUGIN_GETINTERFACE, "CUsbBatteryChargingPlugin::GetInterface;this = [0x%08x]", this );
+    OstTrace1( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_GETINTERFACE_DUP1, "CUsbBatteryChargingPlugin::GetInterface;aUid = 0x%08x", aUid.iUid );
     (void)aUid;
 
     TAny* ret = NULL;
 
-    LOGTEXT2(_L8("<<CUsbBatteryChargingPlugin::GetInterface ret = [0x%08x]"), ret);
+    OstTrace1( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_GETINTERFACE_DUP2, "CUsbBatteryChargingPlugin::GetInterface;ret = [0x%08x]", ret );
     return ret;
     }
 
 void CUsbBatteryChargingPlugin::Panic(TUsbBatteryChargingPanic aPanic)
     {
-    LOGTEXT2(_L8("*** CUsbBatteryChargingPlugin::Panic(%d) ***"),aPanic);
+    OstTrace1( TRACE_FATAL, REF_CUSBBATTERYCHARGINGPLUGIN_PANIC, "CUsbBatteryChargingPlugin::Panic;*** CUsbBatteryChargingPlugin::Panic(%d) ***", aPanic );
     _LIT(KUsbChargingPanic,"USB Charging");
     User::Panic(KUsbChargingPanic, aPanic);
     }
@@ -321,7 +342,7 @@
 
 void CUsbBatteryChargingPlugin::PushRecoverState(TUsbChargingPluginState aRecoverState)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CUSBBATTERYCHARGINGPLUGIN_PUSHRECOVERSTATE_ENTRY );
 
     if((aRecoverState == EPluginStateIdle)||
        (aRecoverState == EPluginStateIdleNegotiated) ||
@@ -330,22 +351,24 @@
         {
         iPluginStateToRecovery = aRecoverState;
         }
+    OstTraceFunctionExit0( REF_CUSBBATTERYCHARGINGPLUGIN_PUSHRECOVERSTATE_EXIT );
     }
 
 TUsbChargingPluginState CUsbBatteryChargingPlugin::PopRecoverState()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CUSBBATTERYCHARGINGPLUGIN_POPRECOVERSTATE_ENTRY );
     
     SetState(iPluginStateToRecovery);
     
     iPluginStateToRecovery = EPluginStateIdle;
     
+    OstTraceFunctionExit0( REF_CUSBBATTERYCHARGINGPLUGIN_POPRECOVERSTATE_EXIT );
     return iPluginStateToRecovery;
     }
 
 TUsbChargingPluginState CUsbBatteryChargingPlugin::SetState(TUsbChargingPluginState aState)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CUSBBATTERYCHARGINGPLUGIN_SETSTATE_ENTRY );
 
     switch (aState)
         {
@@ -371,22 +394,23 @@
             iPluginState = EPluginStateIdle;
             iCurrentState = iPluginStates[EPluginStateIdle];
     
-            LOGTEXT2(_L8(">>CUsbBatteryChargingPlugin::SetState: Invalid new state: aState = %d"), aState);
+            OstTrace1( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_SETSTATE, "CUsbBatteryChargingPlugin::SetState;Invalid new state: aState = %d", aState );
             
             Panic(EUsbBatteryChargingPanicUnexpectedPluginState);
         }
     iPluginState = aState;
     
-    LOGTEXT2(_L8(">>CUsbBatteryChargingPlugin::SetState, New state: aState = %d"), aState);
+    OstTrace1( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_SETSTATE_DUP1, "CUsbBatteryChargingPlugin::SetState;New state: aState=%d", aState );
     
+    OstTraceFunctionExit0( REF_CUSBBATTERYCHARGINGPLUGIN_SETSTATE_EXIT );
     return iPluginState;
     }
 
 void CUsbBatteryChargingPlugin::NegotiateChargingCurrent()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CUSBBATTERYCHARGINGPLUGIN_NEGOTIATECHARGINGCURRENT_ENTRY );
 
-    LOGTEXT2(_L8(">>CUsbBatteryChargingPlugin::StartNegotiation,  iDeviceState = %d"), iDeviceState);
+    OstTrace1( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_NEGOTIATECHARGINGCURRENT, "CUsbBatteryChargingPlugin::NegotiateChargingCurrent;iDeviceState=%d", iDeviceState );
     TRAPD(result, NegotiateNextCurrentValueL());
     if(result == KErrNone)
         {
@@ -394,35 +418,39 @@
         }
     else
         {
-        LOGTEXT2(_L8("Negotiation call failed, iVBusState = 1: result = %d"), result);
+        OstTrace1( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_NEGOTIATECHARGINGCURRENT_DUP1, "CUsbBatteryChargingPlugin::NegotiateChargingCurrent;Negotiation call failed, iVBusState = 1: result = %d", result );
         }
+    OstTraceFunctionExit0( REF_CUSBBATTERYCHARGINGPLUGIN_NEGOTIATECHARGINGCURRENT_EXIT );
     }
 
 void CUsbBatteryChargingPlugin::UsbDeviceStateChange(TInt aLastError,
         TUsbDeviceState aOldState, TUsbDeviceState aNewState)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CUSBBATTERYCHARGINGPLUGIN_USBDEVICESTATECHANGE_ENTRY );
     
     iCurrentState->UsbDeviceStateChange(aLastError, aOldState, aNewState);
+    OstTraceFunctionExit0( REF_CUSBBATTERYCHARGINGPLUGIN_USBDEVICESTATECHANGE_EXIT );
     }
 
 void CUsbBatteryChargingPlugin::HandleRepositoryValueChangedL(const TUid& aRepository, TUint aId, TInt aVal)
     {
-    LOG_FUNC    
+    OstTraceFunctionEntry0( REF_CUSBBATTERYCHARGINGPLUGIN_HANDLEREPOSITORYVALUECHANGEDL_ENTRY );
 
     iCurrentState->HandleRepositoryValueChangedL(aRepository, aId, aVal);
+    OstTraceFunctionExit0( REF_CUSBBATTERYCHARGINGPLUGIN_HANDLEREPOSITORYVALUECHANGEDL_EXIT );
     }
 
 void CUsbBatteryChargingPlugin::DeviceStateTimeout()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CUSBBATTERYCHARGINGPLUGIN_DEVICESTATETIMEOUT_ENTRY );
         
     iCurrentState->DeviceStateTimeout();
+    OstTraceFunctionExit0( REF_CUSBBATTERYCHARGINGPLUGIN_DEVICESTATETIMEOUT_EXIT );
     }
 
 void CUsbBatteryChargingPlugin::NegotiateNextCurrentValueL()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CUSBBATTERYCHARGINGPLUGIN_NEGOTIATENEXTCURRENTVALUEL_ENTRY );
 
     iDeviceStateTimer->Cancel();
     TUint newCurrent = 0;
@@ -454,18 +482,19 @@
     RequestCurrentL(newCurrent);
     iRequestedCurrentValue = newCurrent;
     iPluginState = EPluginStateCurrentNegotiating;
+    OstTraceFunctionExit0( REF_CUSBBATTERYCHARGINGPLUGIN_NEGOTIATENEXTCURRENTVALUEL_EXIT );
     }
 
 void CUsbBatteryChargingPlugin::ResetPlugin()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CUSBBATTERYCHARGINGPLUGIN_RESETPLUGIN_ENTRY );
     
     if((iPluginState != EPluginStateIdle))
         {
         iDeviceStateTimer->Cancel(); // doesn't matter if not running
         iPluginState = EPluginStateIdle;
         iPluginStateToRecovery = EPluginStateIdle;
-        LOGTEXT2(_L8("PluginState => EPluginStateIdle(%d)"),iPluginState);
+        OstTrace1( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_RESETPLUGIN, "CUsbBatteryChargingPlugin::ResetPlugin;PluginState => EPluginStateIdle(%d)", iPluginState );
 
         iRequestedCurrentValue = 0;
         iCurrentIndexRequested = 0;
@@ -473,52 +502,70 @@
         SetNegotiatedCurrent(0);
         TRAP_IGNORE(SetInitialConfigurationL());
         }
+    OstTraceFunctionExit0( REF_CUSBBATTERYCHARGINGPLUGIN_RESETPLUGIN_EXIT );
     }
 
 void CUsbBatteryChargingPlugin::RequestCurrentL(TUint aMilliAmps)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CUSBBATTERYCHARGINGPLUGIN_REQUESTCURRENTL_ENTRY );
     
-    LOGTEXT2(_L8(">>CUsbBatteryChargingPlugin::RequestCurrent aMilliAmps = %d"), aMilliAmps);
+    OstTrace1( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_REQUESTCURRENTL, "CUsbBatteryChargingPlugin::RequestCurrentL;aMilliAmps=%u", aMilliAmps );
 
     if((EPluginStateCurrentNegotiating == iPluginState) && (iRequestedCurrentValue != aMilliAmps))
         {
+        TInt err;
         TInt configDescriptorSize = 0;
-        LEAVEIFERRORL(iLdd.GetConfigurationDescriptorSize(configDescriptorSize));
+        err = iLdd.GetConfigurationDescriptorSize(configDescriptorSize);
+        if(err < 0)
+            {
+            OstTrace1( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_REQUESTCURRENTL_DUP1, "CUsbBatteryChargingPlugin::RequestCurrentL;iLdd.GetConfigurationDescriptorSize(configDescriptorSize) with error=%d", err );
+            User::Leave(err);
+            }
         HBufC8* configDescriptor = HBufC8::NewLC(configDescriptorSize);
         TPtr8 ptr(configDescriptor->Des());
 
-        LOGTEXT2(_L8("Getting Configuration Descriptor (size = %d)"),configDescriptorSize);
-        LEAVEIFERRORL(iLdd.GetConfigurationDescriptor(ptr));
+        OstTrace1( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_REQUESTCURRENTL_DUP2, "CUsbBatteryChargingPlugin::RequestCurrentL;Getting Configuration Descriptor (size = %d)", configDescriptorSize );
+        err = iLdd.GetConfigurationDescriptor(ptr);
+        if(err < 0)
+            {
+            OstTrace1( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_REQUESTCURRENTL_DUP3, "CUsbBatteryChargingPlugin::RequestCurrentL;iLdd.GetConfigurationDescriptor(ptr) with error=%d", err );
+            User::Leave(err);
+            }
 
         // set bMaxPower field. One unit = 2mA, so need to halve aMilliAmps.
-        LOGTEXT3(_L8("Setting bMaxPower to %d mA ( = %d x 2mA units)"),aMilliAmps, (aMilliAmps >> 1));
+        OstTraceExt2( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_REQUESTCURRENTL_DUP4, "CUsbBatteryChargingPlugin::RequestCurrentL;Setting bMaxPower to %u mA ( = %u x 2mA units)", aMilliAmps, aMilliAmps >> 1 );
         TUint oldCurrentValue = ptr[KUsbBatteryChargingConfigurationDescriptorCurrentOffset] << 1;
-        LOGTEXT2(_L8("(old value was %d mA)"), oldCurrentValue);
+        OstTrace1( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_REQUESTCURRENTL_DUP5, "CUsbBatteryChargingPlugin::RequestCurrentL;(old value was %u mA)", oldCurrentValue );
 
         //since the device will force reEnumeration if the value is odd
         aMilliAmps = aMilliAmps & 0xFFFE;    
     
         // to negotiate a new current value, ReEnumerate is needed
-        LOGTEXT(_L8("Forcing ReEnumeration"));
+        OstTrace0( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_REQUESTCURRENTL_DUP6, "CUsbBatteryChargingPlugin::RequestCurrentL;Forcing ReEnumeration" );
         ptr[KUsbBatteryChargingConfigurationDescriptorCurrentOffset] = (aMilliAmps >> 1);
-        LOGTEXT(_L8("Setting Updated Configuration Descriptor"));
-        LEAVEIFERRORL(iLdd.SetConfigurationDescriptor(ptr));
-        LOGTEXT(_L8("Triggering Re-enumeration"));
+        OstTrace0( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_REQUESTCURRENTL_DUP7, "CUsbBatteryChargingPlugin::RequestCurrentL;Setting Updated Configuration Descriptor" );
+        err = iLdd.SetConfigurationDescriptor(ptr);
+        if(err < 0)
+            {
+            OstTrace1( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_REQUESTCURRENTL_DUP8, "CUsbBatteryChargingPlugin::RequestCurrentL;iLdd.SetConfigurationDescriptor(ptr) with err=%d", err );
+            User::Leave(err);
+            }
+        OstTrace0( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_REQUESTCURRENTL_DUP9, "CUsbBatteryChargingPlugin::RequestCurrentL;Triggering Re-enumeration" );
         iDeviceReEnumerator->ReEnumerate();
         
         CleanupStack::PopAndDestroy(configDescriptor); // configDescriptor
         }    
     
     // Always issue a timer as a watchdog to monitor the request progress
-    LOGTEXT2(_L8("Starting timer: %d"), User::NTickCount());
+    OstTrace1( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_REQUESTCURRENTL_DUP10, "CUsbBatteryChargingPlugin::RequestCurrentL;Starting timer: %d", User::NTickCount() );
     iDeviceStateTimer->Cancel();
     iDeviceStateTimer->Start(TTimeIntervalMicroSeconds32(KUsbBatteryChargingCurrentRequestTimeout));
+    OstTraceFunctionExit0( REF_CUSBBATTERYCHARGINGPLUGIN_REQUESTCURRENTL_EXIT );
     }
 
 void CUsbBatteryChargingPlugin::ReadCurrentRequestValuesL()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CUSBBATTERYCHARGINGPLUGIN_READCURRENTREQUESTVALUESL_ENTRY );
     
     CRepository* repository = CRepository::NewLC(KUsbBatteryChargingCentralRepositoryUid);
 
@@ -531,26 +578,27 @@
         TInt value;
         repository->Get(KUsbBatteryChargingCurrentValuesOffset + i, value);
         iCurrentValues.Append(static_cast<TUint>(value));
-        LOGTEXT3(_L8("CurrentValue %d = %dmA"),i,value);
+        OstTraceExt2( TRACE_FLOW, REF_CUSBBATTERYCHARGINGPLUGIN_READCURRENTREQUESTVALUESL, "CUsbBatteryChargingPlugin::ReadCurrentRequestValuesL;CurrentValue %d = %dmA", i, value );
         }
 
     CleanupStack::PopAndDestroy(repository);
+    OstTraceFunctionExit0( REF_CUSBBATTERYCHARGINGPLUGIN_READCURRENTREQUESTVALUESL_EXIT );
     }
 
 void CUsbBatteryChargingPlugin::StartCharging(TUint aMilliAmps)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CUSBBATTERYCHARGINGPLUGIN_STARTCHARGING_ENTRY );
     
-    LOGTEXT2(_L8(">>CUsbBatteryChargingPlugin::StartCharging aMilliAmps = %d"), aMilliAmps);
+    OstTrace1( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_STARTCHARGING, "CUsbBatteryChargingPlugin::StartCharging;aMilliAmps=%u", aMilliAmps );
     
     // do licensee specific functionality (if any)
     iLicenseeHooks->StartCharging(aMilliAmps);
 
-#ifdef __FLOG_ACTIVE
+#ifdef _DEBUG
     TInt err = RProperty::Set(KPropertyUidUsbBatteryChargingCategory,
                 KPropertyUidUsbBatteryChargingChargingCurrent,
                             aMilliAmps);
-    LOGTEXT3(_L8("Set P&S current = %dmA - err = %d"),aMilliAmps,err);
+    OstTraceExt2( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_STARTCHARGING_DUP1, "CUsbBatteryChargingPlugin::StartCharging;Set P&S current = %umA - err = %d", aMilliAmps, err );
 #else
     (void)RProperty::Set(KPropertyUidUsbBatteryChargingCategory,
                 KPropertyUidUsbBatteryChargingChargingCurrent,
@@ -558,91 +606,95 @@
 #endif
 
     SetState(EPluginStateCharging);
+    OstTraceFunctionExit0( REF_CUSBBATTERYCHARGINGPLUGIN_STARTCHARGING_EXIT );
     }
 
 void CUsbBatteryChargingPlugin::StopCharging()
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CUSBBATTERYCHARGINGPLUGIN_STOPCHARGING_ENTRY );
     
     // do licensee specific functionality (if any)
     iLicenseeHooks->StopCharging();
 
-#ifdef __FLOG_ACTIVE
+#ifdef _DEBUG
     TInt err = RProperty::Set(KPropertyUidUsbBatteryChargingCategory,
                                     KPropertyUidUsbBatteryChargingChargingCurrent,
                                     0);
-    LOGTEXT2(_L8("Set P&S current = 0mA - err = %d"),err);
+    OstTrace1( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_STOPCHARGING, "CUsbBatteryChargingPlugin::StopCharging;Set P&S current = 0mA - err = %d", err );
 #else
     (void)RProperty::Set(KPropertyUidUsbBatteryChargingCategory,
                                     KPropertyUidUsbBatteryChargingChargingCurrent,
                                     0);
 #endif
+    OstTraceFunctionExit0( REF_CUSBBATTERYCHARGINGPLUGIN_STOPCHARGING_EXIT );
     }
 
 void CUsbBatteryChargingPlugin::SetNegotiatedCurrent(TUint aMilliAmps)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CUSBBATTERYCHARGINGPLUGIN_SETNEGOTIATEDCURRENT_ENTRY );
     
-    LOGTEXT2(_L8(">>CUsbBatteryChargingPlugin::SetNegotiatedCurrent aMilliAmps = %d"), aMilliAmps);
+    OstTrace1( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_SETNEGOTIATEDCURRENT, "CUsbBatteryChargingPlugin::SetNegotiatedCurrent;aMilliAmps=%u", aMilliAmps );
 
     // Ignore errors - not much we can do if it fails
-#ifdef __FLOG_ACTIVE
+#ifdef _DEBUG
     TInt err = RProperty::Set(KPropertyUidUsbBatteryChargingCategory,
                                     KPropertyUidUsbBatteryChargingAvailableCurrent,
                                     aMilliAmps);
-    LOGTEXT3(_L8("Set P&S current = %dmA - err = %d"),aMilliAmps,err);
+    OstTraceExt2( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_SETNEGOTIATEDCURRENT_DUP1, "CUsbBatteryChargingPlugin::SetNegotiatedCurrent;Set P&S current = %umA - err = %d", aMilliAmps, err );
 #else
     (void)RProperty::Set(KPropertyUidUsbBatteryChargingCategory,
                                     KPropertyUidUsbBatteryChargingAvailableCurrent,
                                     aMilliAmps);
 #endif
+    OstTraceFunctionExit0( REF_CUSBBATTERYCHARGINGPLUGIN_SETNEGOTIATEDCURRENT_EXIT );
     }
 
 
-#ifndef __FLOG_ACTIVE
+#ifndef _DEBUG
 void CUsbBatteryChargingPlugin::LogStateText(TUsbDeviceState /*aState*/)
     {
-    LOG_FUNC
     }
 #else
 void CUsbBatteryChargingPlugin::LogStateText(TUsbDeviceState aState)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CUSBBATTERYCHARGINGPLUGIN_LOGSTATETEXT_ENTRY );
     
     switch (aState)
         {
         case EUsbDeviceStateUndefined:
-            LOGTEXT(_L8(" ***** UNDEFINED *****"));
+            OstTrace0( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_LOGSTATETEXT, "CUsbBatteryChargingPlugin::LogStateText; ***** UNDEFINED *****" );
             break;
         case EUsbDeviceStateDefault:
-            LOGTEXT(_L8(" ***** DEFAULT *****"));
+            OstTrace0( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_LOGSTATETEXT_DUP1, "CUsbBatteryChargingPlugin::LogStateText; ***** DEFAULT *****" );
             break;
         case EUsbDeviceStateAttached:
-            LOGTEXT(_L8(" ***** ATTACHED *****"));
+            OstTrace0( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_LOGSTATETEXT_DUP2, "CUsbBatteryChargingPlugin::LogStateText; ***** ATTACHED *****" );
             break;
         case EUsbDeviceStatePowered:
-            LOGTEXT(_L8(" ***** POWERED *****"));
+            OstTrace0( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_LOGSTATETEXT_DUP3, "CUsbBatteryChargingPlugin::LogStateText; ***** POWERED *****" );
             break;
         case EUsbDeviceStateConfigured:
-            LOGTEXT(_L8(" ***** CONFIGURED *****"));
+            OstTrace0( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_LOGSTATETEXT_DUP4, "CUsbBatteryChargingPlugin::LogStateText; ***** CONFIGURED *****" );
             break;
         case EUsbDeviceStateAddress:
-            LOGTEXT(_L8(" ***** ADDRESS *****"));
+            OstTrace0( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_LOGSTATETEXT_DUP5, "CUsbBatteryChargingPlugin::LogStateText; ***** ADDRESS *****" );
             break;
         case EUsbDeviceStateSuspended:
-            LOGTEXT(_L8(" ***** SUSPENDED *****"));
+            OstTrace0( TRACE_NORMAL, REF_CUSBBATTERYCHARGINGPLUGIN_LOGSTATETEXT_DUP6, "CUsbBatteryChargingPlugin::LogStateText; ***** SUSPENDED *****" );
             break;
         default:
             break;
         }
+    OstTraceFunctionExit0( REF_CUSBBATTERYCHARGINGPLUGIN_LOGSTATETEXT_EXIT );
     }
 #endif
 
 void CUsbBatteryChargingPlugin::MpsoVBusStateChanged(TInt aNewState)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CUSBBATTERYCHARGINGPLUGIN_MPSOVBUSSTATECHANGED_ENTRY );
     
     iCurrentState->MpsoVBusStateChanged(aNewState);
+    OstTraceFunctionExit0( REF_CUSBBATTERYCHARGINGPLUGIN_MPSOVBUSSTATECHANGED_EXIT );
     }
 
 
@@ -650,15 +702,17 @@
 #ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV
 void CUsbBatteryChargingPlugin::MpsoIdPinStateChanged(TInt aValue)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CUSBBATTERYCHARGINGPLUGIN_MPSOIDPINSTATECHANGED_ENTRY );
     
     iCurrentState->MpsoIdPinStateChanged(aValue);
+    OstTraceFunctionExit0( REF_CUSBBATTERYCHARGINGPLUGIN_MPSOIDPINSTATECHANGED_EXIT );
     }
 
 void CUsbBatteryChargingPlugin::MpsoOtgStateChangedL(TUsbOtgState aNewState)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_CUSBBATTERYCHARGINGPLUGIN_MPSOOTGSTATECHANGEDL_ENTRY );
 
     iCurrentState->MpsoOtgStateChangedL(aNewState);
+    OstTraceFunctionExit0( REF_CUSBBATTERYCHARGINGPLUGIN_MPSOOTGSTATECHANGEDL_EXIT );
     }
 #endif
--- a/usbmgmt/usbmgr/usbman/chargingplugin/src/chargingstates.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/usbman/chargingplugin/src/chargingstates.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -20,13 +20,15 @@
 @internalComponent
 */
 
+#include <usb/usblogger.h>
 #include "chargingstates.h"
-#include <usb/usblogger.h>
 #include "reenumerator.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "chargingstatesTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "USBCHARGEStates");
-#endif
+
 
 // Charging plugin base state
 
@@ -35,32 +37,38 @@
 void TUsbBatteryChargingPluginStateBase::UsbServiceStateChange(TInt aLastError,
     TUsbServiceState aOldState, TUsbServiceState aNewState)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_USBSERVICESTATECHANGE_ENTRY );
     
     (void)aLastError;
     (void)aOldState;
     (void)aNewState;
     
     // Not use
+    OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_USBSERVICESTATECHANGE_EXIT );
     }
 
 void TUsbBatteryChargingPluginStateBase::UsbDeviceStateChange(TInt aLastError,
     TUsbDeviceState aOldState, TUsbDeviceState aNewState)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_USBDEVICESTATECHANGE_ENTRY );
     
     (void)aLastError;
     (void)aOldState;
     (void)aNewState;
+    OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_USBDEVICESTATECHANGE_EXIT );
     }
 
 void TUsbBatteryChargingPluginStateBase::HandleRepositoryValueChangedL(
     const TUid& aRepository, TUint aId, TInt aVal)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_HANDLEREPOSITORYVALUECHANGEDL_ENTRY );
     
-    LOGTEXT4(_L8(">>TUsbBatteryChargingPluginStateBase::HandleRepositoryValueChangedL aRepository = 0x%08x, aId = %d, aVal = %d"), aRepository, aId, aVal);
-    LOGTEXT3(_L8("Plugin State = %d, Device State = %d"), iParent.iPluginState, iParent.iDeviceState);
+    OstTraceExt3( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_HANDLEREPOSITORYVALUECHANGEDL, 
+            "TUsbBatteryChargingPluginStateBase::HandleRepositoryValueChangedL;aRepository = 0x%08x;aId=%d;aVal=%d", 
+            aRepository.iUid, aId, (TInt32)aVal );
+    OstTraceExt2( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_HANDLEREPOSITORYVALUECHANGEDL_DUP1, 
+            "TUsbBatteryChargingPluginStateBase::HandleRepositoryValueChangedL;Plugin State = %d, Device State = %d",
+            iParent.iPluginState, iParent.iDeviceState );
     
     if ((aRepository == KUsbBatteryChargingCentralRepositoryUid) &&
             (aId == KUsbBatteryChargingKeyEnabledUserSetting))
@@ -85,12 +93,13 @@
             iParent.SetState(EPluginStateUserDisabled);
             }
         }
+    OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_HANDLEREPOSITORYVALUECHANGEDL_EXIT );
     }
     
 void TUsbBatteryChargingPluginStateBase::DeviceStateTimeout()
     {
-    LOG_FUNC
-    LOGTEXT4(_L8("Time: %d Plugin State = %d, Device State = %d"), User::NTickCount(), iParent.iPluginState, iParent.iDeviceState);
+    OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_DEVICESTATETIMEOUT_ENTRY );
+    OstTraceExt3( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_DEVICESTATETIMEOUT, "TUsbBatteryChargingPluginStateBase::DeviceStateTimeout;Time: %u Plugin State = %d, Device State = %d", User::NTickCount(), (TInt32)iParent.iPluginState, (TInt32)iParent.iDeviceState );
     
     iParent.iDeviceReEnumerator->Cancel(); // cancel re-enumeration AO
     
@@ -99,15 +108,16 @@
         // Should not happen !!! Otherwise, something wrong!!!
         iParent.SetState(EPluginStateIdle);
         }
+    OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_DEVICESTATETIMEOUT_EXIT );
     }
 
 // For host OTG enabled charging plug-in
 #ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV
 void TUsbBatteryChargingPluginStateBase::MpsoIdPinStateChanged(TInt aValue)
     {
-    LOG_FUNC
-    
-    LOGTEXT2(_L8("IdPinState changed => %d"), aValue);
+    OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_MPSOIDPINSTATECHANGED_ENTRY );
+
+    OstTrace1( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_MPSOIDPINSTATECHANGED, "TUsbBatteryChargingPluginStateBase::MpsoIdPinStateChanged;IdPinState changed => %d", aValue );
     
     // Disable charging here when IdPin is present
     // When IdPin disappears (i.e. the phone becomes B-Device), all necessary step are performed 
@@ -127,6 +137,7 @@
             TRAP_IGNORE(iParent.SetInitialConfigurationL());
             iParent.SetState(EPluginStateBEndedCableNotPresent);
             
+            OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_MPSOIDPINSTATECHANGED_EXIT );
             return;
 
         case EUsbBatteryChargingIdPinBRole:
@@ -141,29 +152,32 @@
             iParent.SetState(EPluginStateIdle);
             break;
         }
+    OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_MPSOIDPINSTATECHANGED_EXIT_DUP1 );
     }
 
 void TUsbBatteryChargingPluginStateBase::MpsoOtgStateChangedL(TUsbOtgState aNewState)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_MPSOOTGSTATECHANGEDL_ENTRY );
     
     iParent.iOtgState = aNewState;
     
     // Not use currently
+    OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_MPSOOTGSTATECHANGEDL_EXIT );
     }
 #endif
 
 void TUsbBatteryChargingPluginStateBase::MpsoVBusStateChanged(TInt aNewState)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_MPSOVBUSSTATECHANGED_ENTRY );
     
     if (aNewState == iParent.iVBusState)
         {
-        LOGTEXT2(_L8("Receive VBus State Change notification without any state change: aNewState = %d"), aNewState);
+        OstTrace1( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_MPSOVBUSSTATECHANGED, "TUsbBatteryChargingPluginStateBase::MpsoVBusStateChanged;Receive VBus State Change notification without any state change: aNewState = %d", aNewState );
+        OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_MPSOVBUSSTATECHANGED_EXIT );
         return;//should not happen??
         }
 
-    LOGTEXT3(_L8("VBusState changed from %d to %d"), iParent.iVBusState, aNewState);
+    OstTraceExt2( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_MPSOVBUSSTATECHANGED_DUP1, "TUsbBatteryChargingPluginStateBase::MpsoVBusStateChanged;VBusState changed from %d to %d", iParent.iVBusState, aNewState );
     
     iParent.iVBusState = aNewState;
     if (aNewState == 0) // VBus drop down - we have disconnected from host
@@ -176,6 +190,7 @@
         }
     
     // The handling of VBus on will be down in DeviceStateChanged implicitly
+    OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_MPSOVBUSSTATECHANGED_EXIT_DUP1 );
     }
 
 
@@ -183,7 +198,8 @@
         CUsbBatteryChargingPlugin& aParentStateMachine ): 
         iParent(aParentStateMachine)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_TUSBBATTERYCHARGINGPLUGINSTATEBASE_CONS_ENTRY );
+    OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_TUSBBATTERYCHARGINGPLUGINSTATEBASE_CONS_EXIT );
     }
 
         
@@ -193,15 +209,16 @@
         CUsbBatteryChargingPlugin& aParentStateMachine ) :
     TUsbBatteryChargingPluginStateBase(aParentStateMachine)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATEIDLE_TUSBBATTERYCHARGINGPLUGINSTATEIDLE_CONS_ENTRY );
+    OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEIDLE_TUSBBATTERYCHARGINGPLUGINSTATEIDLE_CONS_EXIT );
     };
 
 void TUsbBatteryChargingPluginStateIdle::UsbDeviceStateChange(
         TInt aLastError, TUsbDeviceState aOldState, TUsbDeviceState aNewState)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATEIDLE_USBDEVICESTATECHANGE_ENTRY );
 
-    LOGTEXT4(_L8(">>TUsbBatteryChargingPluginStateIdle::UsbDeviceStateChange LastError = %d, aOldState = %d, aNewState = %d"), aLastError, aOldState, aNewState);
+    OstTraceExt3( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATEIDLE_USBDEVICESTATECHANGE, "TUsbBatteryChargingPluginStateIdle::UsbDeviceStateChange;aLastError=%d;aOldState=%d;aNewState=%d", aLastError, aOldState, aNewState );
     (void)aLastError;
     (void)aOldState;
     iParent.iDeviceState = aNewState;
@@ -225,6 +242,7 @@
             }
             break;
         }
+    OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEIDLE_USBDEVICESTATECHANGE_EXIT );
     }
     
     
@@ -234,15 +252,16 @@
         CUsbBatteryChargingPlugin& aParentStateMachine ) :
     TUsbBatteryChargingPluginStateBase(aParentStateMachine)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_CONS_ENTRY );
+    OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_CONS_EXIT );
     };
     
 void TUsbBatteryChargingPluginStateCurrentNegotiating::UsbDeviceStateChange(
         TInt aLastError, TUsbDeviceState aOldState, TUsbDeviceState aNewState)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_USBDEVICESTATECHANGE_ENTRY );
 
-    LOGTEXT4(_L8(">>TUsbBatteryChargingPluginStateCurrentNegotiating::UsbDeviceStateChange LastError = %d, aOldState = %d, aNewState = %d"), aLastError, aOldState, aNewState);
+    OstTraceExt3( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_USBDEVICESTATECHANGE, "TUsbBatteryChargingPluginStateCurrentNegotiating::UsbDeviceStateChange;aLastError=%d;aOldState=%d;aNewState=%d", aLastError, aOldState, aNewState );
     (void)aLastError;
     (void)aOldState;
     iParent.iDeviceState = aNewState;
@@ -255,7 +274,7 @@
                 {
                 iParent.iDeviceStateTimer->Cancel();
                 
-                LOGTEXT2(_L8("iParent.iAvailableMilliAmps = %d"),iParent.iAvailableMilliAmps);
+                OstTrace1( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_USBDEVICESTATECHANGE_DUP1, "TUsbBatteryChargingPluginStateCurrentNegotiating::UsbDeviceStateChange;iParent.iAvailableMilliAmps=%d", iParent.iAvailableMilliAmps );
                 iParent.iAvailableMilliAmps = iParent.iRequestedCurrentValue;
                 
                 if(0 != iParent.iRequestedCurrentValue)
@@ -263,7 +282,7 @@
                     // A non-zero value was accepted by host, charging 
                     // can be performed now.
                     iParent.StartCharging(iParent.iAvailableMilliAmps);                     
-                    LOGTEXT2(_L8("PluginState => EPluginStateCharging(%d)"),iParent.iPluginState);
+                    OstTrace1( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_USBDEVICESTATECHANGE_DUP2, "TUsbBatteryChargingPluginStateCurrentNegotiating::UsbDeviceStateChange;PluginState => EPluginStateCharging(%d)", iParent.iPluginState );
                     iParent.SetNegotiatedCurrent(iParent.iAvailableMilliAmps);
                     }
                 else
@@ -271,7 +290,7 @@
                     // Host can only accept 0 charging current
                     // No way to do charging
                     iParent.SetState(EPluginStateNoValidCurrent);
-                    LOGTEXT2(_L8("No more current value to try, iPluginState turned to %d"), iParent.iPluginState);
+                    OstTrace1( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_USBDEVICESTATECHANGE_DUP3, "TUsbBatteryChargingPluginStateCurrentNegotiating::UsbDeviceStateChange;No more current value to try, iPluginState turned to %d", iParent.iPluginState );
                     }
                 }
             
@@ -285,12 +304,13 @@
         default:
             break;
         }
+    OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_USBDEVICESTATECHANGE_EXIT );
     }
 
 void TUsbBatteryChargingPluginStateCurrentNegotiating::DeviceStateTimeout()
     {
-    LOG_FUNC
-    LOGTEXT4(_L8("Time: %d Plugin State = %d, Device State = %d"), User::NTickCount(), iParent.iPluginState, iParent.iDeviceState);
+    OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_DEVICESTATETIMEOUT_ENTRY );
+    OstTraceExt3( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_DEVICESTATETIMEOUT, "TUsbBatteryChargingPluginStateCurrentNegotiating::DeviceStateTimeout;Time: %d Plugin State = %d, Device State = %d", User::NTickCount(), (TInt32)iParent.iPluginState, (TInt32)iParent.iDeviceState );
     
     iParent.iDeviceReEnumerator->Cancel(); // cancel re-enumeration AO
     
@@ -305,6 +325,7 @@
         // Assume it will never happens.
         iParent.SetState(EPluginStateNoValidCurrent);
         }
+    OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_DEVICESTATETIMEOUT_EXIT );
     }
 
 
@@ -315,15 +336,16 @@
         CUsbBatteryChargingPlugin& aParentStateMachine ) :
     TUsbBatteryChargingPluginStateBase(aParentStateMachine)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATECHARGING_TUSBBATTERYCHARGINGPLUGINSTATECHARGING_CONS_ENTRY );
+    OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATECHARGING_TUSBBATTERYCHARGINGPLUGINSTATECHARGING_CONS_EXIT );
     }
 
 void TUsbBatteryChargingPluginStateCharging::UsbDeviceStateChange(
         TInt aLastError, TUsbDeviceState aOldState, TUsbDeviceState aNewState)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATECHARGING_USBDEVICESTATECHANGE_ENTRY );
 
-    LOGTEXT4(_L8(">>TUsbBatteryChargingPluginStateCharging::UsbDeviceStateChange LastError = %d, aOldState = %d, aNewState = %d"), aLastError, aOldState, aNewState);
+    OstTraceExt3( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATECHARGING_USBDEVICESTATECHANGE, "TUsbBatteryChargingPluginStateCharging::UsbDeviceStateChange;aLastError=%d;aOldState=%d;aNewState=%d", aLastError, aOldState, aNewState );
     (void)aLastError;
     (void)aOldState;
     iParent.iDeviceState = aNewState;
@@ -349,6 +371,7 @@
         default:
             break;
         }
+    OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATECHARGING_USBDEVICESTATECHANGE_EXIT );
     }
 
 // Charging plugin negotiated fail state
@@ -358,7 +381,8 @@
         CUsbBatteryChargingPlugin& aParentStateMachine ) :
     TUsbBatteryChargingPluginStateBase(aParentStateMachine)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATENOVALIDCURRENT_TUSBBATTERYCHARGINGPLUGINSTATENOVALIDCURRENT_CONS_ENTRY );
+    OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATENOVALIDCURRENT_TUSBBATTERYCHARGINGPLUGINSTATENOVALIDCURRENT_CONS_EXIT );
     };
 
     
@@ -368,15 +392,16 @@
         CUsbBatteryChargingPlugin& aParentStateMachine ) :
     TUsbBatteryChargingPluginStateBase(aParentStateMachine)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATEIDLENEGOTIATED_TUSBBATTERYCHARGINGPLUGINSTATEIDLENEGOTIATED_CONS_ENTRY );
+    OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEIDLENEGOTIATED_TUSBBATTERYCHARGINGPLUGINSTATEIDLENEGOTIATED_CONS_EXIT );
     };
 
 void TUsbBatteryChargingPluginStateIdleNegotiated::UsbDeviceStateChange(
         TInt aLastError, TUsbDeviceState aOldState, TUsbDeviceState aNewState)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATEIDLENEGOTIATED_USBDEVICESTATECHANGE_ENTRY );
 
-    LOGTEXT4(_L8(">>TUsbBatteryChargingPluginStateIdleNegotiated::UsbDeviceStateChange LastError = %d, aOldState = %d, aNewState = %d"), aLastError, aOldState, aNewState);
+    OstTraceExt3( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATEIDLENEGOTIATED_USBDEVICESTATECHANGE, "TUsbBatteryChargingPluginStateIdleNegotiated::UsbDeviceStateChange;aLastError=%d;aOldState=%d;aNewState=%d", aLastError, aOldState, aNewState );
     (void)aLastError;
     (void)aOldState;
     iParent.iDeviceState = aNewState;
@@ -397,6 +422,7 @@
         default:
             break;
         }
+    OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEIDLENEGOTIATED_USBDEVICESTATECHANGE_EXIT );
     }
  
 // Charging plugin user disabled state
@@ -405,29 +431,32 @@
         CUsbBatteryChargingPlugin& aParentStateMachine ) :
     TUsbBatteryChargingPluginStateBase(aParentStateMachine)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_CONS_ENTRY );
+    OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_CONS_EXIT );
     };
 
 
 void TUsbBatteryChargingPluginStateUserDisabled::UsbDeviceStateChange(
         TInt aLastError, TUsbDeviceState aOldState, TUsbDeviceState aNewState)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_USBDEVICESTATECHANGE_ENTRY );
 
-    LOGTEXT4(_L8(">>TUsbBatteryChargingPluginStateUserDisabled::UsbDeviceStateChange LastError = %d, aOldState = %d, aNewState = %d"), aLastError, aOldState, aNewState);
+    OstTraceExt3( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_USBDEVICESTATECHANGE, "TUsbBatteryChargingPluginStateUserDisabled::UsbDeviceStateChange;aLastError=%d;aOldState=%d;aNewState=%d", aLastError, aOldState, aNewState );
     (void)aLastError;
     (void)aOldState;
     iParent.iDeviceState = aNewState;
     iParent.LogStateText(aNewState);
+    OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_USBDEVICESTATECHANGE_EXIT );
     }
 
 void TUsbBatteryChargingPluginStateUserDisabled::HandleRepositoryValueChangedL(
     const TUid& aRepository, TUint aId, TInt aVal)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_HANDLEREPOSITORYVALUECHANGEDL_ENTRY );
     
-    LOGTEXT4(_L8(">>TUsbBatteryChargingPluginStateUserDisabled::HandleRepositoryValueChangedL aRepository = 0x%08x, aId = %d, aVal = %d"), aRepository, aId, aVal);
-    LOGTEXT3(_L8("Plugin State = %d, Device State = %d"), iParent.iPluginState, iParent.iDeviceState);
+    OstTrace1( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_HANDLEREPOSITORYVALUECHANGEDL, "TUsbBatteryChargingPluginStateUserDisabled::HandleRepositoryValueChangedL;aRepository = 0x%08x", aRepository.iUid );
+    OstTraceExt2( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_HANDLEREPOSITORYVALUECHANGEDL_DUP1, "TUsbBatteryChargingPluginStateUserDisabled::HandleRepositoryValueChangedL;aId=%d;aVal=%d", aId, aVal );
+    OstTraceExt2( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_HANDLEREPOSITORYVALUECHANGEDL_DUP2, "TUsbBatteryChargingPluginStateUserDisabled::HandleRepositoryValueChangedL;iParent.iPluginState=%d;iParent.iDeviceState=%d", iParent.iPluginState, iParent.iDeviceState );
     
     if ((aRepository == KUsbBatteryChargingCentralRepositoryUid) &&
             (aId == KUsbBatteryChargingKeyEnabledUserSetting))
@@ -443,18 +472,19 @@
                 {
                 iParent.StartCharging(iParent.iAvailableMilliAmps); // Go to charing state implicitly
                 }
-            LOGTEXT2(_L8("PluginState => %d"), iParent.iPluginState);
+            OstTrace1( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_HANDLEREPOSITORYVALUECHANGEDL_DUP3, "TUsbBatteryChargingPluginStateUserDisabled::HandleRepositoryValueChangedL;PluginState => %d", iParent.iPluginState );
             }
         }
+    OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_HANDLEREPOSITORYVALUECHANGEDL_EXIT );
     }
 
 // For host OTG enabled charging plug-in
 #ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV
 void TUsbBatteryChargingPluginStateUserDisabled::MpsoIdPinStateChanged(TInt aValue)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_MPSOIDPINSTATECHANGED_ENTRY );
     
-    LOGTEXT2(_L8("IdPinState changed => %d"), aValue);
+    OstTrace1( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_MPSOIDPINSTATECHANGED, "TUsbBatteryChargingPluginStateUserDisabled::MpsoIdPinStateChanged;IdPinState changed => %d", aValue );
     
     // Disable charging here when IdPin is present
     // When IdPin disappears (i.e. the phone becomes B-Device), all necessary step are performed 
@@ -468,6 +498,7 @@
             TRAP_IGNORE(iParent.SetInitialConfigurationL());
             iParent.PushRecoverState(EPluginStateBEndedCableNotPresent);
             
+            OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_MPSOIDPINSTATECHANGED_EXIT );
             return;
 
         case EUsbBatteryChargingIdPinBRole:
@@ -478,21 +509,23 @@
             iParent.SetState(EPluginStateIdle);
             break;
         }
+    OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_MPSOIDPINSTATECHANGED_EXIT_DUP1 );
     }
 
 #endif     
  
 void TUsbBatteryChargingPluginStateUserDisabled::MpsoVBusStateChanged(TInt aNewState)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_MPSOVBUSSTATECHANGED_ENTRY );
     
     if (aNewState == iParent.iVBusState)
         {
-        LOGTEXT2(_L8("Receive VBus State Change notification without any state change: aNewState = %d"), aNewState);
+        OstTrace1( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_MPSOVBUSSTATECHANGED, "TUsbBatteryChargingPluginStateUserDisabled::MpsoVBusStateChanged;Receive VBus State Change notification without any state change: aNewState = %d", aNewState );
+        OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_MPSOVBUSSTATECHANGED_EXIT );
         return;
         }
 
-    LOGTEXT3(_L8("VBusState changed from %d to %d"), iParent.iVBusState, aNewState);
+    OstTraceExt2( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_MPSOVBUSSTATECHANGED_DUP1, "TUsbBatteryChargingPluginStateUserDisabled::MpsoVBusStateChanged;VBusState changed from %d to %d", iParent.iVBusState, aNewState );
     
     iParent.iVBusState = aNewState;
     if (aNewState == 0) // VBus drop down - we have disconnected from host
@@ -505,6 +538,7 @@
         }
     
     // The handling of VBus on will be down in DeviceStateChanged implicitly
+    OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_MPSOVBUSSTATECHANGED_EXIT_DUP1 );
     }
 
 
@@ -514,7 +548,8 @@
         CUsbBatteryChargingPlugin& aParentStateMachine ) :
     TUsbBatteryChargingPluginStateBase(aParentStateMachine)
     {
-    LOG_FUNC
+    OstTraceFunctionEntry0( RES_TUSBBATTERYCHARGINGPLUGINSTATEBENDEDCABLENOTPRESENT_TUSBBATTERYCHARGINGPLUGINSTATEBENDEDCABLENOTPRESENT_CONS_ENTRY );
+    OstTraceFunctionExit0( RES_TUSBBATTERYCHARGINGPLUGINSTATEBENDEDCABLENOTPRESENT_TUSBBATTERYCHARGINGPLUGINSTATEBENDEDCABLENOTPRESENT_CONS_EXIT );
     };
     
     
--- a/usbmgmt/usbmgr/usbman/chargingplugin/src/idpinwatcher.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/usbman/chargingplugin/src/idpinwatcher.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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();
 
--- a/usbmgmt/usbmgr/usbman/chargingplugin/src/otgstatewatcher.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/usbman/chargingplugin/src/otgstatewatcher.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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();
 
--- a/usbmgmt/usbmgr/usbman/chargingplugin/src/vbuswatcher.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/usbman/chargingplugin/src/vbuswatcher.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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();
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/usbman/chargingplugin/traces/OstTraceDefinitions.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,7 @@
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <opensystemtrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/usbman/chargingplugin/traces/fixed_id.definitions	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,192 @@
+#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt.
+[GROUP]TRACE_FATAL=0x81
+[GROUP]TRACE_FLOW=0x8a
+[GROUP]TRACE_NORMAL=0x86
+[TRACE]TRACE_FATAL[0x81]_REF_CUSBBATTERYCHARGINGPLUGIN_PANIC=0x1
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_CONSTRUCTL_ENTRY=0x6a
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_CONSTRUCTL_EXIT=0x6b
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_CUSBBATTERYCHARGINGPLUGIN_DES_ENTRY=0x69
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_DEVICESTATETIMEOUT_ENTRY=0x41
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_DEVICESTATETIMEOUT_EXIT=0x42
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_GETINTERFACE=0x72
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_HANDLEREPOSITORYVALUECHANGEDL_ENTRY=0x3f
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_HANDLEREPOSITORYVALUECHANGEDL_EXIT=0x40
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_LOGSTATETEXT_ENTRY=0x51
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_LOGSTATETEXT_EXIT=0x52
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_MPSOIDPINSTATECHANGED_ENTRY=0x55
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_MPSOIDPINSTATECHANGED_EXIT=0x56
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_MPSOOTGSTATECHANGEDL_ENTRY=0x57
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_MPSOOTGSTATECHANGEDL_EXIT=0x58
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_MPSOVBUSSTATECHANGED_ENTRY=0x53
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_MPSOVBUSSTATECHANGED_EXIT=0x54
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_NEGOTIATECHARGINGCURRENT_ENTRY=0x3b
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_NEGOTIATECHARGINGCURRENT_EXIT=0x3c
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_NEGOTIATENEXTCURRENTVALUEL_ENTRY=0x43
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_NEGOTIATENEXTCURRENTVALUEL_EXIT=0x44
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_POPRECOVERSTATE_ENTRY=0x37
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_POPRECOVERSTATE_EXIT=0x38
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_PUSHRECOVERSTATE_ENTRY=0x35
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_PUSHRECOVERSTATE_EXIT=0x36
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_READCURRENTREQUESTVALUESL=0x6c
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_READCURRENTREQUESTVALUESL_ENTRY=0x49
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_READCURRENTREQUESTVALUESL_EXIT=0x4a
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_REQUESTCURRENTL_ENTRY=0x47
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_REQUESTCURRENTL_EXIT=0x48
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_RESETPLUGIN_ENTRY=0x45
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_RESETPLUGIN_EXIT=0x46
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_SETNEGOTIATEDCURRENT_ENTRY=0x4f
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_SETNEGOTIATEDCURRENT_EXIT=0x50
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_SETSTATE_ENTRY=0x39
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_SETSTATE_EXIT=0x3a
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_STARTCHARGING_ENTRY=0x4b
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_STARTCHARGING_EXIT=0x4c
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_STOPCHARGING_ENTRY=0x4d
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_STOPCHARGING_EXIT=0x4e
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_USBDEVICESTATECHANGE_ENTRY=0x3d
+[TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_USBDEVICESTATECHANGE_EXIT=0x3e
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_DEVICESTATETIMEOUT_ENTRY=0x7
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_DEVICESTATETIMEOUT_EXIT=0x8
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_HANDLEREPOSITORYVALUECHANGEDL_ENTRY=0x5
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_HANDLEREPOSITORYVALUECHANGEDL_EXIT=0x6
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_MPSOIDPINSTATECHANGED_ENTRY=0x9
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_MPSOIDPINSTATECHANGED_EXIT=0xa
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_MPSOIDPINSTATECHANGED_EXIT_DUP1=0xb
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_MPSOOTGSTATECHANGEDL_ENTRY=0xc
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_MPSOOTGSTATECHANGEDL_EXIT=0xd
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_MPSOVBUSSTATECHANGED_ENTRY=0xe
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_MPSOVBUSSTATECHANGED_EXIT=0xf
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_MPSOVBUSSTATECHANGED_EXIT_DUP1=0x10
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_TUSBBATTERYCHARGINGPLUGINSTATEBASE_CONS_ENTRY=0x59
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_TUSBBATTERYCHARGINGPLUGINSTATEBASE_CONS_EXIT=0x5a
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_USBDEVICESTATECHANGE_ENTRY=0x3
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_USBDEVICESTATECHANGE_EXIT=0x4
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_USBSERVICESTATECHANGE_ENTRY=0x1
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_USBSERVICESTATECHANGE_EXIT=0x2
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATECHARGING_TUSBBATTERYCHARGINGPLUGINSTATECHARGING_CONS_ENTRY=0x5f
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATECHARGING_TUSBBATTERYCHARGINGPLUGINSTATECHARGING_CONS_EXIT=0x60
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATECHARGING_USBDEVICESTATECHANGE_ENTRY=0x1f
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATECHARGING_USBDEVICESTATECHANGE_EXIT=0x20
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_DEVICESTATETIMEOUT_ENTRY=0x1b
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_DEVICESTATETIMEOUT_EXIT=0x1c
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_CONS_ENTRY=0x5d
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_CONS_EXIT=0x5e
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_USBDEVICESTATECHANGE_ENTRY=0x19
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_USBDEVICESTATECHANGE_EXIT=0x1a
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEIDLENEGOTIATED_TUSBBATTERYCHARGINGPLUGINSTATEIDLENEGOTIATED_CONS_ENTRY=0x63
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEIDLENEGOTIATED_TUSBBATTERYCHARGINGPLUGINSTATEIDLENEGOTIATED_CONS_EXIT=0x64
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEIDLENEGOTIATED_USBDEVICESTATECHANGE_ENTRY=0x25
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEIDLENEGOTIATED_USBDEVICESTATECHANGE_EXIT=0x26
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEIDLE_TUSBBATTERYCHARGINGPLUGINSTATEIDLE_CONS_ENTRY=0x5b
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEIDLE_TUSBBATTERYCHARGINGPLUGINSTATEIDLE_CONS_EXIT=0x5c
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEIDLE_USBDEVICESTATECHANGE_ENTRY=0x15
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEIDLE_USBDEVICESTATECHANGE_EXIT=0x16
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATENOVALIDCURRENT_TUSBBATTERYCHARGINGPLUGINSTATENOVALIDCURRENT_CONS_ENTRY=0x61
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATENOVALIDCURRENT_TUSBBATTERYCHARGINGPLUGINSTATENOVALIDCURRENT_CONS_EXIT=0x62
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_HANDLEREPOSITORYVALUECHANGEDL_ENTRY=0x2b
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_HANDLEREPOSITORYVALUECHANGEDL_EXIT=0x2c
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_MPSOIDPINSTATECHANGED_ENTRY=0x2d
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_MPSOIDPINSTATECHANGED_EXIT=0x2e
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_MPSOIDPINSTATECHANGED_EXIT_DUP1=0x2f
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_MPSOVBUSSTATECHANGED_ENTRY=0x30
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_MPSOVBUSSTATECHANGED_EXIT=0x31
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_MPSOVBUSSTATECHANGED_EXIT_DUP1=0x32
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_CONS_ENTRY=0x65
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_CONS_EXIT=0x66
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_USBDEVICESTATECHANGE_ENTRY=0x29
+[TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_USBDEVICESTATECHANGE_EXIT=0x2a
+[TRACE]TRACE_FLOW[0x8A]_RES_TUSBBATTERYCHARGINGPLUGINSTATEBENDEDCABLENOTPRESENT_TUSBBATTERYCHARGINGPLUGINSTATEBENDEDCABLENOTPRESENT_CONS_ENTRY=0x67
+[TRACE]TRACE_FLOW[0x8A]_RES_TUSBBATTERYCHARGINGPLUGINSTATEBENDEDCABLENOTPRESENT_TUSBBATTERYCHARGINGPLUGINSTATEBENDEDCABLENOTPRESENT_CONS_EXIT=0x68
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_CONSTRUCTL=0x18
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_CONSTRUCTL_DUP1=0x19
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_CONSTRUCTL_DUP2=0x1a
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_CONSTRUCTL_DUP3=0x1d
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_CONSTRUCTL_DUP4=0x1e
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_GETINTERFACE_DUP1=0x41
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_GETINTERFACE_DUP2=0x42
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_LOGSTATETEXT=0x29
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_LOGSTATETEXT_DUP1=0x2a
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_LOGSTATETEXT_DUP2=0x2b
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_LOGSTATETEXT_DUP3=0x2c
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_LOGSTATETEXT_DUP4=0x2d
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_LOGSTATETEXT_DUP5=0x2e
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_LOGSTATETEXT_DUP6=0x2f
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_NEGOTIATECHARGINGCURRENT=0x33
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_NEGOTIATECHARGINGCURRENT_DUP1=0x34
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_REQUESTCURRENTL=0x36
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_REQUESTCURRENTL_DUP1=0x37
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_REQUESTCURRENTL_DUP10=0x40
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_REQUESTCURRENTL_DUP2=0x38
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_REQUESTCURRENTL_DUP3=0x39
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_REQUESTCURRENTL_DUP4=0x3a
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_REQUESTCURRENTL_DUP5=0x3b
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_REQUESTCURRENTL_DUP6=0x3c
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_REQUESTCURRENTL_DUP7=0x3d
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_REQUESTCURRENTL_DUP8=0x3e
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_REQUESTCURRENTL_DUP9=0x3f
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_RESETPLUGIN=0x35
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_SETINITIALCONFIGURATIONL=0x1f
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_SETINITIALCONFIGURATIONL_DUP1=0x20
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_SETINITIALCONFIGURATIONL_DUP2=0x21
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_SETINITIALCONFIGURATIONL_DUP3=0x22
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_SETINITIALCONFIGURATIONL_DUP4=0x23
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_SETINITIALCONFIGURATIONL_DUP5=0x24
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_SETINITIALCONFIGURATIONL_DUP6=0x25
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_SETINITIALCONFIGURATIONL_DUP7=0x26
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_SETINITIALCONFIGURATIONL_DUP8=0x27
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_SETINITIALCONFIGURATIONL_DUP9=0x28
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_SETNEGOTIATEDCURRENT=0x43
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_SETNEGOTIATEDCURRENT_DUP1=0x44
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_SETSTATE=0x31
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_SETSTATE_DUP1=0x32
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_STARTCHARGING=0x45
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_STARTCHARGING_DUP1=0x46
+[TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_STOPCHARGING=0x47
+[TRACE]TRACE_NORMAL[0x86]_REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_DEVICESTATETIMEOUT=0x3
+[TRACE]TRACE_NORMAL[0x86]_REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_HANDLEREPOSITORYVALUECHANGEDL=0x1
+[TRACE]TRACE_NORMAL[0x86]_REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_HANDLEREPOSITORYVALUECHANGEDL_DUP1=0x2
+[TRACE]TRACE_NORMAL[0x86]_REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_MPSOIDPINSTATECHANGED=0x4
+[TRACE]TRACE_NORMAL[0x86]_REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_MPSOVBUSSTATECHANGED=0x5
+[TRACE]TRACE_NORMAL[0x86]_REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_MPSOVBUSSTATECHANGED_DUP1=0x6
+[TRACE]TRACE_NORMAL[0x86]_REF_TUSBBATTERYCHARGINGPLUGINSTATECHARGING_USBDEVICESTATECHANGE=0xe
+[TRACE]TRACE_NORMAL[0x86]_REF_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_DEVICESTATETIMEOUT=0xd
+[TRACE]TRACE_NORMAL[0x86]_REF_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_USBDEVICESTATECHANGE=0x8
+[TRACE]TRACE_NORMAL[0x86]_REF_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_USBDEVICESTATECHANGE_DUP1=0x9
+[TRACE]TRACE_NORMAL[0x86]_REF_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_USBDEVICESTATECHANGE_DUP2=0xa
+[TRACE]TRACE_NORMAL[0x86]_REF_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_USBDEVICESTATECHANGE_DUP3=0xb
+[TRACE]TRACE_NORMAL[0x86]_REF_TUSBBATTERYCHARGINGPLUGINSTATEIDLENEGOTIATED_USBDEVICESTATECHANGE=0xf
+[TRACE]TRACE_NORMAL[0x86]_REF_TUSBBATTERYCHARGINGPLUGINSTATEIDLE_USBDEVICESTATECHANGE=0x7
+[TRACE]TRACE_NORMAL[0x86]_REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_HANDLEREPOSITORYVALUECHANGEDL=0x11
+[TRACE]TRACE_NORMAL[0x86]_REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_HANDLEREPOSITORYVALUECHANGEDL_DUP1=0x12
+[TRACE]TRACE_NORMAL[0x86]_REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_HANDLEREPOSITORYVALUECHANGEDL_DUP2=0x13
+[TRACE]TRACE_NORMAL[0x86]_REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_HANDLEREPOSITORYVALUECHANGEDL_DUP3=0x14
+[TRACE]TRACE_NORMAL[0x86]_REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_MPSOIDPINSTATECHANGED=0x15
+[TRACE]TRACE_NORMAL[0x86]_REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_MPSOVBUSSTATECHANGED=0x16
+[TRACE]TRACE_NORMAL[0x86]_REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_MPSOVBUSSTATECHANGED_DUP1=0x17
+[TRACE]TRACE_NORMAL[0x86]_REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_USBDEVICESTATECHANGE=0x10
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_GETINTERFACE_DUP1=0x73
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_GETINTERFACE_DUP2=0x74
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_SETNEGOTIATEDCURRENT=0x70
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_SETNEGOTIATEDCURRENT_DUP1=0x71
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_STARTCHARGING=0x6d
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_STARTCHARGING_DUP1=0x6e
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_REF_CUSBBATTERYCHARGINGPLUGIN_STOPCHARGING=0x6f
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_TUSBBATTERYCHARGINGPLUGINSTATEBASE_ENTRY=0x11
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_TUSBBATTERYCHARGINGPLUGINSTATEBASE_EXIT=0x12
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATECHARGING_TUSBBATTERYCHARGINGPLUGINSTATECHARGING_ENTRY=0x1d
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATECHARGING_TUSBBATTERYCHARGINGPLUGINSTATECHARGING_EXIT=0x1e
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_ENTRY=0x17
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_EXIT=0x18
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEIDLENEGOTIATED_TUSBBATTERYCHARGINGPLUGINSTATEIDLENEGOTIATED_ENTRY=0x23
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEIDLENEGOTIATED_TUSBBATTERYCHARGINGPLUGINSTATEIDLENEGOTIATED_EXIT=0x24
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEIDLE_TUSBBATTERYCHARGINGPLUGINSTATEIDLE_ENTRY=0x13
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEIDLE_TUSBBATTERYCHARGINGPLUGINSTATEIDLE_EXIT=0x14
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATENOVALIDCURRENT_TUSBBATTERYCHARGINGPLUGINSTATENOVALIDCURRENT_ENTRY=0x21
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATENOVALIDCURRENT_TUSBBATTERYCHARGINGPLUGINSTATENOVALIDCURRENT_EXIT=0x22
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_ENTRY=0x27
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_EXIT=0x28
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_RES_TUSBBATTERYCHARGINGPLUGINSTATEBENDEDCABLENOTPRESENT_TUSBBATTERYCHARGINGPLUGINSTATEBENDEDCABLENOTPRESENT_ENTRY=0x33
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_RES_TUSBBATTERYCHARGINGPLUGINSTATEBENDEDCABLENOTPRESENT_TUSBBATTERYCHARGINGPLUGINSTATEBENDEDCABLENOTPRESENT_EXIT=0x34
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_REF_CUSBBATTERYCHARGINGPLUGIN_PANIC=0x30
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_HANDLEREPOSITORYVALUECHANGEDL_DUP2=0xc
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]__REF_CUSBBATTERYCHARGINGPLUGIN_CONSTRUCTL_DUP3=0x1b
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]__REF_CUSBBATTERYCHARGINGPLUGIN_CONSTRUCTL_DUP4=0x1c
--- a/usbmgmt/usbmgr/usbman/client/SRC/RUsb.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/usbman/client/SRC/RUsb.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -19,17 +19,20 @@
 #include <usbman.h>
 #include <usb.h>
 #include <e32base.h>
-#include "rusb.h"
-#include <usb/usblogger.h>
-
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "USBMAN");
-#endif
 
 #ifdef __USBMAN_NO_PROCESSES__
 #include <e32math.h>
 #endif
 
+#include <usb/usblogger.h>
+
+#include "rusb.h"
+
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "RUsbTraces.h"
+#endif
+
 
 static TInt StartServer()
 //
@@ -109,7 +112,8 @@
 
 	server.Close();
 	
-	LOGTEXT2(_L8("USB server started successfully: err = %d\n"),err);
+	OstTrace1( TRACE_NORMAL, RUSB_STARTSERVER, "::StartServer;USB server started successfully: err=%d", err );
+	
 
 	return err;
 	}
@@ -121,14 +125,14 @@
 	: iDeviceStatePkg(0), iServiceStatePkg(0), iMessagePkg(0), 
 	  iHostPkg(TDeviceEventInformation())
 	{
-	LOG_LINE
-	LOG_FUNC
+	OstTraceFunctionEntry0( RUSB_RUSB_CONS_ENTRY );
+	OstTraceFunctionExit0( RUSB_RUSB_CONS_EXIT );
 	}
 
 EXPORT_C RUsb::~RUsb()
 	{
-	LOG_LINE
-	LOG_FUNC
+    OstTraceFunctionEntry0( RUSB_RUSB_DES_ENTRY );
+	OstTraceFunctionExit0( RUSB_RUSB_DES_EXIT );
 	}
 
 EXPORT_C TVersion RUsb::Version() const
@@ -138,9 +142,7 @@
 
 EXPORT_C TInt RUsb::Connect()
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( RUSB_CONNECT_ENTRY );
 	TInt retry = 2;
 	
 	FOREVER
@@ -150,11 +152,13 @@
 
 		if ((err != KErrNotFound) && (err != KErrServerTerminated))
 			{
+			OstTraceFunctionExit0( RUSB_CONNECT_EXIT );
 			return err;
 			}
 
 		if (--retry == 0)
 			{
+			OstTraceFunctionExit0( RUSB_CONNECT_EXIT_DUP1 );
 			return err;
 			}
 
@@ -162,6 +166,7 @@
 
 		if ((err != KErrNone) && (err != KErrAlreadyExists))
 			{
+			OstTraceFunctionExit0( RUSB_CONNECT_EXIT_DUP2 );
 			return err;
 			}
 		}
@@ -169,149 +174,134 @@
 
 EXPORT_C void RUsb::Start(TRequestStatus& aStatus)
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( RUSB_START_ENTRY );
+	
 	SendReceive(EUsbStart, aStatus);
+	OstTraceFunctionExit0( RUSB_START_EXIT );
 	}
 
 EXPORT_C void RUsb::StartCancel()
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( RUSB_STARTCANCEL_ENTRY );
 	SendReceive(EUsbStartCancel);
+	OstTraceFunctionExit0( RUSB_STARTCANCEL_EXIT );
 	}
 
 EXPORT_C void RUsb::Stop()
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( RUSB_STOP_ENTRY );
 	SendReceive(EUsbStop);
+	OstTraceFunctionExit0( RUSB_STOP_EXIT );
 	}
 
 EXPORT_C void RUsb::Stop(TRequestStatus& aStatus)
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( RUSB_STOP_TREQUESTSTATUS_ENTRY );
 	SendReceive(EUsbStop, aStatus);
+	OstTraceFunctionExit0( RUSB_STOP_TREQUESTSTATUS_EXIT );
 	}
 
 EXPORT_C void RUsb::StopCancel()
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( RUSB_STOPCANCEL_ENTRY );
 	SendReceive(EUsbStopCancel);
+	OstTraceFunctionExit0( RUSB_STOPCANCEL_EXIT );
 	}
 
 EXPORT_C TInt RUsb::GetServiceState(TUsbServiceState& aState)
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( RUSB_GETSERVICESTATE_ENTRY );
 	TPckg<TUint32> pkg(aState);
 	TInt ret=SendReceive(EUsbGetCurrentState, TIpcArgs(&pkg));
 	aState=(TUsbServiceState)pkg();
+	OstTraceFunctionExit0( RUSB_GETSERVICESTATE_EXIT );
 	return ret;
 	}
 
 EXPORT_C TInt RUsb::GetCurrentState(TUsbServiceState& aState)
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( RUSB_GETCURRENTSTATE_ENTRY );
 	return GetServiceState(aState);
 	}
 
 EXPORT_C void RUsb::ServiceStateNotification(TUsbServiceState& aState,
 	TRequestStatus& aStatus)
 	{
-	LOG_LINE
-	LOG_FUNC
+	OstTraceFunctionEntry0( RUSB_SERVICESTATENOTIFICATION_ENTRY );
 
 	iServiceStatePkg.Set((TUint8*)&aState, sizeof(TUint32), sizeof(TUint32));
 
 	SendReceive(EUsbRegisterServiceObserver, TIpcArgs(&iServiceStatePkg), aStatus);
+	OstTraceFunctionExit0( RUSB_SERVICESTATENOTIFICATION_EXIT );
 	}
 
 EXPORT_C void RUsb::ServiceStateNotificationCancel()
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( RUSB_SERVICESTATENOTIFICATIONCANCEL_ENTRY );
 	SendReceive(EUsbCancelServiceObserver);
+	OstTraceFunctionExit0( RUSB_SERVICESTATENOTIFICATIONCANCEL_EXIT );
 	}
 
 EXPORT_C TInt RUsb::GetDeviceState(TUsbDeviceState& aState)
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( RUSB_GETDEVICESTATE_ENTRY );
 	TPckg<TUint32> pkg(aState);
 	TInt ret=SendReceive(EUsbGetCurrentDeviceState, TIpcArgs(&pkg));
 	aState=(TUsbDeviceState)pkg();
+	OstTraceFunctionExit0( RUSB_GETDEVICESTATE_EXIT );
 	return ret;
 	}
 
 EXPORT_C void RUsb::DeviceStateNotification(TUint aEventMask, TUsbDeviceState& aState,
 											TRequestStatus& aStatus)
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( RUSB_DEVICESTATENOTIFICATION_ENTRY );
 	iDeviceStatePkg.Set((TUint8*)&aState, sizeof(TUint32), sizeof(TUint32));
 
 	SendReceive(EUsbRegisterObserver, TIpcArgs(aEventMask, &iDeviceStatePkg), aStatus);
+	OstTraceFunctionExit0( RUSB_DEVICESTATENOTIFICATION_EXIT );
 	}
 
 EXPORT_C void RUsb::DeviceStateNotificationCancel()
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( RUSB_DEVICESTATENOTIFICATIONCANCEL_ENTRY );
 	SendReceive(EUsbCancelObserver);
+	OstTraceFunctionExit0( RUSB_DEVICESTATENOTIFICATIONCANCEL_EXIT );
 	}
 
 EXPORT_C void RUsb::StateNotification(TUint aEventMask, TUsbDeviceState& aState, TRequestStatus& aStatus)
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( RUSB_STATENOTIFICATION_ENTRY );
 	DeviceStateNotification(aEventMask, aState, aStatus);
+	OstTraceFunctionExit0( RUSB_STATENOTIFICATION_EXIT );
 	}
 
 EXPORT_C void RUsb::StateNotificationCancel()
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( RUSB_STATENOTIFICATIONCANCEL_ENTRY );
 	DeviceStateNotificationCancel();
+	OstTraceFunctionExit0( RUSB_STATENOTIFICATIONCANCEL_EXIT );
 	}
 	
 EXPORT_C void RUsb::TryStart(TInt aPersonalityId, TRequestStatus& aStatus)
 	{
-	LOG_LINE
-	LOG_FUNC
+	OstTraceFunctionEntry0( RUSB_TRYSTART_ENTRY );
 
 	TIpcArgs ipcArgs(aPersonalityId);
 	SendReceive(EUsbTryStart, ipcArgs, aStatus);
+	OstTraceFunctionExit0( RUSB_TRYSTART_EXIT );
 	}
 
 EXPORT_C void RUsb::TryStop(TRequestStatus& aStatus)
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( RUSB_TRYSTOP_ENTRY );
 	SendReceive(EUsbTryStop, aStatus);
+	OstTraceFunctionExit0( RUSB_TRYSTOP_EXIT );
 	}
 	
 EXPORT_C TInt RUsb::CancelInterest(TUsbReqType aMessageId)
 	{
-	LOG_LINE
-	LOG_FUNC
+	OstTraceFunctionEntry0( RUSB_CANCELINTEREST_ENTRY );
 
 	TInt messageId;
 	switch (aMessageId)
@@ -338,9 +328,7 @@
 
 EXPORT_C TInt RUsb::GetDescription(TInt aPersonalityId, HBufC*& aLocalizedPersonalityDescriptor)
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( RUSB_GETDESCRIPTION_ENTRY );
 	TInt ret = KErrNone;
 	// caller is responsible for freeing up memory allocatd for aLocalizedPersonalityDescriptor
 	TRAP(ret, aLocalizedPersonalityDescriptor = HBufC::NewL(KUsbStringDescStringMaxSize));
@@ -357,31 +345,31 @@
 		aLocalizedPersonalityDescriptor = NULL;
 		}
 
+	OstTraceFunctionExit0( RUSB_GETDESCRIPTION_EXIT );
 	return ret;	
 	}
 	
 EXPORT_C TInt RUsb::GetCurrentPersonalityId(TInt& aPersonalityId)
 	{
-	LOG_LINE
-	LOG_FUNC
+	OstTraceFunctionEntry0( RUSB_GETCURRENTPERSONALITYID_ENTRY );
 
 	TPckg<TInt> pkg0(aPersonalityId);
 	TInt ret = SendReceive(EUsbGetCurrentPersonalityId, TIpcArgs(&pkg0));
 	aPersonalityId = static_cast<TInt>(pkg0());
+	OstTraceFunctionExit0( RUSB_GETCURRENTPERSONALITYID_EXIT );
 	return ret;	
 	}
 
 EXPORT_C TInt RUsb::GetSupportedClasses(TInt aPersonalityId, RArray<TUid>& aClassUids)
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( RUSB_GETSUPPORTEDCLASSES_ENTRY );
 	TInt ret = KErrNone;
 	HBufC8* buf = NULL;
 	// +1 for the actual count of personality ids
 	TRAP(ret, buf = HBufC8::NewL((KUsbMaxSupportedClasses + 1)*sizeof (TInt32)));
 	if (ret != KErrNone)
 		{
+		OstTraceFunctionExit0( RUSB_GETSUPPORTEDCLASSES_EXIT );
 		return ret;
 		}
 
@@ -394,6 +382,7 @@
 		if (!recvedIds)
 			{
 			delete buf;
+			OstTraceFunctionExit0( RUSB_GETSUPPORTEDCLASSES_EXIT_DUP1 );
 			return KErrCorrupt;
 			}
 			
@@ -432,13 +421,13 @@
 		}
 		
 	delete buf;
+	OstTraceFunctionExit0( RUSB_GETSUPPORTEDCLASSES_EXIT_DUP2 );
 	return ret;
 	}
 	
 EXPORT_C TInt RUsb::ClassSupported(TInt aPersonalityId, TUid aClassUid, TBool& aSupported)
 	{
-	LOG_LINE
-	LOG_FUNC
+	OstTraceFunctionEntry0( RUSB_CLASSSUPPORTED_ENTRY );
 
 	TPckg<TInt32>  	pkg2(aSupported);
 	TIpcArgs ipcArgs(aPersonalityId, aClassUid.iUid, &pkg2);
@@ -450,20 +439,20 @@
 		aSupported = static_cast<TBool>(pkg2());		
 		}
 		
+	OstTraceFunctionExit0( RUSB_CLASSSUPPORTED_EXIT );
 	return ret;
 	}
 	
 EXPORT_C TInt RUsb::GetPersonalityIds(RArray<TInt>& aPersonalityIds)
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( RUSB_GETPERSONALITYIDS_ENTRY );
 	TInt ret = KErrNone;
 	HBufC8* buf = NULL;
 	// +1 for the actual count of personality ids
 	TRAP(ret, buf = HBufC8::NewL((KUsbMaxSupportedPersonalities + 1)*sizeof (TInt)));
 	if (ret != KErrNone)
 		{
+		OstTraceFunctionExit0( RUSB_GETPERSONALITYIDS_EXIT );
 		return ret;
 		}
 
@@ -476,6 +465,7 @@
 		if (!recvedIds)
 			{
 			delete buf;
+			OstTraceFunctionExit0( RUSB_GETPERSONALITYIDS_EXIT_DUP1 );
 			return KErrCorrupt;
 			}
 			
@@ -515,6 +505,7 @@
 		}
 		
 	delete buf;
+	OstTraceFunctionExit0( RUSB_GETPERSONALITYIDS_EXIT_DUP2 );
 	return ret;
 	}
 	
@@ -567,14 +558,14 @@
 	}
 
 EXPORT_C void panic()
-	{
-	_USB_PANIC(KUsbCliPncCat, EUsbPanicRemovedExport);
+    { 
+    OstTrace1( TRACE_FATAL, RUSB_PANIC, "::panic;Panic reason=%d", EUsbPanicRemovedExport );
+    User::Panic(KUsbCliPncCat, EUsbPanicRemovedExport);
 	}
 
 EXPORT_C TInt RUsb::SetCtlSessionMode(TBool aValue)
 	{
-	LOG_LINE
-	LOG_FUNC
+	OstTraceFunctionEntry0( RUSB_SETCTLSESSIONMODE_ENTRY );
 
 	TPckg<TBool> pkg(aValue);
 	return SendReceive(EUsbSetCtlSessionMode, TIpcArgs(&pkg));
@@ -582,94 +573,82 @@
 
 EXPORT_C TInt RUsb::BusRequest()
 	{
-	LOG_LINE
-	LOG_FUNC
+	OstTraceFunctionEntry0( RUSB_BUSREQUEST_ENTRY );
 
 	return SendReceive(EUsbBusRequest);
 	}
 
 EXPORT_C TInt RUsb::BusRespondSrp()
 	{
-	LOG_LINE
-	LOG_FUNC
+	OstTraceFunctionEntry0( RUSB_BUSRESPONDSRP_ENTRY );
 
 	return SendReceive(EUsbBusRespondSrp);
 	}
 
 EXPORT_C TInt RUsb::BusClearError()
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( RUSB_BUSCLEARERROR_ENTRY );
 	return SendReceive(EUsbBusClearError);
 	}
 
 
 EXPORT_C TInt RUsb::BusDrop()
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( RUSB_BUSDROP_ENTRY );
 	return SendReceive(EUsbBusDrop);
 	}
 
 EXPORT_C void RUsb::MessageNotification(TRequestStatus& aStatus, TInt& aMessage)
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( RUSB_MESSAGENOTIFICATION_ENTRY );
 	iMessagePkg.Set((TUint8*)&aMessage, sizeof(TInt), sizeof(TInt));
 
 	SendReceive(EUsbRegisterMessageObserver, TIpcArgs(&iMessagePkg), aStatus);
+	OstTraceFunctionExit0( RUSB_MESSAGENOTIFICATION_EXIT );
 	}
 
 EXPORT_C void RUsb::MessageNotificationCancel()
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( RUSB_MESSAGENOTIFICATIONCANCEL_ENTRY );
 	SendReceive(EUsbCancelMessageObserver);
+	OstTraceFunctionExit0( RUSB_MESSAGENOTIFICATIONCANCEL_EXIT );
 	}
 
 EXPORT_C void RUsb::HostEventNotification(TRequestStatus& aStatus,
 										  TDeviceEventInformation& aDeviceInformation)
 	{
-	LOG_LINE
-	LOG_FUNC
+	OstTraceFunctionEntry0( RUSB_HOSTEVENTNOTIFICATION_ENTRY );
 
 	iHostPkg.Set((TUint8*)&aDeviceInformation, sizeof(TDeviceEventInformation), sizeof(TDeviceEventInformation));
 
 	SendReceive(EUsbRegisterHostObserver, TIpcArgs(&iHostPkg), aStatus);
+	OstTraceFunctionExit0( RUSB_HOSTEVENTNOTIFICATION_EXIT );
 	}
 	
 EXPORT_C void RUsb::HostEventNotificationCancel()
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( RUSB_HOSTEVENTNOTIFICATIONCANCEL_ENTRY );
 	SendReceive(EUsbCancelHostObserver);
+	OstTraceFunctionExit0( RUSB_HOSTEVENTNOTIFICATIONCANCEL_EXIT );
 	}
 
 EXPORT_C TInt RUsb::EnableFunctionDriverLoading()
 	{
-	LOG_LINE
-	LOG_FUNC
+	OstTraceFunctionEntry0( RUSB_ENABLEFUNCTIONDRIVERLOADING_ENTRY );
 
 	return SendReceive(EUsbEnableFunctionDriverLoading);
 	}
 
 EXPORT_C void RUsb::DisableFunctionDriverLoading()
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( RUSB_DISABLEFUNCTIONDRIVERLOADING_ENTRY );
 	SendReceive(EUsbDisableFunctionDriverLoading);
+	OstTraceFunctionExit0( RUSB_DISABLEFUNCTIONDRIVERLOADING_EXIT );
 	}
 
 EXPORT_C TInt RUsb::GetSupportedLanguages(TUint aDeviceId, RArray<TUint>& aLangIds)
 	{
-	LOG_LINE
-	LOG_FUNC
+	OstTraceFunctionEntry0( RUSB_GETSUPPORTEDLANGUAGES_ENTRY );
 
 	aLangIds.Reset();
 
@@ -679,6 +658,7 @@
 	TRAP(ret, buf = HBufC8::NewL((KUsbMaxSupportedLanguageIds + 1)*sizeof (TUint)));
 	if (ret != KErrNone)
 		{
+		OstTraceFunctionExit0( RUSB_GETSUPPORTEDLANGUAGES_EXIT );
 		return ret;
 		}
 
@@ -691,6 +671,7 @@
 		if (!recvedIds)
 			{
 			delete buf;
+			OstTraceFunctionExit0( RUSB_GETSUPPORTEDLANGUAGES_EXIT_DUP1 );
 			return KErrCorrupt;
 			}
 			
@@ -708,30 +689,26 @@
 		}
 		
 	delete buf;	
+	OstTraceFunctionExit0( RUSB_GETSUPPORTEDLANGUAGES_EXIT_DUP2 );
 	return ret;
 	}
 	
 EXPORT_C TInt RUsb::GetManufacturerStringDescriptor(TUint aDeviceId, TUint aLangId, TName& aString)
 	{
-	LOG_LINE
-	LOG_FUNC
+	OstTraceFunctionEntry0( RUSB_GETMANUFACTURERSTRINGDESCRIPTOR_ENTRY );
 
 	return SendReceive(EUsbGetManufacturerStringDescriptor, TIpcArgs(aDeviceId, aLangId, &aString));
 	}
 
 EXPORT_C TInt RUsb::GetProductStringDescriptor(TUint aDeviceId, TUint aLangId, TName& aString)
 	{
-	LOG_LINE
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( RUSB_GETPRODUCTSTRINGDESCRIPTOR_ENTRY );
 	return SendReceive(EUsbGetProductStringDescriptor, TIpcArgs(aDeviceId, aLangId, &aString));
 	}
 
 EXPORT_C TInt RUsb::GetOtgDescriptor(TUint aDeviceId, TOtgDescriptor& aDescriptor)
 	{
-	LOG_LINE
-	LOG_FUNC
-		
+	OstTraceFunctionEntry0( RUSB_GETOTGDESCRIPTOR_ENTRY );
 	TPckg<TOtgDescriptor> otgDescPkg(aDescriptor);
 	
 	TIpcArgs args;
@@ -744,40 +721,22 @@
 
 EXPORT_C TInt RUsb::RequestSession()
 	{
-	LOG_LINE
-	LOG_FUNC
+	OstTraceFunctionEntry0( RUSB_REQUESTSESSION_ENTRY );
 
 	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; 
+	OstTraceFunctionEntry0( RUSB_GETDETAILEDDESCRIPTION_ENTRY );
+	//This API has been deprecated
+	OstTraceFunctionExit0( RUSB_GETDETAILEDDESCRIPTION_EXIT );
+	return KErrNotSupported; 
 	}
 
 EXPORT_C TInt RUsb::GetPersonalityProperty(TInt aPersonalityId, TUint32& aProperty)
 	{
-	LOG_LINE
-	LOG_FUNC
+	OstTraceFunctionEntry0( RUSB_GETPERSONALITYPROPERTY_ENTRY );
 
 	TPckg<TUint32> pkg(aProperty);
 	TInt ret = SendReceive(EUsbGetPersonalityProperty, TIpcArgs(aPersonalityId, &pkg));
@@ -785,6 +744,7 @@
 		{
 		aProperty = static_cast<TUint32>(pkg());
 		}
+	OstTraceFunctionExit0( RUSB_GETPERSONALITYPROPERTY_EXIT );
 	return ret;	
 	}
 
--- a/usbmgmt/usbmgr/usbman/client/group/Usbman.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/usbman/client/group/Usbman.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -34,14 +34,14 @@
 sourcepath		../SRC
 source			RUsb.cpp
 
-userinclude		../../server/public
+userinclude     ../../server/public
+userinclude     ../traces 
+
 
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
 library			euser.lib
 
-#include <usb/usblogger.mmh>
-
 VENDORID 0x70000001
 
 UNPAGED
--- a/usbmgmt/usbmgr/usbman/client/group/Usbman_over_dummyusbdi.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/usbman/client/group/Usbman_over_dummyusbdi.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -38,12 +38,11 @@
 source			RUsb.cpp
 
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
-userinclude		../../server/public
+userinclude		../../server/public 
+userinclude		../traces
 
 library			euser.lib
 
-#include <usb/usblogger.mmh>
-
 VENDORID 0x70000001
 
 UNPAGED
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/usbman/client/traces/OstTraceDefinitions.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,7 @@
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <opensystemtrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/usbman/client/traces/fixed_id.definitions	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,107 @@
+#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt.
+[GROUP]TRACE_FATAL=0x81
+[GROUP]TRACE_FLOW=0x8a
+[GROUP]TRACE_NORMAL=0x86
+[TRACE]TRACE_FATAL[0x81]_RUSB_PANIC=0x1
+[TRACE]TRACE_FLOW[0x8A]_RUSB_BUSCLEARERROR_ENTRY=0x3a
+[TRACE]TRACE_FLOW[0x8A]_RUSB_BUSDROP_ENTRY=0x3b
+[TRACE]TRACE_FLOW[0x8A]_RUSB_BUSREQUEST_ENTRY=0x38
+[TRACE]TRACE_FLOW[0x8A]_RUSB_BUSRESPONDSRP_ENTRY=0x39
+[TRACE]TRACE_FLOW[0x8A]_RUSB_CANCELINTEREST_ENTRY=0x28
+[TRACE]TRACE_FLOW[0x8A]_RUSB_CLASSSUPPORTED_ENTRY=0x31
+[TRACE]TRACE_FLOW[0x8A]_RUSB_CLASSSUPPORTED_EXIT=0x32
+[TRACE]TRACE_FLOW[0x8A]_RUSB_CONNECT_ENTRY=0x5
+[TRACE]TRACE_FLOW[0x8A]_RUSB_CONNECT_EXIT=0x6
+[TRACE]TRACE_FLOW[0x8A]_RUSB_CONNECT_EXIT_DUP1=0x7
+[TRACE]TRACE_FLOW[0x8A]_RUSB_CONNECT_EXIT_DUP2=0x8
+[TRACE]TRACE_FLOW[0x8A]_RUSB_DEVICESTATENOTIFICATIONCANCEL_ENTRY=0x1e
+[TRACE]TRACE_FLOW[0x8A]_RUSB_DEVICESTATENOTIFICATIONCANCEL_EXIT=0x1f
+[TRACE]TRACE_FLOW[0x8A]_RUSB_DEVICESTATENOTIFICATION_ENTRY=0x1c
+[TRACE]TRACE_FLOW[0x8A]_RUSB_DEVICESTATENOTIFICATION_EXIT=0x1d
+[TRACE]TRACE_FLOW[0x8A]_RUSB_DISABLEFUNCTIONDRIVERLOADING_ENTRY=0x45
+[TRACE]TRACE_FLOW[0x8A]_RUSB_DISABLEFUNCTIONDRIVERLOADING_EXIT=0x46
+[TRACE]TRACE_FLOW[0x8A]_RUSB_ENABLEFUNCTIONDRIVERLOADING_ENTRY=0x44
+[TRACE]TRACE_FLOW[0x8A]_RUSB_GETCURRENTPERSONALITYID_ENTRY=0x2b
+[TRACE]TRACE_FLOW[0x8A]_RUSB_GETCURRENTPERSONALITYID_EXIT=0x2c
+[TRACE]TRACE_FLOW[0x8A]_RUSB_GETCURRENTSTATE_ENTRY=0x15
+[TRACE]TRACE_FLOW[0x8A]_RUSB_GETDESCRIPTION_ENTRY=0x29
+[TRACE]TRACE_FLOW[0x8A]_RUSB_GETDESCRIPTION_EXIT=0x2a
+[TRACE]TRACE_FLOW[0x8A]_RUSB_GETDETAILEDDESCRIPTION_ENTRY=0x4f
+[TRACE]TRACE_FLOW[0x8A]_RUSB_GETDETAILEDDESCRIPTION_EXIT=0x50
+[TRACE]TRACE_FLOW[0x8A]_RUSB_GETDEVICESTATE_ENTRY=0x1a
+[TRACE]TRACE_FLOW[0x8A]_RUSB_GETDEVICESTATE_EXIT=0x1b
+[TRACE]TRACE_FLOW[0x8A]_RUSB_GETMANUFACTURERSTRINGDESCRIPTOR_ENTRY=0x4b
+[TRACE]TRACE_FLOW[0x8A]_RUSB_GETOTGDESCRIPTOR_ENTRY=0x4d
+[TRACE]TRACE_FLOW[0x8A]_RUSB_GETPERSONALITYIDS_ENTRY=0x33
+[TRACE]TRACE_FLOW[0x8A]_RUSB_GETPERSONALITYIDS_EXIT=0x34
+[TRACE]TRACE_FLOW[0x8A]_RUSB_GETPERSONALITYIDS_EXIT_DUP1=0x35
+[TRACE]TRACE_FLOW[0x8A]_RUSB_GETPERSONALITYIDS_EXIT_DUP2=0x36
+[TRACE]TRACE_FLOW[0x8A]_RUSB_GETPERSONALITYPROPERTY_ENTRY=0x51
+[TRACE]TRACE_FLOW[0x8A]_RUSB_GETPERSONALITYPROPERTY_EXIT=0x52
+[TRACE]TRACE_FLOW[0x8A]_RUSB_GETPRODUCTSTRINGDESCRIPTOR_ENTRY=0x4c
+[TRACE]TRACE_FLOW[0x8A]_RUSB_GETSERVICESTATE_ENTRY=0x13
+[TRACE]TRACE_FLOW[0x8A]_RUSB_GETSERVICESTATE_EXIT=0x14
+[TRACE]TRACE_FLOW[0x8A]_RUSB_GETSUPPORTEDCLASSES_ENTRY=0x2d
+[TRACE]TRACE_FLOW[0x8A]_RUSB_GETSUPPORTEDCLASSES_EXIT=0x2e
+[TRACE]TRACE_FLOW[0x8A]_RUSB_GETSUPPORTEDCLASSES_EXIT_DUP1=0x2f
+[TRACE]TRACE_FLOW[0x8A]_RUSB_GETSUPPORTEDCLASSES_EXIT_DUP2=0x30
+[TRACE]TRACE_FLOW[0x8A]_RUSB_GETSUPPORTEDLANGUAGES_ENTRY=0x47
+[TRACE]TRACE_FLOW[0x8A]_RUSB_GETSUPPORTEDLANGUAGES_EXIT=0x48
+[TRACE]TRACE_FLOW[0x8A]_RUSB_GETSUPPORTEDLANGUAGES_EXIT_DUP1=0x49
+[TRACE]TRACE_FLOW[0x8A]_RUSB_GETSUPPORTEDLANGUAGES_EXIT_DUP2=0x4a
+[TRACE]TRACE_FLOW[0x8A]_RUSB_HOSTEVENTNOTIFICATIONCANCEL_ENTRY=0x42
+[TRACE]TRACE_FLOW[0x8A]_RUSB_HOSTEVENTNOTIFICATIONCANCEL_EXIT=0x43
+[TRACE]TRACE_FLOW[0x8A]_RUSB_HOSTEVENTNOTIFICATION_ENTRY=0x40
+[TRACE]TRACE_FLOW[0x8A]_RUSB_HOSTEVENTNOTIFICATION_EXIT=0x41
+[TRACE]TRACE_FLOW[0x8A]_RUSB_MESSAGENOTIFICATIONCANCEL_ENTRY=0x3e
+[TRACE]TRACE_FLOW[0x8A]_RUSB_MESSAGENOTIFICATIONCANCEL_EXIT=0x3f
+[TRACE]TRACE_FLOW[0x8A]_RUSB_MESSAGENOTIFICATION_ENTRY=0x3c
+[TRACE]TRACE_FLOW[0x8A]_RUSB_MESSAGENOTIFICATION_EXIT=0x3d
+[TRACE]TRACE_FLOW[0x8A]_RUSB_REQUESTSESSION_ENTRY=0x4e
+[TRACE]TRACE_FLOW[0x8A]_RUSB_RUSB_CONS_ENTRY=0x53
+[TRACE]TRACE_FLOW[0x8A]_RUSB_RUSB_CONS_EXIT=0x54
+[TRACE]TRACE_FLOW[0x8A]_RUSB_RUSB_DES_ENTRY=0x55
+[TRACE]TRACE_FLOW[0x8A]_RUSB_RUSB_DES_EXIT=0x56
+[TRACE]TRACE_FLOW[0x8A]_RUSB_SERVICESTATENOTIFICATIONCANCEL_ENTRY=0x18
+[TRACE]TRACE_FLOW[0x8A]_RUSB_SERVICESTATENOTIFICATIONCANCEL_EXIT=0x19
+[TRACE]TRACE_FLOW[0x8A]_RUSB_SERVICESTATENOTIFICATION_ENTRY=0x16
+[TRACE]TRACE_FLOW[0x8A]_RUSB_SERVICESTATENOTIFICATION_EXIT=0x17
+[TRACE]TRACE_FLOW[0x8A]_RUSB_SETCTLSESSIONMODE_ENTRY=0x37
+[TRACE]TRACE_FLOW[0x8A]_RUSB_STARTCANCEL_ENTRY=0xb
+[TRACE]TRACE_FLOW[0x8A]_RUSB_STARTCANCEL_EXIT=0xc
+[TRACE]TRACE_FLOW[0x8A]_RUSB_START_ENTRY=0x9
+[TRACE]TRACE_FLOW[0x8A]_RUSB_START_EXIT=0xa
+[TRACE]TRACE_FLOW[0x8A]_RUSB_STATENOTIFICATIONCANCEL_ENTRY=0x22
+[TRACE]TRACE_FLOW[0x8A]_RUSB_STATENOTIFICATIONCANCEL_EXIT=0x23
+[TRACE]TRACE_FLOW[0x8A]_RUSB_STATENOTIFICATION_ENTRY=0x20
+[TRACE]TRACE_FLOW[0x8A]_RUSB_STATENOTIFICATION_EXIT=0x21
+[TRACE]TRACE_FLOW[0x8A]_RUSB_STOPCANCEL_ENTRY=0x11
+[TRACE]TRACE_FLOW[0x8A]_RUSB_STOPCANCEL_EXIT=0x12
+[TRACE]TRACE_FLOW[0x8A]_RUSB_STOP_ENTRY=0xd
+[TRACE]TRACE_FLOW[0x8A]_RUSB_STOP_EXIT=0xe
+[TRACE]TRACE_FLOW[0x8A]_RUSB_STOP_TREQUESTSTATUS_ENTRY=0x57
+[TRACE]TRACE_FLOW[0x8A]_RUSB_STOP_TREQUESTSTATUS_EXIT=0x58
+[TRACE]TRACE_FLOW[0x8A]_RUSB_TRYSTART_ENTRY=0x24
+[TRACE]TRACE_FLOW[0x8A]_RUSB_TRYSTART_EXIT=0x25
+[TRACE]TRACE_FLOW[0x8A]_RUSB_TRYSTOP_ENTRY=0x26
+[TRACE]TRACE_FLOW[0x8A]_RUSB_TRYSTOP_EXIT=0x27
+[TRACE]TRACE_NORMAL[0x86]_RUSB_STARTSERVER=0xd
+[[OBSOLETE]][TRACE]TRACE_ERROR[0x82]_RUSB_MESSAGENOTIFICATION_DUP6=0x1
+[[OBSOLETE]][TRACE]TRACE_ERROR[0x82]_RUSB_MESSAGENOTIFICATION_DUP9=0x2
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_RUSB_RUSB_ENTRY=0x1
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_RUSB_RUSB_ENTRY_DUP1=0x3
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_RUSB_RUSB_EXIT=0x2
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_RUSB_RUSB_EXIT_DUP1=0x4
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_RUSB_STOP_ENTRY_DUP1=0xf
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_RUSB_STOP_EXIT_DUP1=0x10
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_RUSB_MESSAGENOTIFICATION=0x2
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_RUSB_MESSAGENOTIFICATION_DUP1=0x9
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_RUSB_MESSAGENOTIFICATION_DUP11=0xb
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_RUSB_MESSAGENOTIFICATION_DUP2=0x3
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_RUSB_MESSAGENOTIFICATION_DUP3=0x5
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_RUSB_MESSAGENOTIFICATION_DUP4=0x7
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_RUSB_MESSAGENOTIFICATION_DUP5=0x8
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_RUSB_MESSAGENOTIFICATION_DUP7=0xa
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_RUSB_MESSAGENOTIFICATION_DUP8=0x6
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]__PANIC=0xc
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]__STARTSERVER=0x1
--- a/usbmgmt/usbmgr/usbman/server/INC/CPersonality.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/usbman/server/INC/CPersonality.h	Tue Aug 31 17:01:47 2010 +0300
@@ -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 <e32std.h>
 #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<CPersonalityConfigurations::TUsbClasses>& Classes() const;
+    void AppendClassesL(const TUsbClasses& aClasses );
+    ~CPersonalityConfigurations();
+    
+private: 
+    TInt                        iPersonalityId; /*Personality Id*/
+    TInt                        iConfigId; /*Configuration Id*/
+    RArray<TUsbClasses>         iClasses; /*Class array*/
+    };
+
 NONSHARABLE_CLASS(CPersonality) : public CBase
 	{
 public:
 	static CPersonality* NewL();
 	~CPersonality();
 
-	TInt PersonalityId() const;
-	const RArray<TUid>& 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<CPersonalityConfigurations::TUsbClasses>& 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<CPersonalityConfigurations>& PersonalityConfigs() const;
+    void AppendPersonalityConfigsL(const CPersonalityConfigurations *aPersonalityConfig );
     
 private:
 	CPersonality();
 	void ConstructL();
-
+ 
 private:
-	// personality id
-	TInt								iId;
-	// USB class ids
-	RArray<TUid>						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<CPersonalityConfigurations>   iPersonalityConfigs;  
 	};
 
+
+
 #include "CPersonality.inl"
 	
 #endif // __CPERSONALITY_H__
--- a/usbmgmt/usbmgr/usbman/server/INC/CPersonality.inl	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/usbman/server/INC/CPersonality.inl	Tue Aug 31 17:01:47 2010 +0300
@@ -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<TUid>& 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<CPersonalityConfigurations>& CPersonality::PersonalityConfigs() const
+    {
+    return iPersonalityConfigs;
+    }
+
+
+/**
+ * @internalComponent
+ * @return a const to Classes
+ */
+inline const RArray<CPersonalityConfigurations::TUsbClasses> & CPersonalityConfigurations::Classes() const
+    {
+    return iClasses;
+    }
+
 #endif // __PERSONALITY_INL__
 
--- a/usbmgmt/usbmgr/usbman/server/INC/CUsbDevice.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/usbman/server/INC/CUsbDevice.h	Tue Aug 31 17:01:47 2010 +0300
@@ -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 <usb/usblogger.h>
 #include <musbmanextensionpluginobserver.h>
 
+
+
 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<TUint>& aUidArray);
 	
 public: // From CActive
 	void RunL();
@@ -137,22 +152,20 @@
 
 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<TUid>& aClassUids);
-	void ConvertUidsL(const TDesC& aStr, RArray<TUint>& aUidArray);
 	TInt PowerUpAndConnect();	
-#ifdef __FLOG_ACTIVE
+#ifdef _DEBUG
 	void PrintDescriptor(CUsbDevice::TUsbDeviceDescriptor& aDeviceDescriptor);
 #endif
 	void InstantiateExtensionPluginsL();
 private:
 	RPointerArray<CUsbClassControllerBase> iSupportedClasses;
-	RPointerArray<MUsbDeviceNotify> iObservers;
+	RPointerArray<MUsbDeviceNotify> iObservers; 
 	RPointerArray<CUsbmanExtensionPlugin> iExtensionPlugins;
 	TUsbDeviceState  iDeviceState;
 	TUsbServiceState iServiceState;
@@ -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!
 	};
--- a/usbmgmt/usbmgr/usbman/server/INC/CUsbSession.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/usbman/server/INC/CUsbSession.h	Tue Aug 31 17:01:47 2010 +0300
@@ -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);         
 
--- a/usbmgmt/usbmgr/usbman/server/INC/UsbSettings.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/usbman/server/INC/UsbSettings.h	Tue Aug 31 17:01:47 2010 +0300
@@ -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__
--- a/usbmgmt/usbmgr/usbman/server/INC/UsbmanServerSecurityPolicy.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/usbman/server/INC/UsbmanServerSecurityPolicy.h	Tue Aug 31 17:01:47 2010 +0300
@@ -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 */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/usbman/server/INC/usbmancenrepmanager.h	Tue Aug 31 17:01:47 2010 +0300
@@ -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 <e32base.h>
+
+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<CPersonality>& 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*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/usbman/server/INC/usbmanprivatecrkeys.h	Tue Aug 31 17:01:47 2010 +0300
@@ -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
--- a/usbmgmt/usbmgr/usbman/server/SRC/CPersonality.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/usbman/server/SRC/CPersonality.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -22,43 +22,50 @@
 */
 
 #include "CPersonality.h"
-#include <usb/usblogger.h>
+
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "CPersonalityTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "USBSVR");
+// 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. 
  *
  * @return a pointer to CPersonality object.
  */
 CPersonality* CPersonality::NewL()
 	{
-	LOG_STATIC_FUNC_ENTRY
+	OstTraceFunctionEntry0( CPERSONALITY_NEWL_ENTRY );
 
 	CPersonality* self = new(ELeave) CPersonality;
 	CleanupStack::PushL(self);
 	self->ConstructL();
 	CleanupStack::Pop(self);
+	OstTraceFunctionExit0( CPERSONALITY_NEWL_EXIT );
 	return self;
 	}
 
 /**
- * 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();
+	OstTraceFunctionEntry0( CPERSONALITY_CONSTRUCTL_ENTRY );
+	iDescription	= HBufC::NewL(KUsbStringDescStringMaxSize);
+	OstTraceFunctionExit0( CPERSONALITY_CONSTRUCTL_EXIT );
 	}
 	
 /**
@@ -73,62 +80,49 @@
  */
 CPersonality::~CPersonality()
 	{
-	LOG_FUNC
-
-	iClassUids.Close();
-	delete iManufacturer;
-	delete iProduct;
+	OstTraceFunctionEntry0( CPERSONALITY_CPERSONALITY_DES_ENTRY );
+	
+	iPersonalityConfigs.ResetAndDestroy();
 	delete iDescription;
-	delete iDetailedDescription;
-	}
-
-/**
- * @return the index of the first match or KErrNotFound
- */
-TInt CPersonality::ClassSupported(TUid aClassUid) const
-	{
-	TIdentityRelation<TUid> relation(CPersonality::Compare);
-	return iClassUids.Find(aClassUid, relation);
-	}
-
-/**
- * @return KErrNone or system wide error code
- */	
-TInt CPersonality::AddSupportedClasses(TUid aClassUid)
-	{
-	return iClassUids.Append(aClassUid);
+	OstTraceFunctionExit0( CPERSONALITY_CPERSONALITY_DES_EXIT );
 	}
 
 /**
- * Sets personality id
+ * @return supported class uids
  */
-void CPersonality::SetId(TInt aId)
-	{
-	iId = aId;
-	}
+const RArray<CPersonalityConfigurations::TUsbClasses>& CPersonality::SupportedClasses() const
+    {
+    //we only support configuration 0 now
+    if(iPersonalityConfigs.Count() == 0)
+        {
+        OstTrace1( TRACE_FATAL, CPERSONALITY_SUPPORTEDCLASSES, "CPersonality::SupportedClasses;Panic error=%d", EPersonalityConfigsArrayEmpty );
+        __ASSERT_DEBUG( EFalse, User::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
+    if(iPersonalityConfigs.Count() == 0)
+        {
+        OstTrace1( TRACE_FATAL, CPERSONALITY_CLASSSUPPORTED, "CPersonality::ClassSupported;Panic error=%d", EPersonalityConfigsArrayEmpty );
+        __ASSERT_DEBUG( EFalse, User::Panic(KUsbPersonalityPanicCategory, EPersonalityConfigsArrayEmpty) );
+        }
+    const RArray<CPersonalityConfigurations::TUsbClasses> &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 +136,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 +150,118 @@
 	{
 	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()
+    {
+    OstTraceFunctionEntry0( CPERSONALITYCONFIGURATIONS_CPERSONALITYCONFIGURATIONS_DES_ENTRY );
+    iClasses.Close();
+    OstTraceFunctionExit0( CPERSONALITYCONFIGURATIONS_CPERSONALITYCONFIGURATIONS_DES_EXIT );
+    }
--- a/usbmgmt/usbmgr/usbman/server/SRC/CUsbDevice.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/usbman/server/SRC/CUsbDevice.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -20,41 +20,42 @@
 /**
  @file
 */
-
-#include "CUsbDevice.h"
-#include "CUsbDeviceStateWatcher.h"
 #include <cusbclasscontrolleriterator.h>
-#include "MUsbDeviceNotify.h"
-#include "UsbSettings.h"
-#include "CUsbServer.h"
 #include <cusbclasscontrollerbase.h>
 #include <cusbclasscontrollerplugin.h>
-#include "UsbUtils.h"
 #include <cusbmanextensionplugin.h>
-
-#ifdef USE_DUMMY_CLASS_CONTROLLER
-#include "CUsbDummyClassController.h"
-#endif
-
 #include <bafl/sysutil.h>
 #include <usb/usblogger.h>
 #include <e32svr.h>
 #include <e32base.h>
 #include <e32std.h>
-#include <usbman.rsg>
 #include <f32file.h>
 #include <barsc.h>
 #include <barsread.h>
 #include <bautils.h>
 #include <e32property.h> //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"
+
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "CUsbDeviceTraces.h"
+#endif
+
 
 _LIT(KUsbLDDName, "eusbc"); //Name used in call to User::LoadLogicalDevice
 _LIT(KUsbLDDFreeName, "Usbc"); //Name used in call to User::FreeLogicalDevice
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "USBSVR");
-#endif
 
 // Panic category only used in debug builds
 #ifdef _DEBUG
@@ -82,12 +83,13 @@
  * @return	A new CUsbDevice object
  */
 	{
-	LOG_STATIC_FUNC_ENTRY
+    OstTraceFunctionEntry0( CUSBDEVICE_NEWL_ENTRY );
 
 	CUsbDevice* r = new (ELeave) CUsbDevice(aUsbServer);
 	CleanupStack::PushL(r);
 	r->ConstructL();
 	CleanupStack::Pop(r);
+	OstTraceFunctionExit0( CUSBDEVICE_NEWL_EXIT );
 	return r;
 	}
 
@@ -97,7 +99,7 @@
  * Destructor.
  */
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry0( CUSBDEVICE_CUSBDEVICE_DES_ENTRY );
 
 	// Cancel any outstanding asynchronous operation.
 	Cancel();
@@ -108,6 +110,11 @@
 	iSupportedClassUids.Close();
 
 	iExtensionPlugins.ResetAndDestroy();
+	
+	delete iCenRepManager;
+	
+	delete  iDeviceConfiguration.iManufacturerName;
+	delete  iDeviceConfiguration.iProductName;  
 
 	if(iEcom)
 		iEcom->Close();
@@ -118,24 +125,29 @@
 	// the observers themselves.
 	iObservers.Reset();
 
+#ifndef __OVER_DUMMYUSBDI__
 #ifndef __WINS__
-	LOGTEXT2(_L8("about to delete device state watcher @ %08x"), (TUint32) iDeviceStateWatcher);
+	OstTrace1( TRACE_NORMAL, CUSBDEVICE_CUSBDEVICE, "CUsbDevice::~CUsbDevice;about to delete device state watcher @ %08x", (TUint32)iDeviceStateWatcher );
+	
 	delete iDeviceStateWatcher;
-	LOGTEXT(_L8("deleted device state watcher"));
+	OstTrace0( TRACE_NORMAL, CUSBDEVICE_CUSBDEVICE_DUP1, "CUsbDevice::~CUsbDevice;deleted device state watcher" );
 
 	iLdd.Close();
 
-	LOGTEXT(_L8("Freeing logical device"));
+	OstTrace0( TRACE_NORMAL, CUSBDEVICE_CUSBDEVICE_DUP2, "CUsbDevice::~CUsbDevice;Freeing logical device" );
+	
 	TInt err = User::FreeLogicalDevice(KUsbLDDFreeName);
 	//Putting the LOGTEXT2 inside the if statement prevents a compiler
 	//warning about err being unused in UREL builds.
 	if(err)
 		{
-		LOGTEXT2(_L8("     User::FreeLogicalDevice returned %d"),err);
+        OstTrace1( TRACE_NORMAL, CUSBDEVICE_CUSBDEVICE_DUP3, "CUsbDevice::~CUsbDevice; User::FreeLogicalDevice returned err=%d", err );
 		}
+#endif
 #endif	
 
 	delete iDefaultSerialNumber;
+	OstTraceFunctionExit0( CUSBDEVICE_CUSBDEVICE_DES_EXIT );
 	}
 
 
@@ -158,24 +170,36 @@
  * Performs 2nd phase construction of the USB device.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDEVICE_CONSTRUCTL_ENTRY );
 	
 	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"));
+	OstTrace0( TRACE_NORMAL, CUSBDEVICE_CONSTRUCTL, "CUsbDevice::ConstructL; About to load LDD" );
+	
 	TInt err = User::LoadLogicalDevice(KUsbLDDName);
 
 	if (err != KErrNone && err != KErrAlreadyExists)
 		{
-		LEAVEL(err);
+        OstTrace1( TRACE_NORMAL, CUSBDEVICE_CONSTRUCTL_DUP10, "CUsbDevice::ConstructL;err=%d", err );
+		User::Leave(err);
 		}
 
-	LOGTEXT(_L8("About to open LDD"));
-	LEAVEIFERRORL(iLdd.Open(0));
-	LOGTEXT(_L8("LDD opened"));
+	OstTrace0( TRACE_NORMAL, CUSBDEVICE_CONSTRUCTL_DUP1, "CUsbDevice::ConstructL; About to open LDD" );	
+	err = iLdd.Open(0);
+	if(err < 0)
+	    {
+        OstTrace1( TRACE_NORMAL, CUSBDEVICE_CONSTRUCTL_DUP9, "CUsbDevice::ConstructL;iLdd.Open(0) with error=%d", err );
+        User::Leave(err);
+	    }
+	OstTrace0( TRACE_NORMAL, CUSBDEVICE_CONSTRUCTL_DUP2, "CUsbDevice::ConstructL; LDD opened" );
+	
 	
 	// hide bus from host while interfaces are being set up
 	iLdd.DeviceDisconnectFromHost();
@@ -186,21 +210,33 @@
 	// the device state is not undefined. This is to save power in the UDC 
 	// when there's no point it being powered.
 	TUsbDeviceCaps devCapsBuf;
-	LEAVEIFERRORL(iLdd.DeviceCaps(devCapsBuf));
+	err = iLdd.DeviceCaps(devCapsBuf);
+	if(err < 0)
+	    {
+        OstTrace1( TRACE_NORMAL, CUSBDEVICE_CONSTRUCTL_DUP11, "CUsbDevice::ConstructL;iLdd.DeviceCaps(devCapsBuf) with error=%d", err );
+        User::Leave(err);
+	    }
+	
 	if ( devCapsBuf().iFeatureWord1 & KUsbDevCapsFeatureWord1_CableDetectWithoutPower )
 		{
-		LOGTEXT(_L8("\tUDC supports cable detect when unpowered"));
+        OstTrace0( TRACE_NORMAL, CUSBDEVICE_CONSTRUCTL_DUP3, "CUsbDevice::ConstructL: UDC supports cable detect when unpowered" );
 		iUdcSupportsCableDetectWhenUnpowered = ETrue;
 		}
 	else
 		{
-		LOGTEXT(_L8("\tUDC does not support cable detect when unpowered"));
+        OstTrace0( TRACE_NORMAL, CUSBDEVICE_CONSTRUCTL_DUP4, "CUsbDevice::ConstructL; UDC does not support cable detect when unpowered" );
 		}
 
 	TUsbcDeviceState deviceState;
-	LEAVEIFERRORL(iLdd.DeviceStatus(deviceState));
+	err = iLdd.DeviceStatus(deviceState);
+	if(err < 0)
+	    {
+        OstTrace1( TRACE_NORMAL, CUSBDEVICE_CONSTRUCTL_DUP13, "CUsbDevice::ConstructL;iLdd.DeviceStatus(deviceState) with error=%d", err );
+        User::Leave(err);
+	    }
 	SetDeviceState(deviceState);
-	LOGTEXT(_L8("Got device state"));
+	OstTrace0( TRACE_NORMAL, CUSBDEVICE_CONSTRUCTL_DUP5, "CUsbDevice::ConstructL; Got device state" );
+	
 
 	iDeviceStateWatcher = CUsbDeviceStateWatcher::NewL(*this, iLdd);
 	iDeviceStateWatcher->Start();
@@ -215,35 +251,43 @@
 		{
 		delete iDefaultSerialNumber;
 		iDefaultSerialNumber = NULL;
-		LOGTEXT(_L8("No default serial number"));
+		OstTrace0( TRACE_NORMAL, CUSBDEVICE_CONSTRUCTL_DUP6, "CUsbDevice::ConstructL; No default serial number" );
+		
 		}
 	else
 		{
-		LEAVEIFERRORL(err);
-#ifdef __FLOG_ACTIVE
-		TBuf8<KUsbStringDescStringMaxSize> narrowString;
-		narrowString.Copy(serNum);
-		LOGTEXT2(_L8("Got default serial number %S"), &narrowString);
-#endif //__FLOG_ACTIVE		
+        if(err < 0)
+            {
+            OstTrace1( TRACE_NORMAL, CUSBDEVICE_CONSTRUCTL_DUP12, "CUsbDevice::ConstructL;error=%d", err );
+            User::Leave(err);
+            }
+#ifdef _DEBUG
+		OstTraceExt1( TRACE_NORMAL, CUSBDEVICE_CONSTRUCTL_DUP7, "CUsbDevice::ConstructL;serNum=%S", serNum );
+#endif //_DEBUG  
 		}
 
-	LOGTEXT(_L8("UsbDevice::ConstructL() finished"));
+	OstTrace0( TRACE_NORMAL, CUSBDEVICE_CONSTRUCTL_DUP8, "CUsbDevice::ConstructL; UsbDevice::ConstructL() finished" );
+	
+#endif
 #endif
 	
 #ifndef __OVER_DUMMYUSBDI__
 	InstantiateExtensionPluginsL();
 #endif
+	OstTraceFunctionExit0( CUSBDEVICE_CONSTRUCTL_EXIT );
 	}
 
 void CUsbDevice::InstantiateExtensionPluginsL()
 	{
-	LOGTEXT(_L8(">>CUsbDevice::InstantiateExtensionPluginsL"));
+    OstTraceFunctionEntry0( CUSBDEVICE_INSTANTIATEEXTENSIONPLUGINSL_ENTRY );
+    
 	const TUid KUidExtensionPluginInterface = TUid::Uid(KUsbmanExtensionPluginInterfaceUid);
 	RImplInfoPtrArray implementations;
 	const TEComResolverParams noResolverParams;
 	REComSession::ListImplementationsL(KUidExtensionPluginInterface, noResolverParams, KRomOnlyResolverUid, implementations);
 	CleanupResetAndDestroyPushL(implementations);
-	LOGTEXT2(_L8("Number of implementations of extension plugin interface: %d"), implementations.Count());
+	OstTrace1( TRACE_FLOW, CUSBDEVICE_INSTANTIATEEXTENSIONPLUGINSL, "CUsbDevice::InstantiateExtensionPluginsL;Number of implementations of extension plugin interface: %d", implementations.Count() );
+	
 
 	for (TInt i=0; i<implementations.Count(); i++)
 		{
@@ -251,13 +295,14 @@
 		CleanupStack::PushL(plugin);
 		iExtensionPlugins.AppendL(plugin); // transfer ownership to iExtensionPlugins
 		CleanupStack::Pop(plugin);
-		LOGTEXT2(_L8("Added extension plugin with UID 0x%08x"),
-			implementations[i]->ImplementationUid());
+		OstTrace1( TRACE_NORMAL, CUSBDEVICE_INSTANTIATEEXTENSIONPLUGINSL_DUP1, 
+		        "CUsbDevice::InstantiateExtensionPluginsL;Added extension plugin with UID 0x%08x", 
+		        implementations[i]->ImplementationUid().iUid );
+		
 		}
 
 	CleanupStack::PopAndDestroy(&implementations);
-
-	LOGTEXT(_L8("<<CUsbDevice::InstantiateExtensionPluginsL"));
+	OstTraceFunctionExit0( CUSBDEVICE_INSTANTIATEEXTENSIONPLUGINSL_EXIT );
 	}
 
 
@@ -269,7 +314,7 @@
  *
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDEVICE_ENUMERATECLASSCONTROLLERSL_ENTRY );
 	
 #ifdef USE_DUMMY_CLASS_CONTROLLER
 	//create a TLinearOrder to supply the comparison function, Compare(), to be used  
@@ -283,8 +328,12 @@
 		{
 		AddClassControllerL(CUsbDummyClassController::NewL(*this, ii), order);	
 		}
-	    
-	LEAVEIFERRORL(iUsbClassControllerIterator->First());
+	TInt err = iUsbClassControllerIterator->First();   
+	if(err < 0)
+	    {
+        OstTrace1( TRACE_NORMAL, CUSBDEVICE_ENUMERATECLASSCONTROLLERSL_DUP2, "CUsbDevice::EnumerateClassControllersL;iUsbClassControllerIterator->First() with error=%d", err );
+        User::Leave(err);
+	    }
 	    
 #else
 
@@ -302,19 +351,24 @@
 	REComSession::ListImplementationsL(KUidUsbPlugIns, noResolverParams, KRomOnlyResolverUid, implementations);
   	CleanupResetAndDestroyPushL(implementations);
   	
-	LOGTEXT2(_L8("Number of implementations to load  %d"), implementations.Count());
+	OstTrace1( TRACE_NORMAL, CUSBDEVICE_ENUMERATECLASSCONTROLLERSL, "CUsbDevice::EnumerateClassControllersL;Number of implementations to load %d", implementations.Count() );
 	
 	for (TInt i=0; i<implementations.Count(); i++)
 		{
-		LOGTEXT2(_L8("Adding class controller with UID %x"),
-			implementations[i]->ImplementationUid());
-		const TUid uid = implementations[i]->ImplementationUid();
-		LEAVEIFERRORL(iSupportedClassUids.Append(uid));
+        OstTrace1( TRACE_NORMAL, CUSBDEVICE_ENUMERATECLASSCONTROLLERSL_DUP1, "CUsbDevice::EnumerateClassControllersL;Adding class controller with UID %x", implementations[i]->ImplementationUid().iUid );
+        const TUid uid = implementations[i]->ImplementationUid();
+		TInt err = iSupportedClassUids.Append(uid);
+		if(err < 0)
+		    {
+            OstTrace1( TRACE_NORMAL, CUSBDEVICE_ENUMERATECLASSCONTROLLERSL_DUP3, "CUsbDevice::EnumerateClassControllersL;iSupportedClassUids.Append(uid) with error=%d", err );
+            User::Leave(err);
+		    }
 		}	
 			
 	CleanupStack::PopAndDestroy(&implementations);
 	
 #endif // USE_DUMMY_CLASS_CONTROLLER
+	OstTraceFunctionExit0( CUSBDEVICE_ENUMERATECLASSCONTROLLERSL_EXIT );
 	}
 
 void CUsbDevice::AddClassControllerL(CUsbClassControllerBase* aClassController, 
@@ -330,7 +384,7 @@
  *                              added
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDEVICE_ADDCLASSCONTROLLERL_ENTRY );
 	
 	
 	TInt rc = KErrNone;	
@@ -349,8 +403,10 @@
 		{
 		// Avoid memory leak by deleting class controller if the append fails.
 		delete aClassController;
-		LEAVEL(rc);
+		OstTrace1( TRACE_NORMAL, CUSBDEVICE_ADDCLASSCONTROLLERL, "CUsbDevice::AddClassControllerL;Leave rc=%d", rc );
+		User::Leave(rc);
 		}
+	OstTraceFunctionExit0( CUSBDEVICE_ADDCLASSCONTROLLERL_EXIT );
 	}
 
 void CUsbDevice::RegisterObserverL(MUsbDeviceNotify& aObserver)
@@ -361,9 +417,14 @@
  * @param	aObserver	New Observer of the device
  */
 	{
-	LOG_FUNC
-
-	LEAVEIFERRORL(iObservers.Append(&aObserver));
+	OstTraceFunctionEntry0( CUSBDEVICE_REGISTEROBSERVERL_ENTRY );
+	TInt err = iObservers.Append(&aObserver);
+	if(err < 0)
+	    {
+        OstTrace1( TRACE_NORMAL, CUSBDEVICE_REGISTEROBSERVERL, "CUsbDevice::RegisterObserverL;iObservers.Append(&aObserver) with err=%d", err );
+        User::Leave(err);
+	    }
+	OstTraceFunctionExit0( CUSBDEVICE_REGISTEROBSERVERL_EXIT );
 	}
 
 
@@ -374,12 +435,13 @@
  * @param	aObserver	The existing device observer to be de-registered
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDEVICE_DEREGISTEROBSERVER_ENTRY );
 
 	TInt index = iObservers.Find(&aObserver);
 
 	if (index >= 0)
 		iObservers.Remove(index);
+	OstTraceFunctionExit0( CUSBDEVICE_DEREGISTEROBSERVER_EXIT );
 	}
 
 
@@ -389,7 +451,7 @@
  * Reports errors and state changes via observer interface.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDEVICE_STARTL_ENTRY );
 
 	Cancel();
 	SetServiceState(EUsbServiceStarting);
@@ -397,12 +459,14 @@
 	TRAPD(err, SetDeviceDescriptorL());
 	if ( err != KErrNone )
 		{
-		SetServiceState(EUsbServiceIdle);
-		LEAVEL(err);		
+		SetServiceState(EUsbServiceIdle);	
+		OstTrace1( TRACE_NORMAL, CUSBDEVICE_STARTL, "CUsbDevice::StartL;Leave with error=%d", err );
+		User::Leave(err);		
 		}
 
 	iLastError = KErrNone;
 	StartCurrentClassController();
+	OstTraceFunctionExit0( CUSBDEVICE_STARTL_EXIT );
 	}
 
 void CUsbDevice::Stop()
@@ -410,13 +474,14 @@
  * Stop the USB device and all its associated USB classes.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDEVICE_STOP_ENTRY );
 
 	Cancel();
 	SetServiceState(EUsbServiceStopping);
 	
 	iLastError = KErrNone;
 	StopCurrentClassController();
+	OstTraceFunctionExit0( CUSBDEVICE_STOP_EXIT );
 	}
 
 void CUsbDevice::SetServiceState(TUsbServiceState aState)
@@ -426,8 +491,11 @@
  * @param	aState	New state that the device is moving to
  */
 	{
-	LOGTEXT3(_L8("Calling: CUsbDevice::SetServiceState [iServiceState=%d,aState=%d]"),
-		iServiceState, aState);
+    OstTraceFunctionEntry0( CUSBDEVICE_SETSERVICESTATE_ENTRY );
+    
+	OstTraceExt2( TRACE_NORMAL, CUSBDEVICE_SETSERVICESTATE, 
+	        "CUsbDevice::SetServiceState;iServiceState=%d;aState=%d", iServiceState, aState );
+	
 
 	if (iServiceState != aState)
 		{
@@ -445,7 +513,7 @@
 		if (iServiceState == EUsbServiceIdle)
 			iUsbServer.LaunchShutdownTimerIfNoSessions();
 		}
-	LOGTEXT(_L8("Exiting: CUsbDevice::SetServiceState"));
+	OstTraceFunctionExit0( CUSBDEVICE_SETSERVICESTATE_EXIT );
 	}
 
 void CUsbDevice::SetDeviceState(TUsbcDeviceState aState)
@@ -458,8 +526,9 @@
  * @param	aState	New state that the device is moving to
  */
 	{
-	LOG_FUNC
-	LOGTEXT3(_L8("\taState = %d, iDeviceState = %d"), aState, iDeviceState);
+	OstTraceFunctionEntry0( CUSBDEVICE_SETDEVICESTATE_ENTRY );
+	OstTraceExt2( TRACE_NORMAL, CUSBDEVICE_SETDEVICESTATE, 
+	        "CUsbDevice::SetDeviceState;aState=%d;iDeviceState=%d", aState, iDeviceState );
 
 	TUsbDeviceState state;
 	switch (aState)
@@ -491,6 +560,7 @@
 
 	if (iDeviceState != state)
 		{
+#ifndef __OVER_DUMMYUSBDI__
 #ifndef __WINS__
 		if (iDeviceState == EUsbDeviceStateUndefined &&
 			iUdcSupportsCableDetectWhenUnpowered &&
@@ -502,7 +572,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;
@@ -513,6 +584,7 @@
 			iObservers[i]->UsbDeviceStateChange(LastError(), oldState, iDeviceState);
 			}
 		}
+	OstTraceFunctionExit0( CUSBDEVICE_SETDEVICESTATE_EXIT );
 	}
 
 /**
@@ -521,7 +593,7 @@
  */
 void CUsbDevice::BusEnumerationCompleted()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDEVICE_BUSENUMERATIONCOMPLETED_ENTRY );
 
 	// Has the start been cancelled?
 	if (iServiceState == EUsbServiceStarting)
@@ -530,8 +602,10 @@
 		}
 	else
 		{
-		LOGTEXT(_L8("    Start has been cancelled!"));
+        OstTrace0( TRACE_NORMAL, CUSBDEVICE_BUSENUMERATIONCOMPLETED, 
+                "CUsbDevice::BusEnumerationCompleted;    Start has been cancelled!" );
 		}
+	OstTraceFunctionExit0( CUSBDEVICE_BUSENUMERATIONCOMPLETED_EXIT );
 	}
 
 void CUsbDevice::BusEnumerationFailed(TInt aError)
@@ -542,7 +616,8 @@
  * @param	aError	Error that has occurred during Re-enumeration
  */
 	{
-	LOGTEXT2(_L8("CUsbDevice::BusEnumerationFailed [aError=%d]"), aError);
+	OstTrace1( TRACE_NORMAL, CUSBDEVICE_BUSENUMERATIONFAILED, "CUsbDevice::BusEnumerationFailed;aError=%d", aError );
+	
 	iLastError = aError;
 
 	if (iServiceState == EUsbServiceStarting)
@@ -552,7 +627,8 @@
 		}
 	else
 		{
-		LOGTEXT(_L8("    Start has been cancelled!"));
+		OstTrace0( TRACE_NORMAL, CUSBDEVICE_BUSENUMERATIONFAILED_DUP1, 
+		        "CUsbDevice::BusEnumerationFailed;    Start has been cancelled!" );		
 		}
 	}
 
@@ -562,10 +638,11 @@
  * Called numerous times to start all the USB classes.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDEVICE_STARTCURRENTCLASSCONTROLLER_ENTRY );
 
 	iUsbClassControllerIterator->Current()->Start(iStatus);
 	SetActive();
+	OstTraceFunctionExit0( CUSBDEVICE_STARTCURRENTCLASSCONTROLLER_EXIT );
 	}
 
 void CUsbDevice::StopCurrentClassController()
@@ -573,10 +650,11 @@
  * Called numerous times to stop all the USB classes.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDEVICE_STOPCURRENTCLASSCONTROLLER_ENTRY );	
 
 	iUsbClassControllerIterator->Current()->Stop(iStatus);
 	SetActive();
+	OstTraceFunctionExit0( CUSBDEVICE_STOPCURRENTCLASSCONTROLLER_EXIT );
 	}
 
 /**
@@ -585,12 +663,19 @@
 */
 TInt CUsbDevice::PowerUpAndConnect()
 	{
-	LOG_FUNC
-	LOGTEXT(_L8("\tPowering up UDC..."));
+	OstTraceFunctionEntry0( CUSBDEVICE_POWERUPANDCONNECT_ENTRY );
+	
+	OstTrace0( TRACE_NORMAL, CUSBDEVICE_POWERUPANDCONNECT, "CUsbDevice::PowerUpAndConnect;Powering up UDC..." );
+	
 	TInt res = iLdd.PowerUpUdc();
-	LOGTEXT2(_L8("\tPowerUpUdc res = %d"), res);
+	OstTrace1( TRACE_NORMAL, CUSBDEVICE_POWERUPANDCONNECT_DUP1, 
+	        "CUsbDevice::PowerUpAndConnect;PowerUpUdc res = %d", res );
+	
 	res = iLdd.DeviceConnectToHost();
-	LOGTEXT2(_L8("\tDeviceConnectToHost res = %d"), res);
+	OstTrace1( TRACE_NORMAL, CUSBDEVICE_POWERUPANDCONNECT_DUP2, 
+	        "CUsbDevice::PowerUpAndConnect;DeviceConnectToHost res = %d", res );
+	
+	OstTraceFunctionExit0( CUSBDEVICE_POWERUPANDCONNECT_EXIT );
 	return res;
 	}
 
@@ -601,28 +686,37 @@
  * classes have been completed.
  */
 	{
-	LOGTEXT2(_L8(">>CUsbDevice::RunL [iStatus=%d]"), iStatus.Int());
+    OstTraceFunctionEntry0( CUSBDEVICE_RUNL_ENTRY );
+    OstTrace1( TRACE_NORMAL, CUSBDEVICE_RUNL, "CUsbDevice::RunL;iStatus.Int()=%d", iStatus.Int() );
 
-	LEAVEIFERRORL(iStatus.Int());
+    TInt err = iStatus.Int();
+    if(err < 0)
+        {
+        OstTrace1( TRACE_NORMAL, CUSBDEVICE_RUNL_DUP4, "CUsbDevice::RunL;iStatus.Int() with error=%d", err );
+        User::Leave(err);
+        }
 
 	switch (iServiceState)
 		{
 	case EUsbServiceStarting:
 		if (iUsbClassControllerIterator->Next() == KErrNotFound)
 			{
+#ifndef __OVER_DUMMYUSBDI__
 #ifndef __WINS__
 			if (!iUdcSupportsCableDetectWhenUnpowered || iDeviceState != EUsbDeviceStateUndefined)
 				{
 				// We've finished starting the classes. We can just power up the UDC
 				// now: there's no need to re-enumerate, because we soft disconnected
 				// earlier. This will also do a soft connect.
-				LOGTEXT(_L8("Finished starting classes: powering up UDC"));
+				OstTrace0( TRACE_NORMAL, CUSBDEVICE_RUNL_DUP1, "CUsbDevice::RunL;Finished starting classes: powering up UDC" );
+				
 
 				// It isn't an error if this call fails. This will happen, for example,
 				// in the case where there are no USB classes defined.
 				(void)PowerUpAndConnect();
 				}
 #endif
+#endif
 			// If we're not running on target, we can just go to "started".
 			SetServiceState(EUsbServiceStarted);
 			}
@@ -636,6 +730,7 @@
 		if (iUsbClassControllerIterator->Previous() == KErrNotFound)
 			{
 			// if stopping classes, hide the USB interface from the host
+#ifndef __OVER_DUMMYUSBDI__
 #ifndef __WINS__
 			iLdd.DeviceDisconnectFromHost();
 
@@ -643,14 +738,15 @@
 			if (iDefaultSerialNumber)
 				{
 				TInt res = iLdd.SetSerialNumberStringDescriptor(*iDefaultSerialNumber);
-				LOGTEXT2(_L8("Restore default serial number res = %d"), res);
+				OstTrace1( TRACE_NORMAL, CUSBDEVICE_RUNL_DUP2, "CUsbDevice::RunL;Restore default serial number res = %d", res );				
 				}
 			else
 				{
 				TInt res = iLdd.RemoveSerialNumberStringDescriptor();
-				LOGTEXT2(_L8("Remove serial number res = %d"), res);
+				OstTrace1( TRACE_NORMAL, CUSBDEVICE_RUNL_DUP3, "CUsbDevice::RunL;Remove serial number res = %d", res );				
 				}
-				
+
+#endif				
 #endif			
 			SetServiceState(EUsbServiceIdle);
 			}
@@ -661,10 +757,13 @@
 		break;
 
 	default:
-		__ASSERT_DEBUG( EFalse, _USB_PANIC(KUsbDevicePanicCategory, EBadAsynchronousCall) );
+
+        OstTrace1( TRACE_FATAL, CUSBDEVICE_RUNL_DUP5, "CUsbDevice::RunL;Panic reason=%d", EBadAsynchronousCall );
+        __ASSERT_DEBUG( EFalse, User::Panic(KUsbDevicePanicCategory, EBadAsynchronousCall) );
+
 		break;
 		}
-	LOGTEXT(_L8("<<CUsbDevice::RunL"));
+	OstTraceFunctionExit0( CUSBDEVICE_RUNL_EXIT );
 	}
 
 void CUsbDevice::DoCancel()
@@ -674,7 +773,7 @@
  * this function being called is a programming error.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDEVICE_DOCANCEL_ENTRY );
 
 	switch (iServiceState)
 		{
@@ -684,9 +783,12 @@
 		break;
 
 	default:
-		__ASSERT_DEBUG( EFalse, _USB_PANIC(KUsbDevicePanicCategory, EBadAsynchronousCall) );
+
+        OstTrace1( TRACE_FATAL, CUSBDEVICE_DOCANCEL, "CUsbDevice::DoCancel;Panic reason=%d", EBadAsynchronousCall );
+        __ASSERT_DEBUG( EFalse, User::Panic(KUsbDevicePanicCategory, EBadAsynchronousCall ) );
 		break;
 		}
+	OstTraceFunctionExit0( CUSBDEVICE_DOCANCEL_EXIT );
 	}
 
 TInt CUsbDevice::RunError(TInt aError)
@@ -698,7 +800,8 @@
  * @return Always KErrNone, to avoid an active scheduler panic
  */
 	{
-	LOGTEXT2(_L8("CUsbDevice::RunError [aError=%d]"), aError);
+	OstTrace1( TRACE_NORMAL, CUSBDEVICE_RUNERROR, "CUsbDevice::RunError;aError=%d", aError );
+	
 
 	iLastError = aError;
 
@@ -730,7 +833,8 @@
 		break;
 
 	default:
-		__ASSERT_DEBUG( EFalse, _USB_PANIC(KUsbDevicePanicCategory, EBadAsynchronousCall) );
+        OstTrace1( TRACE_FATAL, CUSBDEVICE_RUNERROR_DUP1, "CUsbDevice::RunError;Panic reason=%d", EBadAsynchronousCall );
+        __ASSERT_DEBUG( EFalse, User::Panic(KUsbDevicePanicCategory, EBadAsynchronousCall ) );
 		break;
 		}
 
@@ -746,7 +850,7 @@
  * @return A new iterator
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDEVICE_UCCNGETCLASSCONTROLLERITERATORL_ENTRY );
 
 	return new (ELeave) CUsbClassControllerIterator(iSupportedClasses);
 	}
@@ -759,30 +863,31 @@
  * @param aError The error that's occurred
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDEVICE_UCCNERROR_ENTRY );
 
 	RunError(aError);
+	OstTraceFunctionExit0( CUSBDEVICE_UCCNERROR_EXIT );
 	}
 
 
-#ifdef __FLOG_ACTIVE
+#ifdef _DEBUG
 void CUsbDevice::PrintDescriptor(CUsbDevice::TUsbDeviceDescriptor& aDeviceDescriptor)
 	{
-	LOGTEXT2(_L8("\tiLength is %d"), aDeviceDescriptor.iLength);
-	LOGTEXT2(_L8("\tiDescriptorType is %d"), aDeviceDescriptor.iDescriptorType);
-	LOGTEXT2(_L8("\tBcdUsb is: 0x%04x"), aDeviceDescriptor.iBcdUsb);
-	LOGTEXT2(_L8("\tDeviceClass is: 0x%02x"), aDeviceDescriptor.iDeviceClass);
-	LOGTEXT2(_L8("\tDeviceSubClass is: 0x%02x"), aDeviceDescriptor.iDeviceSubClass);
-	LOGTEXT2(_L8("\tDeviceProtocol is: 0x%02x"), aDeviceDescriptor.iDeviceProtocol);
-	LOGTEXT2(_L8("\tiMaxPacketSize is: 0x%02x"), aDeviceDescriptor.iMaxPacketSize);
+	OstTrace1( TRACE_DUMP, CUSBDEVICE_PRINTDESCRIPTOR, "CUsbDevice::PrintDescriptor;iLength=%d", aDeviceDescriptor.iLength );
+	OstTrace1( TRACE_DUMP, CUSBDEVICE_PRINTDESCRIPTOR_DUP1, "CUsbDevice::PrintDescriptor;iDescriptorType=%d", aDeviceDescriptor.iDescriptorType );
+	OstTrace1( TRACE_DUMP, CUSBDEVICE_PRINTDESCRIPTOR_DUP2, "CUsbDevice::PrintDescriptor;iBcdUsb=0x%04x", aDeviceDescriptor.iBcdUsb );
+	OstTrace1( TRACE_DUMP, CUSBDEVICE_PRINTDESCRIPTOR_DUP3, "CUsbDevice::PrintDescriptor;iDeviceClass=0x%02x", aDeviceDescriptor.iDeviceClass );
+	OstTrace1( TRACE_DUMP, CUSBDEVICE_PRINTDESCRIPTOR_DUP4, "CUsbDevice::PrintDescriptor;iDeviceSubClass=0x%02x", aDeviceDescriptor.iDeviceSubClass );
+	OstTrace1( TRACE_DUMP, CUSBDEVICE_PRINTDESCRIPTOR_DUP5, "CUsbDevice::PrintDescriptor;iDeviceProtocol=0x%02x", aDeviceDescriptor.iDeviceProtocol );
+	OstTrace1( TRACE_DUMP, CUSBDEVICE_PRINTDESCRIPTOR_DUP6, "CUsbDevice::PrintDescriptor;iMaxPacketSize=0x%02x", aDeviceDescriptor.iMaxPacketSize );
 	
-	LOGTEXT2(_L8("\tVendorId is: 0x%04x"), aDeviceDescriptor.iIdVendor);
-	LOGTEXT2(_L8("\tProductId is: 0x%04x"), aDeviceDescriptor.iIdProduct);
-	LOGTEXT2(_L8("\tBcdDevice is: 0x%04x"), aDeviceDescriptor.iBcdDevice);
-
-	LOGTEXT2(_L8("\tiManufacturer is: 0x%04x"), aDeviceDescriptor.iManufacturer);
-	LOGTEXT2(_L8("\tiSerialNumber is: 0x%04x"), aDeviceDescriptor.iSerialNumber);
-	LOGTEXT2(_L8("\tiNumConfigurations is: 0x%04x"), aDeviceDescriptor.iNumConfigurations);
+	OstTrace1( TRACE_DUMP, CUSBDEVICE_PRINTDESCRIPTOR_DUP7, "CUsbDevice::PrintDescriptor;iIdVendor=0x%04x", aDeviceDescriptor.iIdVendor );
+	OstTrace1( TRACE_DUMP, CUSBDEVICE_PRINTDESCRIPTOR_DUP8, "CUsbDevice::PrintDescriptor;iProductId=0x%04x", aDeviceDescriptor.iProductId );
+	OstTrace1( TRACE_DUMP, CUSBDEVICE_PRINTDESCRIPTOR_DUP9, "CUsbDevice::PrintDescriptor;iBcdDevice=0x%04x", aDeviceDescriptor.iBcdDevice );
+	
+	OstTrace1( TRACE_DUMP, CUSBDEVICE_PRINTDESCRIPTOR_DUP10, "CUsbDevice::PrintDescriptor;iManufacturer=0x%04x", aDeviceDescriptor.iManufacturer );
+	OstTrace1( TRACE_DUMP, CUSBDEVICE_PRINTDESCRIPTOR_DUP11, "CUsbDevice::PrintDescriptor;iSerialNumber=0x%04x", aDeviceDescriptor.iSerialNumber );
+	OstTrace1( TRACE_DUMP, CUSBDEVICE_PRINTDESCRIPTOR_DUP12, "CUsbDevice::PrintDescriptor;iNumConfigurations=0x%04x", aDeviceDescriptor.iNumConfigurations );	
 	}
 #endif
 //
@@ -791,13 +896,13 @@
  * Modifies the USB device descriptor.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDEVICE_SETDEVICEDESCRIPTORL_ENTRY );
 
-#ifndef __WINS__
+#if !defined(__OVER_DUMMYUSBDI__) && !defined(__WINS__)
 
 	TInt desSize = 0;
 	iLdd.GetDeviceDescriptorSize(desSize);
-	LOGTEXT2(_L8("UDeviceDescriptorSize = %d"), desSize);
+	OstTrace1( TRACE_NORMAL, CUSBDEVICE_SETDEVICEDESCRIPTORL, "CUsbDevice::SetDeviceDescriptorL;UDeviceDescriptorSize = %d", desSize );
 	HBufC8* deviceBuf = HBufC8::NewLC(desSize);
 	TPtr8   devicePtr = deviceBuf->Des();
 	devicePtr.SetLength(0);
@@ -806,8 +911,8 @@
 
 	if (ret != KErrNone)
 		{
-		LOGTEXT2(_L8("Unable to fetch device descriptor. Error: %d"), ret);
-		LEAVEL(ret);
+		OstTrace1( TRACE_NORMAL, CUSBDEVICE_SETDEVICEDESCRIPTORL_DUP1, "CUsbDevice::SetDeviceDescriptorL;Unable to fetch device descriptor. Error: %d", ret );
+		User::Leave(ret);
 		}
 
 	TUsbDeviceDescriptor* deviceDescriptor = reinterpret_cast<TUsbDeviceDescriptor*>(
@@ -821,7 +926,7 @@
 	TUsbDeviceDescriptor descriptor;
 	TUsbDeviceDescriptor* deviceDescriptor = &descriptor;
 	
-#endif // __WINS__
+#endif // __OVER_DUMMYUSBDI__ && _WINS_
 
 	if (iPersonalityCfged)
 		{
@@ -829,21 +934,26 @@
 		}
 	else
 		{
-	SetUsbDeviceSettingsL(*deviceDescriptor);
+        OstTrace0( TRACE_NORMAL, CUSBDEVICE_SETDEVICEDESCRIPTORL_DUP3, 
+                "CUsbDevice::SetDeviceDescriptorL;USB configuration is not read" );
+        User::Leave(KErrNotFound);
 		}
 	
+#ifndef __OVER_DUMMYUSBDI__
 #ifndef __WINS__
 	ret = iLdd.SetDeviceDescriptor(devicePtr);
 
 	if (ret != KErrNone)
 		{
-		LOGTEXT2(_L8("Unable to set device descriptor. Error: %d"), ret);
-		LEAVEL(ret);
+		OstTrace1( TRACE_NORMAL, CUSBDEVICE_SETDEVICEDESCRIPTORL_DUP2, "CUsbDevice::SetDeviceDescriptorL;Unable to set device descriptor. Error: %d", ret );
+		User::Leave(ret);
 		}
 
 	CleanupStack::PopAndDestroy(deviceBuf);
 
-#endif // __WINS__
+#endif
+#endif // __OVER_DUMMYUSBDI__
+	OstTraceFunctionExit0( CUSBDEVICE_SETDEVICEDESCRIPTORL_EXIT );
 	}
 
 void CUsbDevice::SetUsbDeviceSettingsDefaultsL(CUsbDevice::TUsbDeviceDescriptor& aDeviceDescriptor)
@@ -858,134 +968,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<TUint16>(reader.ReadUint16());
-	aDeviceDescriptor.iIdProduct = static_cast<TUint16>(reader.ReadUint16());
-	aDeviceDescriptor.iBcdDevice = static_cast<TUint16>(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<KUsbStringDescStringMaxSize> 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<KUsbStringDescStringMaxSize> serNum;
-	TInt r = RProperty::Get(KUidSystemCategory,0x101FE1DB,serNum);
-	if(r==KErrNone)
-		{
-#ifdef __FLOG_ACTIVE
-		TBuf8<KUsbStringDescStringMaxSize> 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)
@@ -995,63 +978,83 @@
  * @param aDeviceDescriptor The device descriptor for the USB device
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDEVICE_SETUSBDEVICESETTINGSFROMPERSONALITYL_ENTRY );
 
 	// First, use the default values
-	LOGTEXT(_L8("Setting default values for the configuration"));
+	OstTrace0( TRACE_NORMAL, CUSBDEVICE_SETUSBDEVICESETTINGSFROMPERSONALITYL, "CUsbDevice::SetUsbDeviceSettingsFromPersonalityL;Setting default values for the configuration" );
 	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())));
+	TInt err = iLdd.SetManufacturerStringDescriptor(*(iDeviceConfiguration.iManufacturerName));
+	if(err < 0)
+	    {
+        OstTrace1( TRACE_NORMAL, CUSBDEVICE_SETUSBDEVICESETTINGSFROMPERSONALITYL_DUP7, "CUsbDevice::SetUsbDeviceSettingsFromPersonalityL;iLdd.SetManufacturerStringDescriptor(*(iCurrentPersonality->Manufacturer())) with error=%d", err );
+        User::Leave(err);
+	    }  
+	err = iLdd.SetProductStringDescriptor(*(iDeviceConfiguration.iProductName));
+    if(err < 0)
+        {
+        OstTrace1( TRACE_NORMAL, CUSBDEVICE_SETUSBDEVICESETTINGSFROMPERSONALITYL_DUP6, "CUsbDevice::SetUsbDeviceSettingsFromPersonalityL;iLdd.SetProductStringDescriptor(*(iCurrentPersonality->Product())) with error=%d", err );
+        User::Leave(err);
+        }
+
 
 	//Read the published serial number. The key is the UID KUidUsbmanServer = 0x101FE1DB
 	TBuf16<KUsbStringDescStringMaxSize> serNum;
 	TInt r = RProperty::Get(KUidSystemCategory,0x101FE1DB,serNum);
 	if(r==KErrNone)
 		{
-#ifdef __FLOG_ACTIVE
-		TBuf8<KUsbStringDescStringMaxSize> narrowString;
-		narrowString.Copy(serNum);
-		LOGTEXT2(_L8("Setting published SerialNumber: %S"), &narrowString);
-#endif // __FLOG_ACTIVE
+#ifdef _DEBUG
+		OstTraceExt1( TRACE_NORMAL, CUSBDEVICE_SETUSBDEVICESETTINGSFROMPERSONALITYL_DUP1, "CUsbDevice::SetUsbDeviceSettingsFromPersonalityL;Setting published SerialNumber: %S", serNum );
+#endif//_DEBUG
 		//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));	
+		err = iLdd.SetSerialNumberStringDescriptor(serNum);	
+		if(err < 0)
+		    {
+            OstTrace1( TRACE_NORMAL, CUSBDEVICE_SETUSBDEVICESETTINGSFROMPERSONALITYL_DUP3, "CUsbDevice::SetUsbDeviceSettingsFromPersonalityL;iLdd.SetSerialNumberStringDescriptor(serNum) with error=%d", err );
+            User::Leave(err);
+		    }
 		}
-#ifdef __FLOG_ACTIVE
+#ifdef _DEBUG
 	else
 		{
-		LOGTEXT(_L8("SerialNumber has not been published"));	
+		OstTrace0( TRACE_NORMAL, CUSBDEVICE_SETUSBDEVICESETTINGSFROMPERSONALITYL_DUP2, "CUsbDevice::SetUsbDeviceSettingsFromPersonalityL;SerialNumber has not been published" );	
 		}
-#endif // __FLOG_ACTIVE
-#endif // __WINS__
+#endif // _DEBUG
+
+#endif
+#endif // __OVER_DUMMYUSBDI__
 
 
-#ifdef __FLOG_ACTIVE
+#ifdef _DEBUG
 	PrintDescriptor(aDeviceDescriptor);		
 
+#ifndef __OVER_DUMMYUSBDI__
 #ifndef __WINS__
 	TBuf16<KUsbStringDescStringMaxSize> wideString;
-	TBuf8<KUsbStringDescStringMaxSize> narrowString;
+	TInt tmp = iLdd.GetConfigurationStringDescriptor(wideString);	
+	if(tmp < 0)
+	    {
+        OstTrace1( TRACE_NORMAL, CUSBDEVICE_SETUSBDEVICESETTINGSFROMPERSONALITYL_DUP5, "CUsbDevice::SetUsbDeviceSettingsFromPersonalityL;iLdd.GetConfigurationStringDescriptor(wideString) with error=%d", tmp );
+        User::Leave(tmp);
+	    }
+	OstTraceExt1( TRACE_NORMAL, CUSBDEVICE_SETUSBDEVICESETTINGSFROMPERSONALITYL_DUP4, "CUsbDevice::SetUsbDeviceSettingsFromPersonalityL;Configuration is:%S", wideString );
+#endif
+#endif // __OVER_DUMMYUSBDI__
 
-	LEAVEIFERRORL(iLdd.GetConfigurationStringDescriptor(wideString));
-	narrowString.Copy(wideString);
-	LOGTEXT2(_L8("Configuration is: '%S'"), &narrowString);
-#endif // __WINS__
-
-#endif // __FLOG_ACTIVE
+#endif // _DEBUG
 	}
 	
 void CUsbDevice::TryStartL(TInt aPersonalityId)
@@ -1063,7 +1066,7 @@
  * @param aPersonalityId a personality id
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDEVICE_TRYSTARTL_ENTRY );
 	SetCurrentPersonalityL(aPersonalityId);
 	
 	SelectClassControllersL();
@@ -1072,12 +1075,14 @@
 	TRAPD(err, SetDeviceDescriptorL());
 	if ( err != KErrNone )
 		{
-		SetServiceState(EUsbServiceIdle);
-		LEAVEL(err);		
+		SetServiceState(EUsbServiceIdle);	
+		OstTrace1( TRACE_NORMAL, CUSBDEVICE_TRYSTARTL, "CUsbDevice::TryStartL;leave with error=%d", err );
+		User::Leave(err);		
 		}
 
 	iLastError = KErrNone;
 	StartCurrentClassController();
+ 	OstTraceFunctionExit0( CUSBDEVICE_TRYSTARTL_EXIT );
  	}
  	
 TInt CUsbDevice::CurrentPersonalityId() const
@@ -1085,7 +1090,7 @@
  * @return the current personality id
  */
  	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDEVICE_CURRENTPERSONALITYID_ENTRY );
  	return iCurrentPersonality->PersonalityId();
  	}
  	
@@ -1094,7 +1099,7 @@
  * @return a const reference to RPointerArray<CPersonality>
  */
  	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDEVICE_PERSONALITIES_ENTRY );
  	return iSupportedPersonalities;
  	} 
  	
@@ -1107,17 +1112,19 @@
  * or 0 otherwise.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDEVICE_GETPERSONALITY_ENTRY );
 	
 	TInt count = iSupportedPersonalities.Count();
 	for (TInt i = 0; i < count; i++)
 		{
 		if (iSupportedPersonalities[i]->PersonalityId() == aPersonalityId)
 			{
+			OstTraceFunctionExit0( CUSBDEVICE_GETPERSONALITY_EXIT );
 			return iSupportedPersonalities[i];
 			}
 		}
 	
+	OstTraceFunctionExit0( CUSBDEVICE_GETPERSONALITY_EXIT_DUP1 );
 	return 0;
 	}
 	
@@ -1126,15 +1133,16 @@
  * Sets the current personality to the personality with id aPersonalityId
  */
  	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDEVICE_SETCURRENTPERSONALITYL_ENTRY );
 	const CPersonality* personality = GetPersonality(aPersonalityId);
 	if (!personality)
 		{
-		LOGTEXT(_L8("Personality id not found"));
-		LEAVEL(KErrNotFound);
+		OstTrace0( TRACE_NORMAL, CUSBDEVICE_SETCURRENTPERSONALITYL, "CUsbDevice::SetCurrentPersonalityL;Personality id not found" );
+		User::Leave(KErrNotFound);
 		}
 		
 	iCurrentPersonality = personality;
+ 	OstTraceFunctionExit0( CUSBDEVICE_SETCURRENTPERSONALITYL_EXIT );
  	}
 	
 void CUsbDevice::ValidatePersonalitiesL()
@@ -1143,31 +1151,34 @@
  * Leave if validation fails.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDEVICE_VALIDATEPERSONALITIESL_ENTRY );
 
 	TInt personalityCount = iSupportedPersonalities.Count();
 	for (TInt i = 0; i < personalityCount; i++)
 		{
-		const RArray<TUid>& classUids = iSupportedPersonalities[i]->SupportedClasses();
-		TInt uidCount = classUids.Count();
+		const RArray<CPersonalityConfigurations::TUsbClasses>& classes = iSupportedPersonalities[i]->SupportedClasses();
+		TInt uidCount = classes.Count();
 		for (TInt j = 0; j < uidCount; j++)	
 			{
 			TInt ccCount = iSupportedClassUids.Count();
 			TInt k;
+		    OstTrace1( TRACE_NORMAL, CUSBDEVICE_VALIDATEPERSONALITIESL_DUP1, "CUsbDevice::ValidatePersonalitiesL;iSupportedClassUids Count = %d", ccCount );
 			for (k = 0; k < ccCount; k++)
 				{
-				if (iSupportedClassUids[k] == classUids[j])
+                OstTraceExt4( TRACE_NORMAL, CUSBDEVICE_VALIDATEPERSONALITIESL_DUP2, "CUsbDevice::ValidatePersonalitiesL;iSupportedClassUids %d %x classes %d %x", k, iSupportedClassUids[k].iUid, j, classes[j].iClassUid.iUid );
+				if (iSupportedClassUids[k] == classes[j].iClassUid)
 					{
 					break;
 					}
 				}
 			if (k == ccCount)
 				{
-				LOGTEXT(_L8("personality validation failed"));
-				LEAVEL(KErrAbort);
+				OstTrace0( TRACE_NORMAL, CUSBDEVICE_VALIDATEPERSONALITIESL, "CUsbDevice::ValidatePersonalitiesL;personality validation failed" );
+				User::Leave(KErrAbort);
 				}					
 			}	
 		}
+	OstTraceFunctionExit0( CUSBDEVICE_VALIDATEPERSONALITIESL_EXIT );
 	}
 /**
 Converts text string with UIDs to array of Uint
@@ -1181,8 +1192,15 @@
 */
 void CUsbDevice::ConvertUidsL(const TDesC& aStr, RArray<TUint>& aUidArray)	
 	{
+    OstTraceFunctionEntry0( CUSBDEVICE_CONVERTUIDSL_ENTRY );
 	// Function assumes that aUIDs is empty
-	__ASSERT_DEBUG( aUidArray.Count() == 0, _USB_PANIC(KUsbDevicePanicCategory, EUidArrayNotEmpty) );
+#ifdef _DEBUG
+    if(aUidArray.Count() != 0)
+        {
+        OstTrace1( TRACE_FATAL, CUSBDEVICE_CONVERTUIDSL, "CUsbDevice::ConvertUidsL;Panic reason=%d", EUidArrayNotEmpty );
+        User::Panic(KUsbDevicePanicCategory, EUidArrayNotEmpty);
+        }
+#endif
 
 	TLex input(aStr);
 
@@ -1198,230 +1216,71 @@
 
 		// Convert and add to array
 		TUint val;
-		LEAVEIFERRORL(input.Val(val,EHex));
+		TInt err = input.Val(val,EHex);
+		if(err < 0)
+		    {
+            OstTrace1( TRACE_NORMAL, CUSBDEVICE_CONVERTUIDSL_DUP1, "CUsbDevice::ConvertUidsL;input.Val(val,EHex) with error=%d", err );
+            User::Leave(err);
+		    }
 		aUidArray.AppendL(val);
 		}
 	while (!input.Eos());	
+	OstTraceFunctionExit0( CUSBDEVICE_CONVERTUIDSL_EXIT );
 	}
 
 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<TUint16>(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<TUint8>(reader.ReadUint8());
-		TUint8 	bDeviceSubClass 	= static_cast<TUint8>(reader.ReadUint8());
-		TUint8 	protocol 			= static_cast<TUint8>(reader.ReadUint8());
-		TUint8 	numConfigurations	= static_cast<TUint8>(reader.ReadUint8());
-		TUint16 vendorId			= static_cast<TUint16>(reader.ReadUint16());
-		TUint16 productId			= static_cast<TUint16>(reader.ReadUint16());
-		TUint16 bcdDevice			= static_cast<TUint16>(reader.ReadUint16());
-		TPtrC	manufacturer		= reader.ReadTPtrC();
-		TPtrC	product				= reader.ReadTPtrC();
-		TUint16 id					= static_cast<TUint16>(reader.ReadUint16());
-		TPtrC	uidsStr				= reader.ReadTPtrC();
-		TPtrC 	description			= reader.ReadTPtrC();
-		
-		RArray<TUint> 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<KUsbDescMaxSize_String> 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<TUint32>(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<KMaxName> 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;	
-	}
+    {    
+    OstTraceFunctionEntry0( CUSBDEVICE_READPERSONALITIESL_ENTRY );
+    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;
+    OstTraceFunctionExit0( CUSBDEVICE_READPERSONALITIESL_EXIT );
+    }
 	
 void CUsbDevice::SelectClassControllersL()
 /**
  * Selects class controllers for the current personality
  */
 	{
-	LOG_FUNC
-
-	CreateClassControllersL(iCurrentPersonality->SupportedClasses());
+	OstTraceFunctionEntry0( CUSBDEVICE_SELECTCLASSCONTROLLERSL_ENTRY );
+    const RArray<CPersonalityConfigurations::TUsbClasses>& classes = iCurrentPersonality->SupportedClasses();
+	RArray<TUid> classUids;
+	CleanupClosePushL( classUids ); 
+    TInt classCount = classes.Count();
+	for(TInt classIndex = 0; classIndex<classCount; ++classIndex)
+	    {
+        TUid uid = classes[classIndex].iClassUid;
+        classUids.AppendL(uid);
+	    }
+	
+	CreateClassControllersL(classUids);
+	
+    CleanupStack::PopAndDestroy( &classUids );
+	OstTraceFunctionExit0( CUSBDEVICE_SELECTCLASSCONTROLLERSL_EXIT );
 	}
 #ifdef USE_DUMMY_CLASS_CONTROLLER	
 void CUsbDevice::CreateClassControllersL(const RArray<TUid>& /* aClassUids*/)
@@ -1434,7 +1293,7 @@
  * @param aClassUids an array of class uids
  */
  	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDEVICE_CREATECLASSCONTROLLERSL_ENTRY );
 
 #ifndef USE_DUMMY_CLASS_CONTROLLER
 
@@ -1446,15 +1305,19 @@
 	
 	// destroy any class controller objects in iSupportedClasses and reset it for reuse
 	iSupportedClasses.ResetAndDestroy();
-	LOGTEXT2(_L8("aClassUids.Count() = %d\n"), 	count);
+	OstTrace1( TRACE_NORMAL, CUSBDEVICE_CREATECLASSCONTROLLERSL, "CUsbDevice::CreateClassControllersL;aClassUids.Count() = %d", count );
 	for (TInt i = 0; i < count; i++)
 		{ 
 		CUsbClassControllerPlugIn* plugIn = CUsbClassControllerPlugIn::NewL(aClassUids[i], *this);
 		AddClassControllerL(reinterpret_cast<CUsbClassControllerBase*>(plugIn), order);
 		} 
 #endif // USE_DUMMY_CLASS_CONTROLLER	
-
-	LEAVEIFERRORL(iUsbClassControllerIterator->First());
+	TInt err = iUsbClassControllerIterator->First();	
+	if(err < 0)
+	    {
+        OstTrace1( TRACE_NORMAL, CUSBDEVICE_CREATECLASSCONTROLLERSL_DUP1, "CUsbDevice::CreateClassControllersL;iUsbClassControllerIterator->First() with error=%d", err );
+        User::Leave(err);
+	    }
  	}
 
 void CUsbDevice::SetDefaultPersonalityL()
@@ -1462,11 +1325,10 @@
  * Sets default personality. Used for Start request.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDEVICE_SETDEFAULTPERSONALITYL_ENTRY );
 
 	TInt smallestId = iSupportedPersonalities[0]->PersonalityId();
  	TInt count = iSupportedPersonalities.Count();
- 	
  	for (TInt i = 1; i < count; i++)
  		{
  		if(iSupportedPersonalities[i]->PersonalityId() < smallestId)
@@ -1474,9 +1336,10 @@
  			smallestId = iSupportedPersonalities[i]->PersonalityId();
  			}
  		}
-
+    
 	SetCurrentPersonalityL(smallestId);
 	SelectClassControllersL();
+	OstTraceFunctionExit0( CUSBDEVICE_SETDEFAULTPERSONALITYL_EXIT );
 	}
 
 void CUsbDevice::LoadFallbackClassControllersL()
@@ -1488,49 +1351,12 @@
  * or stopped
  */
  	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDEVICE_LOADFALLBACKCLASSCONTROLLERSL_ENTRY );
  	SetDeviceDescriptorL();
 	CreateClassControllersL(iSupportedClassUids);
+ 	OstTraceFunctionExit0( CUSBDEVICE_LOADFALLBACKCLASSCONTROLLERSL_EXIT );
  	}
  	
-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
@@ -1550,6 +1376,6 @@
  * @param aObserver New Observer of the device
  */
 	{
-	LOGTEXT2(_L8("CUsbDevice::MuepoDoRegisterStateObserverL aObserver = 0x%08x"),&aObserver);
+	OstTrace1( TRACE_NORMAL, CUSBDEVICE_MUEPODOREGISTERSTATEOBSERVERL, "CUsbDevice::MuepoDoRegisterStateObserverL;aObserver = 0x%08x", &aObserver );
 	RegisterObserverL(aObserver);
 	}
--- a/usbmgmt/usbmgr/usbman/server/SRC/CUsbDeviceStateWatcher.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/usbman/server/SRC/CUsbDeviceStateWatcher.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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,14 +21,15 @@
  @file
 */
 
-#include <usb/usblogger.h>
 #include "CUsbScheduler.h"
 #include "CUsbDeviceStateWatcher.h"
 #include "CUsbDevice.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "CUsbDeviceStateWatcherTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "USBSVR");
-#endif
+
 
 /**
  * The CUsbDeviceStateWatcher::NewL method
@@ -43,9 +44,10 @@
  */
 CUsbDeviceStateWatcher* CUsbDeviceStateWatcher::NewL(CUsbDevice& aOwner, RDevUsbcClient& aLdd)
 	{
-	LOG_STATIC_FUNC_ENTRY
+	OstTraceFunctionEntry0( CUSBDEVICESTATEWATCHER_NEWL_ENTRY );
 
 	CUsbDeviceStateWatcher* r = new (ELeave) CUsbDeviceStateWatcher(aOwner, aLdd);
+	OstTraceFunctionExit0( CUSBDEVICESTATEWATCHER_NEWL_EXIT );
 	return r;
 	}
 
@@ -59,7 +61,8 @@
  */
 CUsbDeviceStateWatcher::~CUsbDeviceStateWatcher()
 	{
-	LOGTEXT2(_L8(">CUsbDeviceStateWatcher::~CUsbDeviceStateWatcher (0x%08x)"), (TUint32) this);
+	OstTrace1( TRACE_NORMAL, CUSBDEVICESTATEWATCHER_CUSBDEVICESTATEWATCHER, 
+	        "CUsbDeviceStateWatcher::~CUsbDeviceStateWatcher;  this=(0x%08x)", (TUint32)this );
 	Cancel();
 	}
 
@@ -85,19 +88,21 @@
 	{
 	if (iStatus.Int() != KErrNone)
 		{
-		LOGTEXT2(_L8("CUsbDeviceStateWatcher::RunL() - Error = %d"), iStatus.Int());
+		OstTrace1( TRACE_NORMAL, CUSBDEVICESTATEWATCHER_RUNL, 
+		        "CUsbDeviceStateWatcher::RunL;Error=%d", iStatus.Int() );
 		return;
 		}
 
-	LOGTEXT2(_L8("CUsbDeviceStateWatcher::RunL() - State Changed to %d"), iState);
-
+	OstTrace1( TRACE_NORMAL, CUSBDEVICESTATEWATCHER_RUNL_DUP1, "CUsbDeviceStateWatcher::RunL; - State Changed to %u", iState );
+	
 	if (!(iState & KUsbAlternateSetting))
 		iOwner.SetDeviceState((TUsbcDeviceState) iState);
 
-	LOGTEXT(_L8("CUsbDeviceStateWatcher::RunL() - About to call DeviceStatusNotify"));
+	OstTrace0( TRACE_NORMAL, CUSBDEVICESTATEWATCHER_RUNL_DUP2, 
+	        "CUsbDeviceStateWatcher::RunL - About to call DeviceStatusNotify" );
 	iLdd.AlternateDeviceStatusNotify(iStatus, iState);
 	SetActive();
-	LOGTEXT(_L8("CUsbDeviceStateWatcher::RunL() - Called DeviceStatusNotify"));
+	OstTrace0( TRACE_NORMAL, CUSBDEVICESTATEWATCHER_RUNL_DUP3, "CUsbDeviceStateWatcher::RunL - Called DeviceStatusNotify" );
 	}
 
 
@@ -106,8 +111,9 @@
  */
 void CUsbDeviceStateWatcher::DoCancel()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDEVICESTATEWATCHER_DOCANCEL_ENTRY );
 	iLdd.AlternateDeviceStatusNotifyCancel();
+	OstTraceFunctionExit0( CUSBDEVICESTATEWATCHER_DOCANCEL_EXIT );
 	}
 
 
@@ -116,7 +122,8 @@
  */
 void CUsbDeviceStateWatcher::Start()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDEVICESTATEWATCHER_START_ENTRY );
 	iLdd.AlternateDeviceStatusNotify(iStatus, iState);
 	SetActive();
+	OstTraceFunctionExit0( CUSBDEVICESTATEWATCHER_START_EXIT );
 	}
--- a/usbmgmt/usbmgr/usbman/server/SRC/CUsbDummyClassController.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/usbman/server/SRC/CUsbDummyClassController.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -20,14 +20,16 @@
  @file
 */
 
-#include "CUsbDummyClassController.h"
 #include <usb_std.h>
-#include "inifile.h"
 #include <usb/usblogger.h>
+#include "CUsbDummyClassController.h"
+#include "inifile.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "CUsbDummyClassControllerTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "USBSVR");
-#endif
+
 
 _LIT(KDummyControllerPanic, "UsbDummyCC"); // must be <=16 chars
 // Panic codes
@@ -81,12 +83,13 @@
  * @return Ownership of a new CUsbDummyClassController object
  */
 	{
-	LOG_STATIC_FUNC_ENTRY
+	OstTraceFunctionEntry0( CUSBDUMMYCLASSCONTROLLER_NEWL_MUSBCLASSCONTROLLERNOTIFY_TUINT_ENTRY );
 
 	CUsbDummyClassController* self = new(ELeave) CUsbDummyClassController(aOwner, aIndex);
 	CleanupStack::PushL(self);
 	self->ConstructL();
 	CleanupStack::Pop(self);
+	OstTraceFunctionExit0( CUSBDUMMYCLASSCONTROLLER_NEWL_MUSBCLASSCONTROLLERNOTIFY_TUINT_EXIT );
 	return self;
 	}
 
@@ -103,12 +106,13 @@
  * @return Ownership of a new CUsbDummyClassController object
  */
  	{
-	LOG_STATIC_FUNC_ENTRY
+	OstTraceFunctionEntry0( CUSBDUMMYCLASSCONTROLLER_NEWL_MUSBCLASSCONTROLLERNOTIFY_TUINT_TINT_ENTRY );
 
  	CUsbDummyClassController* self = new(ELeave) CUsbDummyClassController(aOwner, aIndex, aPriority);
 	CleanupStack::PushL(self);
 	self->ConstructL();
 	CleanupStack::Pop(self);
+	OstTraceFunctionExit0( CUSBDUMMYCLASSCONTROLLER_NEWL_MUSBCLASSCONTROLLERNOTIFY_TUINT_TINT_EXIT );
 	return self;
  	}
  
@@ -149,7 +153,12 @@
  * Method to perform second phase construction.
  */
 	{
-	LEAVEIFERRORL(iTimer.CreateLocal());
+    TInt err = iTimer.CreateLocal();
+    if(err < 0)
+        {
+        OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_CONSTRUCTL, "CUsbDummyClassController::ConstructL; iTimer.CreateLocal() error, Leave error=%d", err );
+        User::Leave(err);
+        }
 	}
 
 CUsbDummyClassController::~CUsbDummyClassController()
@@ -174,18 +183,19 @@
  * @param aBehaviour The behaviour struct to read to.
  */
 	{
-	LOG_FUNC
-#ifdef __FLOG_ACTIVE
-	TBuf8<KMaxName> buf;
-	buf.Copy(aSection);
-	LOGTEXT2(_L8("\taSection = %S"), &buf);
-#endif // __FLOG_ACTIVE
+	OstTraceFunctionEntry0( CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_ENTRY );
+#ifdef _DEBUG
+	OstTraceExt1( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR,
+	        "CUsbDummyClassController::GetBehaviour;aSection=%S", aSection );
+#endif//_DEBUG
 
 	TPtrC temp;
 	if ( !aIniFile.FindVar(aSection, KType(), temp) )
 		{
-		LOGTEXT2(_L8("\tPANICKING: can't find Type item in section %S"), &aSection);
-		_USB_PANIC(KDummyControllerPanic, EDummyPanicBadIniFile);
+		OstTraceExt1( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP1, 
+		        "CUsbDummyClassController::GetBehaviour;PANICKING: can't find Type item in section %S", aSection );
+		OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP2, "CUsbDummyClassController::GetBehaviour; panic code=%d", EDummyPanicBadIniFile );
+		User::Panic(KDummyControllerPanic, EDummyPanicBadIniFile );
 		}
 	if ( temp == KSync )
 		{
@@ -201,21 +211,28 @@
 		}
 	else
 		{
-		LOGTEXT3(_L8("\tPANICKING: bad Type value (%S) in section %S"), &temp, &aSection);
-		_USB_PANIC(KDummyControllerPanic, EDummyPanicBadIniFile);
+		OstTraceExt2( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP3, 
+		        "CUsbDummyClassController::GetBehaviour;PANICKING: bad Type value (%S) in section %S", temp, aSection );
+		OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP4, "CUsbDummyClassController::GetBehaviour; panic code=%d", EDummyPanicBadIniFile );
+		User::Panic(KDummyControllerPanic, EDummyPanicBadIniFile);
 		}
 	TInt delay;
 	if ( !aIniFile.FindVar(aSection, KTime(), delay) )
 		{
-		LOGTEXT2(_L8("\tPANICKING: can't find Time item in section %S"), &aSection);
-		_USB_PANIC(KDummyControllerPanic, EDummyPanicBadIniFile);
+		OstTraceExt1( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP5, 
+		        "CUsbDummyClassController::GetBehaviour;PANICKING: can't find Time item in section %S", aSection );
+		OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP6, "CUsbDummyClassController::GetBehaviour;panic code=%d", EDummyPanicBadIniFile );
+		User::Panic(KDummyControllerPanic, EDummyPanicBadIniFile);
 		}
 	aBehaviour.iDelay = delay;
 	if ( !aIniFile.FindVar(aSection, KError(), aBehaviour.iErrorCode) )
 		{
-		LOGTEXT2(_L8("\tPANICKING: can't find Error item in section %S"), &aSection);
-		_USB_PANIC(KDummyControllerPanic, EDummyPanicBadIniFile);
+		OstTraceExt1( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP7, 
+		        "CUsbDummyClassController::GetBehaviour;aSection=%S", aSection );
+		OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP8, "CUsbDummyClassController::GetBehaviour;panic code=%d", EDummyPanicBadIniFile );
+		User::Panic(KDummyControllerPanic, EDummyPanicBadIniFile );
 		}
+	OstTraceFunctionExit0( CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_EXIT );
 	}
 
 void CUsbDummyClassController::DoGetConfigL()
@@ -223,7 +240,7 @@
  * Reads the config from the ini file.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDUMMYCLASSCONTROLLER_DOGETCONFIGL_ENTRY );
 
 	CIniFile* iniFile = CIniFile::NewL(_L("dummy.ini"));
 	CleanupStack::PushL(iniFile);
@@ -237,6 +254,7 @@
 	GetBehaviour(*iniFile, section, iShutdownBehaviour);
 
 	CleanupStack::PopAndDestroy(iniFile);
+	OstTraceFunctionExit0( CUSBDUMMYCLASSCONTROLLER_DOGETCONFIGL_EXIT );
 	}
 
 void CUsbDummyClassController::GetConfig()
@@ -247,7 +265,7 @@
  * the user to figure out what's gone wrong.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDUMMYCLASSCONTROLLER_GETCONFIG_ENTRY );
 
 	// Always use dummy.ini. The entity setting up the test is responsible for 
 	// copying the correct file to c:\\dummy.ini. The first found 
@@ -255,16 +273,25 @@
 	TRAPD(err, DoGetConfigL());
 	if ( err != KErrNone )
 		{
-		_USB_PANIC(KDummyControllerPanic, EDummyPanicUnhandledError);
+        OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP7, "CUsbDummyClassController::GetConfig;panic code=%d", EDummyPanicUnhandledError );
+		User::Panic(KDummyControllerPanic, EDummyPanicUnhandledError);
 		}
 	
-	LOGTEXT2(_L8("\tLogging dummy class controller behaviour for instance %d"), iIndex);
-	LOGTEXT2(_L8("\tiStartupBehaviour.iSynchronicity = %d"), iStartupBehaviour.iSynchronicity);
-	LOGTEXT2(_L8("\tiStartupBehaviour.iDelay = %d"), iStartupBehaviour.iDelay.Int());
-	LOGTEXT2(_L8("\tiStartupBehaviour.iErrorCode = %d"), iStartupBehaviour.iErrorCode);
-	LOGTEXT2(_L8("\tiShutdownBehaviour.iSynchronicity = %d"), iShutdownBehaviour.iSynchronicity);
-	LOGTEXT2(_L8("\tiShutdownBehaviour.iDelay = %d"), iShutdownBehaviour.iDelay.Int());
-	LOGTEXT2(_L8("\tiShutdownBehaviour.iErrorCode = %d"), iShutdownBehaviour.iErrorCode);
+	OstTrace1( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETCONFIG, 
+	        "CUsbDummyClassController::GetConfig; Logging dummy class controller behaviour for instance %d", iIndex );
+	OstTrace1( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP1, 
+	        "CUsbDummyClassController::GetConfig;iStartupBehaviour.iSynchronicity=%d", iStartupBehaviour.iSynchronicity );
+	OstTrace1( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP2, 
+	        "CUsbDummyClassController::GetConfig;iStartupBehaviour.iDelay.Int()=%d", iStartupBehaviour.iDelay.Int() );
+	OstTrace1( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP3, 
+	        "CUsbDummyClassController::GetConfig;iStartupBehaviour.iErrorCode=%d", iStartupBehaviour.iErrorCode );
+	OstTrace1( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP4, 
+	        "CUsbDummyClassController::GetConfig;iShutdownBehaviour.iSynchronicity=%d", iShutdownBehaviour.iSynchronicity );
+	OstTrace1( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP5, 
+	        "CUsbDummyClassController::GetConfig;iShutdownBehaviour.iDelay.Int()=%d", iShutdownBehaviour.iDelay.Int() );
+	OstTrace1( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP6, 
+	        "CUsbDummyClassController::GetConfig;iShutdownBehaviour.iErrorCode=%d", iShutdownBehaviour.iErrorCode );
+	OstTraceFunctionExit0( CUSBDUMMYCLASSCONTROLLER_GETCONFIG_EXIT );
 	}
 
 void CUsbDummyClassController::Start(TRequestStatus& aStatus)
@@ -274,11 +301,16 @@
  * @param aStatus Will be completed with success or failure.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDUMMYCLASSCONTROLLER_START_ENTRY );
+	
+	//Start() should only be called if the CC is idle or started	
 	
-	//Start() should only be called if the CC is idle or started		
-	__ASSERT_DEBUG((iState == EUsbServiceIdle || iState == EUsbServiceStarted), 
-							_USB_PANIC(KDummyControllerPanic, EDummyPanicBadApiCallStart) );
+	if(!(iState == EUsbServiceIdle || iState == EUsbServiceStarted))
+	    {
+        OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_START, "CUsbDummyClassController::Start;panic code=%d", EDummyPanicBadApiCallStart );
+        __ASSERT_DEBUG(EFalse, 
+                User::Panic(KDummyControllerPanic, EDummyPanicBadApiCallStart) );
+	    }
 
 	// Get config from ini file. Note that can't be done once in ConstructL 
 	// because then, in the case of a CC which doesn't Stop, we'd never be 
@@ -286,8 +318,12 @@
 	GetConfig();
 
 	// NB We enforce that the device doesn't re-post requests on us.
-	__ASSERT_DEBUG(!iReportStatus, 
-		_USB_PANIC(KDummyControllerPanic, EDummyPanicOutstandingRequestFromDevice));
+	if(iReportStatus)
+	    {
+        OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_START_DUP1, "CUsbDummyClassController::Start;panic code=%d", EDummyPanicOutstandingRequestFromDevice );
+        __ASSERT_DEBUG(EFalse, 
+                User::Panic(KDummyControllerPanic, EDummyPanicOutstandingRequestFromDevice));
+	    }
 	aStatus = KRequestPending;
 	iReportStatus = &aStatus;
 	
@@ -304,7 +340,13 @@
 
 	case EAsynchronous:
 		iTimer.After(iStatus, iStartupBehaviour.iDelay);
-		__ASSERT_DEBUG(!IsActive(), _USB_PANIC(KDummyControllerPanic, EDummyPanicAlreadyActive));		
+#ifdef _DEBUG
+		if(IsActive())
+		    {
+            OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_START_DUP2, "CUsbDummyClassController::Start;panic code=%d", EDummyPanicAlreadyActive );
+            User::Panic(KDummyControllerPanic, EDummyPanicAlreadyActive);
+		    }
+#endif
 		SetActive();
 		break;
 
@@ -313,9 +355,11 @@
 		break;
 
 	default:
-		_USB_PANIC(KDummyControllerPanic, EDummyPanicBadSynchronicity);
+	    OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_START_DUP3, "CUsbDummyClassController::Start;panic code=%d", EDummyPanicBadSynchronicity );
+	    User::Panic(KDummyControllerPanic, EDummyPanicBadSynchronicity);
 		break;
 		}
+	OstTraceFunctionExit0( CUSBDUMMYCLASSCONTROLLER_START_EXIT );
 	}
 
 void CUsbDummyClassController::Stop(TRequestStatus& aStatus)
@@ -325,11 +369,15 @@
  * @param aStatus Will be completed with success or failure.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDUMMYCLASSCONTROLLER_STOP_ENTRY );
 		
 	//Stop() should only be called if the CC is Started or Idle
-	__ASSERT_DEBUG((iState == EUsbServiceStarted || iState == EUsbServiceIdle), 
-				_USB_PANIC(KDummyControllerPanic, EDummyPanicBadApiCallStop));
+	if(!(iState == EUsbServiceStarted || iState == EUsbServiceIdle))
+	    {
+        OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_STOP, "CUsbDummyClassController::Stop;panic code=%d", EDummyPanicBadApiCallStop );
+        __ASSERT_DEBUG(EFalse, 
+                User::Panic(KDummyControllerPanic, EDummyPanicBadApiCallStop));
+	    }
 	
 	// Get config from ini file. Note that can't be done once in ConstructL 
 	// because then, in the case of a CC which doesn't Stop, we'd never be 
@@ -337,8 +385,12 @@
 	GetConfig();
 
 	// NB We enforce that the device doesn't re-post requests on us.
-	__ASSERT_DEBUG(!iReportStatus, 
-		_USB_PANIC(KDummyControllerPanic, EDummyPanicOutstandingRequestFromDevice));
+	if(iReportStatus)
+	    {
+        OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_STOP_DUP1, "CUsbDummyClassController::Stop;panic code=%d", EDummyPanicOutstandingRequestFromDevice );
+        __ASSERT_DEBUG(EFalse, 
+                User::Panic(KDummyControllerPanic, EDummyPanicOutstandingRequestFromDevice));
+	    }
 	aStatus = KRequestPending;
 	iReportStatus = &aStatus;
 
@@ -355,7 +407,13 @@
 
 	case EAsynchronous:
 		iTimer.After(iStatus, iShutdownBehaviour.iDelay);
-    	__ASSERT_DEBUG(!IsActive(), _USB_PANIC(KDummyControllerPanic, EDummyPanicAlreadyActive));		
+#ifdef _DEBUG
+    	if(IsActive())
+    	    {
+            OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_STOP_DUP2, "CUsbDummyClassController::Stop;panic code=%d", EDummyPanicAlreadyActive );
+            User::Panic(KDummyControllerPanic, EDummyPanicAlreadyActive);
+    	    }
+#endif
 		SetActive();
 		break;
 
@@ -364,9 +422,11 @@
 		break;
 
 	default:
-		_USB_PANIC(KDummyControllerPanic, EDummyPanicBadSynchronicity);
+	    OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_STOP_DUP3, "CUsbDummyClassController::Stop;panic code=%d", EDummyPanicBadSynchronicity );
+	    User::Panic(KDummyControllerPanic, EDummyPanicBadSynchronicity);
 		break;
 		}
+	OstTraceFunctionExit0( CUSBDUMMYCLASSCONTROLLER_STOP_EXIT );
 	}
 
 void CUsbDummyClassController::GetDescriptorInfo(TUsbDescriptor& aDescriptorInfo) const
@@ -385,8 +445,9 @@
  * Standard active object RunL. 
  */
 	{
-	LOGTEXT3(_L8(">>CUsbDummyClassController::RunL [iStatus=%d,iState=%d]"),
-			iStatus.Int(), iState);
+	OstTraceFunctionEntry0( CUSBDUMMYCLASSCONTROLLER_RUNL_ENTRY );
+	OstTraceExt2( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_RUNL, "CUsbDummyClassController::RunL;iStatus.Int()=%d;iState=%d", iStatus.Int(), iState );
+
 
 	if ( iStatus != KErrNone )
 		{
@@ -394,18 +455,27 @@
 		// there's no point trying to code round them. This is part of the 
 		// test framework and if it's failing we want to alert the user 
 		// without faffing around. (It invalidates the test.)
-		_USB_PANIC(KDummyControllerPanic, EDummyPanicUnhandledError);
+        OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_RUNL_DUP1, "CUsbDummyClassController::RunL;panic code=%d", EDummyPanicUnhandledError );
+        User::Panic(KDummyControllerPanic, EDummyPanicUnhandledError);
 		}								  
 
-	__ASSERT_DEBUG(iReportStatus, 
-		_USB_PANIC(KDummyControllerPanic, EDummyPanicBadState));
+	if(!iReportStatus)
+	    {
+        OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_RUNL_DUP2, "CUsbDummyClassController::RunL;panic code=%d", EDummyPanicBadState );
+        __ASSERT_DEBUG(EFalse, 
+                User::Panic(KDummyControllerPanic, EDummyPanicBadState));
+	    }
 
 	switch ( iState )
 		{
 	case EUsbServiceStarting:
 		// Completion of asynchronous startup...
-		__ASSERT_DEBUG(iStartupBehaviour.iSynchronicity == EAsynchronous, 
-			_USB_PANIC(KDummyControllerPanic, EDummyPanicBadSynchronicity));
+		if(iStartupBehaviour.iSynchronicity != EAsynchronous)
+		    {
+            OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_RUNL_DUP3, "CUsbDummyClassController::RunL;panic code=%d", EDummyPanicBadSynchronicity );
+            __ASSERT_DEBUG(EFalse, 
+                    User::Panic(KDummyControllerPanic, EDummyPanicBadSynchronicity));
+		    }
 		iState = EUsbServiceStarted;
 		User::RequestComplete(iReportStatus, iStartupBehaviour.iErrorCode);
 		iReportStatus = NULL;
@@ -413,8 +483,12 @@
 
 	case EUsbServiceStopping:
 		// Completion of asynchronous shutdown...
-		__ASSERT_DEBUG(iShutdownBehaviour.iSynchronicity == EAsynchronous, 
-			_USB_PANIC(KDummyControllerPanic, EDummyPanicBadSynchronicity));
+		if(iShutdownBehaviour.iSynchronicity != EAsynchronous)
+		    {
+            OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_RUNL_DUP4, "CUsbDummyClassController::RunL;panic code=%d", EDummyPanicBadSynchronicity );
+            __ASSERT_DEBUG(EFalse, 
+                    User::Panic(KDummyControllerPanic, EDummyPanicBadSynchronicity));
+		    }
 		iState = EUsbServiceIdle;
 		User::RequestComplete(iReportStatus, iShutdownBehaviour.iErrorCode);
 		iReportStatus = NULL;
@@ -423,11 +497,12 @@
 	case EUsbServiceIdle:
 	case EUsbServiceStarted:
 	default:
-		_USB_PANIC(KDummyControllerPanic, EDummyPanicBadState);
+	    OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_RUNL_DUP5, "CUsbDummyClassController::RunL;panic code=%d", EDummyPanicBadState );
+	    User::Panic(KDummyControllerPanic, EDummyPanicBadState);
 		break;
 		}
 
-	LOGTEXT(_L8("<<CUsbDummyClassController::RunL"));
+	OstTraceFunctionExit0( CUSBDUMMYCLASSCONTROLLER_RUNL_EXIT );
 	}
 
 void CUsbDummyClassController::DoCancel()
@@ -435,7 +510,7 @@
  * Standard active object cancellation function. 
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDUMMYCLASSCONTROLLER_DOCANCEL_ENTRY );
 
 	// Note that CActive::Cancel does not call DoCancel unless we are active. 
 	// Therefore we are at this point active. Therefore, we should have 
@@ -451,8 +526,13 @@
 	// the middle of a Start, then immediately issue another Start.
 	
 	// Cancel our own asynchronous operation.
-	__ASSERT_DEBUG(iTimer.Handle(), 
-		_USB_PANIC(KDummyControllerPanic, EDummyPanicBadState));
+#ifdef _DEBUG
+	if(!iTimer.Handle())
+	    {
+        OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_DOCANCEL, "CUsbDummyClassController::DoCancel;panic code=%d", EDummyPanicBadState ); 
+                User::Panic(KDummyControllerPanic, EDummyPanicBadState);
+	    }
+#endif
 	iTimer.Cancel();
 
 	// Update our iState. If we're starting, then roll back to idle. If we're 
@@ -460,29 +540,43 @@
 	switch ( iState )
 		{
 	case EUsbServiceStarting:
-		__ASSERT_DEBUG(iStartupBehaviour.iSynchronicity == EAsynchronous, 
-			_USB_PANIC(KDummyControllerPanic, EDummyPanicBadSynchronicity));
+		if(iStartupBehaviour.iSynchronicity != EAsynchronous)
+		    {
+            OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_DOCANCEL_DUP1, "CUsbDummyClassController::DoCancel;panic code=%d", EDummyPanicBadSynchronicity );
+            __ASSERT_DEBUG(EFalse, 
+                    User::Panic(KDummyControllerPanic, EDummyPanicBadSynchronicity));
+		    }
 		iState = EUsbServiceIdle;
 		break;
 
 	case EUsbServiceStopping:
-		__ASSERT_DEBUG(iShutdownBehaviour.iSynchronicity == EAsynchronous, 
-			_USB_PANIC(KDummyControllerPanic, EDummyPanicBadSynchronicity));
+		if(iShutdownBehaviour.iSynchronicity != EAsynchronous)
+		    {
+            OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_DOCANCEL_DUP2, "CUsbDummyClassController::DoCancel;panic code=%d", EDummyPanicBadSynchronicity );
+            __ASSERT_DEBUG(EFalse, 
+                    User::Panic(KDummyControllerPanic, EDummyPanicBadSynchronicity));
+		    }
 		iState = EUsbServiceStarted;
 		break;
 
 	case EUsbServiceIdle:
 	case EUsbServiceStarted:
 	default:
-		_USB_PANIC(KDummyControllerPanic, EDummyPanicBadState);
+	    OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_DOCANCEL_DUP3, "CUsbDummyClassController::DoCancel;panic code=%d", EDummyPanicBadState );
+	    User::Panic(KDummyControllerPanic, EDummyPanicBadState);
 		break;
 		}
 
-	// Complete the client's request.	
-	__ASSERT_DEBUG(iReportStatus, 
-		_USB_PANIC(KDummyControllerPanic, EDummyPanicBadState));
+	// Complete the client's request.
+	if(!iReportStatus)
+	    {
+        OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_DOCANCEL_DUP4, "CUsbDummyClassController::DoCancel;panic code=%d", EDummyPanicBadState );
+        __ASSERT_DEBUG(EFalse, 
+                User::Panic(KDummyControllerPanic, EDummyPanicBadState));
+	    }
 	User::RequestComplete(iReportStatus, KErrCancel); 
 	iReportStatus = NULL;
+	OstTraceFunctionExit0( CUSBDUMMYCLASSCONTROLLER_DOCANCEL_EXIT );
 	}
 
 TInt CUsbDummyClassController::RunError(TInt /*aError*/)
@@ -493,8 +587,9 @@
  * should never be called as there is another mechanism for catching errors.
  */
 	{
-	__ASSERT_DEBUG(EFalse, 
-		_USB_PANIC(KDummyControllerPanic, EDummyPanicBadState));
+    OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_RUNERROR, "CUsbDummyClassController::RunError;panic code=%d", EDummyPanicBadState );
+    __ASSERT_DEBUG(EFalse,
+            User::Panic(KDummyControllerPanic, EDummyPanicBadState));
 	return KErrNone;
 	}
 
--- a/usbmgmt/usbmgr/usbman/server/SRC/CUsbOtg.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/usbman/server/SRC/CUsbOtg.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-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,20 +21,22 @@
  @file
 */
 
+#include <e32property.h> //Publish & Subscribe header
 #include "CUsbOtg.h"
 #include "cusbotgwatcher.h"
 #include "CUsbDevice.h"
 #include "musbotghostnotifyobserver.h"
 #include "CUsbServer.h"
-#include <e32property.h> //Publish & Subscribe header
 #include "usberrors.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "CUsbOtgTraces.h"
+#endif
+
 
 //Name used in call to User::LoadLogicalDevice/User::FreeLogicalDevice
 _LIT(KUsbOtgLDDName,"otgdi");
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "USBSVR-OTG");
-#endif
 
 
 CUsbOtg* CUsbOtg::NewL()
@@ -44,12 +46,13 @@
  * @return	A new CUsbOtg object
  */
 	{
-	LOG_STATIC_FUNC_ENTRY
+	OstTraceFunctionEntry0( CUSBOTG_NEWL_ENTRY );
 
 	CUsbOtg* self = new (ELeave) CUsbOtg();
 	CleanupStack::PushL(self);
 	self->ConstructL();
 	CleanupStack::Pop(self);
+	OstTraceFunctionExit0( CUSBOTG_NEWL_EXIT );
 	return self;
 	}
 
@@ -59,8 +62,7 @@
  * Destructor.
  */
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CUSBOTG_CUSBOTG_DES_ENTRY );
 	// Cancel any outstanding asynchronous operation.
 	Stop();
 	
@@ -69,76 +71,93 @@
 	// the observers themselves.
 	iObservers.Reset();
 	
-	LOGTEXT2(_L8("about to stop Id-Pin watcher @ %08x"), (TUint32) iIdPinWatcher);
+	OstTrace1( TRACE_NORMAL, CUSBOTG_CUSBOTG, "CUsbOtg::~CUsbOtg;iIdPinWatcher=%08x", (TUint32)iIdPinWatcher );
+	
 	if (iIdPinWatcher)
 		{
 		iIdPinWatcher->Cancel();
 		delete iIdPinWatcher;
 		iIdPinWatcher = NULL;
-		LOGTEXT(_L8("deleted Id-Pin watcher"));
+		OstTrace0( TRACE_NORMAL, CUSBOTG_CUSBOTG_DUP1, "CUsbOtg::~CUsbOtg;deleted Id-Pin watcher" );
+		
 		}
-	LOGTEXT2(_L8("about to stop Vbus watcher @ %08x"), (TUint32) iVbusWatcher);
+	OstTrace1( TRACE_NORMAL, CUSBOTG_CUSBOTG_DUP2, "CUsbOtg::~CUsbOtg;about to stop Vbus watcher @ %08x", (TUint32)iVbusWatcher );
+	
 	if (iVbusWatcher)
 		{
 		iVbusWatcher->Cancel();
 		delete iVbusWatcher;
 		iVbusWatcher = NULL;
-		LOGTEXT(_L8("deleted Vbus watcher"));
+		OstTrace0( TRACE_NORMAL, CUSBOTG_CUSBOTG_DUP3, "CUsbOtg::~CUsbOtg;deleted Vbus watcher" );
+		
 		}
-	LOGTEXT2(_L8("about to stop OTG State watcher @ %08x"), (TUint32) iVbusWatcher);
+	OstTrace1( TRACE_NORMAL, CUSBOTG_CUSBOTG_DUP4, "CUsbOtg::~CUsbOtg;about to stop OTG State watcher @ %08x", (TUint32) iVbusWatcher );
+	
 	if (iOtgStateWatcher)
 		{
 		iOtgStateWatcher->Cancel();
 		delete iOtgStateWatcher;
 		iOtgStateWatcher = NULL;
-		LOGTEXT(_L8("deleted OTG State watcher"));
+		OstTrace0( TRACE_NORMAL, CUSBOTG_CUSBOTG_DUP5, "CUsbOtg::~CUsbOtg;deleted OTG State watcher" );
+		
 		}
-	LOGTEXT2(_L8("about to stop OTG Event watcher @ %08x"), (TUint32) iVbusWatcher);
+	OstTrace1( TRACE_NORMAL, CUSBOTG_CUSBOTG_DUP6, "CUsbOtg::~CUsbOtg;about to stop OTG Event watcher @ %08x", (TUint32) iVbusWatcher );
+	
 	if (iOtgEventWatcher)
 		{
 		iOtgEventWatcher->Cancel();
 		delete iOtgEventWatcher;
 		iOtgEventWatcher = NULL;
-		LOGTEXT(_L8("deleted OTG Event watcher"));
+		OstTrace0( TRACE_NORMAL, CUSBOTG_CUSBOTG_DUP7, "CUsbOtg::~CUsbOtg;deleted OTG Event watcher" );
+
 		}
 	
 	if (iRequestSessionWatcher)
 		{
 		delete iRequestSessionWatcher;
-		LOGTEXT(_L8("deleted Session Request watcher"));
+		OstTrace0( TRACE_NORMAL, CUSBOTG_CUSBOTG_DUP8, "CUsbOtg::~CUsbOtg;deleted Session Request watcher" );
+		
 		}
 
-	LOGTEXT2(_L8("about to stop Connection Idle watcher @ %08x"), (TUint32)iOtgConnectionIdleWatcher);
+	OstTrace1( TRACE_NORMAL, CUSBOTG_CUSBOTG_DUP9, 
+	        "CUsbOtg::~CUsbOtg;about to stop Connection Idle watcher @ %08x", (TUint32)iOtgConnectionIdleWatcher );
+	
 	if (iOtgConnectionIdleWatcher)
 		{
 		iOtgConnectionIdleWatcher->Cancel();
 		delete iOtgConnectionIdleWatcher;
 		iOtgConnectionIdleWatcher= NULL;
-		LOGTEXT(_L8("deleted Connection Idle watcher"));
+		OstTrace0( TRACE_NORMAL, CUSBOTG_CUSBOTG_DUP10, "CUsbOtg::~CUsbOtg;deleted Connection Idle watcher" );
+		
 		}
 
 	// Unload OTGDI components if it was ever started
 	if ( iOtgDriver.Handle() )
 		{
-		LOGTEXT(_L8("Stopping stacks"));
+		OstTrace0( TRACE_NORMAL, CUSBOTG_CUSBOTG_DUP11, "CUsbOtg::~CUsbOtg; Stopping stacks" );
+		
 		iOtgDriver.StopStacks();
 		iOtgDriver.Close();
 		}
 	else
 		{
-		LOGTEXT(_L8("No OTG Driver session was opened, nothing to do"));
+		OstTrace0( TRACE_NORMAL, CUSBOTG_CUSBOTG_DUP12, "CUsbOtg::~CUsbOtg; No OTG Driver session was opened, nothing to do" );
+		
 		}
 
-	LOGTEXT(_L8("Freeing logical device"));
+	OstTrace0( TRACE_NORMAL, CUSBOTG_CUSBOTG_DUP13, "CUsbOtg::~CUsbOtg; Freeing logical device" );
+	
 	TInt err = User::FreeLogicalDevice(KUsbOtgLDDName);
 	//Putting the LOGTEXT2 inside the if statement prevents a compiler
 	//warning about err being unused in UREL builds.
 	if(err)
 		{
-		LOGTEXT2(_L8("     User::FreeLogicalDevice returned %d"),err);
+		OstTrace1( TRACE_NORMAL, CUSBOTG_CUSBOTG_DUP14, "CUsbOtg::~CUsbOtg;     User::FreeLogicalDevice returned %d", err );
+		
 		}
 	
 	iCriticalSection.Close();
+	OstTraceFunctionExit0( CUSBOTG_CUSBOTG_DES_EXIT );
 	}
 
 
@@ -147,7 +166,9 @@
  * Constructor.
  */
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry0( CUSBOTG_CUSBOTG_CONS_ENTRY );
+    
+	OstTraceFunctionExit0( CUSBOTG_CUSBOTG_CONS_EXIT );
 	}
 
 
@@ -156,31 +177,41 @@
  * Performs 2nd phase construction of the OTG object.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTG_CONSTRUCTL_ENTRY );
 	
-	LOGTEXT(_L8("About to open LDD"));
+	OstTrace0( TRACE_NORMAL, CUSBOTG_CONSTRUCTL, "CUsbOtg::ConstructL; About to open LDD" );
+	
 	iLastError = User::LoadLogicalDevice(KUsbOtgLDDName);
 	if ( (iLastError != KErrNone) && (iLastError != KErrAlreadyExists) )
 		{
-		LOGTEXT3(_L8("Error %d: Unable to load driver: %S"), iLastError, &KUsbOtgLDDName);
-		LEAVEIFERRORL(iLastError);
+        if(iLastError < 0)
+            {
+            OstTraceExt2( TRACE_NORMAL, CUSBOTG_CONSTRUCTL_DUP1, "CUsbOtg::ConstructL; Error %d: Unable to load driver: %S", iLastError, KUsbOtgLDDName );
+            User::Leave(iLastError);
+            }
 		}
-
-	LOGTEXT(_L8("About to open RUsbOtgDriver"));
+	OstTrace0( TRACE_NORMAL, CUSBOTG_CONSTRUCTL_DUP3, "CUsbOtg::ConstructL; About to open RUsbOtgDriver" );
+	
 	iLastError = iOtgDriver.Open();
 	if ( (iLastError != KErrNone) && (iLastError != KErrAlreadyExists) )
 		{
-		LOGTEXT2(_L8("Error %d: Unable to open RUsbOtgDriver session"), iLastError);
-		LEAVEIFERRORL(iLastError);
+        if(iLastError < 0)
+            {
+            OstTrace1( TRACE_NORMAL, CUSBOTG_CONSTRUCTL_DUP4, "CUsbOtg::ConstructL; Error %d: Unable to open RUsbOtgDriver session", iLastError );
+            User::Leave(iLastError);
+            }	
 		}
 
-
-	LOGTEXT(_L8("About to start OTG stacks"));
+	OstTrace0( TRACE_NORMAL, CUSBOTG_CONSTRUCTL_DUP2, "CUsbOtg::ConstructL; About to start OTG stacks" );
+	
 	iLastError = iOtgDriver.StartStacks();
 	if (iLastError != KErrNone)
 		{
-		LOGTEXT2(_L8("Error %d: Unable to open start OTG stacks"), iLastError);
-		LEAVEIFERRORL(iLastError);
+        if(iLastError < 0)
+            {
+            OstTrace1( TRACE_NORMAL, CUSBOTG_CONSTRUCTL_DUP5, "CUsbOtg::ConstructL; Error %d: Unable to open start OTG stacks", iLastError );
+            User::Leave(iLastError);
+            }
 		}
 
 	// Request Otg notifications
@@ -203,7 +234,9 @@
 	
 	iCriticalSection.CreateLocal(EOwnerProcess);
 	
-	LOGTEXT(_L8("UsbOtg::ConstructL() finished"));
+	OstTrace0( TRACE_NORMAL, CUSBOTG_CONSTRUCTL_DUP6, "CUsbOtg::ConstructL; UsbOtg::ConstructL() finished" );
+	
+	OstTraceFunctionExit0( CUSBOTG_CONSTRUCTL_EXIT );
 	}
 	
 void CUsbOtg::NotifyMessage(TInt aMessage)
@@ -275,7 +308,9 @@
 	TInt otgEvent = TranslateOtgEvent();
 	if ( otgEvent == KErrBadName )
 		{
-		LOGTEXT2(_L8("CUsbOtg::NotifyOtgEvent(): OTG event %d was reported, but not propagated"), (TInt) iOtgEvent);
+		OstTrace1( TRACE_NORMAL, CUSBOTG_NOTIFYOTGEVENT,
+		        "CUsbOtg::NotifyOtgEvent;OTG event %d was reported, but not propagated", (TInt)iOtgEvent );
+		
 		return;
 		}
 
@@ -293,9 +328,16 @@
  * @param	aObserver	New Observer of the OTG events
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTG_REGISTEROBSERVERL_ENTRY );
 
-	LEAVEIFERRORL(iObservers.Append(&aObserver));
+    TInt err = iObservers.Append(&aObserver);
+    if(err < 0)
+        {
+        OstTrace1( TRACE_NORMAL, CUSBOTG_REGISTEROBSERVERL, "CUsbOtg::RegisterObserverL; iObservers.Append(&aObserver) error, Leave error=%d", err );
+        User::Leave(err);
+        }
+
+	OstTraceFunctionExit0( CUSBOTG_REGISTEROBSERVERL_EXIT );
 	}
 
 
@@ -306,7 +348,7 @@
  * @param	aObserver	The existing OTG events observer to be de-registered
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTG_DEREGISTEROBSERVER_ENTRY );
 
 	TInt index = iObservers.Find(&aObserver);
 
@@ -314,6 +356,7 @@
 		{
 		iObservers.Remove(index);
 		}
+	OstTraceFunctionExit0( CUSBOTG_DEREGISTEROBSERVER_EXIT );
 	}
 
 
@@ -323,10 +366,11 @@
  * Reports errors and OTG events via observer interface.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTG_STARTL_ENTRY );
 
 	iOtgWatcher = CUsbOtgWatcher::NewL(*this, iOtgDriver, iOtgMessage);
 	iOtgWatcher->Start();
+	OstTraceFunctionExit0( CUSBOTG_STARTL_EXIT );
 	}
 
 void CUsbOtg::Stop()
@@ -334,41 +378,44 @@
  * Stop the USB OTG events watcher
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTG_STOP_ENTRY );
 
-	LOGTEXT2(_L8("about to stop OTG watcher @ %08x"), (TUint32) iOtgWatcher);
+	OstTrace1( TRACE_NORMAL, CUSBOTG_STOP, "CUsbOtg::Stop;about to stop OTG watcher @ %08x", (TUint32)iOtgWatcher );
+	
 	
 	if (iOtgWatcher)
 		{
 		iOtgWatcher->Cancel();
 		delete iOtgWatcher;
 		iOtgWatcher = NULL;
-		LOGTEXT(_L8("deleted OTG watcher"));
+		OstTrace0( TRACE_NORMAL, CUSBOTG_STOP_DUP1, "CUsbOtg::Stop" );
+		
 		}
 	
 	iLastError = KErrNone;
+	OstTraceFunctionExit0( CUSBOTG_STOP_EXIT );
 	}
 
 TInt CUsbOtg::BusRequest()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTG_BUSREQUEST_ENTRY );
 	return iOtgDriver.BusRequest();
 	}
 	
 TInt CUsbOtg::BusRespondSrp()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTG_BUSRESPONDSRP_ENTRY );
 	return iOtgDriver.BusRespondSrp();
 	}
 
 TInt CUsbOtg::BusClearError()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTG_BUSCLEARERROR_ENTRY );
 	return iOtgDriver.BusClearError();
 	}
 
 TInt CUsbOtg::BusDrop()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTG_BUSDROP_ENTRY );
 	return iOtgDriver.BusDrop();
 	}
--- a/usbmgmt/usbmgr/usbman/server/SRC/CUsbScheduler.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/usbman/server/SRC/CUsbScheduler.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -19,13 +19,14 @@
  @file
 */
 
-#include <usb/usblogger.h>
 #include "CUsbScheduler.h"
 #include "CUsbServer.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "CUsbSchedulerTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "USBSVR");
-#endif
+
 
 /**
  * The CUsbScheduler::NewL method
@@ -36,9 +37,10 @@
  */
 CUsbScheduler* CUsbScheduler::NewL()
 	{
-	LOG_STATIC_FUNC_ENTRY
-
+	OstTraceFunctionEntry0( CUSBSCHEDULER_NEWL_ENTRY );
+	
 	CUsbScheduler* self = new(ELeave) CUsbScheduler;
+	OstTraceFunctionExit0( CUSBSCHEDULER_NEWL_EXIT );
 	return self;
 	}
 
@@ -80,7 +82,8 @@
  */
 void CUsbScheduler::Error(TInt aError) const
 	{
-	LOGTEXT2(_L8("CUsbScheduler::Error aError=%d"), aError);
+	OstTrace1( TRACE_NORMAL, CUSBSCHEDULER_ERROR, "CUsbScheduler::Error;aError=%d", aError );
+	
 
 	if (iServer)
 		{
--- a/usbmgmt/usbmgr/usbman/server/SRC/CUsbServer.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/usbman/server/SRC/CUsbServer.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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,24 +21,25 @@
 */
 
 #include <e32svr.h>
+#include <usb/usblogger.h>
 #include "UsbSettings.h"
 #include "CUsbServer.h"
 #include "CUsbSession.h"
 #include "CUsbDevice.h"
 
 #ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV
+#include <e32property.h> //Publish & Subscribe header
 #include "CUsbOtg.h"
 #include "cusbhost.h"
-#include <e32property.h> //Publish & Subscribe header
 #endif // SYMBIAN_ENABLE_USB_OTG_HOST_PRIV
 
-#include <usb/usblogger.h>
 #include "UsbmanServerSecurityPolicy.h"
-#include <usb/usblogger.h>
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "CUsbServerTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "USBSVR");
-#endif
+
 
 /**
  * The CUsbServer::NewL method
@@ -51,12 +52,13 @@
  */
 CUsbServer* CUsbServer::NewLC()
 	{
-	LOG_STATIC_FUNC_ENTRY
+	OstTraceFunctionEntry0( CUSBSERVER_NEWLC_ENTRY );
 
 	CUsbServer* self = new(ELeave) CUsbServer;
 	CleanupStack::PushL(self);
 	self->StartL(KUsbServerName);
 	self->ConstructL();
+	OstTraceFunctionExit0( CUSBSERVER_NEWLC_EXIT );
 	return self;
 	}
 
@@ -70,7 +72,7 @@
  */
 CUsbServer::~CUsbServer()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSERVER_CUSBSERVER_DES_ENTRY );
 
 	delete iShutdownTimer;
 	delete iUsbDevice;
@@ -80,21 +82,21 @@
 	
 #ifndef __OVER_DUMMYUSBDI__
 	// Check that this is A-Device
-	LOGTEXT(_L8("Checking Id-Pin state..."));
+	OstTrace0( TRACE_NORMAL, CUSBSERVER_CUSBSERVER, "CUsbServer::~CUsbServer; Checking Id-Pin state..." );
 	TInt value = 0;
 	TInt err = RProperty::Get(KUidUsbManCategory, KUsbOtgIdPinPresentProperty,value);
 	if (err == 0 && value == 1)
 		{
 		// Ensure VBus is dropped when Usb server exits
-		LOGTEXT(_L8("Checking VBus state..."));
+		OstTrace0( TRACE_NORMAL, CUSBSERVER_CUSBSERVER_DUP1, "CUsbServer::~CUsbServer; Checking VBus state..." );
 		err = RProperty::Get(KUidUsbManCategory, KUsbOtgVBusPoweredProperty,value);
 		if ( err == KErrNone && value != 0 )
 			{
 			if ( iUsbOtg )
 				{
 				err = iUsbOtg->BusDrop();
-				LOGTEXT2(_L8("BusDrop() returned err = %d"),err);
-				LOGTEXT(_L8("USBMAN will wait until VBus is actually dropped"));
+				OstTrace1( TRACE_NORMAL, CUSBSERVER_CUSBSERVER_DUP2, "CUsbServer::~CUsbServer;BusDrop() returned err = %d", err );
+				OstTrace0( TRACE_NORMAL, CUSBSERVER_CUSBSERVER_DUP3, "CUsbServer::~CUsbServer; USBMAN will wait until VBus is actually dropped" );
 				// Wait 1 second for Hub driver to perform VBus drop
 				RTimer timer;
 				err = timer.CreateLocal();
@@ -107,31 +109,29 @@
 					}
 				else
 					{
-					LOGTEXT2(_L8("Failed to create local timer: err = %d"),err);
+					OstTrace1( TRACE_NORMAL, CUSBSERVER_CUSBSERVER_DUP4, "CUsbServer::~CUsbServer;Failed to create local timer: err = %d", err );
 					}
 				}
 			else
 				{
-				LOGTEXT(_L8("Unexpected: OTG object is NULL"));
+				OstTrace0( TRACE_NORMAL, CUSBSERVER_CUSBSERVER_DUP5, "CUsbServer::~CUsbServer; Unexpected: OTG object is NULL" );
 				}
 			}
 		else
 			{
-			LOGTEXT3(_L8("VBus is already dropped or an error occured: err = %d, value =%d"),err,value);
+			OstTraceExt2( TRACE_NORMAL, CUSBSERVER_CUSBSERVER_DUP6, "CUsbServer::~CUsbServer;VBus is already dropped or an error occured: err = %d, value =%d", err, value );
 			}
 		}
 	else
 		{
-		LOGTEXT3(_L8("No Id-Pin is found or an error occured: err = %d, value = %d"), err, value);
+		OstTraceExt2( TRACE_NORMAL, CUSBSERVER_CUSBSERVER_DUP7, "CUsbServer::~CUsbServer;No Id-Pin is found or an error occured: err = %d, value = %d", err, value );
 		}
 	
 	delete iUsbOtg;
 #endif
 #endif // SYMBIAN_ENABLE_USB_OTG_HOST_PRIV
 
-#ifdef __FLOG_ACTIVE
-	CUsbLog::Close();
-#endif
+	OstTraceFunctionExit0( CUSBSERVER_CUSBSERVER_DES_EXIT );
 	}
 
 
@@ -156,12 +156,7 @@
  */
 void CUsbServer::ConstructL()
 	{
-#ifdef __FLOG_ACTIVE
-	// Set the logger up so that everything in this thread that logs using it 
-	// will do so 'connectedly' (i.e. quickly). If this fails, we don't care- 
-	// logging will still work, just 'statically' (i.e. slowly).
-	static_cast<void>(CUsbLog::Connect());
-#endif
+
 
 	iShutdownTimer = new(ELeave) CShutdownTimer;
 	iShutdownTimer->ConstructL(); 
@@ -174,7 +169,7 @@
 #endif // SYMBIAN_ENABLE_USB_OTG_HOST_PRIV
 
 	iUsbDevice = CUsbDevice::NewL(*this);
-	LOGTEXT(_L8("About to load USB classes"));
+	OstTrace0( TRACE_NORMAL, CUSBSERVER_CONSTRUCTL, "CUsbServer::ConstructL; About to load USB classes" );
 	iUsbDevice->EnumerateClassControllersL();
 
 #ifndef USE_DUMMY_CLASS_CONTROLLER	
@@ -188,11 +183,11 @@
 		}
 	else  
 		{
-		LOGTEXT(_L8("Personalities unconfigured, so using fallback CCs"));
+		OstTrace0( TRACE_NORMAL, CUSBSERVER_CONSTRUCTL_DUP1, "CUsbServer::ConstructL;Personalities unconfigured, so using fallback CCs" );
 		iUsbDevice->LoadFallbackClassControllersL();
 		}
 #else // USE_DUMMY_CLASS_CONTROLLER
-	LOGTEXT(_L8("Using Dummy Class Controller, so using fallback CCs"));
+	OstTrace0( TRACE_NORMAL, CUSBSERVER_CONSTRUCTL_DUP2, "CUsbServer::ConstructL; Using Dummy Class Controller, so using fallback CCs" );
 	iUsbDevice->LoadFallbackClassControllersL();
 #endif // USE_DUMMY_CLASS_CONTROLLER		
 
@@ -204,7 +199,7 @@
 	iUsbHost->StartL();
 #endif // SYMBIAN_ENABLE_USB_OTG_HOST_PRIV
 
-	LOGTEXT(_L8("CUsbServer constructed"));
+	OstTrace0( TRACE_NORMAL, CUSBSERVER_CONSTRUCTL_DUP3, "CUsbServer::ConstructL; CUsbServer constructed" );
 	}
 
 
@@ -221,23 +216,24 @@
  */
 CSession2* CUsbServer::NewSessionL(const TVersion &aVersion, const RMessage2& aMessage) const
 	{
-	LOG_LINE
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSERVER_NEWSESSIONL_ENTRY );
 
 	(void)aMessage;//Remove compiler warning
 	
 	TVersion v(KUsbSrvMajorVersionNumber,KUsbSrvMinorVersionNumber,KUsbSrvBuildVersionNumber);
 
-	LOGTEXT(_L8("CUsbServer::NewSessionL - creating new session..."));
+	OstTrace0( TRACE_NORMAL, CUSBSERVER_NEWSESSIONL, "CUsbServer::NewSessionL; CUsbServer::NewSessionL - creating new session..." );
 	if (!User::QueryVersionSupported(v, aVersion))
 		{
-		LEAVEL(KErrNotSupported);
+        OstTrace1( TRACE_NORMAL, CUSBSERVER_NEWSESSIONL_DUP1, "CUsbServer::NewSessionL;leave reason=%d", KErrNotSupported );
+		User::Leave(KErrNotSupported);
 		}
 
 	CUsbServer* ncThis = const_cast<CUsbServer*>(this);
 	
 	CUsbSession* sess = CUsbSession::NewL(ncThis);
 		
+	OstTraceFunctionExit0( CUSBSERVER_NEWSESSIONL_EXIT );
 	return sess;
 	}
 
@@ -249,7 +245,7 @@
  */
 void CUsbServer::Error(TInt aError)
 	{
-	LOGTEXT2(_L8("CUsbServer::Error [aError=%d]"), aError);
+	OstTrace1( TRACE_NORMAL, CUSBSERVER_ERROR, "CUsbServer::Error;aError=%d", aError );
 
 	Message().Complete(aError);
 	ReStart();
@@ -262,13 +258,18 @@
  */
 void CUsbServer::IncrementSessionCount()
 	{
-	LOGTEXT2(_L8(">CUsbServer::IncrementSessionCount %d"), iSessionCount);
-	__ASSERT_DEBUG(iSessionCount >= 0, _USB_PANIC(KUsbSvrPncCat, EICSInvalidCount));
+	OstTraceFunctionEntry0( CUSBSERVER_INCREMENTSESSIONCOUNT_ENTRY );
+	OstTrace1( TRACE_NORMAL, CUSBSERVER_INCREMENTSESSIONCOUNT, "CUsbServer::IncrementSessionCount;iSessionCount=%d", iSessionCount );
+	if(iSessionCount < 0)
+	    {
+        OstTrace1( TRACE_FATAL, CUSBSERVER_INCREMENTSESSIONCOUNT_DUP1, "CUsbServer::IncrementSessionCount;panic code=%d", EICSInvalidCount );
+        __ASSERT_DEBUG(EFalse, User::Panic(KUsbSvrPncCat, EICSInvalidCount));
+	    }
 	
 	++iSessionCount;
 	iShutdownTimer->Cancel();
 
-	LOGTEXT(_L8("<CUsbServer::IncrementSessionCount"));
+	OstTraceFunctionExit0( CUSBSERVER_INCREMENTSESSIONCOUNT_EXIT );
 	}
 
 /**
@@ -278,8 +279,12 @@
  */
 void CUsbServer::DecrementSessionCount()
 	{
-	LOGTEXT3(_L8("CUsbServer::DecrementSessionCount %d, %d"), iSessionCount, Device().ServiceState());
-	__ASSERT_DEBUG(iSessionCount > 0, _USB_PANIC(KUsbSvrPncCat, EDCSInvalidCount));
+	OstTraceExt2( TRACE_NORMAL, CUSBSERVER_DECREMENTSESSIONCOUNT, "CUsbServer::DecrementSessionCount;iSessionCount=%d;Device().ServiceState()=%d", iSessionCount, Device().ServiceState() );
+	if(iSessionCount <= 0)
+	    {
+        OstTrace1( TRACE_FATAL, CUSBSERVER_DECREMENTSESSIONCOUNT_DUP1, "CUsbServer::DecrementSessionCount;panic code=%d", EDCSInvalidCount );
+        __ASSERT_DEBUG(EFalse, User::Panic(KUsbSvrPncCat, EDCSInvalidCount));
+	    }
 	
 	--iSessionCount;
 	
@@ -300,11 +305,17 @@
  */
 void CUsbServer::LaunchShutdownTimerIfNoSessions()
 	{
-	LOGTEXT(_L8("CUsbServer::LaunchShutdownTimerIfNoSessions"));
-	__ASSERT_DEBUG(Device().ServiceState() == EUsbServiceIdle, _USB_PANIC(KUsbSvrPncCat, ELSTNSNotIdle));
-
+	OstTraceFunctionEntry0( CUSBSERVER_LAUNCHSHUTDOWNTIMERIFNOSESSIONS_ENTRY );
+#ifdef _DEBUG
+	if(Device().ServiceState() != EUsbServiceIdle)
+	    {
+        OstTrace1( TRACE_FATAL, CUSBSERVER_LAUNCHSHUTDOWNTIMERIFNOSESSIONS, "CUsbServer::LaunchShutdownTimerIfNoSessions;panic code=%d", ELSTNSNotIdle );
+        User::Panic(KUsbSvrPncCat, ELSTNSNotIdle);
+	    }
+#endif
 	if (iSessionCount == 0)
 		iShutdownTimer->After(KShutdownDelay);
+	OstTraceFunctionExit0( CUSBSERVER_LAUNCHSHUTDOWNTIMERIFNOSESSIONS_EXIT );
 	}
 
 /**
--- a/usbmgmt/usbmgr/usbman/server/SRC/CUsbSession.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/usbman/server/SRC/CUsbSession.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -20,7 +20,11 @@
  @file
 */
 
+#include <usbstates.h>
+#include <usberrors.h>
+#include <usb/usbshared.h>
 #include <usb/usblogger.h>
+
 #include "CUsbSession.h"
 #include "CUsbDevice.h"
 #include "CUsbServer.h"
@@ -30,17 +34,15 @@
 #include "cusbhost.h"
 #endif // SYMBIAN_ENABLE_USB_OTG_HOST_PRIV
 
-#include <usbstates.h>
-#include <usberrors.h>
-
-#include <usb/usbshared.h>
 #include "CPersonality.h"
 #include "rusb.h"
 #include "UsbSettings.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "CUsbSessionTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "USBSVR");
-#endif
+
 
 #ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV
 CUsbSession* CUsbSession::iCtlSession = NULL;
@@ -56,7 +58,7 @@
  */
 CUsbSession* CUsbSession::NewL(CUsbServer* aServer)
 	{
-	LOG_STATIC_FUNC_ENTRY
+	OstTraceFunctionEntry0( CUSBSESSION_NEWL_ENTRY );
 
 	//this class has moved away from standard NewL() semantics
 	//and now uses the virtual CSession2::CreateL() function
@@ -75,9 +77,10 @@
 CUsbSession::CUsbSession(CUsbServer* aServer)
 	: iUsbServer(aServer)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_CUSBSESSION_CONS_ENTRY );
 
 	iUsbServer->IncrementSessionCount();
+	OstTraceFunctionExit0( CUSBSESSION_CUSBSESSION_CONS_EXIT );
 	}
 
 
@@ -86,18 +89,18 @@
  */
 CUsbSession::~CUsbSession()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_CUSBSESSION_DES_ENTRY );
 
-	LOGTEXT2(_L8("About to Device().DeRegisterObserver(%08x"),this);
+	OstTrace1( TRACE_NORMAL, CUSBSESSION_CUSBSESSION, "CUsbSession::~CUsbSession;About to Device().DeRegisterObserver(%08x)", this );
 	iUsbServer->Device().DeRegisterObserver(*this);
 
 #ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV
 #ifndef __OVER_DUMMYUSBDI__
-	LOGTEXT2(_L8("About to Otg().DeRegisterObserver(%08x"),this);
+	OstTrace1( TRACE_NORMAL, CUSBSESSION_CUSBSESSION_DUP1, "CUsbSession::~CUsbSession;About to Otg().DeRegisterObserver(%08x)", this );
 	iUsbServer->Otg().DeRegisterObserver(*this);
 #endif
 
-	LOGTEXT2(_L8("About to Host().DeRegisterObserver(%08x"),this);
+	OstTrace1( TRACE_NORMAL, CUSBSESSION_CUSBSESSION_DUP2, "CUsbSession::~CUsbSession;About to Host().DeRegisterObserver(%08x)", this );
 	iUsbServer->Host().DeregisterObserver(*this);
 
 	if ( iCtlSession && (iCtlSession == this) )
@@ -106,8 +109,9 @@
 		}
 #endif // SYMBIAN_ENABLE_USB_OTG_HOST_PRIV
 
-	LOGTEXT(_L8("About to iUsbServer->DecrementSessionCount()"));
+	OstTrace0( TRACE_NORMAL, CUSBSESSION_CUSBSESSION_DUP3, "CUsbSession::~CUsbSession;About to iUsbServer->DecrementSessionCount()" );
 	iUsbServer->DecrementSessionCount();
+	OstTraceFunctionExit0( CUSBSESSION_CUSBSESSION_DES_EXIT );
 	}
 
 
@@ -118,9 +122,10 @@
  */
 void CUsbSession::ServiceL(const RMessage2& aMessage)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_SERVICEL_ENTRY );
 
 	DispatchMessageL(aMessage);
+	OstTraceFunctionExit0( CUSBSESSION_SERVICEL_EXIT );
 	}
 
 /**
@@ -130,7 +135,7 @@
  */
 void CUsbSession::CreateL()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_CREATEL_ENTRY );
 
 	// This code originally existed in the typical non-virtual ConstructL() method.
 	// However it was moved to this method for minor optimisation reasons [three less
@@ -138,18 +143,19 @@
 
 	iPersonalityCfged = iUsbServer->Device().isPersonalityCfged();
 
-    LOGTEXT(_L8("Registering Device Observer\n"));
+    OstTrace0( TRACE_NORMAL, CUSBSESSION_CREATEL, "CUsbSession::CreateL;Registering Device Observer" );
 	iUsbServer->Device().RegisterObserverL(*this);
 
 #ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV
 #ifndef __OVER_DUMMYUSBDI__
-	LOGTEXT(_L8("Registering OTG Observer\n"));
+	OstTrace0( TRACE_NORMAL, CUSBSESSION_CREATEL_DUP1, "CUsbSession::CreateL;Registering OTG Observer" );
 	iUsbServer->Otg().RegisterObserverL(*this);
 #endif
 
-	LOGTEXT(_L8("Registering HOST Observer\n"));
+	OstTrace0( TRACE_NORMAL, CUSBSESSION_CREATEL_DUP2, "CUsbSession::CreateL;Registering HOST Observer" );
 	iUsbServer->Host().RegisterObserverL(*this);
 #endif // SYMBIAN_ENABLE_USB_OTG_HOST_PRIV
+	OstTraceFunctionExit0( CUSBSESSION_CREATEL_EXIT );
 	}
 
 /**
@@ -163,8 +169,8 @@
 void CUsbSession::UsbServiceStateChange(TInt aLastError, TUsbServiceState aOldState,
 										TUsbServiceState aNewState)
 	{
-	LOG_FUNC
-	LOGTEXT3(_L8("    aOldState=0x%X, aNewState=0x%X"), aOldState, aNewState);
+	OstTraceFunctionEntry0( CUSBSESSION_USBSERVICESTATECHANGE_ENTRY );
+	OstTraceExt2( TRACE_NORMAL, CUSBSESSION_USBSERVICESTATECHANGE, "CUsbSession::UsbServiceStateChange;aOldState=0x%X, aNewState=0x%X", aOldState, aNewState );
 	(void) aOldState; // a-void build warning in UREL
 
 	// Note that it's possible to have both a start and a stop outstanding!
@@ -188,6 +194,7 @@
 		const TInt err = iServiceObserverMessage.Write(0, pckg);
 		iServiceObserverMessage.Complete(err);
 		}
+	OstTraceFunctionExit0( CUSBSESSION_USBSERVICESTATECHANGE_EXIT );
 	}
 
 /**
@@ -199,17 +206,17 @@
 void CUsbSession::HandleServiceStateChangeWhileStarting(TInt aLastError,
 												 TUsbServiceState aNewState)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_HANDLESERVICESTATECHANGEWHILESTARTING_ENTRY );
 
 	switch (aNewState)
 		{
 	case EUsbServiceStarted:
-		LOGTEXT(_L8("    Completing Start successfully"));
+		OstTrace0( TRACE_NORMAL, CUSBSESSION_HANDLESERVICESTATECHANGEWHILESTARTING, "CUsbSession::HandleServiceStateChangeWhileStarting    Completing Start successfully" );
 
 		// If the user has tried to cancel the start, they're too late!
 		if (iCancelOutstanding)
 			{
-			LOGTEXT(_L8("    Completing cancel request with KErrNone"));
+			OstTrace0( TRACE_NORMAL, CUSBSESSION_HANDLESERVICESTATECHANGEWHILESTARTING_DUP1, "CUsbSession::HandleServiceStateChangeWhileStarting    Completing cancel request with KErrNone" );
 			iCancelOutstanding = EFalse;
 			iCancelMessage.Complete(KErrNone);
 			}
@@ -219,7 +226,7 @@
 		break;
 
 	case EUsbServiceIdle:
-		LOGTEXT2(_L8("    Completing Start with error=%d"), aLastError);
+		OstTrace1( TRACE_NORMAL, CUSBSESSION_HANDLESERVICESTATECHANGEWHILESTARTING_DUP2, "CUsbSession::HandleServiceStateChangeWhileStarting;    Completing Start with error=%d", aLastError );
 
 		// If there hasn't actually been an error, but we're in an unexpected
 		// state now, that means that this client cancelled the request, or
@@ -230,7 +237,7 @@
 			// the start message should be completed with KErrCancel.
 			if (iCancelOutstanding)
 				{
-				LOGTEXT(_L8("    Completing original message with KErrCancel"));
+				OstTrace0( TRACE_NORMAL, CUSBSESSION_HANDLESERVICESTATECHANGEWHILESTARTING_DUP3, "CUsbSession::HandleServiceStateChangeWhileStarting    Completing original message with KErrCancel" );
 				iCancelOutstanding = EFalse;
 				iCancelMessage.Complete(KErrNone);
 				iStartMessage.Complete(KErrCancel);
@@ -258,6 +265,7 @@
 	default:
 		break;
 		}
+	OstTraceFunctionExit0( CUSBSESSION_HANDLESERVICESTATECHANGEWHILESTARTING_EXIT );
 	}
 
 /**
@@ -269,12 +277,12 @@
 void CUsbSession::HandleServiceStateChangeWhileStopping(TInt aLastError,
 												 TUsbServiceState aNewState)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_HANDLESERVICESTATECHANGEWHILESTOPPING_ENTRY );
 
 	switch (aNewState)
 		{
 	case EUsbServiceStarted:
-		LOGTEXT2(_L8("    Completing Stop with error=%d"), aLastError);
+		OstTrace1( TRACE_NORMAL, CUSBSESSION_HANDLESERVICESTATECHANGEWHILESTOPPING, "CUsbSession::HandleServiceStateChangeWhileStopping;    Completing Stop with error=%d", aLastError );
 
 		// If there hasn't actually been an error, but we're in an unexpected
 		// state now, that means that this client cancelled the request, or
@@ -285,7 +293,7 @@
 			// the stop message should be completed with KErrCancel.
 			if (iCancelOutstanding)
 				{
-				LOGTEXT(_L8("    Completing original message with KErrCancel"));
+				OstTrace0( TRACE_NORMAL, CUSBSESSION_HANDLESERVICESTATECHANGEWHILESTOPPING_DUP1, "CUsbSession::HandleServiceStateChangeWhileStopping;    Completing original message with KErrCancel" );
 				iCancelOutstanding = EFalse;
 				iCancelMessage.Complete(KErrNone);
 				iStopMessage.Complete(KErrCancel);
@@ -311,12 +319,12 @@
 		break;
 
 	case EUsbServiceIdle:
-		LOGTEXT(_L8("    Completing Stop with KErrNone"));
+		OstTrace0( TRACE_NORMAL, CUSBSESSION_HANDLESERVICESTATECHANGEWHILESTOPPING_DUP2, "CUsbSession::HandleServiceStateChangeWhileStopping    Completing Stop with KErrNone" );
 
 		// If the user has tried to cancel the stop, they're too late!
 		if (iCancelOutstanding)
 			{
-			LOGTEXT(_L8("    Completing cancel request with KErrNone"));
+			OstTrace0( TRACE_NORMAL, CUSBSESSION_HANDLESERVICESTATECHANGEWHILESTOPPING_DUP3, "CUsbSession::HandleServiceStateChangeWhileStopping    Completing cancel request with KErrNone" );
 			iCancelOutstanding = EFalse;
 			iCancelMessage.Complete(KErrNone);
 			}
@@ -328,6 +336,7 @@
 	default:
 		break;
 		}
+	OstTraceFunctionExit0( CUSBSESSION_HANDLESERVICESTATECHANGEWHILESTOPPING_EXIT );
 	}
 
 /**
@@ -343,7 +352,7 @@
 void CUsbSession::UsbDeviceStateChange(TInt /*aLastError*/, TUsbDeviceState /*aOldState*/,
 									   TUsbDeviceState aNewState)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_USBDEVICESTATECHANGE_ENTRY );
 
 	// can we bypass the queue?
  	if ((iDeviceObserverOutstanding) && (iDevStateQueueHead == iDevStateQueueTail))
@@ -384,9 +393,8 @@
  				if (aNewState == iDeviceStateQueue[queuePtr])
  					{
  					// Event is already queued; discard the duplicate and in-between events
- 					LOGTEXT3(_L8("--- collapsing queue head (%d, %d)"),
-						iDevStateQueueHead,
-						(queuePtr + 1) % KDeviceStatesQueueSize);
+ 					OstTraceExt2( TRACE_NORMAL, CUSBSESSION_USBDEVICESTATECHANGE, "CUsbSession::UsbDeviceStateChange;--- collapsing queue head (%d, %d)", iDevStateQueueHead, ((queuePtr + 1) % KDeviceStatesQueueSize) );
+
 
  					// queue head moved to position following the match
  					iDevStateQueueHead = (queuePtr + 1) % KDeviceStatesQueueSize;
@@ -405,13 +413,13 @@
  			// add event to head of queue
  			iDeviceStateQueue[iDevStateQueueHead] = aNewState;
  			iDevStateQueueHead = (iDevStateQueueHead + 1) % KDeviceStatesQueueSize;
- 			LOGTEXT3(_L8("+++ addqueue (%d, %d)"), iDevStateQueueHead,
-				iDevStateQueueTail);
+ 			OstTraceExt2( TRACE_NORMAL, CUSBSESSION_USBDEVICESTATECHANGE_DUP1, "CUsbSession::UsbDeviceStateChange;+++ addqueue (%d, %d)", iDevStateQueueHead, iDevStateQueueTail );
  			}
 
  		// UsbDeviceDequeueEvent() will read from queue when RegisterObserver()
 		// is next called.
 		}
+	OstTraceFunctionExit0( CUSBSESSION_USBDEVICESTATECHANGE_EXIT );
 	}
 
 /**
@@ -419,7 +427,7 @@
  */
 void CUsbSession::UsbDeviceDequeueEvent()
  	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_USBDEVICEDEQUEUEEVENT_ENTRY );
 
  	// Work our way through the queue, until we reach the end
  	// OR we find an event the current observer wants.
@@ -440,7 +448,7 @@
 
  			iNotifiedDevState = newState;
 
- 			LOGTEXT3(_L8(">>> dequeued event #%d (0x%x)"), iDevStateQueueTail, newState);
+ 			OstTraceExt2( TRACE_NORMAL, CUSBSESSION_USBDEVICEDEQUEUEEVENT, "CUsbSession::UsbDeviceDequeueEvent;dequeued event #%d (0x%x)", iDevStateQueueTail, newState );
 
   			iDeviceObserverOutstanding = EFalse;
 			const TInt err = iDeviceObserverMessage.Write(1, pckg);
@@ -448,6 +456,7 @@
  			break;
    			}
    		}
+   	OstTraceFunctionExit0( CUSBSESSION_USBDEVICEDEQUEUEEVENT_EXIT );
    	}
 
 /**
@@ -458,12 +467,12 @@
  */
 void CUsbSession::DispatchMessageL(const RMessage2& aMessage)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_DISPATCHMESSAGEL_ENTRY );
 
 	TBool complete = ETrue;
 	TInt ret = KErrNone;
 
-	LOGTEXT2(_L8("CUsbSession::DispatchMessageL(): func# %d"), aMessage.Function());
+	OstTrace1( TRACE_NORMAL, CUSBSESSION_DISPATCHMESSAGEL, "CUsbSession::DispatchMessageL;func#=%d", aMessage.Function() );
 
 	switch (aMessage.Function())
 		{
@@ -518,9 +527,6 @@
 	case EUsbGetDescription:
 		ret = GetDescription(aMessage);
 		break;
-	case EUsbGetDetailedDescription:
-		ret = GetDetailedDescription(aMessage);
-		break;
 	case EUsbGetPersonalityProperty:
 		ret = GetPersonalityProperty(aMessage);
 		break;
@@ -532,20 +538,20 @@
 	// Heap failure debug APIs.
 
 	case EUsbDbgMarkHeap:
-		LOGTEXT(_L8("Marking heap"));
+		OstTrace0( TRACE_NORMAL, CUSBSESSION_DISPATCHMESSAGEL_DUP1, "CUsbSession::DispatchMessageL;Marking heap" );
 		__UHEAP_MARK;
 		break;
 	case EUsbDbgCheckHeap:
-		LOGTEXT2(_L8("Checking heap (expecting %d cells)"), aMessage.Int0());
+		OstTrace1( TRACE_NORMAL, CUSBSESSION_DISPATCHMESSAGEL_DUP2, "CUsbSession::DispatchMessageL;Checking heap (expecting %d cells)", aMessage.Int0() );
 		__UHEAP_CHECK(aMessage.Int0());
 		break;
 	case EUsbDbgMarkEnd:
-		LOGTEXT2(_L8("End of marking heap (expecting %d cells)"), aMessage.Int0());
+		OstTrace1( TRACE_NORMAL, CUSBSESSION_DISPATCHMESSAGEL_DUP3, "CUsbSession::DispatchMessageL;End of marking heap (expecting %d cells)", aMessage.Int0() );
 		__UHEAP_MARKENDC(aMessage.Int0());
 		break;
 	case EUsbDbgFailNext:
 		{
-		LOGTEXT2(_L8("Simulating failure after %d allocation(s)"), aMessage.Int0());
+		OstTrace1( TRACE_NORMAL, CUSBSESSION_DISPATCHMESSAGEL_DUP4, "CUsbSession::DispatchMessageL;Simulating failure after %d allocation(s)", aMessage.Int0() );
 		if (aMessage.Int0() == 0)
 			__UHEAP_RESET;
 		else
@@ -556,7 +562,7 @@
 		{
 		ret = KErrNone;
 #ifdef _DEBUG
-		LOGTEXT(_L8("\tallocate on the heap"));
+		OstTrace0( TRACE_NORMAL, CUSBSESSION_DISPATCHMESSAGEL_DUP5, "CUsbSession::DispatchMessageL;allocate on the heap" );
 		TInt* x = NULL;
 		TRAP(ret, x = new(ELeave) TInt);
 		delete x;
@@ -646,7 +652,7 @@
 #endif // SYMBIAN_ENABLE_USB_OTG_HOST_PRIV
 
 	default:
-		LOGTEXT2(_L8("Illegal IPC argument(%d) - Panicking Client..."), aMessage.Function());
+		OstTrace1( TRACE_NORMAL, CUSBSESSION_DISPATCHMESSAGEL_DUP6, "CUsbSession::DispatchMessageL;Illegal IPC argument(%d) - Panicking Client...", aMessage.Function() );
 		aMessage.Panic(KUsbCliPncCat, EUsbPanicIllegalIPC);
 		complete = EFalse;
 		break;
@@ -654,6 +660,7 @@
 
 	if (complete)
 		aMessage.Complete(ret);
+	OstTraceFunctionExit0( CUSBSESSION_DISPATCHMESSAGEL_EXIT );
 	}
 
 
@@ -666,12 +673,13 @@
  */
 TInt CUsbSession::StartDeviceL(const RMessage2& aMessage, TBool& aComplete)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_STARTDEVICEL_ENTRY );
 
 #ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV
 	// Only 'control' session is allowed to start USB support
 	if ( !iSessionCtlMode )
 		{
+		OstTraceFunctionExit0( CUSBSESSION_STARTDEVICEL_EXIT );
 		return KErrAccessDenied;
 		}
 #endif
@@ -705,6 +713,7 @@
 		iStartOutstanding = ETrue;
 		}
 
+	OstTraceFunctionExit0( CUSBSESSION_STARTDEVICEL_EXIT_DUP1 );
 	return KErrNone;
 
 #else
@@ -715,6 +724,7 @@
 	iStartOutstanding = EFalse;
 	aMessage.IsNull();
 	aComplete = ETrue;
+	OstTraceFunctionExit0( CUSBSESSION_STARTDEVICEL_EXIT_DUP2 );
 	return KErrNone;
 
 #endif
@@ -729,18 +739,20 @@
  */
 TInt CUsbSession::StopDeviceL(const RMessage2& aMessage, TBool& aComplete)
     {
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_STOPDEVICEL_ENTRY );
 
 #ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV
 	// Only 'control' session is allowed to stop USB support
 	if ( !iSessionCtlMode )
 		{
+		OstTraceFunctionExit0( CUSBSESSION_STOPDEVICEL_EXIT );
 		return KErrAccessDenied;
 		}
 #endif
 
 	if (iStopOutstanding)
 		{
+		OstTraceFunctionExit0( CUSBSESSION_STOPDEVICEL_EXIT_DUP1 );
 		return KErrInUse;
 		}
 
@@ -760,6 +772,7 @@
 		iStopOutstanding = ETrue;
 		}
 
+	OstTraceFunctionExit0( CUSBSESSION_STOPDEVICEL_EXIT_DUP2 );
 	return KErrNone;
 
 #else
@@ -770,6 +783,7 @@
 	aComplete = ETrue;
 	aMessage.IsNull();
 	iStopOutstanding = EFalse;
+	OstTraceFunctionExit0( CUSBSESSION_STOPDEVICEL_EXIT_DUP3 );
 	return KErrNone;
 
 #endif
@@ -786,12 +800,13 @@
  */
 TInt CUsbSession::StartCancel(const RMessage2& aMessage, TBool& aComplete)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_STARTCANCEL_ENTRY );
 
 #ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV
 	// Only 'control' session is allowed to cancel outstaning start request
 	if ( !iSessionCtlMode )
 		{
+		OstTraceFunctionExit0( CUSBSESSION_STARTCANCEL_EXIT );
 		return KErrAccessDenied;
 		}
 #endif
@@ -811,6 +826,7 @@
 #endif
 		}
 
+	OstTraceFunctionExit0( CUSBSESSION_STARTCANCEL_EXIT_DUP1 );
 	return KErrNone;
 	}
 
@@ -825,18 +841,19 @@
  */
 TInt CUsbSession::StopCancel(const RMessage2& aMessage, TBool& aComplete)
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CUSBSESSION_STOPCANCEL_ENTRY );
 #ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV
 	// Only 'control' session is allowed to cancel outstaning stop request
 	if ( !iSessionCtlMode )
 		{
+		OstTraceFunctionExit0( CUSBSESSION_STOPCANCEL_EXIT );
 		return KErrAccessDenied;
 		}
 #endif
 
 	if (!iStopOutstanding)
 		{
+		OstTraceFunctionExit0( CUSBSESSION_STOPCANCEL_EXIT_DUP1 );
 		return KErrNone;
 		}
 
@@ -850,6 +867,7 @@
 		return errHost;
 #endif
 	TRAPD(err, iUsbServer->Device().StartL());
+	OstTraceFunctionExit0( CUSBSESSION_STOPCANCEL_EXIT_DUP2 );
 	return err;
 	}
 
@@ -865,10 +883,11 @@
  */
 TInt CUsbSession::RegisterDeviceObserver(const RMessage2& aMessage, TBool& aComplete)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_REGISTERDEVICEOBSERVER_ENTRY );
 
 	if (iDeviceObserverOutstanding)
 		{
+		OstTraceFunctionExit0( CUSBSESSION_REGISTERDEVICEOBSERVER_EXIT );
 		return KErrInUse;
 		}
 
@@ -880,7 +899,7 @@
 	 	{
  		// This is the first observer after c'tor or DeregisterObserver(),
  		// so zap the device event queue.
- 		LOGTEXT(_L8("    Reset Device Event Queue"));
+ 		OstTrace0( TRACE_NORMAL, CUSBSESSION_REGISTERDEVICEOBSERVER, "CUsbSession::RegisterDeviceObserver    Reset Device Event Queue" );
  		iDevStateQueueHead = 0;
  		iDevStateQueueTail = 0;
  		iObserverQueueEvents = ETrue;
@@ -891,6 +910,7 @@
  		UsbDeviceDequeueEvent();
 	 	}
 
+	OstTraceFunctionExit0( CUSBSESSION_REGISTERDEVICEOBSERVER_EXIT_DUP1 );
 	return KErrNone;
 	}
 
@@ -906,16 +926,18 @@
  */
 TInt CUsbSession::RegisterServiceObserver(const RMessage2& aMessage, TBool& aComplete)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_REGISTERSERVICEOBSERVER_ENTRY );
 
 	if (iServiceObserverOutstanding)
 		{
+		OstTraceFunctionExit0( CUSBSESSION_REGISTERSERVICEOBSERVER_EXIT );
 		return KErrInUse;
 		}
 
 	iServiceObserverMessage = aMessage;
 	iServiceObserverOutstanding = ETrue;
 	aComplete = EFalse;
+	OstTraceFunctionExit0( CUSBSESSION_REGISTERSERVICEOBSERVER_EXIT_DUP1 );
 	return KErrNone;
 	}
 
@@ -931,10 +953,10 @@
  */
 TInt CUsbSession::GetCurrentServiceState(const RMessage2& aMessage)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_GETCURRENTSERVICESTATE_ENTRY );
 
 	TUsbServiceState state = iUsbServer->Device().ServiceState();
-	LOGTEXT2(_L8("\tstate = %d"), state);
+	OstTrace1( TRACE_NORMAL, CUSBSESSION_GETCURRENTSERVICESTATE, "CUsbSession::GetCurrentServiceState;state=%d", state );
 	TPckg<TUint32> pckg(state);
 	return aMessage.Write(0, pckg);
 	}
@@ -950,10 +972,10 @@
  */
 TInt CUsbSession::GetCurrentDeviceState(const RMessage2& aMessage)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_GETCURRENTDEVICESTATE_ENTRY );
 
 	TUsbDeviceState state = iUsbServer->Device().DeviceState();
-	LOGTEXT2(_L8("\tstate = %d"), state);
+	OstTrace1( TRACE_NORMAL, CUSBSESSION_GETCURRENTDEVICESTATE, "CUsbSession::GetCurrentDeviceState;state=%d", state );
 	TPckg<TUint32> pckg(state);
 	return aMessage.Write(0, pckg);
 	}
@@ -968,10 +990,11 @@
  */
 TInt CUsbSession::DeRegisterDeviceObserver()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_DEREGISTERDEVICEOBSERVER_ENTRY );
 
 	if (!iDeviceObserverOutstanding)
 		{
+		OstTraceFunctionExit0( CUSBSESSION_DEREGISTERDEVICEOBSERVER_EXIT );
 		return KErrNone;
 		}
 
@@ -981,6 +1004,7 @@
 	// client doesn't need events queuing any more
  	iObserverQueueEvents = EFalse;
 
+	OstTraceFunctionExit0( CUSBSESSION_DEREGISTERDEVICEOBSERVER_EXIT_DUP1 );
 	return KErrNone;
 	}
 
@@ -993,15 +1017,17 @@
  */
 TInt CUsbSession::DeRegisterServiceObserver()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_DEREGISTERSERVICEOBSERVER_ENTRY );
 
 	if (!iServiceObserverOutstanding)
 		{
+		OstTraceFunctionExit0( CUSBSESSION_DEREGISTERSERVICEOBSERVER_EXIT );
 		return KErrNone;
 		}
 
 	iServiceObserverOutstanding = EFalse;
 	iServiceObserverMessage.Complete(KErrCancel);
+	OstTraceFunctionExit0( CUSBSESSION_DEREGISTERSERVICEOBSERVER_EXIT_DUP1 );
 	return KErrNone;
 	}
 
@@ -1015,7 +1041,7 @@
  */
 TInt CUsbSession::TryStartDeviceL(const RMessage2& aMessage, TBool& aComplete)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_TRYSTARTDEVICEL_ENTRY );
 
 #ifndef __OVER_DUMMYUSBDI__
 
@@ -1023,17 +1049,20 @@
 	// Only 'control' session is allowed to start USB support
 	if ( !iSessionCtlMode )
 		{
+		OstTraceFunctionExit0( CUSBSESSION_TRYSTARTDEVICEL_EXIT );
 		return KErrAccessDenied;
 		}
 #endif
 
 	if (!iPersonalityCfged)
 	{
+	OstTraceFunctionExit0( CUSBSESSION_TRYSTARTDEVICEL_EXIT_DUP1 );
 	return KErrNotSupported;
 	}
 
 	if (iStartOutstanding || iStopOutstanding)
 		{
+		OstTraceFunctionExit0( CUSBSESSION_TRYSTARTDEVICEL_EXIT_DUP2 );
 		return KErrServerBusy;
 		}
 
@@ -1070,6 +1099,7 @@
 		{
 		if (aMessage.Int0() != iUsbServer->Device().CurrentPersonalityId())
 			{
+			OstTraceFunctionExit0( CUSBSESSION_TRYSTARTDEVICEL_EXIT_DUP3 );
 			return KErrAbort;
 			}
 
@@ -1082,9 +1112,11 @@
 		}
 	else if (state == EUsbServiceStopping)
 		{
+		OstTraceFunctionExit0( CUSBSESSION_TRYSTARTDEVICEL_EXIT_DUP4 );
 		return KErrServerBusy;
 		}
 
+	OstTraceFunctionExit0( CUSBSESSION_TRYSTARTDEVICEL_EXIT_DUP5 );
 	return KErrNone;
 
 #else
@@ -1095,6 +1127,7 @@
 	iStartOutstanding = EFalse;
 	aMessage.IsNull();
 	aComplete = ETrue;
+	OstTraceFunctionExit0( CUSBSESSION_TRYSTARTDEVICEL_EXIT_DUP6 );
 	return KErrNone;
 #endif
 	}
@@ -1109,7 +1142,7 @@
  */
 TInt CUsbSession::TryStopDeviceL(const RMessage2& aMessage, TBool& aComplete)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_TRYSTOPDEVICEL_ENTRY );
 
 #ifndef __OVER_DUMMYUSBDI__
 
@@ -1117,17 +1150,20 @@
 	// Only 'control' session is allowed to stop USB support
 	if ( !iSessionCtlMode )
 		{
+		OstTraceFunctionExit0( CUSBSESSION_TRYSTOPDEVICEL_EXIT );
 		return KErrAccessDenied;
 		}
 #endif
 
 	if (!iPersonalityCfged)
 		{
+		OstTraceFunctionExit0( CUSBSESSION_TRYSTOPDEVICEL_EXIT_DUP1 );
 		return KErrNotSupported;
 		}
 
 	if (iStartOutstanding || iStopOutstanding)
 		{
+		OstTraceFunctionExit0( CUSBSESSION_TRYSTOPDEVICEL_EXIT_DUP2 );
 		return KErrServerBusy;
 		}
 
@@ -1157,6 +1193,7 @@
 		}
 	else if (state == EUsbServiceStarting)
 		{
+		OstTraceFunctionExit0( CUSBSESSION_TRYSTOPDEVICEL_EXIT_DUP3 );
 		return KErrServerBusy;
 		}
 	else if (state == EUsbServiceStopping)
@@ -1166,6 +1203,7 @@
 		iStopOutstanding = ETrue;
 		}
 
+	OstTraceFunctionExit0( CUSBSESSION_TRYSTOPDEVICEL_EXIT_DUP4 );
 	return KErrNone;
 
 #else
@@ -1176,6 +1214,7 @@
 	aMessage.IsNull();
 	aComplete = ETrue;
 	iStopOutstanding = EFalse;
+	OstTraceFunctionExit0( CUSBSESSION_TRYSTOPDEVICEL_EXIT_DUP5 );
 	return KErrNone;
 #endif
 	}
@@ -1190,10 +1229,11 @@
  */
 TInt CUsbSession::CancelInterest(const RMessage2& aMessage)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_CANCELINTEREST_ENTRY );
 
 	if (!iPersonalityCfged)
 		{
+		OstTraceFunctionExit0( CUSBSESSION_CANCELINTEREST_EXIT );
 		return KErrNotSupported;
 		}
 
@@ -1215,6 +1255,7 @@
 			}
 		}
 
+	OstTraceFunctionExit0( CUSBSESSION_CANCELINTEREST_EXIT_DUP1 );
 	return KErrCancel;
 	}
 
@@ -1227,15 +1268,16 @@
  */
 TInt CUsbSession::GetCurrentPersonalityId(const RMessage2& aMessage)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_GETCURRENTPERSONALITYID_ENTRY );
 
 	if (!iPersonalityCfged)
 		{
+		OstTraceFunctionExit0( CUSBSESSION_GETCURRENTPERSONALITYID_EXIT );
 		return KErrNotSupported;
 		}
 
 	TInt currentPersonalityId = iUsbServer->Device().CurrentPersonalityId();
-	LOGTEXT2(_L8("\tcurrentPersonalityId = %d"), currentPersonalityId);
+	OstTrace1( TRACE_NORMAL, CUSBSESSION_GETCURRENTPERSONALITYID, "CUsbSession::GetCurrentPersonalityId;currentPersonalityId=%d", currentPersonalityId );
 	TPckgC<TInt> pckg(currentPersonalityId);
 	return aMessage.Write(0, pckg);
 	}
@@ -1251,10 +1293,11 @@
  */
 TInt CUsbSession::GetSupportedClasses(const RMessage2& aMessage)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_GETSUPPORTEDCLASSES_ENTRY );
 
 	if (!iPersonalityCfged)
 		{
+		OstTraceFunctionExit0( CUSBSESSION_GETSUPPORTEDCLASSES_EXIT );
 		return KErrNotSupported;
 		}
 
@@ -1266,7 +1309,11 @@
 	TInt personalityCount = personalities.Count();
 	for (TInt i = 0; i < personalityCount; i++)
 		{
-		__ASSERT_ALWAYS(personalities[i] != NULL, _USB_PANIC(KUsbSvrPncCat, ENullPersonalityPointer));
+		if(personalities[i] == NULL)
+		    {
+            OstTrace1( TRACE_NORMAL, CUSBSESSION_GETSUPPORTEDCLASSES, "CUsbSession::GetSupportedClasses;ENullPersonalityPointer=%d", ENullPersonalityPointer );
+            User::Panic(KUsbSvrPncCat, ENullPersonalityPointer);
+		    }
 		if (aMessage.Int0() == personalities[i]->PersonalityId())
 			{
 			classUids[0] = personalities[i]->SupportedClasses().Count();
@@ -1274,11 +1321,13 @@
 				{
 				if (j < KUsbMaxSupportedClasses + 1)
 					{
-					classUids[j] = personalities[i]->SupportedClasses()[j - 1].iUid;
-					LOGTEXT3(_L8("\tclassUids[%d] = %d"), j, classUids[j]);
+					classUids[j] = personalities[i]->SupportedClasses()[j - 1].iClassUid.iUid;
+					OstTrace1( TRACE_NORMAL, CUSBSESSION_GETSUPPORTEDCLASSES_DUP1, "CUsbSession::GetSupportedClasses;classUids[%d] = ", j );
+					OstTrace1( TRACE_NORMAL, CUSBSESSION_GETSUPPORTEDCLASSES_DUP2, "%d", classUids[j] );					
 					}
 				else
 					{
+					OstTraceFunctionExit0( CUSBSESSION_GETSUPPORTEDCLASSES_EXIT_DUP1 );
 					return KErrTooBig;
 					}
 				}
@@ -1289,6 +1338,7 @@
 	if (classUids[0] == 0)
 		{
 		// No supported classes are found
+		OstTraceFunctionExit0( CUSBSESSION_GETSUPPORTEDCLASSES_EXIT_DUP2 );
 		return KErrNotSupported;
 		}
 
@@ -1303,6 +1353,7 @@
 		}
 
 	delete buf;
+	OstTraceFunctionExit0( CUSBSESSION_GETSUPPORTEDCLASSES_EXIT_DUP3 );
 	return ret;
 	}
 
@@ -1315,10 +1366,11 @@
  */
 TInt CUsbSession::GetPersonalityIds(const RMessage2& aMessage)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_GETPERSONALITYIDS_ENTRY );
 
 	if (!iPersonalityCfged)
 		{
+		OstTraceFunctionExit0( CUSBSESSION_GETPERSONALITYIDS_EXIT );
 		return KErrNotSupported;
 		}
 
@@ -1329,7 +1381,11 @@
 	TInt personalityCount = personalities.Count();
 	for (TInt i = 0; i < personalityCount; ++i)
 		{
-		__ASSERT_ALWAYS(personalities[i] != NULL, _USB_PANIC(KUsbSvrPncCat, ENullPersonalityPointer));
+        if(personalities[i] == NULL)
+            {
+            OstTrace1( TRACE_NORMAL, CUSBSESSION_GETPERSONALITYIDS, "CUsbSession::GetPersonalityIds;Panic reason=%d", ENullPersonalityPointer );
+            User::Panic(KUsbSvrPncCat, ENullPersonalityPointer);
+            }
 		personalityIds[i + 1] = personalities[i]->PersonalityId();
 		}
 	personalityIds[0] = personalityCount;
@@ -1345,6 +1401,7 @@
 		}
 
 	delete buf;
+	OstTraceFunctionExit0( CUSBSESSION_GETPERSONALITYIDS_EXIT_DUP1 );
 	return ret;
 	}
 
@@ -1357,10 +1414,11 @@
  */
 TInt CUsbSession::GetDescription(const RMessage2& aMessage)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_GETDESCRIPTION_ENTRY );
 
 	if (!iPersonalityCfged)
 		{
+		OstTraceFunctionExit0( CUSBSESSION_GETDESCRIPTION_EXIT );
 		return KErrNotSupported;
 		}
 
@@ -1372,39 +1430,10 @@
 		}
 
 	// We should never reach here
+	OstTraceFunctionExit0( CUSBSESSION_GETDESCRIPTION_EXIT_DUP1 );
 	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
@@ -1415,10 +1444,11 @@
  */
 TInt CUsbSession::GetPersonalityProperty(const RMessage2& aMessage)
 	{
-		LOG_FUNC
+		OstTraceFunctionEntry0( CUSBSESSION_GETPERSONALITYPROPERTY_ENTRY );
 
 		if (!iPersonalityCfged)
 			{
+			OstTraceFunctionExit0( CUSBSESSION_GETPERSONALITYPROPERTY_EXIT );
 			return KErrNotSupported;
 			}
 
@@ -1426,14 +1456,11 @@
 		const CPersonality* personality = iUsbServer->Device().GetPersonality(personalityId);
 		if (personality)
 			{
-			if(personality->Version() < EUsbManagerResourceVersionThree)
-				{
-				return KErrNotFound;
-				}
 			TPckg<TUint32> pckg(personality->Property());
 			return aMessage.Write(1, pckg);
 			}
 
+		OstTraceFunctionExit0( CUSBSESSION_GETPERSONALITYPROPERTY_EXIT_DUP2 );
 		return KErrNotSupported;
 	}
 
@@ -1446,10 +1473,10 @@
  */
 TInt CUsbSession::ClassSupported(const RMessage2& aMessage)
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CUSBSESSION_CLASSSUPPORTED_ENTRY );
 	if (!iPersonalityCfged)
 		{
+		OstTraceFunctionExit0( CUSBSESSION_CLASSSUPPORTED_EXIT );
 		return KErrNotSupported;
 		}
 
@@ -1459,12 +1486,13 @@
 	const CPersonality* personality = iUsbServer->Device().GetPersonality(personalityId);
 	if (personality)
 		{
-		isSupported = (personality->ClassSupported(classUid) != KErrNotFound);
+		isSupported = personality->ClassSupported(classUid);
 		TPckg<TBool> pkg2(isSupported);
 		return aMessage.Write(2, pkg2);
 		}
 
 	// We should never reach here
+	OstTraceFunctionExit0( CUSBSESSION_CLASSSUPPORTED_EXIT_DUP1 );
 	return KErrNotSupported;
 	}
 
@@ -1478,12 +1506,12 @@
  */
 TInt CUsbSession::SetCtlSessionMode(const RMessage2& aMessage)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_SETCTLSESSIONMODE_ENTRY );
 
 	TInt ret = KErrNone;
 
 	TBool value = (TBool)aMessage.Int0();
-	LOGTEXT2(_L8("\tSetting = %d"), static_cast<TInt>(value));
+	OstTrace1( TRACE_NORMAL, CUSBSESSION_SETCTLSESSIONMODE, "CUsbSession::SetCtlSessionMode;Setting = %d", static_cast<TInt>(value) );
 
 	// Verify if this is the same session which set the value before
 	if ( iCtlSession && (iCtlSession != this) )
@@ -1505,6 +1533,7 @@
 			}
 		}
 
+	OstTraceFunctionExit0( CUSBSESSION_SETCTLSESSIONMODE_EXIT );
 	return ret;
 	}
 
@@ -1517,7 +1546,7 @@
  */
 TInt CUsbSession::BusRequest()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_BUSREQUEST_ENTRY );
 
 	TInt ret = KErrNone;
 	if ( iSessionCtlMode )
@@ -1529,6 +1558,7 @@
 		ret = KErrAccessDenied;
 		}
 
+	OstTraceFunctionExit0( CUSBSESSION_BUSREQUEST_EXIT );
 	return ret;
 	}
 
@@ -1543,7 +1573,7 @@
  */
 TInt CUsbSession::BusRespondSrp()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_BUSRESPONDSRP_ENTRY );
 
 	TInt ret = KErrNone;
 	if ( iSessionCtlMode )
@@ -1555,6 +1585,7 @@
 		ret = KErrAccessDenied;
 		}
 
+	OstTraceFunctionExit0( CUSBSESSION_BUSRESPONDSRP_EXIT );
 	return ret;
 	}
 
@@ -1568,7 +1599,7 @@
  */
 TInt CUsbSession::BusClearError()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_BUSCLEARERROR_ENTRY );
 
 	TInt ret = KErrNone;
 	if ( iSessionCtlMode )
@@ -1580,6 +1611,7 @@
 		ret = KErrAccessDenied;
 		}
 
+	OstTraceFunctionExit0( CUSBSESSION_BUSCLEARERROR_EXIT );
 	return ret;
 	}
 
@@ -1592,7 +1624,7 @@
  */
 TInt CUsbSession::BusDrop()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_BUSDROP_ENTRY );
 
 	TInt ret = KErrNone;
 	if ( iSessionCtlMode )
@@ -1604,6 +1636,7 @@
 		ret = KErrAccessDenied;
 		}
 
+	OstTraceFunctionExit0( CUSBSESSION_BUSDROP_EXIT );
 	return ret;
 	}
 
@@ -1616,7 +1649,7 @@
  */
 TInt CUsbSession::EnableFunctionDriverLoading()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_ENABLEFUNCTIONDRIVERLOADING_ENTRY );
 
 	TInt ret = KErrNone;
 	if ( iSessionCtlMode )
@@ -1628,6 +1661,7 @@
 		ret = KErrAccessDenied;
 		}
 
+	OstTraceFunctionExit0( CUSBSESSION_ENABLEFUNCTIONDRIVERLOADING_EXIT );
 	return ret;
 	}
 
@@ -1640,7 +1674,7 @@
  */
 TInt CUsbSession::DisableFunctionDriverLoading()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_DISABLEFUNCTIONDRIVERLOADING_ENTRY );
 
 	TInt ret = KErrNone;
 	if ( iSessionCtlMode )
@@ -1652,6 +1686,7 @@
 		ret = KErrAccessDenied;
 		}
 
+	OstTraceFunctionExit0( CUSBSESSION_DISABLEFUNCTIONDRIVERLOADING_EXIT );
 	return ret;
 	}
 
@@ -1664,8 +1699,9 @@
  */
 TInt CUsbSession::GetSupportedLanguages(const RMessage2& aMessage)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_GETSUPPORTEDLANGUAGES_ENTRY );
 	TRAPD(err, GetSupportedLanguagesL(aMessage));
+	OstTraceFunctionExit0( CUSBSESSION_GETSUPPORTEDLANGUAGES_EXIT );
 	return err;
 	}
 
@@ -1678,11 +1714,10 @@
  */
 TInt CUsbSession::GetSupportedLanguagesL(const RMessage2& aMessage)
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CUSBSESSION_GETSUPPORTEDLANGUAGESL_ENTRY );
 
 	const TUint deviceId = aMessage.Int0();
-	LOGTEXT2(_L8("\tdeviceId = %d"), deviceId);
+	OstTrace1( TRACE_NORMAL, CUSBSESSION_GETSUPPORTEDLANGUAGESL, "CUsbSession::GetSupportedLanguagesL;deviceId=%d", deviceId );
 
 	RArray<TUint> langIds;
 	CleanupClosePushL(langIds);
@@ -1691,7 +1726,7 @@
 	if (ret == KErrNone)
 		{
 		const TUint count = langIds.Count();
-		LOGTEXT2(_L8("\tcount = %d"), count);
+		OstTrace1( TRACE_NORMAL, CUSBSESSION_GETSUPPORTEDLANGUAGESL_DUP1, "CUsbSession::GetSupportedLanguagesL;count=%d", count );
 
 		// Set error code if there is no languages or there are too many
 		if ( count == 0 )
@@ -1717,7 +1752,7 @@
 			for ( TUint ii = 0 ; ii < count; ++ii )
 				{
 				buf.Append((TUint8*)&(langIds[ii]), sizeof(TUint));
-				LOGTEXT3(_L8("Append langID[%d] = %d"),ii,langIds[ii]);
+				OstTraceExt2( TRACE_NORMAL, CUSBSESSION_GETSUPPORTEDLANGUAGESL_DUP2, "CUsbSession::GetSupportedLanguagesL;Append langID[%d] = %d", ii, langIds[ii] );
 				}
 
 			// Write back to the client.
@@ -1728,6 +1763,7 @@
 
 	CleanupStack::PopAndDestroy();
 
+	OstTraceFunctionExit0( CUSBSESSION_GETSUPPORTEDLANGUAGESL_EXIT );
 	return ret;
 	}
 
@@ -1740,20 +1776,21 @@
  */
 TInt CUsbSession::GetManufacturerStringDescriptor(const RMessage2& aMessage)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_GETMANUFACTURERSTRINGDESCRIPTOR_ENTRY );
 
 	const TUint deviceId = aMessage.Int0();
 	const TUint langId = aMessage.Int1();
-	LOGTEXT3(_L8("\tdeviceId = %d, langId = %d"), deviceId, langId);
+	OstTraceExt2( TRACE_NORMAL, CUSBSESSION_GETMANUFACTURERSTRINGDESCRIPTOR, "CUsbSession::GetManufacturerStringDescriptor;langId=%d;deviceId=%d", langId, deviceId );
 
 	TName string;
 	TInt ret = iUsbServer->Host().GetManufacturerStringDescriptor(deviceId,langId,string);
 	if (ret == KErrNone)
 		{
-		LOGTEXT2(_L("\tstring = \"%S\""), &string);
+		OstTraceExt1( TRACE_NORMAL, CUSBSESSION_GETMANUFACTURERSTRINGDESCRIPTOR_DUP1, "CUsbSession::GetManufacturerStringDescriptor;string = \"%S\"", string );
 		ret = aMessage.Write(2, string);
 		}
 
+	OstTraceFunctionExit0( CUSBSESSION_GETMANUFACTURERSTRINGDESCRIPTOR_EXIT );
 	return ret;
 	}
 
@@ -1766,20 +1803,21 @@
  */
 TInt CUsbSession::GetProductStringDescriptor(const RMessage2& aMessage)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_GETPRODUCTSTRINGDESCRIPTOR_ENTRY );
 
 	const TUint deviceId = aMessage.Int0();
 	const TUint langId = aMessage.Int1();
-	LOGTEXT3(_L8("\tdeviceId = %d, langId = %d"), deviceId, langId);
+	OstTraceExt2( TRACE_NORMAL, CUSBSESSION_GETPRODUCTSTRINGDESCRIPTOR, "CUsbSession::GetProductStringDescriptor;deviceId=%d;langId=%d", deviceId, langId );
 
 	TName string;
 	TInt ret = iUsbServer->Host().GetProductStringDescriptor(deviceId,langId,string);
 	if (ret == KErrNone)
 		{
-		LOGTEXT2(_L("\tstring = \"%S\""), &string);
+		OstTraceExt1( TRACE_NORMAL, CUSBSESSION_GETPRODUCTSTRINGDESCRIPTOR_DUP1, "CUsbSession::GetProductStringDescriptor;string = \"%S\"", string );
 		ret = aMessage.Write(2, string);
 		}
 
+	OstTraceFunctionExit0( CUSBSESSION_GETPRODUCTSTRINGDESCRIPTOR_EXIT );
 	return ret;
 	}
 
@@ -1792,10 +1830,10 @@
  */
 TInt CUsbSession::GetOtgDescriptor(const RMessage2& aMessage)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_GETOTGDESCRIPTOR_ENTRY );
 
 	const TUint deviceId = aMessage.Int0();
-	LOGTEXT2(_L8("\tdeviceId = %d"), deviceId);
+	OstTrace1( TRACE_NORMAL, CUSBSESSION_GETOTGDESCRIPTOR, "CUsbSession::GetOtgDescriptor;deviceId=%d", deviceId );
 
     TOtgDescriptor otgDescriptor;
 	TInt ret = iUsbServer->Host().GetOtgDescriptor(deviceId, otgDescriptor);
@@ -1805,6 +1843,7 @@
 		ret = aMessage.Write(1, buf);
 		}
 
+	OstTraceFunctionExit0( CUSBSESSION_GETOTGDESCRIPTOR_EXIT );
 	return ret;
 	}
 
@@ -1822,10 +1861,11 @@
  */
 TInt CUsbSession::RegisterHostObserver(const RMessage2& aMessage, TBool& aComplete)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_REGISTERHOSTOBSERVER_ENTRY );
 
 	if (iHostEventObserverOutstanding)
 		{
+		OstTraceFunctionExit0( CUSBSESSION_REGISTERHOSTOBSERVER_EXIT );
 		return KErrInUse;
 		}
 
@@ -1837,7 +1877,7 @@
 	 	{
  		// This is the first observer after c'tor or DeregisterObserver(),
  		// so zap the device event queue.
- 		LOGTEXT(_L8("    Reset OTG Host State Queue"));
+ 		OstTrace0( TRACE_NORMAL, CUSBSESSION_REGISTERHOSTOBSERVER, "CUsbSession::RegisterHostObserver;    Reset OTG Host State Queue" );
  		iHostEventQueueHead = 0;
  		iHostEventQueueTail = 0;
  		iHostEventObserverQueueEvents = ETrue;
@@ -1848,6 +1888,7 @@
  		UsbHostEventDequeue();
 	 	}
 
+	OstTraceFunctionExit0( CUSBSESSION_REGISTERHOSTOBSERVER_EXIT_DUP1 );
 	return KErrNone;
 	}
 
@@ -1859,13 +1900,13 @@
  */
 TInt CUsbSession::DeRegisterHostObserver()
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CUSBSESSION_DEREGISTERHOSTOBSERVER_ENTRY );
 
 	if (!iHostEventObserverQueueEvents)
 		{
 		//Never register
-		LOGTEXT(_L8("iHostEventObserverQueueEvents is FALSE!"));
+		OstTrace0( TRACE_NORMAL, CUSBSESSION_DEREGISTERHOSTOBSERVER, "CUsbSession::DeRegisterHostObserver;iHostEventObserverQueueEvents is FALSE!" );
+		OstTraceFunctionExit0( CUSBSESSION_DEREGISTERHOSTOBSERVER_EXIT );
 		return KErrNone;
 		}
 
@@ -1873,7 +1914,7 @@
 		{
 		iHostEventObserverOutstanding = EFalse;
 		iHostEventObserverMessage.Complete(KErrCancel);
-		LOGTEXT(_L8("iHostEventObserverMessage.Complete(KErrCancel);"));
+		OstTrace0( TRACE_NORMAL, CUSBSESSION_DEREGISTERHOSTOBSERVER_DUP1, "CUsbSession::DeRegisterHostObserver;iHostEventObserverMessage.Complete(KErrCancel);" );
 		}
 
 	// client doesn't need events queuing any more
@@ -1882,6 +1923,7 @@
 	iHostEventQueueHead = 0;
 	iHostEventQueueTail = 0;
 
+	OstTraceFunctionExit0( CUSBSESSION_DEREGISTERHOSTOBSERVER_EXIT_DUP1 );
 	return KErrNone;	
 	}
 
@@ -1899,10 +1941,11 @@
  */
 TInt CUsbSession::RegisterMsgObserver(const RMessage2& aMessage, TBool& aComplete)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_REGISTERMSGOBSERVER_ENTRY );
 
 	if (iMsgObserverOutstanding)
 		{
+		OstTraceFunctionExit0( CUSBSESSION_REGISTERMSGOBSERVER_EXIT );
 		return KErrInUse;
 		}
 
@@ -1914,7 +1957,7 @@
 	 	{
  		// This is the first observer after c'tor or DeregisterObserver(),
  		// so zap the device event queue.
- 		LOGTEXT(_L8("    Reset OTG Message Queue"));
+ 		OstTrace0( TRACE_NORMAL, CUSBSESSION_REGISTERMSGOBSERVER, "CUsbSession::RegisterMsgObserver;    Reset OTG Message Queue" );
  		iMsgQueueHead = 0;
  		iMsgQueueTail = 0;
  		iMsgObserverQueueEvents = ETrue;
@@ -1925,6 +1968,7 @@
  		UsbMsgDequeue();
 	 	}
 
+	OstTraceFunctionExit0( CUSBSESSION_REGISTERMSGOBSERVER_EXIT_DUP1 );
 	return KErrNone;
 	}
 
@@ -1936,10 +1980,11 @@
  */
 TInt CUsbSession::DeRegisterMsgObserver()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_DEREGISTERMSGOBSERVER_ENTRY );
 
 	if (!iMsgObserverOutstanding)
 		{
+		OstTraceFunctionExit0( CUSBSESSION_DEREGISTERMSGOBSERVER_EXIT );
 		return KErrNone;
 		}
 
@@ -1949,6 +1994,7 @@
 	// client doesn't need events queuing any more
  	iMsgObserverQueueEvents = EFalse;
 
+	OstTraceFunctionExit0( CUSBSESSION_DEREGISTERMSGOBSERVER_EXIT_DUP1 );
 	return KErrNone;
 	}
 
@@ -1962,7 +2008,7 @@
  */
 void CUsbSession::UsbOtgHostMessage(TInt aMessage)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_USBOTGHOSTMESSAGE_ENTRY );
 
 	// can we bypass the queue?
  	if ((iMsgObserverOutstanding) && (iMsgQueueHead == iMsgQueueTail))
@@ -1980,12 +2026,12 @@
 		// add event to head of queue
 		iMsgQueue[iMsgQueueHead] = aMessage;
 		iMsgQueueHead = (iMsgQueueHead + 1) % KOtgHostMessageQueueSize;
-		LOGTEXT3(_L8("+++ CUsbSession::UsbOtgMessage() addqueue (%d, %d)"), iMsgQueueHead,
-			iMsgQueueTail);
+		OstTraceExt2( TRACE_NORMAL, CUSBSESSION_USBOTGHOSTMESSAGE, "CUsbSession::UsbOtgHostMessage; addqueue (%d, %d)", iMsgQueueHead, iMsgQueueTail );
 
  		// UsbMsgDequeueEvent() will read from queue when RegisterMsgObserver()
 		// is next called.
 		}
+	OstTraceFunctionExit0( CUSBSESSION_USBOTGHOSTMESSAGE_EXIT );
 	}
 
 /**
@@ -1999,7 +2045,7 @@
  */
 void CUsbSession::UsbHostEvent(TDeviceEventInformation& aDevInfo)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_USBHOSTEVENT_ENTRY );
 
 	// can we bypass the queue?
  	if ((iHostEventObserverOutstanding) && (iHostEventQueueHead == iHostEventQueueTail))
@@ -2007,24 +2053,24 @@
 		iNotifiedHostState = aDevInfo;
 		iHostEventObserverOutstanding = EFalse;
 
-		LOGTEXT(_L8("CUsbSession::UsbHostEvent() detected outstanding request"));
+		OstTrace0( TRACE_NORMAL, CUSBSESSION_USBHOSTEVENT, "CUsbSession::UsbHostEvent detected outstanding request" );
 
 		TPckg<TDeviceEventInformation> info(aDevInfo);
 		const TInt err = iHostEventObserverMessage.Write(0, info);
 		iHostEventObserverMessage.Complete(err);
-		LOGTEXT2(_L8("CUsbSession::UsbHostEvent() detects outstanding request: request is compeleted with %d"), err);
+		OstTrace1( TRACE_NORMAL, CUSBSESSION_USBHOSTEVENT_DUP1, "CUsbSession::UsbHostEvent; detects outstanding request: request is compeleted with %d", err );
 		}
 	else if (iHostEventObserverQueueEvents)
 		{
 		// add dev info to head of queue
 		iHostStateQueue[iHostEventQueueHead] = aDevInfo;
 		iHostEventQueueHead = (iHostEventQueueHead + 1) % KDeviceStatesQueueSize;
-		LOGTEXT3(_L8("+++ CUsbSession::UsbHostEvent() addqueue (%d, %d)"), iHostEventQueueHead,
-			iHostEventQueueTail);
+		OstTraceExt2( TRACE_NORMAL, CUSBSESSION_USBHOSTEVENT_DUP2, "CUsbSession::UsbHostEvent; addqueue (%d, %d)", iHostEventQueueHead, iHostEventQueueTail );
 
  		// UsbHostStateDequeueEvent() will read from queue when RegisterHostObserver()
 		// is next called.
 		}
+	OstTraceFunctionExit0( CUSBSESSION_USBHOSTEVENT_EXIT );
 	}
 
 /**
@@ -2032,7 +2078,7 @@
  */
 void CUsbSession::UsbMsgDequeue()
  	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_USBMSGDEQUEUE_ENTRY );
 
 	// Work our way through the queue, until we reach the end
  	// OR we find an event the current observer wants.
@@ -2046,12 +2092,13 @@
  		TPckg<TUint32> pckg(newMsg);
  		iNotifiedMsg = newMsg;
 
- 		LOGTEXT3(_L8(">>> dequeued event #%d (0x%x)"), iMsgQueueTail, newMsg);
+ 		OstTraceExt2( TRACE_NORMAL, CUSBSESSION_USBMSGDEQUEUE, "CUsbSession::UsbMsgDequeue;dequeued event #%d (0x%x)", iMsgQueueTail, newMsg );
 
 		iMsgObserverOutstanding = EFalse;
 		const TInt err = iMsgObserverMessage.Write(0, pckg);
 		iMsgObserverMessage.Complete(err);
    		}
+  	OstTraceFunctionExit0( CUSBSESSION_USBMSGDEQUEUE_EXIT );
   	}
 
 /**
@@ -2059,7 +2106,7 @@
  */
 void CUsbSession::UsbHostEventDequeue()
  	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSESSION_USBHOSTEVENTDEQUEUE_ENTRY );
 
 	// Work our way through the queue, until we reach the end
  	// OR we find an event the current observer wants.
@@ -2073,15 +2120,16 @@
  		// advance tail towards the head
  		iHostEventQueueTail = (iHostEventQueueTail + 1) % KDeviceStatesQueueSize;
 
-		LOGTEXT3(_L8(">>> CUsbSession::UsbHostStateDequeueEvent() dequeued event #%d (0x%x)"), iHostEventQueueTail, newDevInfo.iEventType);
+		OstTraceExt2( TRACE_NORMAL, CUSBSESSION_USBHOSTEVENTDEQUEUE, "CUsbSession::UsbHostEventDequeue; dequeued event #%d (0x%x)", iHostEventQueueTail, newDevInfo.iEventType );
 
 		TPckg<TDeviceEventInformation> info(newDevInfo);
 		iHostEventObserverOutstanding = EFalse;
 		const TInt err = iHostEventObserverMessage.Write(0, info);
 		iHostEventObserverMessage.Complete(err);
 
-		LOGTEXT2(_L8("CUsbSession::UsbHostStateDequeueEvent() detects outstanding request: request is compeleted with %d"), err);
+		OstTrace1( TRACE_NORMAL, CUSBSESSION_USBHOSTEVENTDEQUEUE_DUP1, "CUsbSession::UsbHostStateDequeueEvent() detects outstanding request: request is compeleted with %d", err );
    		}
+   	OstTraceFunctionExit0( CUSBSESSION_USBHOSTEVENTDEQUEUE_EXIT );
    	}
 
 TInt CUsbSession::RequestSession()
--- a/usbmgmt/usbmgr/usbman/server/SRC/UsbSvr.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/usbman/server/SRC/UsbSvr.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -17,16 +17,18 @@
 
 #include <e32base.h>
 #include <usb/usbshared.h>
+#include <usb/usblogger.h>
 #include "CUsbScheduler.h"
 #include "CUsbServer.h"
-#include <usb/usblogger.h>
 #include "rusb.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "UsbSvrTraces.h"
+#endif
+
 
 static void RunServerL();
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "USBSVR");
-#endif
 
 
 GLDEF_C TInt E32Main()
@@ -60,7 +62,13 @@
 //
 	{
 	// naming the server thread after the server helps to debug panics
-	LEAVEIFERRORL(User::RenameThread(KUsbServerName));
+    TInt err = User::RenameThread(KUsbServerName);
+    if(err < 0)
+        {
+        OstTrace1( TRACE_NORMAL, USBSVR_RUNSERVERL, "::RunServerL; User::RenameThread(KUsbServerName) error, leave reason=%d", err );
+        User::Leave(err);
+        }
+
 	//
 	// create and install the active scheduler we need
 	CUsbScheduler* scheduler = CUsbScheduler::NewL();
--- a/usbmgmt/usbmgr/usbman/server/SRC/cusbhost.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/usbman/server/SRC/cusbhost.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-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"
@@ -15,13 +15,13 @@
 *
 */
 
+#include <usb/usblogger.h>
 #include "cusbhost.h"
-#include <usb/usblogger.h>
-
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "cusbhostTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "usbhost");
-#endif
 
 CUsbHost* CUsbHost::iInstance = 0;
 
@@ -39,7 +39,7 @@
 
 CUsbHost::~CUsbHost()
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry0( CUSBHOST_CUSBHOST_DES_ENTRY );
 
 	Stop();
 
@@ -51,30 +51,37 @@
 		}
 	iObservers.Close();
 	iInstance = 0;
+	OstTraceFunctionExit0( CUSBHOST_CUSBHOST_DES_EXIT );
 	}
 
 CUsbHost::CUsbHost()
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry0( CUSBHOST_CUSBHOST_CONS_ENTRY );
+	OstTraceFunctionExit0( CUSBHOST_CUSBHOST_CONS_EXIT );
 	}
 
 void CUsbHost::ConstructL()
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry0( CUSBHOST_CONSTRUCTL_ENTRY );
 
 	iUsbHostWatcher[EHostEventMonitor] = 
 			CActiveUsbHostEventWatcher::NewL(iUsbHostStack,*this,iHostEventInfo);
 	iUsbHostWatcher[EHostMessageMonitor] = 
 			CActiveUsbHostMessageWatcher::NewL(iUsbHostStack,*this,iHostMessage);
+	OstTraceFunctionExit0( CUSBHOST_CONSTRUCTL_EXIT );
 	}
 void CUsbHost::StartL()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBHOST_STARTL_ENTRY );
 
 	if(!iHasBeenStarted)
 		{
-
-		LEAVEIFERRORL(iUsbHostStack.Connect());
+		TInt err = iUsbHostStack.Connect();
+		if(err < 0)
+		    {
+            OstTrace1( TRACE_NORMAL, CUSBHOST_STARTL, "CUsbHost::StartL; iUsbHostStack.Connect() error. Leave error=%d", err );
+            User::Leave(err);
+		    }
 
 		for(TInt i=0;i<ENumMonitor;i++)
 			{
@@ -82,11 +89,12 @@
 			}
 		iHasBeenStarted = ETrue;
 		}
+	OstTraceFunctionExit0( CUSBHOST_STARTL_EXIT );
 	}
 
 void CUsbHost::Stop()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBHOST_STOP_ENTRY );
 
 	TInt i=0;
 	for(i=0;i<ENumMonitor;i++)
@@ -100,23 +108,25 @@
 	iUsbHostStack.Close();
 
 	iHasBeenStarted = EFalse;
+	OstTraceFunctionExit0( CUSBHOST_STOP_EXIT );
 	}
 
 void CUsbHost::RegisterObserverL(MUsbOtgHostNotifyObserver& aObserver)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBHOST_REGISTEROBSERVERL_ENTRY );
 
 	iObservers.AppendL(&aObserver);
 	UpdateNumOfObservers();
+	OstTraceFunctionExit0( CUSBHOST_REGISTEROBSERVERL_EXIT );
 	}
 
 void CUsbHost::DeregisterObserver(MUsbOtgHostNotifyObserver& aObserver)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBHOST_DEREGISTEROBSERVER_ENTRY );
 	TInt index = iObservers.Find(&aObserver);
 	if(index == KErrNotFound)
 		{
-		LOGTEXT(_L8("\t Cannot remove observer, not found"));
+        OstTrace0( TRACE_NORMAL, CUSBHOST_DEREGISTEROBSERVER, "CUsbHost::DeregisterObserver;  Cannot remove observer, not found" );
 		}
 	else
 		{
@@ -124,11 +134,12 @@
 		}
 
 	UpdateNumOfObservers();
+	OstTraceFunctionExit0( CUSBHOST_DEREGISTEROBSERVER_EXIT );
 	}
 
 TInt CUsbHost::GetSupportedLanguages(TUint aDeviceId,RArray<TUint>& aLangIds)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBHOST_GETSUPPORTEDLANGUAGES_ENTRY );
 	TInt err = KErrNone;
 	if ( iUsbHostStack.Handle() )
 		{
@@ -138,12 +149,13 @@
 		{
 		err = KErrBadHandle;
 		}
+	OstTraceFunctionExit0( CUSBHOST_GETSUPPORTEDLANGUAGES_EXIT );
 	return err;
 	}
 
 TInt CUsbHost::GetManufacturerStringDescriptor(TUint aDeviceId,TUint aLangId,TName& aString)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBHOST_GETMANUFACTURERSTRINGDESCRIPTOR_ENTRY );
 	TInt err = KErrNone;
 	if ( iUsbHostStack.Handle() )
 		{
@@ -153,12 +165,13 @@
 		{
 		err = KErrBadHandle;
 		}
+	OstTraceFunctionExit0( CUSBHOST_GETMANUFACTURERSTRINGDESCRIPTOR_EXIT );
 	return err;
 	}
 
 TInt CUsbHost::GetProductStringDescriptor(TUint aDeviceId,TUint aLangId,TName& aString)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBHOST_GETPRODUCTSTRINGDESCRIPTOR_ENTRY );
 	TInt err = KErrNone;
 	if ( iUsbHostStack.Handle() )
 		{
@@ -168,12 +181,13 @@
 		{
 		err = KErrBadHandle;
 		}
+	OstTraceFunctionExit0( CUSBHOST_GETPRODUCTSTRINGDESCRIPTOR_EXIT );
 	return err;
 	}
 
 TInt CUsbHost::GetOtgDescriptor(TUint aDeviceId, TOtgDescriptor& otgDescriptor)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBHOST_GETOTGDESCRIPTOR_ENTRY );
 	
 	TInt err(KErrNone);
 	
@@ -186,20 +200,21 @@
 		err = KErrBadHandle;
 		}
 	
+	OstTraceFunctionExit0( CUSBHOST_GETOTGDESCRIPTOR_EXIT );
 	return err;
 	}
 
 void CUsbHost::NotifyHostEvent(TUint aWatcherId)
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry0( CUSBHOST_NOTIFYHOSTEVENT_ENTRY );
+
 	if(aWatcherId == EHostEventMonitor)
 		{
-
-		LOGTEXT2(_L8("\t Device id %d"),iHostEventInfo.iDeviceId);
-		LOGTEXT2(_L8("\t iEventType  %d"),iHostEventInfo.iEventType);
-		LOGTEXT2(_L8("\t TDriverLoadStatus %d"),iHostEventInfo.iDriverLoadStatus);
-		LOGTEXT2(_L8("\t VID %d"),iHostEventInfo.iVid);
-		LOGTEXT2(_L8("\t PID %d"),iHostEventInfo.iPid);
+		OstTrace1( TRACE_NORMAL, CUSBHOST_NOTIFYHOSTEVENT, "CUsbHost::NotifyHostEvent;DeviceId=%d", iHostEventInfo.iDeviceId );
+		OstTrace1( TRACE_NORMAL, CUSBHOST_NOTIFYHOSTEVENT_DUP1, "CUsbHost::NotifyHostEvent;iEventType=%d", iHostEventInfo.iEventType );
+		OstTrace1( TRACE_NORMAL, CUSBHOST_NOTIFYHOSTEVENT_DUP2, "CUsbHost::NotifyHostEvent;TDriverLoadStatus=%d", iHostEventInfo.iDriverLoadStatus );
+		OstTrace1( TRACE_NORMAL, CUSBHOST_NOTIFYHOSTEVENT_DUP3, "CUsbHost::NotifyHostEvent;VID=%d", iHostEventInfo.iVid );
+		OstTrace1( TRACE_NORMAL, CUSBHOST_NOTIFYHOSTEVENT_DUP4, "CUsbHost::NotifyHostEvent;Pid=%d", iHostEventInfo.iPid );
 
 		for(TUint i=0;i<iNumOfObservers;i++)
 			{
@@ -208,24 +223,26 @@
 		}
 	else
 		{
-		LOGTEXT2(_L8("\t Host Message %d"),iHostMessage);
-
+		OstTrace1( TRACE_NORMAL, CUSBHOST_NOTIFYHOSTEVENT_DUP5, "CUsbHost::NotifyHostEvent;Host Message=%d", iHostMessage );
+		
 		for(TUint i=0;i<iNumOfObservers;i++)
 			{
 			iObservers[i]->UsbOtgHostMessage(iHostMessage);
 			}
 		}
+	OstTraceFunctionExit0( CUSBHOST_NOTIFYHOSTEVENT_EXIT );
 	}
 
 void CUsbHost::UpdateNumOfObservers()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBHOST_UPDATENUMOFOBSERVERS_ENTRY );
 	iNumOfObservers = iObservers.Count();
+	OstTraceFunctionExit0( CUSBHOST_UPDATENUMOFOBSERVERS_EXIT );
 	}
 
 TInt CUsbHost::EnableDriverLoading()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBHOST_ENABLEDRIVERLOADING_ENTRY );
 	TInt err = KErrNone;
 	if ( iUsbHostStack.Handle() )
 		{
@@ -235,14 +252,16 @@
 		{
 		err = KErrBadHandle;
 		}
+	OstTraceFunctionExit0( CUSBHOST_ENABLEDRIVERLOADING_EXIT );
 	return err;
 	}
 
 void CUsbHost::DisableDriverLoading()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBHOST_DISABLEDRIVERLOADING_ENTRY );
 	if ( iUsbHostStack.Handle() )
 		{
 		iUsbHostStack.DisableDriverLoading();
 		}
+	OstTraceFunctionExit0( CUSBHOST_DISABLEDRIVERLOADING_EXIT );
 	}
--- a/usbmgmt/usbmgr/usbman/server/SRC/cusbhostwatcher.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/usbman/server/SRC/cusbhostwatcher.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-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"
@@ -17,13 +17,14 @@
 
 
 #include "cusbhostwatcher.h"
-#include <usb/usblogger.h>
 #include "cusbhost.h"
 
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "cusbhostwatcherTraces.h"
+#endif
+
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "hoststatewatcher");
-#endif
 
 /*
  * 	Base class for USB Host watchers
@@ -36,23 +37,26 @@
 	iOwner(aOwner),
 	iWatcherId(aWatcherId)
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry0( CACTIVEUSBHOSTWATCHER_CACTIVEUSBHOSTWATCHER_CONS_ENTRY );
 	CActiveScheduler::Add(this);
+	OstTraceFunctionExit0( CACTIVEUSBHOSTWATCHER_CACTIVEUSBHOSTWATCHER_CONS_EXIT );
 	}
 
 CActiveUsbHostWatcher::~CActiveUsbHostWatcher()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CACTIVEUSBHOSTWATCHER_CACTIVEUSBHOSTWATCHER_DES_ENTRY );	
 	Cancel();
+	OstTraceFunctionExit0( CACTIVEUSBHOSTWATCHER_CACTIVEUSBHOSTWATCHER_DES_EXIT );
 	}
 
 void CActiveUsbHostWatcher::RunL()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CACTIVEUSBHOSTWATCHER_RUNL_ENTRY );
 
 	ASSERT(iStatus.Int() == KErrNone);
 	iOwner.NotifyHostEvent(iWatcherId);
 	Post();
+	OstTraceFunctionExit0( CACTIVEUSBHOSTWATCHER_RUNL_EXIT );
 	}
 
 
@@ -80,28 +84,32 @@
 														 , iHostEventInfo(aHostEventInfo)
 
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CACTIVEUSBHOSTEVENTWATCHER_CACTIVEUSBHOSTEVENTWATCHER_CONS_ENTRY );
+	OstTraceFunctionExit0( CACTIVEUSBHOSTEVENTWATCHER_CACTIVEUSBHOSTEVENTWATCHER_CONS_EXIT );
 	}
 
 CActiveUsbHostEventWatcher::~CActiveUsbHostEventWatcher()
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry0( CACTIVEUSBHOSTEVENTWATCHER_CACTIVEUSBHOSTEVENTWATCHER_DES_ENTRY );
 	Cancel();
+	OstTraceFunctionExit0( CACTIVEUSBHOSTEVENTWATCHER_CACTIVEUSBHOSTEVENTWATCHER_DES_EXIT );
 	}
 
 void CActiveUsbHostEventWatcher::Post()
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry0( CACTIVEUSBHOSTEVENTWATCHER_POST_ENTRY );
 
 	iUsbHostStack.NotifyDeviceEvent(iStatus, iHostEventInfo);
 	SetActive();
+	OstTraceFunctionExit0( CACTIVEUSBHOSTEVENTWATCHER_POST_EXIT );
 	}
 
 void CActiveUsbHostEventWatcher::DoCancel()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CACTIVEUSBHOSTEVENTWATCHER_DOCANCEL_ENTRY );
 
 	iUsbHostStack.NotifyDeviceEventCancel();
+	OstTraceFunctionExit0( CACTIVEUSBHOSTEVENTWATCHER_DOCANCEL_EXIT );
 	}
 
 
@@ -120,9 +128,9 @@
 
 CActiveUsbHostMessageWatcher::~CActiveUsbHostMessageWatcher()
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CACTIVEUSBHOSTMESSAGEWATCHER_CACTIVEUSBHOSTMESSAGEWATCHER_DES_ENTRY ); 
 	Cancel();
+	OstTraceFunctionExit0( CACTIVEUSBHOSTMESSAGEWATCHER_CACTIVEUSBHOSTMESSAGEWATCHER_DES_EXIT );
 	}
 
 CActiveUsbHostMessageWatcher::CActiveUsbHostMessageWatcher(
@@ -134,22 +142,25 @@
 															   KHostMessageMonitor)
 										, iHostMessage(aHostMessage)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CACTIVEUSBHOSTMESSAGEWATCHER_CACTIVEUSBHOSTMESSAGEWATCHER_CONS_ENTRY );
+	OstTraceFunctionExit0( CACTIVEUSBHOSTMESSAGEWATCHER_CACTIVEUSBHOSTMESSAGEWATCHER_CONS_EXIT );
 	}
 
 void CActiveUsbHostMessageWatcher::Post()
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry0( CACTIVEUSBHOSTMESSAGEWATCHER_POST_ENTRY );
 	
 	iUsbHostStack.NotifyDevmonEvent(iStatus, iHostMessage);
 	SetActive();
+	OstTraceFunctionExit0( CACTIVEUSBHOSTMESSAGEWATCHER_POST_EXIT );
 	}
 
 
 void CActiveUsbHostMessageWatcher::DoCancel()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CACTIVEUSBHOSTMESSAGEWATCHER_DOCANCEL_ENTRY );
 	
 	iUsbHostStack.NotifyDevmonEventCancel();
+	OstTraceFunctionExit0( CACTIVEUSBHOSTMESSAGEWATCHER_DOCANCEL_EXIT );
 	}
 
--- a/usbmgmt/usbmgr/usbman/server/SRC/cusbotgwatcher.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/usbman/server/SRC/cusbotgwatcher.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-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,15 +21,16 @@
  @file
 */
 
+#include <usb/usbshared.h>
 #include <usb/usblogger.h>
 #include "CUsbScheduler.h"
 #include "cusbotgwatcher.h"
 #include "CUsbOtg.h"
-#include <usb/usbshared.h>
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "cusbotgwatcherTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "USBSVR-OTGWATCHER");
-#endif
 
 static _LIT_SECURITY_POLICY_PASS(KAllowAllPolicy);
 static _LIT_SECURITY_POLICY_S1(KNetworkControlPolicy,KUsbmanSvrSid,ECapabilityNetworkControl);
@@ -50,8 +51,9 @@
 CUsbOtgBaseWatcher::CUsbOtgBaseWatcher(RUsbOtgDriver& aLdd)
 	: CActive(CActive::EPriorityStandard), iLdd(aLdd)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTGBASEWATCHER_CUSBOTGBASEWATCHER_CONS_ENTRY );
 	CActiveScheduler::Add(this);
+	OstTraceFunctionExit0( CUSBOTGBASEWATCHER_CUSBOTGBASEWATCHER_CONS_EXIT );
 	}
 
 /**
@@ -63,8 +65,9 @@
  */
 CUsbOtgBaseWatcher::~CUsbOtgBaseWatcher()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTGBASEWATCHER_CUSBOTGBASEWATCHER_DES_ENTRY );
 	Cancel();
+	OstTraceFunctionExit0( CUSBOTGBASEWATCHER_CUSBOTGBASEWATCHER_DES_EXIT );
 	}
 
 /**
@@ -72,8 +75,9 @@
  */
 void CUsbOtgBaseWatcher::Start()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTGBASEWATCHER_START_ENTRY );
 	Post();
+	OstTraceFunctionExit0( CUSBOTGBASEWATCHER_START_EXIT );
 	}
 
 //---------------------------- Id-Pin watcher class --------------------------- 
@@ -89,12 +93,13 @@
  */
 CUsbOtgIdPinWatcher* CUsbOtgIdPinWatcher::NewL(RUsbOtgDriver& aLdd)
 	{
-	LOG_STATIC_FUNC_ENTRY
+	OstTraceFunctionEntry0( CUSBOTGIDPINWATCHER_NEWL_ENTRY );
 
 	CUsbOtgIdPinWatcher* self = new (ELeave) CUsbOtgIdPinWatcher(aLdd);
 	CleanupStack::PushL(self);
 	self->ConstructL();
 	CleanupStack::Pop(self);
+	OstTraceFunctionExit0( CUSBOTGIDPINWATCHER_NEWL_EXIT );
 	return self;
 	}
 
@@ -108,9 +113,10 @@
  */
 CUsbOtgIdPinWatcher::~CUsbOtgIdPinWatcher()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTGIDPINWATCHER_CUSBOTGIDPINWATCHER_DES_ENTRY );
 	Cancel();
 	RProperty::Delete(KUsbOtgIdPinPresentProperty);
+	OstTraceFunctionExit0( CUSBOTGIDPINWATCHER_CUSBOTGIDPINWATCHER_DES_EXIT );
 	}
 
 void CUsbOtgIdPinWatcher::ConstructL()
@@ -118,7 +124,7 @@
  * Performs 2nd phase construction of the OTG object.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTGIDPINWATCHER_CONSTRUCTL_ENTRY );
 
 	TInt err = RProperty::Define(KUsbOtgIdPinPresentProperty, RProperty::EInt, KAllowAllPolicy, KNetworkControlPolicy);
 	if ( err != KErrNone && err != KErrAlreadyExists )
@@ -130,6 +136,7 @@
 	    {
 	    User::LeaveIfError(err);
 	    }
+	OstTraceFunctionExit0( CUSBOTGIDPINWATCHER_CONSTRUCTL_EXIT );
 	}
 
 /**
@@ -143,7 +150,8 @@
 CUsbOtgIdPinWatcher::CUsbOtgIdPinWatcher(RUsbOtgDriver& aLdd)
 	: CUsbOtgBaseWatcher(aLdd)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTGIDPINWATCHER_CUSBOTGIDPINWATCHER_CONS_ENTRY );
+	OstTraceFunctionExit0( CUSBOTGIDPINWATCHER_CUSBOTGIDPINWATCHER_CONS_EXIT );
 	}
 
 /**
@@ -151,14 +159,19 @@
  */
 void CUsbOtgIdPinWatcher::RunL()
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8(">>CUsbOtgIdPinWatcher::RunL [iStatus=%d]"), iStatus.Int());
+	OstTraceFunctionEntry0( CUSBOTGIDPINWATCHER_RUNL_ENTRY );
+	OstTrace1( TRACE_NORMAL, CUSBOTGIDPINWATCHER_RUNL, "CUsbOtgIdPinWatcher::RunL;iStatus=%d", iStatus.Int() );
 
-	LEAVEIFERRORL(iStatus.Int());
+    TInt err = iStatus.Int();
+    if(err < 0)
+        {
+        OstTrace1( TRACE_NORMAL, CUSBOTGIDPINWATCHER_RUNL_DUP1, "CUsbOtgIdPinWatcher::RunL;iStatus.Int() with error=%d", err );
+        User::Leave(err);
+        }
 	
 	Post();
 
-	LOGTEXT(_L8("<<CUsbOtgIdPinWatcher::RunL"));
+	OstTraceFunctionExit0( CUSBOTGIDPINWATCHER_RUNL_EXIT );
 	}
 
 
@@ -167,8 +180,9 @@
  */
 void CUsbOtgIdPinWatcher::DoCancel()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTGIDPINWATCHER_DOCANCEL_ENTRY );
 	iLdd.CancelOtgIdPinNotification();
+	OstTraceFunctionExit0( CUSBOTGIDPINWATCHER_DOCANCEL_EXIT );
 	}
 
 /**
@@ -176,38 +190,45 @@
  */
 void CUsbOtgIdPinWatcher::Post()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTGIDPINWATCHER_POST_ENTRY );
 
-	LOGTEXT(_L8("CUsbOtgIdPinWatcher::Post() - About to call QueueOtgIdPinNotification"));
+	OstTrace0( TRACE_NORMAL, CUSBOTGIDPINWATCHER_POST, "CUsbOtgIdPinWatcher::Post - About to call QueueOtgIdPinNotification" );
+	
 	iLdd.QueueOtgIdPinNotification(iOtgIdPin, iStatus);
 	switch (iOtgIdPin)
 		{
 		case RUsbOtgDriver::EIdPinAPlug:
 			if (RProperty::Set(KUidUsbManCategory,KUsbOtgIdPinPresentProperty,ETrue) != KErrNone)
 				{
-				LOGTEXT2(_L8(">>CUsbOtgIdPinWatcher::Post [iOtgIdPin=%d] - failed to set the property value"), iOtgIdPin);
+				OstTrace1( TRACE_NORMAL, CUSBOTGIDPINWATCHER_POST_DUP1, 
+				        "CUsbOtgIdPinWatcher::Post; [iOtgIdPin=%d] - failed to set the property value", iOtgIdPin );				
 				}
 			else
 				{
-				LOGTEXT2(_L8(">>CUsbOtgIdPinWatcher::Post [iOtgIdPin=%d] - property is set to 1"), iOtgIdPin);
+				OstTrace1( TRACE_NORMAL, CUSBOTGIDPINWATCHER_POST_DUP2, 
+				        "CUsbOtgIdPinWatcher::Post; [iOtgIdPin=%d] - property is set to 1", iOtgIdPin );				
 				}
 			break;
 		case RUsbOtgDriver::EIdPinBPlug:
 		case RUsbOtgDriver::EIdPinUnknown:
 			if (RProperty::Set(KUidUsbManCategory,KUsbOtgIdPinPresentProperty,EFalse) != KErrNone)
 				{
-				LOGTEXT2(_L8(">>CUsbOtgIdPinWatcher::Post [iOtgIdPin=%d] - failed to set the property value"), iOtgIdPin);
+				OstTrace1( TRACE_NORMAL, CUSBOTGIDPINWATCHER_POST_DUP3, 
+				        "CUsbOtgIdPinWatcher::Post; [iOtgIdPin=%d] - failed to set the property value", iOtgIdPin );				
 				}
 			else
 				{
-				LOGTEXT2(_L8(">>CUsbOtgIdPinWatcher::Post [iOtgIdPin=%d] - property is set to 0"), iOtgIdPin);
+				OstTrace1( TRACE_NORMAL, CUSBOTGIDPINWATCHER_POST_DUP4, 
+				        "CUsbOtgIdPinWatcher::Post; [iOtgIdPin=%d] - property is set to 0", iOtgIdPin );				
 				}
 			break;
 		default:
-			LOGTEXT2(_L8(">>CUsbOtgIdPinWatcher::Post [iOtgIdPin=%d] is unrecognized, re-request QueueOtgIdPinNotification"), iOtgIdPin);
+			OstTrace1( TRACE_NORMAL, CUSBOTGIDPINWATCHER_POST_DUP5, 
+			        "CUsbOtgIdPinWatcher::Post; [iOtgIdPin=%d] is unrecognized, re-request QueueOtgIdPinNotification", iOtgIdPin );
 			break;
 		}
 	SetActive();
+	OstTraceFunctionExit0( CUSBOTGIDPINWATCHER_POST_EXIT );
 	}
 
 //----------------------------- VBus watcher class ---------------------------- 
@@ -223,12 +244,13 @@
  */
 CUsbOtgVbusWatcher* CUsbOtgVbusWatcher::NewL(RUsbOtgDriver& aLdd)
 	{
-	LOG_STATIC_FUNC_ENTRY
+	OstTraceFunctionEntry0( CUSBOTGVBUSWATCHER_NEWL_ENTRY );
 
 	CUsbOtgVbusWatcher* self = new (ELeave) CUsbOtgVbusWatcher(aLdd);
 	CleanupStack::PushL(self);
 	self->ConstructL();
 	CleanupStack::Pop(self);
+	OstTraceFunctionExit0( CUSBOTGVBUSWATCHER_NEWL_EXIT );
 	return self;
 	}
 
@@ -242,10 +264,11 @@
  */
 CUsbOtgVbusWatcher::~CUsbOtgVbusWatcher()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTGVBUSWATCHER_CUSBOTGVBUSWATCHER_DES_ENTRY );
 	Cancel();
 
 	RProperty::Delete(KUsbOtgVBusPoweredProperty);
+	OstTraceFunctionExit0( CUSBOTGVBUSWATCHER_CUSBOTGVBUSWATCHER_DES_EXIT );
 	}
 
 void CUsbOtgVbusWatcher::ConstructL()
@@ -253,7 +276,7 @@
  * Performs 2nd phase construction of the OTG object.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTGVBUSWATCHER_CONSTRUCTL_ENTRY );
 
 	TInt err = RProperty::Define(KUsbOtgVBusPoweredProperty, RProperty::EInt, KAllowAllPolicy, KNetworkControlPolicy);
 	if ( err != KErrNone && err != KErrAlreadyExists )
@@ -265,6 +288,7 @@
 	    {
 	    User::LeaveIfError(err);
 	    }
+	OstTraceFunctionExit0( CUSBOTGVBUSWATCHER_CONSTRUCTL_EXIT );
 	}
 
 /**
@@ -277,7 +301,8 @@
 CUsbOtgVbusWatcher::CUsbOtgVbusWatcher(RUsbOtgDriver& aLdd)
 	: CUsbOtgBaseWatcher(aLdd)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTGVBUSWATCHER_CUSBOTGVBUSWATCHER_CONS_ENTRY );
+	OstTraceFunctionExit0( CUSBOTGVBUSWATCHER_CUSBOTGVBUSWATCHER_CONS_EXIT );
 	}
 
 /**
@@ -285,14 +310,19 @@
  */
 void CUsbOtgVbusWatcher::RunL()
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8(">>CUsbOtgVbusWatcher::RunL [iStatus=%d]"), iStatus.Int());
+	OstTraceFunctionEntry0( CUSBOTGVBUSWATCHER_RUNL_ENTRY );
+	OstTrace1( TRACE_NORMAL, CUSBOTGVBUSWATCHER_RUNL, "CUsbOtgVbusWatcher::RunL;iStatus=%d", iStatus.Int() );
 
-	LEAVEIFERRORL(iStatus.Int());
+    TInt err = iStatus.Int();
+    if(err < 0)
+        {
+        OstTrace1( TRACE_NORMAL, CUSBOTGVBUSWATCHER_RUNL_DUP1, "CUsbOtgVbusWatcher::RunL;iStatus.Int() with error=%d", err );
+        User::Leave(err);
+        }
 
 	Post();
 
-	LOGTEXT(_L8("<<CUsbOtgVbusWatcher::RunL"));
+	OstTraceFunctionExit0( CUSBOTGVBUSWATCHER_RUNL_EXIT );
 	}
 
 
@@ -301,8 +331,9 @@
  */
 void CUsbOtgVbusWatcher::DoCancel()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTGVBUSWATCHER_DOCANCEL_ENTRY );
 	iLdd.CancelOtgVbusNotification();
+	OstTraceFunctionExit0( CUSBOTGVBUSWATCHER_DOCANCEL_EXIT );
 	}
 
 /**
@@ -310,38 +341,45 @@
  */
 void CUsbOtgVbusWatcher::Post()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTGVBUSWATCHER_POST_ENTRY );
 
-	LOGTEXT(_L8("CUsbOtgVbusWatcher::Post() - About to call QueueOtgVbusNotification"));
+	OstTrace0( TRACE_NORMAL, CUSBOTGVBUSWATCHER_POST, "CUsbOtgVbusWatcher::Post - About to call QueueOtgVbusNotification" );
+	
 	iLdd.QueueOtgVbusNotification(iOtgVbus, iStatus);
 	switch (iOtgVbus)
 		{
 		case RUsbOtgDriver::EVbusHigh:
 			if (RProperty::Set(KUidUsbManCategory,KUsbOtgVBusPoweredProperty,ETrue) != KErrNone)
 				{
-				LOGTEXT2(_L8(">>CUsbOtgVbusWatcher::Post [iOtgVbus=%d](EVbusHigh) - failed to set the property value"), iOtgVbus);
+				OstTrace1( TRACE_NORMAL, CUSBOTGVBUSWATCHER_POST_DUP1, 
+				        "CUsbOtgVbusWatcher::Post;[iOtgVbus=%d](EVbusHigh) - failed to set the property value", iOtgVbus );
 				}
 			else
 				{
-				LOGTEXT2(_L8(">>CUsbOtgVbusWatcher::Post [iOtgVbus=%d](EVbusHigh) - property is set to ETrue"), iOtgVbus);
+				OstTrace1( TRACE_NORMAL, CUSBOTGVBUSWATCHER_POST_DUP2, 
+				        "CUsbOtgVbusWatcher::Post;[iOtgVbus=%d](EVbusHigh) - property is set to ETrue", iOtgVbus );
 				}
 			break;
 		case RUsbOtgDriver::EVbusLow:
 		case RUsbOtgDriver::EVbusUnknown:
 			if (RProperty::Set(KUidUsbManCategory,KUsbOtgVBusPoweredProperty,EFalse) != KErrNone)
 				{
-				LOGTEXT2(_L8(">>CUsbOtgVbusWatcher::Post [iOtgVbus=%d](1 - EVbusLow, 2 - EVbusUnknown) - failed to set the property value"), iOtgVbus);
+				OstTrace1( TRACE_NORMAL, CUSBOTGVBUSWATCHER_POST_DUP3, 
+				        "CUsbOtgVbusWatcher::Post;[iOtgVbus=%d](1 - EVbusLow, 2 - EVbusUnknown) - failed to set the property value", iOtgVbus );
 				}
 			else
 				{
-				LOGTEXT2(_L8(">>CUsbOtgVbusWatcher::Post [iOtgVbus=%d](1 - EVbusLow, 2 - EVbusUnknown) - property is set to EFalse"), iOtgVbus);
+				OstTrace1( TRACE_NORMAL, CUSBOTGVBUSWATCHER_POST_DUP4, 
+				        "CUsbOtgVbusWatcher::Post;[iOtgVbus=%d](1 - EVbusLow, 2 - EVbusUnknown) - property is set to EFalse", iOtgVbus );
 				}
 			break;
 		default:
-			LOGTEXT2(_L8(">>CUsbOtgVbusWatcher::RunL [iOtgVbus=%d] is unrecognized, re-request QueueOtgVbusNotification"), iOtgVbus);
+			OstTrace1( TRACE_NORMAL, CUSBOTGVBUSWATCHER_POST_DUP5, 
+			        "CUsbOtgVbusWatcher::Post;iOtgVbus=%d] is unrecognized, re-request QueueOtgVbusNotification", iOtgVbus );
 			break;
 		}
 	SetActive();
+	OstTraceFunctionExit0( CUSBOTGVBUSWATCHER_POST_EXIT );
 	}
 
 
@@ -358,12 +396,13 @@
  */
 CUsbOtgStateWatcher* CUsbOtgStateWatcher::NewL(RUsbOtgDriver& aLdd)
 	{
-	LOG_STATIC_FUNC_ENTRY
+	OstTraceFunctionEntry0( CUSBOTGSTATEWATCHER_NEWL_ENTRY );
 
 	CUsbOtgStateWatcher* self = new (ELeave) CUsbOtgStateWatcher(aLdd);
 	CleanupStack::PushL(self);
 	self->ConstructL();
 	CleanupStack::Pop(self);
+	OstTraceFunctionExit0( CUSBOTGSTATEWATCHER_NEWL_EXIT );
 	return self;
 	}
 
@@ -377,9 +416,10 @@
  */
 CUsbOtgStateWatcher::~CUsbOtgStateWatcher()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTGSTATEWATCHER_CUSBOTGSTATEWATCHER_DES_ENTRY );
 	Cancel();
 	RProperty::Delete(KUsbOtgStateProperty);
+	OstTraceFunctionExit0( CUSBOTGSTATEWATCHER_CUSBOTGSTATEWATCHER_DES_EXIT );
 	}
 
 void CUsbOtgStateWatcher::ConstructL()
@@ -387,7 +427,7 @@
  * Performs 2nd phase construction of the OTG object.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTGSTATEWATCHER_CONSTRUCTL_ENTRY );
 
 	TInt err = RProperty::Define(KUsbOtgStateProperty, RProperty::EInt, KAllowAllPolicy, KNetworkControlPolicy);
 	if ( err != KErrNone && err != KErrAlreadyExists )
@@ -399,6 +439,7 @@
 	    {
 	    User::LeaveIfError(err);
 	    }
+	OstTraceFunctionExit0( CUSBOTGSTATEWATCHER_CONSTRUCTL_EXIT );
 	}
 
 /**
@@ -412,8 +453,9 @@
 CUsbOtgStateWatcher::CUsbOtgStateWatcher(RUsbOtgDriver& aLdd)
 	: CUsbOtgBaseWatcher(aLdd)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTGSTATEWATCHER_CUSBOTGSTATEWATCHER_CONS_ENTRY );
 	iOtgState = RUsbOtgDriver::EStateReset;
+	OstTraceFunctionExit0( CUSBOTGSTATEWATCHER_CUSBOTGSTATEWATCHER_CONS_EXIT );
 	}
 
 /**
@@ -421,14 +463,19 @@
  */
 void CUsbOtgStateWatcher::RunL()
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8(">>CUsbOtgStateWatcher::RunL [iStatus=%d]"), iStatus.Int());
+	OstTraceFunctionEntry0( CUSBOTGSTATEWATCHER_RUNL_ENTRY );
+	OstTrace1( TRACE_NORMAL, CUSBOTGSTATEWATCHER_RUNL, "CUsbOtgStateWatcher::RunL;iStatus.Int()=%d", iStatus.Int() );
 
-	LEAVEIFERRORL(iStatus.Int());
+    TInt err = iStatus.Int();
+    if(err < 0)
+        {
+        OstTrace1( TRACE_NORMAL, CUSBOTGSTATEWATCHER_RUNL_DUP1, "CUsbOtgStateWatcher::RunL;iStatus.Int() with error=%d", err );
+        User::Leave(err);
+        }
 
 	Post();
 
-	LOGTEXT(_L8("<<CUsbOtgStateWatcher::RunL"));
+	OstTraceFunctionExit0( CUSBOTGSTATEWATCHER_RUNL_EXIT );
 	}
 
 
@@ -437,8 +484,9 @@
  */
 void CUsbOtgStateWatcher::DoCancel()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTGSTATEWATCHER_DOCANCEL_ENTRY );
 	iLdd.CancelOtgStateNotification();
+	OstTraceFunctionExit0( CUSBOTGSTATEWATCHER_DOCANCEL_EXIT );
 	}
 
 /**
@@ -446,17 +494,20 @@
  */
 void CUsbOtgStateWatcher::Post()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTGSTATEWATCHER_POST_ENTRY );
 
-	LOGTEXT(_L8("CUsbOtgStateWatcher::Post() - About to call QueueOtgStateNotification"));	
+	OstTrace0( TRACE_NORMAL, CUSBOTGSTATEWATCHER_POST, "CUsbOtgStateWatcher::Post - About to call QueueOtgStateNotification" );
 	iLdd.QueueOtgStateNotification(iOtgState, iStatus);
-	LOGTEXT3(_L8(">>CUsbOtgStateWatcher::RunL [iStatus=%d], iOtgState = %d"), iStatus.Int(), iOtgState);
+	OstTraceExt2( TRACE_NORMAL, CUSBOTGSTATEWATCHER_POST_DUP1, 
+	        "CUsbOtgStateWatcher::Post;[iStatus=%d], iOtgState = %d", iStatus.Int(), iOtgState );
 	if (RProperty::Set(KUidUsbManCategory,KUsbOtgStateProperty,(TInt)iOtgState) != KErrNone)
 	{
-		LOGTEXT3(_L8(">>CUsbOtgStateWatcher::RunL [iStatus=%d], iOtgState = %d - failed to set the property"), iStatus.Int(), iOtgState);
+		OstTraceExt2( TRACE_NORMAL, CUSBOTGSTATEWATCHER_POST_DUP2, 
+		        "CUsbOtgStateWatcher::Post;[iStatus=%d], iOtgState = %d - failed to set the property", iStatus.Int(), iOtgState );
 	}
 
 	SetActive();
+	OstTraceFunctionExit0( CUSBOTGSTATEWATCHER_POST_EXIT );
 	}
 
 //-------------------------- OTG Events watcher class ------------------------- 
@@ -475,12 +526,13 @@
 CUsbOtgEventWatcher* CUsbOtgEventWatcher::NewL(CUsbOtg& aOwner, RUsbOtgDriver& aLdd,
 											   RUsbOtgDriver::TOtgEvent& aOtgEvent)
 	{
-	LOG_STATIC_FUNC_ENTRY
+	OstTraceFunctionEntry0( CUSBOTGEVENTWATCHER_NEWL_ENTRY );
 
 	CUsbOtgEventWatcher* self = new (ELeave) CUsbOtgEventWatcher(aOwner, aLdd, aOtgEvent);
 	CleanupStack::PushL(self);
 	self->ConstructL();
 	CleanupStack::Pop(self);
+	OstTraceFunctionExit0( CUSBOTGEVENTWATCHER_NEWL_EXIT );
 	return self;
 	}
 
@@ -494,8 +546,9 @@
  */
 CUsbOtgEventWatcher::~CUsbOtgEventWatcher()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTGEVENTWATCHER_CUSBOTGEVENTWATCHER_DES_ENTRY );
 	Cancel();
+	OstTraceFunctionExit0( CUSBOTGEVENTWATCHER_CUSBOTGEVENTWATCHER_DES_EXIT );
 	}
 
 void CUsbOtgEventWatcher::ConstructL()
@@ -503,7 +556,8 @@
  * Performs 2nd phase construction of the OTG object.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTGEVENTWATCHER_CONSTRUCTL_ENTRY );
+	OstTraceFunctionExit0( CUSBOTGEVENTWATCHER_CONSTRUCTL_EXIT );
 	}
 
 /**
@@ -519,7 +573,8 @@
 										 RUsbOtgDriver::TOtgEvent& aOtgEvent)
 	: CUsbOtgBaseWatcher(aLdd), iOwner(aOwner), iOtgEvent(aOtgEvent)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTGEVENTWATCHER_CUSBOTGEVENTWATCHER_CONS_ENTRY );
+	OstTraceFunctionExit0( CUSBOTGEVENTWATCHER_CUSBOTGEVENTWATCHER_CONS_EXIT );
 	}
 
 /**
@@ -527,11 +582,17 @@
  */
 void CUsbOtgEventWatcher::RunL()
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8(">>CUsbOtgEventWatcher::RunL [iStatus=%d]"), iStatus.Int());
-
-	LEAVEIFERRORL(iStatus.Int());
-	LOGTEXT2(_L8("CUsbOtgEventWatcher::RunL() - Otg Event reported: %d"), (TInt)iOtgEvent);
+	OstTraceFunctionEntry0( CUSBOTGEVENTWATCHER_RUNL_ENTRY );
+	OstTrace1( TRACE_NORMAL, CUSBOTGEVENTWATCHER_RUNL, "CUsbOtgEventWatcher::RunL;iStatus=%d", iStatus.Int() );
+    TInt err = iStatus.Int();
+    if(err < 0)
+        {
+        OstTrace1( TRACE_NORMAL, CUSBOTGEVENTWATCHER_RUNL_DUP3, "CUsbOtgEventWatcher::RunL;iStatus.Int() with error=%d", err );
+        User::Leave(err);
+        }
+    
+	OstTrace1( TRACE_NORMAL, CUSBOTGEVENTWATCHER_RUNL_DUP1, 
+	        "CUsbOtgEventWatcher::RunL; - Otg Event reported: %d", (TInt)iOtgEvent );
 	if (  ( iOtgEvent == RUsbOtgDriver::EEventHnpDisabled )
 	    ||( iOtgEvent == RUsbOtgDriver::EEventHnpEnabled )
 	    ||( iOtgEvent == RUsbOtgDriver::EEventSrpInitiated )
@@ -541,13 +602,14 @@
 	   )
 		{
 		iOwner.NotifyOtgEvent();
-		LOGTEXT2(_L8("CUsbOtgEventWatcher::RunL() - The owner is notified about Otg Event = %d"), (TInt)iOtgEvent);
+		OstTrace1( TRACE_NORMAL, CUSBOTGEVENTWATCHER_RUNL_DUP2, 
+		        "CUsbOtgEventWatcher::RunL - The owner is notified about Otg Event = %d", (TInt)iOtgEvent );
 		}
 	Post();
-	LOGTEXT(_L8("<<CUsbOtgEventWatcher::RunL"));
+	OstTraceFunctionExit0( CUSBOTGEVENTWATCHER_RUNL_EXIT );
 	}
 
-#ifndef __FLOG_ACTIVE
+#ifndef _DEBUG
 void CUsbOtgEventWatcher::LogEventText(RUsbOtgDriver::TOtgEvent /*aState*/)
 	{
 	}
@@ -557,37 +619,48 @@
 	switch (aEvent)
 		{
 		case RUsbOtgDriver::EEventAPlugInserted:
-			LOGTEXT(_L8(" ***** A-Plug Inserted *****"));
+			OstTrace0( TRACE_NORMAL, CUSBOTGEVENTWATCHER_LOGEVENTTEXT, 
+			        "CUsbOtgEventWatcher::LogEventText ***** A-Plug Inserted *****" );
 			break;
 		case RUsbOtgDriver::EEventAPlugRemoved:
-			LOGTEXT(_L8(" ***** A-Plug Removed *****"));
+			OstTrace0( TRACE_NORMAL, CUSBOTGEVENTWATCHER_LOGEVENTTEXT_DUP1, 
+			        "CUsbOtgEventWatcher::LogEventText ***** A-Plug Removed *****" );
 			break;
 		case RUsbOtgDriver::EEventVbusRaised:
-			LOGTEXT(_L8(" ***** VBus Raised *****"));
+			OstTrace0( TRACE_NORMAL, CUSBOTGEVENTWATCHER_LOGEVENTTEXT_DUP2, 
+			        "CUsbOtgEventWatcher::LogEventText ***** VBus Raised *****" );
 			break;
 		case RUsbOtgDriver::EEventVbusDropped:
-			LOGTEXT(_L8(" ***** VBus Dropped *****"));
+			OstTrace0( TRACE_NORMAL, CUSBOTGEVENTWATCHER_LOGEVENTTEXT_DUP3, 
+			        "CUsbOtgEventWatcher::LogEventText ***** VBus Dropped *****" );
 			break;
 		case RUsbOtgDriver::EEventSrpInitiated:
-			LOGTEXT(_L8(" ***** SRP Initiated *****"));
+			OstTrace0( TRACE_NORMAL, CUSBOTGEVENTWATCHER_LOGEVENTTEXT_DUP4, 
+			        "CUsbOtgEventWatcher::LogEventText ***** SRP Initiated *****" );
 			break;
 		case RUsbOtgDriver::EEventSrpReceived:
-			LOGTEXT(_L8(" ***** SRP Received *****"));
+			OstTrace0( TRACE_NORMAL, CUSBOTGEVENTWATCHER_LOGEVENTTEXT_DUP5, 
+			        "CUsbOtgEventWatcher::LogEventText ***** SRP Received *****" );
 			break;
 		case RUsbOtgDriver::EEventHnpEnabled:
-			LOGTEXT(_L8(" ***** HNP Enabled *****"));
+			OstTrace0( TRACE_NORMAL, CUSBOTGEVENTWATCHER_LOGEVENTTEXT_DUP6, 
+			        "CUsbOtgEventWatcher::LogEventText ***** HNP Enabled *****" );
 			break;
 		case RUsbOtgDriver::EEventHnpDisabled:
-			LOGTEXT(_L8(" ***** HNP Disabled *****"));
+			OstTrace0( TRACE_NORMAL, CUSBOTGEVENTWATCHER_LOGEVENTTEXT_DUP7, 
+			        "CUsbOtgEventWatcher::LogEventText ***** HNP Disabled *****" );
 			break;
 		case RUsbOtgDriver::EEventRoleChangedToHost:
-			LOGTEXT(_L8(" ***** Role Changed to Host *****"));
+			OstTrace0( TRACE_NORMAL, CUSBOTGEVENTWATCHER_LOGEVENTTEXT_DUP8, 
+			        "CUsbOtgEventWatcher::LogEventText ***** Role Changed to Host *****" );
 			break;
 		case RUsbOtgDriver::EEventRoleChangedToDevice:
-			LOGTEXT(_L8(" ***** Role Changed to Device *****"));
+			OstTrace0( TRACE_NORMAL, CUSBOTGEVENTWATCHER_LOGEVENTTEXT_DUP9, 
+			        "CUsbOtgEventWatcher::LogEventText ***** Role Changed to Device *****" );
 			break;
 		case RUsbOtgDriver::EEventRoleChangedToIdle:
-			LOGTEXT(_L8(" ***** Role Changed to Idle *****"));
+			OstTrace0( TRACE_NORMAL, CUSBOTGEVENTWATCHER_LOGEVENTTEXT_DUP10, 
+			        "CUsbOtgEventWatcher::LogEventText ***** Role Changed to Idle *****" );
 			break;
 		default:
 			break;
@@ -600,8 +673,9 @@
  */
 void CUsbOtgEventWatcher::DoCancel()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTGEVENTWATCHER_DOCANCEL_ENTRY );
 	iLdd.CancelOtgEventRequest();
+	OstTraceFunctionExit0( CUSBOTGEVENTWATCHER_DOCANCEL_EXIT );
 	}
 
 /**
@@ -609,11 +683,12 @@
  */
 void CUsbOtgEventWatcher::Post()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTGEVENTWATCHER_POST_ENTRY );
 
-	LOGTEXT(_L8("CUsbOtgEventWatcher::Post() - About to call QueueOtgEventRequest"));	
+	OstTrace0( TRACE_NORMAL, CUSBOTGEVENTWATCHER_POST, "CUsbOtgEventWatcher::Post - About to call QueueOtgEventRequest" );
 	iLdd.QueueOtgEventRequest(iOtgEvent, iStatus);
 	SetActive();
+	OstTraceFunctionExit0( CUSBOTGEVENTWATCHER_POST_EXIT );
 	}
 
 
@@ -633,9 +708,10 @@
  */
 CUsbOtgWatcher* CUsbOtgWatcher::NewL(MUsbOtgObserver& aOwner, RUsbOtgDriver& aLdd, TUint& aOtgMessage)
 	{
-	LOG_STATIC_FUNC_ENTRY
+	OstTraceFunctionEntry0( CUSBOTGWATCHER_NEWL_ENTRY );
 
 	CUsbOtgWatcher* r = new (ELeave) CUsbOtgWatcher(aOwner, aLdd, aOtgMessage);
+	OstTraceFunctionExit0( CUSBOTGWATCHER_NEWL_EXIT );
 	return r;
 	}
 
@@ -649,8 +725,7 @@
  */
 CUsbOtgWatcher::~CUsbOtgWatcher()
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8(">CUsbOtgWatcher::~CUsbOtgWatcher (0x%08x)"), (TUint32) this);
+	OstTraceFunctionEntry1( CUSBOTGWATCHER_CUSBOTGWATCHER_DES_ENTRY, this );
 	Cancel();
 	}
 
@@ -666,8 +741,9 @@
 CUsbOtgWatcher::CUsbOtgWatcher(MUsbOtgObserver& aOwner, RUsbOtgDriver& aLdd, TUint& aOtgMessage)
 	: CActive(CActive::EPriorityStandard), iOwner(aOwner), iLdd(aLdd), iOtgMessage(aOtgMessage)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTGWATCHER_CUSBOTGWATCHER_CONS_ENTRY );
 	CActiveScheduler::Add(this);
+	OstTraceFunctionExit0( CUSBOTGWATCHER_CUSBOTGWATCHER_CONS_EXIT );
 	}
 
 /**
@@ -675,17 +751,19 @@
  */
 void CUsbOtgWatcher::RunL()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTGWATCHER_RUNL_ENTRY );
 	if (iStatus.Int() != KErrNone)
 		{
-		LOGTEXT2(_L8("CUsbOtgWatcher::RunL() - Error = %d"), iStatus.Int());
+		OstTrace1( TRACE_NORMAL, CUSBOTGWATCHER_RUNL, "CUsbOtgWatcher::RunL;Error=%d", iStatus.Int() );
+		OstTraceFunctionExit0( CUSBOTGWATCHER_RUNL_EXIT );
 		return;
 		}
 
-	LOGTEXT2(_L8("CUsbOtgWatcher::RunL() - Otg Message reported: %d"), iOtgMessage);
+	OstTrace1( TRACE_NORMAL, CUSBOTGWATCHER_RUNL_DUP1, "CUsbOtgWatcher::RunL;Otg Message reported: %d", iOtgMessage );
 	iOwner.NotifyMessage();
 
 	Post();
+	OstTraceFunctionExit0( CUSBOTGWATCHER_RUNL_EXIT_DUP1 );
 	}
 
 
@@ -694,8 +772,9 @@
  */
 void CUsbOtgWatcher::DoCancel()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTGWATCHER_DOCANCEL_ENTRY );
 	iLdd.CancelOtgMessageRequest();
+	OstTraceFunctionExit0( CUSBOTGWATCHER_DOCANCEL_EXIT );
 	}
 
 
@@ -704,8 +783,9 @@
  */
 void CUsbOtgWatcher::Start()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTGWATCHER_START_ENTRY );
 	Post();
+	OstTraceFunctionExit0( CUSBOTGWATCHER_START_EXIT );
 	}
 
 /**
@@ -713,11 +793,12 @@
  */
 void CUsbOtgWatcher::Post()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTGWATCHER_POST_ENTRY );
 
-	LOGTEXT(_L8("CUsbOtgWatcher::Post() - About to call QueueOtgMessageRequest"));
+	OstTrace0( TRACE_NORMAL, CUSBOTGWATCHER_POST, "CUsbOtgWatcher::Post - About to call QueueOtgMessageRequest" );
 	iLdd.QueueOtgMessageRequest((RUsbOtgDriver::TOtgMessage&)iOtgMessage, iStatus);
 	SetActive();
+	OstTraceFunctionExit0( CUSBOTGWATCHER_POST_EXIT );
 	}
 
 
@@ -747,7 +828,7 @@
  * Performs 2nd phase construction of the OTG object.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CREQUESTSESSIONWATCHER_CONSTRUCTL_ENTRY );
 
 	TInt err = RProperty::Define(KUsbRequestSessionProperty, RProperty::EInt, KAllowAllPolicy, KRequestSessionPolicy);
 	if ( err != KErrNone && err != KErrAlreadyExists )
@@ -762,13 +843,15 @@
 	User::LeaveIfError(iProp.Attach(KUidUsbManCategory, KUsbRequestSessionProperty));
 	iProp.Subscribe(iStatus);
 	SetActive();
+	OstTraceFunctionExit0( CREQUESTSESSIONWATCHER_CONSTRUCTL_EXIT );
 	}
 
 CRequestSessionWatcher::CRequestSessionWatcher(MUsbOtgObserver& aOwner)
 	: CActive(CActive::EPriorityStandard), iOwner(aOwner)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CREQUESTSESSIONWATCHER_CREQUESTSESSIONWATCHER_CONS_ENTRY );
 	CActiveScheduler::Add(this);
+	OstTraceFunctionExit0( CREQUESTSESSIONWATCHER_CREQUESTSESSIONWATCHER_CONS_EXIT );
 	}
 
 /**
@@ -776,8 +859,8 @@
  */
 void CRequestSessionWatcher::RunL()
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8(">>CRequestSessionWatcher::RunL [iStatus=%d]"), iStatus.Int());
+	OstTraceFunctionEntry0( CREQUESTSESSIONWATCHER_RUNL_ENTRY );
+	OstTrace1( TRACE_NORMAL, CREQUESTSESSIONWATCHER_RUNL, "CRequestSessionWatcher::RunL;iStatus=%d", iStatus.Int() );
 	RDebug::Printf(">>CRequestSessionWatcher::RunL [iStatus=%d]", iStatus.Int());
 	
 	iProp.Subscribe(iStatus);
@@ -789,7 +872,7 @@
 
 	iOwner.NotifyMessage(KUsbMessageRequestSession);
 	
-	LOGTEXT(_L8("<<CRequestSessionWatcher::RunL"));
+	OstTraceFunctionExit0( CREQUESTSESSIONWATCHER_RUNL_EXIT );
 	}
 
 
@@ -798,8 +881,9 @@
  */
 void CRequestSessionWatcher::DoCancel()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CREQUESTSESSIONWATCHER_DOCANCEL_ENTRY );
 	iProp.Cancel();
+	OstTraceFunctionExit0( CREQUESTSESSIONWATCHER_DOCANCEL_EXIT );
 	}
 
 //---------------------------- Connection Idle watcher class --------------------------- 
@@ -815,12 +899,13 @@
  */
 CUsbOtgConnectionIdleWatcher* CUsbOtgConnectionIdleWatcher::NewL(RUsbOtgDriver& aLdd)
 	{
-	LOG_STATIC_FUNC_ENTRY
+	OstTraceFunctionEntry0( CUSBOTGCONNECTIONIDLEWATCHER_NEWL_ENTRY );
 
 	CUsbOtgConnectionIdleWatcher* self = new (ELeave) CUsbOtgConnectionIdleWatcher(aLdd);
 	CleanupStack::PushL(self);
 	self->ConstructL();
 	CleanupStack::Pop(self);
+	OstTraceFunctionExit0( CUSBOTGCONNECTIONIDLEWATCHER_NEWL_EXIT );
 	return self;
 	}
 
@@ -834,9 +919,10 @@
  */
 CUsbOtgConnectionIdleWatcher::~CUsbOtgConnectionIdleWatcher()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTGCONNECTIONIDLEWATCHER_CUSBOTGCONNECTIONIDLEWATCHER_DES_ENTRY );
 	Cancel();
 	RProperty::Delete(KUsbOtgConnectionIdleProperty);
+	OstTraceFunctionExit0( CUSBOTGCONNECTIONIDLEWATCHER_CUSBOTGCONNECTIONIDLEWATCHER_DES_EXIT );
 	}
 
 /**
@@ -844,7 +930,7 @@
  */
 void CUsbOtgConnectionIdleWatcher::ConstructL()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTGCONNECTIONIDLEWATCHER_CONSTRUCTL_ENTRY );
 
 	TInt err = RProperty::Define(KUsbOtgConnectionIdleProperty, RProperty::EInt, KAllowAllPolicy, KNetworkControlPolicy);
 	if ( err != KErrNone && err != KErrAlreadyExists )
@@ -856,6 +942,7 @@
 	    {
 	    User::LeaveIfError(err);
 	    }
+	OstTraceFunctionExit0( CUSBOTGCONNECTIONIDLEWATCHER_CONSTRUCTL_EXIT );
 	}
 
 /**
@@ -869,7 +956,8 @@
 CUsbOtgConnectionIdleWatcher::CUsbOtgConnectionIdleWatcher(RUsbOtgDriver& aLdd)
 	: CUsbOtgBaseWatcher(aLdd)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTGCONNECTIONIDLEWATCHER_CUSBOTGCONNECTIONIDLEWATCHER_CONS_ENTRY );
+	OstTraceFunctionExit0( CUSBOTGCONNECTIONIDLEWATCHER_CUSBOTGCONNECTIONIDLEWATCHER_CONS_EXIT );
 	}
 
 /**
@@ -877,14 +965,20 @@
  */
 void CUsbOtgConnectionIdleWatcher::RunL()
 	{
-	LOG_FUNC
-	LOGTEXT2(_L8(">>CUsbOtgConnectionIdleWatcher::RunL [iStatus=%d]"), iStatus.Int());
-
-	LEAVEIFERRORL(iStatus.Int());
+	OstTraceFunctionEntry0( CUSBOTGCONNECTIONIDLEWATCHER_RUNL_ENTRY );
+	OstTrace1( TRACE_NORMAL, CUSBOTGCONNECTIONIDLEWATCHER_RUNL, 
+	        "CUsbOtgConnectionIdleWatcher::RunL;iStatus=%d", iStatus.Int() );
 	
+    TInt err = iStatus.Int();
+    if(err < 0)
+        {
+        OstTrace1( TRACE_NORMAL, CUSBOTGCONNECTIONIDLEWATCHER_RUNL_DUP1, "CUsbOtgConnectionIdleWatcher::RunL;iStatus.Int() with error=%d", err );
+        User::Leave(err);
+        }
+    
 	Post();
 
-	LOGTEXT(_L8("<<CUsbOtgConnectionIdleWatcher::RunL"));
+	OstTraceFunctionExit0( CUSBOTGCONNECTIONIDLEWATCHER_RUNL_EXIT );
 	}
 
 
@@ -893,8 +987,9 @@
  */
 void CUsbOtgConnectionIdleWatcher::DoCancel()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTGCONNECTIONIDLEWATCHER_DOCANCEL_ENTRY );
 	iLdd.CancelOtgConnectionNotification();
+	OstTraceFunctionExit0( CUSBOTGCONNECTIONIDLEWATCHER_DOCANCEL_EXIT );
 	}
 
 /**
@@ -902,26 +997,31 @@
  */
 void CUsbOtgConnectionIdleWatcher::Post()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBOTGCONNECTIONIDLEWATCHER_POST_ENTRY );
 
-	LOGTEXT(_L8("CUsbOtgConnectionIdleWatcher::Post() - About to call QueueOtgIdPinNotification"));
+	OstTrace0( TRACE_NORMAL, CUSBOTGCONNECTIONIDLEWATCHER_POST, 
+	        "CUsbOtgConnectionIdleWatcher::Post - About to call QueueOtgIdPinNotification" );
 	iLdd.QueueOtgConnectionNotification(iConnectionIdle, iStatus);
 	switch (iConnectionIdle)
 		{
 		case RUsbOtgDriver::EConnectionIdle:
 		case RUsbOtgDriver::EConnectionUnknown:
 			RProperty::Set(KUidUsbManCategory,KUsbOtgConnectionIdleProperty,ETrue);
-			LOGTEXT2(_L8(">>CUsbOtgConnectionIdleWatcher::Post [iConnectionIdle=%d] - property is set to 1"), iConnectionIdle);
+			OstTrace1( TRACE_NORMAL, CUSBOTGCONNECTIONIDLEWATCHER_POST_DUP1, 
+			        "CUsbOtgConnectionIdleWatcher::Post;[iConnectionIdle=%d] - property is set to 1", iConnectionIdle );
 			break;
 		case RUsbOtgDriver::EConnectionBusy:
 			RProperty::Set(KUidUsbManCategory,KUsbOtgConnectionIdleProperty,EFalse);
-			LOGTEXT2(_L8(">>CUsbOtgConnectionIdleWatcher::Post [iConnectionIdle=%d] - property is set to 0"), iConnectionIdle);
+			OstTrace1( TRACE_NORMAL, CUSBOTGCONNECTIONIDLEWATCHER_POST_DUP2, 
+			        "CUsbOtgConnectionIdleWatcher::Post;[iConnectionIdle=%d] - property is set to 0", iConnectionIdle );
 			break;
 		default:
-			LOGTEXT2(_L8(">>CUsbOtgConnectionIdleWatcher::Post [iConnectionIdle=%d] is unrecognized, re-request QueueOtgIdPinNotification"), iConnectionIdle);
+			OstTrace1( TRACE_NORMAL, CUSBOTGCONNECTIONIDLEWATCHER_POST_DUP3, 
+			        "CUsbOtgConnectionIdleWatcher::Post;[iConnectionIdle=%d] is unrecognized, re-request QueueOtgIdPinNotification", iConnectionIdle );
 			break;
 		}
 	SetActive();
+	OstTraceFunctionExit0( CUSBOTGCONNECTIONIDLEWATCHER_POST_EXIT );
 	}
 
 
--- a/usbmgmt/usbmgr/usbman/server/SRC/usbman.rls	Thu Jul 15 20:42:20 2010 +0300
+++ /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"
--- a/usbmgmt/usbmgr/usbman/server/SRC/usbman.rss	Thu Jul 15 20:42:20 2010 +0300
+++ /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 <badef.rh>
-#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
-
-		};
-	}
-			
--- a/usbmgmt/usbmgr/usbman/server/SRC/usbman_01.rls	Thu Jul 15 20:42:20 2010 +0300
+++ /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)"
--- a/usbmgmt/usbmgr/usbman/server/SRC/usbman_02.rls	Thu Jul 15 20:42:20 2010 +0300
+++ /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)"
-
--- a/usbmgmt/usbmgr/usbman/server/SRC/usbman_03.rls	Thu Jul 15 20:42:20 2010 +0300
+++ /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)"
--- a/usbmgmt/usbmgr/usbman/server/SRC/usbman_10.rls	Thu Jul 15 20:42:20 2010 +0300
+++ /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)"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/usbman/server/SRC/usbmancenrepmanager.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,541 @@
+// 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 <centralrepository.h>
+#include <usb/usblogger.h>
+#ifdef SYMBIAN_FEATURE_MANAGER
+    #include <featureuids.h>
+    #include <featdiscovery.h>
+#endif
+#include "usbmanprivatecrkeys.h"
+#include "UsbSettings.h"
+#include "CPersonality.h"
+#include "usbmancenrepmanager.h"
+#include "CUsbDevice.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "usbmancenrepmanagerTraces.h"
+#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 )
+	{
+    OstTraceFunctionEntry0( CUSBMANCENREPMANAGER_CUSBMANCENREPMANAGER_CONS_ENTRY );
+	OstTraceFunctionExit0( CUSBMANCENREPMANAGER_CUSBMANCENREPMANAGER_CONS_EXIT );
+	}
+
+// ---------------------------------------------------------------------------
+// The first phase construction   
+// ---------------------------------------------------------------------------
+//
+CUsbManCenRepManager* CUsbManCenRepManager::NewL(CUsbDevice& aUsbDevice)
+    {
+    OstTraceFunctionEntry0( CUSBMANCENREPMANAGER_NEWL_ENTRY );
+    CUsbManCenRepManager* self = new (ELeave) CUsbManCenRepManager(aUsbDevice);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    OstTraceFunctionExit0( CUSBMANCENREPMANAGER_NEWL_EXIT );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// The second phase construction   
+// ---------------------------------------------------------------------------
+//
+void CUsbManCenRepManager::ConstructL()
+    {
+    OstTraceFunctionEntry0( CUSBMANCENREPMANAGER_CONSTRUCTL_ENTRY );
+    // Open the Central Repository
+    iRepository = CRepository::NewL( KCRUidUSBManagerConfiguration );
+    CheckSignatureL();
+    OstTraceFunctionExit0( CUSBMANCENREPMANAGER_CONSTRUCTL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------
+// Deconstruction   
+// ---------------------------------------------------------------------------
+//
+CUsbManCenRepManager::~CUsbManCenRepManager()
+	{
+    OstTraceFunctionEntry0( CUSBMANCENREPMANAGER_CUSBMANCENREPMANAGER_DES_ENTRY );
+    delete iRepository;
+	OstTraceFunctionExit0( CUSBMANCENREPMANAGER_CUSBMANCENREPMANAGER_DES_EXIT );
+	}
+
+// ---------------------------------------------------------------------------
+// Read specific Key whose value type is String   
+// ---------------------------------------------------------------------------
+//
+HBufC* CUsbManCenRepManager::ReadStringKeyLC( TUint32 aKeyId )
+	{
+    OstTraceFunctionEntry0( CUSBMANCENREPMANAGER_READSTRINGKEYLC_ENTRY );
+    HBufC* keyBuf = HBufC::NewLC( NCentralRepositoryConstants::KMaxUnicodeStringLength );
+    TPtr key = keyBuf->Des();
+
+    TInt err = iRepository->Get( aKeyId, key );
+    LEAVEIFERRORL( err, OstTrace1( TRACE_NORMAL, CUSBMANCENREPMANAGER_READSTRINGKEYLC, "CUsbManCenRepManager::ReadStringKeyLC;Leave err=%d", err ););
+	OstTraceExt2( TRACE_NORMAL, CUSBMANCENREPMANAGER_READSTRINGKEYLC_DUP1, "CUsbManCenRepManager::ReadStringKeyLC;aKeyId=%x;key=%S", aKeyId, key );
+
+    OstTraceFunctionExit0( CUSBMANCENREPMANAGER_READSTRINGKEYLC_EXIT );
+    return keyBuf;
+    }
+
+// ---------------------------------------------------------------------------
+// Read specific Key whose value type is TInt   
+// ---------------------------------------------------------------------------
+//
+TInt CUsbManCenRepManager::ReadKeyL( TUint32 aKeyId )
+    {
+    OstTraceFunctionEntry0( CUSBMANCENREPMANAGER_READKEYL_ENTRY );
+    TInt key;
+    
+    TInt err = iRepository->Get( aKeyId, key );
+    LEAVEIFERRORL( err, OstTrace1( TRACE_NORMAL, CUSBMANCENREPMANAGER_READKEYL, "CUsbManCenRepManager::ReadKeyL;Leave err=%d", err ); );
+    OstTraceExt2( TRACE_NORMAL, CUSBMANCENREPMANAGER_READKEYL_DUP1, "CUsbManCenRepManager::ReadKeyL;LocSets: ReadKeyL id: 0x%x, val: 0x%x", aKeyId, (TInt32)key );
+
+    OstTraceFunctionExit0( CUSBMANCENREPMANAGER_READKEYL_EXIT );
+    return key;
+    }
+
+// ---------------------------------------------------------------------------
+// Check wheather cenrep's version is supported by cenrep manager 
+// ---------------------------------------------------------------------------
+//
+void CUsbManCenRepManager::CheckSignatureL()
+    {
+    OstTraceFunctionEntry0( CUSBMANCENREPMANAGER_CHECKSIGNATUREL_ENTRY );
+    iSignature = ReadKeyL( KUsbManConfigSign );
+    
+    if ( iSignature < TUsbManagerSupportedVersionMin ||
+            iSignature > TUsbManagerSupportedVersionMax )
+        {
+        OstTrace1( TRACE_NORMAL, CUSBMANCENREPMANAGER_CHECKSIGNATUREL, "CUsbManCenRepManager::CheckSignatureL;Leave reason=%d", KErrNotSupported );
+        }    
+    OstTraceFunctionExit0( CUSBMANCENREPMANAGER_CHECKSIGNATUREL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------
+// Read Device configuration table 
+// ---------------------------------------------------------------------------
+//
+void CUsbManCenRepManager::ReadDeviceConfigurationL(CUsbDevice::TUsbDeviceConfiguration& aDeviceConfig)
+    {
+    OstTraceFunctionEntry0( CUSBMANCENREPMANAGER_READDEVICECONFIGURATIONL_ENTRY );
+    //Only support version four right now.
+    if(TUsbManagerSupportedVersionFour != iSignature)
+        {
+        OstTrace1( TRACE_NORMAL, CUSBMANCENREPMANAGER_READDEVICECONFIGURATIONL, "CUsbManCenRepManager::ReadDeviceConfigurationL;Panic error=%d", ECenRepConfigError );
+        __ASSERT_DEBUG( EFalse, User::Panic( KUsbCenRepPanic, ECenRepConfigError ) );
+        }
+    
+    
+    //Shall only have on device configuration setting.
+    TUint32 devConfigCount = ReadKeyL( KUsbManDeviceCountIndexKey );
+    if(devConfigCount != 1)
+        {
+        OstTrace1( TRACE_NORMAL, CUSBMANCENREPMANAGER_READDEVICECONFIGURATIONL_DUP1, "CUsbManCenRepManager::ReadDeviceConfigurationL;Panic error=%d", ECenRepConfigError );
+        __ASSERT_DEBUG( EFalse, User::Panic( KUsbCenRepPanic, ECenRepConfigError ) );
+        }
+    
+        
+    RArray<TUint32> keyArray;
+    CleanupClosePushL( keyArray );
+    TInt err = iRepository->FindL( KUsbManDevicePartialKey, KUsbManConfigKeyMask, keyArray );
+    LEAVEIFERRORL( err, OstTrace1( TRACE_NORMAL, CUSBMANCENREPMANAGER_READDEVICECONFIGURATIONL_DUP2, "CUsbManCenRepManager::ReadDeviceConfigurationL;Leave err=%d", err ); );
+    
+    TInt keyCount = keyArray.Count();
+    OstTrace1( TRACE_NORMAL, CUSBMANCENREPMANAGER_READDEVICECONFIGURATIONL_DUP3, "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 );
+        OstTrace1( TRACE_NORMAL, CUSBMANCENREPMANAGER_READDEVICECONFIGURATIONL_DUP4, "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
+            {
+            OstTrace1( TRACE_FATAL, CUSBMANCENREPMANAGER_READDEVICECONFIGURATIONL_DUP5, "CUsbManCenRepManager::ReadDeviceConfigurationL;panic error=%d", ECenRepConfigError );
+            User::Panic( KUsbCenRepPanic, ECenRepConfigError );
+            }
+        }
+    CleanupStack::PopAndDestroy( &keyArray );  
+    OstTraceFunctionExit0( CUSBMANCENREPMANAGER_READDEVICECONFIGURATIONL_EXIT );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Read personality table 
+// ---------------------------------------------------------------------------
+//
+void CUsbManCenRepManager::ReadPersonalitiesL(RPointerArray<CPersonality>& aPersonalities)
+	{
+	OstTraceFunctionEntry0( CUSBMANCENREPMANAGER_READPERSONALITIESL_ENTRY );
+    
+	//Only support version four right now.
+	if(TUsbManagerSupportedVersionFour != iSignature)
+	    {
+        OstTrace1( TRACE_FATAL, CUSBMANCENREPMANAGER_READPERSONALITIESL, "CUsbManCenRepManager::ReadPersonalitiesL;ECenRepConfigError=%d", ECenRepConfigError );
+        __ASSERT_DEBUG( EFalse, User::Panic( KUsbCenRepPanic, ECenRepConfigError ) );
+	    }
+
+	// Get the personality count.
+	TUint32 personalityCount = ReadKeyL( KUsbManDevicePersonalitiesCountIndexKey );
+	OstTrace1( TRACE_NORMAL, CUSBMANCENREPMANAGER_READPERSONALITIESL_DUP3, "CUsbManCenRepManager::ReadPersonalitiesL;personalityCount=%d", personalityCount );
+	
+	RArray<TUint32> 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 );
+        TInt err = iRepository->FindL( devicePersonalitiesKey, KUsbManConfigKeyMask, keyArray );
+        LEAVEIFERRORL( err, OstTrace1( TRACE_NORMAL, CUSBMANCENREPMANAGER_READPERSONALITIESL_DUP1, "CUsbManCenRepManager::ReadPersonalitiesL;Leave err=%d", err ); );
+        
+        TInt keyCount = keyArray.Count();
+        OstTrace1( TRACE_NORMAL, DUP2_CUSBMANCENREPMANAGER_READPERSONALITIESL_DUP2, "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);
+            OstTrace1( TRACE_NORMAL, CUSBMANCENREPMANAGER_READPERSONALITIESL_DUP4, "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:
+                    OstTrace1( TRACE_FATAL, CUSBMANCENREPMANAGER_READPERSONALITIESL_DUP5, "CUsbManCenRepManager::ReadPersonalitiesL;Panic error=%d", ECenRepConfigError );
+                    User::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<CPersonalityConfigurations>& personalityConfigs = personality->PersonalityConfigs();
+            CPersonalityConfigurations *personalityConfigurations = personalityConfigs[configurationIdx];
+            TInt classesCount = personalityConfigurations->Classes().Count();
+            if(0 != classesCount)
+                {
+                isPersonalitySupport = ETrue;
+                break;
+                }
+            }
+       
+        if(isPersonalitySupport)
+            {
+            OstTrace1( TRACE_NORMAL, CUSBMANCENREPMANAGER_READPERSONALITIESL_DUP6, "CUsbManCenRepManager::ReadPersonalitiesL; Personality ID: %d is supported", personality->PersonalityId() );
+            aPersonalities.Append( personality );
+            CleanupStack::Pop( personality );
+            }
+        else
+            {
+            OstTrace1( TRACE_NORMAL, CUSBMANCENREPMANAGER_READPERSONALITIESL_DUP7, "CUsbManCenRepManager::ReadPersonalitiesL;Personality ID: %d is not supported", personality->PersonalityId() );
+            CleanupStack::PopAndDestroy(personality);
+            }
+        }
+    CleanupStack::PopAndDestroy( &keyArray );  	
+    OstTraceFunctionExit0( CUSBMANCENREPMANAGER_READPERSONALITIESL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------
+// Read configuration table for specific personality
+// ---------------------------------------------------------------------------
+//
+void CUsbManCenRepManager::ReadConfigurationsForPersonalityL(TInt aPersonalityId, CPersonality& aPersonality)
+    {
+    OstTraceFunctionEntry0( CUSBMANCENREPMANAGER_READCONFIGURATIONSFORPERSONALITYL_ENTRY );
+    RArray<TUint32> configArray;
+    CleanupClosePushL(configArray);
+ 
+    //Only support version four right now.
+    if(TUsbManagerSupportedVersionFour != iSignature)
+        {
+        OstTrace1( TRACE_FATAL, CUSBMANCENREPMANAGER_READCONFIGURATIONSFORPERSONALITYL, "CUsbManCenRepManager::ReadConfigurationsForPersonalityL;Panic error=%d", ECenRepConfigError );
+        __ASSERT_DEBUG( EFalse, User::Panic( KUsbCenRepPanic, ECenRepConfigError ) );
+        }
+
+    TInt err = iRepository->FindEqL( KUsbManDeviceConfigurationsPartialKey, KUsbManConfigFirstEntryMask, aPersonalityId, configArray );
+    LEAVEIFERRORL( err, OstTrace1( TRACE_NORMAL, CUSBMANCENREPMANAGER_READCONFIGURATIONSFORPERSONALITYL_DUP1, "CUsbManCenRepManager::ReadConfigurationsForPersonalityL;Leave err=%d", err ); );
+    
+    // Get the configuration count.
+    TUint32 configCount = configArray.Count();
+    TUint32 totalConfigCount = ReadKeyL( KUsbManDeviceConfigurationsCountIndexKey );
+
+    OstTraceExt3( TRACE_NORMAL, CUSBMANCENREPMANAGER_READCONFIGURATIONSFORPERSONALITYL_DUP2, 
+            "CUsbManCenRepManager::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;
+            OstTraceExt3( TRACE_NORMAL, CUSBMANCENREPMANAGER_READCONFIGURATIONSFORPERSONALITYL_DUP3, "CUsbManCenRepManager::ReadConfigurationsForPersonalityL;fieldId=%d;configIdx=%d;keyIdx=%d", fieldId, configIdx, keyIdx );
+            
+            if(KUsbManDeviceConfigurationsPersonalityIdKey == fieldId)
+                {
+                TRAPD( err, keyValue = ReadKeyL( key + keyIdx ) );
+                if( err == KErrNone )
+                    {
+                    if(keyValue != aPersonalityId)
+                        {
+                        OstTrace1( TRACE_FATAL, CUSBMANCENREPMANAGER_READCONFIGURATIONSFORPERSONALITYL_DUP4, "CUsbManCenRepManager::ReadConfigurationsForPersonalityL;Panic error=%d", ECenRepConfigError );
+                        __ASSERT_DEBUG( EFalse, User::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<TUint> 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
+                {
+                OstTrace1( TRACE_FATAL, CUSBMANCENREPMANAGER_READCONFIGURATIONSFORPERSONALITYL_DUP5, "CUsbManCenRepManager::ReadConfigurationsForPersonalityL;Panic error=%d", ECenRepConfigError );
+                User::Panic( KUsbCenRepPanic, ECenRepConfigError );
+                }
+            }
+        aPersonality.AppendPersonalityConfigsL( config );
+
+        CleanupStack::Pop( config );
+        }
+
+    CleanupStack::PopAndDestroy( &configArray );     
+    OstTraceFunctionExit0( CUSBMANCENREPMANAGER_READCONFIGURATIONSFORPERSONALITYL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------
+// Check the class belonging to a personality configurable or not.
+// ---------------------------------------------------------------------------
+//
+TBool CUsbManCenRepManager::IsClassConfigurableL(TUint aClassId, TInt& aFeatureId)
+    {
+    OstTraceFunctionEntry0( CUSBMANCENREPMANAGER_ISCLASSCONFIGURABLEL_ENTRY );
+    TBool classConfigurable = EFalse;
+    RArray<TUint32> keyArray;
+    CleanupClosePushL(keyArray);
+    
+    TInt err = iRepository->FindEqL( KUsbManDeviceConfigurableClassesPartialKey, KUsbManConfigFirstEntryMask, (TInt)aClassId, keyArray );
+    OstTraceExt2( TRACE_NORMAL, CUSBMANCENREPMANAGER_ISCLASSCONFIGURABLEL, "CUsbManCenRepManager::IsClassConfigurableL;aClassId=0x%x;err=%d", aClassId, err );
+    switch ( err )
+        {
+        case KErrNotFound:
+            break;
+        case KErrNone:
+            {
+#ifdef _DEBUG
+            if(keyArray.Count() != 1)
+                {
+                OstTrace1( TRACE_FATAL, DUP1_CUSBMANCENREPMANAGER_ISCLASSCONFIGURABLEL_DUP1, "CUsbManCenRepManager::IsClassConfigurableL;panic error=%d", ECenRepConfigError );
+                User::Panic( KUsbCenRepPanic, ECenRepConfigError );
+                }
+#endif
+            // The array size always is 1, so here using 0 as index.
+            aFeatureId = ReadKeyL( keyArray[0] | KUsbManDeviceConfigurableClassesFeatureIdKey );
+            classConfigurable = ETrue;
+            break;
+            }
+        default:
+            OstTrace1( TRACE_NORMAL, CUSBMANCENREPMANAGER_ISCLASSCONFIGURABLEL_DUP2, "CUsbManCenRepManager::IsClassConfigurableL;Leave err=%d", err );
+            User::Leave( err );
+            break;
+        }    
+    
+    CleanupStack::PopAndDestroy( &keyArray );     
+    OstTraceFunctionExit0( CUSBMANCENREPMANAGER_ISCLASSCONFIGURABLEL_EXIT );
+    return classConfigurable;
+    }
+
+// ---------------------------------------------------------------------------
+// Check the class belonging to a personality support or not.
+// ---------------------------------------------------------------------------
+//
+TBool CUsbManCenRepManager::IsFeatureSupportedL(TInt aFeatureId)
+    {
+    OstTraceFunctionEntry0( CUSBMANCENREPMANAGER_ISFEATURESUPPORTEDL_ENTRY );
+#ifdef SYMBIAN_FEATURE_MANAGER
+    if(CFeatureDiscovery::IsFeatureSupportedL(TUid::Uid(aFeatureId)))
+        {
+        OstTrace1( TRACE_NORMAL, DUP1_CUSBMANCENREPMANAGER_ISFEATURESUPPORTEDL_DUP1, "CUsbManCenRepManager::IsFeatureSupportedL;featureId = 0x%x supported", aFeatureId );
+        OstTraceFunctionExit0( CUSBMANCENREPMANAGER_ISFEATURESUPPORTEDL_EXIT );
+        return ETrue;
+        }
+    else
+        {
+        OstTrace1( TRACE_NORMAL, CUSBMANCENREPMANAGER_ISFEATURESUPPORTEDL_DUP2, "CUsbManCenRepManager::IsFeatureSupportedL;featureId = 0x%x not supported", aFeatureId );
+        OstTraceFunctionExit0( CUSBMANCENREPMANAGER_ISFEATURESUPPORTEDL_EXIT_DUP1 );
+        return EFalse;
+        }
+#else
+    OstTrace1( TRACE_FATAL, CUSBMANCENREPMANAGER_ISFEATURESUPPORTEDL, "CUsbManCenRepManager::IsFeatureSupportedL;panic error code=%d", ECenRepFeatureManagerError );
+    User::Panic( KUsbCenRepPanic, ECenRepFeatureManagerError )
+#endif    
+    }
--- a/usbmgmt/usbmgr/usbman/server/SRC/usbmanlubbockobex.rss	Thu Jul 15 20:42:20 2010 +0300
+++ /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 <badef.rh>
-#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;
-			}
-
-		};
-	}
-
-
--- a/usbmgmt/usbmgr/usbman/server/SRC/usbmanmtp.rss	Thu Jul 15 20:42:20 2010 +0300
+++ /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 <badef.rh>
-#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
-
-		};
-	}
-			
--- a/usbmgmt/usbmgr/usbman/server/SRC/usbmanmtprndis.rss	Thu Jul 15 20:42:20 2010 +0300
+++ /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 <badef.rh>
-#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
-
-		};
-	}
-			
--- a/usbmgmt/usbmgr/usbman/server/SRC/usbmanrndis.rss	Thu Jul 15 20:42:20 2010 +0300
+++ /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 <badef.rh>
-#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
-
-		};
-	}
-			
Binary file usbmgmt/usbmgr/usbman/server/conf/usbmanager_101fe1db.crml has changed
--- a/usbmgmt/usbmgr/usbman/server/data/demo_mcci_usbman.rh	Thu Jul 15 20:42:20 2010 +0300
+++ /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";
-	}
--- a/usbmgmt/usbmgr/usbman/server/group/BLD.INF	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/usbman/server/group/BLD.INF	Tue Aug 31 17:01:47 2010 +0300
@@ -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
 
--- a/usbmgmt/usbmgr/usbman/server/group/usbsvrbase.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/usbman/server/group/usbsvrbase.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -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,14 @@
 source			CUsbDeviceStateWatcher.cpp
 source			UsbUtils.cpp
 source			CPersonality.cpp
+source          usbmancenrepmanager.cpp
 
 userinclude		../INC
 userinclude		../public
-userinclude		../../../host/fdf/production/client/public
+userinclude		../../../host/fdf/production/client/public 
+userinclude		../traces
 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 +52,8 @@
 library			bafl.lib
 library			usbmanextensionplugin.lib
 library			sysutil.lib
+library         centralrepository.lib 
 
-#include <usb/usblogger.mmh>
+#ifdef SYMBIAN_FEATURE_MANAGER
+library         featdiscovery.lib
+#endif
--- a/usbmgmt/usbmgr/usbman/server/public/rusb.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgr/usbman/server/public/rusb.h	Tue Aug 31 17:01:47 2010 +0300
@@ -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
 	};
 
--- a/usbmgmt/usbmgr/usbman/server/public/usbman.rh	Thu Jul 15 20:42:20 2010 +0300
+++ /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
-	}	 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/usbman/server/traces/OstTraceDefinitions.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,7 @@
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <opensystemtrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/usbman/server/traces/fixed_id.definitions	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,1117 @@
+#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt.
+[GROUP]TRACE_DUMP=0x89
+[GROUP]TRACE_FATAL=0x81
+[GROUP]TRACE_FLOW=0x8a
+[GROUP]TRACE_NORMAL=0x86
+[TRACE]TRACE_DUMP[0x89]_CUSBDEVICE_PRINTDESCRIPTOR=0x2
+[TRACE]TRACE_DUMP[0x89]_CUSBDEVICE_PRINTDESCRIPTOR_DUP1=0x3
+[TRACE]TRACE_DUMP[0x89]_CUSBDEVICE_PRINTDESCRIPTOR_DUP10=0xc
+[TRACE]TRACE_DUMP[0x89]_CUSBDEVICE_PRINTDESCRIPTOR_DUP11=0xd
+[TRACE]TRACE_DUMP[0x89]_CUSBDEVICE_PRINTDESCRIPTOR_DUP12=0xe
+[TRACE]TRACE_DUMP[0x89]_CUSBDEVICE_PRINTDESCRIPTOR_DUP2=0x4
+[TRACE]TRACE_DUMP[0x89]_CUSBDEVICE_PRINTDESCRIPTOR_DUP3=0x5
+[TRACE]TRACE_DUMP[0x89]_CUSBDEVICE_PRINTDESCRIPTOR_DUP4=0x6
+[TRACE]TRACE_DUMP[0x89]_CUSBDEVICE_PRINTDESCRIPTOR_DUP5=0x7
+[TRACE]TRACE_DUMP[0x89]_CUSBDEVICE_PRINTDESCRIPTOR_DUP6=0x8
+[TRACE]TRACE_DUMP[0x89]_CUSBDEVICE_PRINTDESCRIPTOR_DUP7=0x9
+[TRACE]TRACE_DUMP[0x89]_CUSBDEVICE_PRINTDESCRIPTOR_DUP8=0xa
+[TRACE]TRACE_DUMP[0x89]_CUSBDEVICE_PRINTDESCRIPTOR_DUP9=0xb
+[TRACE]TRACE_FATAL[0x81]_CPERSONALITY_CLASSSUPPORTED=0x75
+[TRACE]TRACE_FATAL[0x81]_CPERSONALITY_SUPPORTEDCLASSES=0x74
+[TRACE]TRACE_FATAL[0x81]_CUSBDEVICE_CONVERTUIDSL=0x52
+[TRACE]TRACE_FATAL[0x81]_CUSBDEVICE_DOCANCEL=0x2
+[TRACE]TRACE_FATAL[0x81]_CUSBDEVICE_RUNERROR_DUP1=0x51
+[TRACE]TRACE_FATAL[0x81]_CUSBDEVICE_RUNL_DUP5=0x1
+[TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_CONSTRUCTL=0x76
+[TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_DOCANCEL=0x89
+[TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_DOCANCEL_DUP1=0x8a
+[TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_DOCANCEL_DUP2=0x8b
+[TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_DOCANCEL_DUP3=0x8c
+[TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_DOCANCEL_DUP4=0x8d
+[TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP2=0x77
+[TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP4=0x78
+[TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP6=0x79
+[TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP8=0x7a
+[TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP7=0x7b
+[TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_RUNERROR=0x8e
+[TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_RUNL_DUP1=0x84
+[TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_RUNL_DUP2=0x85
+[TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_RUNL_DUP3=0x86
+[TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_RUNL_DUP4=0x87
+[TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_RUNL_DUP5=0x88
+[TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_START=0x7c
+[TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_START_DUP1=0x7d
+[TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_START_DUP2=0x7e
+[TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_START_DUP3=0x7f
+[TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_STOP=0x80
+[TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_STOP_DUP1=0x81
+[TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_STOP_DUP2=0x82
+[TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_STOP_DUP3=0x83
+[TRACE]TRACE_FATAL[0x81]_CUSBMANCENREPMANAGER_ISFEATURESUPPORTEDL=0x6c
+[TRACE]TRACE_FATAL[0x81]_CUSBMANCENREPMANAGER_READCONFIGURATIONSFORPERSONALITYL=0x70
+[TRACE]TRACE_FATAL[0x81]_CUSBMANCENREPMANAGER_READCONFIGURATIONSFORPERSONALITYL_DUP4=0x71
+[TRACE]TRACE_FATAL[0x81]_CUSBMANCENREPMANAGER_READCONFIGURATIONSFORPERSONALITYL_DUP5=0x72
+[TRACE]TRACE_FATAL[0x81]_CUSBMANCENREPMANAGER_READDEVICECONFIGURATIONL_DUP5=0x6d
+[TRACE]TRACE_FATAL[0x81]_CUSBMANCENREPMANAGER_READPERSONALITIESL=0x6e
+[TRACE]TRACE_FATAL[0x81]_CUSBMANCENREPMANAGER_READPERSONALITIESL_DUP5=0x6f
+[TRACE]TRACE_FATAL[0x81]_CUSBSERVER_DECREMENTSESSIONCOUNT_DUP1=0x1d
+[TRACE]TRACE_FATAL[0x81]_CUSBSERVER_INCREMENTSESSIONCOUNT_DUP1=0x1c
+[TRACE]TRACE_FATAL[0x81]_CUSBSERVER_LAUNCHSHUTDOWNTIMERIFNOSESSIONS=0x1e
+[TRACE]TRACE_FATAL[0x81]_DUP1_CUSBMANCENREPMANAGER_ISCLASSCONFIGURABLEL_DUP1=0x73
+[TRACE]TRACE_FLOW[0x8A]_CINIFILE_CINIFILE_CONS_ENTRY=0x629
+[TRACE]TRACE_FLOW[0x8A]_CINIFILE_NEWL_TDESC_ENTRY=0x62a
+[TRACE]TRACE_FLOW[0x8A]_CINIFILE_NEWL_TDESC_EXIT=0x62b
+[TRACE]TRACE_FLOW[0x8A]_CINIFILE_NEWL_TDESC_TDESC_ENTRY=0x62c
+[TRACE]TRACE_FLOW[0x8A]_CINIFILE_NEWL_TDESC_TDESC_EXIT=0x62d
+[TRACE]TRACE_FLOW[0x8A]_CPERSONALITYCONFIGURATIONS_CPERSONALITYCONFIGURATIONS_DES_ENTRY=0x623
+[TRACE]TRACE_FLOW[0x8A]_CPERSONALITYCONFIGURATIONS_CPERSONALITYCONFIGURATIONS_DES_EXIT=0x624
+[TRACE]TRACE_FLOW[0x8A]_CPERSONALITY_CONSTRUCTL_ENTRY=0x3
+[TRACE]TRACE_FLOW[0x8A]_CPERSONALITY_CONSTRUCTL_EXIT=0x4
+[TRACE]TRACE_FLOW[0x8A]_CPERSONALITY_CPERSONALITY_DES_ENTRY=0x454
+[TRACE]TRACE_FLOW[0x8A]_CPERSONALITY_CPERSONALITY_DES_EXIT=0x455
+[TRACE]TRACE_FLOW[0x8A]_CPERSONALITY_NEWL_ENTRY=0x1
+[TRACE]TRACE_FLOW[0x8A]_CPERSONALITY_NEWL_EXIT=0x2
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICESTATEWATCHER_DOCANCEL_ENTRY=0x105
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICESTATEWATCHER_DOCANCEL_EXIT=0x106
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICESTATEWATCHER_NEWL_ENTRY=0x103
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICESTATEWATCHER_NEWL_EXIT=0x104
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICESTATEWATCHER_START_ENTRY=0x107
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICESTATEWATCHER_START_EXIT=0x108
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_ADDCLASSCONTROLLERL_ENTRY=0x12b
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_ADDCLASSCONTROLLERL_EXIT=0x12c
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_BUSENUMERATIONCOMPLETED_ENTRY=0x139
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_BUSENUMERATIONCOMPLETED_EXIT=0x13a
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_CONSTRUCTL_ENTRY=0x124
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_CONSTRUCTL_EXIT=0x125
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_CONVERTUIDSL_ENTRY=0x625
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_CONVERTUIDSL_EXIT=0x626
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_CREATECLASSCONTROLLERSL_ENTRY=0x21a
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_CURRENTPERSONALITYID_ENTRY=0x207
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_CUSBDEVICE_DES_ENTRY=0x366
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_CUSBDEVICE_DES_EXIT=0x367
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_DEREGISTEROBSERVER_ENTRY=0x12f
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_DEREGISTEROBSERVER_EXIT=0x130
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_DOCANCEL_ENTRY=0x143
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_DOCANCEL_EXIT=0x144
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_ENUMERATECLASSCONTROLLERSL_ENTRY=0x129
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_ENUMERATECLASSCONTROLLERSL_EXIT=0x12a
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_GETPERSONALITY_ENTRY=0x209
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_GETPERSONALITY_EXIT=0x20a
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_GETPERSONALITY_EXIT_DUP1=0x368
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_INSTANTIATEEXTENSIONPLUGINSL=0x127
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_INSTANTIATEEXTENSIONPLUGINSL_ENTRY=0x126
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_INSTANTIATEEXTENSIONPLUGINSL_EXIT=0x128
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_LOADFALLBACKCLASSCONTROLLERSL_ENTRY=0x212
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_LOADFALLBACKCLASSCONTROLLERSL_EXIT=0x213
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_NEWL_ENTRY=0x120
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_NEWL_EXIT=0x121
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_PERSONALITIES_ENTRY=0x208
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_POWERUPANDCONNECT_ENTRY=0x13f
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_POWERUPANDCONNECT_EXIT=0x140
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_READPERSONALITIESL_ENTRY=0x627
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_READPERSONALITIESL_EXIT=0x628
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_REGISTEROBSERVERL_ENTRY=0x12d
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_REGISTEROBSERVERL_EXIT=0x12e
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_RUNL_ENTRY=0x141
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_RUNL_EXIT=0x142
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_SELECTCLASSCONTROLLERSL_ENTRY=0x218
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_SELECTCLASSCONTROLLERSL_EXIT=0x219
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_SETCURRENTPERSONALITYL_ENTRY=0x20c
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_SETCURRENTPERSONALITYL_EXIT=0x20d
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_SETDEFAULTPERSONALITYL_ENTRY=0x210
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_SETDEFAULTPERSONALITYL_EXIT=0x211
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_SETDEVICEDESCRIPTORL_ENTRY=0x1fc
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_SETDEVICEDESCRIPTORL_EXIT=0x1fd
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_SETDEVICESTATE_ENTRY=0x137
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_SETDEVICESTATE_EXIT=0x138
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_SETSERVICESTATE_ENTRY=0x135
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_SETSERVICESTATE_EXIT=0x136
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_SETUSBDEVICESETTINGSFROMPERSONALITYL_ENTRY=0x203
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_STARTCURRENTCLASSCONTROLLER_ENTRY=0x13b
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_STARTCURRENTCLASSCONTROLLER_EXIT=0x13c
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_STARTL_ENTRY=0x131
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_STARTL_EXIT=0x132
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_STOPCURRENTCLASSCONTROLLER_ENTRY=0x13d
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_STOPCURRENTCLASSCONTROLLER_EXIT=0x13e
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_STOP_ENTRY=0x133
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_STOP_EXIT=0x134
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_TRYSTARTL_ENTRY=0x205
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_TRYSTARTL_EXIT=0x206
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_UCCNERROR_ENTRY=0x146
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_UCCNERROR_EXIT=0x147
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_UCCNGETCLASSCONTROLLERITERATORL_ENTRY=0x145
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_VALIDATEPERSONALITIESL_ENTRY=0x20e
+[TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_VALIDATEPERSONALITIESL_EXIT=0x20f
+[TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_DOCANCEL_ENTRY=0x63e
+[TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_DOCANCEL_EXIT=0x63f
+[TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_DOGETCONFIGL_ENTRY=0x634
+[TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_DOGETCONFIGL_EXIT=0x635
+[TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_ENTRY=0x632
+[TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_EXIT=0x633
+[TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_GETCONFIG_ENTRY=0x636
+[TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_GETCONFIG_EXIT=0x637
+[TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_NEWL_MUSBCLASSCONTROLLERNOTIFY_TUINT_ENTRY=0x62e
+[TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_NEWL_MUSBCLASSCONTROLLERNOTIFY_TUINT_EXIT=0x62f
+[TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_NEWL_MUSBCLASSCONTROLLERNOTIFY_TUINT_TINT_ENTRY=0x630
+[TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_NEWL_MUSBCLASSCONTROLLERNOTIFY_TUINT_TINT_EXIT=0x631
+[TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_RUNL_ENTRY=0x63c
+[TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_RUNL_EXIT=0x63d
+[TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_START_ENTRY=0x638
+[TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_START_EXIT=0x639
+[TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_STOP_ENTRY=0x63a
+[TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_STOP_EXIT=0x63b
+[TRACE]TRACE_FLOW[0x8A]_CUSBMANCENREPMANAGER_CHECKSIGNATUREL_ENTRY=0x616
+[TRACE]TRACE_FLOW[0x8A]_CUSBMANCENREPMANAGER_CHECKSIGNATUREL_EXIT=0x617
+[TRACE]TRACE_FLOW[0x8A]_CUSBMANCENREPMANAGER_CONSTRUCTL_ENTRY=0x60e
+[TRACE]TRACE_FLOW[0x8A]_CUSBMANCENREPMANAGER_CONSTRUCTL_EXIT=0x60f
+[TRACE]TRACE_FLOW[0x8A]_CUSBMANCENREPMANAGER_CUSBMANCENREPMANAGER_CONS_ENTRY=0x60a
+[TRACE]TRACE_FLOW[0x8A]_CUSBMANCENREPMANAGER_CUSBMANCENREPMANAGER_CONS_EXIT=0x60b
+[TRACE]TRACE_FLOW[0x8A]_CUSBMANCENREPMANAGER_CUSBMANCENREPMANAGER_DES_ENTRY=0x610
+[TRACE]TRACE_FLOW[0x8A]_CUSBMANCENREPMANAGER_CUSBMANCENREPMANAGER_DES_EXIT=0x611
+[TRACE]TRACE_FLOW[0x8A]_CUSBMANCENREPMANAGER_ISCLASSCONFIGURABLEL_ENTRY=0x61e
+[TRACE]TRACE_FLOW[0x8A]_CUSBMANCENREPMANAGER_ISCLASSCONFIGURABLEL_EXIT=0x61f
+[TRACE]TRACE_FLOW[0x8A]_CUSBMANCENREPMANAGER_ISFEATURESUPPORTEDL_ENTRY=0x620
+[TRACE]TRACE_FLOW[0x8A]_CUSBMANCENREPMANAGER_ISFEATURESUPPORTEDL_EXIT=0x621
+[TRACE]TRACE_FLOW[0x8A]_CUSBMANCENREPMANAGER_ISFEATURESUPPORTEDL_EXIT_DUP1=0x622
+[TRACE]TRACE_FLOW[0x8A]_CUSBMANCENREPMANAGER_NEWL_ENTRY=0x60c
+[TRACE]TRACE_FLOW[0x8A]_CUSBMANCENREPMANAGER_NEWL_EXIT=0x60d
+[TRACE]TRACE_FLOW[0x8A]_CUSBMANCENREPMANAGER_READCONFIGURATIONSFORPERSONALITYL_ENTRY=0x61c
+[TRACE]TRACE_FLOW[0x8A]_CUSBMANCENREPMANAGER_READCONFIGURATIONSFORPERSONALITYL_EXIT=0x61d
+[TRACE]TRACE_FLOW[0x8A]_CUSBMANCENREPMANAGER_READDEVICECONFIGURATIONL_ENTRY=0x618
+[TRACE]TRACE_FLOW[0x8A]_CUSBMANCENREPMANAGER_READDEVICECONFIGURATIONL_EXIT=0x619
+[TRACE]TRACE_FLOW[0x8A]_CUSBMANCENREPMANAGER_READKEYL_ENTRY=0x614
+[TRACE]TRACE_FLOW[0x8A]_CUSBMANCENREPMANAGER_READKEYL_EXIT=0x615
+[TRACE]TRACE_FLOW[0x8A]_CUSBMANCENREPMANAGER_READPERSONALITIESL_ENTRY=0x61a
+[TRACE]TRACE_FLOW[0x8A]_CUSBMANCENREPMANAGER_READPERSONALITIESL_EXIT=0x61b
+[TRACE]TRACE_FLOW[0x8A]_CUSBMANCENREPMANAGER_READSTRINGKEYLC_ENTRY=0x612
+[TRACE]TRACE_FLOW[0x8A]_CUSBMANCENREPMANAGER_READSTRINGKEYLC_EXIT=0x613
+[TRACE]TRACE_FLOW[0x8A]_CUSBSCHEDULER_NEWL_ENTRY=0x2f
+[TRACE]TRACE_FLOW[0x8A]_CUSBSCHEDULER_NEWL_EXIT=0x30
+[TRACE]TRACE_FLOW[0x8A]_CUSBSERVER_CUSBSERVER_DES_ENTRY=0x468
+[TRACE]TRACE_FLOW[0x8A]_CUSBSERVER_CUSBSERVER_DES_EXIT=0x469
+[TRACE]TRACE_FLOW[0x8A]_CUSBSERVER_INCREMENTSESSIONCOUNT_ENTRY=0x1f8
+[TRACE]TRACE_FLOW[0x8A]_CUSBSERVER_INCREMENTSESSIONCOUNT_EXIT=0x1f9
+[TRACE]TRACE_FLOW[0x8A]_CUSBSERVER_LAUNCHSHUTDOWNTIMERIFNOSESSIONS_ENTRY=0x1fa
+[TRACE]TRACE_FLOW[0x8A]_CUSBSERVER_LAUNCHSHUTDOWNTIMERIFNOSESSIONS_EXIT=0x1fb
+[TRACE]TRACE_FLOW[0x8A]_CUSBSERVER_NEWLC_ENTRY=0x15c
+[TRACE]TRACE_FLOW[0x8A]_CUSBSERVER_NEWLC_EXIT=0x15d
+[TRACE]TRACE_FLOW[0x8A]_CUSBSERVER_NEWSESSIONL_ENTRY=0x1f6
+[TRACE]TRACE_FLOW[0x8A]_CUSBSERVER_NEWSESSIONL_EXIT=0x1f7
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_BUSCLEARERROR_ENTRY=0x27f
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_BUSCLEARERROR_EXIT=0x280
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_BUSDROP_ENTRY=0x281
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_BUSDROP_EXIT=0x282
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_BUSREQUEST_ENTRY=0x27b
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_BUSREQUEST_EXIT=0x27c
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_BUSRESPONDSRP_ENTRY=0x27d
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_BUSRESPONDSRP_EXIT=0x27e
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_CANCELINTEREST_ENTRY=0x25e
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_CANCELINTEREST_EXIT=0x25f
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_CANCELINTEREST_EXIT_DUP1=0x260
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_CLASSSUPPORTED_ENTRY=0x276
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_CLASSSUPPORTED_EXIT=0x277
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_CLASSSUPPORTED_EXIT_DUP1=0x278
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_CREATEL_ENTRY=0x223
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_CREATEL_EXIT=0x224
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_CUSBSESSION_CONS_ENTRY=0x21d
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_CUSBSESSION_CONS_EXIT=0x21e
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_CUSBSESSION_DES_ENTRY=0x21f
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_CUSBSESSION_DES_EXIT=0x220
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_DEREGISTERDEVICEOBSERVER_ENTRY=0x249
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_DEREGISTERDEVICEOBSERVER_EXIT=0x24a
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_DEREGISTERDEVICEOBSERVER_EXIT_DUP1=0x24b
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_DEREGISTERHOSTOBSERVER_ENTRY=0x294
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_DEREGISTERHOSTOBSERVER_EXIT=0x295
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_DEREGISTERHOSTOBSERVER_EXIT_DUP1=0x296
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_DEREGISTERMSGOBSERVER_ENTRY=0x29a
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_DEREGISTERMSGOBSERVER_EXIT=0x29b
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_DEREGISTERMSGOBSERVER_EXIT_DUP1=0x29c
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_DEREGISTERSERVICEOBSERVER_ENTRY=0x24c
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_DEREGISTERSERVICEOBSERVER_EXIT=0x24d
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_DEREGISTERSERVICEOBSERVER_EXIT_DUP1=0x24e
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_DISABLEFUNCTIONDRIVERLOADING_ENTRY=0x285
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_DISABLEFUNCTIONDRIVERLOADING_EXIT=0x286
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_DISPATCHMESSAGEL_ENTRY=0x22f
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_DISPATCHMESSAGEL_EXIT=0x230
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_ENABLEFUNCTIONDRIVERLOADING_ENTRY=0x283
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_ENABLEFUNCTIONDRIVERLOADING_EXIT=0x284
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_GETCURRENTDEVICESTATE_ENTRY=0x248
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_GETCURRENTPERSONALITYID_ENTRY=0x261
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_GETCURRENTPERSONALITYID_EXIT=0x262
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_GETCURRENTSERVICESTATE_ENTRY=0x247
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_GETDESCRIPTION_ENTRY=0x26b
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_GETDESCRIPTION_EXIT=0x26c
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_GETDESCRIPTION_EXIT_DUP1=0x26d
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_GETMANUFACTURERSTRINGDESCRIPTOR_ENTRY=0x28b
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_GETMANUFACTURERSTRINGDESCRIPTOR_EXIT=0x28c
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_GETOTGDESCRIPTOR_ENTRY=0x28f
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_GETOTGDESCRIPTOR_EXIT=0x290
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_GETPERSONALITYIDS_ENTRY=0x268
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_GETPERSONALITYIDS_EXIT=0x269
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_GETPERSONALITYIDS_EXIT_DUP1=0x26a
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_GETPERSONALITYPROPERTY_ENTRY=0x272
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_GETPERSONALITYPROPERTY_EXIT=0x273
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_GETPERSONALITYPROPERTY_EXIT_DUP2=0x275
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_GETPRODUCTSTRINGDESCRIPTOR_ENTRY=0x28d
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_GETPRODUCTSTRINGDESCRIPTOR_EXIT=0x28e
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_GETSUPPORTEDCLASSES_ENTRY=0x263
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_GETSUPPORTEDCLASSES_EXIT=0x264
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_GETSUPPORTEDCLASSES_EXIT_DUP1=0x265
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_GETSUPPORTEDCLASSES_EXIT_DUP2=0x266
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_GETSUPPORTEDCLASSES_EXIT_DUP3=0x267
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_GETSUPPORTEDLANGUAGESL_ENTRY=0x289
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_GETSUPPORTEDLANGUAGESL_EXIT=0x28a
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_GETSUPPORTEDLANGUAGES_ENTRY=0x287
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_GETSUPPORTEDLANGUAGES_EXIT=0x288
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_HANDLESERVICESTATECHANGEWHILESTARTING_ENTRY=0x227
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_HANDLESERVICESTATECHANGEWHILESTARTING_EXIT=0x228
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_HANDLESERVICESTATECHANGEWHILESTOPPING_ENTRY=0x229
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_HANDLESERVICESTATECHANGEWHILESTOPPING_EXIT=0x22a
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_NEWL_ENTRY=0x21c
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_REGISTERDEVICEOBSERVER_ENTRY=0x241
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_REGISTERDEVICEOBSERVER_EXIT=0x242
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_REGISTERDEVICEOBSERVER_EXIT_DUP1=0x243
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_REGISTERHOSTOBSERVER_ENTRY=0x291
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_REGISTERHOSTOBSERVER_EXIT=0x292
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_REGISTERHOSTOBSERVER_EXIT_DUP1=0x293
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_REGISTERMSGOBSERVER_ENTRY=0x297
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_REGISTERMSGOBSERVER_EXIT=0x298
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_REGISTERMSGOBSERVER_EXIT_DUP1=0x299
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_REGISTERSERVICEOBSERVER_ENTRY=0x244
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_REGISTERSERVICEOBSERVER_EXIT=0x245
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_REGISTERSERVICEOBSERVER_EXIT_DUP1=0x246
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_SERVICEL_ENTRY=0x221
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_SERVICEL_EXIT=0x222
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_SETCTLSESSIONMODE_ENTRY=0x279
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_SETCTLSESSIONMODE_EXIT=0x27a
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_STARTCANCEL_ENTRY=0x23a
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_STARTCANCEL_EXIT=0x23b
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_STARTCANCEL_EXIT_DUP1=0x23c
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_STARTDEVICEL_ENTRY=0x231
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_STARTDEVICEL_EXIT=0x232
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_STARTDEVICEL_EXIT_DUP1=0x233
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_STARTDEVICEL_EXIT_DUP2=0x234
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_STOPCANCEL_ENTRY=0x23d
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_STOPCANCEL_EXIT=0x23e
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_STOPCANCEL_EXIT_DUP1=0x23f
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_STOPCANCEL_EXIT_DUP2=0x240
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_STOPDEVICEL_ENTRY=0x235
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_STOPDEVICEL_EXIT=0x236
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_STOPDEVICEL_EXIT_DUP1=0x237
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_STOPDEVICEL_EXIT_DUP2=0x238
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_STOPDEVICEL_EXIT_DUP3=0x239
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_TRYSTARTDEVICEL_ENTRY=0x24f
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_TRYSTARTDEVICEL_EXIT=0x250
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_TRYSTARTDEVICEL_EXIT_DUP1=0x251
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_TRYSTARTDEVICEL_EXIT_DUP2=0x252
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_TRYSTARTDEVICEL_EXIT_DUP3=0x253
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_TRYSTARTDEVICEL_EXIT_DUP4=0x254
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_TRYSTARTDEVICEL_EXIT_DUP5=0x255
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_TRYSTARTDEVICEL_EXIT_DUP6=0x256
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_TRYSTOPDEVICEL_ENTRY=0x257
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_TRYSTOPDEVICEL_EXIT=0x258
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_TRYSTOPDEVICEL_EXIT_DUP1=0x259
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_TRYSTOPDEVICEL_EXIT_DUP2=0x25a
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_TRYSTOPDEVICEL_EXIT_DUP3=0x25b
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_TRYSTOPDEVICEL_EXIT_DUP4=0x25c
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_TRYSTOPDEVICEL_EXIT_DUP5=0x25d
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_USBDEVICEDEQUEUEEVENT_ENTRY=0x22d
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_USBDEVICEDEQUEUEEVENT_EXIT=0x22e
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_USBDEVICESTATECHANGE_ENTRY=0x22b
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_USBDEVICESTATECHANGE_EXIT=0x22c
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_USBHOSTEVENTDEQUEUE_ENTRY=0x2a3
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_USBHOSTEVENTDEQUEUE_EXIT=0x2a4
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_USBHOSTEVENT_ENTRY=0x29f
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_USBHOSTEVENT_EXIT=0x2a0
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_USBMSGDEQUEUE_ENTRY=0x2a1
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_USBMSGDEQUEUE_EXIT=0x2a2
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_USBOTGHOSTMESSAGE_ENTRY=0x29d
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_USBOTGHOSTMESSAGE_EXIT=0x29e
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_USBSERVICESTATECHANGE_ENTRY=0x225
+[TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_USBSERVICESTATECHANGE_EXIT=0x226
+[TRACE]TRACE_NORMAL[0x86]_CINIFILE_CONSTRUCTL=0x3e1
+[TRACE]TRACE_NORMAL[0x86]_CINIFILE_CONSTRUCTL_DUP1=0x3e2
+[TRACE]TRACE_NORMAL[0x86]_CINIFILE_CONSTRUCTL_DUP2=0x3e3
+[TRACE]TRACE_NORMAL[0x86]_CINIFILE_CONSTRUCTL_DUP3=0x3e4
+[TRACE]TRACE_NORMAL[0x86]_CINIFILE_CONSTRUCTL_DUP4=0x3e5
+[TRACE]TRACE_NORMAL[0x86]_CINIFILE_PANIC=0x3e0
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICESTATEWATCHER_CUSBDEVICESTATEWATCHER=0x89
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICESTATEWATCHER_RUNL=0x8a
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICESTATEWATCHER_RUNL_DUP1=0x8b
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICESTATEWATCHER_RUNL_DUP2=0x8c
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICESTATEWATCHER_RUNL_DUP3=0x8d
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_ADDCLASSCONTROLLERL=0x178
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_BUSENUMERATIONCOMPLETED=0xcb
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_BUSENUMERATIONFAILED=0xcc
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_BUSENUMERATIONFAILED_DUP1=0xcd
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CONSTRUCTL=0xbf
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CONSTRUCTL_DUP1=0x16f
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CONSTRUCTL_DUP10=0x171
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CONSTRUCTL_DUP11=0x172
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CONSTRUCTL_DUP12=0x174
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CONSTRUCTL_DUP13=0x175
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CONSTRUCTL_DUP2=0xc1
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CONSTRUCTL_DUP3=0xc2
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CONSTRUCTL_DUP4=0xc3
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CONSTRUCTL_DUP5=0xc4
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CONSTRUCTL_DUP6=0xc5
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CONSTRUCTL_DUP7=0xc6
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CONSTRUCTL_DUP8=0xc7
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CONSTRUCTL_DUP9=0x170
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CONVERTUIDSL_DUP1=0x1a1
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CREATECLASSCONTROLLERSL=0x16e
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CREATECLASSCONTROLLERSL_DUP1=0x1a5
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CUSBDEVICE=0xbb
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CUSBDEVICE_DUP1=0xbc
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CUSBDEVICE_DUP2=0xbd
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CUSBDEVICE_DUP3=0xbe
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_ENUMERATECLASSCONTROLLERSL=0x138
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_ENUMERATECLASSCONTROLLERSL_DUP1=0x139
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_ENUMERATECLASSCONTROLLERSL_DUP2=0x176
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_ENUMERATECLASSCONTROLLERSL_DUP3=0x192
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_INSTANTIATEEXTENSIONPLUGINSL_DUP1=0xc8
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_MUEPODOREGISTERSTATEOBSERVERL=0x150
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_POWERUPANDCONNECT=0xce
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_POWERUPANDCONNECT_DUP1=0xcf
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_POWERUPANDCONNECT_DUP2=0xd0
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_REGISTEROBSERVERL=0x179
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_RUNERROR=0xd5
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_RUNL=0xd1
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_RUNL_DUP1=0xd2
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_RUNL_DUP2=0xd3
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_RUNL_DUP3=0xd4
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_RUNL_DUP4=0x193
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_SETCURRENTPERSONALITYL=0x154
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_SETDEVICEDESCRIPTORL=0x146
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_SETDEVICEDESCRIPTORL_DUP1=0x147
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_SETDEVICEDESCRIPTORL_DUP2=0x148
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_SETDEVICEDESCRIPTORL_DUP3=0x3c6
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_SETDEVICESTATE=0xca
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_SETSERVICESTATE=0xc9
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_SETUSBDEVICESETTINGSFROMPERSONALITYL=0x151
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_SETUSBDEVICESETTINGSFROMPERSONALITYL_DUP1=0x157
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_SETUSBDEVICESETTINGSFROMPERSONALITYL_DUP2=0x158
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_SETUSBDEVICESETTINGSFROMPERSONALITYL_DUP3=0x19e
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_SETUSBDEVICESETTINGSFROMPERSONALITYL_DUP4=0x1a0
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_SETUSBDEVICESETTINGSFROMPERSONALITYL_DUP5=0x19f
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_SETUSBDEVICESETTINGSFROMPERSONALITYL_DUP6=0x19d
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_SETUSBDEVICESETTINGSFROMPERSONALITYL_DUP7=0x19c
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_STARTL=0x17a
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_TRYSTARTL=0x18a
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_VALIDATEPERSONALITIESL=0x155
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_VALIDATEPERSONALITIESL_DUP1=0x3c7
+[TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_VALIDATEPERSONALITIESL_DUP2=0x3c8
+[TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR=0x3e6
+[TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP1=0x3e7
+[TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP3=0x3e8
+[TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP5=0x3e9
+[TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP7=0x3ea
+[TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_GETCONFIG=0x3eb
+[TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP1=0x3ec
+[TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP2=0x3ed
+[TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP3=0x3ee
+[TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP4=0x3ef
+[TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP5=0x3f0
+[TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP6=0x3f1
+[TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_RUNL=0x3f2
+[TRACE]TRACE_NORMAL[0x86]_CUSBMANCENREPMANAGER_CHECKSIGNATUREL=0x3cc
+[TRACE]TRACE_NORMAL[0x86]_CUSBMANCENREPMANAGER_ISCLASSCONFIGURABLEL=0x3dc
+[TRACE]TRACE_NORMAL[0x86]_CUSBMANCENREPMANAGER_ISCLASSCONFIGURABLEL_DUP2=0x3dd
+[TRACE]TRACE_NORMAL[0x86]_CUSBMANCENREPMANAGER_ISFEATURESUPPORTEDL_DUP2=0x3df
+[TRACE]TRACE_NORMAL[0x86]_CUSBMANCENREPMANAGER_READCONFIGURATIONSFORPERSONALITYL_DUP1=0x3d9
+[TRACE]TRACE_NORMAL[0x86]_CUSBMANCENREPMANAGER_READCONFIGURATIONSFORPERSONALITYL_DUP2=0x3da
+[TRACE]TRACE_NORMAL[0x86]_CUSBMANCENREPMANAGER_READCONFIGURATIONSFORPERSONALITYL_DUP3=0x3db
+[TRACE]TRACE_NORMAL[0x86]_CUSBMANCENREPMANAGER_READDEVICECONFIGURATIONL=0x3cd
+[TRACE]TRACE_NORMAL[0x86]_CUSBMANCENREPMANAGER_READDEVICECONFIGURATIONL_DUP1=0x3d1
+[TRACE]TRACE_NORMAL[0x86]_CUSBMANCENREPMANAGER_READDEVICECONFIGURATIONL_DUP2=0x3d2
+[TRACE]TRACE_NORMAL[0x86]_CUSBMANCENREPMANAGER_READDEVICECONFIGURATIONL_DUP3=0x3cf
+[TRACE]TRACE_NORMAL[0x86]_CUSBMANCENREPMANAGER_READDEVICECONFIGURATIONL_DUP4=0x3d0
+[TRACE]TRACE_NORMAL[0x86]_CUSBMANCENREPMANAGER_READKEYL=0x3c9
+[TRACE]TRACE_NORMAL[0x86]_CUSBMANCENREPMANAGER_READKEYL_DUP1=0x3cb
+[TRACE]TRACE_NORMAL[0x86]_CUSBMANCENREPMANAGER_READPERSONALITIESL_DUP1=0x3d4
+[TRACE]TRACE_NORMAL[0x86]_CUSBMANCENREPMANAGER_READPERSONALITIESL_DUP3=0x3d3
+[TRACE]TRACE_NORMAL[0x86]_CUSBMANCENREPMANAGER_READPERSONALITIESL_DUP4=0x3d6
+[TRACE]TRACE_NORMAL[0x86]_CUSBMANCENREPMANAGER_READPERSONALITIESL_DUP6=0x3d7
+[TRACE]TRACE_NORMAL[0x86]_CUSBMANCENREPMANAGER_READPERSONALITIESL_DUP7=0x3d8
+[TRACE]TRACE_NORMAL[0x86]_CUSBMANCENREPMANAGER_READSTRINGKEYLC=0x3c4
+[TRACE]TRACE_NORMAL[0x86]_CUSBMANCENREPMANAGER_READSTRINGKEYLC_DUP1=0x3c5
+[TRACE]TRACE_NORMAL[0x86]_CUSBSCHEDULER_ERROR=0x1d
+[TRACE]TRACE_NORMAL[0x86]_CUSBSERVER_CONSTRUCTL=0x12c
+[TRACE]TRACE_NORMAL[0x86]_CUSBSERVER_CONSTRUCTL_DUP1=0x12d
+[TRACE]TRACE_NORMAL[0x86]_CUSBSERVER_CONSTRUCTL_DUP2=0x12e
+[TRACE]TRACE_NORMAL[0x86]_CUSBSERVER_CONSTRUCTL_DUP3=0x12f
+[TRACE]TRACE_NORMAL[0x86]_CUSBSERVER_CUSBSERVER=0x124
+[TRACE]TRACE_NORMAL[0x86]_CUSBSERVER_CUSBSERVER_DUP1=0x125
+[TRACE]TRACE_NORMAL[0x86]_CUSBSERVER_CUSBSERVER_DUP2=0x126
+[TRACE]TRACE_NORMAL[0x86]_CUSBSERVER_CUSBSERVER_DUP3=0x127
+[TRACE]TRACE_NORMAL[0x86]_CUSBSERVER_CUSBSERVER_DUP4=0x128
+[TRACE]TRACE_NORMAL[0x86]_CUSBSERVER_CUSBSERVER_DUP5=0x129
+[TRACE]TRACE_NORMAL[0x86]_CUSBSERVER_CUSBSERVER_DUP6=0x12a
+[TRACE]TRACE_NORMAL[0x86]_CUSBSERVER_CUSBSERVER_DUP7=0x12b
+[TRACE]TRACE_NORMAL[0x86]_CUSBSERVER_DECREMENTSESSIONCOUNT=0x135
+[TRACE]TRACE_NORMAL[0x86]_CUSBSERVER_ERROR=0x132
+[TRACE]TRACE_NORMAL[0x86]_CUSBSERVER_INCREMENTSESSIONCOUNT=0x133
+[TRACE]TRACE_NORMAL[0x86]_CUSBSERVER_NEWSESSIONL=0x130
+[TRACE]TRACE_NORMAL[0x86]_CUSBSERVER_NEWSESSIONL_DUP1=0x131
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_CREATEL=0x1c8
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_CREATEL_DUP1=0x1c9
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_CREATEL_DUP2=0x1ca
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_CUSBSESSION=0x1d2
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_CUSBSESSION_DUP1=0x1d5
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_CUSBSESSION_DUP2=0x1d6
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_CUSBSESSION_DUP3=0x1d7
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_DEREGISTERHOSTOBSERVER=0x1ad
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_DEREGISTERHOSTOBSERVER_DUP1=0x1ae
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_DISPATCHMESSAGEL=0x1c2
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_DISPATCHMESSAGEL_DUP1=0x1d0
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_DISPATCHMESSAGEL_DUP2=0x1dd
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_DISPATCHMESSAGEL_DUP3=0x1de
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_DISPATCHMESSAGEL_DUP4=0x1df
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_DISPATCHMESSAGEL_DUP5=0x1e0
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_DISPATCHMESSAGEL_DUP6=0x1e1
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_GETCURRENTDEVICESTATE=0x1ba
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_GETCURRENTPERSONALITYID=0x1bb
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_GETCURRENTSERVICESTATE=0x1b9
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_GETMANUFACTURERSTRINGDESCRIPTOR=0x1a9
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_GETMANUFACTURERSTRINGDESCRIPTOR_DUP1=0x1db
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_GETOTGDESCRIPTOR=0x1ab
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_GETPERSONALITYIDS=0x1b8
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_GETPRODUCTSTRINGDESCRIPTOR=0x1aa
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_GETPRODUCTSTRINGDESCRIPTOR_DUP1=0x1dc
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_GETSUPPORTEDCLASSES=0x1bc
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_GETSUPPORTEDCLASSES_DUP1=0x1be
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_GETSUPPORTEDCLASSES_DUP2=0x1d9
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_GETSUPPORTEDLANGUAGESL=0x1a6
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_GETSUPPORTEDLANGUAGESL_DUP1=0x1a7
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_GETSUPPORTEDLANGUAGESL_DUP2=0x1a8
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_HANDLESERVICESTATECHANGEWHILESTARTING=0x1cb
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_HANDLESERVICESTATECHANGEWHILESTARTING_DUP1=0x1cc
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_HANDLESERVICESTATECHANGEWHILESTARTING_DUP2=0x1cd
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_HANDLESERVICESTATECHANGEWHILESTARTING_DUP3=0x1ce
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_HANDLESERVICESTATECHANGEWHILESTOPPING=0x1c4
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_HANDLESERVICESTATECHANGEWHILESTOPPING_DUP1=0x1c5
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_HANDLESERVICESTATECHANGEWHILESTOPPING_DUP2=0x1c6
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_HANDLESERVICESTATECHANGEWHILESTOPPING_DUP3=0x1c7
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_REGISTERDEVICEOBSERVER=0x1c3
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_REGISTERHOSTOBSERVER=0x1ac
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_REGISTERMSGOBSERVER=0x1af
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_SETCTLSESSIONMODE=0x1b7
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_USBDEVICEDEQUEUEEVENT=0x1c1
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_USBDEVICESTATECHANGE=0x1bf
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_USBDEVICESTATECHANGE_DUP1=0x1c0
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_USBHOSTEVENT=0x1b1
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_USBHOSTEVENTDEQUEUE=0x1b5
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_USBHOSTEVENTDEQUEUE_DUP1=0x1b6
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_USBHOSTEVENT_DUP1=0x1b2
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_USBHOSTEVENT_DUP2=0x1b3
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_USBMSGDEQUEUE=0x1b4
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_USBOTGHOSTMESSAGE=0x1b0
+[TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_USBSERVICESTATECHANGE=0x1d8
+[TRACE]TRACE_NORMAL[0x86]_DUP1_CUSBMANCENREPMANAGER_ISFEATURESUPPORTEDL_DUP1=0x3de
+[TRACE]TRACE_NORMAL[0x86]_DUP2_CUSBMANCENREPMANAGER_READPERSONALITIESL_DUP2=0x3d5
+[TRACE]TRACE_NORMAL[0x86]_USBSVR_RUNSERVERL=0x2ed
+[[OBSOLETE]][TRACE]TRACE_DUMP[0x89]_CUSBDEVICE_READPERSONALITIESL_DUP10=0x12
+[[OBSOLETE]][TRACE]TRACE_DUMP[0x89]_CUSBDEVICE_READPERSONALITIESL_DUP11=0x13
+[[OBSOLETE]][TRACE]TRACE_DUMP[0x89]_CUSBDEVICE_READPERSONALITIESL_DUP12=0x14
+[[OBSOLETE]][TRACE]TRACE_DUMP[0x89]_CUSBDEVICE_READPERSONALITIESL_DUP13=0x15
+[[OBSOLETE]][TRACE]TRACE_DUMP[0x89]_CUSBDEVICE_READPERSONALITIESL_DUP14=0x16
+[[OBSOLETE]][TRACE]TRACE_DUMP[0x89]_CUSBDEVICE_READPERSONALITIESL_DUP15=0x17
+[[OBSOLETE]][TRACE]TRACE_DUMP[0x89]_CUSBDEVICE_READPERSONALITIESL_DUP16=0x18
+[[OBSOLETE]][TRACE]TRACE_DUMP[0x89]_CUSBDEVICE_READPERSONALITIESL_DUP17=0x19
+[[OBSOLETE]][TRACE]TRACE_DUMP[0x89]_CUSBDEVICE_READPERSONALITIESL_DUP18=0x1a
+[[OBSOLETE]][TRACE]TRACE_DUMP[0x89]_CUSBDEVICE_READPERSONALITIESL_DUP19=0x1b
+[[OBSOLETE]][TRACE]TRACE_DUMP[0x89]_CUSBDEVICE_READPERSONALITIESL_DUP20=0x1c
+[[OBSOLETE]][TRACE]TRACE_DUMP[0x89]_CUSBDEVICE_READPERSONALITIESL_DUP21=0x1d
+[[OBSOLETE]][TRACE]TRACE_DUMP[0x89]_CUSBDEVICE_READPERSONALITIESL_DUP7=0xf
+[[OBSOLETE]][TRACE]TRACE_DUMP[0x89]_CUSBDEVICE_READPERSONALITIESL_DUP8=0x10
+[[OBSOLETE]][TRACE]TRACE_DUMP[0x89]_CUSBDEVICE_READPERSONALITIESL_DUP9=0x11
+[[OBSOLETE]][TRACE]TRACE_DUMP[0x89]_DUP1_CUSBSESSION_GETMANUFACTURERSTRINGDESCRIPTOR=0x1
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_CONSTRUCTL=0x53
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_DOCANCEL=0x66
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_DOCANCEL_DUP1=0x67
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_DOCANCEL_DUP2=0x68
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_DOCANCEL_DUP3=0x69
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_DOCANCEL_DUP4=0x6a
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP2=0x54
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP4=0x55
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP6=0x56
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP8=0x57
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP7=0x58
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_RUNERROR=0x6b
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_RUNL_DUP1=0x61
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_RUNL_DUP2=0x62
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_RUNL_DUP3=0x63
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_RUNL_DUP4=0x64
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_RUNL_DUP5=0x65
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_START=0x59
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_START_DUP1=0x5a
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_START_DUP2=0x5b
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_START_DUP3=0x5c
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_STOP=0x5d
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_STOP_DUP1=0x5e
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_STOP_DUP2=0x5f
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CUSBDUMMYCLASSCONTROLLER_STOP_DUP3=0x60
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEUSBHOSTEVENTWATCHER_CACTIVEUSBHOSTEVENTWATCHER_CONS_ENTRY=0x598
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEUSBHOSTEVENTWATCHER_CACTIVEUSBHOSTEVENTWATCHER_CONS_EXIT=0x599
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEUSBHOSTEVENTWATCHER_CACTIVEUSBHOSTEVENTWATCHER_DES_ENTRY=0x59a
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEUSBHOSTEVENTWATCHER_CACTIVEUSBHOSTEVENTWATCHER_DES_EXIT=0x59b
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEUSBHOSTEVENTWATCHER_CACTIVEUSBHOSTEVENTWATCHER_ENTRY=0x3e2
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEUSBHOSTEVENTWATCHER_CACTIVEUSBHOSTEVENTWATCHER_ENTRY_DUP1=0x3e4
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEUSBHOSTEVENTWATCHER_CACTIVEUSBHOSTEVENTWATCHER_EXIT=0x3e3
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEUSBHOSTEVENTWATCHER_CACTIVEUSBHOSTEVENTWATCHER_EXIT_DUP1=0x3e5
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEUSBHOSTEVENTWATCHER_DOCANCEL_ENTRY=0x59e
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEUSBHOSTEVENTWATCHER_DOCANCEL_EXIT=0x59f
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEUSBHOSTEVENTWATCHER_POST_ENTRY=0x59c
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEUSBHOSTEVENTWATCHER_POST_EXIT=0x59d
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEUSBHOSTMESSAGEWATCHER_CACTIVEUSBHOSTMESSAGEWATCHER_CONS_ENTRY=0x5a2
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEUSBHOSTMESSAGEWATCHER_CACTIVEUSBHOSTMESSAGEWATCHER_CONS_EXIT=0x5a3
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEUSBHOSTMESSAGEWATCHER_CACTIVEUSBHOSTMESSAGEWATCHER_DES_ENTRY=0x5a0
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEUSBHOSTMESSAGEWATCHER_CACTIVEUSBHOSTMESSAGEWATCHER_DES_EXIT=0x5a1
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEUSBHOSTMESSAGEWATCHER_CACTIVEUSBHOSTMESSAGEWATCHER_ENTRY=0x3ea
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEUSBHOSTMESSAGEWATCHER_CACTIVEUSBHOSTMESSAGEWATCHER_ENTRY_DUP1=0x3ec
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEUSBHOSTMESSAGEWATCHER_CACTIVEUSBHOSTMESSAGEWATCHER_EXIT=0x3eb
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEUSBHOSTMESSAGEWATCHER_CACTIVEUSBHOSTMESSAGEWATCHER_EXIT_DUP1=0x3ed
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEUSBHOSTMESSAGEWATCHER_DOCANCEL_ENTRY=0x5a6
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEUSBHOSTMESSAGEWATCHER_DOCANCEL_EXIT=0x5a7
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEUSBHOSTMESSAGEWATCHER_POST_ENTRY=0x5a4
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEUSBHOSTMESSAGEWATCHER_POST_EXIT=0x5a5
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEUSBHOSTWATCHER_CACTIVEUSBHOSTWATCHER_CONS_ENTRY=0x592
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEUSBHOSTWATCHER_CACTIVEUSBHOSTWATCHER_CONS_EXIT=0x593
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEUSBHOSTWATCHER_CACTIVEUSBHOSTWATCHER_DES_ENTRY=0x594
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEUSBHOSTWATCHER_CACTIVEUSBHOSTWATCHER_DES_EXIT=0x595
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEUSBHOSTWATCHER_CACTIVEUSBHOSTWATCHER_ENTRY=0x2ee
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEUSBHOSTWATCHER_CACTIVEUSBHOSTWATCHER_ENTRY_DUP1=0x2f0
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEUSBHOSTWATCHER_CACTIVEUSBHOSTWATCHER_EXIT=0x2ef
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEUSBHOSTWATCHER_CACTIVEUSBHOSTWATCHER_EXIT_DUP1=0x2f1
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEUSBHOSTWATCHER_RUNL_ENTRY=0x596
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CACTIVEUSBHOSTWATCHER_RUNL_EXIT=0x597
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CINIFILE_CINIFILE_CONS_ENTRY=0x549
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CINIFILE_CINIFILE_ENTRY=0x2a5
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CINIFILE_NEWL_ENTRY=0x3a6
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CINIFILE_NEWL_ENTRY_DUP1=0x3a8
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CINIFILE_NEWL_ENTRY_DUP1_EXIT=0x2a9
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CINIFILE_NEWL_EXIT=0x3a7
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CINIFILE_NEWL_EXIT_DUP1=0x3a9
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CINIFILE_NEWL_TDESC_ENTRY=0x54a
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CINIFILE_NEWL_TDESC_EXIT=0x54b
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CINIFILE_NEWL_TDESC_TDESC_ENTRY=0x54c
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CINIFILE_NEWL_TDESC_TDESC_EXIT=0x54d
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CPERSONALITY_CPERSONALITY_ENTRY=0x5
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CPERSONALITY_CPERSONALITY_EXIT=0x6
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CREQUESTSESSIONWATCHER_CONSTRUCTL_ENTRY=0x5f4
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CREQUESTSESSIONWATCHER_CONSTRUCTL_EXIT=0x5f5
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CREQUESTSESSIONWATCHER_CREQUESTSESSIONWATCHER_CONS_ENTRY=0x5f6
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CREQUESTSESSIONWATCHER_CREQUESTSESSIONWATCHER_CONS_EXIT=0x5f7
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CREQUESTSESSIONWATCHER_CREQUESTSESSIONWATCHER_ENTRY=0x352
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CREQUESTSESSIONWATCHER_CREQUESTSESSIONWATCHER_EXIT=0x353
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CREQUESTSESSIONWATCHER_DOCANCEL_ENTRY=0x5fa
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CREQUESTSESSIONWATCHER_DOCANCEL_EXIT=0x5fb
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CREQUESTSESSIONWATCHER_RUNL_ENTRY=0x5f8
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CREQUESTSESSIONWATCHER_RUNL_EXIT=0x5f9
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_ADDCLASSCONTROLLERL_ENTRY=0x84
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_ADDCLASSCONTROLLERL_EXIT=0x85
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_BUSENUMERATIONCOMPLETED_ENTRY=0x92
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_BUSENUMERATIONCOMPLETED_EXIT=0x93
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_CONSTRUCTL_ENTRY=0x7d
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_CONSTRUCTL_EXIT=0x7e
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_CUSBDEVICE_ENTRY=0x122
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_CUSBDEVICE_EXIT=0x123
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_DEREGISTEROBSERVER_ENTRY=0x88
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_DEREGISTEROBSERVER_EXIT=0x89
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_DOCANCEL_ENTRY=0x9c
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_DOCANCEL_EXIT=0x9d
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_ENUMERATECLASSCONTROLLERSL_ENTRY=0x82
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_ENUMERATECLASSCONTROLLERSL_EXIT=0x83
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_INSTANTIATEEXTENSIONPLUGINSL=0x80
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_INSTANTIATEEXTENSIONPLUGINSL_ENTRY=0x7f
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_INSTANTIATEEXTENSIONPLUGINSL_EXIT=0x81
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_NEWL_ENTRY=0x79
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_NEWL_EXIT=0x7a
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_POWERUPANDCONNECT_ENTRY=0x98
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_POWERUPANDCONNECT_EXIT=0x99
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_READPERSONALITIESL_ENTRY=0x214
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_READPERSONALITIESL_EXIT=0x215
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_READPERSONALITIESL_EXIT_DUP1=0x369
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_READPERSONALITIESL_EXIT_DUP2=0x21b
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_REGISTEROBSERVERL_ENTRY=0x86
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_REGISTEROBSERVERL_EXIT=0x87
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_RESOURCEFILENAMEL_ENTRY=0x201
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_RESOURCEFILENAMEL_EXIT=0x202
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_RUNL_ENTRY=0x9a
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_RUNL_EXIT=0x9b
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_SETDEVICESTATE_ENTRY=0x90
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_SETDEVICESTATE_EXIT=0x91
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_SETSERVICESTATE_ENTRY=0x8e
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_SETSERVICESTATE_EXIT=0x8f
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_SETUSBDEVICESETTINGSFROMPERSONALITYL_EXIT=0x204
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_SETUSBDEVICESETTINGSL_ENTRY=0x1fe
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_SETUSBDEVICESETTINGSL_EXIT=0x1ff
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_SETUSBDEVICESETTINGSL_EXIT_DUP1=0x200
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_STARTCURRENTCLASSCONTROLLER_ENTRY=0x94
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_STARTCURRENTCLASSCONTROLLER_EXIT=0x95
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_STARTL_ENTRY=0x8a
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_STARTL_EXIT=0x8b
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_STOPCURRENTCLASSCONTROLLER_ENTRY=0x96
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_STOPCURRENTCLASSCONTROLLER_EXIT=0x97
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_STOP_ENTRY=0x8c
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_STOP_EXIT=0x8d
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_UCCNERROR_ENTRY=0x9f
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_UCCNERROR_EXIT=0xa0
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDEVICE_UCCNGETCLASSCONTROLLERITERATORL_ENTRY=0x9e
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_DOCANCEL_ENTRY=0x55e
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_DOCANCEL_EXIT=0x55f
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_DOGETCONFIGL_ENTRY=0x554
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_DOGETCONFIGL_EXIT=0x555
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_ENTRY=0x552
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_EXIT=0x553
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_GETCONFIG_ENTRY=0x556
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_GETCONFIG_EXIT=0x557
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_NEWL_ENTRY=0x456
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_NEWL_ENTRY_DUP1=0x458
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_NEWL_EXIT=0x457
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_NEWL_EXIT_DUP1=0x459
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_NEWL_MUSBCLASSCONTROLLERNOTIFY_TUINT_ENTRY=0x54e
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_NEWL_MUSBCLASSCONTROLLERNOTIFY_TUINT_EXIT=0x54f
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_NEWL_MUSBCLASSCONTROLLERNOTIFY_TUINT_TINT_ENTRY=0x550
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_NEWL_MUSBCLASSCONTROLLERNOTIFY_TUINT_TINT_EXIT=0x551
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_RUNL_ENTRY=0x55c
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_RUNL_EXIT=0x55d
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_START_ENTRY=0x558
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_START_EXIT=0x559
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_STOP_ENTRY=0x55a
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBDUMMYCLASSCONTROLLER_STOP_EXIT=0x55b
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBHOST_CONSTRUCTL_ENTRY=0x578
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBHOST_CONSTRUCTL_EXIT=0x579
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBHOST_CUSBHOST_CONS_ENTRY=0x576
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBHOST_CUSBHOST_CONS_EXIT=0x577
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBHOST_CUSBHOST_DES_ENTRY=0x574
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBHOST_CUSBHOST_DES_EXIT=0x575
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBHOST_CUSBHOST_ENTRY=0x2d0
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBHOST_CUSBHOST_ENTRY_DUP1=0x2d2
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBHOST_CUSBHOST_EXIT=0x2d1
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBHOST_CUSBHOST_EXIT_DUP1=0x2d3
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBHOST_DEREGISTEROBSERVER_ENTRY=0x580
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBHOST_DEREGISTEROBSERVER_EXIT=0x581
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBHOST_DISABLEDRIVERLOADING_ENTRY=0x590
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBHOST_DISABLEDRIVERLOADING_EXIT=0x591
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBHOST_ENABLEDRIVERLOADING_ENTRY=0x58e
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBHOST_ENABLEDRIVERLOADING_EXIT=0x58f
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBHOST_GETMANUFACTURERSTRINGDESCRIPTOR_ENTRY=0x584
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBHOST_GETMANUFACTURERSTRINGDESCRIPTOR_EXIT=0x585
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBHOST_GETOTGDESCRIPTOR_ENTRY=0x588
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBHOST_GETOTGDESCRIPTOR_EXIT=0x589
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBHOST_GETPRODUCTSTRINGDESCRIPTOR_ENTRY=0x586
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBHOST_GETPRODUCTSTRINGDESCRIPTOR_EXIT=0x587
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBHOST_GETSUPPORTEDLANGUAGES_ENTRY=0x582
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBHOST_GETSUPPORTEDLANGUAGES_EXIT=0x583
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBHOST_NOTIFYHOSTEVENT_ENTRY=0x58a
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBHOST_NOTIFYHOSTEVENT_EXIT=0x58b
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBHOST_REGISTEROBSERVERL_ENTRY=0x57e
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBHOST_REGISTEROBSERVERL_EXIT=0x57f
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBHOST_STARTL_ENTRY=0x57a
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBHOST_STARTL_EXIT=0x57b
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBHOST_STOP_ENTRY=0x57c
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBHOST_STOP_EXIT=0x57d
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBHOST_UPDATENUMOFOBSERVERS_ENTRY=0x58c
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBHOST_UPDATENUMOFOBSERVERS_EXIT=0x58d
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGBASEWATCHER_CUSBOTGBASEWATCHER_CONS_ENTRY=0x5a8
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGBASEWATCHER_CUSBOTGBASEWATCHER_CONS_EXIT=0x5a9
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGBASEWATCHER_CUSBOTGBASEWATCHER_DES_ENTRY=0x5aa
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGBASEWATCHER_CUSBOTGBASEWATCHER_DES_EXIT=0x5ab
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGBASEWATCHER_CUSBOTGBASEWATCHER_ENTRY=0x304
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGBASEWATCHER_CUSBOTGBASEWATCHER_ENTRY_DUP1=0x306
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGBASEWATCHER_CUSBOTGBASEWATCHER_EXIT=0x305
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGBASEWATCHER_CUSBOTGBASEWATCHER_EXIT_DUP1=0x307
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGBASEWATCHER_START_ENTRY=0x5ac
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGBASEWATCHER_START_EXIT=0x5ad
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGCONNECTIONIDLEWATCHER_CONSTRUCTL_ENTRY=0x600
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGCONNECTIONIDLEWATCHER_CONSTRUCTL_EXIT=0x601
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGCONNECTIONIDLEWATCHER_CUSBOTGCONNECTIONIDLEWATCHER_CONS_ENTRY=0x602
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGCONNECTIONIDLEWATCHER_CUSBOTGCONNECTIONIDLEWATCHER_CONS_EXIT=0x603
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGCONNECTIONIDLEWATCHER_CUSBOTGCONNECTIONIDLEWATCHER_DES_ENTRY=0x5fe
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGCONNECTIONIDLEWATCHER_CUSBOTGCONNECTIONIDLEWATCHER_DES_EXIT=0x5ff
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGCONNECTIONIDLEWATCHER_CUSBOTGCONNECTIONIDLEWATCHER_ENTRY=0x35a
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGCONNECTIONIDLEWATCHER_CUSBOTGCONNECTIONIDLEWATCHER_ENTRY_DUP1=0x35e
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGCONNECTIONIDLEWATCHER_CUSBOTGCONNECTIONIDLEWATCHER_EXIT=0x35b
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGCONNECTIONIDLEWATCHER_CUSBOTGCONNECTIONIDLEWATCHER_EXIT_DUP1=0x35f
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGCONNECTIONIDLEWATCHER_DOCANCEL_ENTRY=0x606
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGCONNECTIONIDLEWATCHER_DOCANCEL_EXIT=0x607
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGCONNECTIONIDLEWATCHER_NEWL_ENTRY=0x5fc
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGCONNECTIONIDLEWATCHER_NEWL_EXIT=0x5fd
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGCONNECTIONIDLEWATCHER_POST_ENTRY=0x608
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGCONNECTIONIDLEWATCHER_POST_EXIT=0x609
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGCONNECTIONIDLEWATCHER_RUNL_ENTRY=0x604
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGCONNECTIONIDLEWATCHER_RUNL_EXIT=0x605
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGEVENTWATCHER_CONSTRUCTL_ENTRY=0x5dc
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGEVENTWATCHER_CONSTRUCTL_EXIT=0x5dd
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGEVENTWATCHER_CUSBOTGEVENTWATCHER_CONS_ENTRY=0x5de
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGEVENTWATCHER_CUSBOTGEVENTWATCHER_CONS_EXIT=0x5df
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGEVENTWATCHER_CUSBOTGEVENTWATCHER_DES_ENTRY=0x5da
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGEVENTWATCHER_CUSBOTGEVENTWATCHER_DES_EXIT=0x5db
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGEVENTWATCHER_CUSBOTGEVENTWATCHER_ENTRY=0x336
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGEVENTWATCHER_CUSBOTGEVENTWATCHER_ENTRY_DUP1=0x33a
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGEVENTWATCHER_CUSBOTGEVENTWATCHER_EXIT=0x337
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGEVENTWATCHER_CUSBOTGEVENTWATCHER_EXIT_DUP1=0x33b
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGEVENTWATCHER_DOCANCEL_ENTRY=0x5e2
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGEVENTWATCHER_DOCANCEL_EXIT=0x5e3
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGEVENTWATCHER_NEWL_ENTRY=0x5d8
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGEVENTWATCHER_NEWL_EXIT=0x5d9
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGEVENTWATCHER_POST_ENTRY=0x5e4
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGEVENTWATCHER_POST_EXIT=0x5e5
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGEVENTWATCHER_RUNL_ENTRY=0x5e0
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGEVENTWATCHER_RUNL_EXIT=0x5e1
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGIDPINWATCHER_CONSTRUCTL_ENTRY=0x5b2
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGIDPINWATCHER_CONSTRUCTL_EXIT=0x5b3
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGIDPINWATCHER_CUSBOTGIDPINWATCHER_CONS_ENTRY=0x5b4
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGIDPINWATCHER_CUSBOTGIDPINWATCHER_CONS_EXIT=0x5b5
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGIDPINWATCHER_CUSBOTGIDPINWATCHER_DES_ENTRY=0x5b0
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGIDPINWATCHER_CUSBOTGIDPINWATCHER_DES_EXIT=0x5b1
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGIDPINWATCHER_CUSBOTGIDPINWATCHER_ENTRY=0x30c
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGIDPINWATCHER_CUSBOTGIDPINWATCHER_ENTRY_DUP1=0x310
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGIDPINWATCHER_CUSBOTGIDPINWATCHER_EXIT=0x30d
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGIDPINWATCHER_CUSBOTGIDPINWATCHER_EXIT_DUP1=0x311
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGIDPINWATCHER_DOCANCEL_ENTRY=0x5b8
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGIDPINWATCHER_DOCANCEL_EXIT=0x5b9
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGIDPINWATCHER_NEWL_ENTRY=0x5ae
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGIDPINWATCHER_NEWL_EXIT=0x5af
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGIDPINWATCHER_POST_ENTRY=0x5ba
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGIDPINWATCHER_POST_EXIT=0x5bb
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGIDPINWATCHER_RUNL_ENTRY=0x5b6
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGIDPINWATCHER_RUNL_EXIT=0x5b7
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGSTATEWATCHER_CONSTRUCTL_ENTRY=0x5ce
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGSTATEWATCHER_CONSTRUCTL_EXIT=0x5cf
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGSTATEWATCHER_CUSBOTGSTATEWATCHER_CONS_ENTRY=0x5d0
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGSTATEWATCHER_CUSBOTGSTATEWATCHER_CONS_EXIT=0x5d1
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGSTATEWATCHER_CUSBOTGSTATEWATCHER_DES_ENTRY=0x5cc
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGSTATEWATCHER_CUSBOTGSTATEWATCHER_DES_EXIT=0x5cd
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGSTATEWATCHER_CUSBOTGSTATEWATCHER_ENTRY=0x328
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGSTATEWATCHER_CUSBOTGSTATEWATCHER_EXIT=0x329
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGSTATEWATCHER_DOCANCEL_ENTRY=0x5d4
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGSTATEWATCHER_DOCANCEL_EXIT=0x5d5
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGSTATEWATCHER_NEWL_ENTRY=0x5ca
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGSTATEWATCHER_NEWL_EXIT=0x5cb
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGSTATEWATCHER_POST_ENTRY=0x5d6
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGSTATEWATCHER_POST_EXIT=0x5d7
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGSTATEWATCHER_RUNL_ENTRY=0x5d2
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGSTATEWATCHER_RUNL_EXIT=0x5d3
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGVBUSWATCHER_CONSTRUCTL_ENTRY=0x5c0
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGVBUSWATCHER_CONSTRUCTL_EXIT=0x5c1
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGVBUSWATCHER_CUSBOTGVBUSWATCHER_CONS_ENTRY=0x5c2
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGVBUSWATCHER_CUSBOTGVBUSWATCHER_CONS_EXIT=0x5c3
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGVBUSWATCHER_CUSBOTGVBUSWATCHER_DES_ENTRY=0x5be
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGVBUSWATCHER_CUSBOTGVBUSWATCHER_DES_EXIT=0x5bf
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGVBUSWATCHER_CUSBOTGVBUSWATCHER_ENTRY=0x31a
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGVBUSWATCHER_CUSBOTGVBUSWATCHER_ENTRY_DUP1=0x31e
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGVBUSWATCHER_CUSBOTGVBUSWATCHER_EXIT=0x31b
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGVBUSWATCHER_CUSBOTGVBUSWATCHER_EXIT_DUP1=0x31f
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGVBUSWATCHER_DOCANCEL_ENTRY=0x5c6
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGVBUSWATCHER_DOCANCEL_EXIT=0x5c7
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGVBUSWATCHER_NEWL_ENTRY=0x5bc
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGVBUSWATCHER_NEWL_EXIT=0x5bd
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGVBUSWATCHER_POST_ENTRY=0x5c8
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGVBUSWATCHER_POST_EXIT=0x5c9
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGVBUSWATCHER_RUNL_ENTRY=0x5c4
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGVBUSWATCHER_RUNL_EXIT=0x5c5
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGWATCHER_CUSBOTGWATCHER_CONS_ENTRY=0x5e9
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGWATCHER_CUSBOTGWATCHER_CONS_EXIT=0x5ea
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGWATCHER_CUSBOTGWATCHER_DES_ENTRY=0x5e8
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGWATCHER_CUSBOTGWATCHER_ENTRY=0x344
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGWATCHER_CUSBOTGWATCHER_ENTRY_DUP1=0x345
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGWATCHER_CUSBOTGWATCHER_EXIT_DUP1=0x346
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGWATCHER_DOCANCEL_ENTRY=0x5ee
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGWATCHER_DOCANCEL_EXIT=0x5ef
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGWATCHER_NEWL_ENTRY=0x5e6
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGWATCHER_NEWL_EXIT=0x5e7
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGWATCHER_POST_ENTRY=0x5f2
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGWATCHER_POST_EXIT=0x5f3
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGWATCHER_RUNL_ENTRY=0x5eb
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGWATCHER_RUNL_EXIT=0x5ec
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGWATCHER_RUNL_EXIT_DUP1=0x5ed
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGWATCHER_START_ENTRY=0x5f0
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTGWATCHER_START_EXIT=0x5f1
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTG_BUSCLEARERROR_ENTRY=0x572
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTG_BUSDROP_ENTRY=0x573
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTG_BUSREQUEST_ENTRY=0x570
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTG_BUSRESPONDSRP_ENTRY=0x571
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTG_CONSTRUCTL_ENTRY=0x566
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTG_CONSTRUCTL_EXIT=0x567
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTG_CUSBOTG_CONS_ENTRY=0x564
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTG_CUSBOTG_CONS_EXIT=0x565
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTG_CUSBOTG_DES_ENTRY=0x562
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTG_CUSBOTG_DES_EXIT=0x563
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTG_CUSBOTG_ENTRY=0x2be
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTG_CUSBOTG_ENTRY_DUP1=0x2c0
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTG_CUSBOTG_ENTRY_DUP1_EXIT=0x2c1
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTG_CUSBOTG_EXIT=0x2bf
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTG_DEREGISTEROBSERVER_ENTRY=0x56a
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTG_DEREGISTEROBSERVER_EXIT=0x56b
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTG_NEWL_ENTRY=0x560
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTG_NEWL_EXIT=0x561
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTG_REGISTEROBSERVERL_ENTRY=0x568
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTG_REGISTEROBSERVERL_EXIT=0x569
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTG_STARTL_ENTRY=0x56c
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTG_STARTL_EXIT=0x56d
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTG_STOP_ENTRY=0x56e
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBOTG_STOP_EXIT=0x56f
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBSERVER_CUSBSERVER_ENTRY=0x15e
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBSERVER_CUSBSERVER_EXIT=0x15f
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_GETDETAILEDDESCRIPTION_ENTRY=0x26e
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_GETDETAILEDDESCRIPTION_EXIT=0x26f
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_GETDETAILEDDESCRIPTION_EXIT_DUP1=0x270
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_GETDETAILEDDESCRIPTION_EXIT_DUP2=0x271
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_CUSBSESSION_GETPERSONALITYPROPERTY_EXIT_DUP1=0x274
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_DUP1_CUSBDEVICE_GETPERSONALITY_EXIT=0x20b
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_DUP1_CUSBDEVICE_READPERSONALITIESL_EXIT=0x216
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_DUP1_CUSBOTGSTATEWATCHER_CUSBOTGSTATEWATCHER_ENTRY=0x32c
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_DUP1_CUSBOTGSTATEWATCHER_CUSBOTGSTATEWATCHER_EXIT=0x32d
+[[OBSOLETE]][TRACE]TRACE_FLOW[0x8A]_DUP2_CUSBDEVICE_READPERSONALITIESL_EXIT=0x217
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CINIFILE_CONSTRUCTL=0x361
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CINIFILE_CONSTRUCTL_DUP1=0x362
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CINIFILE_CONSTRUCTL_DUP2=0x363
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CINIFILE_CONSTRUCTL_DUP3=0x364
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CINIFILE_CONSTRUCTL_DUP4=0x365
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CINIFILE_PANIC=0x360
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CREQUESTSESSIONWATCHER_RUNL=0x3bd
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CREQUESTSESSIONWATCHER_RUNL_DUP1=0x34c
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_BUSENUMERATIONCOMPLETED=0x52
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_BUSENUMERATIONFAILED=0x53
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_BUSENUMERATIONFAILED_DUP1=0x54
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CONSTRUCTL=0x46
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CONSTRUCTL_DUP1=0xc0
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CONSTRUCTL_DUP2=0x48
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CONSTRUCTL_DUP3=0x49
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CONSTRUCTL_DUP4=0x4a
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CONSTRUCTL_DUP5=0x4b
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CONSTRUCTL_DUP6=0x4c
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CONSTRUCTL_DUP7=0x4d
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CONSTRUCTL_DUP8=0x4e
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CONVERTUIDSL=0x18b
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CUSBDEVICE=0x42
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CUSBDEVICE_DUP1=0x43
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CUSBDEVICE_DUP2=0x44
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_CUSBDEVICE_DUP3=0x45
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_DOCANCEL=0x17d
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_INSTANTIATEEXTENSIONPLUGINSL_DUP1=0x4f
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_POWERUPANDCONNECT=0x55
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_POWERUPANDCONNECT_DUP1=0x56
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_POWERUPANDCONNECT_DUP2=0x57
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_PRINTDESCRIPTOR=0xd6
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_PRINTDESCRIPTOR_DUP1=0x13a
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_PRINTDESCRIPTOR_DUP10=0x143
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_PRINTDESCRIPTOR_DUP11=0x144
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_PRINTDESCRIPTOR_DUP12=0x145
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_PRINTDESCRIPTOR_DUP2=0x13b
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_PRINTDESCRIPTOR_DUP3=0x13c
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_PRINTDESCRIPTOR_DUP4=0x13d
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_PRINTDESCRIPTOR_DUP5=0x13e
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_PRINTDESCRIPTOR_DUP6=0x13f
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_PRINTDESCRIPTOR_DUP7=0x140
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_PRINTDESCRIPTOR_DUP8=0x141
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_PRINTDESCRIPTOR_DUP9=0x142
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_READPERSONALITIESL=0x156
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_READPERSONALITIESL_DUP1=0x159
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_READPERSONALITIESL_DUP10=0x162
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_READPERSONALITIESL_DUP11=0x163
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_READPERSONALITIESL_DUP12=0x164
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_READPERSONALITIESL_DUP13=0x165
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_READPERSONALITIESL_DUP14=0x166
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_READPERSONALITIESL_DUP15=0x167
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_READPERSONALITIESL_DUP16=0x168
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_READPERSONALITIESL_DUP17=0x169
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_READPERSONALITIESL_DUP18=0x16a
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_READPERSONALITIESL_DUP19=0x16b
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_READPERSONALITIESL_DUP2=0x15a
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_READPERSONALITIESL_DUP20=0x16c
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_READPERSONALITIESL_DUP21=0x16d
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_READPERSONALITIESL_DUP22=0x1a2
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_READPERSONALITIESL_DUP23=0x1a3
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_READPERSONALITIESL_DUP24=0x1a4
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_READPERSONALITIESL_DUP3=0x15b
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_READPERSONALITIESL_DUP4=0x15c
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_READPERSONALITIESL_DUP5=0x15d
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_READPERSONALITIESL_DUP6=0x15e
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_READPERSONALITIESL_DUP7=0x15f
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_READPERSONALITIESL_DUP8=0x160
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_READPERSONALITIESL_DUP9=0x161
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_RESOURCEFILENAMEL=0x191
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_RUNERROR=0x5c
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_RUNERROR_DUP1=0x195
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_RUNL=0x58
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_RUNL_DUP1=0x59
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_RUNL_DUP2=0x5a
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_RUNL_DUP3=0x5b
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_RUNL_DUP5=0x194
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_SETDEVICESTATE=0x51
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_SETSERVICESTATE=0x50
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_SETUSBDEVICESETTINGSL=0x149
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_SETUSBDEVICESETTINGSL_DUP1=0x14a
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_SETUSBDEVICESETTINGSL_DUP10=0x19b
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_SETUSBDEVICESETTINGSL_DUP11=0x196
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_SETUSBDEVICESETTINGSL_DUP12=0x19a
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_SETUSBDEVICESETTINGSL_DUP2=0x14b
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_SETUSBDEVICESETTINGSL_DUP3=0x14c
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_SETUSBDEVICESETTINGSL_DUP4=0x14d
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_SETUSBDEVICESETTINGSL_DUP5=0x14e
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_SETUSBDEVICESETTINGSL_DUP6=0x14f
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_SETUSBDEVICESETTINGSL_DUP7=0x197
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_SETUSBDEVICESETTINGSL_DUP8=0x198
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDEVICE_SETUSBDEVICESETTINGSL_DUP9=0x199
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_CONSTRUCTL=0x260
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_DOCANCEL=0x280
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_DOCANCEL_DUP1=0x281
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_DOCANCEL_DUP2=0x282
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_DOCANCEL_DUP3=0x283
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_DOCANCEL_DUP4=0x284
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR=0x366
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP1=0x367
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP2=0x263
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP3=0x368
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP4=0x265
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP5=0x369
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP6=0x267
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP7=0x36a
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP8=0x269
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_GETCONFIG=0x36b
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP1=0x36c
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP2=0x36d
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP3=0x36e
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP4=0x36f
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP5=0x370
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP6=0x371
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP7=0x26a
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_RUNERROR=0x285
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_RUNL=0x372
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_RUNL_DUP1=0x27b
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_RUNL_DUP2=0x27c
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_RUNL_DUP3=0x27d
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_RUNL_DUP4=0x27e
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_RUNL_DUP5=0x27f
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_START=0x272
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_START_DUP1=0x273
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_START_DUP2=0x274
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_START_DUP3=0x275
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_STOP=0x276
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_STOP_DUP1=0x277
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_STOP_DUP2=0x278
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBDUMMYCLASSCONTROLLER_STOP_DUP3=0x279
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBHOST_DEREGISTEROBSERVER=0x38e
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBHOST_NOTIFYHOSTEVENT=0x38f
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBHOST_NOTIFYHOSTEVENT_DUP1=0x390
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBHOST_NOTIFYHOSTEVENT_DUP2=0x391
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBHOST_NOTIFYHOSTEVENT_DUP3=0x392
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBHOST_NOTIFYHOSTEVENT_DUP4=0x393
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBHOST_NOTIFYHOSTEVENT_DUP5=0x394
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBHOST_STARTL=0x38d
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGCONNECTIONIDLEWATCHER_POST=0x3c0
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGCONNECTIONIDLEWATCHER_POST_DUP1=0x3c1
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGCONNECTIONIDLEWATCHER_POST_DUP2=0x3c2
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGCONNECTIONIDLEWATCHER_POST_DUP3=0x3c3
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGCONNECTIONIDLEWATCHER_RUNL=0x3be
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGCONNECTIONIDLEWATCHER_RUNL_DUP1=0x3bf
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGEVENTWATCHER_LOGEVENTTEXT=0x3ae
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGEVENTWATCHER_LOGEVENTTEXT_DUP1=0x3af
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGEVENTWATCHER_LOGEVENTTEXT_DUP10=0x3b8
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGEVENTWATCHER_LOGEVENTTEXT_DUP2=0x3b0
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGEVENTWATCHER_LOGEVENTTEXT_DUP3=0x3b1
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGEVENTWATCHER_LOGEVENTTEXT_DUP4=0x3b2
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGEVENTWATCHER_LOGEVENTTEXT_DUP5=0x3b3
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGEVENTWATCHER_LOGEVENTTEXT_DUP6=0x3b4
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGEVENTWATCHER_LOGEVENTTEXT_DUP7=0x3b5
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGEVENTWATCHER_LOGEVENTTEXT_DUP8=0x3b6
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGEVENTWATCHER_LOGEVENTTEXT_DUP9=0x3b7
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGEVENTWATCHER_POST=0x3b9
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGEVENTWATCHER_RUNL=0x3aa
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGEVENTWATCHER_RUNL_DUP1=0x3ac
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGEVENTWATCHER_RUNL_DUP2=0x3ad
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGEVENTWATCHER_RUNL_DUP3=0x3ab
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGIDPINWATCHER_POST=0x397
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGIDPINWATCHER_POST_DUP1=0x398
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGIDPINWATCHER_POST_DUP2=0x399
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGIDPINWATCHER_POST_DUP3=0x39a
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGIDPINWATCHER_POST_DUP4=0x39b
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGIDPINWATCHER_POST_DUP5=0x39c
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGIDPINWATCHER_RUNL=0x395
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGIDPINWATCHER_RUNL_DUP1=0x396
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGSTATEWATCHER_POST=0x3a7
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGSTATEWATCHER_POST_DUP1=0x3a8
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGSTATEWATCHER_POST_DUP2=0x3a9
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGSTATEWATCHER_RUNL=0x3a5
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGSTATEWATCHER_RUNL_DUP1=0x3a6
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGVBUSWATCHER_POST=0x39f
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGVBUSWATCHER_POST_DUP1=0x3a0
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGVBUSWATCHER_POST_DUP2=0x3a1
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGVBUSWATCHER_POST_DUP3=0x3a2
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGVBUSWATCHER_POST_DUP4=0x3a3
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGVBUSWATCHER_POST_DUP5=0x3a4
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGVBUSWATCHER_RUNL=0x39d
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGVBUSWATCHER_RUNL_DUP1=0x39e
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGWATCHER_POST=0x3bc
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGWATCHER_RUNL=0x3ba
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTGWATCHER_RUNL_DUP1=0x3bb
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTG_CONSTRUCTL=0x382
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTG_CONSTRUCTL_DUP1=0x383
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTG_CONSTRUCTL_DUP2=0x386
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTG_CONSTRUCTL_DUP3=0x384
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTG_CONSTRUCTL_DUP4=0x385
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTG_CONSTRUCTL_DUP5=0x387
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTG_CONSTRUCTL_DUP6=0x388
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTG_CUSBOTG=0x373
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTG_CUSBOTG_DUP1=0x374
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTG_CUSBOTG_DUP10=0x37d
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTG_CUSBOTG_DUP11=0x37e
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTG_CUSBOTG_DUP12=0x37f
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTG_CUSBOTG_DUP13=0x380
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTG_CUSBOTG_DUP14=0x381
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTG_CUSBOTG_DUP2=0x375
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTG_CUSBOTG_DUP3=0x376
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTG_CUSBOTG_DUP4=0x377
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTG_CUSBOTG_DUP5=0x378
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTG_CUSBOTG_DUP6=0x379
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTG_CUSBOTG_DUP7=0x37a
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTG_CUSBOTG_DUP8=0x37b
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTG_CUSBOTG_DUP9=0x37c
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTG_NOTIFYOTGEVENT=0x389
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTG_REGISTEROBSERVERL=0x38a
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTG_STOP=0x38b
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBOTG_STOP_DUP1=0x38c
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBSERVER_DECREMENTSESSIONCOUNT_DUP1=0x136
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBSERVER_INCREMENTSESSIONCOUNT_DUP1=0x134
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBSERVER_LAUNCHSHUTDOWNTIMERIFNOSESSIONS=0x137
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBSESSION_GETMANUFACTURERSTRINGDESCRIPTOR_DUP1=0x1d1
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP1_CUSBDEVICE_CONSTRUCTL=0x173
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP1_CUSBDEVICE_CONVERTUIDSL=0x18c
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP1_CUSBDEVICE_CREATECLASSCONTROLLERSL=0x190
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP1_CUSBDEVICE_ENUMERATECLASSCONTROLLERSL=0x177
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP1_CUSBDEVICE_READPERSONALITIESL=0x18d
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP1_CUSBDEVICE_RUNERROR=0x17e
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP1_CUSBDEVICE_RUNL=0x17b
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP1_CUSBDEVICE_SETUSBDEVICESETTINGSFROMPERSONALITYL=0x185
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP1_CUSBDEVICE_SETUSBDEVICESETTINGSL=0x17f
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP1_CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR=0x91
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP1_CUSBDUMMYCLASSCONTROLLER_RUNL=0xac
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP1_CUSBMANCENREPMANAGER_READKEYL=0x3ca
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP1_CUSBOTGCONNECTIONIDLEWATCHER_POST_DUP1=0x258
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP1_CUSBOTG_CONSTRUCTL=0x21e
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP1_CUSBOTG_CUSBOTG=0x28
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP1_CUSBSESSION_CUSBSESSION=0x1d3
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP1_CUSBSESSION_DISPATCHMESSAGEL=0x1cf
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP1_CUSBSESSION_GETMANUFACTURERSTRINGDESCRIPTOR=0x1da
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP1_CUSBSESSION_GETSUPPORTEDCLASSES=0x1bd
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP2_CUSBDEVICE_READPERSONALITIESL=0x18e
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP2_CUSBDEVICE_RUNL=0x17c
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP2_CUSBDEVICE_SETUSBDEVICESETTINGSFROMPERSONALITYL=0x186
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP2_CUSBDEVICE_SETUSBDEVICESETTINGSL=0x180
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP2_CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR=0x92
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP2_CUSBDUMMYCLASSCONTROLLER_RUNL=0xad
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP2_CUSBSESSION_CUSBSESSION=0x1d4
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP3_CUSBDEVICE_READPERSONALITIESL=0x18f
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP3_CUSBDEVICE_SETUSBDEVICESETTINGSFROMPERSONALITYL=0x187
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP3_CUSBDEVICE_SETUSBDEVICESETTINGSL=0x181
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP3_CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR=0x93
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP3_CUSBDUMMYCLASSCONTROLLER_RUNL=0xae
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP4_CUSBDEVICE_SETUSBDEVICESETTINGSFROMPERSONALITYL=0x189
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP4_CUSBDEVICE_SETUSBDEVICESETTINGSL=0x182
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP5_CUSBDEVICE_SETUSBDEVICESETTINGSFROMPERSONALITYL=0x188
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP5_CUSBDEVICE_SETUSBDEVICESETTINGSL=0x183
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_DUP6_CUSBDEVICE_SETUSBDEVICESETTINGSL=0x184
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]__RUNSERVERL=0x8e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrautotest/TestExecute/USB/ncm_unit_test/ncmcctest/dummy_ncminternalsrv/group/bld.inf	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This material, including documentation and any related 
+ * computer programs, is protected by copyright controlled by 
+ * Nokia. All rights are reserved. Copying, including 
+ * reproducing, storing, adapting or translating, any 
+ * or all of this material requires the prior written consent of 
+ * Nokia. This material also contains confidential 
+ * information which may not be disclosed to others without the 
+ * prior written consent of Nokia.
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  
+ *  
+ */
+
+PRJ_PLATFORMS
+ARMV5  winscw
+
+PRJ_TESTEXPORTS
+../inc/dummy_ncminternalsrv.h  SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(usb/testncmcc/dummy_ncminternalsrv.h)
+
+PRJ_TESTMMPFILES
+dummy_ncminternalsrv.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrautotest/TestExecute/USB/ncm_unit_test/ncmcctest/dummy_ncminternalsrv/group/dummy_ncminternalsrv.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This material, including documentation and any related 
+ * computer programs, is protected by copyright controlled by 
+ * Nokia. All rights are reserved. Copying, including 
+ * reproducing, storing, adapting or translating, any 
+ * or all of this material requires the prior written consent of 
+ * Nokia. This material also contains confidential 
+ * information which may not be disclosed to others without the 
+ * prior written consent of Nokia.
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  
+ *
+ */
+
+TARGET dummy_ncminternalsrv.dll
+TARGETTYPE DLL
+
+UID 0x1000008d 0x2002EA86
+VENDORID 0x70000001
+
+// Being run in usbsvr.exe(usbman)
+CAPABILITY CommDD PowerMgmt TrustedUI ProtServ NetworkControl NetworkServices LocalServices ReadUserData WriteUserData ReadDeviceData WriteDeviceData 
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+SOURCEPATH    ../src
+
+LIBRARY       euser.lib
+
+SOURCE dummy_ncminternalsrv.cpp
+
+USERINCLUDE ../inc ../../inc
--- a/usbmgmt/usbmgrtest/ObexClassController/ObexUsbClassController/ObexClassController/group/CUsbObexClassController.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/ObexClassController/ObexUsbClassController/ObexClassController/group/CUsbObexClassController.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2005-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"
@@ -42,11 +42,6 @@
 target obexclasscontroller.rsc
 END
 
-START RESOURCE obexusbman.rss
-TARGETPATH /private/101fe1db
-HEADER
-END
-
 LIBRARY			classcontrollerclientsession.lib
 LIBRARY			euser.lib 
 LIBRARY			usbclasscontroller.lib
--- a/usbmgmt/usbmgrtest/ObexClassController/ObexUsbClassController/ObexClassController/group/bld.inf	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/ObexClassController/ObexUsbClassController/ObexClassController/group/bld.inf	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2005-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"
@@ -20,3 +20,6 @@
 
 PRJ_TESTMMPFILES
 CUsbObexClassController.mmp
+
+PRJ_TESTEXPORTS
+../conf/obexusbman_101fe1db.txt  			/epoc32/data/z/private/10202be9/obexusbman_101fe1db.txt
--- a/usbmgmt/usbmgrtest/ObexClassController/ObexUsbClassController/ObexClassController/src/obexusbman.rss	Thu Jul 15 20:42:20 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +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.
-* This file is needed when implementing Obex over USB.
-* This file needs to be placed in usbman\src\ and a new build needs 
-* to be made.
-*
-*/
-
-/**
- @file
-*/
-
-NAME USBM
-
-#include <badef.rh>
-#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"
-#endif      
-
-RESOURCE BA_RSS_SIGNATURE
-	{
-	signature = 1;
-	}
-
-RESOURCE usb_configuration usb_config
-	{
-	}
-	
-		
-RESOURCE PERSONALITY_ARRAY device_personalities
-	{
-	personalities = 
-		{
-		PERSONALITY
-			{
-			bDeviceClass = 02;
-			bDeviceSubClass = 0;
-			protocol = 0;
-			numConfigurations = 1;
-			vendorId = 0x0e22;
-			productId = 0x000c;
-			bcdDevice = 0;
-			manufacturer = per_manufacturer1;
-			product = per_product1;
-			id = 1;					
-			class_uids = "101fbf24, 10274339";    			
-			description = per_description1;
-			}
-		};
-	}
-			
--- a/usbmgmt/usbmgrtest/ObexClassController/test/src/simpleObexApp.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/ObexClassController/test/src/simpleObexApp.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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); 
--- a/usbmgmt/usbmgrtest/ObexClassController/test/src/simpleObexClient.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/ObexClassController/test/src/simpleObexClient.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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();
 	
--- a/usbmgmt/usbmgrtest/ObexClassController/test/src/simpleObexServer.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/ObexClassController/test/src/simpleObexServer.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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)); 
 			
--- a/usbmgmt/usbmgrtest/csy/t_ecacm/src/t_csyaccess.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/csy/t_ecacm/src/t_csyaccess.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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.
 		{
--- a/usbmgmt/usbmgrtest/t_acm/src/t_acm.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_acm/src/t_acm.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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();
--- a/usbmgmt/usbmgrtest/t_acm_cc/src/t_acm_cc.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_acm_cc/src/t_acm_cc.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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)
 	{
--- a/usbmgmt/usbmgrtest/t_acm_pub_sub/src/t_acm_pub_sub.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_acm_pub_sub/src/t_acm_pub_sub.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -344,7 +344,7 @@
     }
     
     //Connect to the file server
-    gFs.Connect();
+    User::LeaveIfError(gFs.Connect());
     TInt result = KErrNone;
     TRAPD(error, result = TestCase1L());
     if(error)
--- a/usbmgmt/usbmgrtest/t_acm_spec/src/t_acm_spec.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_acm_spec/src/t_acm_spec.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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();
--- a/usbmgmt/usbmgrtest/t_acm_wins/src/t_acm_wins.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_acm_wins/src/t_acm_wins.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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): "));
 
--- a/usbmgmt/usbmgrtest/t_catc/src/t_catc.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_catc/src/t_catc.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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<KChunkSize> 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<uInBufSize> 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;
--- a/usbmgmt/usbmgrtest/t_charging_arm/group/t_usbchargingarm.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_charging_arm/group/t_usbchargingarm.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -51,4 +51,3 @@
 // -- Add specific libraries here
 LIBRARY			centralrepository.lib
 
-#include <usb/usblogger.mmh>
--- a/usbmgmt/usbmgrtest/t_charging_emu/group/TestPlugin.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_charging_emu/group/TestPlugin.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2005-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"
@@ -47,13 +47,13 @@
 USERINCLUDE		../inc ../../../usbmgr/usbman/chargingplugin/inc
 USERINCLUDE		../../../usbmgr/usbman/chargingplugin/inc/default
 USERINCLUDE		../../../usbmgr/usbman/chargingplugin/public
+USERINCLUDE     ../traces
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
 LIBRARY 		euser.lib 
 LIBRARY 		usbmanextensionplugin.lib 
 LIBRARY			centralrepository.lib
 
-#include <usb/usblogger.mmh>
 
 library	flogger.lib
 
--- a/usbmgmt/usbmgrtest/t_charging_emu/group/TestPluginotg.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_charging_emu/group/TestPluginotg.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -47,16 +47,17 @@
 target usbbatterychargingtestpluginotg.rsc
 END
 
-USERINCLUDE		../inc ../../../usbmgr/usbman/chargingplugin/inc
+USERINCLUDE		../inc 
+USERINCLUDE     ../../../usbmgr/usbman/chargingplugin/inc
 USERINCLUDE		../../../usbmgr/usbman/chargingplugin/inc/default
 USERINCLUDE		../../../usbmgr/usbman/chargingplugin/public
+USERINCLUDE		../traces
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
 LIBRARY 		euser.lib 
 LIBRARY 		usbmanextensionplugin.lib 
 LIBRARY			centralrepository.lib
 
-#include <usb/usblogger.mmh>
 
 library	flogger.lib
 
--- a/usbmgmt/usbmgrtest/t_charging_emu/inc/dummyldd.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_charging_emu/inc/dummyldd.h	Tue Aug 31 17:01:47 2010 +0300
@@ -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;
 	}
 
--- a/usbmgmt/usbmgrtest/t_charging_emu/inc/tbatterycharging.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_charging_emu/inc/tbatterycharging.h	Tue Aug 31 17:01:47 2010 +0300
@@ -120,7 +120,6 @@
 
 	RTest iTest;
 	RTimer iTimer;
-	//CRepository* iRepository;
 
 	TPtr8 iPtr; // data file
 	TPtr8 iLine; // current line
--- a/usbmgmt/usbmgrtest/t_charging_emu/inc/tpropertybatterycharging.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_charging_emu/inc/tpropertybatterycharging.h	Tue Aug 31 17:01:47 2010 +0300
@@ -56,9 +56,7 @@
 	CActivePropertyReadChargingCurrent* iActiveReadChargingCurrent;
 	CRepository* iRepository;
 	
-	//RProperty iPropertyWrittenToRepositoryAck;
-	//RProperty iPropertyReadChargingCurrentAck;
 	RProperty iProperty; // only one protected needed ?
 	
 	
-	};
\ No newline at end of file
+	};
--- a/usbmgmt/usbmgrtest/t_charging_emu/src/1020DEA7.rss	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_charging_emu/src/1020DEA7.rss	Tue Aug 31 17:01:47 2010 +0300
@@ -29,7 +29,7 @@
 		{
 		INTERFACE_INFO
 			{
-			interface_uid = 0x10208DD6;
+			interface_uid = 0xE0208DD6;
 			implementations =
 				{
 				IMPLEMENTATION_INFO
--- a/usbmgmt/usbmgrtest/t_charging_emu/src/CUsbBatteryChargingTestPlugin.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_charging_emu/src/CUsbBatteryChargingTestPlugin.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -31,6 +31,11 @@
 #include <dummyldd.h>
 #define __D32USBC_H__ // ensure that d32usbc is ignored, and dummyldd used instead
 #include "CUsbBatteryChargingTestPlugin.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "CUsbBatteryChargingTestPluginTraces.h"
+#endif
+
 
 // Define the private interface UIDs
 const TImplementationProxy ImplementationTable[] =
@@ -47,8 +52,8 @@
 
 CUsbBatteryChargingTestPlugin* CUsbBatteryChargingTestPlugin::NewL(MUsbmanExtensionPluginObserver& aObserver)
 	{
-	LOGTEXT(_L8("NewL Test plug-n"));
-
+    OstTrace0( TRACE_NORMAL, CUSBBATTERYCHARGINGTESTPLUGIN_NEWL, _L8("NewL Test plug-n"));
+    
 	CUsbBatteryChargingTestPlugin* self = new(ELeave) CUsbBatteryChargingTestPlugin(aObserver);
 	CleanupStack::PushL(self);
 	self->ConstructL();
--- a/usbmgmt/usbmgrtest/t_charging_emu/src/tbatterycharging.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_charging_emu/src/tbatterycharging.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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,7 +21,6 @@
 #include <e32svr.h>
 #include <e32base.h>
 #include <e32std.h>
-#include <usbman.rsg>
 #include <f32file.h>
 #include <barsc.h>
 #include <barsread.h>
@@ -129,7 +128,6 @@
 	iPlugin = iExtensionPlugins[0];
 
 	iDummyLdd.Initialise();
-	//iRepository = CRepository::NewL(KUsbBatteryChargingCentralRepositoryUid);
 	User::LeaveIfError(iTimer.CreateLocal());
 	
 	DefinePropertyL(KBattChargWriteRepositoryUid, KBattChargWriteRepositoryKey,RProperty::EInt);
@@ -346,7 +344,7 @@
 
 TInt CDummyUsbDevice::GetNextLine()
 	{
-	TInt newLineOffset = (iPtr.Mid(iFileOffset)).Locate(13);//Find(_L("\r\n"));
+	TInt newLineOffset = (iPtr.Mid(iFileOffset)).Locate(13);
 	if (newLineOffset < 0)
 		{
 		return newLineOffset;
@@ -427,7 +425,6 @@
 			{
 			TInt err = WriteToRepositoryProperty(iCommandValue);
 			
-			//TInt err = iRepository->Set(KUsbBatteryChargingKeyEnabledUserSetting, iCommandValue);
 			iTest(err == KErrNone);
 			}
 			break;
@@ -483,8 +480,6 @@
 			TInt current;			
 			TInt err = GetChargingCurrentFromProperty(current);
 			
-			//TInt err = RProperty::Get(KPropertyUidUsbBatteryChargingCategory,
-			//	KPropertyUidUsbBatteryChargingChargingCurrent, current);
 			iTest(err == KErrNone);
 			iTest(current == iCheckValue);
 			}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/t_charging_emu/traces/OstTraceDefinitions.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,7 @@
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <opensystemtrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/t_charging_emu/traces/fixed_id.definitions	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,3 @@
+#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt.
+[GROUP]TRACE_NORMAL=0x86
+[TRACE]TRACE_NORMAL[0x86]_CUSBBATTERYCHARGINGTESTPLUGIN_NEWL=0x1
--- a/usbmgmt/usbmgrtest/t_headlessecacm/group/t_headlessecacm.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_headlessecacm/group/t_headlessecacm.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -80,4 +80,3 @@
 // performance testing at the level of RDevUsbcClient.
 MACRO __HEADLESS_ACM_TEST_CODE__
 
-#include <usb/usblogger.mmh>
--- a/usbmgmt/usbmgrtest/t_multi_acm/src/t_multiple_acm.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_multi_acm/src/t_multiple_acm.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -33,7 +33,6 @@
 
 const TInt KReceiveBufferLength = 4096;
 const TInt KMaxAcmPortNameLength = 8;
-//_LIT(KUsbCsyName, "ECACM");
 _LIT(KUsbPortName, "ACM::0");
 _LIT(KUsbPortNameAcm1, "ACM::1");
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/t_ncm/group/bld.inf	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2002-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
+ */
+ 
+PRJ_PLATFORMS
+ARMV5 winscw
+
+PRJ_TESTEXPORTS
+ncmtestconsole.iby /epoc32/rom/include/ncmtestconsole.iby
+
+PRJ_TESTMMPFILES
+ncmtestconsole.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/t_ncm/group/ncmtestconsole.iby	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2002-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
+ */
+
+#ifndef NCM_TEST_CONSOLE_IBY
+#define NCM_TEST_CONSOLE_IBY
+
+
+#ifdef _DEBUG
+file= ABI_DIR\DEBUG_DIR\ncmtestconsole.exe sys\bin\ncmtestconsole.exe
+#else
+file= ABI_DIR\BUILD_DIR\ncmtestconsole.exe sys\bin\ncmtestconsole.exe
+#endif
+
+#endif //NCM_TEST_CONSOLE_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/t_ncm/group/ncmtestconsole.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2002-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 ncmtestconsole.exe
+targettype exe
+UID			 0 0xE228E991
+
+capability All -Tcb
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+userinclude ../inc
+
+sourcepath ../src
+
+library euser.lib
+library usbman.lib
+library centralrepository.lib 
+library	esock.lib
+library	commdb.lib 
+library	insock.lib 
+library	esocksvr.lib 
+
+source ncmtestconsole.cpp commandengine.cpp devicewatcher.cpp servicewatcher.cpp 
+source exitcommand.cpp 
+source simpancommand.cpp
+source  setncmiapcommand.cpp tcptest.cpp tcpcommand.cpp
+source ncmwatcher.cpp 
+
+#include <usb/usblogger.mmh>
+#include <comms-infras/commsdebugutility.mmh>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/t_ncm/inc/commandengine.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2002-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
+ */
+
+
+#ifndef COMMANDENGINE_H
+#define COMMANDENGINE_H
+
+#include "ncmtestdefines.hrh"
+
+#include <e32base.h>
+#include <e32hashtab.h>
+
+#define COMMAND_MAX_COUNT_PER_PAGE NUM_EVENT_ON_SCREEN
+#define COMMAND_MAX_PAGE 9
+
+class CUsbNcmConsole;
+
+NONSHARABLE_CLASS(CNcmCommandBase) : public CActive
+/**
+ The CNcmCommandBase class is the base class of command classes
+ */
+    {
+    friend class CNcmCommandEngine;
+public:
+    virtual ~CNcmCommandBase();
+
+    //Set the command key
+    void SetKey(TUint aKey);
+    //Get the command key
+    TUint Key() const;
+
+    //The command action when user choose a command. It must be implemneted by command classes.
+    virtual void DoCommandL() = 0;
+
+    //Set the command description. which will be displayed in command help.
+    void SetDescription(const TDesC& aDescription);
+    const virtual TDesC& Description();
+
+protected:
+    CNcmCommandBase(TInt aPriority, CUsbNcmConsole& aConsole, TUint aKey);
+
+protected:
+    //From CActive
+    virtual void DoCancel();
+    virtual void RunL();
+
+protected:
+    //Main console
+    CUsbNcmConsole& iTestConsole;
+
+    //The character which indicates the command
+    TUint iKey;
+    //The command's description
+    TBuf<NUM_CHARACTERS_ON_LINE> iDescription;
+
+    };
+
+NONSHARABLE_CLASS(CNcmCommandEngine) : public CActive
+/**
+ CNcmCommandEngine manages all command classes.
+ */
+    {
+public:
+    static CNcmCommandEngine* NewL(CUsbNcmConsole& aUsb);
+    ~CNcmCommandEngine();
+
+    //Add command to command engine.
+    void RegisterCommand(CNcmCommandBase* aCommand);
+    //Destroy all commands in command engine.
+    void RemoveAllCommand();
+
+    //Get command help info.
+    void PrintHelp(TInt aPage);
+
+private:
+    CNcmCommandEngine(CUsbNcmConsole& aUsb);
+    void ConstructL();
+
+    //From CActive
+    void DoCancel();
+    void RunL();
+    TInt RunError(TInt aError);
+
+private:
+    //Main console
+    CUsbNcmConsole& iTestConsole;
+
+    //The mapping of key and commands.
+    RHashMap<TUint, CNcmCommandBase*> iCommandMap;
+    //keep the key infomation, the command will be displayed in which page and which line.
+    TUint iCommandKeys[COMMAND_MAX_PAGE][COMMAND_MAX_COUNT_PER_PAGE];
+    //Indicate the page of the last command .
+    TInt iLastPage;
+    //Indicate the place of the last command in the last page.
+    TInt iLastItem;
+    //Indicate the rest lines in the last used page.
+    TInt iRemainLine;
+    };
+
+#endif // COMMANDENGINE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/t_ncm/inc/devicewatcher.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2002-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
+ */
+
+#ifndef DEVICEWATCHER_H
+#define DEVICEWATCHER_H
+
+#include <e32base.h>
+#include <d32usbc.h>
+
+class CUsbNcmConsole;
+
+//The mode of CDeviceWatcher
+enum TDeviceWatchMode
+	{
+	EWatchMode,				//Only monitor the device state
+	EWatchAndStartMode		//monitor the device state and start/stop NCM and NCM control app 
+							//when usb cable plugin/unplug
+	};
+
+NONSHARABLE_CLASS(CDeviceWatcher) : public CActive
+/**
+Monitor the USB device state.
+*/
+	{	
+public:
+	
+	static CDeviceWatcher* NewL(CUsbNcmConsole& aUsb);
+	~CDeviceWatcher();
+
+	void SetWatchMode(TDeviceWatchMode aWatchMode);
+	TDeviceWatchMode GetWatchMode() const;
+
+private:
+	CDeviceWatcher(CUsbNcmConsole& aUsb);
+	void ConstructL();
+	
+private:
+	//From CActive
+	void DoCancel();
+	void RunL();
+	TInt RunError(TInt aError);
+
+private:
+	void DisplayDeviceState(TUint aDeviceState);
+
+private:
+	//Main console
+	CUsbNcmConsole&  iTestConsole;
+	RDevUsbcClient iLdd;
+
+	//Usb device state
+	TUint		iDeviceState;
+	//Usb old device state
+	TUint		iOldDeviceState;
+	//Indicate whether start/stop behavior are used. ETrue means start/stop is needed.
+	TBool				iStartNcm;	
+	TDeviceWatchMode	iWatchMode;
+	};
+
+
+#endif //DEVICEWATCHER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/t_ncm/inc/exitcommand.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2002-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
+ */
+
+
+#ifndef EXITCOMMAND_H
+#define EXITCOMMAND_H
+
+#include "commandengine.h"
+
+NONSHARABLE_CLASS(CExitCommand) : public CNcmCommandBase
+/**
+Quit from the main console
+*/
+	{
+public:
+	static CExitCommand* NewL(CUsbNcmConsole& aUsb, TUint aKey);
+	~CExitCommand();
+
+public:
+	//From CNcmCommandBase
+	void DoCommandL();
+
+private:
+	CExitCommand(CUsbNcmConsole& aUsb, TUint aKey);
+	void ConstructL();
+
+private:
+		
+	};
+
+#endif // EXITCOMMAND_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/t_ncm/inc/ncmtestconsole.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,196 @@
+/*
+* Copyright (c) 2002-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
+ */
+
+
+#ifndef NCMTESTCONSOLE_H
+#define NCMTESTCONSOLE_H
+
+#include <usbman.h>
+#include <e32cons.h>
+#include <usb/usblogger.h>
+#include <comms-infras/commsdebugutility.h>
+#include <in_sock.h>
+
+void Panic(TInt aPanic);
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KSubSys, "NCM");
+_LIT8(KLogComponent, "TEST");
+#endif
+
+
+class CConsoleBase;
+class CNcmCommandEngine;
+class CDeviceWatcher;
+class CServiceWatcher;
+class CSharedStateWatcher;
+
+_LIT(KUsbNcmConsoleTitle, "NCM Test Console");
+
+//Display item index
+enum TDisplayItemIndex
+	{	
+	EUsbServiceStateItem = 0,		
+	EUsbDeviceStateItem,			
+	ENcmConnStatusItem,			
+	ENcmConnIpItem,				
+	EUplinkConnStatusItem,			
+	EUplinkConnIpItem,				
+	ENcmBtPanItem,				
+	ENcmAgentStateItem,			
+	EAuthorisationSettingItem,		
+	ENcmConnectionStateItem,
+	ELastItem						//not used, just for count
+	};
+
+#define DISPLAY_USB_SERVICE_STATE_LEN	11			//EUsbServiceStateItem
+#define DISPLAY_USB_DEVICE_STATE_LEN	11			//EUsbDeviceStateItem
+#define DISPLAY_NCM_CONN_STATE_LEN	16			//ENcmConnStatusItem
+#define DISPLAY_NCM_CONN_IP_LEN		15			//ENcmConnIpItem
+#define DISPLAY_UPLINK_CONN_STATE_LEN	16			//EUplinkConnStatusItem
+#define DISPLAY_UPLINK_CONN_IP_LEN		15			//EUplinkConnIpItem
+#define DISPLAY_NCM_BTPAN_LEN			10			//ENcmBtPanItem
+#define DISPLAY_AGENT_STATE_LEN			30			//ENcmAgentStateItem
+#define DISPLAY_AUTH_SETTING_LEN		15			//EAuthorisationSettingItem
+#define DISPLAY_NCM_CONNECTION_STATE    16
+
+//The SID of Ncm state P&S key used
+const TUid KC32ExeSid = {0x101F7989};
+
+NONSHARABLE_CLASS(CUsbNcmConsoleEvent)
+/**
+Event reported by running commands and watcher classes 
+*/
+	{
+public:
+	static CUsbNcmConsoleEvent* NewL();
+	~CUsbNcmConsoleEvent();
+private:
+	CUsbNcmConsoleEvent();
+	void ConstructL();
+public:
+	//Event queue link
+	TDblQueLink	iLink;
+	//Event description
+	RBuf		iEvent;
+	};
+
+
+NONSHARABLE_CLASS(CUsbNcmConsole) : public CActive
+/**
+The Main Console of NCM manual test
+*/
+	{
+friend class CNcmCommandEngine;
+
+public:
+	static CUsbNcmConsole* NewLC(TBool aDemo);
+	~CUsbNcmConsole();
+
+public:
+	void StartL();
+	void Stop() const;
+	
+	RUsb& Usb();
+
+public:
+	//commands use it to report event to main console
+	void NotifyEvent(CUsbNcmConsoleEvent* aEvent);
+	
+	//Set the Ncm IAP and monitor the related connection status
+	void SetLocalIapId(TInt aId);
+	//Set the Uplink IAP and monitor the related connection status
+	void SetUplinkIapId(TInt aId);
+
+	//Get Ncm Iap ID
+	TInt LocalIapId() const;
+	//Get Uplink Iap ID
+	TInt UplinkIapId() const;
+	
+	//Called by commands and watchers to notify main console refresh the screen
+	void ScheduleDraw(TUint aKey);
+	
+	//Set the permanent info to display on screen 
+	void SetDisplayItem(TInt aIndex, TDes& aInfo);
+	//Get the permanent info on screen
+	const TDes& GetDisplayItem(TInt aIndex);
+
+	//Display all Iaps configured in commsdb
+	TInt DrawAvailableIapsL();
+	
+	//Attach the connection specified by aIap
+	TBool AttachConnectionL(TInt aIap, RConnection& aConnection);
+	
+private:
+	CUsbNcmConsole(TBool aDemo);
+	void ConstructL();
+	
+	//Display all kinds of info.
+	void DrawL();
+	//Init the items which are displayed on screen permanently
+	void CreateDisplayItemL();
+
+	//Call back function 
+	static TInt DoCommandCallback(TAny *aThisPtr);
+
+private:
+	//From Active
+	void DoCancel();
+	void RunL();
+	TInt RunError(TInt aError);
+
+private:
+    CConsoleBase* iConsole;
+	RUsb iUsb;
+	
+	//The info displayed on screen permanently
+	RArray<RBuf> iDisplayArray;
+
+	TVersion	iVersion;
+	
+	//The Uplink IAP id	
+	TInt	iLocalIapId;
+	
+	CNcmCommandEngine* iKeys;
+
+	//monitor the USB device state
+	CDeviceWatcher* iDeviceWatcher;
+	//monitor the USB service state
+	CServiceWatcher* iServiceWatcher;
+
+	//Get the agent state of Ncm
+	CSharedStateWatcher*    iSharedStateWatcher; 
+	//Indicate current operation is display the help or not.
+	TInt 		iHelp;
+	
+	//If 'DEMO' is used as application parameter, iDemo will be set true. The Ncm
+	//Control app will be started automaticly and start Ncm automicly when usb cable
+	//plugin. This is used to demo for licencee.
+	TBool iDemo;	
+//	CAsyncCallBack* iStartWatcherCallback;
+	
+	// Event list
+	TDblQue<CUsbNcmConsoleEvent>	iEventList;
+	};
+
+
+#endif // NCMTESTCONSOLE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/t_ncm/inc/ncmtestdefines.hrh	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2002-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
+ */
+
+
+
+#ifndef NCMTESTDEFINES_HRH
+#define NCMTESTDEFINES_HRH
+
+// H4 screen can have 22 lines of text on it at once
+// H4 screen can have 53 characters per line.
+#define NUM_CHARACTERS_ON_LINE 53
+#define NUM_EVENT_ON_SCREEN 12
+
+
+enum TNcmTestConsolePanic
+	{
+	//The event is null.
+	ENcmEventIsNull = 300000,
+	//The lengh of event info is larger than allowed
+	ENcmEventLengthValid,
+	//The index of display item is valid
+	ENcmDisplayItemVaild,
+	//The command instance is null
+	ENcmCommandIsNull,
+	//The ncm start command is null
+	ENcmStartCommandIsNull,
+	//The command key exists
+	ENcmCommandKeyExists,
+	//InsertCommandError
+	ENcmInsertCommandError,
+	//The index of array item is valid
+	ENcmArrayBound
+	
+	};
+#endif // NCMTESTDEFINES_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/t_ncm/inc/ncmwatcher.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2002-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
+ */
+
+
+#ifndef NCMWATCHER_H
+#define NCMWATCHER_H
+
+#include <e32property.h>
+#include <usb/usbncm.h>
+#include <e32base.h> 
+
+class CUsbNcmConsole;
+
+NONSHARABLE_CLASS(CSharedStateWatcher) : public CActive
+    {
+public:
+    static CSharedStateWatcher* NewL(CUsbNcmConsole& aConsole);
+    ~CSharedStateWatcher();
+
+private:
+    CSharedStateWatcher(CUsbNcmConsole& aConsole);
+    void ConstructL();
+    void reportState();
+
+    //From CActive
+    void RunL();
+    void DoCancel();
+
+private:
+    RProperty iProperty;
+    TInt iIapId;
+    TInt iErrCode;
+    TPtr8 iNcmStateDes;
+    UsbNcm::TNcmConnectionEvent iSharedState;
+    CUsbNcmConsole& iConsole;
+    };
+
+#endif  // NCMWATCHER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/t_ncm/inc/servicewatcher.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2002-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
+ */
+
+
+#ifndef SERVICEWATCHER_H
+#define SERVICEWATCHER_H
+
+#include <usbstates.h>
+#include <e32base.h>
+
+class CUsbNcmConsole;
+
+NONSHARABLE_CLASS(CServiceWatcher) : public CActive
+/**
+Monitor USB service state
+*/
+	{
+public:
+	static CServiceWatcher* NewL(CUsbNcmConsole& aUsb);
+	~CServiceWatcher();
+
+private:
+	CServiceWatcher(CUsbNcmConsole& aUsb);
+	void ConstructL();
+
+	//Display USB service state on main console
+	void DisplayServiceState(TUsbServiceState aServiceState);
+
+private:
+	//From CActive
+	void DoCancel();
+	void RunL();
+	TInt RunError(TInt aError);
+
+private:
+	CUsbNcmConsole&	iTestConsole;
+	TUsbServiceState	iServiceState;
+	};
+
+
+#endif  // SERVICEWATCHER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/t_ncm/inc/setncmiapcommand.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,105 @@
+/*
+* Copyright (c) 2002-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
+ */
+
+#ifndef SETNCMIAPCOMMAND_H
+#define SETNCMIAPCOMMAND_H
+
+#include "commandengine.h"
+#include <centralrepository.h>
+
+NONSHARABLE_CLASS(CSetNcmIapCommand) : public CNcmCommandBase
+/**
+Set the Ncm Iap Id into central repository
+*/
+	{
+public:
+	enum TSetNcmIapCommandState
+	{
+		EIapId,			//The command is in state of wait user input iap
+		EIapPriority	//The command is in state of wait user input iap index
+	};
+public:
+	static CSetNcmIapCommand* NewL(CUsbNcmConsole& aUsb, TUint aKey);
+	~CSetNcmIapCommand();
+
+	//Get the first IAP ID stored in central repository.
+	void GetDefaultIapL(TInt& aDefaultIap);
+
+public:
+	//From CNcmCommandBase
+	void DoCommandL();
+	
+private:
+	CSetNcmIapCommand(CUsbNcmConsole& aUsb, TUint aKey);
+	void ConstructL();
+
+private:
+	//From CActive
+	void DoCancel();
+	void RunL();
+	TInt RunError(TInt aError);
+
+private:
+	//Display all IAPs stored in central repository which are used for Ncm
+	void ListAllNcmIapL();
+	//Set the Iap Id inputed by user into central repository
+	void SetNcmIapL();
+	
+	//Init work for run this command
+	void InitWorkL();
+	//Stop work when finish or terminate this command
+	void EndWork();
+	
+private:
+
+	TSetNcmIapCommandState iCommandState;
+
+	//The console used to display iap info and get user input for ncm iap
+	CConsoleBase* iConsole;
+	//user current input
+	RBuf		 iChars;
+	//the Iap id user want to store in central repository
+	TInt iIapId;
+	//the position of the Iap id which will be stored in central repository
+	TInt iIndex;
+	//central repository handle
+	CRepository* iRepository;
+	//all Iaps get from central repository
+	RArray<TUint32> iRows;
+
+	//followed are used for finding Iap Id stored in central repository
+	static const TUint KPartialKey = 0x01010000;
+	static const TUint KMask = 0xFFFF0000;
+	static const TInt KMaxNumOfChars = 255;
+	
+
+	};
+
+
+_LIT(KSetIapMemo ,"Input the NcmIap you want to set:");
+_LIT(KSetIapIndexMemo, "Input the index of iap you want to set:");
+_LIT(KErrInput, "Error input. Input again.\n");
+
+const TUid KNcmIapIdRepositoryUID = {0x10286a43};
+
+#endif // SETNCMIAPCOMMAND_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/t_ncm/inc/simpancommand.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2002-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
+ */
+
+#ifndef SIMPANCOMMAND_H
+#define SIMPANCOMMAND_H
+
+#include "commandengine.h"
+#include <e32property.h>
+
+// This is a local definition of this shared enum of P&S key values.  These values should not be changed without changing
+// the equivalent definition in the other IP bearer code.
+enum TIPBearerCoexistenceStatus
+	{
+	ENoneIsActive, 
+	ENcmIsActive,
+	EBTPanIsActive
+	};
+
+// This is a local definition of this shared P&S id.  This value should not be changed without changing
+// the equivalent definition in the other IP bearer code.
+const TInt KIPBearerCoexistenceProperty = 0x10286a95;
+
+// This is the identifer of the shared mutex used to allow safe read / write of the coexistence P&S key.
+// This can only be changed if all other existing definitions of the mutex name are also changed.
+_LIT(KIPBearerCoexistenceMutex, "IPBearerCoexistenceMutex");
+
+//static _LIT_SECURITY_POLICY_PASS(KAllowAllPolicy);
+//static _LIT_SECURITY_POLICY_C1(KNetworkControlPolicy, ECapabilityNetworkControl); 
+
+
+NONSHARABLE_CLASS(CSimPANCommand) : public CNcmCommandBase
+/**
+Simulate PAN has an active connection or not.
+It is also response for display the exclusive state on main console
+*/
+	{
+public:
+	static CSimPANCommand* NewL(CUsbNcmConsole& aUsb, TUint aKey);
+	~CSimPANCommand();
+
+public:
+	//From CNcmCommandBase
+	void DoCommandL();
+
+private:
+	CSimPANCommand(CUsbNcmConsole& aUsb, TUint aKey);
+	void ConstructL();
+
+private:
+	//From CActive
+    void RunL();
+    void DoCancel();
+	TInt RunError(TInt aError);
+
+private:
+    //Display the exclusive state on main screen
+    void DisplayExclusive(TInt aState);
+	//When the PAN is active, the command description should be 
+	//changed to 'Simulate PAN disactive'
+	void ChangeDescription();
+
+private:
+	//Indicate the PAN is active or not
+	TBool iSetPAN;
+	//The property which store the exclusive state
+	RProperty iNcmExclusiveProp;
+	};
+
+#endif // SIMPANCOMMAND_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/t_ncm/inc/startwatchercommand.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2002-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
+ */
+
+#ifndef STARTWATCHERCOMMAND_H
+#define STARTWATCHERCOMMAND_H
+
+#include "commandengine.h"
+
+class CDeviceWatcher;
+
+NONSHARABLE_CLASS(CStartWatcherCommand) : public CNcmCommandBase
+/**
+Set the test mode to run NCM automaticly when usb cable plugin.
+*/
+	{
+public:
+	static CStartWatcherCommand* NewL(CUsbNcmConsole& aUsb, TUint aKey, CDeviceWatcher& aDeviceWatch);
+	~CStartWatcherCommand();
+
+public:
+	//From CNcmCommandBase
+	void DoCommandL();
+
+private:
+	CStartWatcherCommand(CUsbNcmConsole& aUsb, TUint aKey, CDeviceWatcher& aDeviceWatch);
+	void ConstructL();
+	
+private:
+	CDeviceWatcher& iDeviceWatcher;
+	};
+
+#endif // STARTWATCHERCOMMAND_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/t_ncm/inc/tcpcommand.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2002-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
+ */
+
+#ifndef TCPCOMMAND_H
+#define TCPCOMMAND_H
+
+#include "commandengine.h"
+
+//The max count of tcp test in a same time
+const static TInt KMaxTcpTestCount = 5;
+
+class CTcpTestConsole;
+
+NONSHARABLE_CLASS(CTcpCommand) : public CNcmCommandBase
+/**
+Make TCP test: Create a tcp connection and tansfer data on it.
+*/
+	{
+public:
+	static CTcpCommand* NewL(CUsbNcmConsole& aUsb, TUint aKey, TBool aIsTcp, TBool aIsServer);
+	~CTcpCommand();
+
+public:
+	//From CNcmCommandBase
+	void DoCommandL();
+
+public:
+	void CloseTcpTest(TInt aIndex);
+	
+private:
+	CTcpCommand(CUsbNcmConsole& aUsb, TUint aKey, TBool aIsTcp, TBool aIsServer);
+	void ConstructL();
+	
+private:
+	//Indicate the tcp type: ETrue - as TCP server; EFalse - as TCP client
+	TBool iIsServer;
+	TBool iIsTcp;
+	//Store the instances of tcp test console
+	CTcpTestConsole* iTestArray[KMaxTcpTestCount];
+	};
+
+#endif // TCPCOMMAND_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/t_ncm/inc/tcptest.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,190 @@
+/*
+* Copyright (c) 2002-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
+ */
+
+#ifndef TCPTEST_H
+#define TCPTEST_H
+
+#include <e32cons.h>
+#include <es_sock.h>
+#include <in_sock.h>
+
+class CTcpProcess : public CActive
+/**
+Run TCP test: Create a tcp connection and make data transfer on it.
+*/
+	{
+public:
+	static CTcpProcess* NewL(CConsoleBase& aConsole, TInetAddr& aAddr, TInt aPort, TInt aSize, TBool aMode);
+	~CTcpProcess();
+
+private:
+	CTcpProcess(CConsoleBase& aConsole, TInetAddr& aAddr, TInt aPort, TInt aSize, TBool aMode);
+	void ConstructL();
+
+	void RecvDataL();
+    TInt SendDataL(TDes8& aData, TInt aSize);
+    void PrintData(TDes8& aData);
+
+private:
+	//From CActive
+    virtual void RunL();
+    virtual void DoCancel();
+	TInt RunError(TInt aError);
+
+private:
+	enum TProcessState
+		{
+		ECreateConnection,	//Create tcp connection
+		EDataTransfer		//Data transfer
+		};
+
+private:
+	CConsoleBase& iConsole;
+
+	RSocketServ iSockServ;
+	RSocket iListenSocket;
+	RSocket iSocket;
+	
+	TInetAddr& iAddr; 
+	TInt iPort;
+	
+	//The size of send buf and receive buf
+	TInt iSize;
+
+	RBuf8 iRecvBuf;
+	RBuf8 iSendBuf;
+
+	TSockXfrLength iRecvSize;
+	
+	TBool iMode; //ETrue: as a Server, and data transfer is receive first, then send back
+				 //EFalse: as a client, and data transfer is send first, then receive.
+	
+	TProcessState iProcessState;
+	
+	};
+
+
+class CUdpProcess : public CActive
+            /**
+              Run TCP test: Create a udp connection and make data transfer on it.
+              */
+{
+    public:
+    static CUdpProcess* NewL(CConsoleBase& aConsole, TInetAddr& aAddr, TInt aPort, TInt aSize, TBool aMode);
+    ~CUdpProcess();
+
+    private:
+    CUdpProcess(CConsoleBase& aConsole, TInetAddr& aAddr, TInt aPort, TInt aSize, TBool aMode);
+    void ConstructL();
+
+    void RecvDataL();
+    TInt SendDataL(TDes8& aData, TInetAddr& aAddr, TInt aSize);
+    void PrintData(TDes8& aData);
+
+    private:
+    //From CActive
+    virtual void RunL();
+    virtual void DoCancel();
+    TInt RunError(TInt aError);
+
+    private:
+    enum TProcessState
+    {
+        EDataSending,   //Data Sending
+        EDataTransfer   //Data Recving
+    };
+
+    private:
+    CConsoleBase& iConsole;
+
+    RSocketServ iSockServ;
+    RSocket iListenSocket;
+    RSocket iSocket;
+
+    TInetAddr iAddr; 
+    TInetAddr iPeerAddr;
+    TInt iPort;
+
+    //The size of send buf and receive buf
+    TInt iSize;
+
+    RBuf8 iRecvBuf;
+    RBuf8 iSendBuf;
+
+    TSockXfrLength iRecvSize;
+
+    TBool iMode; //ETrue: as a Server, and data transfer is receive first, then send back
+    //EFalse: as a client, and data transfer is send first, then receive.
+
+    TProcessState iProcessState;
+
+};
+
+
+class CTcpCommand;
+class CTcpTestConsole : public CActive 
+/**
+The console of tcp test.
+*/
+	{
+public:
+	static CTcpTestConsole* NewL(TBool aIsTcp, TBool aMode, TDesC& aDefautAddr, TInt aIndex, CTcpCommand& aOwner);
+	~CTcpTestConsole();
+
+	TBool StartL();
+	void Help();
+	
+private:
+	CTcpTestConsole(TBool aIsTcp, TBool aMode, TDesC& aDefautAddr, TInt aIndex, CTcpCommand& aOwner);
+	void ConstructL();
+
+private:
+	//From CActive
+    virtual void RunL();
+    virtual void DoCancel();
+	TInt RunError(TInt aError);
+
+private:
+	enum TCommandMode
+		{
+		ECommandInit,	//Get parameter from user input
+		ECommandRunning //tcp test run
+		};
+	
+private:
+	CConsoleBase* iConsole;
+	RBuf		 iChars;
+	TCommandMode iCommandMode;
+	
+	CTcpProcess* iTcp;
+	CUdpProcess* iUdp;
+	TBool iMode; //ETrue server EFalse client
+	TBool iIsTcp;
+	
+	//The defaut addr, format like 'addr port' (192.168.2.101 5000)
+	const TDesC& iDefaultAddr;
+	TInt iIndex;
+	CTcpCommand& iOwner;
+	
+	};
+
+#endif //TCPTEST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/t_ncm/sis/ncmtestconsole.pkg	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,24 @@
+; Installation file for Symbian OS 9.x for generic console application
+; Installation file for ncmtestconsole EXE
+;
+; This is an auto-generated PKG file by Carbide.
+; This file uses variables specific to Carbide builds that will not work
+; on command-line builds. If you want to use this generated PKG file from the
+; command-line tools you will need to modify the variables with the appropriate
+; values: $(EPOCROOT), $(PLATFORM), $(TARGET)
+;
+
+;
+; UID is the exe's UID
+;
+#{"ncmtestconsole"},(0xE228E991),1,0,0
+
+
+;Localised Vendor name
+%{"Vendor-EN"}
+
+;Unique Vendor name
+:"Vendor"
+
+"$(EPOCROOT)Epoc32\release\$(PLATFORM)\$(TARGET)\ncmtestconsole.exe"		  -"!:\sys\bin\ncmtestconsole.exe"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/t_ncm/src/commandengine.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,249 @@
+/*
+* Copyright (c) 2002-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
+ */
+
+#include "commandengine.h"
+#include "ncmtestconsole.h"
+
+CNcmCommandEngine* CNcmCommandEngine::NewL(CUsbNcmConsole& aTestConsole)
+/**
+Constructs a CNcmCommandEngine object.
+  @param  aTestConsole The main console 
+*/
+	{
+	LOG_STATIC_FUNC_ENTRY
+	CNcmCommandEngine* self = new(ELeave) CNcmCommandEngine(aTestConsole);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+CNcmCommandEngine::~CNcmCommandEngine()
+	{
+	Cancel();
+	RemoveAllCommand();
+	}
+
+CNcmCommandEngine::CNcmCommandEngine(CUsbNcmConsole& aTestConsole)
+	: CActive(EPriorityStandard)
+	, iTestConsole(aTestConsole)
+	, iLastPage(0), iLastItem(-1), iRemainLine(COMMAND_MAX_COUNT_PER_PAGE)
+	{
+	CActiveScheduler::Add(this);
+	}
+
+void CNcmCommandEngine::ConstructL()
+	{
+	//wait user select command
+	iTestConsole.iConsole->Read(iStatus);
+	SetActive();
+	}
+
+void CNcmCommandEngine::DoCancel()
+	{
+	iTestConsole.iConsole->ReadCancel();
+	}
+
+void CNcmCommandEngine::RunL()
+	{
+	LOG_FUNC
+	
+	User::LeaveIfError(iStatus.Int());
+	
+	TUint key = iTestConsole.iConsole->KeyCode();
+
+	__FLOG_STATIC1(KSubSys, KLogComponent , _L8("key = %c"), key);
+	
+	if((key >= '0') && (key <= '9'))
+		{
+		iTestConsole.ScheduleDraw(key-0x30);
+		}
+	else
+		{
+		CNcmCommandBase* command = NULL;
+		if(iCommandMap.Find(key))
+			{
+			command = *(iCommandMap.Find(key));
+			if(command)
+				{
+				command->DoCommandL();
+				}
+			else
+				{
+				__FLOG_STATIC0(KSubSys, KLogComponent , _L8("The command in hashmap is NULL"));				
+				}
+			}						
+		else
+			{
+			CUsbNcmConsoleEvent* event = CUsbNcmConsoleEvent::NewL();
+			event->iEvent.AppendFormat(_L("G:Unknown:Key[%c]"), key);
+			iTestConsole.NotifyEvent(event);			
+			}
+
+		}
+	iTestConsole.iConsole->Read(iStatus);
+	
+	SetActive();
+	}
+
+void CNcmCommandEngine::RegisterCommand(CNcmCommandBase* aCommand)
+/**
+Add command object into command map
+  @param aCommand  a command which will be used by user 
+*/
+	{
+	//Assert if aCommand is NULL
+	__ASSERT_ALWAYS(aCommand, Panic(ENcmCommandIsNull));
+	//Assert if the key exists in command map
+	__ASSERT_ALWAYS(!iCommandMap.Find(aCommand->Key()), Panic(ENcmCommandKeyExists));
+	
+	//add command
+	TInt err = iCommandMap.Insert(aCommand->Key(), aCommand);
+	if(err != KErrNone)
+		{
+		User::Panic(_L("RegisterCommand"), err);
+		}
+	
+	//make the command to be displayed in which page, which line
+	TInt line = (aCommand->Description().Length() + NUM_CHARACTERS_ON_LINE + 4) / (NUM_CHARACTERS_ON_LINE);
+	iRemainLine -= line;
+	if(iRemainLine < 0)
+		{
+		iLastPage ++;
+		iRemainLine = COMMAND_MAX_COUNT_PER_PAGE - line;
+		iLastItem = 0;
+		}
+	else
+		{
+		iLastItem ++;
+		}
+	iCommandKeys[iLastPage][iLastItem] = aCommand->Key();
+	
+	}
+
+void CNcmCommandEngine::RemoveAllCommand()
+/**
+Destroy all commands in command map  
+*/
+	{
+	CNcmCommandBase* currentitem;
+
+	RHashMap<TUint, CNcmCommandBase*>::TIter hashMapIter(iCommandMap);
+	TInt count = iCommandMap.Count();
+	for(TInt i=0; i< count; i++)
+	    {
+	    currentitem = *(hashMapIter.NextValue());
+	    if(currentitem)
+	    	{
+	    	hashMapIter.RemoveCurrent();
+	    	delete currentitem;
+	    	}
+	    }
+	iCommandMap.Close();
+	
+	}
+
+
+void CNcmCommandEngine::PrintHelp(TInt aPage)
+/**
+Get command help info (command key - command description) 
+@param aPage  the command help info of specified page
+*/
+	{		
+	LOG_FUNC
+	
+	__ASSERT_ALWAYS(((aPage <= COMMAND_MAX_PAGE) && (aPage > 0)), Panic(ENcmArrayBound));
+	
+	TUint key = iCommandKeys[aPage-1][0];
+	if(key == 0)
+		{
+		//No commands in this page
+		iTestConsole.iConsole->Printf(_L("No commands\n"));
+		}
+	else
+		{
+		//Display command
+		TInt i = 0;
+		while((key != 0) && (i < COMMAND_MAX_COUNT_PER_PAGE))
+			{
+			CNcmCommandBase* command = NULL;
+			command = *(iCommandMap.Find(key));
+			iTestConsole.iConsole->Printf(_L("%c - %S\n"), command->Key(), &command->Description());
+			i++;
+			key = iCommandKeys[aPage-1][i];
+			}
+		}
+
+	}
+
+CNcmCommandBase::CNcmCommandBase(TInt aPriority, CUsbNcmConsole& aConsole, TUint aKey)
+	: CActive(aPriority), iTestConsole(aConsole), iKey(aKey)
+/**
+Constructor
+@param aPriority  	Active object's priority
+@param aConsole		The main console
+@param aKey			command key
+*/
+	{
+	}
+
+CNcmCommandBase::~CNcmCommandBase()
+	{	
+	}
+
+TUint CNcmCommandBase::Key() const
+	{
+	return iKey;
+	}
+
+void CNcmCommandBase::SetKey(TUint aKey)
+	{ 
+	iKey = aKey; 
+	}
+
+
+const TDesC& CNcmCommandBase::Description()
+	{ 
+	return iDescription; 
+	}
+
+void CNcmCommandBase::SetDescription(const TDesC& aDescription)
+/**
+Set command description
+@param aDescription  the new description for the command 
+*/
+	{
+	iDescription.SetLength(0);
+	iDescription.Copy(aDescription.Left(NUM_CHARACTERS_ON_LINE));
+	}
+void CNcmCommandBase::RunL()
+	{	
+	}
+
+void CNcmCommandBase::DoCancel()
+	{	
+	}
+TInt CNcmCommandEngine::RunError(TInt aError)
+	{
+	User::Panic(_L("CNcmCommandEngine"), aError);
+	return aError;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/t_ncm/src/devicewatcher.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,179 @@
+/*
+* Copyright (c) 2002-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
+ */
+
+#include "devicewatcher.h"
+#include "ncmtestconsole.h"
+
+CDeviceWatcher* CDeviceWatcher::NewL(CUsbNcmConsole& aTestConsole)
+	{
+	LOG_STATIC_FUNC_ENTRY
+	
+	CDeviceWatcher* self = new(ELeave) CDeviceWatcher(aTestConsole);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+CDeviceWatcher::~CDeviceWatcher()
+	{
+	Cancel();
+	iLdd.Close();
+	}
+
+CDeviceWatcher::CDeviceWatcher(CUsbNcmConsole& aTestConsole)
+	: CActive(EPriorityStandard), iTestConsole(aTestConsole), iWatchMode(EWatchMode)
+	{
+	CActiveScheduler::Add(this);
+	}
+
+void CDeviceWatcher::ConstructL()
+	{
+	User::LeaveIfError(iLdd.Open(0));
+	iLdd.AlternateDeviceStatusNotify(iStatus, iDeviceState);
+
+	SetActive();
+
+	//Get current device state
+	TUsbcDeviceState deviceState;
+	User::LeaveIfError(iLdd.DeviceStatus(deviceState));
+
+	DisplayDeviceState(deviceState);
+	
+	}
+
+void CDeviceWatcher::DoCancel()
+	{
+	iLdd.AlternateDeviceStatusNotifyCancel();
+	}
+
+void CDeviceWatcher::RunL()
+	{
+	//Get USB device state change
+	iLdd.AlternateDeviceStatusNotify(iStatus, iDeviceState);
+	SetActive();
+
+	LOG_FUNC
+	__FLOG_STATIC1(KSubSys, KLogComponent , _L8("CDeviceWatcherCommand::RunL - iStatus = %d"), iStatus.Int());
+
+	//Display the current state on main console
+	DisplayDeviceState(iDeviceState);
+ 
+	TUsbServiceState serviceState;
+	User::LeaveIfError(iTestConsole.Usb().GetServiceState(serviceState));
+
+	__FLOG_STATIC3(KSubSys, KLogComponent , 
+			_L8("iDeviceState = %d, serviceState = %d, iStartNcm=%d"), 
+			iDeviceState, serviceState, iStartNcm);
+
+	iOldDeviceState = iDeviceState;
+	}
+
+TInt CDeviceWatcher::RunError(TInt aError)
+	{
+	User::Panic(_L("CDeviceWatcher"), aError);
+	return aError;
+	}
+
+TDeviceWatchMode CDeviceWatcher::GetWatchMode() const
+	{
+	return iWatchMode;
+	}
+
+void CDeviceWatcher::SetWatchMode(TDeviceWatchMode aWatchMode)
+/**
+Set the watch mode : If the mode is EWatchMode, only monitor the USB device status.
+If the mode is EWatchAndStartMode, when cable plugin, NCM will be started automaticly
+  @param  aWatchMode 	The mode user want to set 
+*/
+	{	
+	iWatchMode = aWatchMode;
+	switch(iWatchMode)
+		{
+		case EWatchMode:
+			iStartNcm = EFalse;
+			break;
+		case EWatchAndStartMode:
+			iStartNcm = ETrue;
+			break;
+		}
+	//When USB device state changed, CDeviceWatcher will check iStartNcm. The detail please see
+	//RunL()
+	}
+
+void CDeviceWatcher::DisplayDeviceState(TUint aDeviceState)
+/**
+Display device status on main console
+  @param  aDeviceState 	the device state
+*/
+	{
+ 	TBuf<DISPLAY_USB_DEVICE_STATE_LEN> devStatus;
+	switch(aDeviceState)
+		{
+	case EUsbcDeviceStateUndefined:
+		devStatus =
+    		//  12345678901
+			_L("Undefined  ");
+		break;
+
+	case EUsbcDeviceStateDefault:
+		devStatus =
+    		//  12345678901
+			_L("Default    ");
+		break;
+
+	case EUsbcDeviceStateAttached:
+		devStatus =
+    		//  12345678901
+			_L("Attached   ");
+		break;
+
+	case EUsbcDeviceStatePowered:
+		devStatus =
+    		//  12345678901
+			_L("Powered    ");
+		break;
+
+	case EUsbcDeviceStateConfigured:
+		devStatus =
+    		//  12345678901
+			_L("Configured ");
+		break;
+
+	case EUsbcDeviceStateAddress:
+		devStatus =
+    		//  12345678901
+			_L("Address    ");
+		break;
+
+	case EUsbcDeviceStateSuspended:
+		devStatus =
+    		//  12345678901
+			_L("Suspended  ");
+		break;
+	default:
+		devStatus =
+		    //  12345678901
+			_L("Unknown    ");
+		break;
+		}
+	iTestConsole.SetDisplayItem(EUsbDeviceStateItem, devStatus);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/t_ncm/src/exitcommand.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2002-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
+ */
+
+#include "exitcommand.h"
+#include "ncmtestconsole.h"
+
+_LIT(KExitCommandDescription, "Exit");
+
+CExitCommand* CExitCommand::NewL(CUsbNcmConsole& aTestConsole, TUint aKey)
+	{
+	LOG_STATIC_FUNC_ENTRY
+	
+	CExitCommand* self = new(ELeave) CExitCommand(aTestConsole, aKey);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+CExitCommand::~CExitCommand()
+	{
+	}
+
+CExitCommand::CExitCommand(CUsbNcmConsole& aTestConsole, TUint aKey)
+	: CNcmCommandBase(EPriorityStandard, aTestConsole, aKey)
+	{
+	}
+
+void CExitCommand::ConstructL()
+	{
+	SetDescription(KExitCommandDescription());
+	}
+
+void CExitCommand::DoCommandL()
+	{
+	LOG_FUNC
+	__FLOG_STATIC0(KSubSys, KLogComponent , _L8("CExitCommand::DoCommandL - Stop scheduler"));
+	
+	//Quit the main console
+	iTestConsole.Stop();
+	}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/t_ncm/src/ncmtestconsole.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,565 @@
+/*
+* Copyright (c) 2002-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
+ */
+
+
+#include "ncmtestconsole.h"
+#include "ncmtestdefines.hrh"
+#include "commandengine.h"
+#include "devicewatcher.h"
+#include "servicewatcher.h"
+#include "ncmwatcher.h"
+#include "exitcommand.h"
+#include "setncmiapcommand.h"
+#include "simpancommand.h"
+#include "tcpcommand.h"
+
+#include <commdb.h>
+#include <commdbconnpref.h>
+#include <nifman.h>
+#include <es_enum.h>
+
+//#include <ncm/ncmuiinterfaces.h>
+using namespace UsbNcm;
+
+//The app parameter
+_LIT(KArgDemo, "DEMO");
+
+//Set the display item length
+//every display item has fixed length. It will be displayed screen permanently.
+//The details about how to use display item is in CUsbNcmConsole::DrawL()
+TInt gDisplayItemLength[] = {
+			DISPLAY_USB_SERVICE_STATE_LEN,			//EUsbServiceStateItem
+			DISPLAY_USB_DEVICE_STATE_LEN,			//EUsbDeviceStateItem
+			DISPLAY_NCM_CONN_STATE_LEN,			//ENcmConnStatusItem
+			DISPLAY_NCM_CONN_IP_LEN,				//ENcmConnIpItem
+			DISPLAY_UPLINK_CONN_STATE_LEN,			//EUplinkConnStatusItem
+			DISPLAY_UPLINK_CONN_IP_LEN,				//EUplinkConnIpItem
+			DISPLAY_NCM_BTPAN_LEN,				//ENcmBtPanItem
+			DISPLAY_AGENT_STATE_LEN,				//ENcmAgentStateItem
+			DISPLAY_AUTH_SETTING_LEN,				//EAuthorisationSettingItem
+			DISPLAY_NCM_CONNECTION_STATE
+							};
+
+void Panic(TInt aPanic)
+	{
+	User::Panic(_L("NcmTestConsole"), aPanic);
+	}
+
+
+void RunConsoleL()
+	{
+	TInt cmdLineLength(User::CommandLineLength());
+	HBufC* cmdLine = HBufC::NewMaxLC(cmdLineLength);
+	TPtr cmdLinePtr = cmdLine->Des();
+	User::CommandLine(cmdLinePtr);
+
+	TLex args(*cmdLine);
+	// args are separated by spaces
+	args.SkipSpace(); 
+	
+	TPtrC cmdToken = args.NextToken();
+	HBufC* tc = HBufC::NewLC(80);
+	*tc = cmdToken;
+	
+	TBool isDemo = EFalse;
+	
+	//Find if there is 'DEMO' or not.
+	while (tc->Length())
+		{
+		TInt pos = tc->FindF(KArgDemo);
+		if ( pos != KErrNotFound )
+			{ 
+			isDemo = ETrue;
+			break;
+			}
+		
+		// next parameter
+		*tc = args.NextToken();
+		}
+	CleanupStack::PopAndDestroy(tc);
+	CleanupStack::PopAndDestroy(cmdLine);
+
+	CUsbNcmConsole* console = CUsbNcmConsole::NewLC(isDemo);
+	console->StartL();
+	CleanupStack::PopAndDestroy(console);
+	}
+
+TInt E32Main()
+	{
+	__UHEAP_MARK;
+	CTrapCleanup* cleanup = CTrapCleanup::New();
+	CActiveScheduler* activeScheduler = new CActiveScheduler;
+	TInt err = KErrNoMemory;
+	if(cleanup && activeScheduler)
+		{
+		CActiveScheduler::Install(activeScheduler);
+		TRAP(err,RunConsoleL());
+		}
+	delete activeScheduler;
+	delete cleanup;
+	__UHEAP_MARKEND;
+	return err;
+	}
+
+CUsbNcmConsoleEvent* CUsbNcmConsoleEvent::NewL()
+	{	
+	CUsbNcmConsoleEvent* self = new(ELeave) CUsbNcmConsoleEvent();
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	
+	}
+
+CUsbNcmConsoleEvent::CUsbNcmConsoleEvent()
+	{	
+	}
+
+CUsbNcmConsoleEvent::~CUsbNcmConsoleEvent()
+	{
+	iLink.Deque();
+	iEvent.Close();
+	}
+	
+void CUsbNcmConsoleEvent::ConstructL()
+	{
+	User::LeaveIfError(iEvent.Create(NUM_CHARACTERS_ON_LINE-1));	
+	}
+
+
+CUsbNcmConsole* CUsbNcmConsole::NewLC(TBool aDemo)
+/**
+Constructs a CUsbNcmConsole object.
+  @param  aDemo 	Indicate start NCM control app and NCM automaticly or manually
+
+When iDemo is ETrue, means ncmtestconsole starts as a demo. It will ask user to set ncm iap and
+uplink iap.Then user can experience the NCM function by plug/unplug usb cable. 
+*/
+	{
+	LOG_STATIC_FUNC_ENTRY
+
+	CUsbNcmConsole* self = new(ELeave) CUsbNcmConsole(aDemo);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	return self;
+	}
+	
+CUsbNcmConsole::~CUsbNcmConsole()
+	{
+	LOG_FUNC
+
+	//If Ncm control app is not stopped, stop it.
+	//destroy all commands
+	delete iKeys;
+
+	//destroy event list
+	TDblQueIter<CUsbNcmConsoleEvent> iter(iEventList);
+	CUsbNcmConsoleEvent* event = NULL;
+	while((event = iter++) != NULL)
+		{
+		delete event;
+		}
+
+	//delete iStartWatcherCallback;
+
+	//destroy all watches
+	delete iSharedStateWatcher;
+	delete iDeviceWatcher;
+	delete iServiceWatcher;
+	
+	iUsb.Close();
+		
+	delete iConsole;
+
+	//Destroy all display items
+	for(TInt i=0; i<ELastItem; i++)
+		{
+		iDisplayArray[i].Close();
+		}
+	iDisplayArray.Close();
+
+	Cancel();
+	
+	}
+
+CUsbNcmConsole::CUsbNcmConsole(TBool aDemo)
+	: CActive(EPriorityLow) // Low so all notifications that want to be serviced will be done first
+	, iHelp(EFalse)
+	, iDemo(aDemo)
+	, iEventList(_FOFF(CUsbNcmConsoleEvent, iLink))
+	{
+	CActiveScheduler::Add(this);
+	}
+
+void CUsbNcmConsole::ConstructL()
+	{
+	LOG_FUNC
+	
+	//Init Display Item
+	iDisplayArray.ReserveL(ELastItem);
+	CreateDisplayItemL();
+
+	iConsole = Console::NewL(KUsbNcmConsoleTitle, TSize(-1,-1));
+	User::LeaveIfError(iUsb.Connect());
+	__FLOG_STATIC0(KSubSys, KLogComponent , _L8("iUsb.Connect() successful"));
+	
+	//Init event list
+	for(TInt i=0; i< NUM_EVENT_ON_SCREEN; ++i)
+		{
+		CUsbNcmConsoleEvent* nullEvent = CUsbNcmConsoleEvent::NewL();
+		iEventList.AddFirst(*nullEvent);
+		}
+	__FLOG_STATIC0(KSubSys, KLogComponent , _L8("Create event list successful"));		
+
+
+	//Start watcher
+	//iDeviceWatcher = CDeviceWatcher::NewL(*this);
+	//iServiceWatcher = CServiceWatcher::NewL(*this);
+	// iUplinkConnectionWatcher = CUplinkWatcher::NewL(*this);
+	
+	__FLOG_STATIC0(KSubSys, KLogComponent , _L8("Create watchers successful"));
+
+	//create command engine
+	iKeys = CNcmCommandEngine::NewL(*this);
+	
+	//add commands
+	CNcmCommandBase* command = NULL;
+
+	//the command to set ncm iap
+	command = CSetNcmIapCommand::NewL(*this, 'n');
+	iKeys->RegisterCommand(command);
+	//Get the default iap used by ncm
+	TInt defaultIap = 0;
+	((CSetNcmIapCommand*)command)->GetDefaultIapL(defaultIap);
+	SetLocalIapId(defaultIap);	
+
+	//the command to simulate PAN actvie/inactive
+	command = CSimPANCommand::NewL(*this, 'p');
+	iKeys->RegisterCommand(command);
+
+	//the command to create a connection from PC to H4 and make data transfer
+	command = CTcpCommand::NewL(*this, 'v', ETrue, ETrue);
+	iKeys->RegisterCommand(command);
+	//the command to create a connection from H4 to PC and make data transfer
+	command = CTcpCommand::NewL(*this, 'i', ETrue, EFalse);
+	iKeys->RegisterCommand(command);
+
+	command = CTcpCommand::NewL(*this , 'r', EFalse, ETrue);
+	iKeys->RegisterCommand(command);
+	command = CTcpCommand::NewL(*this , 's', EFalse, EFalse);
+	iKeys->RegisterCommand(command);
+
+	//here to add new command
+	
+	//the command to quit 
+	command = CExitCommand::NewL(*this, 'q');
+	iKeys->RegisterCommand(command);
+	
+	//Monitor the status published by NCM agent
+	iSharedStateWatcher = CSharedStateWatcher::NewL(*this);
+	}
+
+void CUsbNcmConsole::StartL()
+	{
+	//Output the init state to screen
+	DrawL();
+	//Do StartWatcherCommand if 'demo' is the command parameter
+	if(iDemo)
+		{
+//		iStartWatcherCallback->CallBack();
+		}
+	CActiveScheduler::Start();
+	}
+	
+void CUsbNcmConsole::Stop() const
+	{
+	CActiveScheduler::Stop();
+	}
+
+void CUsbNcmConsole::DoCancel()
+	{
+	}
+
+void CUsbNcmConsole::RunL()
+	{
+	DrawL();
+	}
+
+TInt CUsbNcmConsole::RunError(TInt aError)
+	{
+	User::Panic(_L("CUsbNcmConsole"), aError);
+	return aError;
+	}
+
+void CUsbNcmConsole::ScheduleDraw(TUint aKey)
+/**
+Called by commands and monitors.To notify main console there's new infomation to show.
+  @param  aKey 	Display type. '1'-'9' - display the command help
+  							  'E' - display the events.
+  							  '0' - back from command help	
+*/
+	{
+	iHelp = aKey;
+	if(!IsActive())
+		{
+		SetActive();
+		TRequestStatus* status = &iStatus;
+		User::RequestComplete(status, KErrNone);
+		}
+	}
+	
+RUsb& CUsbNcmConsole::Usb()
+	{
+	return iUsb;
+	}
+
+void CUsbNcmConsole::SetLocalIapId(TInt aId)
+/**
+Set the Ncm Iap which will be monitored and displayed on screen
+  @param  aId 	The Ncm Iap Id
+*/
+	{
+	iLocalIapId = aId;
+	ScheduleDraw('E');
+	}
+
+void CUsbNcmConsole::NotifyEvent(CUsbNcmConsoleEvent* aEvent)
+/**
+Called by commands and monitors. To tell main console to display the new event.
+  @param  aEvent 	Event reported by commands and monitors
+*/
+	{
+	//Console can't display a NULL event
+	__ASSERT_ALWAYS(aEvent, Panic(ENcmEventIsNull));
+	//Console can't display a string more than one line
+	__ASSERT_ALWAYS(aEvent->iEvent.Length() <= NUM_CHARACTERS_ON_LINE, Panic(ENcmEventLengthValid));
+
+	iEventList.AddFirst(*aEvent);
+	CUsbNcmConsoleEvent* theLastEvent = iEventList.Last();
+	delete theLastEvent;
+
+	ScheduleDraw('E');
+	}
+
+void CUsbNcmConsole::DrawL()
+/**
+Display all infomation on screen. 
+There are two parts on the screen. One is permanent info. It will display all kinds of states such as USB device state,
+USB service state, NCM state, and so on. The other is event info show. It will display the events reported by monitors
+and commands. It also used to show command help when user need command help. 
+*/
+	{
+	iConsole->ClearScreen();
+	// First line is the server version number 
+	TVersionName versionName = iVersion.Name();
+	iConsole->Printf(_L(
+		//          1         2         3         4         5
+		// 12345678901234567890123456789012345678901234567890123
+		"Server Version: %S             %S\n"
+		),
+		&versionName, &iDisplayArray[EAuthorisationSettingItem]
+		);
+
+	
+	iConsole->Printf(_L("Service: %S    Device: %S\n"), 
+			&iDisplayArray[EUsbServiceStateItem], &iDisplayArray[EUsbDeviceStateItem]);
+	iConsole->Printf(_L("NCM Iap:%2d state:%S IP:%S\n"), 
+			iLocalIapId, &iDisplayArray[ENcmConnStatusItem], &iDisplayArray[ENcmConnIpItem]);
+	iConsole->Printf(_L("Active:%S NcmConnection:%S\n"), 
+			&iDisplayArray[ENcmBtPanItem], &iDisplayArray[ENcmAgentStateItem]);
+    iConsole->Printf(_L("Ncm connection:%S\n"), &iDisplayArray[ENcmConnectionStateItem]);
+	
+	if ((iHelp > 0) && (iHelp <=9))
+		{
+		iConsole->Printf(_L("Press 0 to quit help\n\n"));
+		//Display the command help
+		iKeys->PrintHelp(iHelp);
+		}
+	else
+		{
+		iConsole->Printf(_L("Press 1 to 9 to get menu help\n\n"));
+		//Display the event list
+		TDblQueIter<CUsbNcmConsoleEvent> iter(iEventList);
+		CUsbNcmConsoleEvent* event = NULL;
+		while((event = iter++) != NULL)
+			{
+			iConsole->Printf(event->iEvent.Left(NUM_CHARACTERS_ON_LINE-1));
+			iConsole->Printf(_L("\n"));
+			}
+		}
+	}
+	
+
+void CUsbNcmConsole::CreateDisplayItemL()
+/**
+Init the display item.
+*/
+	{
+	for(TInt i = 0; i < ELastItem; i++)
+		{
+		RBuf buf;
+		iDisplayArray.AppendL(buf);
+		iDisplayArray[i].CreateL(gDisplayItemLength[i]);
+		}
+	}
+
+void CUsbNcmConsole::SetDisplayItem(TInt aIndex, TDes& aInfo)
+/**
+Called by commands and monitors to show the changed info in screen
+*/
+	{
+	//Prevent array is out of bound
+	__ASSERT_ALWAYS(((aIndex < ELastItem) && (aIndex >= 0)), Panic(ENcmDisplayItemVaild));
+	
+	iDisplayArray[aIndex].SetLength(0);
+	iDisplayArray[aIndex].Copy(aInfo);
+	
+	ScheduleDraw('E');
+	}
+
+TInt CUsbNcmConsole::LocalIapId() const
+	{
+	return iLocalIapId;
+	}
+
+const TDes& CUsbNcmConsole::GetDisplayItem(TInt aIndex)
+	{
+	//Prevent array is out of bound
+	__ASSERT_ALWAYS(((aIndex < ELastItem) && (aIndex >= 0)), Panic(ENcmDisplayItemVaild));
+
+	return iDisplayArray[aIndex];
+	}
+
+
+TInt CUsbNcmConsole::DoCommandCallback(TAny *aThisPtr)
+	{
+	CNcmCommandBase* command = static_cast<CNcmCommandBase*>(aThisPtr);
+	TRAPD(err,command->DoCommandL());
+	if(err != KErrNone)
+		{
+		User::Panic(_L("DoCommandCallback"), err);
+		}
+	return err;
+	}
+
+
+TInt CUsbNcmConsole::DrawAvailableIapsL()
+/**
+Display commsdb's iaps on console
+@return the count of iaps
+*/
+	{
+	LOG_FUNC
+	__FLOG_STATIC0(KSubSys, KLogComponent , _L8("CNcmTestUtil::DrawAvailableIapsL"));
+
+	iConsole->Printf(_L("CommDB IAPs:\n"));
+	iConsole->Printf(_L("ID: Name\n"));
+	
+	//Get commsdb handle
+	CCommsDatabase* db = CCommsDatabase::NewL();
+	__FLOG_STATIC0(KSubSys, KLogComponent , _L8("Get CommsDatabase ok"));	
+	CleanupStack::PushL(db);
+	
+	//Get Iap table infomation
+	CCommsDbTableView* iapTableView = db->OpenTableLC(TPtrC(IAP));
+	__FLOG_STATIC0(KSubSys, KLogComponent , _L8("OpenTableLC ok"));
+
+	
+	TUint32 iapId;
+	TBuf<128> iapName;
+	TInt iapCount = 0;
+	
+	for (TInt iapTableErr = iapTableView->GotoFirstRecord(); iapTableErr == KErrNone; iapTableErr = iapTableView->GotoNextRecord())
+		{
+		//Get every IAP
+		iapTableView->ReadTextL(TPtrC(COMMDB_NAME), iapName);
+		iapTableView->ReadUintL(TPtrC(COMMDB_ID), iapId);
+		
+		__FLOG_STATIC2(KSubSys, KLogComponent , _L8("Read: %d: %S"), iapId, &iapName);
+
+		iConsole->Printf(_L("%d: %S\n"), iapId, &iapName);		
+		iapCount++;
+		}
+
+	if (0 == iapCount)
+		{
+		iConsole->Printf(_L("No available IAP!\n"));
+		}
+		
+	CleanupStack::PopAndDestroy(2); // iapTableView, db
+	return iapCount;
+	
+	}
+
+TBool CUsbNcmConsole::AttachConnectionL(TInt aIap, RConnection& aConnection)
+/**
+Try to attach the connection specified by iIapId. If attach failed or no specified connection,return false
+*/
+	{
+	LOG_FUNC
+	__FLOG_STATIC1(KSubSys, KLogComponent , _L8("AttachConnectionL aIap=%d"), aIap);
+
+	TBool result = ETrue;
+	TUint count = 0;
+	//Get active connections
+	User::LeaveIfError(aConnection.EnumerateConnections(count));
+	__FLOG_STATIC2(KSubSys, KLogComponent , _L8("active connection count = %d, watch iap = %d"), count, aIap);
+
+	TBool hasConnection = EFalse;
+	for(TInt i = 1; i <= count; i++)
+		{
+		TPckgBuf<TConnectionInfo> info;
+		User::LeaveIfError(aConnection.GetConnectionInfo(i,info));
+		TUint32 id = info().iIapId;
+		__FLOG_STATIC2(KSubSys, KLogComponent , _L8("aIap=%d, id=%d"), aIap, id);
+		
+		if(id == aIap)
+			{
+			hasConnection = ETrue;
+			//The connection is the connection specified by aIap
+			__FLOG_STATIC0(KSubSys, KLogComponent , _L8("Got it!"));			
+
+			//Attach the connection
+			TInt err = aConnection.Attach(info, RConnection::EAttachTypeMonitor);	
+			if(err != KErrNone)
+				{
+				result = EFalse;
+				__FLOG_STATIC1(KSubSys, KLogComponent , _L8("Attach error[%d]"), err);
+				}
+			else
+				{
+				__FLOG_STATIC0(KSubSys, KLogComponent , _L8("Attach it!"));	
+				}
+			break;
+			}
+		}
+
+	if(!hasConnection)
+		{
+		//connection not found;
+		__FLOG_STATIC0(KSubSys, KLogComponent , _L8("No connection found!"));			
+		result = EFalse;		
+		}
+
+	return result;
+
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/t_ncm/src/ncmwatcher.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,103 @@
+/*
+* Copyright (c) 2002-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
+ */
+
+#include "ncmwatcher.h"
+#include "ncmtestconsole.h"
+
+using namespace UsbNcm;
+
+//
+// CSharedStateWatcher
+//
+CSharedStateWatcher* CSharedStateWatcher::NewL(CUsbNcmConsole& aConsole)
+    {
+    CSharedStateWatcher* self = new (ELeave) CSharedStateWatcher(aConsole);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CSharedStateWatcher::CSharedStateWatcher(CUsbNcmConsole& aConsole) :
+    CActive(EPriorityStandard), iConsole(aConsole), iNcmStateDes(
+            reinterpret_cast<TUint8*> (&iSharedState), sizeof(iSharedState),
+            sizeof(iSharedState))
+    {
+    CActiveScheduler::Add(this);
+    }
+
+CSharedStateWatcher::~CSharedStateWatcher()
+    {
+    Cancel();
+    iProperty.Close();
+    }
+
+void CSharedStateWatcher::ConstructL()
+    {
+    User::LeaveIfError(iProperty.Attach(KC32ExeSid, KKeyNcmConnectionEvent));
+    reportState();
+    iProperty.Subscribe(iStatus);
+    SetActive();
+    }
+
+void CSharedStateWatcher::RunL()
+    {
+    TInt err = iStatus.Int();
+    iProperty.Subscribe(iStatus);
+    SetActive();
+
+    if (KErrNone == err)
+        {
+        reportState();
+        }
+    }
+
+void CSharedStateWatcher::reportState()
+    {
+    iProperty.Get(iNcmStateDes);
+    TBuf<DISPLAY_NCM_CONNECTION_STATE> stateBuf;
+    switch (iSharedState.iState)
+        {
+        case ENcmStateDisconnected:
+            stateBuf = _L("DisConnected");
+            break;
+        case ENcmStateConnected:
+            stateBuf = _L("Connected");
+            break;
+        default:
+            stateBuf = _L("Unknown");
+            break;
+        }
+    __FLOG_STATIC2(KSubSys, KLogComponent ,
+            _L8("NCM state=%d, iapid=%d"), iSharedState.iState, iSharedState.iIapId);
+
+    iConsole.SetLocalIapId(iSharedState.iIapId);
+    iConsole.SetDisplayItem(ENcmConnectionStateItem, stateBuf);
+    }
+
+/**
+ Stop checking the shared state 
+ */
+void CSharedStateWatcher::DoCancel()
+    {
+    iProperty.Cancel();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/t_ncm/src/servicewatcher.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,135 @@
+/*
+* Copyright (c) 2002-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
+ */
+
+#include "servicewatcher.h"
+#include "ncmtestconsole.h"
+#include "ncmtestdefines.hrh"
+
+CServiceWatcher* CServiceWatcher::NewL(CUsbNcmConsole& aTestConsole)
+	{
+	LOG_STATIC_FUNC_ENTRY
+
+	CServiceWatcher* self = new(ELeave) CServiceWatcher(aTestConsole);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+CServiceWatcher::~CServiceWatcher()
+	{
+	Cancel();
+	}
+
+CServiceWatcher::CServiceWatcher(CUsbNcmConsole& aTestConsole)
+	: CActive(EPriorityStandard), iTestConsole(aTestConsole)
+	{
+	CActiveScheduler::Add(this);
+	}
+
+void CServiceWatcher::ConstructL()
+	{
+	iTestConsole.Usb().ServiceStateNotification(iServiceState, iStatus);
+	SetActive();
+
+	TUsbServiceState serviceState;
+	User::LeaveIfError(iTestConsole.Usb().GetServiceState(serviceState));
+	DisplayServiceState(serviceState);
+	}
+
+void CServiceWatcher::DoCancel()
+	{
+	iTestConsole.Usb().ServiceStateNotificationCancel();
+	}
+
+void CServiceWatcher::RunL()
+	{	
+	LOG_FUNC
+	__FLOG_STATIC2(KSubSys, KLogComponent , 
+			_L8("CServiceWatcherCommand::RunL - iStatus = %d, iServiceState = %d"), 
+			iStatus.Int(), iServiceState);
+
+	User::LeaveIfError(iStatus.Int());
+
+	iTestConsole.Usb().ServiceStateNotification(iServiceState, iStatus);
+	SetActive();
+
+	iTestConsole.Usb().GetServiceState(iServiceState);
+	//Display the service state on main console
+	DisplayServiceState(iServiceState);
+
+	}
+
+TInt CServiceWatcher::RunError(TInt aError)
+	{
+	User::Panic(_L("CServiceWatcher"), aError);
+	return aError;
+	}
+
+void CServiceWatcher::DisplayServiceState(TUsbServiceState aServiceState)
+/**
+Display the service state on main console
+  @param  aServiceState 	Service state
+*/
+	{
+	TBuf<DISPLAY_USB_SERVICE_STATE_LEN> servStatus;
+	switch(aServiceState)
+		{
+    case EUsbServiceIdle:
+    	servStatus =
+    		//  12345678901
+			_L("Idle       ");
+    	break;
+
+	case EUsbServiceStarting:
+		servStatus =
+    		//  12345678901
+			_L("Starting   ");
+		break;
+
+	case EUsbServiceStarted:
+		servStatus =
+    		//  12345678901
+			_L("Started    ");
+		break;
+
+	case EUsbServiceStopping:
+		servStatus =
+    		//  12345678901
+			_L("Stopping   ");
+		break;
+
+	case EUsbServiceFatalError:
+		servStatus =
+    		//  12345678901
+			_L("Error      ");
+		break;
+
+	default:
+		servStatus =
+			_L("Unknown    ");
+
+		break;
+		}
+	
+	iTestConsole.SetDisplayItem(EUsbServiceStateItem, servStatus);
+	
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/t_ncm/src/setncmiapcommand.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,308 @@
+/*
+* Copyright (c) 2002-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
+ */
+
+#include "setncmiapcommand.h"
+#include "ncmtestconsole.h"
+
+_LIT(KSetNcmIapCommandDescription, "Set Ncm Iap ID");
+
+CSetNcmIapCommand* CSetNcmIapCommand::NewL(CUsbNcmConsole& aTestConsole, TUint aKey)
+	{
+	LOG_STATIC_FUNC_ENTRY
+	
+	CSetNcmIapCommand* self = new(ELeave) CSetNcmIapCommand(aTestConsole, aKey);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+CSetNcmIapCommand::~CSetNcmIapCommand()
+	{
+	EndWork();
+	}
+
+CSetNcmIapCommand::CSetNcmIapCommand(CUsbNcmConsole& aTestConsole, TUint aKey)
+	: CNcmCommandBase(EPriorityStandard, aTestConsole, aKey)
+	{
+	CActiveScheduler::Add(this);
+	}
+
+void CSetNcmIapCommand::ConstructL()
+	{
+	SetDescription(KSetNcmIapCommandDescription());
+	}
+
+void CSetNcmIapCommand::DoCommandL()
+/**
+Main function of set ncm iap. 
+It will start a new console to display all Iaps in commsdb and current setting for ncm. 
+Then prompt user to input ncm iap id and the index of this iap will be placed in central 
+repository. Press 'ESC' for give up this function. After the setting is successful, the 
+console will be destroyed and return to main console
+*/	
+	{
+	LOG_FUNC
+
+	if(!IsActive())
+		{
+		//If the console has existed, close the old console. The work on old console will be 
+		//gived up.
+		if(iConsole)
+			{
+			__FLOG_STATIC0(KSubSys, KLogComponent , _L8("Close old console"));
+			EndWork();
+			}
+		InitWorkL();
+		
+		iConsole->Printf(_L("Press \'ESC\' to exit without change\n"));
+		
+		//Display all iaps in commsdb
+		ListAllNcmIapL();
+	
+		//wait user input iap id
+		iConsole->Printf(KSetIapMemo());
+		iCommandState = EIapId;
+		iConsole->Read(iStatus);
+		SetActive();
+		}				
+	}
+
+void CSetNcmIapCommand::ListAllNcmIapL()
+/**
+Display all iaps in commsdb on console and get current config in cental repoistory
+*/
+	{
+	LOG_FUNC
+	
+	//Display commsdb's iaps
+	TInt iapcount = iTestConsole.DrawAvailableIapsL();
+
+	TInt iapId = 0;
+
+	//Get iap config from central repository
+	TInt err = iRepository->FindL(KPartialKey, KMask, iRows);
+	if(err == KErrNone)
+		{
+		TUint count = iRows.Count();
+		for (TInt row = 0; row < count; ++row)
+		    {
+		    // Read each IAP ID
+		    User::LeaveIfError(iRepository->Get(iRows[row], iapId));
+			__FLOG_STATIC2(KSubSys, KLogComponent , _L8("index[%d]: iap = %d"), row, iapId);		    
+		    iConsole->Printf(_L("index[%d]: iap = %d\n"), row, iapId);
+		    }  
+		}
+	else
+		{
+		__FLOG_STATIC1(KSubSys, KLogComponent , _L8("FindL() err[%d]"), err);		    		
+		}
+	}
+
+void CSetNcmIapCommand::GetDefaultIapL(TInt& aDefaultIap)
+/**
+Get the default iap id (The first one) stored in central repository. 
+@return the default iap id
+*/
+	{
+	LOG_FUNC
+	aDefaultIap = 13;
+	return ;
+	}
+
+void CSetNcmIapCommand::SetNcmIapL()
+/**
+Set iap id into central repository. The iap id is iIapId. The place of iap id in central
+repository is iIndex. iIndex is started from 0. If the iIndex is not exist in central 
+repository, iIapId will be placed at last place. 
+*/
+	{
+	LOG_FUNC
+	
+	TUint count = iRows.Count();
+	__FLOG_STATIC1(KSubSys, KLogComponent , _L8("now iap count = %d"), count);
+
+	TInt idx;
+	if(iIndex >= count)
+		{
+		//iIndex is not exist in central repository, create a new entry in central repository
+		idx = iRows[count-1]+1;
+		User::LeaveIfError(iRepository->Create(idx, iIapId));
+		__FLOG_STATIC2(KSubSys, KLogComponent , _L8("add iap: idx = %d, iIapId"), idx, iIapId);		
+		}
+	else
+		{
+		//iIndex exists, just set in the new value
+		idx = iRows[iIndex];
+		User::LeaveIfError(iRepository->Set(idx, iIapId));
+		__FLOG_STATIC2(KSubSys, KLogComponent , _L8("set iap: aIdx = %d, iIapId"), idx, iIapId);		
+		}
+
+	}
+
+void CSetNcmIapCommand::RunL()
+	{
+	LOG_FUNC
+	__FLOG_STATIC1(KSubSys, KLogComponent , _L8("CSetNcmIapCommand::RunL - iStatus = %d"), iStatus.Int());
+
+	User::LeaveIfError(iStatus.Int());
+
+	TKeyCode code = iConsole->KeyCode();
+	switch(code)
+		{
+		case EKeyEnter:
+			{
+			iConsole->Printf(_L("\n"));
+
+			//get value
+			TInt val;
+			TBool typeErr = EFalse;
+			if(iChars.Length() != 0)
+				{					
+				TLex lex(iChars);				
+				lex.SkipSpaceAndMark();
+
+				if(KErrNone != lex.Val(val))
+					{
+					typeErr = ETrue;
+					}
+				}
+			else
+				{
+				typeErr = ETrue;
+				}
+			
+			if(typeErr)
+				{
+				//Prompt user input again
+				iConsole->Printf(KErrInput());
+				iConsole->Printf(KSetIapMemo());
+				iChars.SetLength(0);
+				__FLOG_STATIC0(KSubSys, KLogComponent , _L8("Input error"));
+				break;					
+				}
+			
+			//The input is correct
+			__FLOG_STATIC1(KSubSys, KLogComponent , _L8("Get val = %d"), val);
+			
+			if(iCommandState == EIapId)
+				{
+				//if the command state is wait iap id, now get the iap id, wait for iap index
+				iIapId = val;
+				iChars.SetLength(0);
+				iConsole->Printf(KSetIapIndexMemo());
+				iCommandState = EIapPriority;
+				}
+			else //(iCommandState == EIapPriority)
+				{
+				//if the command state is wait iap index, now the index. set into central repoistory.
+				//Then destroy the current console and update the value displayed on main console if the
+				//setting value is ncm default value.
+				iIndex = val;
+				SetNcmIapL();
+				EndWork();
+				if(iIndex == 0)
+					{
+					iTestConsole.SetLocalIapId(iIapId);
+					}
+				__FLOG_STATIC2(KSubSys, KLogComponent , _L8("Set Ncm Iap, idx = %d, id = %d"),
+						iIndex, iIapId);
+
+				return;
+				}				
+			}
+			break;
+		case EKeyEscape:
+			//delete this;
+			EndWork();
+			return;
+		case EKeyBackspace:
+			if(iChars.Length() > 0)
+				{
+				iConsole->SetCursorPosRel(TPoint(-1, 0));
+				iConsole->ClearToEndOfLine();
+				iChars.SetLength(iChars.Length()-1);
+				}
+			break;
+		default:
+			iChars.Append(code);
+			iConsole->Printf(_L("%c"), code);
+			break;
+		}
+	iConsole->Read(iStatus);
+	SetActive();
+	
+	}
+
+void CSetNcmIapCommand::DoCancel()
+	{
+	iConsole->ReadCancel();
+	}
+
+TInt CSetNcmIapCommand::RunError(TInt aError)
+	{
+	User::Panic(_L("CSetNcmIapCommand"), aError);
+	return aError;
+	}
+
+void CSetNcmIapCommand::InitWorkL()
+/**
+Initialize work. Including start a new console, create buf for getting user input, get repoistory handle.
+*/
+	{
+	LOG_FUNC
+
+	if(!iConsole)
+		{		
+		iConsole = Console::NewL(_L("Set Ncm IAP Console"), TSize(-1,-1));
+		__FLOG_STATIC0(KSubSys, KLogComponent , _L8("Create Console ok!"));
+
+		User::LeaveIfError(iChars.Create(KMaxNumOfChars));
+		__FLOG_STATIC0(KSubSys, KLogComponent , _L8("Create iChars ok!"));
+
+		iRepository = CRepository::NewL(KNcmIapIdRepositoryUID);	
+		__FLOG_STATIC0(KSubSys, KLogComponent , _L8("Get CRepository ok!"));
+		
+		iIapId = 1;
+		iIndex = 0;
+		}
+	}
+
+void CSetNcmIapCommand::EndWork()
+/**
+Finalize work. Including delete console, delete the buf used for getting user input, close repoistory handle.
+*/
+	{
+	LOG_FUNC
+	
+	if(iConsole)
+		{
+		__FLOG_STATIC0(KSubSys, KLogComponent , _L8("Destroy console..."));
+		Cancel();
+		iChars.Close();
+		iRows.Close();
+		delete iRepository;
+		delete iConsole;
+		iConsole = NULL;
+		__FLOG_STATIC0(KSubSys, KLogComponent , _L8("Destroy console ok!"));
+		}
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/t_ncm/src/simpancommand.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,269 @@
+/*
+* Copyright (c) 2002-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
+ */
+
+#include <e32property.h> 
+
+#include "simpancommand.h"
+#include "ncmtestconsole.h"
+
+static _LIT_SECURITY_POLICY_PASS(KAllowAllPolicy);
+static _LIT_SECURITY_POLICY_C1(KNetworkControlPolicy, ECapabilityNetworkControl); 
+
+_LIT(KSimPANCommandActive, "Simulate PAN connection is active");
+_LIT(KSimPANCommandNone, "Simulate PAN connection is not active");
+
+CSimPANCommand* CSimPANCommand::NewL(CUsbNcmConsole& aTestConsole, TUint aKey)
+	{
+	LOG_STATIC_FUNC_ENTRY
+	
+	CSimPANCommand* self = new(ELeave) CSimPANCommand(aTestConsole, aKey);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+CSimPANCommand::~CSimPANCommand()
+	{
+	Cancel();
+	iNcmExclusiveProp.Close();
+	}
+
+CSimPANCommand::CSimPANCommand(CUsbNcmConsole& aTestConsole, TUint aKey)
+	: CNcmCommandBase(EPriorityStandard, aTestConsole, aKey)
+	{
+	}
+
+void CSimPANCommand::ConstructL()
+	{
+	//Attach the property of Exclusive state
+	User::LeaveIfError(iNcmExclusiveProp.Attach(KC32ExeSid, KIPBearerCoexistenceProperty));
+	CActiveScheduler::Add(this);
+	iNcmExclusiveProp.Subscribe(iStatus);
+	SetActive();
+	
+	//Get the current value of exclusive state
+	TInt state; 
+	TInt err = iNcmExclusiveProp.Get(state);
+	switch(err)
+		{
+		case KErrNotFound:
+			//The property is not defined. means BtPAN and Ncm didn't start.
+			DisplayExclusive(ENoneIsActive);
+			break;
+		case KErrNone:
+			//Display the exclusive state on main console
+			DisplayExclusive(state);
+			break;
+		default:
+			User::LeaveIfError(err);
+			break;
+		}
+ 
+	}
+
+void CSimPANCommand::RunL()
+/**
+Get the current exclusive state and update on main console when the state changed
+*/	
+	{
+	LOG_FUNC
+	__FLOG_STATIC1(KSubSys, KLogComponent , _L8("CNcmExclusiveStateAO::RunL - iStatus = %d"), iStatus.Int());
+
+	User::LeaveIfError(iStatus.Int());
+
+	iNcmExclusiveProp.Subscribe(iStatus);
+	SetActive();
+	
+	TInt exclusiveState; 
+	TInt err = iNcmExclusiveProp.Get(exclusiveState);
+
+	__FLOG_STATIC2(KSubSys, KLogComponent , _L8("Get[IPBearerCoexistence]=%d, err=%d"), exclusiveState, err);
+
+	if(err == KErrNone)
+		{
+		//Display the exclusive state on main console
+		DisplayExclusive(exclusiveState);
+		}	
+	}
+
+void CSimPANCommand::DoCancel()
+	{
+	iNcmExclusiveProp.Cancel();
+	}
+
+TInt CSimPANCommand::RunError(TInt aError)
+	{
+	User::Panic(_L("CSimPANCommand"), aError);
+	return aError;
+	}
+
+void CSimPANCommand::DoCommandL()
+/**
+Main function of simualate Pan active/inactive. 
+It will try to get the exclusive state from P&S key. And set the value based on the iSetPAN.
+There's three value for this P&S key: EExclusiveNone,ENcmOwned,EBtPanOwned
+
+If now the command is 'active PAN'(iSetPAN=ETrue), then set the value of property to Pan active.
+If now the command is 'inactive PAN'(iSetPAN=EFalse), then set the value of property to Pan inactive.
+*/	
+	{
+	LOG_FUNC
+		
+	//Get the mutex which used to protect the P&S key.
+	RMutex mtx;
+	TInt ret;
+	ret = mtx.CreateGlobal(KIPBearerCoexistenceMutex);
+	if (ret == KErrAlreadyExists)
+		{
+		ret  = mtx.OpenGlobal(KIPBearerCoexistenceMutex);
+		}	
+	User::LeaveIfError(ret);
+	__FLOG_STATIC0(KSubSys, KLogComponent , _L8("Get Mutex, wait()"));
+	CleanupClosePushL(mtx);
+ 	mtx.Wait();
+ 	
+ 	RProperty prop;
+ 	TInt state;
+ 	TBool bSet = ETrue;
+ 	
+ 	//Get the exclusive state.
+ 	ret = prop.Get(KC32ExeSid, KIPBearerCoexistenceProperty, state);
+	CleanupClosePushL(prop);
+ 	__FLOG_STATIC2(KSubSys, KLogComponent , _L8("Get Property[IPBearerCoexistence]: ret=%d, val=%d"), ret, state);
+ 	
+ 	switch(ret)
+ 		{
+ 		case KErrNotFound:
+ 			{
+	 		//The property not exists. (NCM not start.)
+	
+		 	__FLOG_STATIC0(KSubSys, KLogComponent , _L8("Not define property yet. define it"));		
+			CUsbNcmConsoleEvent* event = CUsbNcmConsoleEvent::NewL();
+			event->iEvent.AppendFormat(_L("Not define property yet. define it."));
+			iTestConsole.NotifyEvent(event);
+	
+			//Define the property
+			User::LeaveIfError(RProperty::Define(KC32ExeSid, KIPBearerCoexistenceProperty, RProperty::EInt, KAllowAllPolicy, KNetworkControlPolicy));
+		 	__FLOG_STATIC0(KSubSys, KLogComponent , _L8("Define Property[IPBearerCoexistence] ok"));
+		 	break;
+ 			}
+ 		case KErrNone:
+ 			{
+	 		//property exists.
+	 		if(state == ENcmIsActive)
+	 			{
+	 			//Ncm hold the key. PAN can't active. Do nothing in this command.
+	 			CUsbNcmConsoleEvent* event = CUsbNcmConsoleEvent::NewL();
+	 			event->iEvent.AppendFormat(_L("NCM hold the P&S key!"));
+	 			iTestConsole.NotifyEvent(event); 	
+	 			bSet = EFalse;
+	 			}
+	 		break;
+ 			}
+ 		default:
+ 			{
+ 			//error when get P&S key.
+ 			CUsbNcmConsoleEvent* event = CUsbNcmConsoleEvent::NewL();
+ 			event->iEvent.AppendFormat(_L("Get P&S key error! err = %d"), ret);
+ 			iTestConsole.NotifyEvent(event);
+ 			bSet = EFalse;
+ 			break;
+ 			}
+ 		}
+ 	
+ 	if(bSet)
+ 		{
+ 		//Set the property value
+		CUsbNcmConsoleEvent* event = CUsbNcmConsoleEvent::NewL();
+		CleanupStack::PushL(event);
+ 		if(this->iSetPAN)
+ 			{
+ 			User::LeaveIfError(prop.Set(KC32ExeSid, KIPBearerCoexistenceProperty, EBTPanIsActive));
+ 	 		__FLOG_STATIC1(KSubSys, KLogComponent , _L8("Set Property[IPBearerCoexistence]: val = %d"), EBTPanIsActive);		
+ 			event->iEvent.AppendFormat(_L("Set PAN active! prop=%d"), EBTPanIsActive);			
+ 			}
+ 		else
+ 			{
+ 			User::LeaveIfError(prop.Set(KC32ExeSid, KIPBearerCoexistenceProperty, ENoneIsActive));
+ 	 		__FLOG_STATIC1(KSubSys, KLogComponent , _L8("Set Property[IPBearerCoexistence]: val = %d"), ENoneIsActive);		
+			event->iEvent.AppendFormat(_L("Set PAN disactive! prop=%d"), ENoneIsActive);
+			}
+ 		CleanupStack::Pop(event);
+		iTestConsole.NotifyEvent(event);
+					
+ 		}
+ 	
+ 	CleanupStack::Pop(2, &mtx); //prop, mtx
+ 	mtx.Signal();
+ 	prop.Close();
+ 	mtx.Close();
+ 	
+	}
+
+void CSimPANCommand::ChangeDescription()
+	{
+	if(iSetPAN)
+		{
+		SetDescription(KSimPANCommandActive());
+		}
+	else
+		{
+		SetDescription(KSimPANCommandNone());
+		}
+	}
+
+void CSimPANCommand::DisplayExclusive(TInt aState)
+/**
+Display the exclusive state on main console and change the description of command by the
+value of aState
+  @param  aState 	Exclusive state
+*/
+	{
+	TBuf<DISPLAY_NCM_BTPAN_LEN>	exclusive;
+	iSetPAN = ETrue;
+	switch(aState)
+		{
+		case ENoneIsActive:
+			{
+			exclusive = _L("None    ");
+			}
+			break;
+		case ENcmIsActive:
+			{
+			exclusive = _L("NCM   ");
+			}
+			break;
+		case EBTPanIsActive:
+			{
+			exclusive = _L("BT PAN  ");
+			//If Bt Pan is active, the command description should be 'disactive BT PAN'
+			iSetPAN = EFalse;
+			}
+			break;
+		default:
+			exclusive = _L("        ");
+			break;
+		}
+	
+	ChangeDescription();
+	iTestConsole.SetDisplayItem(ENcmBtPanItem, exclusive);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/t_ncm/src/tcpcommand.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,142 @@
+/*
+* Copyright (c) 2002-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
+ */
+
+#include "tcpcommand.h"
+#include "tcptest.h"
+#include "ncmtestconsole.h"
+
+_LIT(KTcpClientCommandDescription, "Create tcp connection from H4 to PC");
+_LIT(KTcpServerCommandDescription, "Create tcp connection from PC to H4");
+_LIT(KUdpClientCommandDescription, "Create udp connection from H4 to PC");
+_LIT(KUdpServerCommandDescription, "Create udp connection from PC to H4");
+
+
+const TInt KDefaultPortFrom = 5000;
+
+CTcpCommand* CTcpCommand::NewL(CUsbNcmConsole& aTestConsole, TUint aKey, TBool aIsTcp, TBool aIsServer)
+	{
+	LOG_STATIC_FUNC_ENTRY
+	
+	CTcpCommand* self = new(ELeave) CTcpCommand(aTestConsole, aKey, aIsTcp, aIsServer);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+CTcpCommand::~CTcpCommand()
+	{
+	for(TInt i = 0; i < KMaxTcpTestCount; i++)
+		{
+		delete iTestArray[i];
+		}	
+	}
+
+CTcpCommand::CTcpCommand(CUsbNcmConsole& aTestConsole, TUint aKey, TBool aIsTcp, TBool aIsServer)
+	: CNcmCommandBase(EPriorityStandard, aTestConsole, aKey), iIsTcp(aIsTcp), iIsServer(aIsServer)
+	{
+	}
+
+void CTcpCommand::ConstructL()
+    {
+    if (iIsServer)
+        {
+        if (iIsTcp)
+            {
+            SetDescription(KTcpServerCommandDescription());
+            }
+        else
+            {
+            SetDescription(KUdpServerCommandDescription());
+            }
+        }
+    else
+        {
+        if (iIsTcp)
+            {
+            SetDescription(KTcpClientCommandDescription());
+            }
+        else
+            {
+            SetDescription(KUdpClientCommandDescription());
+            }
+        }
+    }
+
+void CTcpCommand::DoCommandL()
+	{
+	LOG_FUNC
+	
+	//Create an CTcpTestConsole object to run the tcp test.
+	TBool noRun = ETrue;
+	for(TInt i = 0; i < KMaxTcpTestCount; i++)
+		{
+		if(!iTestArray[i])
+			{
+			//create the default parameter for tcp test
+			//  as a server : the parameter is port (Listen at which port)
+			//  as a client : the parameter is ip and port. IP is got from NCM's IP + 1
+			//                   (The DHCP server will assign "NCM's IP+1" to PC.)
+			RBuf addr;
+			addr.CreateL(30);
+			
+			if(!iIsServer)
+				{
+				TInetAddr serverIP;
+				serverIP.Input(_L("192.168.3.100"));
+				//serverIP.Input(iTestConsole.GetDisplayItem(ENcmConnIpItem));
+				TUint32 serverAddr = serverIP.Address();
+				TUint32 hostId = (serverAddr & ~KInetAddrNetMaskC) + 1;
+				if (hostId >= 255)
+					 {
+					 hostId = 1;
+					 }
+				TUint32 clientAddr = (serverAddr & KInetAddrNetMaskC) | hostId;
+				TInetAddr clientIP(clientAddr, 0);
+				clientIP.Output(addr);			
+				}
+			
+			addr.AppendFormat(_L(" %d"), KDefaultPortFrom+i);
+			//Create a tcp test console
+			iTestArray[i] = CTcpTestConsole::NewL(iIsTcp, iIsServer, addr, i, *this);
+			noRun = EFalse;
+			addr.Close();
+			break;
+			}
+		}
+	if(noRun)
+		{
+		//The count of tcp test is up to the max value. 
+		CUsbNcmConsoleEvent* event = CUsbNcmConsoleEvent::NewL();
+		TInt count = KMaxTcpTestCount;
+		event->iEvent.AppendFormat(_L("The test connection is up to %d.Please close some."), count);
+		iTestConsole.NotifyEvent(event);			
+		}
+	}
+
+void CTcpCommand::CloseTcpTest(TInt aIndex)
+	{
+	__ASSERT_ALWAYS(((aIndex < KMaxTcpTestCount) && (aIndex >= 0)), Panic(ENcmArrayBound));
+
+	delete iTestArray[aIndex];
+	iTestArray[aIndex] = NULL;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/t_ncm/src/tcptest.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,612 @@
+/*
+* Copyright (c) 2002-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
+ */
+
+#include "tcptest.h"
+#include <in_sock.h>
+#include <commdbconnpref.h>
+#include <es_enum.h>
+#include "tcpcommand.h"
+#include "ncmtestconsole.h"
+
+_LIT8(KSendData, "TCP-Packet::HelloWorld\n");
+
+static const TInt KMaxNumOfChars = 255;
+
+//The title of TCP test console
+_LIT(KTcpServerMode, "Tcp Server");
+_LIT(KTcpClientMode, "Tcp Client");
+
+//The default value of data size
+static const TInt KDefaultDataSize = 30;
+
+CTcpProcess* CTcpProcess::NewL(CConsoleBase& aConsole, TInetAddr& aAddr, TInt aPort, TInt aSize, TBool aMode)
+	{
+	CTcpProcess* self = new(ELeave) CTcpProcess(aConsole, aAddr, aPort, aSize, aMode);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+CTcpProcess::~CTcpProcess()
+	{
+	Cancel();
+	iRecvBuf.Close();
+    iSendBuf.Close();
+    iSocket.Close();
+    iListenSocket.Close();
+    iSockServ.Close();
+	}
+
+CTcpProcess::CTcpProcess(CConsoleBase& aConsole, TInetAddr& aAddr, TInt aPort, TInt aSize, TBool aMode) 
+		:  CActive(EPriorityStandard), iConsole(aConsole), iAddr(aAddr), iPort(aPort), iSize(aSize), iMode(aMode)
+	{
+	CActiveScheduler::Add(this);
+	}
+
+void CTcpProcess::ConstructL()
+	{
+	//Create the data buffer
+	User::LeaveIfError(iSendBuf.Create(iSize));
+	User::LeaveIfError(iRecvBuf.Create(iSize));
+	iRecvSize = iSize;
+	
+	iProcessState = ECreateConnection;
+	
+	User::LeaveIfError(iSockServ.Connect());
+	if(iMode)
+		{
+		//Listen at specified port
+		TBuf<5>		 protocol = _L("tcp");
+		User::LeaveIfError(iListenSocket.Open(iSockServ, protocol));
+		User::LeaveIfError(iListenSocket.SetOpt(KSoReuseAddr, KProtocolInetIp, 1));
+		User::LeaveIfError(iListenSocket.SetLocalPort(iPort));
+		User::LeaveIfError(iListenSocket.Listen(5));
+		User::LeaveIfError(iSocket.Open(iSockServ));
+		iListenSocket.Accept(iSocket, iStatus);
+		iConsole.Printf(_L("\nWait for a connection at port[%d].\n"), iPort);
+		}
+	else
+		{
+        RConnection conn;  
+        User::LeaveIfError(conn.Open(iSockServ));
+        TCommDbConnPref pref;
+        pref.SetIapId(13);
+        pref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
+        User::LeaveIfError(conn.Start(pref));
+        
+		//Connect to specified server
+		User::LeaveIfError(iSocket.Open(iSockServ, KAfInet, KSockStream, KProtocolInetTcp, conn));
+		iSocket.Connect(iAddr, iStatus);
+
+		iConsole.Printf(_L("\nConnecting....\n"));
+		}
+	SetActive();
+	}
+
+
+void CTcpProcess::RunL()
+	{
+	switch(iProcessState)
+		{
+		case ECreateConnection:
+			//Get result of connect
+			if(iStatus.Int() != KErrNone)
+				{
+				iConsole.Printf(_L("Connect err[%d].\nPress any key to quit."), iStatus.Int());
+				return;
+				}
+			else
+				{
+				//A TCP connection is created.
+				if(iMode)
+					{
+					iConsole.Printf(_L("Get a connection.\n"));
+					}
+				else
+					{
+					iConsole.Printf(_L("\nConnected.\n"));					
+					}
+				iProcessState = EDataTransfer;
+
+				//Ready for read data
+				iSocket.RecvOneOrMore(iRecvBuf, 0, iStatus, iRecvSize);
+				__FLOG_STATIC1(KSubSys, KLogComponent , _L8("Ready for read data"), iRecvSize);
+				SetActive();
+				if(!iMode)
+					{
+					//As a client, send data first.
+					iSendBuf.SetLength(iSize);
+					iSendBuf.Repeat(KSendData());
+
+					iConsole.Printf(_L("Send data."));
+					PrintData(iSendBuf);
+					TInt sendLen = SendDataL(iSendBuf, iSize);
+					if(sendLen != iSize)
+						{
+						iConsole.Printf(_L("The length of data sent is not equal to requested! requested[%d], sent[%d]"),
+											iSize, sendLen);
+						}
+					}
+				}
+			break;
+
+		case EDataTransfer:
+			//In data transfer, some data is received
+			iConsole.Printf(_L("recv Package, size[%d], status[%d]\n"), iRecvSize(), iStatus.Int());
+			if((KErrEof == iStatus.Int()) || (KErrDisconnected == iStatus.Int()))
+				{
+				iConsole.Printf(_L("Connection closed!"));
+				return;
+				}
+			else if(KErrNone == iStatus.Int())
+				{
+				iConsole.Printf(_L("Receive data."));
+				PrintData(iRecvBuf);
+
+				if(iMode)
+					{
+					//As a server, send back the data received
+					TInt len = SendDataL(iRecvBuf, iRecvSize());
+					iConsole.Printf(_L("Send back the data. len[%d]"), len);
+					}
+				}	
+			iRecvBuf.SetLength(0);
+			iRecvSize = iSize;
+			iSocket.RecvOneOrMore(iRecvBuf, 0, iStatus, iRecvSize);
+			SetActive();	
+			
+			break;
+		}
+	}
+
+void CTcpProcess::DoCancel()
+	{
+	switch(iProcessState)
+		{
+		case ECreateConnection:
+			if(iMode)
+				{
+				iListenSocket.CancelAccept();
+				}
+			else
+				{
+				iSocket.CancelConnect();
+				}
+			break;
+		case EDataTransfer:
+			iSocket.CancelRecv();
+			break;
+		}
+	}
+
+TInt CTcpProcess::RunError(TInt aError)
+	{
+	User::Panic(_L("CTcpProcess"), aError);
+	return aError;
+	}
+
+TInt CTcpProcess::SendDataL(TDes8& aData, TInt aSize)
+/**
+Send data.
+  @return the size of data sent
+ */
+	{
+	TRequestStatus status;
+	TSockXfrLength sendSize = aSize;
+	iSocket.Send(aData, 0, status, sendSize);
+	User::WaitForRequest(status);
+	
+	switch(status.Int())
+		{
+		case KErrEof:
+			iConsole.Printf(_L("Connection closed!"));
+			return 0;		
+		case KErrNone:
+			iConsole.Printf(_L("Send successfully."));
+			break;
+		default:
+			User::LeaveIfError(status.Int());
+			break;
+		}
+	return sendSize();
+	}
+
+void CTcpProcess::PrintData(TDes8& aData)
+	{
+	iConsole.Printf(_L("The data is: \n"));
+	for(TInt i=0; i< aData.Length();i++)
+		{
+		iConsole.Printf(_L("%c"), aData[i]);
+		}
+	iConsole.Printf(_L("\n"));
+	}
+
+CUdpProcess* CUdpProcess::NewL(CConsoleBase& aConsole, TInetAddr& aAddr,
+        TInt aPort, TInt aSize, TBool aMode)
+    {
+    CUdpProcess* self = new (ELeave) CUdpProcess(aConsole, aAddr, aPort,
+            aSize, aMode);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CUdpProcess::~CUdpProcess()
+    {
+    Cancel();
+    iRecvBuf.Close();
+    iSendBuf.Close();
+    iSocket.Close();
+    iListenSocket.Close();
+    iSockServ.Close();
+    }
+
+CUdpProcess::CUdpProcess(CConsoleBase& aConsole, TInetAddr& aAddr,
+        TInt aPort, TInt aSize, TBool aMode) :
+    CActive(EPriorityStandard), iConsole(aConsole), iAddr(aAddr),
+            iPort(aPort), iSize(aSize), iMode(aMode)
+    {
+    CActiveScheduler::Add(this);
+    }
+
+void CUdpProcess::ConstructL()
+    {
+    //Create the data buffer
+    User::LeaveIfError(iSendBuf.Create(iSize));
+    User::LeaveIfError(iRecvBuf.Create(iSize));
+    iRecvSize = iSize;
+
+    User::LeaveIfError(iSockServ.Connect());
+
+    // Start NCM IAP
+    RConnection conn;
+    User::LeaveIfError(conn.Open(iSockServ));
+    TCommDbConnPref pref;
+    pref.SetIapId(13);
+    pref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
+    User::LeaveIfError(conn.Start(pref));
+    
+    User::LeaveIfError(iSocket.Open(iSockServ, KAfInet, KSockDatagram,
+            KProtocolInetUdp, conn));
+    
+    iConsole.Printf(_L("In constructL, port=%d"), iAddr.Port());
+    
+    if (iMode)
+        {
+        iProcessState = EDataTransfer;
+       
+        User::LeaveIfError(iSocket.SetLocalPort(iPort));
+        iSocket.RecvFrom(iRecvBuf, iPeerAddr, 0, iStatus);
+        iConsole.Printf(_L("\nWait for UDP incoming data at port[%d]...\n"),iPort);
+        SetActive();
+        }
+    else 
+        {
+        iProcessState = EDataSending;
+        SetActive();
+        TRequestStatus* status = &iStatus;
+        User::RequestComplete(status, KErrNone);
+        }
+    }
+
+
+void CUdpProcess::RunL()
+    {
+    __FLOG_STATIC0(KSubSys, KLogComponent , _L8("CUdpProcess::RunL"));
+    switch (iProcessState)
+        {
+        case EDataSending:
+            //As a client, send data first.
+            iSendBuf.SetLength(iSize);
+            iSendBuf.Repeat(KSendData());
+            iConsole.Printf(_L("Send data.."));
+            PrintData(iSendBuf);
+            iConsole.Printf(_L("In RunL, port=%d"), iAddr.Port());
+            TInt sendLen = SendDataL(iSendBuf, iAddr, iSize);
+            
+            if (sendLen != iSize)
+                {
+                iConsole.Printf(
+                        _L("The length of data sent is not equal to requested! requested[%d], sent[%d]"),
+                        iSize, sendLen);
+                }
+            break;
+
+        case EDataTransfer:
+            //In data transfer, some data is received
+            iConsole.Printf(_L("recv Package, size[%d], status[%d]\n"),
+                    iRecvSize(), iStatus.Int());
+            if (KErrNone == iStatus.Int())
+                {
+                iConsole.Printf(_L("Receive data."));
+                PrintData(iRecvBuf);
+
+                if (iMode)
+                    {
+                    //As a server, send back the data received
+                    TInt len = SendDataL(iRecvBuf, iPeerAddr, iRecvBuf.Length());
+                    iConsole.Printf(_L("Send back the data. len[%d]"), len);
+                    }
+                }
+            else
+                {
+                iConsole.Printf(_L("Something is wrong..."));
+                return;
+                }
+
+            iRecvBuf.SetLength(0);
+            iRecvSize = iSize;
+            //iListenSocket.RecvFrom(iRecvBuf, iPeerAddr, 0, iStatus);
+            iSocket.RecvFrom(iRecvBuf, iPeerAddr, 0, iStatus);
+            SetActive();
+            iConsole.Printf(_L("\nWait for UDP incoming data at port[%d]...\n"),iPort);
+            break;
+        }
+    }
+
+void CUdpProcess::DoCancel()
+{
+    switch(iProcessState)
+    {
+    case EDataTransfer:
+        //iListenSocket.CancelRecv();
+        iSocket.CancelRecv();
+        break;
+    }
+}
+
+TInt CUdpProcess::RunError(TInt aError)
+{
+    User::Panic(_L("CUdpProcess"), aError);
+    return aError;
+}
+
+TInt CUdpProcess::SendDataL(TDes8& aData, TInetAddr& aAddr, TInt aSize)
+    /**
+      Send data.
+      @return the size of data sent
+      */
+{
+    TRequestStatus status;
+    
+    TInt port = aAddr.Port();
+    iConsole.Printf(_L("Before sending, size = %d, port=%d\n"), aSize, port);
+    TSockXfrLength sendSize = 0; //aSize;
+    iSocket.SendTo(aData, aAddr, 0, status, sendSize);
+    User::WaitForRequest(status);
+    iConsole.Printf(_L("Sending result = %d, and sent=%d\n"), status.Int(), sendSize());
+
+    switch(status.Int())
+    {
+    case KErrEof:
+        iConsole.Printf(_L("Connection closed!"));
+        return 0;       
+    case KErrNone:
+        iConsole.Printf(_L("Send successfully.\n"));
+        break;
+    default:
+        User::LeaveIfError(status.Int());
+        break;
+    }
+    return sendSize();
+}
+
+void CUdpProcess::PrintData(TDes8& aData)
+{
+    iConsole.Printf(_L("The data is: \n"));
+    for(TInt i=0; i< aData.Length();i++)
+    {
+    iConsole.Printf(_L("%c"), aData[i]);
+    }
+    iConsole.Printf(_L("\n"));
+}
+
+
+
+CTcpTestConsole* CTcpTestConsole::NewL(TBool aIsTcp, TBool aMode, TDesC& aDefautAddr, TInt aIndex, CTcpCommand& aOwner)
+	{
+	CTcpTestConsole* self = new(ELeave) CTcpTestConsole(aIsTcp, aMode, aDefautAddr, aIndex, aOwner);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	
+	}
+
+CTcpTestConsole::CTcpTestConsole(TBool aIsTcp, TBool aMode, TDesC& aDefautAddr, TInt aIndex, CTcpCommand& aOwner) 
+	: CActive(EPriorityStandard),iCommandMode(ECommandInit),  iIsTcp(aIsTcp), iMode(aMode), 
+	  iDefaultAddr(aDefautAddr), iIndex(aIndex), iOwner(aOwner)
+	{	
+	CActiveScheduler::Add(this);
+	}
+
+CTcpTestConsole::~CTcpTestConsole()
+	{
+	Cancel();
+	delete iTcp;
+	delete iUdp;
+    delete iConsole;
+    iChars.Close();
+	}
+
+
+void CTcpTestConsole::ConstructL()
+	{
+	if(iMode)
+		{
+		iConsole = Console::NewL(KTcpServerMode(),TSize(KConsFullScreen,KConsFullScreen));
+		}
+	else
+		{
+		iConsole = Console::NewL(KTcpClientMode(),TSize(KConsFullScreen,KConsFullScreen));
+		}	
+	User::LeaveIfError(iChars.Create(KMaxNumOfChars));
+	//Generate the default value and display on screen, user can modify it if they want to use other value.
+	iChars.AppendFormat(_L("%S %d"), &iDefaultAddr, KDefaultDataSize);
+	Help();
+	//wait user input
+	iConsole->Read(iStatus);
+	SetActive();
+	}
+
+void CTcpTestConsole::Help()
+	{
+	iConsole->Printf(_L("Please change the parameters, then press enter\n"));
+	if(iMode)
+		{
+		iConsole->Printf(_L("   The parameters are port size \n"));
+		iConsole->Printf(_L("   port - The port of the Tcp/udp Server listen to \n"));
+		iConsole->Printf(_L("   size - the max package size \n"));
+		}
+	else
+		{
+		iConsole->Printf(_L("   The parameters are destAddr port size \n"));
+		iConsole->Printf(_L("   destAddr - The ip address of Tcp/udp Client connect to.\n"));
+		iConsole->Printf(_L("   port - The port of Tcp Client connect to \n"));
+		iConsole->Printf(_L("   size - the package size \n"));
+		}
+	//Display the default value
+	iConsole->Printf(_L("%S"), &iChars);
+		
+	}
+TBool CTcpTestConsole::StartL()
+	{
+	TLex args(iChars);
+	// args are separated by spaces
+	args.SkipSpace(); 
+	
+	TInetAddr addr;
+	TInt size;
+
+	if(!iMode)
+		{
+		//Get ip addr
+		TPtrC cmdAddr = args.NextToken();
+		if(!args.Eos())
+			{
+			if(KErrNone == addr.Input(cmdAddr))
+				{
+				args.Inc();
+				}
+			else
+				{
+				return EFalse;
+				}
+			}
+		else
+			{
+			return EFalse;
+			}
+		}
+	
+	//Get port
+	TInt port;
+	if(KErrNone != args.Val(port))
+		{
+		return EFalse;
+		}
+	addr.SetPort(port);
+
+	//Get pkg size
+	args.Inc();
+	if(KErrNone != args.Val(size))
+		{
+		return EFalse;
+		}
+	
+	iCommandMode = ECommandRunning;
+    if (iIsTcp)
+        {
+        iConsole->Printf(_L("Test for TCP...\n"));
+        iTcp = CTcpProcess::NewL(*iConsole, addr, port, size, iMode);
+        }
+    else
+        {
+        iConsole->Printf(_L("Test for UDP...\n"));
+        iUdp = CUdpProcess::NewL(*iConsole, addr, port, size, iMode);
+        }
+		
+	return ETrue;
+
+	}
+
+void CTcpTestConsole::DoCancel()
+	{
+	iConsole->ReadCancel();
+	}
+
+void CTcpTestConsole::RunL()
+	{
+	User::LeaveIfError(iStatus.Int());
+	switch(iCommandMode)
+		{
+		case ECommandInit:
+			{
+			TKeyCode code = iConsole->KeyCode();
+			switch(code)
+				{
+				case EKeyEnter:
+					{
+					//User input ok
+					if(!StartL())
+						{
+						Help();
+						}
+					}
+					break;
+				case EKeyEscape:
+					//connection has not been created. User want to cancel and quit
+					iOwner.CloseTcpTest(iIndex);
+					return;
+				case EKeyBackspace:
+					if(iChars.Length() > 0)
+						{
+						iConsole->SetCursorPosRel(TPoint(-1, 0));
+						iConsole->ClearToEndOfLine();
+						iChars.SetLength(iChars.Length()-1);
+						}
+					break;
+				default:
+					iChars.Append(code);
+					iConsole->Printf(_L("%c"), code);
+					break;
+				}
+			iConsole->Read(iStatus);
+			SetActive();
+			}
+			break;
+		case ECommandRunning:
+			//Connection has been created. User quit by press any key.
+			iOwner.CloseTcpTest(iIndex);
+			break;
+		}
+	}
+
+TInt CTcpTestConsole::RunError(TInt aError)
+	{
+	User::Panic(_L("CTcpTestConsole"), aError);
+	return aError;
+	}
+
+
--- a/usbmgmt/usbmgrtest/t_termusb/src/t_termusb.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_termusb/src/t_termusb.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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()<KMaxDumpLength);
 
 	dialog.Destroy();
@@ -528,8 +500,6 @@
 			GetStopBit(aConfig.iStopBits, right);
 		if (des[0]=='L')
 			GetLength(aConfig.iDataBits, right);
-//		if (des[0]=='K')
-//			GetBreak(aSettings.iBreak, right);
 		if (des[0]=='F')
 			GetFifo(aConfig.iFifo, right);
 		if (des[0]=='I')
@@ -747,7 +717,7 @@
 	TheWindow.Write(_L("Opened USB Comm Port\r\n"));
 
 	TheCommPort.Config(TheConfigBuf);	// get config
-	TheConfig.iHandshake=0; //KConfigObeyXoff|KConfigSendXoff;
+	TheConfig.iHandshake=0; 
 	TheCommPort.SetConfig(TheConfigBuf);
 	TheCommPort.SetReceiveBufferLength(8192);
 
--- a/usbmgmt/usbmgrtest/t_termusb2/src/t_termusb2.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_termusb2/src/t_termusb2.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -203,11 +203,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 "));
 	
@@ -221,10 +216,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)
@@ -355,23 +346,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)
 	{
 
@@ -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()<KMaxDumpLength);
 
 	dialog.Destroy();
@@ -526,8 +498,6 @@
 			GetStopBit(aConfig.iStopBits, right);
 		if (des[0]=='L')
 			GetLength(aConfig.iDataBits, right);
-//		if (des[0]=='K')
-//			GetBreak(aSettings.iBreak, right);
 		if (des[0]=='F')
 			GetFifo(aConfig.iFifo, right);
 		if (des[0]=='I')
@@ -652,17 +622,6 @@
 
 	// Initialisation
 
-/*	
-	// I don't belive this section of code is being used anymore and
-	// has been replaced with PORT_NAME.
-	// I'm not sure so I've left it here ...
-	
-	TBuf <0x100> 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);
--- a/usbmgmt/usbmgrtest/t_usb_cable_detect/src/t_usb_cable_detect.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_usb_cable_detect/src/t_usb_cable_detect.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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))
--- a/usbmgmt/usbmgrtest/t_usbman/src/t_usbman.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_usbman/src/t_usbman.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"));
--- a/usbmgmt/usbmgrtest/t_usbmanager_suite/Stub1CC/group/BLD.INF	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_usbmanager_suite/Stub1CC/group/BLD.INF	Tue Aug 31 17:01:47 2010 +0300
@@ -29,4 +29,3 @@
 Stub1CC.mmp
 #endif
 
-
--- a/usbmgmt/usbmgrtest/t_usbmanager_suite/Stub1CC/group/Stub1CC.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_usbmanager_suite/Stub1CC/group/Stub1CC.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -34,7 +34,8 @@
 SOURCE			Stub1CC.cpp
 
 USERINCLUDE		../inc
-USERINCLUDE		../../../../usbmgr/usbman/server/public
+USERINCLUDE		../../../../usbmgr/usbman/server/public 
+USERINCLUDE     ../traces
 
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
@@ -47,4 +48,3 @@
 LIBRARY			usbclasscontroller.lib
 LIBRARY 		esock.lib
 
-#include <usb/usblogger.mmh>
--- a/usbmgmt/usbmgrtest/t_usbmanager_suite/Stub1CC/inc/Stub1CC.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_usbmanager_suite/Stub1CC/inc/Stub1CC.h	Tue Aug 31 17:01:47 2010 +0300
@@ -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;
--- a/usbmgmt/usbmgrtest/t_usbmanager_suite/Stub1CC/src/Stub1CC.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_usbmanager_suite/Stub1CC/src/Stub1CC.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -22,11 +22,10 @@
  @file
 */
 
-#include "Stub1CC.h"
 #include <usb_std.h>
 #include <es_ini.h>
 #include <d32usbc.h>
-#include <usb/usblogger.h>
+#include "Stub1CC.h"
 
 #ifdef __FLOG_ACTIVE
 _LIT8(KLogComponent, "STUB1CC");
@@ -34,6 +33,11 @@
 
 
 #include "usbmaninternalconstants.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "Stub1CCTraces.h"
+#endif
+
  
 
 // Panic category 
@@ -160,32 +164,37 @@
  */
 void CUsbstub1ClassController::Start(TRequestStatus& aStatus)
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CUSBSTUB1CLASSCONTROLLER_START_ENTRY );
+	
 	aStatus = KRequestPending;
 	iReportStatus = &aStatus;
 	//If we are already started then just complete the request.
 	if (iState == EUsbServiceStarted)
 		{
 		User::RequestComplete(iReportStatus, KErrNone);
+		OstTraceFunctionExit0( CUSBSTUB1CLASSCONTROLLER_START_EXIT );
 		return;
 		}
 
 	if (iFailToStart)
 		{
 		User::RequestComplete(iReportStatus, KErrGeneral);
+		OstTraceFunctionExit0( CUSBSTUB1CLASSCONTROLLER_START_EXIT_DUP1 );
 		return;
 		}
 	
 	iState = EUsbServiceStarting;
 #ifndef __WINS__	
 	TInt ret = iLdd.Open(0);
-	LOGTEXT2(_L8("Open LDD, ret=%d"), ret);
+	OstTrace1( TRACE_NORMAL, CUSBSTUB1CLASSCONTROLLER_START, _L8("Open LDD, ret=%d"), ret );
+	
 	ret = SetUpInterface();
-	LOGTEXT2(_L8("SetUpInterface(), ret=%d"), ret);
+	OstTrace1( TRACE_NORMAL, CUSBSTUB1CLASSCONTROLLER_START_DUP1, _L8("SetUpInterface(), ret=%d"), ret );
+	
 #endif	
 	iTimer.After(iStatus, iStartDelay*1000);  //convert from usec to msec
 	SetActive();
+	OstTraceFunctionExit0( CUSBSTUB1CLASSCONTROLLER_START_EXIT_DUP2 );
 	}
 
 /**
@@ -195,7 +204,7 @@
  */
 void CUsbstub1ClassController::Stop(TRequestStatus& aStatus)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBSTUB1CLASSCONTROLLER_STOP_ENTRY );
 	
 	aStatus = KRequestPending;
 	iReportStatus = &aStatus;
@@ -203,12 +212,14 @@
 	if (iState == EUsbServiceIdle)
 		{
 		User::RequestComplete(iReportStatus, KErrNone);
+		OstTraceFunctionExit0( CUSBSTUB1CLASSCONTROLLER_STOP_EXIT );
 		return;
 		}
 
 	if (iFailToStop)
 		{
 		User::RequestComplete(iReportStatus, KErrGeneral);
+		OstTraceFunctionExit0( CUSBSTUB1CLASSCONTROLLER_STOP_EXIT_DUP1 );
 		return;
 		}
 
@@ -220,6 +231,7 @@
 	
 	iTimer.After(iStatus, iStopDelay*1000);  //convert from usec to msec
 	SetActive();
+	OstTraceFunctionExit0( DUP2_CUSBSTUB1CLASSCONTROLLER_STOP_EXIT );
 	}
 
 /**
@@ -229,10 +241,11 @@
  */
 void CUsbstub1ClassController::GetDescriptorInfo(TUsbDescriptor& aDescriptorInfo) const
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CUSBSTUB1CLASSCONTROLLER_GETDESCRIPTORINFO_ENTRY );
+	
 	aDescriptorInfo.iLength = Kstub1DescriptorLength;
 	aDescriptorInfo.iNumInterfaces = Kstub1NumberOfInterfacesPerstub1Function;
+	OstTraceFunctionExit0( CUSBSTUB1CLASSCONTROLLER_GETDESCRIPTORINFO_EXIT );
 	}
 
 
@@ -241,9 +254,15 @@
  */
 void CUsbstub1ClassController::RunL()
 	{
-	LOG_FUNC
-
-	__ASSERT_DEBUG( iStatus == KErrNone, _USB_PANIC(Kstub1CcPanicCategory, EPanicUnexpectedStatus) );
+	OstTraceFunctionEntry0( CUSBSTUB1CLASSCONTROLLER_RUNL_ENTRY );
+	
+	if(iStatus != KErrNone)
+	    {
+            OstTrace1( TRACE_FATAL, CUSBSTUB1CLASSCONTROLLER_RUNL, 
+                    "CUsbstub1ClassController::RunL panic with error %d", 
+                    EPanicUnexpectedState);
+            __ASSERT_DEBUG(EFalse,User::Panic(Kstub1CcPanicCategory,EPanicUnexpectedStatus));
+	    }
 	switch (iState)
 		{
 		case EUsbServiceStarting:
@@ -253,10 +272,14 @@
 			iState = EUsbServiceIdle;
 			break;
 		default:	
-			_USB_PANIC(Kstub1CcPanicCategory, EPanicUnexpectedState);
+		    OstTrace1( TRACE_FATAL, CUSBSTUB1CLASSCONTROLLER_RUNL_DUP1, 
+                    "CUsbstub1ClassController::RunL panic with error %d", 
+                    EPanicUnexpectedState);
+		    User::Panic(Kstub1CcPanicCategory,EPanicUnexpectedStatus);
 		}
 	*iReportStatus = KErrNone;	
 	User::RequestComplete(iReportStatus, iStatus.Int());	
+	OstTraceFunctionExit0( CUSBSTUB1CLASSCONTROLLER_RUNL_EXIT );
 	}
 
 /**
@@ -279,7 +302,9 @@
 			iState = EUsbServiceStarted;
 			break;
 		default:	
-			_USB_PANIC(Kstub1CcPanicCategory, EPanicUnexpectedState);
+		    OstTrace1( TRACE_FATAL, CUSBSTUB1CLASSCONTROLLER_DOCANCEL, 
+		            "CUsbstub1ClassController::DoCancel panic with error %d", EPanicUnexpectedState );
+		    User::Panic(Kstub1CcPanicCategory,EPanicUnexpectedStatus);
 	}
 	*iReportStatus = KErrNone;		
 	User::RequestComplete(iReportStatus, KErrCancel);	
@@ -294,7 +319,9 @@
  */
 TInt CUsbstub1ClassController::RunError(TInt /*aError*/)
 	{
-	__ASSERT_DEBUG( EFalse, _USB_PANIC(Kstub1CcPanicCategory, EUnusedFunction) );
+    OstTrace1( TRACE_FATAL, CUSBSTUB1CLASSCONTROLLER_RUNERROR, 
+                    "CUsbstub1ClassController::RunError panic with error %d", EUnusedFunction);
+    __ASSERT_DEBUG(EFalse,User::Panic(Kstub1CcPanicCategory,EPanicUnexpectedStatus));
 	return KErrNone;
 	}
 	
@@ -304,25 +331,33 @@
  * endpoint and, if found, configuring the interface.
  */
 	{
-	LOGTEXT(_L8(">>CCdcControlInterface::SetUpInterface"));
-
+    OstTrace0( TRACE_NORMAL, CUSBSTUB1CLASSCONTROLLER_SETUPINTERFACE, 
+            _L8(">>CCdcControlInterface::SetUpInterface"));
+    
 	TUsbDeviceCaps dCaps;
 	TInt ret = iLdd.DeviceCaps(dCaps);
-	LOGTEXT(_L8("\tchecking result of DeviceCaps"));
+	OstTrace0( TRACE_NORMAL, CUSBSTUB1CLASSCONTROLLER_SETUPINTERFACE_DUP1, 
+	        _L8("\tchecking result of DeviceCaps"));
+	
 	if ( ret )
 		{
-		LOGTEXT2(_L8("<<CCdcControlInterface::SetUpInterface ret=%d"), ret);
+        OstTrace1( TRACE_ERROR, CUSBSTUB1CLASSCONTROLLER_SETUPINTERFACE_DUP2, 
+                _L8("<<CCdcControlInterface::SetUpInterface ret=%d"), ret );
+        
 		return ret;
 		}
 
 	const TUint KRequiredNumberOfEndpoints = 1; // in addition to endpoint 0.
 
 	const TUint totalEndpoints = static_cast<TUint>(dCaps().iTotalEndpoints);
-	LOGTEXT2(_L8("\tiTotalEndpoints = %d"), totalEndpoints);
+	OstTrace1( TRACE_NORMAL, CUSBSTUB1CLASSCONTROLLER_SETUPINTERFACE_DUP3, 
+	        _L8("\tiTotalEndpoints = %d"), totalEndpoints);
+	
 	if ( totalEndpoints < KRequiredNumberOfEndpoints )
 		{
-		LOGTEXT2(_L8("<<CCdcControlInterface::SetUpInterface ret=%d"), 
-			KErrGeneral);
+        OstTrace1( TRACE_ERROR, CUSBSTUB1CLASSCONTROLLER_SETUPINTERFACE_DUP4, 
+                _L8("<<CCdcControlInterface::SetUpInterface ret=%d"), KErrGeneral );
+        
 		return KErrGeneral;
 		}
 	
@@ -330,10 +365,14 @@
 	TUsbcEndpointData data[KUsbcMaxEndpoints];
 	TPtr8 dataptr(reinterpret_cast<TUint8*>(data), sizeof(data), sizeof(data));
 	ret = iLdd.EndpointCaps(dataptr);
-	LOGTEXT(_L8("\tchecking result of EndpointCaps"));
+	OstTrace0( TRACE_NORMAL, CUSBSTUB1CLASSCONTROLLER_SETUPINTERFACE_DUP5, 
+	        _L8("\tchecking result of EndpointCaps"));
+	
 	if ( ret )
 		{
-		LOGTEXT2(_L8("<<CCdcControlInterface::SetUpInterface ret=%d"), ret);
+        OstTrace1( TRACE_ERROR, CUSBSTUB1CLASSCONTROLLER_SETUPINTERFACE_DUP6, 
+                _L8("<<CCdcControlInterface::SetUpInterface ret=%d"), ret );
+        
 		return ret;
 		}
 
@@ -343,7 +382,12 @@
 	for ( TUint i = 0 ; i < totalEndpoints ; i++ )
 		{
 		const TUsbcEndpointCaps* caps = &data[i].iCaps;
-		__ASSERT_DEBUG(caps,_USB_PANIC(Kstub1CcPanicCategory, EPanicUnexpectedStatus));
+		if(!caps)
+		    {
+                OstTrace1( TRACE_FATAL, CUSBSTUB1CLASSCONTROLLER_SETUPINTERFACE_DUP7, 
+                        "CUsbstub1ClassController::SetUpInterface panic with error %d", EPanicUnexpectedStatus);
+                __ASSERT_DEBUG(EFalse,User::Panic(Kstub1CcPanicCategory,EPanicUnexpectedStatus));
+		    }
 
 		if (data[i].iInUse)
 			{
@@ -369,11 +413,14 @@
 			break;
 			}
 		}
-	LOGTEXT(_L8("\tchecking epFound"));
+	OstTrace0( TRACE_NORMAL, CUSBSTUB1CLASSCONTROLLER_SETUPINTERFACE_DUP8, 
+	        _L8("\tchecking epFound"));
+	
 	if ( !epFound )
 		{
-		LOGTEXT2(_L8("<<CCdcControlInterface::SetUpInterface ret=%d"), 
-			KErrGeneral);
+        OstTrace1( TRACE_ERROR, CUSBSTUB1CLASSCONTROLLER_SETUPINTERFACE_DUP9, 
+                _L8("<<CCdcControlInterface::SetUpInterface ret=%d"), KErrGeneral);
+        
 		return KErrGeneral;
 		}
 
@@ -385,11 +432,15 @@
 	ifc().iClass.iSubClassNum = 0x02; // Table 16- Abstract Control Model
 	ifc().iClass.iProtocolNum = 0x01; // Table 17- Hayes compatible
 
-	LOGTEXT(_L8("\tabout to call SetInterface"));
+	OstTrace0( TRACE_NORMAL, CUSBSTUB1CLASSCONTROLLER_SETUPINTERFACE_DUP10, 
+	        _L8("\tabout to call SetInterface"));
+	
 	// Zero effectively indicates that alternate interfaces are not used.
 	ret = iLdd.SetInterface(0, ifc);
 
-	LOGTEXT2(_L8("<<CCdcControlInterface::SetUpInterface ret=%d"), ret);
+	OstTrace1( TRACE_NORMAL, CUSBSTUB1CLASSCONTROLLER_SETUPINTERFACE_DUP11, 
+	        _L8("<<CCdcControlInterface::SetUpInterface ret=%d"), ret );
+	
 	return ret;
 	}
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/t_usbmanager_suite/Stub1CC/traces/OstTraceDefinitions.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,7 @@
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <opensystemtrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/t_usbmanager_suite/Stub1CC/traces/fixed_id.definitions	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,44 @@
+#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt.
+[GROUP]TRACE_ERROR=0x82
+[GROUP]TRACE_FATAL=0x81
+[GROUP]TRACE_FLOW=0x8a
+[GROUP]TRACE_NORMAL=0x86
+[TRACE]TRACE_ERROR[0x82]_CUSBSTUB1CLASSCONTROLLER_SETUPINTERFACE_DUP2=0x1
+[TRACE]TRACE_ERROR[0x82]_CUSBSTUB1CLASSCONTROLLER_SETUPINTERFACE_DUP4=0x2
+[TRACE]TRACE_ERROR[0x82]_CUSBSTUB1CLASSCONTROLLER_SETUPINTERFACE_DUP6=0x3
+[TRACE]TRACE_ERROR[0x82]_CUSBSTUB1CLASSCONTROLLER_SETUPINTERFACE_DUP9=0x4
+[TRACE]TRACE_FATAL[0x81]_CUSBSTUB1CLASSCONTROLLER_DOCANCEL=0x3
+[TRACE]TRACE_FATAL[0x81]_CUSBSTUB1CLASSCONTROLLER_RUNERROR=0x4
+[TRACE]TRACE_FATAL[0x81]_CUSBSTUB1CLASSCONTROLLER_RUNL=0x1
+[TRACE]TRACE_FATAL[0x81]_CUSBSTUB1CLASSCONTROLLER_RUNL_DUP1=0x2
+[TRACE]TRACE_FATAL[0x81]_CUSBSTUB1CLASSCONTROLLER_SETUPINTERFACE_DUP7=0x5
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB1CLASSCONTROLLER_GETDESCRIPTORINFO_ENTRY=0xb
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB1CLASSCONTROLLER_GETDESCRIPTORINFO_EXIT=0xc
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB1CLASSCONTROLLER_RUNL_ENTRY=0x9
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB1CLASSCONTROLLER_RUNL_EXIT=0xa
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB1CLASSCONTROLLER_START_ENTRY=0x1
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB1CLASSCONTROLLER_START_EXIT=0x2
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB1CLASSCONTROLLER_START_EXIT_DUP1=0x3
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB1CLASSCONTROLLER_START_EXIT_DUP2=0x4
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB1CLASSCONTROLLER_STOP_ENTRY=0x5
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB1CLASSCONTROLLER_STOP_EXIT=0x6
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB1CLASSCONTROLLER_STOP_EXIT_DUP1=0x7
+[TRACE]TRACE_FLOW[0x8A]_DUP2_CUSBSTUB1CLASSCONTROLLER_STOP_EXIT=0x8
+[TRACE]TRACE_NORMAL[0x86]_CUSBSTUB1CLASSCONTROLLER_SETUPINTERFACE=0x7
+[TRACE]TRACE_NORMAL[0x86]_CUSBSTUB1CLASSCONTROLLER_SETUPINTERFACE_DUP1=0x8
+[TRACE]TRACE_NORMAL[0x86]_CUSBSTUB1CLASSCONTROLLER_SETUPINTERFACE_DUP10=0x11
+[TRACE]TRACE_NORMAL[0x86]_CUSBSTUB1CLASSCONTROLLER_SETUPINTERFACE_DUP11=0x12
+[TRACE]TRACE_NORMAL[0x86]_CUSBSTUB1CLASSCONTROLLER_SETUPINTERFACE_DUP3=0xa
+[TRACE]TRACE_NORMAL[0x86]_CUSBSTUB1CLASSCONTROLLER_SETUPINTERFACE_DUP5=0xc
+[TRACE]TRACE_NORMAL[0x86]_CUSBSTUB1CLASSCONTROLLER_SETUPINTERFACE_DUP8=0xf
+[TRACE]TRACE_NORMAL[0x86]_CUSBSTUB1CLASSCONTROLLER_START=0x1
+[TRACE]TRACE_NORMAL[0x86]_CUSBSTUB1CLASSCONTROLLER_START_DUP1=0x2
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBSTUB1CLASSCONTROLLER_DOCANCEL=0x5
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBSTUB1CLASSCONTROLLER_RUNERROR=0x6
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBSTUB1CLASSCONTROLLER_RUNL=0x3
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBSTUB1CLASSCONTROLLER_RUNL_DUP1=0x4
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBSTUB1CLASSCONTROLLER_SETUPINTERFACE_DUP2=0x9
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBSTUB1CLASSCONTROLLER_SETUPINTERFACE_DUP4=0xb
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBSTUB1CLASSCONTROLLER_SETUPINTERFACE_DUP6=0xd
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBSTUB1CLASSCONTROLLER_SETUPINTERFACE_DUP7=0xe
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBSTUB1CLASSCONTROLLER_SETUPINTERFACE_DUP9=0x10
--- a/usbmgmt/usbmgrtest/t_usbmanager_suite/Stub2CC/group/Stub2CC.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_usbmanager_suite/Stub2CC/group/Stub2CC.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -34,7 +34,8 @@
 SOURCE			Stub2CC.cpp
 
 USERINCLUDE		../inc
-USERINCLUDE		../../../../usbmgr/usbman/server/public
+USERINCLUDE		../../../../usbmgr/usbman/server/public 
+USERINCLUDE		../traces
 
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
@@ -47,4 +48,3 @@
 LIBRARY			usbclasscontroller.lib
 LIBRARY 		esock.lib
 
-#include <usb/usblogger.mmh>
--- a/usbmgmt/usbmgrtest/t_usbmanager_suite/Stub2CC/inc/Stub2CC.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_usbmanager_suite/Stub2CC/inc/Stub2CC.h	Tue Aug 31 17:01:47 2010 +0300
@@ -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;
--- a/usbmgmt/usbmgrtest/t_usbmanager_suite/Stub2CC/src/Stub2CC.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_usbmanager_suite/Stub2CC/src/Stub2CC.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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,12 +21,10 @@
 /**
  @file
 */
-
-#include "Stub2CC.h"
 #include <usb_std.h>
 #include <es_ini.h>
 #include <d32usbc.h>
-#include <usb/usblogger.h>
+#include "Stub2CC.h"
 
 #ifdef __FLOG_ACTIVE
 _LIT8(KLogComponent, "STUB2CC");
@@ -34,6 +32,11 @@
 
 
 #include "usbmaninternalconstants.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "Stub2CCTraces.h"
+#endif
+
  
 
 // Panic category 
@@ -161,34 +164,39 @@
  */
 void CUsbstub2ClassController::Start(TRequestStatus& aStatus)
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CUSBSTUB2CLASSCONTROLLER_START_ENTRY );
+	
 	aStatus = KRequestPending;
 	iReportStatus = &aStatus;
 	//If we are already started then just complete the request.
 	if (iState == EUsbServiceStarted)
 		{
 		User::RequestComplete(iReportStatus, KErrNone);
+		OstTraceFunctionExit0( CUSBSTUB2CLASSCONTROLLER_START_EXIT );
 		return;
 		}
 
 	if (iFailToStart)
 		{
 		User::RequestComplete(iReportStatus, KErrGeneral);
+		OstTraceFunctionExit0( CUSBSTUB2CLASSCONTROLLER_START_EXIT_DUP1 );
 		return;
 		}
 	
 	iState = EUsbServiceStarting;
 #ifndef __WINS__	
 	TInt ret = iLdd.Open(0);
-	LOGTEXT2(_L8("Open LDD, ret=%d"), ret);
+	OstTrace1( TRACE_NORMAL, CUSBSTUB2CLASSCONTROLLER_START,_L8("Open LDD, ret=%d"),ret);
 	ret = SetUpInterface();
-	LOGTEXT2(_L8("SetUpInterface(), ret=%d"), ret);
+	OstTrace1( TRACE_NORMAL, CUSBSTUB2CLASSCONTROLLER_START_DUP1,
+	        _L8("SetUpInterface(),ret=%d"),ret);
+	
 #endif	
 
 
 	iTimer.After(iStatus, iStartDelay*1000);  //convert from usec to msec
 	SetActive();
+	OstTraceFunctionExit0( CUSBSTUB2CLASSCONTROLLER_START_EXIT_DUP2 );
 	}
 
 /**
@@ -198,20 +206,21 @@
  */
 void CUsbstub2ClassController::Stop(TRequestStatus& aStatus)
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CUSBSTUB2CLASSCONTROLLER_STOP_ENTRY );
 	aStatus = KRequestPending;
 	iReportStatus = &aStatus;
 	//If we are already idle then just complete the request.
 	if (iState == EUsbServiceIdle)
 		{
 		User::RequestComplete(iReportStatus, KErrNone);
+		OstTraceFunctionExit0( CUSBSTUB2CLASSCONTROLLER_STOP_EXIT );
 		return;
 		}
 
 	if (iFailToStop)
 		{
 		User::RequestComplete(iReportStatus, KErrGeneral);
+		OstTraceFunctionExit0( CUSBSTUB2CLASSCONTROLLER_STOP_EXIT_DUP1 );
 		return;
 		}
 
@@ -223,6 +232,7 @@
 
 	iTimer.After(iStatus, iStopDelay*1000);  //convert from usec to msec
 	SetActive();
+	OstTraceFunctionExit0( CUSBSTUB2CLASSCONTROLLER_STOP_EXIT_DUP2 );
 	}
 
 /**
@@ -232,10 +242,12 @@
  */
 void CUsbstub2ClassController::GetDescriptorInfo(TUsbDescriptor& aDescriptorInfo) const
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CUSBSTUB2CLASSCONTROLLER_GETDESCRIPTORINFO_ENTRY );
+	
 	aDescriptorInfo.iLength = Kstub2DescriptorLength;
 	aDescriptorInfo.iNumInterfaces = Kstub2NumberOfInterfacesPerstub2Function;
+	
+	OstTraceFunctionExit0( CUSBSTUB2CLASSCONTROLLER_GETDESCRIPTORINFO_EXIT );
 	}
 
 
@@ -244,9 +256,14 @@
  */
 void CUsbstub2ClassController::RunL()
 	{
-	LOG_FUNC
-
-	__ASSERT_DEBUG( iStatus == KErrNone, _USB_PANIC(Kstub2CcPanicCategory, EPanicUnexpectedStatus) );
+	OstTraceFunctionEntry0( CUSBSTUB2CLASSCONTROLLER_RUNL_ENTRY );
+	
+	if(iStatus != KErrNone)
+	    {
+            OstTrace1( TRACE_FATAL, CUSBSTUB2CLASSCONTROLLER_RUNL, 
+                    "CUsbstub2ClassController::RunL panic with error %d", EPanicUnexpectedStatus);
+            __ASSERT_DEBUG(EFalse,User::Panic(Kstub2CcPanicCategory,EPanicUnexpectedStatus));
+	    }
 	switch (iState)
 		{
 		case EUsbServiceStarting:
@@ -255,11 +272,14 @@
 		case EUsbServiceStopping:
 			iState = EUsbServiceIdle;
 			break;
-		default:	
-			_USB_PANIC(Kstub2CcPanicCategory, EPanicUnexpectedState);
+		default:
+		    OstTrace1( TRACE_FATAL, CUSBSTUB2CLASSCONTROLLER_RUNL_DUP1, 
+		           "CUsbstub2ClassController::RunL panic with error %d", EPanicUnexpectedStatus);
+		    User::Panic(Kstub2CcPanicCategory, EPanicUnexpectedState);
 		}
 	*iReportStatus = KErrNone;	
 	User::RequestComplete(iReportStatus, iStatus.Int());	
+	OstTraceFunctionExit0( CUSBSTUB2CLASSCONTROLLER_RUNL_EXIT );
 	}
 
 /**
@@ -281,8 +301,10 @@
 		case EUsbServiceStopping:
 			iState = EUsbServiceStarted;
 			break;
-		default:	
-			_USB_PANIC(Kstub2CcPanicCategory, EPanicUnexpectedState);
+		default:
+		    OstTrace1( TRACE_FATAL, CUSBSTUB2CLASSCONTROLLER_DOCANCEL, 
+		            "CUsbstub2ClassController::DoCancel panic with error %d", EPanicUnexpectedState );
+			User::Panic(Kstub2CcPanicCategory, EPanicUnexpectedState);
 	}
 	*iReportStatus = KErrNone;		
 	User::RequestComplete(iReportStatus, KErrCancel);	
@@ -297,7 +319,10 @@
  */
 TInt CUsbstub2ClassController::RunError(TInt /*aError*/)
 	{
-	__ASSERT_DEBUG( EFalse, _USB_PANIC(Kstub2CcPanicCategory, EUnusedFunction) );
+    OstTrace1( TRACE_FATAL, CUSBSTUB2CLASSCONTROLLER_RUNERROR, 
+            "CUsbstub2ClassController::RunError panic with error %d", 
+            EUnusedFunction);
+    __ASSERT_DEBUG(EFalse,User::Panic(Kstub2CcPanicCategory, EUnusedFunction));
 	return KErrNone;
 	}
 
@@ -307,25 +332,33 @@
  * endpoint and, if found, configuring the interface.
  */
 	{
-	LOGTEXT(_L8(">>CCdcControlInterface::SetUpInterface"));
-
+    OstTrace0( TRACE_NORMAL, CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE, 
+            _L8(">>CCdcControlInterface::SetUpInterface"));
+    
 	TUsbDeviceCaps dCaps;
 	TInt ret = iLdd.DeviceCaps(dCaps);
-	LOGTEXT(_L8("\tchecking result of DeviceCaps"));
+	OstTrace0( TRACE_NORMAL, CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP1, 
+	        _L8("\tchecking result of DeviceCaps"));
+	
 	if ( ret )
 		{
-		LOGTEXT2(_L8("<<CCdcControlInterface::SetUpInterface ret=%d"), ret);
+        OstTrace1( TRACE_ERROR, CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP2, 
+                _L8("<<CCdcControlInterface::SetUpInterface ret=%d"), ret );
+        
 		return ret;
 		}
 
 	const TUint KRequiredNumberOfEndpoints = 1; // in addition to endpoint 0.
 
 	const TUint totalEndpoints = static_cast<TUint>(dCaps().iTotalEndpoints);
-	LOGTEXT2(_L8("\tiTotalEndpoints = %d"), totalEndpoints);
+	OstTrace1( TRACE_NORMAL, CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP3, 
+	        _L8("\tiTotalEndpoints = %d"), totalEndpoints );
+	
 	if ( totalEndpoints < KRequiredNumberOfEndpoints )
 		{
-		LOGTEXT2(_L8("<<CCdcControlInterface::SetUpInterface ret=%d"), 
-			KErrGeneral);
+        OstTrace1( TRACE_ERROR, CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP4, 
+                _L8("<<CCdcControlInterface::SetUpInterface ret=%d"), KErrGeneral);
+        
 		return KErrGeneral;
 		}
 	
@@ -333,10 +366,14 @@
 	TUsbcEndpointData data[KUsbcMaxEndpoints];
 	TPtr8 dataptr(reinterpret_cast<TUint8*>(data), sizeof(data), sizeof(data));
 	ret = iLdd.EndpointCaps(dataptr);
-	LOGTEXT(_L8("\tchecking result of EndpointCaps"));
+	OstTrace0( TRACE_NORMAL, CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP5, 
+	        _L8("\tchecking result of EndpointCaps"));
+	
 	if ( ret )
 		{
-		LOGTEXT2(_L8("<<CCdcControlInterface::SetUpInterface ret=%d"), ret);
+        OstTrace1( TRACE_ERROR, CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP6, 
+                _L8("<<CCdcControlInterface::SetUpInterface ret=%d"), ret );
+        
 		return ret;
 		}
 
@@ -346,8 +383,13 @@
 	for ( TUint i = 0 ; i < totalEndpoints ; i++ )
 		{
 		const TUsbcEndpointCaps* caps = &data[i].iCaps;
-		__ASSERT_DEBUG(caps,_USB_PANIC(Kstub2CcPanicCategory, EPanicUnexpectedStatus));
-
+		if(!caps)
+		{
+            OstTrace1( TRACE_FATAL, CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP7, 
+                    "CUsbstub2ClassController::SetUpInterface panic with error %d", 
+                    EPanicUnexpectedStatus);
+            __ASSERT_DEBUG(EFalse,User::Panic(Kstub2CcPanicCategory,EPanicUnexpectedStatus));
+		}
 		if (data[i].iInUse)
 			{
 			continue;
@@ -372,11 +414,13 @@
 			break;
 			}
 		}
-	LOGTEXT(_L8("\tchecking epFound"));
+	OstTrace0( TRACE_NORMAL, CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP8, _L8("\tchecking epFound"));
+	
 	if ( !epFound )
 		{
-		LOGTEXT2(_L8("<<CCdcControlInterface::SetUpInterface ret=%d"), 
-			KErrGeneral);
+        OstTrace1( TRACE_NORMAL, CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP9, 
+                _L8("<<CCdcControlInterface::SetUpInterface ret=%d"), KErrGeneral);
+        
 		return KErrGeneral;
 		}
 
@@ -388,11 +432,15 @@
 	ifc().iClass.iSubClassNum = 0x02; // Table 16- Abstract Control Model
 	ifc().iClass.iProtocolNum = 0x01; // Table 17- Hayes compatible
 
-	LOGTEXT(_L8("\tabout to call SetInterface"));
+	OstTrace0( TRACE_NORMAL, CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP10, 
+	        _L8("\tabout to call SetInterface"));
+	
 	// Zero effectively indicates that alternate interfaces are not used.
 	ret = iLdd.SetInterface(0, ifc);
 
-	LOGTEXT2(_L8("<<CCdcControlInterface::SetUpInterface ret=%d"), ret);
+	OstTrace1( TRACE_NORMAL, CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP11, 
+	        _L8("<<CCdcControlInterface::SetUpInterface ret=%d"), ret );
+	
 	return ret;
 	}
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/t_usbmanager_suite/Stub2CC/traces/OstTraceDefinitions.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,7 @@
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <opensystemtrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/t_usbmanager_suite/Stub2CC/traces/fixed_id.definitions	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,43 @@
+#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt.
+[GROUP]TRACE_ERROR=0x82
+[GROUP]TRACE_FATAL=0x81
+[GROUP]TRACE_FLOW=0x8a
+[GROUP]TRACE_NORMAL=0x86
+[TRACE]TRACE_ERROR[0x82]_CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP2=0x1
+[TRACE]TRACE_ERROR[0x82]_CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP4=0x2
+[TRACE]TRACE_ERROR[0x82]_CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP6=0x3
+[TRACE]TRACE_FATAL[0x81]_CUSBSTUB2CLASSCONTROLLER_DOCANCEL=0x3
+[TRACE]TRACE_FATAL[0x81]_CUSBSTUB2CLASSCONTROLLER_RUNERROR=0x4
+[TRACE]TRACE_FATAL[0x81]_CUSBSTUB2CLASSCONTROLLER_RUNL=0x1
+[TRACE]TRACE_FATAL[0x81]_CUSBSTUB2CLASSCONTROLLER_RUNL_DUP1=0x2
+[TRACE]TRACE_FATAL[0x81]_CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP7=0x5
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB2CLASSCONTROLLER_GETDESCRIPTORINFO_ENTRY=0x9
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB2CLASSCONTROLLER_GETDESCRIPTORINFO_EXIT=0xa
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB2CLASSCONTROLLER_RUNL_ENTRY=0xb
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB2CLASSCONTROLLER_RUNL_EXIT=0xc
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB2CLASSCONTROLLER_START_ENTRY=0x1
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB2CLASSCONTROLLER_START_EXIT=0x2
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB2CLASSCONTROLLER_START_EXIT_DUP1=0x3
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB2CLASSCONTROLLER_START_EXIT_DUP2=0x4
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB2CLASSCONTROLLER_STOP_ENTRY=0x5
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB2CLASSCONTROLLER_STOP_EXIT=0x6
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB2CLASSCONTROLLER_STOP_EXIT_DUP1=0x7
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB2CLASSCONTROLLER_STOP_EXIT_DUP2=0x8
+[TRACE]TRACE_NORMAL[0x86]_CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE=0x7
+[TRACE]TRACE_NORMAL[0x86]_CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP1=0x8
+[TRACE]TRACE_NORMAL[0x86]_CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP10=0x11
+[TRACE]TRACE_NORMAL[0x86]_CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP11=0x12
+[TRACE]TRACE_NORMAL[0x86]_CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP3=0xa
+[TRACE]TRACE_NORMAL[0x86]_CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP5=0xc
+[TRACE]TRACE_NORMAL[0x86]_CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP8=0xf
+[TRACE]TRACE_NORMAL[0x86]_CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP9=0x10
+[TRACE]TRACE_NORMAL[0x86]_CUSBSTUB2CLASSCONTROLLER_START=0x1
+[TRACE]TRACE_NORMAL[0x86]_CUSBSTUB2CLASSCONTROLLER_START_DUP1=0x2
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBSTUB2CLASSCONTROLLER_DOCANCEL=0x5
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBSTUB2CLASSCONTROLLER_RUNERROR=0x6
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBSTUB2CLASSCONTROLLER_RUNL=0x3
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBSTUB2CLASSCONTROLLER_RUNL_DUP1=0x4
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP2=0x9
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP4=0xb
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP6=0xd
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP7=0xe
--- a/usbmgmt/usbmgrtest/t_usbmanager_suite/Stub3CC/group/Stub3CC.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_usbmanager_suite/Stub3CC/group/Stub3CC.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -34,9 +34,11 @@
 SOURCE			Stub3CC.cpp
 
 USERINCLUDE		../inc
-USERINCLUDE		../../../../usbmgr/usbman/server/public
-
+USERINCLUDE		../../../../usbmgr/usbman/server/public 
+USERINCLUDE     ../traces
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+SYSTEMINCLUDE	/epoc32/include
+SYSTEMINCLUDE	/epoc32/include/ecom
 
 
 start resource 10203288.rss
@@ -47,4 +49,3 @@
 LIBRARY			usbclasscontroller.lib
 LIBRARY 		esock.lib
 
-#include <usb/usblogger.mmh>
--- a/usbmgmt/usbmgrtest/t_usbmanager_suite/Stub3CC/inc/Stub3CC.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_usbmanager_suite/Stub3CC/inc/Stub3CC.h	Tue Aug 31 17:01:47 2010 +0300
@@ -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;
--- a/usbmgmt/usbmgrtest/t_usbmanager_suite/Stub3CC/src/Stub3CC.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_usbmanager_suite/Stub3CC/src/Stub3CC.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -22,11 +22,10 @@
  @file
 */
 
-#include "Stub3CC.h"
 #include <usb_std.h>
 #include <es_ini.h>
 #include <d32usbc.h>
-#include <usb/usblogger.h>
+#include "Stub3CC.h"
 
 #ifdef __FLOG_ACTIVE
 _LIT8(KLogComponent, "STUB3CC");
@@ -34,6 +33,11 @@
 
 
 #include "usbmaninternalconstants.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "Stub3CCTraces.h"
+#endif
+
  
 
 // Panic category 
@@ -162,20 +166,22 @@
  */
 void CUsbstub3ClassController::Start(TRequestStatus& aStatus)
 	{
-	LOG_FUNC
-
+    OstTraceFunctionEntry0( CUSBSTUB3CLASSCONTROLLER_START_ENTRY );
+    
 	aStatus = KRequestPending;
 	iReportStatus = &aStatus;
 	//If we are already started then just complete the request.
 	if (iState == EUsbServiceStarted)
 		{
 		User::RequestComplete(iReportStatus, KErrNone);
+		OstTraceFunctionExit0( CUSBSTUB3CLASSCONTROLLER_START_EXIT );
 		return;
 		}
 
 	if (iFailToStart)
 		{
 		User::RequestComplete(iReportStatus, KErrGeneral);
+		OstTraceFunctionExit0( CUSBSTUB3CLASSCONTROLLER_START_EXIT_DUP1 );
 		return;
 		}
 	
@@ -183,14 +189,18 @@
 	
 #ifndef __WINS__	
 	TInt ret = iLdd.Open(0);
-	LOGTEXT2(_L8("Open LDD, ret=%d"), ret);
+	OstTrace1( TRACE_NORMAL, CUSBSTUB3CLASSCONTROLLER_START, _L8("Open LDD, ret=%d"), ret );
+	
 	ret = SetUpInterface();
-	LOGTEXT2(_L8("SetUpInterface(), ret=%d"), ret);
+	OstTrace1( TRACE_NORMAL, CUSBSTUB3CLASSCONTROLLER_START_DUP1, 
+	        _L8("SetUpInterface(), ret=%d"), ret );
+	
 #endif	
 
 
 	iTimer.After(iStatus, iStartDelay*1000);  //convert from usec to msec
 	SetActive();
+	OstTraceFunctionExit0( CUSBSTUB3CLASSCONTROLLER_START_EXIT_DUP2 );
 	}
 
 /**
@@ -200,20 +210,22 @@
  */
 void CUsbstub3ClassController::Stop(TRequestStatus& aStatus)
 	{
-	LOG_FUNC
-
+	OstTraceFunctionEntry0( CUSBSTUB3CLASSCONTROLLER_STOP_ENTRY );
+	
 	aStatus = KRequestPending;
 	iReportStatus = &aStatus;
 	//If we are already idle then just complete the request.
 	if (iState == EUsbServiceIdle)
 		{
 		User::RequestComplete(iReportStatus, KErrNone);
+		OstTraceFunctionExit0( CUSBSTUB3CLASSCONTROLLER_STOP_EXIT );
 		return;
 		}
 
 	if (iFailToStop)
 		{
 		User::RequestComplete(iReportStatus, KErrGeneral);
+		OstTraceFunctionExit0( CUSBSTUB3CLASSCONTROLLER_STOP_EXIT_DUP1 );
 		return;
 		}
 
@@ -226,6 +238,7 @@
 	
 	iTimer.After(iStatus, iStopDelay*1000);  //convert from usec to msec
 	SetActive();
+	OstTraceFunctionExit0( CUSBSTUB3CLASSCONTROLLER_STOP_EXIT_DUP2 );
 	}
 
 /**
@@ -235,10 +248,12 @@
  */
 void CUsbstub3ClassController::GetDescriptorInfo(TUsbDescriptor& aDescriptorInfo) const
 	{
-	LOG_FUNC
-
+    OstTraceFunctionEntry0( CUSBSTUB3CLASSCONTROLLER_GETDESCRIPTORINFO_ENTRY );
+    
 	aDescriptorInfo.iLength = Kstub3DescriptorLength;
 	aDescriptorInfo.iNumInterfaces = Kstub3NumberOfInterfacesPerstub3Function;
+	
+	OstTraceFunctionExit0( CUSBSTUB3CLASSCONTROLLER_GETDESCRIPTORINFO_EXIT );
 	}
 
 
@@ -247,9 +262,14 @@
  */
 void CUsbstub3ClassController::RunL()
 	{
-	LOG_FUNC
-
-	__ASSERT_DEBUG( iStatus == KErrNone, _USB_PANIC(Kstub3CcPanicCategory, EPanicUnexpectedStatus) );
+    OstTraceFunctionEntry0( CUSBSTUB3CLASSCONTROLLER_RUNL_ENTRY );
+    
+    if(iStatus != KErrNone)
+        {
+            OstTrace1( TRACE_FATAL, CUSBSTUB3CLASSCONTROLLER_RUNL, 
+                    "CUsbstub3ClassController::RunL panic with error %d", EPanicUnexpectedStatus );
+            __ASSERT_DEBUG(EFalse,User::Panic(Kstub3CcPanicCategory,EPanicUnexpectedStatus));
+        }
 	switch (iState)
 		{
 		case EUsbServiceStarting:
@@ -259,10 +279,13 @@
 			iState = EUsbServiceIdle;
 			break;
 		default:	
-			_USB_PANIC(Kstub3CcPanicCategory, EPanicUnexpectedState);
+		    OstTrace1( TRACE_FATAL, CUSBSTUB3CLASSCONTROLLER_RUNL_DUP1, 
+		             "CUsbstub3ClassController::RunL panic with error %d", EPanicUnexpectedStatus );
+		    User::Panic(Kstub3CcPanicCategory,EPanicUnexpectedStatus);
 		}
 	*iReportStatus = KErrNone;	
 	User::RequestComplete(iReportStatus, iStatus.Int());	
+	OstTraceFunctionExit0( CUSBSTUB3CLASSCONTROLLER_RUNL_EXIT );
 	}
 
 /**
@@ -284,8 +307,10 @@
 		case EUsbServiceStopping:
 			iState = EUsbServiceStarted;
 			break;
-		default:	
-			_USB_PANIC(Kstub3CcPanicCategory, EPanicUnexpectedState);
+		default:
+		    OstTrace1( TRACE_FATAL, CUSBSTUB3CLASSCONTROLLER_DOCANCEL, 
+		            "CUsbstub3ClassController::DoCancel panic with error %d", EPanicUnexpectedStatus );
+		    User::Panic(Kstub3CcPanicCategory,EPanicUnexpectedStatus);
 	}
 	*iReportStatus = KErrNone;		
 	User::RequestComplete(iReportStatus, KErrCancel);	
@@ -300,7 +325,9 @@
  */
 TInt CUsbstub3ClassController::RunError(TInt /*aError*/)
 	{
-	__ASSERT_DEBUG( EFalse, _USB_PANIC(Kstub3CcPanicCategory, EUnusedFunction) );
+    OstTrace1( TRACE_FATAL, CUSBSTUB3CLASSCONTROLLER_RUNERROR, 
+             "CUsbstub3ClassController::RunError panic with error %d", EUnusedFunction );
+    __ASSERT_DEBUG(EFalse,User::Panic(Kstub3CcPanicCategory,EUnusedFunction));
 	return KErrNone;
 	}
 
@@ -310,25 +337,34 @@
  * endpoint and, if found, configuring the interface.
  */
 	{
-	LOG_FUNC
-
+    OstTraceFunctionEntry0( CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_ENTRY );
+    
 	TUsbDeviceCaps dCaps;
 	TInt ret = iLdd.DeviceCaps(dCaps);
-	LOGTEXT(_L8("\tchecking result of DeviceCaps"));
+	OstTrace0( TRACE_NORMAL, CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE,
+	        _L8("\tchecking result of DeviceCaps"));
+	
 	if ( ret )
 		{
-		LOGTEXT2(_L8("<<CCdcControlInterface::SetUpInterface ret=%d"), ret);
+        OstTrace1( TRACE_ERROR, CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_DUP1, 
+                _L8("<<CCdcControlInterface::SetUpInterface ret=%d"), ret );
+        
+		OstTraceFunctionExit0( CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_EXIT );
 		return ret;
 		}
 
 	const TUint KRequiredNumberOfEndpoints = 1; // in addition to endpoint 0.
 
 	const TUint totalEndpoints = static_cast<TUint>(dCaps().iTotalEndpoints);
-	LOGTEXT2(_L8("\tiTotalEndpoints = %d"), totalEndpoints);
+	OstTrace1( TRACE_NORMAL, CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_DUP2, 
+	        _L8("\tiTotalEndpoints = %d"), totalEndpoints );
+	
 	if ( totalEndpoints < KRequiredNumberOfEndpoints )
 		{
-		LOGTEXT2(_L8("<<CCdcControlInterface::SetUpInterface ret=%d"), 
-			KErrGeneral);
+        OstTrace1( TRACE_ERROR, CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_DUP3, 
+                _L8("<<CCdcControlInterface::SetUpInterface ret=%d"), KErrGeneral );
+        
+		OstTraceFunctionExit0( CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_EXIT_DUP1 );
 		return KErrGeneral;
 		}
 	
@@ -336,10 +372,15 @@
 	TUsbcEndpointData data[KUsbcMaxEndpoints];
 	TPtr8 dataptr(reinterpret_cast<TUint8*>(data), sizeof(data), sizeof(data));
 	ret = iLdd.EndpointCaps(dataptr);
-	LOGTEXT(_L8("\tchecking result of EndpointCaps"));
+	OstTrace0( TRACE_NORMAL, CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_DUP4,
+	        _L8("\tchecking result of EndpointCaps"));
+	
 	if ( ret )
 		{
-		LOGTEXT2(_L8("<<CCdcControlInterface::SetUpInterface ret=%d"), ret);
+        OstTrace1( TRACE_ERROR, CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_DUP5, 
+                _L8("<<CCdcControlInterface::SetUpInterface ret=%d"), ret );
+        
+		OstTraceFunctionExit0( CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_EXIT_DUP2 );
 		return ret;
 		}
 
@@ -349,7 +390,13 @@
 	for ( TUint i = 0 ; i < totalEndpoints ; i++ )
 		{
 		const TUsbcEndpointCaps* caps = &data[i].iCaps;
-		__ASSERT_DEBUG(caps,_USB_PANIC(Kstub3CcPanicCategory, EPanicUnexpectedStatus));
+		if(!caps)
+		    {
+                OstTrace1( TRACE_FATAL, CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_DUP6, 
+                        "CUsbstub3ClassController::SetUpInterface panic with error %d", 
+                        EPanicUnexpectedStatus );
+                __ASSERT_DEBUG(EFalse,User::Panic(Kstub3CcPanicCategory,EPanicUnexpectedStatus));
+		    }
 
 		if (data[i].iInUse)
 			{
@@ -375,11 +422,14 @@
 			break;
 			}
 		}
-	LOGTEXT(_L8("\tchecking epFound"));
+	OstTrace0( TRACE_NORMAL, CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_DUP7, _L8("\tchecking epFound"));
+	
 	if ( !epFound )
 		{
-		LOGTEXT2(_L8("<<CCdcControlInterface::SetUpInterface ret=%d"), 
-			KErrGeneral);
+        OstTrace1( TRACE_ERROR, CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_DUP8, 
+                _L8("<<CCdcControlInterface::SetUpInterface ret=%d"), KErrGeneral);
+        
+		OstTraceFunctionExit0( CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_EXIT_DUP3 );
 		return KErrGeneral;
 		}
 
@@ -391,11 +441,16 @@
 	ifc().iClass.iSubClassNum = 0x02; // Table 16- Abstract Control Model
 	ifc().iClass.iProtocolNum = 0x01; // Table 17- Hayes compatible
 
-	LOGTEXT(_L8("\tabout to call SetInterface"));
+	OstTrace0( TRACE_NORMAL, CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_DUP9,
+	        _L8("\tabout to call SetInterface"));
+	
 	// Zero effectively indicates that alternate interfaces are not used.
 	ret = iLdd.SetInterface(0, ifc);
 
-	LOGTEXT2(_L8("<<CCdcControlInterface::SetUpInterface ret=%d"), ret);
+	OstTrace1( TRACE_NORMAL, CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_DUP10, 
+	        _L8("<<CCdcControlInterface::SetUpInterface ret=%d"), ret );
+	
+	OstTraceFunctionExit0( CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_EXIT_DUP4 );
 	return ret;
 	}
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/t_usbmanager_suite/Stub3CC/traces/OstTraceDefinitions.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,7 @@
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <opensystemtrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/t_usbmanager_suite/Stub3CC/traces/fixed_id.definitions	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,49 @@
+#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt.
+[GROUP]TRACE_ERROR=0x82
+[GROUP]TRACE_FATAL=0x81
+[GROUP]TRACE_FLOW=0x8a
+[GROUP]TRACE_NORMAL=0x86
+[TRACE]TRACE_ERROR[0x82]_CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_DUP1=0x1
+[TRACE]TRACE_ERROR[0x82]_CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_DUP3=0x2
+[TRACE]TRACE_ERROR[0x82]_CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_DUP5=0x3
+[TRACE]TRACE_ERROR[0x82]_CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_DUP8=0x4
+[TRACE]TRACE_FATAL[0x81]_CUSBSTUB3CLASSCONTROLLER_DOCANCEL=0x3
+[TRACE]TRACE_FATAL[0x81]_CUSBSTUB3CLASSCONTROLLER_RUNERROR=0x4
+[TRACE]TRACE_FATAL[0x81]_CUSBSTUB3CLASSCONTROLLER_RUNL=0x1
+[TRACE]TRACE_FATAL[0x81]_CUSBSTUB3CLASSCONTROLLER_RUNL_DUP1=0x2
+[TRACE]TRACE_FATAL[0x81]_CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_DUP6=0x5
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB3CLASSCONTROLLER_GETDESCRIPTORINFO_ENTRY=0x9
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB3CLASSCONTROLLER_GETDESCRIPTORINFO_EXIT=0xa
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB3CLASSCONTROLLER_RUNL_ENTRY=0xb
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB3CLASSCONTROLLER_RUNL_EXIT=0xc
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_ENTRY=0xd
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_EXIT=0xe
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_EXIT_DUP1=0xf
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_EXIT_DUP2=0x10
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_EXIT_DUP3=0x11
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_EXIT_DUP4=0x12
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB3CLASSCONTROLLER_START_ENTRY=0x1
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB3CLASSCONTROLLER_START_EXIT=0x2
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB3CLASSCONTROLLER_START_EXIT_DUP1=0x3
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB3CLASSCONTROLLER_START_EXIT_DUP2=0x4
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB3CLASSCONTROLLER_STOP_ENTRY=0x5
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB3CLASSCONTROLLER_STOP_EXIT=0x6
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB3CLASSCONTROLLER_STOP_EXIT_DUP1=0x7
+[TRACE]TRACE_FLOW[0x8A]_CUSBSTUB3CLASSCONTROLLER_STOP_EXIT_DUP2=0x8
+[TRACE]TRACE_NORMAL[0x86]_CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE=0x7
+[TRACE]TRACE_NORMAL[0x86]_CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_DUP10=0x11
+[TRACE]TRACE_NORMAL[0x86]_CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_DUP2=0x9
+[TRACE]TRACE_NORMAL[0x86]_CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_DUP4=0xb
+[TRACE]TRACE_NORMAL[0x86]_CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_DUP7=0xe
+[TRACE]TRACE_NORMAL[0x86]_CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_DUP9=0x10
+[TRACE]TRACE_NORMAL[0x86]_CUSBSTUB3CLASSCONTROLLER_START=0x1
+[TRACE]TRACE_NORMAL[0x86]_CUSBSTUB3CLASSCONTROLLER_START_DUP1=0x2
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBSTUB3CLASSCONTROLLER_DOCANCEL=0x5
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBSTUB3CLASSCONTROLLER_RUNERROR=0x6
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBSTUB3CLASSCONTROLLER_RUNL=0x3
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBSTUB3CLASSCONTROLLER_RUNL_DUP1=0x4
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_DUP1=0x8
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_DUP3=0xa
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_DUP5=0xc
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_DUP6=0xd
+[[OBSOLETE]][TRACE]TRACE_NORMAL[0x86]_CUSBSTUB3CLASSCONTROLLER_SETUPINTERFACE_DUP8=0xf
--- a/usbmgmt/usbmgrtest/t_usbmanager_suite/T_UsbManager/src/CUsbComponentTest.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_usbmanager_suite/T_UsbManager/src/CUsbComponentTest.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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));
 	}
 	
--- a/usbmgmt/usbmgrtest/t_usbmanager_suite/T_UsbManager/src/T_UsbManagerServer.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_usbmanager_suite/T_UsbManager/src/T_UsbManagerServer.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -53,7 +53,6 @@
 	// Server Logging.
 
 	server->StartL(KServerName); 
-	//server-> ConstructL(KServerName);
 	CleanupStack::Pop(server);
 	return server;
 	}
--- a/usbmgmt/usbmgrtest/t_usbmanager_suite/mscc/group/te_msclasscontroller.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_usbmanager_suite/mscc/group/te_msclasscontroller.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -42,6 +42,7 @@
 
 USERINCLUDE	../inc
 USERINCLUDE	../../../../usbmgr/device/classdrivers/ms/classcontroller/inc
+USERINCLUDE	../../../../usbmgr/device/classdrivers/ms/classcontroller/traces
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
 LIBRARY     	euser.lib
@@ -51,4 +52,3 @@
 LIBRARY		bafl.lib 
 LIBRARY		usbclasscontroller.lib
 
-#include <usb/usblogger.mmh>
--- a/usbmgmt/usbmgrtest/t_usbmodem/inc/t_usbmodem.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_usbmodem/inc/t_usbmodem.h	Tue Aug 31 17:01:47 2010 +0300
@@ -146,7 +146,7 @@
 	RComm* iCommPort;
 	};
 
-class CDuplex : public MTransferNotifier, CBase
+class CDuplex : public CBase, MTransferNotifier
 	{
 public:
 	// Construction
--- a/usbmgmt/usbmgrtest/t_usbmodem/src/t_usbmodem.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_usbmodem/src/t_usbmodem.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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(""));
--- a/usbmgmt/usbmgrtest/t_whcm_cc/src/t_whcm_cc.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_whcm_cc/src/t_whcm_cc.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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
     }
 
--- a/usbmgmt/usbmgrtest/usbmsapp/usbms_stub/group/usbms_stub1cc.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/usbmsapp/usbms_stub/group/usbms_stub1cc.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -36,6 +36,7 @@
 
 USERINCLUDE		../inc
 USERINCLUDE		../../../../usbmgr/usbman/server/public
+USERINCLUDE     ../traces
 
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
--- a/usbmgmt/usbmgrtest/usbmsapp/usbms_stub/group/usbms_stub2cc.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/usbmsapp/usbms_stub/group/usbms_stub2cc.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -36,6 +36,7 @@
 
 USERINCLUDE		../inc
 USERINCLUDE		../../../../usbmgr/usbman/server/public
+USERINCLUDE     ../traces
 
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
--- a/usbmgmt/usbmgrtest/usbmsapp/usbms_stub/group/usbms_stub3cc.mmp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/usbmsapp/usbms_stub/group/usbms_stub3cc.mmp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -36,6 +36,7 @@
 
 USERINCLUDE		../inc
 USERINCLUDE		../../../../usbmgr/usbman/server/public
+USERINCLUDE     ../traces
 
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
--- a/usbmgmt/usbmgrtest/usbmsapp/usbms_stub/inc/usbms_stub.h	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/usbmsapp/usbms_stub/inc/usbms_stub.h	Tue Aug 31 17:01:47 2010 +0300
@@ -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;
--- a/usbmgmt/usbmgrtest/usbmsapp/usbms_stub/src/usbms_stub.cpp	Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/usbmsapp/usbms_stub/src/usbms_stub.cpp	Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -22,14 +22,17 @@
  @file
 */
 
-#include "usbms_stub.h"
 #include <usb_std.h>
 #include <es_ini.h>
 #include <d32usbc.h>
 
+#include "usbms_stub.h"
 #include "UsbmanInternalConstants.h"
 
-#define _USB_PANIC(CAT, CODE)	User::Panic(CAT, CODE) 
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "usbms_stubTraces.h"
+#endif
 
 // Panic category 
 _LIT( Kstub3CcPanicCategory, "UsbstubCc" );
@@ -80,11 +83,6 @@
 	Cancel();
 
 	iTimer.Close();
-
-#ifndef __WINS__	
-//	iLdd.Close();
-#endif
-
 	}
 
 
@@ -193,8 +191,15 @@
  */
 void CUsbstub3ClassController::RunL()
 	{
-
-	__ASSERT_DEBUG( iStatus == KErrNone, _USB_PANIC(Kstub3CcPanicCategory, EPanicUnexpectedStatus) );
+    if(iStatus != KErrNone)
+    {
+        OstTrace1( TRACE_FATAL, CUSBSTUB3CLASSCONTROLLER_RUNL, 
+                        "CUsbstub3ClassController::RunL panic with error %d", 
+                        EPanicUnexpectedState);
+        
+        __ASSERT_DEBUG(EFalse, User::Panic(Kstub3CcPanicCategory, EPanicUnexpectedStatus));
+    }
+	
 	switch (iState)
 		{
 		case EUsbServiceStarting:
@@ -203,8 +208,10 @@
 		case EUsbServiceStopping:
 			iState = EUsbServiceIdle;
 			break;
-		default:	
-			_USB_PANIC(Kstub3CcPanicCategory, EPanicUnexpectedState);
+		default:
+		    OstTrace1( TRACE_FATAL, CUSBSTUB3CLASSCONTROLLER_RUNL_DUP1, 
+		            "CUsbstub3ClassController::RunL panic with error %d", EPanicUnexpectedState);
+		    User::Panic(Kstub3CcPanicCategory,EPanicUnexpectedState);
 		}
 	*iReportStatus = KErrNone;	
 	User::RequestComplete(iReportStatus, iStatus.Int());	
@@ -229,8 +236,11 @@
 		case EUsbServiceStopping:
 			iState = EUsbServiceStarted;
 			break;
-		default:	
-			_USB_PANIC(Kstub3CcPanicCategory, EPanicUnexpectedState);
+		default:
+		    OstTrace1( TRACE_FATAL, CUSBSTUB3CLASSCONTROLLER_DOCANCEL, 
+		                                "CUsbstub3ClassController::DoCancel panic with error %d", 
+		                                EPanicUnexpectedState);
+			User::Panic(Kstub3CcPanicCategory, EPanicUnexpectedState);
 	}
 	*iReportStatus = KErrNone;		
 	User::RequestComplete(iReportStatus, KErrCancel);	
@@ -245,7 +255,10 @@
  */
 TInt CUsbstub3ClassController::RunError(TInt /*aError*/)
 	{
-	__ASSERT_DEBUG( EFalse, _USB_PANIC(Kstub3CcPanicCategory, EUnusedFunction) );
+    OstTrace1( TRACE_FATAL, CUSBSTUB3CLASSCONTROLLER_RUNERROR, 
+                            "CUsbstub3ClassController::RunError panic with error %d", 
+                            EUnusedFunction);
+	__ASSERT_DEBUG( EFalse, User::Panic(Kstub3CcPanicCategory, EUnusedFunction));
 	return KErrNone;
 	}
 
@@ -255,7 +268,7 @@
  * endpoint and, if found, configuring the interface.
  */
 	{
-return 0;
+    return 0;
 	}
 
 	
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/usbmsapp/usbms_stub/traces/OstTraceDefinitions.h	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,7 @@
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <opensystemtrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/usbmsapp/usbms_stub/traces/fixed_id.definitions	Tue Aug 31 17:01:47 2010 +0300
@@ -0,0 +1,6 @@
+#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt.
+[GROUP]TRACE_NORMAL=0x86
+[TRACE]TRACE_NORMAL[0x86]_CUSBSTUB3CLASSCONTROLLER_DOCANCEL=0x3
+[TRACE]TRACE_NORMAL[0x86]_CUSBSTUB3CLASSCONTROLLER_RUNERROR=0x4
+[TRACE]TRACE_NORMAL[0x86]_CUSBSTUB3CLASSCONTROLLER_RUNL=0x1
+[TRACE]TRACE_NORMAL[0x86]_CUSBSTUB3CLASSCONTROLLER_RUNL_DUP1=0x2