VirtualBox

Changeset 60758 in vbox for trunk/src


Ignore:
Timestamp:
Apr 29, 2016 11:18:03 AM (9 years ago)
Author:
vboxsync
Message:

Main/{USBProxyBackend|HostUSBDeviceImpl}: Don't hardcode certain host OS specific behavior during attach/release now that we can mix several backends with different requirements but make the backends report which behavior they need (should fix USB testing on Windows, OS X and Solaris hosts)

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/USBProxyBackend.h

    r60744 r60758  
    5656    virtual const com::Utf8Str &i_getBackend();
    5757    uint32_t i_getRefCount();
     58
     59    virtual bool i_isDevReEnumerationRequired();
    5860
    5961    /** @name Interface for the USBController and the Host object.
     
    156158    virtual void releaseDeviceCompleted(HostUSBDevice *aDevice, bool aSuccess);
    157159
     160    virtual bool i_isDevReEnumerationRequired();
     161
    158162protected:
    159163    virtual int wait(RTMSINTERVAL aMillies);
     
    294298    virtual void releaseDeviceCompleted(HostUSBDevice *aDevice, bool aSuccess);
    295299
     300    virtual bool i_isDevReEnumerationRequired();
     301
    296302protected:
    297303    virtual int wait(RTMSINTERVAL aMillies);
     
    324330    virtual int captureDevice (HostUSBDevice *aDevice);
    325331    virtual int releaseDevice (HostUSBDevice *aDevice);
     332
     333    virtual bool i_isDevReEnumerationRequired();
    326334
    327335protected:
  • trunk/src/VBox/Main/src-server/HostUSBDeviceImpl.cpp

    r60712 r60758  
    469469     */
    470470    LogFlowThisFunc(("{%s} capturing the device.\n", mName));
    471 #if defined(RT_OS_DARWIN) || defined(RT_OS_WINDOWS) || defined(RT_OS_SOLARIS) /* PORTME */
    472     i_setState(kHostUSBDeviceState_Capturing, kHostUSBDeviceState_UsedByVM, kHostUSBDeviceSubState_AwaitingDetach);
    473 #else
    474     i_setState(kHostUSBDeviceState_Capturing, kHostUSBDeviceState_UsedByVM);
    475 #endif
     471    if (mUSBProxyBackend->i_isDevReEnumerationRequired())
     472        i_setState(kHostUSBDeviceState_Capturing, kHostUSBDeviceState_UsedByVM, kHostUSBDeviceSubState_AwaitingDetach);
     473    else
     474        i_setState(kHostUSBDeviceState_Capturing, kHostUSBDeviceState_UsedByVM);
     475
    476476    mMachine = aMachine;
    477477    mMaskedIfs = aMaskedIfs;
     
    731731     * Try release it.
    732732     */
    733 #if defined(RT_OS_DARWIN) || defined(RT_OS_WINDOWS) /* PORTME */
    734     i_startTransition(kHostUSBDeviceState_ReleasingToHost, kHostUSBDeviceState_Unused, kHostUSBDeviceSubState_AwaitingDetach);
    735 #else
    736     i_startTransition(kHostUSBDeviceState_ReleasingToHost, kHostUSBDeviceState_Unused);
    737 #endif
     733    if (mUSBProxyBackend->i_isDevReEnumerationRequired())
     734        i_startTransition(kHostUSBDeviceState_ReleasingToHost, kHostUSBDeviceState_Unused, kHostUSBDeviceSubState_AwaitingDetach);
     735    else
     736        i_startTransition(kHostUSBDeviceState_ReleasingToHost, kHostUSBDeviceState_Unused);
     737
    738738    alock.release();
    739739    int rc = mUSBProxyBackend->releaseDevice(this);
     
    784784     * Do the job.
    785785     */
    786 #if defined(RT_OS_DARWIN) || defined(RT_OS_WINDOWS) /* PORTME */
    787     i_startTransition(kHostUSBDeviceState_Capturing, kHostUSBDeviceState_HeldByProxy, kHostUSBDeviceSubState_AwaitingDetach);
    788 #else
    789     i_startTransition(kHostUSBDeviceState_Capturing, kHostUSBDeviceState_HeldByProxy);
    790 #endif
     786    if (mUSBProxyBackend->i_isDevReEnumerationRequired())
     787        i_startTransition(kHostUSBDeviceState_Capturing, kHostUSBDeviceState_HeldByProxy, kHostUSBDeviceSubState_AwaitingDetach);
     788    else
     789        i_startTransition(kHostUSBDeviceState_Capturing, kHostUSBDeviceState_HeldByProxy);
     790
    791791    alock.release();
    792792    int rc = mUSBProxyBackend->captureDevice(this);
  • trunk/src/VBox/Main/src-server/USBProxyBackend.cpp

    r60744 r60758  
    234234
    235235bool USBProxyBackend::isFakeUpdateRequired()
     236{
     237    return false;
     238}
     239
     240/**
     241 * Returns whether devices reported by this backend go through a de/re-attach
     242 * and device re-enumeration cycle when they are captured or released.
     243 */
     244bool USBProxyBackend::i_isDevReEnumerationRequired()
    236245{
    237246    return false;
  • trunk/src/VBox/Main/src-server/darwin/USBProxyBackendDarwin.cpp

    r60742 r60758  
    222222
    223223
     224/**
     225 * Returns whether devices reported by this backend go through a de/re-attach
     226 * and device re-enumeration cycle when they are captured or released.
     227 */
     228bool USBProxyBackendDarwin::i_isDevReEnumerationRequired()
     229{
     230    return true;
     231}
     232
     233
    224234int USBProxyBackendDarwin::wait(RTMSINTERVAL aMillies)
    225235{
  • trunk/src/VBox/Main/src-server/solaris/USBProxyBackendSolaris.cpp

    r60742 r60758  
    461461
    462462/**
     463 * Returns whether devices reported by this backend go through a de/re-attach
     464 * and device re-enumeration cycle when they are captured or released.
     465 */
     466bool USBProxyBackendSolaris::i_isDevReEnumerationRequired()
     467{
     468    return true;
     469}
     470
     471
     472/**
    463473 * Wrapper called by walkDeviceNode.
    464474 *
  • trunk/src/VBox/Main/src-server/win/USBProxyBackendWindows.cpp

    r60742 r60758  
    227227
    228228
     229/**
     230 * Returns whether devices reported by this backend go through a de/re-attach
     231 * and device re-enumeration cycle when they are captured or released.
     232 */
     233bool USBProxyBackendWindows::i_isDevReEnumerationRequired()
     234{
     235    return true;
     236}
     237
     238
    229239int USBProxyBackendWindows::wait(unsigned aMillies)
    230240{
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