- Timestamp:
- Apr 28, 2008 7:31:29 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/HostImpl.cpp
r8431 r8438 1284 1284 CHECK_READY(); 1285 1285 1286 /* 1287 * Translate the device id into a device object. 1288 */ 1286 1289 Guid id (aId); 1287 1288 1290 ComObjPtr <HostUSBDevice> device; 1289 1291 USBDeviceList::iterator it = mUSBDevices.begin(); … … 1294 1296 ++ it; 1295 1297 } 1296 1297 1298 if (!device) 1298 1299 return setError (E_INVALIDARG, … … 1300 1301 id.raw()); 1301 1302 1302 /** @todo r=bird this doesn't belong here but in the HostUSBDevice bit. */ 1303 /* 1304 * Try to capture the device 1305 */ 1303 1306 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 */); 1337 1308 1338 1309 return S_OK; … … 2142 2113 /** @todo r=bird: this is wrong as requestAttachToVM may return false for different reasons that we. */ 2143 2114 /* try to capture the device */ 2144 return aDevice->requestCaptureForVM (aMachine, maskedIfs); 2115 HRESULT hrc = aDevice->requestCaptureForVM (aMachine, false /* aSetError */, maskedIfs); 2116 return SUCCEEDED (hrc); 2145 2117 } 2146 2118
Note:
See TracChangeset
for help on using the changeset viewer.