VirtualBox

Changeset 8438 in vbox for trunk/src


Ignore:
Timestamp:
Apr 28, 2008 7:31:29 PM (17 years ago)
Author:
vboxsync
Message:

Moved the requestCaptureForVM code.

File:
1 edited

Legend:

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

    r8431 r8438  
    12841284    CHECK_READY();
    12851285
     1286    /*
     1287     * Translate the device id into a device object.
     1288     */
    12861289    Guid id (aId);
    1287 
    12881290    ComObjPtr <HostUSBDevice> device;
    12891291    USBDeviceList::iterator it = mUSBDevices.begin();
     
    12941296        ++ it;
    12951297    }
    1296 
    12971298    if (!device)
    12981299        return setError (E_INVALIDARG,
     
    13001301            id.raw());
    13011302
    1302 /** @todo r=bird this doesn't belong here but in the HostUSBDevice bit. */
     1303    /*
     1304     * Try to capture the device
     1305     */
    13031306    AutoWriteLock devLock (device);
    1304 
    1305     if (device->isStatePending())
    1306         return setError (E_INVALIDARG,
    1307             tr ("USB device '%s' with UUID {%Vuuid} is busy (waiting for a pending "
    1308                 "state change). Please try later"),
    1309             device->name().raw(), id.raw());
    1310 
    1311     if (device->state() == USBDeviceState_NotSupported)
    1312         return setError (E_INVALIDARG,
    1313             tr ("USB device '%s' with UUID {%Vuuid} cannot be accessed by guest "
    1314                 "computers"),
    1315             device->name().raw(), id.raw());
    1316 
    1317     if (device->state() == USBDeviceState_Unavailable)
    1318         return setError (E_INVALIDARG,
    1319             tr ("USB device '%s' with UUID {%Vuuid} is being exclusively used by the "
    1320                 "host computer"),
    1321             device->name().raw(), id.raw());
    1322 
    1323     if (device->state() == USBDeviceState_Captured)
    1324     {
    1325         /* Machine::name() requires a read lock */
    1326         AutoReadLock machLock (device->machine());
    1327 
    1328         return setError (E_INVALIDARG,
    1329             tr ("USB device '%s' with UUID {%Vuuid} is already captured by the virtual "
    1330                 "machine '%ls'"),
    1331             device->name().raw(), id.raw(),
    1332             device->machine()->name().raw());
    1333     }
    1334 
    1335     /* try to capture the device */
    1336     device->requestCaptureForVM (aMachine);
     1307    device->requestCaptureForVM (aMachine, true /* aSetError */);
    13371308
    13381309    return S_OK;
     
    21422113        /** @todo r=bird: this is wrong as requestAttachToVM may return false for different reasons that we. */
    21432114        /* try to capture the device */
    2144         return aDevice->requestCaptureForVM (aMachine, maskedIfs);
     2115        HRESULT hrc = aDevice->requestCaptureForVM (aMachine, false /* aSetError */, maskedIfs);
     2116        return SUCCEEDED (hrc);
    21452117    }
    21462118
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