--- a/kernel/eka/include/e32ver.h Fri Apr 23 22:20:31 2010 +0100
+++ b/kernel/eka/include/e32ver.h Fri Apr 23 22:26:35 2010 +0100
@@ -28,7 +28,7 @@
const TInt KE32MajorVersionNumber=2;
const TInt KE32MinorVersionNumber=0;
-const TInt KE32BuildVersionNumber=3066;
+const TInt KE32BuildVersionNumber=3068;
const TInt KMachineConfigurationMajorVersionNumber=1;
const TInt KMachineConfigurationMinorVersionNumber=0;
--- a/kernel/eka/release.txt Fri Apr 23 22:20:31 2010 +0100
+++ b/kernel/eka/release.txt Fri Apr 23 22:26:35 2010 +0100
@@ -1,3 +1,19 @@
+Version 2.00.3068
+=================
+(Made by vfebvre 16/04/2010)
+
+1. jimmzhou
+ 1. ou1cimx1#342082 Logitech USB desktop microphone is not recogonized
+
+
+Version 2.00.3067
+=================
+(Made by vfebvre 16/04/2010)
+
+1. vfebvre
+ 1. No change
+
+
Version 2.00.3066
=================
(Made by vfebvre 15/04/2010)
--- a/userlibandfileserver/fileserver/group/release.txt Fri Apr 23 22:20:31 2010 +0100
+++ b/userlibandfileserver/fileserver/group/release.txt Fri Apr 23 22:26:35 2010 +0100
@@ -1,3 +1,19 @@
+Version 2.00.3033
+=================
+(Made by vfebvre 16/04/2010)
+
+1. niccox
+ 1. DEF145330 Error in mass storage note when connecting SanDisk 16GB stick to phone
+
+
+Version 2.00.3032
+=================
+(Made by vfebvre 16/04/2010)
+
+1. vfebvre
+ 1. No change
+
+
Version 2.00.3031
=================
(Made by vfebvre 15/04/2010)
--- a/userlibandfileserver/fileserver/inc/f32ver.h Fri Apr 23 22:20:31 2010 +0100
+++ b/userlibandfileserver/fileserver/inc/f32ver.h Fri Apr 23 22:26:35 2010 +0100
@@ -58,6 +58,6 @@
@see TVersion
*/
-const TInt KF32BuildVersionNumber=3031;
+const TInt KF32BuildVersionNumber=3033;
//
#endif
--- a/userlibandfileserver/fileserver/shostmassstorage/client/debug.h Fri Apr 23 22:20:31 2010 +0100
+++ b/userlibandfileserver/fileserver/shostmassstorage/client/debug.h Fri Apr 23 22:26:35 2010 +0100
@@ -1,4 +1,4 @@
-// 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 the License "Eclipse Public License v1.0"
@@ -25,7 +25,8 @@
#include <e32debug.h>
#endif
-// #define _USBMS_DEBUG_PRINT_
+// #define _USBMS_DEBUG_PRINT_
+// #define _MSDEVICE_DEBUG_PRINT_
#if defined(_USBMS_DEBUG_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE))
/** Trace - format string */
@@ -75,4 +76,15 @@
#define __FNLOG(name)
#endif
+
+#if defined (_MSDEVICE_DEBUG_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE))
+#define __MSDEVPRINT(t) {RDebug::Print(t);}
+#define __MSDEVPRINT1(t,a) {RDebug::Print(t,a);}
+#define __MSDEVPRINT2(t,a,b) {RDebug::Print(t,a,b);}
+#else
+#define __MSDEVPRINT(t)
+#define __MSDEVPRINT1(t,a)
+#define __MSDEVPRINT2(t,a,b)
+#endif // _MSDEVICE_DEBUG_PRINT_
+
#endif // DEBUG_H
--- a/userlibandfileserver/fileserver/shostmassstorage/client/rusbhostmsdevice.cpp Fri Apr 23 22:20:31 2010 +0100
+++ b/userlibandfileserver/fileserver/shostmassstorage/client/rusbhostmsdevice.cpp Fri Apr 23 22:26:35 2010 +0100
@@ -1,4 +1,4 @@
-// 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 the License "Eclipse Public License v1.0"
@@ -204,6 +204,7 @@
EXPORT_C TInt RUsbHostMsDevice::MountLun(TUint32 aLunId, TInt aDriveNum)
{
__FNLOG("RUsbHostMsDevice::MountLun");
+ __MSDEVPRINT2(_L(">>> RUsbHostMsDevice::MountLun Drv=%d LUN=%d"), aDriveNum, aLunId);
RFs TheFs;
TInt r = TheFs.Connect();
if(r == KErrNone)
@@ -212,11 +213,12 @@
unitPkg().iLunID = aLunId;
r = TheFs.MountProxyDrive(aDriveNum, _L("usbhostms"), &unitPkg, *this);
+ __MSDEVPRINT1(_L("MountProxyDrive %d"), r);
if(r >= KErrNone)
{
r = TheFs.MountFileSystem(KFileSystem, aDriveNum);
-
- if(r != KErrNone && r != KErrNotReady && r != KErrCorrupt)
+ __MSDEVPRINT1(_L("MountFileSystem %d"), r);
+ if(r != KErrNone && r != KErrNotReady && r != KErrCorrupt && r != KErrNotSupported)
{
TheFs.DismountFileSystem(KFileSystem, aDriveNum);
TheFs.DismountProxyDrive(aDriveNum);
@@ -230,6 +232,7 @@
EXPORT_C TInt RUsbHostMsDevice::DismountLun(TInt aDriveNum)
{
__FNLOG("RUsbHostMsDevice::DismountLun");
+ __MSDEVPRINT1(_L(">>> RUsbHostMsDevice::DismountLun Drv=%d"), aDriveNum);
RFs TheFs;
TInt r;
r = TheFs.Connect();
--- a/userlibandfileserver/fileserver/shostmassstorage/msproxy/hostusbmsproxy.cpp Fri Apr 23 22:20:31 2010 +0100
+++ b/userlibandfileserver/fileserver/shostmassstorage/msproxy/hostusbmsproxy.cpp Fri Apr 23 22:26:35 2010 +0100
@@ -154,7 +154,7 @@
TCapsInfo capsInfo;
TInt err = iUsbHostMsLun.Caps(capsInfo);
- if (err == KErrNone)
+ if (err == KErrNone && capsInfo.iMediaType == EMediaHardDisk)
{
err = InitialiseOffset(capsInfo);
}
@@ -538,13 +538,12 @@
TInt CUsbHostMsProxyDrive::Caps(TDes8& anInfo)
{
__MSFNSLOG
- __HOSTPRINT(_L("\n>>> HOST Caps"));
+ __HOSTPRINT(_L(">>> HOST Caps"));
TLocalDriveCapsV6Buf caps;
caps.FillZ();
TLocalDriveCapsV6& c = caps();
- c.iType = EMediaHardDisk;
c.iConnectionBusType = EConnectionBusUsb;
c.iDriveAtt = KDriveAttLocal | KDriveAttRemovable | KDriveAttExternal;
c.iMediaAtt = KMediaAttFormattable;
@@ -552,32 +551,50 @@
TCapsInfo capsInfo;
TInt r = iUsbHostMsLun.Caps(capsInfo);
+
if (KErrNone == r)
{
- c.iBlockSize = capsInfo.iBlockLength;
- TUint64 size = iMsDataMemMap.DataSize();
- if (size == 0)
- {
- // No valid partitions so specify the size of the disk
- size = static_cast<TUint64>(capsInfo.iNumberOfBlocks) * capsInfo.iBlockLength;
- }
- c.iSize = size;
-
- c.iEraseBlockSize = 0;
+ c.iType = capsInfo.iMediaType;
- if (capsInfo.iWriteProtect)
+ if (capsInfo.iMediaType == EMediaHardDisk)
{
- c.iMediaAtt |= KMediaAttWriteProtected;
+ c.iBlockSize = capsInfo.iBlockLength;
+ TUint64 size = iMsDataMemMap.DataSize();
+
+ if (size == 0)
+ {
+ // No valid partitions so specify the size of the disk
+ size = static_cast<TUint64>(capsInfo.iNumberOfBlocks) * capsInfo.iBlockLength;
+ }
+ c.iSize = size;
+
+ c.iEraseBlockSize = 0;
+
+ if (capsInfo.iWriteProtect)
+ {
+ c.iMediaAtt |= KMediaAttWriteProtected;
+ }
+
+ static const TInt K512ByteSectorSize = 0x200; // 512
+ if(K512ByteSectorSize != capsInfo.iBlockLength)
+ {
+ // not formattable if sector size is not 512
+ c.iMediaAtt &= ~KMediaAttFormattable;
+ }
+ __HOSTPRINT4(_L("<<< HOST Caps Block[num=0x%x size=0x%x] Media[size=0x%lx WP=0x%x]"),
+ capsInfo.iNumberOfBlocks, capsInfo.iBlockLength,
+ caps().iSize, caps().iMediaAtt);
}
-
- static const TInt K512ByteSectorSize = 0x200; // 512
- if(K512ByteSectorSize != capsInfo.iBlockLength)
- {
- c.iMediaAtt &= ~KMediaAttFormattable;
- }
- __HOSTPRINT4(_L("<<< HOST Caps Block[num=0x%x size=0x%x] Media[size=0x%lx WP=0x%x]"),
- capsInfo.iNumberOfBlocks, capsInfo.iBlockLength,
- caps().iSize, caps().iMediaAtt);
+ else if (capsInfo.iMediaType == EMediaCdRom)
+ {
+ // not formattable
+ c.iMediaAtt &= ~KMediaAttFormattable;
+ __HOSTPRINT(_L(">>> HOST Caps MediaType = EMediaCdRom"));
+ }
+ else
+ {
+ // do nothing
+ }
}
else if (KErrNotReady)
{
--- a/userlibandfileserver/fileserver/shostmassstorage/server/controller/cusbhostmsdevice.cpp Fri Apr 23 22:20:31 2010 +0100
+++ b/userlibandfileserver/fileserver/shostmassstorage/server/controller/cusbhostmsdevice.cpp Fri Apr 23 22:26:35 2010 +0100
@@ -1,4 +1,4 @@
-// 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 the License "Eclipse Public License v1.0"
@@ -152,8 +152,8 @@
void CUsbHostMsDevice::InitLunL(TLun aLun)
{
__MSFNLOG
- SetLunL(aLun);
- iLuList.GetLuL(aLun).InitL();
+ CUsbHostMsLogicalUnit& lu = SetLunL(aLun);
+ lu.InitL();
}
@@ -174,7 +174,7 @@
for (TInt i = 0; i < iLuList.Count(); i++)
{
CUsbHostMsLogicalUnit& lu = iLuList.GetLuL(i);
- SetLunL(lu.Lun());
+ SetLunL(lu);
lu.SuspendL();
}
@@ -217,21 +217,31 @@
return iLuList.GetLuL(aLunNum);
}
-void CUsbHostMsDevice::SetLunL(TLun aLun)
+
+void CUsbHostMsDevice::SetLunL(CUsbHostMsLogicalUnit& aLu)
{
__MSFNLOG
- if (aLun <= iMaxLun)
+ TLun lun = aLu.Lun();
+ if (lun <= iMaxLun)
{
- __HOSTPRINT1(_L("SetLun %d"), aLun);
- iTransport->SetLun(aLun);
- CUsbHostMsLogicalUnit& lu = iLuList.GetLuL(aLun);
- if (lu.IsReadyToSuspend())
+ __HOSTPRINT1(_L("SetLun %d"), lun);
+ iTransport->SetLun(lun);
+ if (aLu.IsReadyToSuspend())
{
- lu.CancelReadyToSuspend();
+ aLu.CancelReadyToSuspend();
}
}
}
+
+CUsbHostMsLogicalUnit& CUsbHostMsDevice::SetLunL(TLun aLun)
+ {
+ __MSFNLOG
+ CUsbHostMsLogicalUnit& lu = iLuList.GetLuL(aLun);
+ SetLunL(lu);
+ return lu;
+ }
+
/**
Starts timer to periodically check LUN. If the timer is not yet running then
start it.
@@ -290,7 +300,7 @@
for (TInt i = 0; i < iLuList.Count(); i++)
{
CUsbHostMsLogicalUnit& lu = iLuList.GetLuL(i);
- SetLunL(lu.Lun());
+ SetLunL(lu);
TRAP(err, lu.DoLunReadyCheckL());
}
}
@@ -318,7 +328,7 @@
for (TInt i = 0; i < iLuList.Count(); i++)
{
CUsbHostMsLogicalUnit& lu = iLuList.GetLuL(i);
- SetLunL(lu.Lun());
+ SetLunL(lu);
lu.SuspendL();
}
@@ -332,7 +342,7 @@
for (TInt i = 0; i < iLuList.Count(); i++)
{
CUsbHostMsLogicalUnit& lu = iLuList.GetLuL(i);
- SetLunL(lu.Lun());
+ SetLunL(lu);
lu.ResumeL();
}
}
--- a/userlibandfileserver/fileserver/shostmassstorage/server/controller/cusbhostmsdevicethread.cpp Fri Apr 23 22:20:31 2010 +0100
+++ b/userlibandfileserver/fileserver/shostmassstorage/server/controller/cusbhostmsdevicethread.cpp Fri Apr 23 22:26:35 2010 +0100
@@ -1,4 +1,4 @@
-// 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 the License "Eclipse Public License v1.0"
@@ -419,6 +419,7 @@
TPtrC8 pLun((TUint8*)&iLunId, sizeof(TUint32));
aMessage.WriteL(3, pLun);
iLunId -= 1; // We represent LunId in MSC from 0 to MaxLun-1 as represented in BOT
+ __HOSTPRINT1(_L("RegisterLogicalUnitL LUN=%d "), iLunId);
iUsbHostMsDevice->AddLunL(iLunId);
iUsbHostMsDevice->InitLunL(iLunId);
}
--- a/userlibandfileserver/fileserver/shostmassstorage/server/controller/include/cusbhostmsdevice.h Fri Apr 23 22:20:31 2010 +0100
+++ b/userlibandfileserver/fileserver/shostmassstorage/server/controller/include/cusbhostmsdevice.h Fri Apr 23 22:26:35 2010 +0100
@@ -1,4 +1,4 @@
-// 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 the License "Eclipse Public License v1.0"
@@ -41,7 +41,8 @@
TLun GetAndSetLunL(const RMessage2& aMessage);
CUsbHostMsLogicalUnit& GetLuL(TInt aLunNum) const;
- void SetLunL(TLun aLun);
+ void SetLunL(CUsbHostMsLogicalUnit& aLu);
+ CUsbHostMsLogicalUnit& SetLunL(TLun aLun);
void SetMaxLun(TLun aMaxLun);
TLun GetMaxLun() const;
--- a/userlibandfileserver/fileserver/shostmassstorage/server/controller/tlogicalunitlist.cpp Fri Apr 23 22:20:31 2010 +0100
+++ b/userlibandfileserver/fileserver/shostmassstorage/server/controller/tlogicalunitlist.cpp Fri Apr 23 22:26:35 2010 +0100
@@ -102,7 +102,7 @@
TInt index;
for (index = 0; index < iLu.Count(); index++)
{
- __HOSTPRINT2(_L("search %d : interface id = %d\n"), aLun, iLu[index]->Lun());
+ __HOSTPRINT2(_L("search LUN=%d : interface id = %d"), aLun, iLu[index]->Lun());
if (iLu[index]->Lun() == aLun)
{
break;
--- a/userlibandfileserver/fileserver/shostmassstorage/server/protocol/cmassstoragefsm.cpp Fri Apr 23 22:20:31 2010 +0100
+++ b/userlibandfileserver/fileserver/shostmassstorage/server/protocol/cmassstoragefsm.cpp Fri Apr 23 22:26:35 2010 +0100
@@ -321,6 +321,7 @@
TInt CMassStorageFsm::ConnectLogicalUnitL()
{
__MSFNLOG
+ __HOSTPRINT(_L("CMassStorageFsm::ConnectLogicalUnitL()"));
TInt err = KErrNone;
for (;;)
{
@@ -340,6 +341,7 @@
TInt CMassStorageFsm::DisconnectLogicalUnitL()
{
__MSFNLOG
+ __HOSTPRINT(_L("CMassStorageFsm::DisconnectLogicalUnitL()"));
TInt err = KErrNone;
for (;;)
{
@@ -370,6 +372,7 @@
TRAPD(err, event = EntryL());
if (err == KErrNotSupported)
{
+ __HOSTPRINT(_L("FSM ProcessState returning with KErrNotSupported"));
return KErrNotSupported;
}
User::LeaveIfError(err);
@@ -557,7 +560,11 @@
aFsm.SetState(TMassStorageState::EReadCapacityState);
}
else
- aFsm.SetState(TMassStorageState::EInquiryState);
+ {
+ __HOSTPRINT(_L("SBC is not set !!"));
+ aFsm.SetState(TMassStorageState::EReadCapacityState);
+ }
+
return KErrNone;
}
--- a/userlibandfileserver/fileserver/shostmassstorage/server/protocol/cscsiprotocol.cpp Fri Apr 23 22:20:31 2010 +0100
+++ b/userlibandfileserver/fileserver/shostmassstorage/server/protocol/cscsiprotocol.cpp Fri Apr 23 22:26:35 2010 +0100
@@ -1,4 +1,4 @@
-// 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 the License "Eclipse Public License v1.0"
@@ -26,8 +26,6 @@
#include "shared.h"
#include "msgservice.h"
-#include "mscutils.h"
-
#include "mtransport.h"
#include "mprotocol.h"
#include "tscsiclientreq.h"
@@ -45,7 +43,6 @@
#include "usbmshostpanic.h"
-
/**
Create the CScsiProtocol object.
@@ -68,8 +65,8 @@
void CScsiProtocol::ConstructL(TLun aLun)
{
__MSFNLOG
+ // iState = EEntry;
iFsm = CMassStorageFsm::NewL(*this);
- iState = EDisconnected;
const TInt blockLength = 0x200;
@@ -99,6 +96,7 @@
void CScsiProtocol::InitialiseUnitL()
{
__MSFNLOG
+ iState = EDisconnected;
// A device may take time to mount the media. If the device fails attempt to
// retry the connection for a number of seconds
@@ -106,13 +104,16 @@
do
{
retryCounter--;
- iFsm->ConnectLogicalUnitL();
- iState = iFsm->IsConnected() ? EConnected: EDisconnected;
-
- if (iState == EConnected)
+ TInt err = iFsm->ConnectLogicalUnitL();
+ if (err == KErrNotSupported)
{
break;
}
+ if (iFsm->IsConnected())
+ {
+ iState = EConnected;
+ break;
+ }
User::After(1000 * 200); // 200 mS
}
while (retryCounter);
@@ -136,6 +137,10 @@
TInt aLength)
{
__MSFNLOG
+
+ if (!iSbcInterface)
+ User::Leave(KErrNotSupported);
+
if(!IsConnected())
User::Leave(KErrNotReady);
iSbcInterface->iBlockTransfer.ReadL(*this, aPos, aLength, aBuf);
@@ -145,6 +150,9 @@
void CScsiProtocol::BlockReadL(TPos aPos, TDes8& aCopybuf, TInt aLen)
{
__MSFNLOG
+ if (!iSbcInterface)
+ User::Leave(KErrNotSupported);
+
__ASSERT_DEBUG(aPos % iSbcInterface->iBlockTransfer.BlockLength() == 0,
User::Panic(KUsbMsHostPanicCat, EBlockDevice));
@@ -162,8 +170,7 @@
if (err)
{
__SCSIPRINT1(_L("READ(10) Err=%d"), err);
- DoCheckConditionL();
- User::LeaveIfError(KErrAbort);
+ User::LeaveIfError(DoCheckConditionL());
}
// handle residue
@@ -189,8 +196,7 @@
TInt err = iSbcInterface->Read10L(aPos/blockLen, aCopybuf, len);
if (err)
{
- DoCheckConditionL();
- User::LeaveIfError(KErrAbort);
+ User::LeaveIfError(DoCheckConditionL());
}
}
}
@@ -201,6 +207,9 @@
TInt aLength)
{
__MSFNLOG
+ if (!iSbcInterface)
+ User::Leave(KErrNotSupported);
+
if(!IsConnected())
User::Leave(KErrNotReady);
iSbcInterface->iBlockTransfer.WriteL(*this, aPosition, aLength, aBuf);
@@ -210,6 +219,9 @@
void CScsiProtocol::BlockWriteL(TPos aPos, TDesC8& aCopybuf, TUint aOffset, TInt aLen)
{
__MSFNLOG
+ if (!iSbcInterface)
+ User::Leave(KErrNotSupported);
+
__ASSERT_DEBUG(aPos % iSbcInterface->iBlockTransfer.BlockLength() == 0,
User::Panic(KUsbMsHostPanicCat, EBlockDevice));
const TInt blockLen = iSbcInterface->iBlockTransfer.BlockLength();
@@ -217,8 +229,7 @@
TInt err = iSbcInterface->Write10L(aPos/blockLen, aCopybuf, aOffset, len);
if (err)
{
- DoCheckConditionL();
- User::LeaveIfError(KErrAbort);
+ User::LeaveIfError(DoCheckConditionL());
}
while (len != aLen)
@@ -242,8 +253,7 @@
TInt err = iSbcInterface->Write10L(aPos/blockLen, buf, aOffset, len);
if (err)
{
- DoCheckConditionL();
- User::LeaveIfError(KErrAbort);
+ User::LeaveIfError(DoCheckConditionL());
}
}
}
@@ -257,6 +267,17 @@
DoScsiReadyCheckEventL();
}
+ if (!iSbcInterface)
+ {
+ aCapsInfo.iMediaType = EMediaCdRom;
+ aCapsInfo.iNumberOfBlocks = 0;
+ aCapsInfo.iBlockLength = 0;
+ aCapsInfo.iWriteProtect = ETrue;
+ return;
+ }
+
+ aCapsInfo.iMediaType = EMediaHardDisk;
+
TLba lastLba;
TUint32 blockLength;
@@ -268,15 +289,11 @@
err = iSbcInterface->ReadCapacity10L(lastLba, blockLength);
} while (err == KErrCommandStalled && stallCounter-- > 0);
-
if (err)
{
- if (err == KErrCommandFailed)
- {
- // Clear sense error
- DoCheckConditionL();
- }
- User::LeaveIfError(KErrAbort);
+ // DoCheckConditionL clears sense error
+ // Media not present will return KErrNotReady so leave here
+ User::LeaveIfError(DoCheckConditionL());
}
// update iWriteProtect
@@ -286,14 +303,24 @@
if (err == KErrCommandFailed)
{
// Clear sense error
- DoCheckConditionL();
+ err = DoCheckConditionL();
+ // ignore error if unsupported
+ if (err != KErrUnknown)
+ {
+ User::LeaveIfError(err);
+ }
}
err = MsModeSense6L();
if (err == KErrCommandFailed)
{
// Clear sense error
- DoCheckConditionL();
+ err = DoCheckConditionL();
+ // ignore error if unsupported
+ if (err != KErrUnknown)
+ {
+ User::LeaveIfError(err);
+ }
}
}
@@ -352,23 +379,38 @@
if (info.iPeripheralQualifier != 0 && info.iPeripheralQualifier != 1)
{
- __HOSTPRINT(_L("Peripheral Qualifier[Unknown device type]\n"))
- return KErrUnknown;
+ __HOSTPRINT(_L("Peripheral Qualifier[Unknown device type]"))
+ err = KErrUnknown;
+ }
+ else if (info.iPeripheralDeviceType == 0)
+ {
+ // SCSI SBC Direct access device
+ iRemovableMedia = info.iRemovable;
+
+ // SCSI Block device
+ iSbcInterface = new (ELeave) TSbcClientInterface(iSpcInterface.Transport());
+ iSbcInterface->InitBuffers(&iHeadbuf, &iTailbuf);
+ err = KErrNone;
+ }
+ else if (info.iPeripheralDeviceType == 5)
+ {
+ // SCSI MMC-2 CD-ROM device
+ __HOSTPRINT(_L("Peripheral Device Type[CD-ROM]"))
+ iRemovableMedia = info.iRemovable;
+
+ // MMC-2 is not supported. A SCSI interface call will return
+ // KErrNotSupported. If SCSI support is extended in future then
+ // TSbcInterface class should be replaced with a proper interface class.
+ iSbcInterface = NULL;
+ err = KErrNone;
+ }
+ else
+ {
+ __HOSTPRINT(_L("Peripheral Device Type[Unsupported device type]"))
+ err = KErrUnknown;
}
- if (info.iPeripheralDeviceType != 0)
- {
- __HOSTPRINT(_L("Peripheral Device Type[Unsupported device type]\n"))
- return KErrUnknown;
- }
-
- iRemovableMedia = info.iRemovable;
-
- // SCSI Block device
- iSbcInterface = new (ELeave) TSbcClientInterface(iSpcInterface.Transport());
- iSbcInterface->InitBuffers(&iHeadbuf, &iTailbuf);
-
- return KErrNone;
+ return err;
}
@@ -401,6 +443,11 @@
TInt CScsiProtocol::MsReadCapacityL()
{
__MSFNLOG
+ if (!iSbcInterface)
+ {
+ User::Leave(KErrNotSupported);
+ }
+
// READ CAPACITY
TUint32 blockSize;
TUint32 lastLba;
@@ -421,6 +468,9 @@
TInt CScsiProtocol::MsModeSense10L()
{
__MSFNLOG
+ if (!iSbcInterface)
+ User::Leave(KErrNotSupported);
+
TBool writeProtected;
TInt err = iSbcInterface->ModeSense10L(TSbcClientInterface::EReturnAllModePages, writeProtected);
@@ -442,6 +492,9 @@
TInt CScsiProtocol::MsModeSense6L()
{
__MSFNLOG
+ if (!iSbcInterface)
+ User::Leave(KErrNotSupported);
+
TBool writeProtected;
TInt err = iSbcInterface->ModeSense6L(TSbcClientInterface::EReturnAllModePages, writeProtected);
@@ -463,6 +516,9 @@
TInt CScsiProtocol::MsStartStopUnitL(TBool aStart)
{
__MSFNLOG
+ if (!iSbcInterface)
+ User::Leave(KErrNotSupported);
+
return iSbcInterface->StartStopUnitL(aStart);
}
@@ -481,33 +537,52 @@
}
-void CScsiProtocol::DoCheckConditionL()
+TInt CScsiProtocol::DoCheckConditionL()
{
__MSFNLOG
User::LeaveIfError(MsRequestSenseL());
+ TInt err;
+
// Check if init is needed
if (iSenseInfo.iSenseCode == TSenseInfo::ENotReady &&
iSenseInfo.iAdditional == TSenseInfo::EAscLogicalUnitNotReady &&
iSenseInfo.iQualifier == TSenseInfo::EAscqInitializingCommandRequired)
{
- // start unit
- TInt err = iSbcInterface->StartStopUnitL(ETrue);
-
- if (err)
- {
- User::LeaveIfError(MsRequestSenseL());
- }
-
+ if (iSbcInterface)
+ {
+ // start unit
+ err = iSbcInterface->StartStopUnitL(ETrue);
+ if (err)
+ {
+ User::LeaveIfError(MsRequestSenseL());
+ }
+ }
}
- TInt r = GetSystemWideSenseError(iSenseInfo);
+ err = GetSystemWideSenseError(iSenseInfo);
- if (((r == KErrNotReady) && (iState == EConnected)) ||
- r == KErrDisconnected)
- {
- CompleteNotifyChangeL();
+ TScsiState nextState = iState;
+ if (err == KErrDisconnected)
+ {
+ nextState = EDisconnected;
+ }
+ else if (err == KErrNotReady)
+ {
+ nextState = EMediaNotPresent;
}
+ else
+ {
+ // no state change;
+ }
+
+ if (nextState != iState)
+ {
+ iMediaChangeNotifier.DoNotifyL();
+ iState = nextState;
+ }
+
+ return err;
}
@@ -730,7 +805,7 @@
__MSFNLOG
TInt err = KErrNone;
- if(iFsm->IsRemovableMedia() || iState == EDisconnected)
+ if(iRemovableMedia || iState != EConnected)
{
iFsm->SetStatusCheck();
TRAP(err, iFsm->ConnectLogicalUnitL());
@@ -760,18 +835,6 @@
}
}
-void CScsiProtocol::CompleteNotifyChangeL()
- {
- __MSFNLOG
- if (!iFsm->IsStatusCheck())
- {
- if (iState == EConnected)
- {
- iState = EDisconnected;
- iMediaChangeNotifier.DoNotifyL();
- }
- }
- }
RMediaChangeNotifier::RMediaChangeNotifier()
: iRegistered(EFalse)
--- a/userlibandfileserver/fileserver/shostmassstorage/server/protocol/tscsiprimarycmds.cpp Fri Apr 23 22:20:31 2010 +0100
+++ b/userlibandfileserver/fileserver/shostmassstorage/server/protocol/tscsiprimarycmds.cpp Fri Apr 23 22:26:35 2010 +0100
@@ -1,4 +1,4 @@
-// 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 the License "Eclipse Public License v1.0"
@@ -84,7 +84,6 @@
void TScsiClientInquiryResp::DecodeInquiry(const TDesC8& aPtr)
{
__MSFNSLOG
- __SCSIPRINT(_L("--> SCSI INQUIRY"));
iPeripheralInfo.iRemovable = (aPtr[1] & 0x80) ? ETrue : EFalse;
iPeripheralInfo.iPeripheralQualifier = aPtr[0] >> 5;
--- a/userlibandfileserver/fileserver/shostmassstorage/shared/shared.h Fri Apr 23 22:20:31 2010 +0100
+++ b/userlibandfileserver/fileserver/shostmassstorage/shared/shared.h Fri Apr 23 22:26:35 2010 +0100
@@ -1,4 +1,4 @@
-// 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 the License "Eclipse Public License v1.0"
@@ -77,6 +77,8 @@
TUint32 iBlockLength;
/** Media write protect */
TBool iWriteProtect;
+ /** Block device or CD-ROM */
+ TMediaType iMediaType;
};