Changeset 3891 in vbox for trunk/src/VBox/Main
- Timestamp:
- Jul 26, 2007 6:28:51 PM (18 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImpl.cpp
r3875 r3891 3283 3283 } 3284 3284 3285 #if 1 3285 3286 /* Don't proceed unless we've found the usb controller. */ 3286 3287 PPDMIBASE pBase = NULL; … … 3297 3298 3298 3299 HRESULT rc = attachUSBDevice (aDevice, pRhConfig); 3300 #else /* PDMUsb */ 3301 /* Don't proceed unless there's a USB hub. */ 3302 if (!PDMR3USBHasHub (m_VM)) 3303 { 3304 LogFlowThisFunc (("Attach request ignored (no USB controller).\n")); 3305 return E_FAIL; 3306 } 3307 3308 HRESULT rc = attachUSBDevice (aDevice); 3309 #endif /* PDMUsb */ 3299 3310 3300 3311 if (FAILED (rc)) … … 4283 4294 * @note Must be called from under this object's lock. 4284 4295 */ 4296 #if 1 4285 4297 HRESULT Console::attachUSBDevice (IUSBDevice *aHostDevice, PVUSBIRHCONFIG aConfig) 4286 4298 { 4287 4299 AssertReturn (aHostDevice && aConfig, E_FAIL); 4300 #else /* PDMUsb */ 4301 HRESULT Console::attachUSBDevice (IUSBDevice *aHostDevice) 4302 { 4303 AssertReturn (aHostDevice, E_FAIL); 4304 #endif 4288 4305 4289 4306 AssertReturn (isLockedOnCurrentThread(), E_FAIL); … … 4324 4341 alock.leave(); 4325 4342 4343 #if 1 4326 4344 PVMREQ pReq = NULL; 4327 4345 int vrc = VMR3ReqCall (mpVM, &pReq, RT_INDEFINITE_WAIT, … … 4329 4347 this, aHostDevice, 4330 4348 aConfig, Uuid.ptr(), fRemote, Address.raw(), pvRemote); 4349 #else /* PDMUsb */ 4350 PVMREQ pReq = NULL; 4351 int vrc = VMR3ReqCall (mpVM, &pReq, RT_INDEFINITE_WAIT, 4352 (PFNRT) usbAttachCallback, 5, this, aHostDevice, aConfig, Uuid.ptr(), fRemote, Address.raw()); 4353 #endif /* PDMUsb */ 4331 4354 if (VBOX_SUCCESS (vrc)) 4332 4355 vrc = pReq->iStatus; … … 4372 4395 * @note Locks the console object for writing. 4373 4396 */ 4374 //static 4397 #if 1 4375 4398 DECLCALLBACK(int) 4376 4399 Console::usbAttachCallback (Console *that, IUSBDevice *aHostDevice, … … 4424 4447 return vrc; 4425 4448 } 4449 #else /* PDMUsb */ 4450 //static 4451 DECLCALLBACK(int) 4452 Console::usbAttachCallback (Console *that, IUSBDevice *aHostDevice, PCRTUUID aUuid, bool aRemote, const char *aAddress) 4453 { 4454 LogFlowFuncEnter(); 4455 LogFlowFunc (("that={%p}\n", that)); 4456 4457 AssertReturn (that && aConfig && aUuid, VERR_INVALID_PARAMETER); 4458 4459 if (aRemote) 4460 { 4461 RemoteUSBDevice *pRemoteUSBDevice = static_cast <RemoteUSBDevice *> (aHostDevice); 4462 Guid guid (*aUuid); 4463 4464 aRemoteBackend = that->consoleVRDPServer ()->USBBackendRequestPointer (pRemoteUSBDevice->clientId (), &guid); 4465 if (!aRemoteBackend) 4466 return VERR_INVALID_PARAMETER; /* The clientId is invalid then. */ 4467 } 4468 4469 int vrc = PDMR3USBCreateProxyDevice (mVM, aUuid, aRemote, aAddress, aRemoteBackend); 4470 if (VBOX_SUCCESS (vrc)) 4471 { 4472 /* Create a OUSBDevice and add it to the device list */ 4473 ComObjPtr <OUSBDevice> device; 4474 device.createObject(); 4475 HRESULT hrc = device->init (aHostDevice); 4476 AssertComRC (hrc); 4477 4478 AutoLock alock (that); 4479 that->mUSBDevices.push_back (device); 4480 LogFlowFunc (("Attached device {%Vuuid}\n", device->id().raw())); 4481 4482 /* notify callbacks */ 4483 that->onUSBDeviceStateChange (device, true /* aAttached */, NULL); 4484 } 4485 4486 LogFlowFunc (("vrc=%Vrc\n", vrc)); 4487 LogFlowFuncLeave(); 4488 return vrc; 4489 } 4490 #endif /* PDMUsb */ 4426 4491 4427 4492 /** -
trunk/src/VBox/Main/include/ConsoleImpl.h
r3720 r3891 383 383 const char *pszPath, bool fPassthrough); 384 384 385 #if 1 385 386 HRESULT attachUSBDevice (IUSBDevice *aHostDevice, PVUSBIRHCONFIG aConfig); 386 387 HRESULT detachUSBDevice (USBDeviceList::iterator &aIt); … … 390 391 PVUSBIRHCONFIG aConfig, PCRTUUID aUuid, bool aRemote, 391 392 const char *aAddress, void *aRemoteBackend); 393 #else /* PDMUsb coding. */ 394 HRESULT attachUSBDevice (IUSBDevice *aHostDevice); 395 HRESULT detachUSBDevice (USBDeviceList::iterator &aIt); 396 397 static DECLCALLBACK(int) 398 usbAttachCallback (Console *that, IUSBDevice *aHostDevice, PCRTUUID aUuid, 399 bool aRemote, const char *aAddress, void *aRemoteBackend); 400 #endif /* PDMUsb coding. */ 392 401 static DECLCALLBACK(int) 393 402 usbDetachCallback (Console *that, USBDeviceList::iterator *aIt, … … 535 544 } 536 545 mCallbackData; 537 546 538 547 friend struct VMTask; 539 548 };
Note:
See TracChangeset
for help on using the changeset viewer.