VirtualBox

Changeset 52526 in vbox


Ignore:
Timestamp:
Aug 29, 2014 9:51:53 AM (10 years ago)
Author:
vboxsync
Message:

usb arg2

File:
1 edited

Legend:

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

    r52525 r52526  
    217217}
    218218
     219
     220/**
     221 * Worker that resets the pipe data on select config and detach.
     222 *
     223 * This leaves the critical section unmolested
     224 *
     225 * @param   pPipe               The pipe which data should be reset.
     226 */
     227static void vusbDevResetPipeData(PVUSBPIPE pPipe)
     228{
     229    vusbMsgFreeExtraData(pPipe->pCtrl);
     230    pPipe->pCtrl = NULL;
     231
     232    if (pPipe->hReadAhead)
     233    {
     234        vusbReadAheadStop(pPipe->hReadAhead);
     235        pPipe->hReadAhead = NULL;
     236    }
     237
     238    RT_ZERO(pPipe->in);
     239    RT_ZERO(pPipe->out);
     240    pPipe->async = 0;
     241}
     242
     243
    219244bool vusbDevDoSelectConfig(PVUSBDEV pDev, PCVUSBDESCCONFIGEX pCfgDesc)
    220245{
     
    227252    unsigned i;
    228253    for (i = 0; i < VUSB_PIPE_MAX; i++)
    229     {
    230254        if (i != VUSB_PIPE_DEFAULT)
    231         {
    232             vusbMsgFreeExtraData(pDev->aPipes[i].pCtrl);
    233             memset(&pDev->aPipes[i], 0, sizeof(pDev->aPipes[i]));
    234         }
    235     }
     255            vusbDevResetPipeData(&pDev->aPipes[i]);
    236256    memset(pDev->paIfStates, 0, pCfgDesc->Core.bNumInterfaces * sizeof(pDev->paIfStates[0]));
    237257
     
    12251245    pDev->pCurCfgDesc = NULL;
    12261246    for (unsigned i = 0; i < RT_ELEMENTS(pDev->aPipes); i++)
    1227     {
    1228         vusbMsgFreeExtraData(pDev->aPipes[i].pCtrl);
    1229         pDev->aPipes[i].pCtrl = NULL;
    1230 
    1231         if (pDev->aPipes[i].hReadAhead)
    1232         {
    1233             vusbReadAheadStop(pDev->aPipes[i].hReadAhead);
    1234             pDev->aPipes[i].hReadAhead = NULL;
    1235         }
    1236 
    1237         RT_ZERO(pDev->aPipes[i].in);
    1238         RT_ZERO(pDev->aPipes[i].out);
    1239         pDev->aPipes[i].async = 0;
    1240     }
     1247        vusbDevResetPipeData(&pDev->aPipes[i]);
    12411248    return VINF_SUCCESS;
    12421249}
     
    12681275    pDev->pResetTimer = NULL;
    12691276    for (unsigned i = 0; i < RT_ELEMENTS(pDev->aPipes); i++)
     1277    {
     1278        Assert(pDev->aPipes[i].pCtrl == NULL);
    12701279        RTCritSectDelete(&pDev->aPipes[i].CritSectCtrl);
     1280    }
    12711281
    12721282    /*
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