--- a/usbengines/usbwatcher/src/cusbactivestate.cpp Tue Jan 26 12:55:41 2010 +0200
+++ b/usbengines/usbwatcher/src/cusbactivestate.cpp Tue Feb 02 00:52:37 2010 +0200
@@ -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 );
+ }
}
// ----------------------------------------------------------------------------