Changeset 5721 in vbox
- Timestamp:
- Nov 13, 2007 12:15:51 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Config.kmk
r5718 r5721 205 205 # Enable the USB 2.0 controller 206 206 VBOX_WITH_EHCI = 1 207 # Enable the new PDM USB management code (work in progress).208 VBOX_WITH_PDMUSB = 1209 207 # Enable the ISCSI feature. 210 208 VBOX_WITH_ISCSI = 1 -
trunk/src/VBox/Devices/Makefile.kmk
r5719 r5721 102 102 ifdef VBOX_WITH_USB 103 103 VBoxDD_DEFS += VBOX_WITH_USB IN_USB_R3 104 ifdef VBOX_WITH_PDMUSB105 VBoxDD_DEFS += VBOX_WITH_PDMUSB106 endif107 104 ifdef VBOX_WITH_EHCI 108 105 VBoxDD_DEFS += VBOX_WITH_EHCI … … 224 221 ifdef VBOX_WITH_USB 225 222 DevicesR3_DEFS += VBOX_WITH_USB IN_USB_R3 226 ifdef VBOX_WITH_PDMUSB227 DevicesR3_DEFS += VBOX_WITH_PDMUSB228 endif229 223 230 224 DevicesR3_SOURCES += \ … … 561 555 ifdef VBOX_WITH_USB 562 556 Drivers_DEFS += VBOX_WITH_USB IN_USB_R3 563 ifdef VBOX_WITH_PDMUSB564 Drivers_DEFS += VBOX_WITH_PDMUSB565 endif566 557 Drivers_SOURCES += \ 567 558 USB/DrvVUSBRootHub.cpp \ -
trunk/src/VBox/Main/ConsoleImpl.cpp
r5713 r5721 3398 3398 } 3399 3399 3400 #ifndef VBOX_WITH_PDMUSB 3401 /* Don't proceed unless we've found the usb controller. */ 3402 PPDMIBASE pBase = NULL; 3403 int vrc = PDMR3QueryLun (mpVM, "usb-ohci", 0, 0, &pBase); 3404 if (VBOX_FAILURE (vrc)) 3400 /* Don't proceed unless there's at least one USB hub. */ 3401 if (!PDMR3USBHasHub (mpVM)) 3405 3402 { 3406 3403 LogFlowThisFunc (("Attach request ignored (no USB controller).\n")); … … 3408 3405 } 3409 3406 3410 PVUSBIRHCONFIG pRhConfig = (PVUSBIRHCONFIG) pBase->3411 pfnQueryInterface (pBase, PDMINTERFACE_VUSB_RH_CONFIG);3412 ComAssertRet (pRhConfig, E_FAIL);3413 3414 HRESULT rc = attachUSBDevice (aDevice, pRhConfig);3415 #else /* PDMUsb */3416 /* Don't proceed unless there's at least one USB hub. */3417 if (!PDMR3USBHasHub (mpVM))3418 {3419 LogFlowThisFunc (("Attach request ignored (no USB controller).\n"));3420 return E_FAIL;3421 }3422 3423 3407 HRESULT rc = attachUSBDevice (aDevice, aMaskedIfs); 3424 #endif /* PDMUsb */3425 3426 3408 if (FAILED (rc)) 3427 3409 { … … 4706 4688 * @note Must be called from under this object's lock. 4707 4689 */ 4708 #ifndef VBOX_WITH_PDMUSB4709 HRESULT Console::attachUSBDevice (IUSBDevice *aHostDevice, PVUSBIRHCONFIG aConfig)4710 {4711 AssertReturn (aHostDevice && aConfig, E_FAIL);4712 #else /* PDMUsb */4713 4690 HRESULT Console::attachUSBDevice (IUSBDevice *aHostDevice, ULONG aMaskedIfs) 4714 4691 { 4715 4692 AssertReturn (aHostDevice, E_FAIL); 4716 #endif4717 4718 4693 AssertReturn (isLockedOnCurrentThread(), E_FAIL); 4719 4694 … … 4738 4713 4739 4714 BOOL fRemote = FALSE; 4740 #ifndef VBOX_WITH_PDMUSB4741 void *pvRemote = NULL;4742 #endif4743 4744 4715 hrc = aHostDevice->COMGETTER (Remote) (&fRemote); 4745 4716 ComAssertComRCRetRC (hrc); … … 4755 4726 alock.leave(); 4756 4727 4757 #ifndef VBOX_WITH_PDMUSB4758 PVMREQ pReq = NULL;4759 int vrc = VMR3ReqCall (mpVM, &pReq, RT_INDEFINITE_WAIT,4760 (PFNRT) usbAttachCallback, 7,4761 this, aHostDevice,4762 aConfig, Uuid.ptr(), fRemote, Address.raw(), pvRemote);4763 #else /* PDMUsb */4764 4728 /**@todo just do everything here */ 4765 4729 PVMREQ pReq = NULL; 4766 4730 int vrc = VMR3ReqCall (mpVM, &pReq, RT_INDEFINITE_WAIT, 4767 4731 (PFNRT) usbAttachCallback, 6, this, aHostDevice, Uuid.ptr(), fRemote, Address.raw(), aMaskedIfs); 4768 #endif /* PDMUsb */4769 4732 if (VBOX_SUCCESS (vrc)) 4770 4733 vrc = pReq->iStatus; … … 4810 4773 * @note Locks the console object for writing. 4811 4774 */ 4812 #ifndef VBOX_WITH_PDMUSB 4775 //static 4813 4776 DECLCALLBACK(int) 4814 Console::usbAttachCallback (Console *that, IUSBDevice *aHostDevice, 4815 PVUSBIRHCONFIG aConfig, PCRTUUID aUuid, bool aRemote, 4816 const char *aAddress, void *aRemoteBackend) 4777 Console::usbAttachCallback (Console *that, IUSBDevice *aHostDevice, PCRTUUID aUuid, bool aRemote, const char *aAddress, ULONG aMaskedIfs) 4817 4778 { 4818 4779 LogFlowFuncEnter(); 4819 4780 LogFlowFunc (("that={%p}\n", that)); 4820 4781 4821 AssertReturn (that && aConfig && aUuid, VERR_INVALID_PARAMETER); 4822 4782 AssertReturn (that && aUuid, VERR_INVALID_PARAMETER); 4783 4784 void *pvRemoteBackend = NULL; 4823 4785 if (aRemote) 4824 4786 { 4825 /* @todo aRemoteBackend input parameter is not needed. */4826 Assert (aRemoteBackend == NULL);4827 4828 4787 RemoteUSBDevice *pRemoteUSBDevice = static_cast <RemoteUSBDevice *> (aHostDevice); 4829 4830 4788 Guid guid (*aUuid); 4831 4789 4832 aRemoteBackend = that->consoleVRDPServer ()->USBBackendRequestPointer (pRemoteUSBDevice->clientId (), &guid);4833 4834 if (aRemoteBackend == NULL)4835 {4836 /* The clientId is invalid then. */ 4837 return VERR_INVALID_PARAMETER;4838 }4839 }4840 4841 int vrc = aConfig->pfnCreateProxyDevice (aConfig, aUuid, aRemote, aAddress, 4842 aRemoteBackend);4843 4790 pvRemoteBackend = that->consoleVRDPServer ()->USBBackendRequestPointer (pRemoteUSBDevice->clientId (), &guid); 4791 if (!pvRemoteBackend) 4792 return VERR_INVALID_PARAMETER; /* The clientId is invalid then. */ 4793 } 4794 4795 USHORT portVersion = 1; 4796 HRESULT hrc = aHostDevice->COMGETTER(PortVersion)(&portVersion); 4797 AssertComRCReturn(hrc, VERR_GENERAL_FAILURE); 4798 Assert(portVersion == 1 || portVersion == 2); 4799 4800 int vrc = PDMR3USBCreateProxyDevice (that->mpVM, aUuid, aRemote, aAddress, pvRemoteBackend, 4801 portVersion == 1 ? VUSB_STDVER_11 : VUSB_STDVER_20, aMaskedIfs); 4844 4802 if (VBOX_SUCCESS (vrc)) 4845 4803 { … … 4862 4820 return vrc; 4863 4821 } 4864 #else /* PDMUsb */4865 //static4866 DECLCALLBACK(int)4867 Console::usbAttachCallback (Console *that, IUSBDevice *aHostDevice, PCRTUUID aUuid, bool aRemote, const char *aAddress, ULONG aMaskedIfs)4868 {4869 LogFlowFuncEnter();4870 LogFlowFunc (("that={%p}\n", that));4871 4872 AssertReturn (that && aUuid, VERR_INVALID_PARAMETER);4873 4874 void *pvRemoteBackend = NULL;4875 if (aRemote)4876 {4877 RemoteUSBDevice *pRemoteUSBDevice = static_cast <RemoteUSBDevice *> (aHostDevice);4878 Guid guid (*aUuid);4879 4880 pvRemoteBackend = that->consoleVRDPServer ()->USBBackendRequestPointer (pRemoteUSBDevice->clientId (), &guid);4881 if (!pvRemoteBackend)4882 return VERR_INVALID_PARAMETER; /* The clientId is invalid then. */4883 }4884 4885 USHORT portVersion = 1;4886 HRESULT hrc = aHostDevice->COMGETTER(PortVersion)(&portVersion);4887 AssertComRCReturn(hrc, VERR_GENERAL_FAILURE);4888 Assert(portVersion == 1 || portVersion == 2);4889 4890 int vrc = PDMR3USBCreateProxyDevice (that->mpVM, aUuid, aRemote, aAddress, pvRemoteBackend,4891 portVersion == 1 ? VUSB_STDVER_11 : VUSB_STDVER_20, aMaskedIfs);4892 if (VBOX_SUCCESS (vrc))4893 {4894 /* Create a OUSBDevice and add it to the device list */4895 ComObjPtr <OUSBDevice> device;4896 device.createObject();4897 HRESULT hrc = device->init (aHostDevice);4898 AssertComRC (hrc);4899 4900 AutoLock alock (that);4901 that->mUSBDevices.push_back (device);4902 LogFlowFunc (("Attached device {%Vuuid}\n", device->id().raw()));4903 4904 /* notify callbacks */4905 that->onUSBDeviceStateChange (device, true /* aAttached */, NULL);4906 }4907 4908 LogFlowFunc (("vrc=%Vrc\n", vrc));4909 LogFlowFuncLeave();4910 return vrc;4911 }4912 #endif /* PDMUsb */4913 4822 4914 4823 /** … … 4933 4842 CheckComRCReturnRC (autoVMCaller.rc()); 4934 4843 4935 #ifndef VBOX_WITH_PDMUSB4936 PPDMIBASE pBase = NULL;4937 int vrc = PDMR3QueryLun (mpVM, "usb-ohci", 0, 0, &pBase);4938 4939 /* if the device is attached, then there must be a USB controller */4940 AssertRCReturn (vrc, E_FAIL);4941 4942 PVUSBIRHCONFIG pRhConfig = (PVUSBIRHCONFIG) pBase->4943 pfnQueryInterface (pBase, PDMINTERFACE_VUSB_RH_CONFIG);4944 AssertReturn (pRhConfig, E_FAIL);4945 #else4946 4844 /* if the device is attached, then there must at least one USB hub. */ 4947 4845 AssertReturn (PDMR3USBHasHub (mpVM), E_FAIL); 4948 #endif4949 4846 4950 4847 LogFlowThisFunc (("Detaching USB proxy device {%Vuuid}...\n", … … 4955 4852 4956 4853 PVMREQ pReq; 4957 #ifndef VBOX_WITH_PDMUSB4958 vrc = VMR3ReqCall (mpVM, &pReq, RT_INDEFINITE_WAIT,4959 (PFNRT) usbDetachCallback, 5,4960 this, &aIt, pRhConfig, (*aIt)->id().raw());4961 #else4962 4854 /** @todo just do everything here */ 4963 4855 int vrc = VMR3ReqCall (mpVM, &pReq, RT_INDEFINITE_WAIT, 4964 4856 (PFNRT) usbDetachCallback, 4, 4965 4857 this, &aIt, (*aIt)->id().raw()); 4966 #endif4967 4858 if (VBOX_SUCCESS (vrc)) 4968 4859 vrc = pReq->iStatus; … … 4983 4874 * @note Locks the console object for writing. 4984 4875 */ 4985 #ifndef VBOX_WITH_PDMUSB4986 4876 //static 4987 4877 DECLCALLBACK(int) 4988 Console::usbDetachCallback (Console *that, USBDeviceList::iterator *aIt, 4989 PVUSBIRHCONFIG aConfig, PCRTUUID aUuid) 4878 Console::usbDetachCallback (Console *that, USBDeviceList::iterator *aIt, PCRTUUID aUuid) 4990 4879 { 4991 4880 LogFlowFuncEnter(); 4992 4881 LogFlowFunc (("that={%p}\n", that)); 4993 4882 4994 AssertReturn (that && a Config && aUuid, VERR_INVALID_PARAMETER);4883 AssertReturn (that && aUuid, VERR_INVALID_PARAMETER); 4995 4884 4996 4885 /* … … 5009 4898 } 5010 4899 5011 int vrc = aConfig->pfnDestroyProxyDevice (aConfig, aUuid);4900 int vrc = PDMR3USBDetachDevice (that->mpVM, aUuid); 5012 4901 5013 4902 if (VBOX_SUCCESS (vrc)) … … 5027 4916 return vrc; 5028 4917 } 5029 #else /* VBOX_WITH_PDMUSB */5030 //static5031 DECLCALLBACK(int)5032 Console::usbDetachCallback (Console *that, USBDeviceList::iterator *aIt, PCRTUUID aUuid)5033 {5034 LogFlowFuncEnter();5035 LogFlowFunc (("that={%p}\n", that));5036 5037 AssertReturn (that && aUuid, VERR_INVALID_PARAMETER);5038 5039 /*5040 * If that was a remote device, release the backend pointer.5041 * The pointer was requested in usbAttachCallback.5042 */5043 BOOL fRemote = FALSE;5044 5045 HRESULT hrc2 = (**aIt)->COMGETTER (Remote) (&fRemote);5046 ComAssertComRC (hrc2);5047 5048 if (fRemote)5049 {5050 Guid guid (*aUuid);5051 that->consoleVRDPServer ()->USBBackendReleasePointer (&guid);5052 }5053 5054 int vrc = PDMR3USBDetachDevice (that->mpVM, aUuid);5055 5056 if (VBOX_SUCCESS (vrc))5057 {5058 AutoLock alock (that);5059 5060 /* Remove the device from the collection */5061 that->mUSBDevices.erase (*aIt);5062 LogFlowFunc (("Detached device {%Vuuid}\n", (**aIt)->id().raw()));5063 5064 /* notify callbacks */5065 that->onUSBDeviceStateChange (**aIt, false /* aAttached */, NULL);5066 }5067 5068 LogFlowFunc (("vrc=%Vrc\n", vrc));5069 LogFlowFuncLeave();5070 return vrc;5071 }5072 #endif /* VBOX_WITH_PDMUSB */5073 4918 5074 4919 /** -
trunk/src/VBox/Main/Makefile.kmk
r5652 r5721 112 112 ifdef VBOX_WITH_EHCI 113 113 VBoxSVC_DEFS += VBOX_WITH_EHCI 114 endif115 ifdef VBOX_WITH_PDMUSB116 VBoxSVC_DEFS += VBOX_WITH_PDMUSB117 114 endif 118 115 endif … … 295 292 VBoxC_DEFS += VBOX_WITH_EHCI 296 293 endif 297 ifdef VBOX_WITH_PDMUSB298 VBoxC_DEFS += VBOX_WITH_PDMUSB299 endif300 294 endif 301 295 ifdef VBOX_WITH_ALSA -
trunk/src/VBox/Main/include/ConsoleImpl.h
r5713 r5721 404 404 const char *pszPath, bool fPassthrough); 405 405 406 #ifndef VBOX_WITH_PDMUSB407 HRESULT attachUSBDevice (IUSBDevice *aHostDevice, PVUSBIRHCONFIG aConfig);408 HRESULT detachUSBDevice (USBDeviceList::iterator &aIt);409 410 static DECLCALLBACK(int)411 usbAttachCallback (Console *that, IUSBDevice *aHostDevice,412 PVUSBIRHCONFIG aConfig, PCRTUUID aUuid, bool aRemote,413 const char *aAddress, void *aRemoteBackend);414 static DECLCALLBACK(int)415 usbDetachCallback (Console *that, USBDeviceList::iterator *aIt,416 PVUSBIRHCONFIG aConfig, PCRTUUID aUuid);417 #else /* PDMUsb coding. */418 406 HRESULT attachUSBDevice (IUSBDevice *aHostDevice, ULONG aMaskedIfs); 419 407 HRESULT detachUSBDevice (USBDeviceList::iterator &aIt); … … 424 412 static DECLCALLBACK(int) 425 413 usbDetachCallback (Console *that, USBDeviceList::iterator *aIt, PCRTUUID aUuid); 426 #endif /* PDMUsb coding. */427 414 428 415 static DECLCALLBACK (int)
Note:
See TracChangeset
for help on using the changeset viewer.