--- a/harvester/monitorplugins/mmcplugin/src/mmcmonitorplugin.cpp Thu Aug 19 10:20:41 2010 +0300
+++ b/harvester/monitorplugins/mmcplugin/src/mmcmonitorplugin.cpp Tue Aug 31 15:37:30 2010 +0300
@@ -116,7 +116,8 @@
TBool presentState( EFalse );
TUint32 hdMediaId( 0 );
- hdMediaId = iMountTask->GetInternalDriveMediaId();
+ TBool hdPresent( EFalse );
+ hdMediaId = iMountTask->GetInternalDriveMediaId( hdPresent );
for( TInt i = medias.Count() - 1; i >=0; i-- )
{
@@ -137,10 +138,10 @@
}
}
- if( hdMediaId == 0 )
+ if( hdMediaId == 0 || !hdPresent )
{
// Try to fetch internall mass storage media id again if it was not mounted
- hdMediaId = iMountTask->GetInternalDriveMediaId();
+ hdMediaId = iMountTask->GetInternalDriveMediaId( hdPresent );
}
// scan mass storage to catch all chances even if battery dies during operation that should be catched
@@ -149,7 +150,7 @@
TBool exists( EFalse );
TRAP_IGNORE( exists= iMdEClient->GetMediaL( hdMediaId, driveLetter, presentState ) );
- if ( exists )
+ if ( exists && hdPresent )
{
WRITELOG("CMMCMonitorPlugin::StartMonitoring - start mass storage scan");
@@ -267,33 +268,39 @@
if( internalMassStorageError == KErrNone )
{
const TUint32 massStorageMediaId( internalMassStorageVolumeInfo.iUniqueID );
- TUint32 mmcMediaId( 0 );
- TInt mmcError( DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRemovableMassStorage, drive ) );
- if( mmcError == KErrNone )
+ if( massStorageMediaId == aMediaID &&
+ massStorageMediaId != 0 )
{
- TVolumeInfo mmcVolumeInfo;
- mmcError = iFs.Volume( mmcVolumeInfo, drive );
+ TUint32 mmcMediaId( 0 );
+ TInt mmcDrive( -1 );
+ TInt mmcError( DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRemovableMassStorage, mmcDrive ) );
if( mmcError == KErrNone )
{
- mmcMediaId = mmcVolumeInfo.iUniqueID;
+ if( drive != mmcDrive )
+ {
+ TVolumeInfo mmcVolumeInfo;
+ mmcError = iFs.Volume( mmcVolumeInfo, mmcDrive );
+ if( mmcError == KErrNone )
+ {
+ mmcMediaId = mmcVolumeInfo.iUniqueID;
+ }
+ }
+ else
+ {
+ mmcMediaId = massStorageMediaId;
+ }
}
- }
- // If removable storage is not found, assume internal mass storage was mounted
- if( mmcError )
- {
- if( massStorageMediaId != 0 &&
- massStorageMediaId == aMediaID )
+ // If removable storage is not found, assume internal mass storage was mounted
+ if( mmcError )
+ {
+ iMdEClient->CheckMassStorageMediaId( massStorageMediaId );
+ }
+ else if( massStorageMediaId != mmcMediaId )
{
iMdEClient->CheckMassStorageMediaId( massStorageMediaId );
- }
- }
- else if( massStorageMediaId != mmcMediaId &&
- massStorageMediaId != 0 &&
- massStorageMediaId == aMediaID )
- {
- iMdEClient->CheckMassStorageMediaId( massStorageMediaId );
- }
+ }
+ }
}
}