Changeset 5520 in vbox for trunk/src/VBox/Main/ConsoleImpl.cpp
- Timestamp:
- Oct 26, 2007 4:29:13 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 25737
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImpl.cpp
r5390 r5520 69 69 #include <VBox/ssm.h> 70 70 #include <VBox/version.h> 71 #ifdef VBOX_WITH_USB 72 # include <VBox/pdmusb.h> 73 #endif 71 74 72 75 #include <VBox/VBoxDev.h> … … 3391 3394 } 3392 3395 3393 #if 13396 #ifndef VBOX_WITH_PDMUSB 3394 3397 /* Don't proceed unless we've found the usb controller. */ 3395 3398 PPDMIBASE pBase = NULL; … … 3407 3410 HRESULT rc = attachUSBDevice (aDevice, pRhConfig); 3408 3411 #else /* PDMUsb */ 3409 /* Don't proceed unless there's a USB hub. */3410 if (!PDMR3USBHasHub (m _VM))3412 /* Don't proceed unless there's at least one USB hub. */ 3413 if (!PDMR3USBHasHub (mpVM)) 3411 3414 { 3412 3415 LogFlowThisFunc (("Attach request ignored (no USB controller).\n")); … … 3923 3926 alock.enter(); 3924 3927 } 3925 3926 3928 3929 3927 3930 #ifdef VBOX_HGCM 3928 3931 /* … … 4690 4693 * @note Must be called from under this object's lock. 4691 4694 */ 4692 #if 14695 #ifndef VBOX_WITH_PDMUSB 4693 4696 HRESULT Console::attachUSBDevice (IUSBDevice *aHostDevice, PVUSBIRHCONFIG aConfig) 4694 4697 { … … 4722 4725 4723 4726 BOOL fRemote = FALSE; 4727 #ifndef VBOX_WITH_PDMUSB 4724 4728 void *pvRemote = NULL; 4729 #endif 4725 4730 4726 4731 hrc = aHostDevice->COMGETTER (Remote) (&fRemote); … … 4737 4742 alock.leave(); 4738 4743 4739 #if 14744 #ifndef VBOX_WITH_PDMUSB 4740 4745 PVMREQ pReq = NULL; 4741 4746 int vrc = VMR3ReqCall (mpVM, &pReq, RT_INDEFINITE_WAIT, … … 4744 4749 aConfig, Uuid.ptr(), fRemote, Address.raw(), pvRemote); 4745 4750 #else /* PDMUsb */ 4751 /**@todo just do everything here */ 4746 4752 PVMREQ pReq = NULL; 4747 4753 int vrc = VMR3ReqCall (mpVM, &pReq, RT_INDEFINITE_WAIT, 4748 (PFNRT) usbAttachCallback, 5, this, aHostDevice, aConfig,Uuid.ptr(), fRemote, Address.raw());4754 (PFNRT) usbAttachCallback, 5, this, aHostDevice, Uuid.ptr(), fRemote, Address.raw()); 4749 4755 #endif /* PDMUsb */ 4750 4756 if (VBOX_SUCCESS (vrc)) … … 4791 4797 * @note Locks the console object for writing. 4792 4798 */ 4793 #if 14799 #ifndef VBOX_WITH_PDMUSB 4794 4800 DECLCALLBACK(int) 4795 4801 Console::usbAttachCallback (Console *that, IUSBDevice *aHostDevice, … … 4851 4857 LogFlowFunc (("that={%p}\n", that)); 4852 4858 4853 AssertReturn (that && aConfig && aUuid, VERR_INVALID_PARAMETER); 4854 4859 AssertReturn (that && aUuid, VERR_INVALID_PARAMETER); 4860 4861 void *pvRemoteBackend = NULL; 4855 4862 if (aRemote) 4856 4863 { … … 4858 4865 Guid guid (*aUuid); 4859 4866 4860 aRemoteBackend = that->consoleVRDPServer ()->USBBackendRequestPointer (pRemoteUSBDevice->clientId (), &guid);4861 if (! aRemoteBackend)4867 pvRemoteBackend = that->consoleVRDPServer ()->USBBackendRequestPointer (pRemoteUSBDevice->clientId (), &guid); 4868 if (!pvRemoteBackend) 4862 4869 return VERR_INVALID_PARAMETER; /* The clientId is invalid then. */ 4863 4870 } 4864 4865 int vrc = PDMR3USBCreateProxyDevice (mVM, aUuid, aRemote, aAddress, aRemoteBackend); 4871 ULONG ulUSBVersion = 0x00010001; /* 1.1 */ 4872 #if 0 4873 HRESULT hrc = aHostDevice->GetUSBVersion(&ulUSBVersion); 4874 AssertComRCReturn(hrc, VERR_GENERAL_FAILURE); 4875 #endif 4876 Assert(ulUSBVersion == 0x00010001 || ulUSBVersion == 0x00020000); 4877 4878 int vrc = PDMR3USBCreateProxyDevice (that->mpVM, aUuid, aRemote, aAddress, pvRemoteBackend, 4879 ulUSBVersion == 0x00010001 ? VUSB_STDVER_11 : VUSB_STDVER_20); 4866 4880 if (VBOX_SUCCESS (vrc)) 4867 4881 { … … 4907 4921 CheckComRCReturnRC (autoVMCaller.rc()); 4908 4922 4923 #ifndef VBOX_WITH_PDMUSB 4909 4924 PPDMIBASE pBase = NULL; 4910 4925 int vrc = PDMR3QueryLun (mpVM, "usb-ohci", 0, 0, &pBase); … … 4916 4931 pfnQueryInterface (pBase, PDMINTERFACE_VUSB_RH_CONFIG); 4917 4932 AssertReturn (pRhConfig, E_FAIL); 4933 #else 4934 /* if the device is attached, then there must at least one USB hub. */ 4935 AssertReturn (PDMR3USBHasHub (mpVM), E_FAIL); 4936 #endif 4918 4937 4919 4938 LogFlowThisFunc (("Detaching USB proxy device {%Vuuid}...\n", … … 4924 4943 4925 4944 PVMREQ pReq; 4945 #ifndef VBOX_WITH_PDMUSB 4926 4946 vrc = VMR3ReqCall (mpVM, &pReq, RT_INDEFINITE_WAIT, 4927 4947 (PFNRT) usbDetachCallback, 5, 4928 4948 this, &aIt, pRhConfig, (*aIt)->id().raw()); 4949 #else 4950 /** @todo just do everything here */ 4951 int vrc = VMR3ReqCall (mpVM, &pReq, RT_INDEFINITE_WAIT, 4952 (PFNRT) usbDetachCallback, 4, 4953 this, &aIt, (*aIt)->id().raw()); 4954 #endif 4929 4955 if (VBOX_SUCCESS (vrc)) 4930 4956 vrc = pReq->iStatus; … … 4945 4971 * @note Locks the console object for writing. 4946 4972 */ 4973 #ifndef VBOX_WITH_PDMUSB 4947 4974 //static 4948 4975 DECLCALLBACK(int) … … 4988 5015 return vrc; 4989 5016 } 5017 #else /* VBOX_WITH_PDMUSB */ 5018 //static 5019 DECLCALLBACK(int) 5020 Console::usbDetachCallback (Console *that, USBDeviceList::iterator *aIt, PCRTUUID aUuid) 5021 { 5022 LogFlowFuncEnter(); 5023 LogFlowFunc (("that={%p}\n", that)); 5024 5025 AssertReturn (that && aUuid, VERR_INVALID_PARAMETER); 5026 5027 /* 5028 * If that was a remote device, release the backend pointer. 5029 * The pointer was requested in usbAttachCallback. 5030 */ 5031 BOOL fRemote = FALSE; 5032 5033 HRESULT hrc2 = (**aIt)->COMGETTER (Remote) (&fRemote); 5034 ComAssertComRC (hrc2); 5035 5036 if (fRemote) 5037 { 5038 Guid guid (*aUuid); 5039 that->consoleVRDPServer ()->USBBackendReleasePointer (&guid); 5040 } 5041 5042 int vrc = PDMR3USBDetachDevice (that->mpVM, aUuid); 5043 5044 if (VBOX_SUCCESS (vrc)) 5045 { 5046 AutoLock alock (that); 5047 5048 /* Remove the device from the collection */ 5049 that->mUSBDevices.erase (*aIt); 5050 LogFlowFunc (("Detached device {%Vuuid}\n", (**aIt)->id().raw())); 5051 5052 /* notify callbacks */ 5053 that->onUSBDeviceStateChange (**aIt, false /* aAttached */, NULL); 5054 } 5055 5056 LogFlowFunc (("vrc=%Vrc\n", vrc)); 5057 LogFlowFuncLeave(); 5058 return vrc; 5059 } 5060 #endif /* VBOX_WITH_PDMUSB */ 4990 5061 4991 5062 /**
Note:
See TracChangeset
for help on using the changeset viewer.