diff -r 47c263f7e521 -r 4712310216c0 usbengines/usbwatcher/src/cusbactivestate.cpp --- a/usbengines/usbwatcher/src/cusbactivestate.cpp Tue Jan 26 12:55:41 2010 +0200 +++ b/usbengines/usbwatcher/src/cusbactivestate.cpp Fri Apr 23 23:17:21 2010 +0300 @@ -95,13 +95,25 @@ LOG_FUNC LEAVEIFERROR( iStatus.Int() ); // Close process if error happens here - LOG2( "DeviceState change: %d ==> %d", iPreviousState, iCurrentState ); + TUsbDeviceState newState = iCurrentState; iUsbMan.DeviceStateNotification( KUsbAllStates, iCurrentState, iStatus ); SetActive(); - iOwner.StateChangeNotify( iPreviousState, newState ); - iPreviousState = newState; + + // Notify only if there is a change + if ( newState != iPreviousState ) + { + LOG2( "USB device state changed: %d ==> %d", iPreviousState, + newState ); + iOwner.StateChangeNotify( iPreviousState, newState ); + iPreviousState = newState; + } + else + { + LOG2("USB device change ignored: %d -> %d", iPreviousState, + newState ); + } } // ----------------------------------------------------------------------------