ForwardToIoQueue RRS feed

  • Question

  • Hi ,

    I am trying to integrate VirtualSerial  and OSRFx2 UMDF drivers to do  a loopback in the USB driver,

    and send the data back to VirtualSerial.  Before saving a request to manual queue in Serial driver ,

    I am sending a read request to USB and saving it Manual queue , to retrieve it during Write (and then completing it for a loopback).

    The problem , i am facing is : After forwarding the request to manual queue in USB successfully and return ,

    the control doesn't come to serial . And the USB driver is re-initialized again.

    Tuesday, May 7, 2013 2:05 PM

All replies

  • You need to provide more details. Is the device reinitializing because the PC blue screened? Are you running with a debugger attached and driver verifier enabled?

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Tuesday, May 7, 2013 2:27 PM
  • Here is the USB OnRead function , i am calling from the VirtualSerial driver's OnRead :


      HRESULT hr = S_OK;

        IWDFMemory * pOutputMemory = NULL;

        OutputDebugString(L"USB || ReadWriteQueue.cpp || CMyReadWriteQueue::OnRead\n");

       /*The FormatRequestForRead method formats an I/O request object for a read operation.*/
        hr = m_Device->GetInputPipe()->FormatRequestForRead( pWdfRequest,
                                                                             NULL, //pFile
                                                                             NULL, //Memory offset
                                                                                          NULL  //DeviceOffset

        if (FAILED(hr))
               OutputDebugString(L"Failed to format a read request\n");
                   hr = pWdfRequest->ForwardToIoQueue( m_USBLoopbackQueue );

                  if (hr == S_OK)
                               OutputDebugString(L"After Successfully forwarding the request to the LoopBackQueue\n");// Am able to get this print
                               OutputDebugString(L"Error in forwarding the Read request to the LoopBackQueue\n");
            OutputDebugString(L"USB : Before returning from USB OnRead CMyReadWriteQueue::OnRead\n");// AM able to get this print

             return; // This doesn't returns the control to the Virtual Serial driver


    Wednesday, May 8, 2013 6:55 AM
  • and where are things stuck? callstack? or are there error returned? if so, what specific error?

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Wednesday, May 8, 2013 7:14 AM
  • Hi Doron ,

    What i am doing is this : 

                     Putty  --Read--> VirtualSerial_UMDF  --Read--> OSRFx2_UMDF (forwards the read req to manual queue)

    Then , the USB driver returns back to Virtual serial OnRead .

    The problem is , on return from USB , instead of returning to serial , it is calling DllMain of USB and then DllMain of Serial and stopping.

    TEST : As a test , i retrieved the same request from manual queue and completed it, the it is returning back to serial driver. But that doesn't solves the purpose. Just confirms that the request was forwarded correctly.

    These might be of some help. Thanks for the help 

    00000017 0.01258096 [2616] VS-> queue.cpp-> CMyQueue::OnRead 00000018 0.01311034 [2616] VS-> ringbuffer.cpp-> CRingBuffer::Read 00000019 0.01315301 [268] USB || ReadWriteQueue.cpp || CMyReadWriteQueue::OnRead 00000020 0.02053297 [268] After Successfully forwarding the request to the LoopBackQueue 00000021 0.02067155 [268] Retrieved back the fwded request
    00000022 0.02078760 [268] USB : Before returning from USB OnRead CMyReadWriteQueue::OnRead 00000023 37.51660538 [268] USB || dllsup.cpp  || DllMain
    00000024 37.51679993 [268] USB || dllsup.cpp  || DllMain
    00000025 37.61040497 [2652] VS-> dllsup.cpp-> DllMain
    00000026 37.61056519 [2652] VS-> dllsup.cpp-> DllMain
    00000027 37.70408630 [2616] VS-> dllsup.cpp-> DllMain
    00000028 37.70425415 [2616] VS-> dllsup.cpp-> DllMain
    00000029 69.81859589 [3048] LOG_SYSTEM: [GoogleUpdate:goopdate]: ERROR - Cannot create ETW log writer 00000030 69.94968414 [3292] LOG_SYSTEM: [GoogleUpdate:goopdate]: ERROR - Cannot create ETW log writer 00000031 243.51562500 KTM:  TmRollbackTransaction for tx 84d54030 00000032 243.51562500 KTM:  TmRollbackTransaction for tx 84d54030 00000033 274.15060425 KTM:  TmCommitTransaction for tx 84739030 00000034 274.15063477 KTM:  Notifying RM of 1 for tx 84739030 00000035 274.15063477 KTM:  TmPrepareTransaction for en 847c4e98 00000036 274.15066528 KTM:  Notifying RM of 16 for tx 846607c0 00000037 274.15066528 KTM:  Notifying RM of 2 for tx 84739030 00000038 274.15066528 KTM:  TmPrepareTransaction for en 847c4e98


    Wednesday, May 8, 2013 11:02 AM
  • It would be good to log all of the parameters to dllmain when it is called. For instance, it could be innocuous and you are being notified of thread attach /detach. Umdf won't be calling dllmain in random spots like this while the driver is running

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Wednesday, May 8, 2013 2:10 PM
  • Hi ,

    I am still facing this issue.

    Is there any way to share notifications between two UMDF drivers.

    Wednesday, July 10, 2013 11:21 AM
  • Hi Doron ,

    The following link , states my problem which you already answered.

    But i am not able to get much out of it . 

    Please , make it more clear here.

    Wednesday, July 10, 2013 12:51 PM
  • the queue that you forward the request to will process the request in the same callstack and context. if the queue you forwarded to blocks, your call blocks. you need to make sure that the queue you forward to does not block.

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Wednesday, July 10, 2013 6:28 PM