diff -r 8c311f9acc5e -r 0ae0f29418cd usbengines/usbotgwatcher/src/cusbstatehostabase.cpp --- a/usbengines/usbotgwatcher/src/cusbstatehostabase.cpp Fri Mar 19 09:48:52 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbstatehostabase.cpp Fri Apr 16 16:02:21 2010 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -20,6 +20,7 @@ #include #include +#include "cusbotgwatcher.h" #include "cusbstatehostabase.h" #include "cusbstatehosthandledropping.h" @@ -44,6 +45,7 @@ void CUsbStateHostABase::ConstructL() { LOG_FUNC + CUsbState::ConstructL(); } // --------------------------------------------------------------------------- @@ -151,7 +153,7 @@ case KErrUsbOtgHnpEnableProblem:// = -6687; case KErrUsbOtgVbusError:// = -6690; - // hosterrors.h + // hosterrors.h case KErrUsbConfigurationHasNoInterfaces: case KErrUsbInterfaceCountMismatch: case KErrUsbDuplicateInterfaceNumbers: @@ -164,10 +166,10 @@ break; } - // OTGDI + // OTGDI case KErrUsbOtgPeriphNotSupported: // = -6688, for OPT only - // USBDI + // USBDI case KErrUsbRequestsPending: case KErrUsbBadAddress: case KErrUsbNoAddress: @@ -189,7 +191,7 @@ case KErrUsbEventOverflow: case KErrUsbBadDeviceAttached: - // hosterrors.h + // hosterrors.h case KErrUsbUnsupportedDevice: { LOG( "UnsupportedDevice" ); @@ -238,10 +240,17 @@ { LOG_FUNC + if (iWatcher.VBusObserver()->VBus() == CUsbVBusObserver::EVBusUp) + { + LOG( "Session is ongoing (VBus high); ignore SRP request." ); + return; + } + TInt err = iWatcher.Usb().BusRespondSrp(); - if (KErrNone != err) + LOG1( "BusRespondSrp() error = %d" , err ); + + if (KErrNone != err && KErrUsbOtgVbusAlreadyRaised != err) { - LOG1( "BusRespondSrp error = %d" , err ); iWatcher.HandleHostProblemL(EUsbWatcherErrorInConnection, EUsbStateHostHandleDropping); } @@ -258,16 +267,16 @@ if (iWatcher.VBusObserver()->VBus() == CUsbVBusObserver::EVBusUp) { // session already ongoing; BusRequest() in this case returns KErrUsbOtgBadState... - LOG( "VBus is already UP; ignore Session request." ); + LOG( "Session is ongoing (VBus high); ignore Session Request." ); return; } TInt err = iWatcher.Usb().BusRequest(); - if (KErrNone != err && KErrUsbOtgVbusAlreadyRaised != err) // sometimes this also comes... + LOG1( "BusRequest() err = %d" , err); + + if (KErrNone != err && KErrUsbOtgVbusAlreadyRaised != err) { - LOG1( "BusRequestError err = %d" , err); iWatcher.HandleHostProblemL(EUsbWatcherErrorInConnection, EUsbStateHostHandleDropping); - return; } }