third_party/virtualbox/src/VBox/Devices/USB/VUSBUrb.cpp
/**
 * Called from vusbUrbCompletionRh when it encounters a
 * message type URB.
 *
 * @param   pUrb    The URB within the control pipe extra state data.
 */
Called from vusbUrbCompletionRh when it encounters a
message type URB.

@param   pUrb    The URB within the control pipe extra state data.
Called from vusbUrbCompletionRh when it encounters a message type URB . @param pUrb The URB within the control pipe extra state data .
static void vusbMsgCompletion(PVUSBURB pUrb)
{
    PVUSBDEV        pDev   = pUrb->pVUsb->pDev;
    PVUSBPIPE       pPipe  = &pDev->aPipes[pUrb->EndPt];
    RTCritSectEnter(&pPipe->CritSectCtrl);
    PVUSBCTRLEXTRA  pExtra = pPipe->pCtrl;
#ifdef LOG_ENABLED
    LogFlow(("%s: vusbMsgCompletion: pDev=%p[%s]\n", pUrb->pszDesc, pDev, pDev->pUsbIns->pszName));
    vusbUrbTrace(pUrb, "vusbMsgCompletion", true);
#endif
    Assert(&pExtra->Urb == pUrb);
    if (pUrb->enmStatus == VUSBSTATUS_OK)
        pExtra->fOk = true;
    else
        pExtra->fOk = false;
    pExtra->cbLeft = pUrb->cbData - sizeof(VUSBSETUP);
    PVUSBURB pCtrlUrb = pUrb->pVUsb->pCtrlUrb;
    pCtrlUrb->enmState = VUSBURBSTATE_REAPED;
    vusbCtrlCompletion(pCtrlUrb);
    Assert(   pUrb->enmState == VUSBURBSTATE_REAPED
           || pUrb->enmState == VUSBURBSTATE_CANCELLED);
    if (pUrb->enmState != VUSBURBSTATE_CANCELLED)
    {
        pUrb->enmState = VUSBURBSTATE_ALLOCATED;
        pUrb->fCompleting = false;
    }
    RTCritSectLeave(&pPipe->CritSectCtrl);
    vusbUrbCompletionRh(pCtrlUrb);
}
static void vusbMsgCompletion ( PVUSBURB pUrb ) { PVUSBDEV pDev = pUrb -> pVUsb -> pDev ; PVUSBPIPE pPipe = & pDev -> aPipes [ pUrb -> EndPt ] ; RTCritSectEnter ( & pPipe -> CritSectCtrl ) ; PVUSBCTRLEXTRA pExtra = pPipe -> pCtrl ; #ifdef LOG_ENABLED LogFlow ( ( " \n " , pUrb -> pszDesc , pDev , pDev -> pUsbIns -> pszName ) ) ; vusbUrbTrace ( pUrb , " " , true ) ; #endif Assert ( & pExtra -> Urb == pUrb ) ; if ( pUrb -> enmStatus == VUSBSTATUS_OK ) pExtra -> fOk = true ; else pExtra -> fOk = false ; pExtra -> cbLeft = pUrb -> cbData - sizeof ( VUSBSETUP ) ; PVUSBURB pCtrlUrb = pUrb -> pVUsb -> pCtrlUrb ; pCtrlUrb -> enmState = VUSBURBSTATE_REAPED ; vusbCtrlCompletion ( pCtrlUrb ) ; Assert ( pUrb -> enmState == VUSBURBSTATE_REAPED || pUrb -> enmState == VUSBURBSTATE_CANCELLED ) ; if ( pUrb -> enmState != VUSBURBSTATE_CANCELLED ) { pUrb -> enmState = VUSBURBSTATE_ALLOCATED ; pUrb -> fCompleting = false ; } RTCritSectLeave ( & pPipe -> CritSectCtrl ) ; vusbUrbCompletionRh ( pCtrlUrb ) ; }
Called from vusbUrbCompletionRh when it encounters a
 message type URB.
Called from vusbUrbCompletionRh when it encounters a message type URB .
/*
     * Complete the original URB.
     */ /*
     * 'Free' the message URB, i.e. put it back to the allocated state.
     */ /* Complete the original control URB on the root hub now. */