VirtualBox

Changeset 54556 in vbox for trunk/src


Ignore:
Timestamp:
Feb 27, 2015 3:42:57 PM (10 years ago)
Author:
vboxsync
Message:

VUSB: Added RH service to abort an endpoint (as opposed to canceling a single URB).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/USB/DrvVUSBRootHub.cpp

    r53163 r54556  
    648648    }
    649649    RTCritSectLeave(&pRh->CritSectDevices);
     650}
     651
     652/**
     653 * Worker doing the actual cancelling of all outstanding per-EP URBs on the
     654 * device I/O thread.
     655 *
     656 * @returns VBox status code.
     657 * @param   pDev    USB device instance data.
     658 * @param   EndPt   Endpoint number.
     659 * @param   enmDir  Endpoint direction.
     660 */
     661static DECLCALLBACK(int) vusbRhAbortEpWorker(PVUSBDEV pDev, int EndPt, VUSBDIRECTION enmDir)
     662{
     663    /*
     664     * Iterate the URBs, find ones corresponding to given EP, and cancel them.
     665     */
     666    PVUSBURB pUrb = pDev->pAsyncUrbHead;
     667    while (pUrb)
     668    {
     669        PVUSBURB pNext = pUrb->VUsb.pNext;
     670
     671        Assert(pUrb->VUsb.pDev == pDev);
     672
     673        if (pUrb->EndPt == EndPt && pUrb->enmDir == enmDir)
     674        {
     675            LogFlow(("%s: vusbRhAbortEpWorker: CANCELING URB\n", pUrb->pszDesc));
     676            int rc = vusbUrbCancelWorker(pUrb, CANCELMODE_UNDO);
     677            AssertRC(rc);
     678        }
     679        pUrb = pNext;
     680    }
     681
     682    return VINF_SUCCESS;
     683}
     684
     685
     686/** @copydoc VUSBIROOTHUBCONNECTOR::pfnAbortEp */
     687static DECLCALLBACK(int) vusbRhAbortEp(PVUSBIROOTHUBCONNECTOR pInterface, PVUSBIDEVICE pDevice, int EndPt, VUSBDIRECTION enmDir)
     688{
     689    PVUSBROOTHUB pRh = VUSBIROOTHUBCONNECTOR_2_VUSBROOTHUB(pInterface);
     690    if (&pRh->Hub != ((PVUSBDEV)pDevice)->pHub)
     691        AssertFailedReturn(VERR_INVALID_PARAMETER);
     692
     693    RTCritSectEnter(&pRh->CritSectDevices);
     694    PVUSBDEV pDev = (PVUSBDEV)pDevice;
     695    vusbDevIoThreadExecSync(pDev, (PFNRT)vusbRhAbortEpWorker, 3, pDev, EndPt, enmDir);
     696    RTCritSectLeave(&pRh->CritSectDevices);
     697
     698    /* The reaper thread will take care of completing the URB. */
     699
     700    return VINF_SUCCESS;
    650701}
    651702
     
    9731024    pThis->IRhConnector.pfnCancelUrbsEp = vusbRhCancelUrbsEp;
    9741025    pThis->IRhConnector.pfnCancelAllUrbs= vusbRhCancelAllUrbs;
     1026    pThis->IRhConnector.pfnAbortEp      = vusbRhAbortEp;
    9751027    pThis->IRhConnector.pfnAttachDevice = vusbRhAttachDevice;
    9761028    pThis->IRhConnector.pfnDetachDevice = vusbRhDetachDevice;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette