/**
Concludes an USB MTP device class specific request request processing sequence.
*/
void CMTPUsbEpControl::SendControlRequestStatus()
    {
    OstTraceFunctionEntry0( CMTPUSBEPCONTROL_SENDCONTROLREQUESTSTATUS_ENTRY );
    OstTrace1( TRACE_NORMAL, CMTPUSBEPCONTROL_SENDCONTROLREQUESTSTATUS, 
            "CMTPUsbEpControl state on entry = %d", iState );
    __ASSERT_DEBUG(((iState == EControlRequestStatusSend) || (iState == EControlRequestSetupComplete)), Panic(EMTPUsbBadState));
    TInt ret = Connection().Ldd().SendEp0StatusPacket();
    OstTrace1( TRACE_NORMAL, DUP1_CMTPUSBEPCONTROL_SENDCONTROLREQUESTSTATUS, 
            "SendEp0StatusPacket result = %d.", ret );
    SetState(EIdle);
    OstTrace1( TRACE_NORMAL, DUP2_CMTPUSBEPCONTROL_SENDCONTROLREQUESTSTATUS, 
            "CMTPUsbEpControl state on exit = %d", iState );
    OstTraceFunctionExit0( CMTPUSBEPCONTROL_SENDCONTROLREQUESTSTATUS_EXIT );
    }
void CCdcDataInterface::ReadOneOrMoreCompleted(TInt aError)
/**
 * The completion function, called when a ReadOneOrMore request is completed 
 * by the LDD.
 *
 * @param aError The result of the read request.
 */
	{
	OstTraceFunctionEntry0( CCDCDATAINTERFACE_READONEORMORECOMPLETED_ENTRY );
	OstTrace1( TRACE_NORMAL, CCDCDATAINTERFACE_READONEORMORECOMPLETED, "CCdcDataInterface::ReadOneOrMoreCompleted;aError=%d", aError );

#ifdef __HEADLESS_ACM_TEST_CODE__
	OstTrace1( TRACE_NORMAL, CCDCDATAINTERFACE_READONEORMORECOMPLETED_DUP1, 
			"CCdcDataInterface::ReadOneOrMoreCompleted;__HEADLESS_ACM_TEST_CODE__- issuing Write for %d bytes", iHeadlessAcmBuffer.Length() );

	// Write back the data just read.
	// If the ReadOneOrMore completed with an error, we panic, as it's 
	// invalidating the test.
	if (aError != KErrNone)
		{
		OstTrace1( TRACE_FATAL, CCDCDATAINTERFACE_READONEORMORECOMPLETED_DUP2, 
								"CCdcDataInterface::ReadOneOrMoreCompleted;aError=%d", aError );
		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
		}

	if (!iWriter)
		{	
		OstTraceExt1( TRACE_FATAL, CCDCDATAINTERFACE_READONEORMORECOMPLETED_DUP3, 
							"CCdcDataInterface::ReadOneOrMoreCompleted;iWriter=%p", iWriter );
		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
		}
	iWriter->Write(iHeadlessAcmBuffer, iHeadlessAcmBuffer.Length(), EFalse); 
#else
	if (!iReadOneOrMoreObserver)
		{
		OstTraceExt1( TRACE_FATAL, CCDCDATAINTERFACE_READONEORMORECOMPLETED_DUP4, 
							"CCdcDataInterface::ReadOneOrMoreCompleted;iReadOneOrMoreObserver=%p", iReadOneOrMoreObserver );
		__ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
		}

	// See comment in WriteCompleted.
	MReadOneOrMoreObserver* temp = iReadOneOrMoreObserver;
	iReadOneOrMoreObserver = NULL;
	OstTrace0( TRACE_NORMAL, CCDCDATAINTERFACE_READONEORMORECOMPLETED_DUP5, 
			"CCdcDataInterface::ReadOneOrMoreCompleted;\tcalling ReadOneOrMoreCompleted on observer" );
	temp->ReadOneOrMoreCompleted(aError);
#endif // __HEADLESS_ACM_TEST_CODE__

	OstTraceFunctionExit0( CCDCDATAINTERFACE_READONEORMORECOMPLETED_EXIT );
	}
void CUT_PBASE_T_USBDI_0485::Ep0TransferCompleteL(TInt aCompletionCode)
	{
	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0485_EP0TRANSFERCOMPLETEL_ENTRY, this );
	
	OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0485_EP0TRANSFERCOMPLETEL, "Ep0TransferCompleteL with aCompletionCode = %d",aCompletionCode);
		
	switch(iCaseStep)
		{
		case EInProgress:
			{
			if(aCompletionCode != KErrCancel)
				{
				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0485_EP0TRANSFERCOMPLETEL_DUP01, "<Error %d> Nakking request was not cancelled by stack",aCompletionCode);
				return TestFailed(aCompletionCode);
				}
		
			// No panic or leave so passed
			
			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0485_EP0TRANSFERCOMPLETEL_DUP02, "No leave or panic occured so open interface again and send test passed");
			
			// Open the interface
			
			TInt err(iUsbInterface0.Open(iToken0));
			if(err != KErrNone)
				{
				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0485_EP0TRANSFERCOMPLETEL_DUP03, "<Error %d> Unable to open interface 0", err);
				return TestFailed(err);
				}
			
			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0485_EP0TRANSFERCOMPLETEL_DUP04, "Interface 0 re-opened");
			
			iCaseStep = EPassed;
			TTestCasePassed request;
			iControlEp0->SendRequest(request,this);			
			}
			break;
			
		case EPassed:
			TestPassed();
			break;
			
		case EFailed:
		default:
			TestFailed(KErrCompletion);
			break;
		}
	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0485_EP0TRANSFERCOMPLETEL_EXIT, this );
	}
// ---------------------------------------------------------
// CDpMif::SendMessage
// Send ISI message, given receiver device, receiver object,
// resource, transaction id, message id and message.
// (other items were commented in a header).
// ---------------------------------------------------------
//
TInt CDpMif::SendMessage(
    TUint8 aRecDevice,
    TUint8 aRecObject,
    TUint8 aResource,
    TUint8 aTransactionId,
    TUint8 aMessageId,
    const TDesC8& aMessage )
    {
    OstTrace0( TRACE_NORMAL, DUP1_CDPMIF_SENDMESSAGE, "CDpMif::SendMessage" );
    OstTrace1( TRACE_NORMAL, DUP15_CDPMIF_SENDMESSAGE, "CDpMif:: Port: %u", iDataPort.PortUnit() );
    OstTraceExt1( TRACE_NORMAL, DUP14_CDPMIF_SENDMESSAGE, "CDpMif:: ==> receiver dev.: 0x%hhx", aRecDevice );
    OstTraceExt1( TRACE_NORMAL, DUP13_CDPMIF_SENDMESSAGE, "CDpMif:: ==> receiver obj.: 0x%hhx", aRecObject );
    OstTraceExt1( TRACE_NORMAL, DUP12_CDPMIF_SENDMESSAGE, "CDpMif:: ==> resource: 0x%hhx", aResource );
    OstTraceExt1( TRACE_NORMAL, DUP11_CDPMIF_SENDMESSAGE, "CDpMif:: ==> tra id: 0x%hhx", aTransactionId );
    OstTraceExt1( TRACE_NORMAL, DUP10_CDPMIF_SENDMESSAGE, "CDpMif:: ==> msg id: 0x%hhx", aMessageId );

    LOGM1(" CDpMif::SendMessage - Port %d", iDataPort.PortUnit() );
    LOGM1("  ==> receiver dev.: 0x%x", aRecDevice );
    LOGM1("  ==> receiver obj.: 0x%x", aRecObject );
    LOGM1("  ==> resource: 0x%x", aResource );
    LOGM1("  ==> tra id: 0x%x", aTransactionId );
    LOGM1("  ==> msg id: 0x%x", aMessageId );

    // We shall use send buffer
    iSendMessage.Zero();
    TIsiSend msg( iSendMessage );
    msg.Set8bit( ISI_HEADER_OFFSET_RECEIVERDEVICE, aRecDevice );
    msg.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, aResource );
    msg.Set8bit( ISI_HEADER_OFFSET_RECEIVEROBJECT, aRecObject );
    msg.Set8bit( ISI_HEADER_OFFSET_TRANSID, aTransactionId );
    msg.Set8bit( ISI_HEADER_OFFSET_MESSAGEID, aMessageId );
    // Copy message data (+2 => after msgid and traid)
    msg.CopyData( ISI_HEADER_SIZE + 2, aMessage );

    // Add paddings
    while ( iSendMessage.Length() % 4 )
        {
        iSendMessage.Append( 0x00 );
        }

    OstTrace1( TRACE_NORMAL, DUP8_CDPMIF_SENDMESSAGE, "CDpMif:: ==> message length: %d", iSendMessage.Length() );
    OstPrintIsiMessage( iSendMessage );

    LOGM1("  ==> message length: %d", iSendMessage.Length() );
    LOGMESSAGE( iSendMessage );

    return iDataPort.ISAHandle().Send( msg.Complete() );
    }
// -------------------------------------------------------------------------------------
// CUpnpTmClientProfileService::SetClientProfileActionL
// @param aAction  Pointer to UPnP action object
// @return Returns upnp error code
// ---------------------------------------------------------------------------------
//
TUpnpErrorCode CUpnpTmClientProfileService::SetClientProfileActionL( CUpnpAction* aAction )
{
    OstTraceFunctionEntry0( CUPNPTMCLIENTPROFILESERVICE_SETCLIENTPROFILEACTIONL_ENTRY );
    TUint profileIdInt;
    // Fetch the value for profile ID argument
    TLex8 lex( aAction->ArgumentValue(KProfileId) );
    lex.Val(profileIdInt);
    OstTrace1( TRACE_ERROR, CUPNPTMCLIENTPROFILESERVICE_SETCLIENTPROFILEACTIONL, "CUpnpTmClientProfileService::SetClientProfileActionL;profileIdInt=%d", profileIdInt );

    // Fetch the value for client profile argument
    const TDesC8& clientProfile = aAction->ArgumentValue(KClientProfile);

    RBuf8 resultProfileBuf;
    TTerminalModeErrorCode ret = iTmServerImpl.SetClientProfile( profileIdInt,clientProfile,resultProfileBuf );
    if ( ret != ETerminalModeSuccess )
    {
        resultProfileBuf.Close();
        OstTrace0( TRACE_ERROR, DUP1_CUPNPTMCLIENTPROFILESERVICE_SETCLIENTPROFILEACTIONL, "CUpnpTmClientProfileService::SetClientProfileActionL" );
        return TUpnpErrorCode( ret );
    }
    CleanupClosePushL(resultProfileBuf);
    aAction->SetArgumentL( KResultProfile , resultProfileBuf );
    CleanupStack::PopAndDestroy(&resultProfileBuf);
    OstTraceFunctionExit0( CUPNPTMCLIENTPROFILESERVICE_SETCLIENTPROFILEACTIONL_EXIT );
    return EHttpOk;
}
/**
Check if we can copy the file to the new location
*/
TMTPResponseCode CMTPImageDpCopyObject::CanCopyObjectL(const TDesC& aOldName, const TDesC& aNewName) const
    {
    OstTraceFunctionEntry0( CMTPIMAGEDPCOPYOBJECT_CANCOPYOBJECTL_ENTRY );
    TMTPResponseCode result = EMTPRespCodeOK;
    
    TEntry fileEntry;
    LEAVEIFERROR(iFramework.Fs().Entry(aOldName, fileEntry),
            OstTraceExt2( TRACE_ERROR, DUP1_CMTPIMAGEDPCOPYOBJECT_CANCOPYOBJECTL, 
                    "Gets the entry details for %S failed! error code %d", aOldName, munged_err ));
    TDriveNumber drive(static_cast<TDriveNumber>(iFramework.StorageMgr().DriveNumber(iStorageId)));
    LEAVEIFERROR(drive,
            OstTraceExt2( TRACE_ERROR, DUP2_CMTPIMAGEDPCOPYOBJECT_CANCOPYOBJECTL, 
                    "Gets drive for storage %d failed! error code %d", iStorageId, munged_err ));
    TVolumeInfo volumeInfo;
    LEAVEIFERROR(iFramework.Fs().Volume(volumeInfo, drive),
            OstTraceExt2( TRACE_ERROR, DUP3_CMTPIMAGEDPCOPYOBJECT_CANCOPYOBJECTL, 
                    "Gets volume information for driver %d failed! error code %d", drive, munged_err ));            
    
    if(volumeInfo.iFree < fileEntry.FileSize())
        {
        result = EMTPRespCodeStoreFull;
        }
    else if (BaflUtils::FileExists(iFramework.Fs(), aNewName))			
        {
        result = EMTPRespCodeInvalidParentObject;
        }
	OstTrace1( TRACE_NORMAL, CMTPIMAGEDPCOPYOBJECT_CANCOPYOBJECTL, 
	        "CanCopyObjectL - Exit with response code 0x%04X", result );
    OstTraceFunctionExit0( CMTPIMAGEDPCOPYOBJECT_CANCOPYOBJECTL_EXIT );
    return result;	
    }
    void CUT_PBASE_T_USBDI_1231::ExecuteHostTestCaseL()
        {
        OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1231_EXECUTEHOSTTESTCASEL_ENTRY, this );

        OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP01, "====> ExecuteHostTestCaseL entry priority = %d",
                RThread().Priority());

        // Bump thread priority for this test only

        RThread().SetPriority(EPriorityAbsoluteHigh);
        OstTraceExt2(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP02, "Thread priority raised %d->%d", iPriority, RThread().Priority());

        iCaseStep = EInProcess;
        iActorFDF = CActorFDF::NewL(*this);
        iControlEp0 = new (ELeave) CEp0Transfer(iUsbInterface0);
        iInterface0Watcher = new (ELeave) CInterfaceWatcher(iUsbInterface0,TCallBack(CUT_PBASE_T_USBDI_1231::Interface0ResumedL,this));
        iInterface1Watcher = new (ELeave) CInterfaceWatcher(iUsbInterface1,TCallBack(CUT_PBASE_T_USBDI_1231::Interface1ResumedL,this));

        // Monitor for device connections
        iActorFDF->Monitor();

        // Start the connection timeout    
        TimeoutIn(30);
        OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_EXECUTEHOSTTESTCASEL_EXIT, this );
        }
Example #8
0
void CDeviceProxy::ReadStringDescriptorsL()
	{
    OstTraceFunctionEntry0( CDEVICEPROXY_READSTRINGDESCRIPTORSL_ENTRY );
    
	// wait 10 ms before reading any string descriptors
	// to avoid IOP issues with some USB devices (e.g. PNY Attache)
	User::After(10000);

	// First read string descriptor 0 (supported languages).
	// For each supported language, read the manufacturer, product and serial
	// number string descriptors (as supported). (These are not cached in
	// USBD.)
	// To look up these string descriptors we need to get the device
	// descriptor. The device descriptor *is* cached in USBD, so we don't
	// remember our own copy, even though it is queried later by the CFdf.

	// '0' is the index of the string descriptor which holds the supported
	// language IDs.
	TBuf8<256> stringBuf;
	TUsbStringDescriptor* stringDesc = NULL;
	
	if(!(iHandle.Handle()))
	    {
        OstTrace0( TRACE_FATAL, CDEVICEPROXY_READSTRINGDESCRIPTORSL_DUP1, "Empty handler" );
        __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory, __LINE__));
	    }

	TInt err=iHandle.GetStringDescriptor(stringDesc, stringBuf, 0);
	LEAVEIFERRORL(err, OstTrace1( TRACE_ERROR, CDEVICEPROXY_READSTRINGDESCRIPTORSL_DUP6, 
	"iHandle.GetStringDescriptor error %d", err ););
void CUT_PBASE_T_USBDI_0479::Ep0TransferCompleteL(TInt aCompletionCode)
	{
	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0479_EP0TRANSFERCOMPLETEL_ENTRY, this );
	
	OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0479_EP0TRANSFERCOMPLETEL, "Ep0TransferCompleteL with aCompletionCode = %d",aCompletionCode);
	
	if(aCompletionCode != KErrNone)
		{	
		TBuf<256> msg;
		msg.Format(_L("<Error %d> Transfer to control endpoint 0 was not successful"),aCompletionCode);
		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0479_EP0TRANSFERCOMPLETEL_DUP01, msg);
		}

	if(iCaseStep == EPassed)
		{	
		if(aCompletionCode == KErrNone)
			{
			return TestPassed();
			}
		// else error
	    iCaseStep = EFailed;
		}
	
	if(iCaseStep == EFailed)
		{
		return TestFailed(KErrCompletion);
		}
	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0479_EP0TRANSFERCOMPLETEL_EXIT, this );
	}
//
//Start the control channel of NCM
//
TInt CNcmCommunicationInterface::Start()
{
    OstTraceFunctionEntry1( CNCMCOMMUNICATIONINTERFACE_START_ENTRY, this );
    if (iStarted)
    {
        OstTrace0( TRACE_WARNING, CNCMCOMMUNICATIONINTERFACE_START, "CNcmCommunicationInterface, already started!" );
        OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_START_EXIT, this );
        return KErrInUse;
    }

    TInt ret = GetInterfaceNumber();
    if (ret != KErrNone)
    {
        OstTrace1( TRACE_FATAL, CNCMCOMMUNICATIONINTERFACE_START1, "GetInterfaceNumber failed ret=%d", ret);
        OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_START_EXIT_DUP1, this );
        return ret;
    }

    iStarted = ETrue;
    iRWState = EStateInitial;

    iSenderAndReceiver->Start();

    //force a call to RunL
    SetActive();
    TRequestStatus* status=&iStatus;
    User::RequestComplete(status, KErrNone);
    OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_START_EXIT_DUP2, this );
    return KErrNone;
}
Example #11
0
void COtgRoot::otgDeactivateFdfActor()
	{
	if(!iFdfActorActive)
		{
		OstTrace0(TRACE_NORMAL, COTGROOT_OTGDEACTIVATEFDFACTOR, "FdfActor is not running!");
		return;
		}

	//	If iFdfActorActive is set, the FDF Actor should be waiting to
	//	rendezvous with us before it shuts down...
	//	First of all, logon to wait for it to close down properly
	TRequestStatus waitForCloseStat;
	iFdfActorProcess.Logon(waitForCloseStat);
	
	//	Now, trigger the FDF Actor to close down

	RProcess::Rendezvous(KErrNone);
	
	//	...and wait for it to go away.
	User::WaitForRequest(waitForCloseStat);
	test.Printf(_L("T_OTGDI confirms FDF Actor has gone away %d\n"), waitForCloseStat.Int());
	OstTrace1(TRACE_NORMAL, COTGROOT_OTGDEACTIVATEFDFACTOR_DUP01, "T_OTGDI confirms FDF Actor has gone away %d\n", waitForCloseStat.Int());
	
	//	Now close our handle, and record that the process is no more...
	iFdfActorProcess.Close();
	iFdfActorActive = EFalse;
	}
/**
Initiates an USB MTP device class specific request request processing sequence.
@param aData The control request setup data sink buffer.
@leave One of the system wide error codes, if a processing failure occurs.
*/
void CMTPUsbEpControl::ReceiveControlRequestSetupL(MMTPType& aData)
    {
    OstTraceFunctionEntry0( CMTPUSBEPCONTROL_RECEIVECONTROLREQUESTSETUPL_ENTRY );
    OstTrace1( TRACE_NORMAL, CMTPUSBEPCONTROL_RECEIVECONTROLREQUESTSETUPL, 
            "CMTPUsbEpControl state on entry = %d", iState );
    
    __ASSERT_DEBUG((iState == EIdle), Panic(EMTPUsbBadState));
    
    // Pass the bulk data sink buffer to the base class and update state.
    ReceiveDataL(aData);
    SetState(EControlRequestSetupPending);

    OstTrace1( TRACE_NORMAL, DUP1_CMTPUSBEPCONTROL_RECEIVECONTROLREQUESTSETUPL, 
            "CMTPUsbEpControl state on entry = %d", iState );
    OstTraceFunctionExit0( CMTPUSBEPCONTROL_RECEIVECONTROLREQUESTSETUPL_EXIT );
    }
//
//Parse the data out from host to specific NCM control message
//
void CNcmCommunicationInterface::ParseDataOut()
{
    OstTraceFunctionEntry1( CNCMCOMMUNICATIONINTERFACE_PARSEDATAOUT_ENTRY, this );

    __ASSERT_DEBUG(iDataBuffer.Length()>0,
                   User::Panic(KNcmCommInterfacePanic, ENcmCommWrongDataLength));

    TInt ret = KErrNone;
    switch (iRequestType)
    {
    case ESetNtbInputSize:
        ret = iEngine.HandleSetNtbInputSize(iDataBuffer);
        break;
    default:
        ret = KErrNotSupported;
        break;
    }

    if (ret == KErrNone)
    {
        iPort.SendEp0StatusPacket();
    }
    else
    {
        OstTrace1( TRACE_WARNING, CNCMCOMMUNICATIONINTERFACE_PARSEDATAOUT, "handle request iRequestType error %d stall endpoint", ret);
        iPort.EndpointZeroRequestError();
    }
    ReadSetup();
    OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_PARSEDATAOUT_EXIT, this );
}
/**
Sets the endpoint data send/receive state variable.
@param aState The new data stream state.
*/
void CMTPUsbEpControl::SetState(TUint aState)
    {
    OstTraceFunctionEntry0( CMTPUSBEPCONTROL_SETSTATE_ENTRY );
    iState = aState;
    OstTrace1( TRACE_NORMAL, CMTPUSBEPCONTROL_SETSTATE, "State set to %d", iState );
    OstTraceFunctionExit0( CMTPUSBEPCONTROL_SETSTATE_EXIT );
    }
Example #15
0
TInt TFsFormatNext::DoRequestL(CFsRequest* aRequest)
//
// Format the next part of the media.
//
	{

	__PRINT1(_L("TFsFormatNext::DoRequestL() drv:%d"), aRequest->DriveNumber());
	CFormatCB* format=(CFormatCB*)aRequest->ScratchValue();
	TInt r=format->CheckMount();
	if (r!=KErrNone && r!=KErrInUse)
        {
    	__PRINT1(_L("TFsFormatNext::DoRequestL() err:%d"), r);
        return r;
        }

	TPtr8 pStep((TUint8*)&format->CurrentStep(),sizeof(TInt));
	aRequest->ReadL(KMsgPtr0,pStep);

	OstTrace1(TRACE_FILESYSTEM, FSYS_ECFORMATCBDOFORMATSTEPL, "this %x", format);

	TRAP(r,format->DoFormatStepL());

	OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFORMATCBDOFORMATSTEPLRET, "r %d  iCurrentStep %d", r, (TUint) format->CurrentStep());

	if (r==KErrNone)
		aRequest->WriteL(KMsgPtr0,pStep);
	if (r==KErrNone && format->CurrentStep()==0)
		{
		FsNotify::DiskChange(aRequest->DriveNumber());
		}
	return(r);
	}
    CUT_PBASE_T_USBDI_1231::~CUT_PBASE_T_USBDI_1231()
        {
        OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1231_CUT_PBASE_T_USBDI_1231_ENTRY_DUP01, this );

        OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231, "====> Destructor entry priority = %d", RThread().Priority());

        // Reinstate original priority

        RThread().SetPriority(iPriority);

        // Cancel any async operations

        Cancel(); // Cancel host timer

        // Destroy the watchers
        // they still use opened interfaces to cancel the suspend if active
        delete iInterface1Watcher;
        delete iInterface0Watcher;

        // Close the interfaces
        iUsbInterface1.Close();
        iUsbInterface0.Close();

        delete iControlEp0;
        delete iActorFDF;
        if (!IsHost() && iTestDevice)
            {
            iTestDevice->Close();
            }
        delete iTestDevice;
        OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_CUT_PBASE_T_USBDI_1231_EXIT_DUP01, this );
        }
//
//RunL, looply receive data from share chunk LDD until receive all required data
//
void CNcmCommInterfaceSenderAndReceiver::RunL()
    {
    OstTraceFunctionEntry1( CNCMCOMMINTERFACESENDERANDRECEIVER_RUNL_ENTRY, this );
    if(iStatus.Int() != KErrNone)
        {
        if (KErrCancel == iStatus.Int() )
            {
            OstTrace0( TRACE_NORMAL, CNCMCOMMINTERFACESENDERANDRECEIVER_RUNL,"CNcmCommInterfaceSenderAndReceiver, control channel is cancelled" );
            }
        else
            {
            OstTrace1( TRACE_NORMAL, CNCMCOMMINTERFACESENDERANDRECEIVER_RUNL1, "CNcmCommInterfaceSenderAndReceiver::RunL error %d", iStatus.Int());
            }
        User::RequestComplete(iCompleteStatus, iStatus.Int());
        }
    else
        {
        if (iState == EReceiving)
            {
            ReadData();
            }
        else if (iState == ESending)
            {
            User::RequestComplete(iCompleteStatus, KErrNone);
            iState = EIdle;
            OstTrace0( TRACE_NORMAL, CNCMCOMMINTERFACESENDERANDRECEIVER_RUNL2,"Complete write request" );
            }
        }
    OstTraceFunctionExit1( CNCMCOMMINTERFACESENDERANDRECEIVER_RUNL_EXIT, this );
    }
// ---------------------------------------------------------------------------
// CThumbnailMDSQueryTask::DoCancel()
// ---------------------------------------------------------------------------
//
void CThumbnailMDSQueryTask::DoCancel()
    {
    TN_DEBUG2( "CThumbnailMDSQueryTask(0x%08x)::DoCancel()", this );
    OstTrace1( TRACE_NORMAL, CTHUMBNAILMDSQUERYTASK_DOCANCEL, "CThumbnailMDSQueryTask::DoCancel;this=%o", this );
    
    iQuery->Cancel();
    }
Example #19
0
TBool COtgRoot::otgIdPinPresent()
	{
	if(gVerboseOutput)
	    {
	    OstTraceFunctionEntry0(COTGROOT_OTGIDPINPRESENT);
	    }
	TRequestStatus aStatus;
	RUsbOtgDriver::TOtgIdPin aPin;
	oUsbOtgDriver.QueueOtgIdPinNotification(aPin, aStatus);	// the kernel driver populates aPin...
	LOG_VERBOSE2(_L("(sync) ID_PIN=%d\n"), iOTGIdPin);
	if(gVerboseOutput)
	    {
	    OstTrace1(TRACE_VERBOSE, COTGROOT_OTGIDPINPRESENT_DUP01, "(sync) ID_PIN=%d\n", iOTGIdPin);
	    }
	
	oUsbOtgDriver.CancelOtgIdPinNotification();
	// swallow the event
	User::WaitForRequest(aStatus);
	
	if (RUsbOtgDriver::EIdPinAPlug == aPin)			// at this stage, the aPin value is known
		{
		return(ETrue);
		}
	return(EFalse);
	}
// -----------------------------------------------------------------------------
// CSACommonIscServiceChannelListener::NewL
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
CSACommonIscServiceChannelListener* CSACommonIscServiceChannelListener::NewL(
    MSAIscService& aAdaptation, 
    RIscApi& aIscApi)
    {
    OstTraceExt2( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_CHANNEL_LISTENER_AUTOMATED_5,
        "ISCSERVICE - CSACommonIscServiceChannelListener::NewL(0x%x,0x%x)",
        (TUint)&aAdaptation, (TUint)&aIscApi );
    INTERNAL_TRACE( ( _L( "ISCSERVICE - CSACommonIscServiceChannelListener::NewL(0x%x,0x%x)" ),
        &aAdaptation, &aIscApi ) );

    CSACommonIscServiceChannelListener* self = new( ELeave ) CSACommonIscServiceChannelListener( 
        aAdaptation, 
        aIscApi );

    CleanupStack::PushL( self );
    self->ConstructL();
    CleanupStack::Pop( self );

    OstTrace1( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_CHANNEL_LISTENER_AUTOMATED_6,
        "ISCSERVICE - CSACommonIscServiceChannelListener::NewL - return 0x%x", self );
    INTERNAL_TRACE( ( _L( "ISCSERVICE - CSACommonIscServiceChannelListener::NewL - return 0x%x" ),
        self ) );

    return self;
    }
// ---------------------------------------------------------
// CDpMif::Read
// Makes a receive request to ISAHandle
// ---------------------------------------------------------
//
TInt CDpMif::Read()
    {
    OstTrace0( TRACE_NORMAL, CDPMIF_READ, "CDpMif::Read" );
    OstTrace1( TRACE_NORMAL, DUP1_CDPMIF_READ, "CDpMif:: Port: %u", iDataPort.PortUnit() );

    LOGM1("CDpMif::Read - Port %d", iDataPort.PortUnit() );

    TInt ret( KErrNone );

    // length of a message ptr indicates we are already reading
    if ( iReceiveMessage.Length() || IsActive() )
        {
        LOG(" CDpMif::Read, Fail - already reading");
        OstTrace0( TRACE_NORMAL, DUP2_CDPMIF_READ, "CDpMif:: Fail - already reading" );

        ret = KErrGeneral;
        }
    else
        {
        // IscApi receive
        iDataPort.ISAHandle().Receive(
            iStatus, iReceiveMessage, iLen );

        SetActive();
         }

    return ret;
    }
void CSoftwareConnectTimer::RunL()
	{
	OstTraceFunctionEntry1( CSOFTWARECONNECTTIMER_RUNL_ENTRY, this );
	TInt completionCode(iStatus.Int());
	
	if(completionCode != KErrNone)
		{
		OstTrace1(TRACE_NORMAL, CSOFTWARECONNECTTIMER_RUNL, "<Error %d> software connect/disconnect timer error",completionCode);
		iTestDevice.ReportError(completionCode);
		}
	else
		{
		switch(iConnectType)
			{
			case EConnect:
				iTestDevice.SoftwareConnect();
				break;
				
			case EDisconnect:
				iTestDevice.SoftwareDisconnect();
				break;
				
			case EUnknown:
				OstTrace0(TRACE_NORMAL, CSOFTWARECONNECTTIMER_RUNL_DUP01, "<Error> Unknown state for software connect timer");
				break;
			
			default:
				break;
			}			
		}	
	OstTraceFunctionExit1( CSOFTWARECONNECTTIMER_RUNL_EXIT, this );
	}
Example #23
0
// --------------------------------------------------------------------------
// 
// --------------------------------------------------------------------------
//    
void CPtpTimer::RunL()
    {
    OstTraceFunctionEntry0( CPTPTIMER_RUNL_ENTRY );
    if (iStatus.Int() == KErrNone)
        {
        OstTrace0( TRACE_NORMAL, CPTPTIMER_RUNL, "--- timer expired, because of:" );

        if (iSession.ServerP()->Printer()->Status() == CMTPPictBridgePrinter::ENotConnected) // must be DPS discovery, since no other service is supported
            {
            OstTrace0( TRACE_NORMAL, DUP1_CPTPTIMER_RUNL, "--- Dps printer not available" );
            iSession.ServerP()->Printer()->NoDpsDiscovery();
            iSession.IsDpsPrinterCompleted(EPrinterNotAvailable);
            }
        else if (iSession.ServerP()->Printer()->SendObjectPending())
            {
            OstTrace0( TRACE_NORMAL, DUP2_CPTPTIMER_RUNL, "---SendObject timeout" );
            iSession.ServerP()->Printer()->DpsFileSent(KErrTimedOut);
            }
        else 
            {
            OstTrace0( TRACE_NORMAL, DUP3_CPTPTIMER_RUNL, "---something else, do not care" );
            }    
        }
    else if (iStatus.Int() == KErrCancel)
        {
        OstTrace0( TRACE_NORMAL, DUP4_CPTPTIMER_RUNL, "--- RunL Cancelled." );
        }
    else 
        {
        OstTrace1( TRACE_WARNING, DUP5_CPTPTIMER_RUNL, "!!!Error: Err %d returned.", iStatus.Int() );
        }
    OstTraceFunctionExit0( CPTPTIMER_RUNL_EXIT );
    }
Example #24
0
void CMTPDeviceDataProvider::SessionOpenedL(const TMTPNotificationParamsSessionChange& /*aSession*/)
#endif
    {
    OstTraceFunctionEntry0( CMTPDEVICEDATAPROVIDER_SESSIONOPENEDL_ENTRY );
    OstTrace1(TRACE_NORMAL, CMTPDEVICEDATAPROVIDER_SESSIONOPENEDL, "SessionID = %d", aSession.iMTPId);
    OstTraceFunctionExit0( CMTPDEVICEDATAPROVIDER_SESSIONOPENEDL_EXIT);
    }
Example #25
0
void CDeviceProxy::ConstructL(RUsbHubDriver& aHubDriver)
	{
    OstTraceFunctionEntry0( CDEVICEPROXY_CONSTRUCTL_ENTRY );
    
    TInt err=iHandle.Open(aHubDriver, iId);
    if (err<0)
        {
        OstTrace1( TRACE_NORMAL, CDEVICEPROXY_CONSTRUCTL, "handle open with error %d", err );
        User::Leave(err);
        }

	// Pre-allocate objects relating to this device for the event queue.
	iAttachmentEvent = new(ELeave) TDeviceEvent;
	iAttachmentEvent->iInfo.iEventType = EDeviceAttachment;
	iAttachmentEvent->iInfo.iDeviceId = iId;

	iDriverLoadingEvent = new(ELeave) TDeviceEvent;
	iDriverLoadingEvent->iInfo.iEventType = EDriverLoad;
	iDriverLoadingEvent->iInfo.iDeviceId = iId;

	iDetachmentEvent = new(ELeave) TDeviceEvent;
	iDetachmentEvent->iInfo.iEventType = EDeviceDetachment;
	iDetachmentEvent->iInfo.iDeviceId = iId;
	
	ReadStringDescriptorsL();

	LOG;
	OstTraceFunctionExit0( CDEVICEPROXY_CONSTRUCTL_EXIT );
	}
// ---------------------------------------------------------
// CDpDataBuffer::SetLength
// This method sets length of buffer. This is called from
// CDpDataPort::SetReceiveBufferLength() method.
// ---------------------------------------------------------
//
TInt CDpDataBuffer::SetLength(
    const TInt aLen)
    {
    OstTrace0( TRACE_NORMAL, CDPDATABUFFER_SETLENGTH, "CDpDataBuffer::SetLength" );
    LOGM(" CDpDataBuffer::SetLength");

    //Initialization
    TInt max( 0 );
    TInt ret( KErrNone );

    if ( iHead + iWE.iSize > iEnd )
        {
        max = iHead + iWE.iSize;
        }
    else
        {
        max = iEnd;
        }

        OstTraceExt2( TRACE_NORMAL, DUP1_CDPDATABUFFER_SETLENGTH, "CDpDataBuffer:: iHead: %d, iWE.iSize: %d", iHead, iWE.iSize );
        OstTraceExt2( TRACE_NORMAL, DUP2_CDPDATABUFFER_SETLENGTH, "CDpDataBuffer:: iEnd : %d, aLen     : %d", iEnd, aLen );

        LOG2("  iHead: %d, \t iWE.iSize: %d", iHead, iWE.iSize );
        LOG2("  iEnd : %d, \t aLen     : %d", iEnd, aLen );

    if ( ( max >= ( aLen + iMaxReservationSize ) ) ||
            ( aLen < 2*iMaxReservationSize ) )
        {
        // buffer may be filled further than length

        OstTrace0( TRACE_NORMAL, DUP3_CDPDATABUFFER_SETLENGTH, "CDpDataBuffer:: ERROR, Client tried to reserve too big or too small Receive Buffer Size" );
        OstTraceExt2( TRACE_NORMAL, DUP4_CDPDATABUFFER_SETLENGTH, "CDpDataBuffer:: aLen: %d, iMaxReservationSize: %d", aLen, iMaxReservationSize );
        OstTrace1( TRACE_NORMAL, DUP5_CDPDATABUFFER_SETLENGTH, "CDpDataBuffer:: max: %d", max );

        LOG("  ERROR, Client tried to reserve too big or too small Receive Buffer Size");
        LOG2("  aLen: %d, \t iMaxReservationSize: %d", aLen, iMaxReservationSize );
        LOG1("  max: %d", max );

        ret = KErrArgument;
        }
    else
        {
        iBuf->Des().SetLength( max );
        HBufC8* tmp = NULL;

        // ReAllocL returns address of the expanded or contracted HBufC descriptor.
        // ReAllocL() leaves, if there is insufficient memory.
        TRAP(ret, ( tmp = iBuf->ReAllocL( aLen+iMaxReservationSize ) ));

        if ( KErrNone == ret )
            {
            iBuf=tmp;
            iBuf->Des().SetLength( aLen + iMaxReservationSize );
            iBufSize = aLen + iMaxReservationSize;
            iTreshold = aLen;
            }
        }

    return ret;
    }
Example #27
0
/**
Cleans up outstanding request processors when a session is closed.
@param aSession notification parameter block
*/
void CMTPDeviceDataProvider::SessionClosedL(const TMTPNotificationParamsSessionChange& aSession)
    {
    OstTraceFunctionEntry0( CMTPDEVICEDATAPROVIDER_SESSIONCLOSEDL_ENTRY );
    TInt count = iActiveProcessors.Count();
    while(count--)
        {
	MMTPRequestProcessor* processor = iActiveProcessors[count];
	TUint32 sessionId = processor->SessionId();
	if((sessionId == aSession.iMTPId) && (processor->Connection().ConnectionId() == aSession.iConnection.ConnectionId()))
		{
		iActiveProcessors.Remove(count);
		if (count == iActiveProcessor)
    		{
    			iActiveProcessorRemoved = ETrue;
    		}
    	else
    		{        		
    			processor->Release();
    		} 
		}
        } 
    OstTrace1(TRACE_NORMAL, CMTPDEVICEDATAPROVIDER_SESSIONCLOSEDL, 
            "current state is =%d", iCommandState);
    if(iCommandState != EIdle)
        {
        if(iDeviceInfoTimer)
            {
            delete iDeviceInfoTimer;
            iDeviceInfoTimer = NULL;
            }
        iCommandState = EIdle;
        iDevDpSingletons.DeviceDataStore().SetConnectMac(EFalse);
        }
    OstTraceFunctionExit0( CMTPDEVICEDATAPROVIDER_SESSIONCLOSEDL_EXIT );
    }
// ---------------------------------------------------------------------------
// 
// ---------------------------------------------------------------------------
//
void CDpsPtpNotifier::RunL()
    {
    OstTraceFunctionEntry0( CDPSPTPNOTIFIER_RUNL_ENTRY );
    OstTrace1( TRACE_NORMAL, CDPSPTPNOTIFIER_RUNL, "iStatus %d", iStatus.Int());         
    if (KErrNone == iStatus.Int())
        {
        iNotifier->iPersonality = KUsbPersonalityIdMTP;
        TInt ret = iNotifier->ConnectState();
        if (ret != KErrNone)
            {
            OstTrace1( TRACE_WARNING, DUP1_CDPSPTPNOTIFIER_RUNL, "error happened %d", ret );
            }
        }
    iNotifier->PtpNotify(iStatus.Int());        
    OstTraceFunctionExit0( CDPSPTPNOTIFIER_RUNL_EXIT );
    }
Example #29
0
void CMTPDeviceInfoTimer::RunL()
    {
    OstTraceFunctionEntry0( CMTPDEVICEINFOTIMER_RUNL_ENTRY );
    OstTrace1(TRACE_NORMAL, CMTPDEVICEINFOTIMER_RUNL,
            "iStatus == %d", iStatus.Int());

    switch(iState)
        {
        case EStartTimer:
            OstTrace0(TRACE_NORMAL, DUP1_CMTPDEVICEINFOTIMER_RUNL, "CMTPDeviceInfoTimer::RunL - EStartTimer");
            // Open the USB device interface.
            LEAVEIFERROR(iLdd.Open(0),
                    OstTrace0( TRACE_ERROR, DUP4_CMTPDEVICEINFOTIMER_RUNL, "Open the USB device interface error!" ));
            iLdd.ReEnumerate(iStatus);
            iDeviceProvider.SetConnectMac();
            iState = EUSBReEnumerate;
            SetActive();
            break;
        case EUSBReEnumerate:          
            OstTrace0(TRACE_NORMAL, DUP2_CMTPDEVICEINFOTIMER_RUNL, "CMTPDeviceInfoTimer::RunL - EUSBReEnumerate");
            break;
        default:
            OstTrace0(TRACE_NORMAL, DUP3_CMTPDEVICEINFOTIMER_RUNL, "CMTPDeviceInfoTimer::RunL - default");
            break;
        }
    OstTraceFunctionExit0( CMTPDEVICEINFOTIMER_RUNL_EXIT );
    }
// ---------------------------------------------------------------------------------
// CUpnpTmAppServerService::GetAppStatusActionL
// @param aAction Pointer to upnp action object
// @return Returns upnp error code
// ---------------------------------------------------------------------------------
//
TUpnpErrorCode CUpnpTmAppServerService::GetAppStatusActionL( CUpnpAction* aAction )
   {
   OstTraceFunctionEntry0( CUPNPTMAPPSERVERSERVICE_GETAPPSTATUSACTIONL_ENTRY );
   const TDesC8& appId= aAction->ArgumentValue(KAppId);
   // Check if the appID argument has either wildcard character(*)
   // or a valid integer as its value
   TUint appIdInt;
   if ( (( appId.Compare( KWildCard ) != KErrNone ) &&
          ( ConvertDescriptorToInt( appId, appIdInt ) != KErrNone )) )
        {
        OstTrace1( TRACE_ERROR, CUPNPTMAPPSERVERSERVICE_GETAPPSTATUSACTIONL, "CUpnpTmAppServerService::GetAppStatusActionL;appIdInt=%u", appIdInt );
        return EInvalidArgs; // invalid input argument
        }
   RBuf8 appStatusBuf;
   CleanupClosePushL(appStatusBuf);
   TTerminalModeErrorCode ret;
   iTmServerImpl.GetAppStatusL( appId, appStatusBuf, ret);
   
   if ( ret != ETerminalModeSuccess )
       {
       CleanupStack::PopAndDestroy(&appStatusBuf);
       OstTrace0( TRACE_ERROR, DUP1_CUPNPTMAPPSERVERSERVICE_GETAPPSTATUSACTIONL, "CUpnpTmAppServerService::GetAppStatusActionL" );      
       return TUpnpErrorCode( ret );
       }
   aAction->SetArgumentL( KAppStatus, appStatusBuf );
   
   CleanupStack::PopAndDestroy(&appStatusBuf);
   OstTraceFunctionExit0( CUPNPTMAPPSERVERSERVICE_GETAPPSTATUSACTIONL_EXIT );
   return EHttpOk;   
   }