Exemplo n.º 1
0
void CActiveConsole::ProcessKeyPressL(TChar aChar)
	{
	if (aChar == EKeyEscape)
		{
		PRINT(_L("CActiveConsole: ESC key pressed -> stopping active scheduler...\n"));
		gAbort = ETrue;
		CActiveScheduler::Stop();
		return;
		}
	aChar.UpperCase();
	GetCharacter();
	}
Exemplo n.º 2
0
TBool ScrShotsGenUtils::DriveExists(TChar aDriveChar)
{
    SLOGF(_L("ScrShotsGenUtils::DriveExists <<"));
    RFs fs;
    TDriveList dList;
    TBool drvExists = EFalse;
    if(fs.Connect() == KErrNone){
        fs.DriveList(dList);
        aDriveChar.UpperCase();
        unsigned int intval = aDriveChar.operator unsigned int(); 
        if(dList[intval - 65]){
            SLOGF(_L("Drive found"));
            drvExists = ETrue;
        }
        fs.Close();
    }
    SLOGF(_L("ScrShotsGenUtils::DriveExists >>"));
    return drvExists;
}
Exemplo n.º 3
0
void CMessageKeyProcessor::ProcessKeyPress(TChar aChar)
	{

	TInt error = KErrNone;

    aChar.UpperCase();
	switch(aChar)
		{
		case 'Q':
		case EKeyEscape:
			{
			TInt err = KErrNone;
			for(TInt j=0; j<KMaxDrives; j++)
				{
				err = RestoreMount(j);

				if (err)
					{
					// Mount is busy/locked and can not be restored.
					break;
					}

				}

			if (err == KErrNone)
				{
				CActiveScheduler::Stop();
				return;
				}

			}
			break;

#if defined(_DEBUG)
		case 'T':
			iTraceEnable = !iTraceEnable;
			if (iTraceEnable)	// 0x44008401
				User::SetDebugMask(KHARDWARE|KDLL|KSCRATCH|KPOWER|KMEMTRACE);
			else
				User::SetDebugMask(0);
			break;
#endif

		case 'D':
			if(++selectedDriveIndex >= PropertyHandlers::allDrivesStatus.Length()/2)
				{
				selectedDriveIndex = 0;
				}
			ShowDriveSelection();
			break;

		case 'M':
			if(PropertyHandlers::allDrivesStatus.Length())
				{
				MountMsFs(PropertyHandlers::allDrivesStatus[selectedDriveIndex*2]);
				}
			break;

		case 'U':
			if(PropertyHandlers::allDrivesStatus.Length())
				{
				RestoreMount(PropertyHandlers::allDrivesStatus[selectedDriveIndex*2]);
				}
			break;

		case 'L':
			{
			// lock unprotected drive
			TMediaPassword password;
			MakePassword(password);

			_LIT(KEmpty, "");
			TMediaPassword nul;
			nul.Copy(KEmpty);
			error = fs.LockDrive(PropertyHandlers::allDrivesStatus[selectedDriveIndex*2],
                                 nul, password, ETrue);
			console->SetPos(0,9);
			LogPrint(_L("LockDrive %S (%d)"), (error?&KError:&KOk), error);
			break;
			}

		case 'I':
            {
            // lock password protected drive
            TMediaPassword password;
            MakePassword(password);
            error = fs.LockDrive(PropertyHandlers::allDrivesStatus[selectedDriveIndex*2],
                                 password, password, ETrue);
            console->SetPos(0,9);
            LogPrint(_L("LockDrive %S (%d)"), (error?&KError:&KOk), error);
            break;
            }

        case 'N':
            {
            TMediaPassword password;
            MakePassword(password);
            error = fs.UnlockDrive(PropertyHandlers::allDrivesStatus[selectedDriveIndex*2],
                                   password, ETrue);
            Clear(9);
            LogPrint(_L("UnlockDrive %S (%d)"), (error?&KError:&KOk), error);
            }
			break;

        case 'C':
            {
            TMediaPassword password;
            MakePassword(password);
            error = fs.ClearPassword(PropertyHandlers::allDrivesStatus[selectedDriveIndex*2],
                                     password);
            Clear(9);
            LogPrint(_L("ClearPassword %S (%d)"), (error?&KError:&KOk), error);
            }
			break;
		default:
			break;
		}
	RequestCharacter();
	}
Exemplo n.º 4
0
void ParseCommandArguments(TTestSwitches& aSwitches)
	{
	TBuf<256> cmd;
	User::CommandLine(cmd);
	RDebug::Print(_L("Command Line : %S"), &cmd);
	TChar testDrive = 'C';
		
	InitLogData();
	ClearSwitches(aSwitches);

	TFileName currentFile=RProcess().FileName();
	TLex lex(cmd);
	TPtrC token=lex.NextToken();
	if (token.MatchF(currentFile)==0)
		{
		token.Set(lex.NextToken());
		}
	if (token.Length()==0)
		{
		testDrive = 'C'; // default drives
		gAutoTest = ETrue;
		}
	else if((token[0] >='A' && token[0]<='Z') || (token[0] >='a' && token[0]<='z'))
		{
		testDrive = token[0];
		gAutoTest = ETrue;
		}
	else
		{
		while (!lex.Eos())
			{
			if (token.Length()==0)
				{
				continue;	// ignore trailing whitespace
				}
			if (token==_L("-x") || token==_L("-X"))
				{
				token.Set(lex.NextToken());
				if((token==_L("s")) || (token==_L("S")))
					{
					aSwitches.iExeOnSymbian = ETrue;
					gLogFailureData.iExeOsName = KSymbian;
					}
				else if((token==_L("w")) || (token==_L("W")))
					{
					aSwitches.iExeOnWindows = ETrue;
					gLogFailureData.iExeOsName = KWindows;
					}
				token.Set(lex.NextToken());
				continue;
				}
			if (token==_L("-d") || token==_L("-D"))
				{
				token.Set(lex.NextToken());
				testDrive = token[0];
				token.Set(lex.NextToken());
				continue;
				}
			if (token==_L("-v") || token==_L("-V"))
				{
				token.Set(lex.NextToken());
				if((token==_L("s")) || (token==_L("S")))
					{
					aSwitches.iVerOnSymbian = ETrue;
					gLogFailureData.iVerOsName = KSymbian;
					}
				else if((token==_L("w")) || (token==_L("W")))
					{
					aSwitches.iVerOnWindows = ETrue;
					gLogFailureData.iVerOsName = KWindows;
					}
				token.Set(lex.NextToken());
				continue;
				}
			RDebug::Print(_L("Unknown option %S"), &token);
			Help();
			return;
			}
		}

	CheckIfIOTesting(aSwitches);

	if(gIOTesting)
		{
		gAutoTest = EFalse;
		}
	else
		{
		gAutoTest = ETrue;
		}

	testDrive.UpperCase();
	if (gAutoTest)
		{
#if defined (__WINS__)
		//execution phase
		aSwitches.iExeOnWindows = ETrue;
		aSwitches.iExeDriveChar = testDrive;
		aSwitches.iExeDriveNum = CurrentDrive(aSwitches.iExeDriveChar);
		gLogFailureData.iExeDrive = aSwitches.iExeDriveChar;
		gLogFailureData.iExeOsName = KWindows;
		//verification phase
		aSwitches.iVerOnWindows = ETrue;
		aSwitches.iVerDriveChar = testDrive;
		aSwitches.iVerDriveNum = CurrentDrive(aSwitches.iVerDriveChar);
		gLogFailureData.iVerDrive = aSwitches.iVerDriveChar;
		gLogFailureData.iVerOsName = KWindows;
#else	
		//execution phase
		aSwitches.iExeOnSymbian = ETrue;
		aSwitches.iExeDriveChar = testDrive;
		aSwitches.iExeDriveNum = CurrentDrive(aSwitches.iExeDriveChar);
		gLogFailureData.iExeDrive = aSwitches.iExeDriveChar;
		gLogFailureData.iExeOsName = KSymbian;
		//verification phase	
		aSwitches.iVerOnSymbian = ETrue;
		aSwitches.iVerDriveChar = testDrive;
		aSwitches.iVerDriveNum = CurrentDrive(aSwitches.iVerDriveChar);
		gLogFailureData.iVerDrive = aSwitches.iVerDriveChar;
		gLogFailureData.iVerOsName = KSymbian;
#endif
		}

	if(aSwitches.iExeOnWindows || aSwitches.iExeOnSymbian)
		{
		aSwitches.iExeDriveChar = testDrive;
		aSwitches.iExeDriveNum = CurrentDrive(aSwitches.iExeDriveChar);
		gLogFailureData.iExeDrive = aSwitches.iExeDriveChar;
		}
	if(aSwitches.iVerOnWindows || aSwitches.iVerOnSymbian)
		{
		aSwitches.iVerDriveChar = testDrive;
		aSwitches.iVerDriveNum = CurrentDrive(aSwitches.iVerDriveChar);
		gLogFailureData.iVerDrive = aSwitches.iVerDriveChar;
		}
	}
Exemplo n.º 5
0
void ParseCommandLine()
{
    TBuf<0x100> cmd;
    User::CommandLine(cmd);
    TLex lex(cmd);

    for (TPtrC token=lex.NextToken(); token.Length() != 0; token.Set(lex.NextToken()))
    {
        if (token.MatchF(RProcess().FileName())==0)
        {
            continue;
        }

        if (token.CompareF(_L("-m"))== 0)
        {
            gMisalignedReadWrites = ETrue;
            continue;
        }
        if (token.CompareF(_L("-r"))== 0)
        {
            gReadCachingOn = EFalse;
            continue;
        }
        if (token.CompareF(_L("+r"))== 0)
        {
            gReadCachingOn = ETrue;
            continue;
        }
        if (token.CompareF(_L("-w"))== 0)
        {
            gWriteCachingOn = EFalse;
            continue;
        }
        if (token.CompareF(_L("+w"))== 0)
        {
            gWriteCachingOn = ETrue;
            continue;
        }

        if (token.CompareF(_L("-f"))== 0)
        {
            gFlushAfterWrite = EFalse;
            continue;
        }
        if (token.CompareF(_L("+f"))== 0)
        {
            gFlushAfterWrite = ETrue;
            continue;
        }
        if (token.CompareF(_L("+s"))== 0)
        {
            gSharedMemory = ETrue;
            continue;
        }
        if (token.CompareF(_L("+x"))== 0)
        {
            gFragSharedMemory = ETrue;
            continue;
        }

        if (token.CompareF(_L("+q"))== 0)
        {
            gFileSequentialModeOn = ETrue;
            continue;
        }
        if (token.CompareF(_L("-q"))== 0)
        {
            gFileSequentialModeOn = EFalse;
            continue;
        }

        test.Printf(_L("CLP=%S\n"),&token);

        if(token.Length()!=0)
        {
            gDriveToTest=token[0];
            gDriveToTest.UpperCase();
        }
        else
            gDriveToTest='C';

#if defined SYMBIAN_TEST_COPY
        token.Set(lex.NextToken());
        if(token.Length()!=0)
        {
            gDriveToTest2=token[0];
            gDriveToTest2.UpperCase();
        }
        else
            gDriveToTest2='C';
        test.Printf(_L("CLP2=%S\n"),&token);
#endif

    }
}
Exemplo n.º 6
0
void CActiveConsole::ProcessKeyPressL(TChar aChar)
	{
	if (aChar == EKeyEscape)
		{
		PRINT(_L("CActiveConsole: ESC key pressed -> stopping active scheduler...\n"));
		CActiveScheduler::Stop();
		return;
		}
	aChar.UpperCase();
	if (iCmdGetValue != 0 && aChar == '\r')
		{
		if (iLastChar == 'K')
			{
			iValue *= iGetHexValue ? 0x400 : 1000;
			}
		if (iLastChar == 'M')
			{
			iValue *= iGetHexValue ? 0x10000 : 1000000;
			}
		PRINT1(_L("CActiveConsole: Value %d\n"),iValue);
		ProcessValue();
		}
	if (iCmdGetValue != 0 )
		{
		if (iGetHexValue)
			{
			if (aChar.IsDigit())
				{
				iValue = iValue * 16 + aChar.GetNumericValue();
			}
			else
				{
				if (aChar.IsHexDigit())
					{
					iValue = iValue * 16 + (TUint)aChar - 'A' + 10;
					}
				else
					{
						if (aChar != 'K' && aChar != 'M')
						{
						PRINT(_L("Illegal hexadecimal character - Enter command\n"));
						iCmdGetValue = 0;
						}
					}
				}
			}
		else
			{
			if (aChar.IsDigit())
				{
				iValue = iValue * 10 + aChar.GetNumericValue();
				}
			else
				{
				if ((aChar == 'X') && (iLastChar == '0') && (iValue == 0))
					iGetHexValue = ETrue;
				else
					{
					if (aChar != 'K' && aChar != 'M')
						{
						test.Printf(_L("Illegal decimal character - Enter command\n"));
						iCmdGetValue = 0;							
						}
					}
				}
			}
		}
	else
		{
		switch (aChar)
			{
			case 'F' :
				TESTNEXT(_L("Flushing Cache"));
				test_KErrNone(DPTest::FlushCache());
				ShowMemoryUse();
				iPrompt = ETrue;
				break;
				
			case 'I' :
				CacheSize(0,0);
				ShowMemoryUse();
				iPrompt = ETrue;
				break;
	
			case 'Q' :
				gQuiet = ETrue;
				iPrompt = ETrue;
				break;

			case 'V' :
				gQuiet = EFalse;
				iPrompt = ETrue;
				break;
				
			case '?' :
				ShowHelp();
				break;

			case '=' :
				iCmdGetValue = iLastChar;
				iGetHexValue = EFalse;
				iValue = 0;
				break;
						
			default :
				if (aChar.IsDigit())
					{
					if (iLastChar == 'R')
						{
						if (aChar.GetNumericValue() < (TInt)gNextChunk)
							{
							ReadChunk (&gChunk[aChar.GetNumericValue()]);			
							}
						else
							{
							for (TUint i = 0; i < gNextChunk; i++)
								ReadChunk (&gChunk[i]);			
							}
						iPrompt = ETrue;
						}				
					if (iLastChar == 'W')
						{
						if (aChar.GetNumericValue() < (TInt)gNextChunk)
							{
							WriteChunk (&gChunk[aChar.GetNumericValue()]);			
							}
						else
							{
							for (TUint i = 0; i < gNextChunk; i++)
								WriteChunk (&gChunk[i]);			
							}
						iPrompt = ETrue;
						}
					if (iLastChar == 'M')
						{
						if (aChar.GetNumericValue() == 0)
							{
							iActions = (TUint16)(iPeriod < KFlushQuietLimit ? EFlushQuiet : EFlush);							
							}
						else
							{
							iActions = (TUint16)(aChar.GetNumericValue() << 4);							
							}
						iPrompt = ETrue;
						}
					}
				break;
			}
		}
	iLastChar = aChar;
	GetCharacter();
	return;
	}