VirtualBox

Changeset 47342 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Jul 23, 2013 1:59:12 PM (11 years ago)
Author:
vboxsync
Message:

Main: Cache information about USB controller availability locally in Console object.

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

Legend:

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

    r47190 r47342  
    786786    /** true if we already listed the disk type of the snapshot folder. */
    787787    bool mfSnapshotFolderDiskTypeShown : 1;
     788    /** true if a USB controller is available (i.e. USB devices can be attached). */
     789    bool mfVMHasUsbController : 1;
    788790
    789791    /** Pointer to the VMM -> User (that's us) callbacks. */
  • trunk/src/VBox/Main/src-client/ConsoleImpl.cpp

    r47249 r47342  
    381381    , mfSnapshotFolderExt4WarningShown(false)
    382382    , mfSnapshotFolderDiskTypeShown(false)
     383    , mfVMHasUsbController(false)
    383384    , mpVmm2UserMethods(NULL)
    384385    , m_pVMMDev(NULL)
     
    28482849        return ptrVM.rc();
    28492850
    2850     /* Don't proceed unless we've found the usb controller. */
    2851     PPDMIBASE pBase = NULL;
    2852     int vrc = PDMR3QueryLun(ptrVM.rawUVM(), "usb-ohci", 0, 0, &pBase);
    2853     if (RT_FAILURE(vrc))
     2851    /* Don't proceed unless we have a USB controller. */
     2852    if (!mfVMHasUsbController)
    28542853        return setError(VBOX_E_PDM_ERROR,
    28552854            tr("The virtual machine does not have a USB controller"));
     
    71377136    if (RT_SUCCESS(vrc) || autoCaller.state() == InUninit)
    71387137    {
    7139         /* If the machine has an USB controller, release all USB devices
     7138        /* If the machine has a USB controller, release all USB devices
    71407139         * (symmetric to the code in captureUSBDevices()) */
    7141         bool fHasUSBController = false;
    7142         {
    7143             PPDMIBASE pBase;
    7144             vrc = PDMR3QueryLun(pUVM, "usb-ohci", 0, 0, &pBase);
    7145             if (RT_SUCCESS(vrc))
    7146             {
    7147                 fHasUSBController = true;
    7148                 alock.release();
    7149                 detachAllUSBDevices(false /* aDone */);
    7150                 alock.acquire();
    7151             }
     7140        if (mfVMHasUsbController)
     7141        {
     7142            alock.release();
     7143            detachAllUSBDevices(false /* aDone */);
     7144            alock.acquire();
    71527145        }
    71537146
     
    72007193
    72017194        /* Complete the detaching of the USB devices. */
    7202         if (fHasUSBController)
     7195        if (mfVMHasUsbController)
    72037196        {
    72047197            alock.release();
     
    86528645    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    86538646
    8654     /* If the machine has an USB controller, ask the USB proxy service to
     8647    /* If the machine has a USB controller, ask the USB proxy service to
    86558648     * capture devices */
    8656     PPDMIBASE pBase;
    8657     int vrc = PDMR3QueryLun(pUVM, "usb-ohci", 0, 0, &pBase);
    8658     if (RT_SUCCESS(vrc))
     8649    if (mfVMHasUsbController)
    86598650    {
    86608651        /* release the lock before calling Host in VBoxSVC since Host may call
     
    86668657        ComAssertComRCRetRC(hrc);
    86678658    }
    8668     else if (   vrc == VERR_PDM_DEVICE_NOT_FOUND
    8669              || vrc == VERR_PDM_DEVICE_INSTANCE_NOT_FOUND)
    8670         vrc = VINF_SUCCESS;
    8671     else
    8672         AssertRC(vrc);
    8673 
    8674     return RT_SUCCESS(vrc) ? S_OK : E_FAIL;
     8659
     8660    return S_OK;
    86758661}
    86768662
  • trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp

    r47246 r47342  
    22902290                attachStatusDriver(pInst, &mapUSBLed[0], 0, 0, NULL, NULL, 0);
    22912291
     2292                mfVMHasUsbController = true;
    22922293#ifdef VBOX_WITH_EHCI
    22932294                BOOL fEHCIEnabled;
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