VirtualBox

Changeset 8547 in vbox


Ignore:
Timestamp:
May 3, 2008 12:54:40 AM (17 years ago)
Author:
vboxsync
Message:

Removed the non-NEW_HOSTUSBDEVICE_STATE code.

Location:
trunk/src/VBox/Main
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r8544 r8547  
    20112011            Guid (aId).raw());
    20122012
    2013 # if defined(RT_OS_DARWIN) || defined(NEW_HOSTUSBDEVICE_STATE)
    20142013    /*
    20152014     * Inform the USB device and USB proxy about what's cooking.
     
    20202019        return rc2;
    20212020    alock.enter();
    2022 #  ifndef NEW_HOSTUSBDEVICE_STATE
    2023     for (it = mUSBDevices.begin(); it != mUSBDevices.end(); ++ it)
    2024         if ((*it)->id() == aId)
    2025             break;
    2026     if (it == mUSBDevices.end())
    2027         return S_OK;
    2028 #  endif
    2029 # endif
    20302021
    20312022    /* Request the PDM to detach the USB device. */
  • trunk/src/VBox/Main/HostImpl.cpp

    r8484 r8547  
    13491349    AutoWriteLock devLock (device);
    13501350
    1351 #ifdef NEW_HOSTUSBDEVICE_STATE
    13521351    /*
    13531352     * Work the state machine.
     
    13691368    }
    13701369    return hrc;
    1371 
    1372 #else  /* !NEW_HOSTUSBDEVICE_STATE */
    1373 
    1374     LogFlowThisFunc (("id={%Vuuid} state=%d isStatePending=%RTbool pendingState=%d aDone=%RTbool\n",
    1375                       device->id().raw(), device->state(), device->isStatePending(),
    1376                       device->pendingState(), aDone));
    1377     HRESULT rc = S_OK;
    1378     if (!aDone)
    1379     {
    1380         if (device->isStatePending())
    1381             rc = setError (E_INVALIDARG,
    1382                 tr ("USB device '%s' with UUID {%Vuuid} is busy (waiting for a pending "
    1383                     "state change). Please try later"),
    1384                              device->name().raw(), device->id().raw());
    1385         else
    1386             mUSBProxyService->detachingDevice (device);
    1387     }
    1388     else
    1389     {
    1390         if (device->isStatePending())
    1391         {
    1392             /* If an async detach operation is still pending (darwin), postpone
    1393                the setHeld() + the re-applying of filters until it is completed.
    1394                We indicate this by moving to the '*Filters' state variant. */
    1395             if (device->pendingStateEx() == HostUSBDevice::kDetachingPendingAttach)
    1396                 device->setLogicalReconnect (HostUSBDevice::kDetachingPendingAttachFilters);
    1397             else if (device->pendingStateEx() == HostUSBDevice::kDetachingPendingDetach)
    1398                 device->setLogicalReconnect (HostUSBDevice::kDetachingPendingDetachFilters);
    1399             else
    1400             {
    1401                 Assert (device->pendingStateEx() == HostUSBDevice::kNothingPending);
    1402                 rc = setError (E_INVALIDARG,
    1403                     tr ("USB device '%s' with UUID {%Vuuid} is busy (waiting for a pending "
    1404                         "state change). Please try later"),
    1405                                  device->name().raw(), device->id().raw());
    1406             }
    1407         }
    1408         else
    1409         {
    1410             ComAssertRet (device->machine() == aMachine, E_FAIL);
    1411 
    1412             /* re-apply filters on the device before giving it back to the host */
    1413             device->setHeld();
    1414             rc = applyAllUSBFilters (device, aMachine);
    1415             ComAssertComRC (rc);
    1416         }
    1417     }
    1418     return rc;
    1419 #endif /* !NEW_HOSTUSBDEVICE_STATE */
    14201370}
    14211371
     
    14471397        ComObjPtr <HostUSBDevice> device = *it;
    14481398        AutoWriteLock devLock (device);
    1449 #ifdef NEW_HOSTUSBDEVICE_STATE
    14501399        if (   device->unistate() == kHostUSBDeviceState_HeldByProxy
    14511400            || device->unistate() == kHostUSBDeviceState_Unused
    14521401            || device->unistate() == kHostUSBDeviceState_Capturable)
    14531402            applyMachineUSBFilters(aMachine, device);
    1454 #else /* !NEW_HOSTUSBDEVICE_STATE */
    1455 
    1456         /* skip pending devices */
    1457         if (device->isStatePending())
    1458             continue;
    1459 
    1460         if (device->state() == USBDeviceState_Busy ||
    1461             device->state() == USBDeviceState_Available ||
    1462             device->state() == USBDeviceState_Held)
    1463         {
    1464             applyMachineUSBFilters (aMachine, device);
    1465         }
    1466 #endif /* !NEW_HOSTUSBDEVICE_STATE */
    14671403    }
    14681404
     
    14951431        if (device->machine() == aMachine)
    14961432        {
    1497 # ifdef NEW_HOSTUSBDEVICE_STATE
    14981433            /*
    14991434             * Same procedure as in detachUSBDevice().
     
    15081443                ComAssertComRC(hrc2);
    15091444            }
    1510 # else  /* !NEW_HOSTUSBDEVICE_STATE */
    1511             if (!aDone)
    1512             {
    1513                 if (!device->isStatePending())
    1514                     mUSBProxyService->detachingDevice (device);
    1515             }
    1516             else
    1517             {
    1518                 if (!device->isStatePending())
    1519                 {
    1520                     Assert (device->state() == USBDeviceState_Captured);
    1521 
    1522                     /* re-apply filters on the device before giving it back to the
    1523                      * host */
    1524                     device->setHeld();
    1525                     HRESULT rc = applyAllUSBFilters (device, aMachine);
    1526                     AssertComRC (rc);
    1527                 }
    1528                 else if (device->pendingStateEx() == HostUSBDevice::kNothingPending)
    1529                     device->cancelPendingState();
    1530             }
    1531 # endif  /* !NEW_HOSTUSBDEVICE_STATE */
    15321445        }
    15331446        ++ it;
     
    20481961    AssertReturn(isWriteLockOnCurrentThread(), E_FAIL);
    20491962    AssertReturn(aDevice->isWriteLockOnCurrentThread(), E_FAIL);
    2050 #ifdef NEW_HOSTUSBDEVICE_STATE
    20511963    /* Quietly ignore unsupported and unavailable device. */
    20521964    if (    aDevice->unistate() == kHostUSBDeviceState_UsedByHost
     
    20561968        return S_OK;
    20571969    }
    2058 
    2059 #else  /* !NEW_HOSTUSBDEVICE_STATE */
    2060     AssertReturn(aDevice->state() != USBDeviceState_Captured, E_FAIL);
    2061 
    2062     AssertReturn(aDevice->isStatePending() == false, E_FAIL);
    2063 
    2064     /* ignore unsupported devices */
    2065     if (aDevice->state() == USBDeviceState_NotSupported)
    2066         return S_OK;
    2067     /* ignore unavailable devices as well */
    2068     if (aDevice->state() == USBDeviceState_Unavailable)
    2069         return S_OK;
    2070 #endif /* !NEW_HOSTUSBDEVICE_STATE */
    20711970
    20721971    VirtualBox::SessionMachineVector machines;
     
    21572056    AssertReturn(isWriteLockOnCurrentThread(), false);
    21582057    AssertReturn(aDevice->isWriteLockOnCurrentThread(), false);
    2159 #ifdef NEW_HOSTUSBDEVICE_STATE
    21602058    /* Let HostUSBDevice::requestCaptureToVM() validate the state. */
    2161 #else  /* !NEW_HOSTUSBDEVICE_STATE */
    2162     AssertReturn (aDevice->state() != USBDeviceState_NotSupported, false);
    2163     AssertReturn (aDevice->state() != USBDeviceState_Unavailable, false);
    2164     AssertReturn (aDevice->isStatePending() == false, false);
    2165 #endif /* !NEW_HOSTUSBDEVICE_STATE */
    21662059
    21672060    ULONG maskedIfs;
     
    21922085    AssertReturnVoid(isWriteLockOnCurrentThread());
    21932086    AssertReturnVoid(aDevice->isWriteLockOnCurrentThread());
    2194 #ifdef NEW_HOSTUSBDEVICE_STATE
    21952087    LogFlowThisFunc(("aDevice=%p name={%s} state=%s id={%RTuuid}\n",
    21962088                     aDevice, aDevice->name().raw(), aDevice->stateName(), aDevice->id().raw()));
    2197 #else
    2198     LogFlowThisFunc (("aDevice=%p id={%Vuuid} state=%d isStatePending=%RTbool pendingState=%d\n",
    2199                       aDevice, aDevice->id().raw(), aDevice->state(), aDevice->isStatePending(),
    2200                       aDevice->pendingState()));
    2201     Assert (aDevice->isStatePending() == false);
    2202 #endif
    22032089
    22042090    /* add to the collecion */
     
    22252111    AssertReturnVoid(isWriteLockOnCurrentThread());
    22262112    AssertReturnVoid(aDevice->isWriteLockOnCurrentThread());
    2227 #ifdef NEW_HOSTUSBDEVICE_STATE
    22282113    LogFlowThisFunc(("aDevice=%p name={%s} state=%s id={%RTuuid}\n",
    22292114                     aDevice, aDevice->name().raw(), aDevice->stateName(), aDevice->id().raw()));
    2230 #else
    2231     LogFlowThisFunc (("aDevice=%p id={%Vuuid} state=%d isStatePending=%RTbool pendingState=%d\n",
    2232                       aDevice, aDevice->id().raw(), aDevice->state(), aDevice->isStatePending(),
    2233                       aDevice->pendingState()));
    2234 #endif
    22352115
    22362116    /*
     
    22702150 * @param   aIgnoreMachine  The machine to ignore when running filters.
    22712151 */
    2272 #ifdef NEW_HOSTUSBDEVICE_STATE
    22732152void Host::onUSBDeviceStateChanged (HostUSBDevice *aDevice, bool aRunFilters, SessionMachine *aIgnoreMachine)
    2274 #else
    2275 void Host::onUSBDeviceStateChanged (HostUSBDevice *aDevice)
    2276 #endif
    22772153{
    22782154    /*
     
    22832159    AssertReturnVoid(isWriteLockOnCurrentThread());
    22842160    AssertReturnVoid(aDevice->isWriteLockOnCurrentThread());
    2285 #ifdef NEW_HOSTUSBDEVICE_STATE
    22862161    LogFlowThisFunc(("aDevice=%p name={%s} state=%s id={%RTuuid}\n",
    22872162                     aDevice, aDevice->name().raw(), aDevice->stateName(), aDevice->id().raw()));
    2288 #else
    2289     LogFlowThisFunc (("aDevice=%p id={%Vuuid} state=%d isStatePending=%RTbool pendingState=%d\n",
    2290                       aDevice, aDevice->id().raw(), aDevice->state(), aDevice->isStatePending(),
    2291                       aDevice->pendingState()));
    2292 #endif
    2293 
    2294 # ifdef NEW_HOSTUSBDEVICE_STATE
     2163
    22952164    /*
    22962165     * Run filters if requested to do so.
     
    23022171        AssertComRC(rc);
    23032172    }
    2304 # else  /* !NEW_HOSTUSBDEVICE_STATE */
    2305     ComObjPtr <HostUSBDevice> device (aDevice);
    2306     if (device->isStatePending())
    2307     {
    2308         /* it was a state change request */
    2309         if (device->pendingStateEx() == HostUSBDevice::kDetachingPendingAttachFilters)
    2310         {
    2311             /* The device has completed an asynchronous detach operation, subject
    2312                it to the filters and such if the current state permits this.
    2313                (handlePendingStateChange will disassociate itself from the machine.) */
    2314             ComObjPtr <SessionMachine> machine (device->machine());
    2315             device->handlePendingStateChange();
    2316             if (device->state() == USBDeviceState_Captured)
    2317             {
    2318                 Log (("USB: running filters on async detached device\n"));
    2319                 device->setHeld();
    2320                 HRESULT rc = applyAllUSBFilters (device, machine);
    2321                 AssertComRC (rc);
    2322             }
    2323             else
    2324                 Log (("USB: async detached devices reappeared in stated %d instead of %d!\n",
    2325                       device->state(), USBDeviceState_Captured));
    2326         }
    2327         else
    2328             device->handlePendingStateChange();
    2329     }
    2330     else if (   device->state() == USBDeviceState_Available
    2331              || device->state() == USBDeviceState_Busy)
    2332     {
    2333         /* The device has gone from being unavailable (not subject to filters) to being
    2334            available / busy. This transition can be triggered by udevd or manual
    2335            permission changes on Linux. On all systems may be triggered by the host
    2336            ceasing to use the device - like unmounting an MSD in the Finder or invoking
    2337            the "Safely remove XXXX" stuff on Windows (perhaps). */
    2338         HRESULT rc = applyAllUSBFilters (device);
    2339         AssertComRC (rc);
    2340     }
    2341     else
    2342     {
    2343         /* some external state change */
    2344 
    2345         /// @todo re-run all USB filters probably
    2346         AssertFailed();
    2347     }
    2348 # endif /* !NEW_HOSTUSBDEVICE_STATE */
    23492173}
    23502174#endif /* VBOX_WITH_USB */
  • trunk/src/VBox/Main/Makefile.kmk

    r8546 r8547  
    4747 endif
    4848 VBOX_MAIN_DEFS += VBOX_WITH_UNIXY_TAP_NETWORKING
    49 endif
    50 if1of ($(BUILD_TARGET), darwin linux win) # this is only temporary, all targets will use this soon.
    51  VBOX_MAIN_DEFS += NEW_HOSTUSBDEVICE_STATE
    5249endif
    5350ifneq ($(VBOX_VERSION_MAJOR)$(VBOX_VERSION_MINOR)$(VBOX_VERSION_BUILD),160)
  • trunk/src/VBox/Main/include/HostImpl.h

    r8484 r8547  
    121121    void onUSBDeviceAttached (HostUSBDevice *aDevice);
    122122    void onUSBDeviceDetached (HostUSBDevice *aDevice);
    123 #ifdef NEW_HOSTUSBDEVICE_STATE
    124123    void onUSBDeviceStateChanged(HostUSBDevice *aDevice, bool aRunFilters, SessionMachine *aIgnoreMachine);
    125 #else
    126     void onUSBDeviceStateChanged(HostUSBDevice *aDevice);
    127 #endif
    128124
    129125    /* must be called from under this object's lock */
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