diff --git a/repos/ports/lib/mk/virtualbox-common.inc b/repos/ports/lib/mk/virtualbox-common.inc index d18bd14c8..6c5302fde 100644 --- a/repos/ports/lib/mk/virtualbox-common.inc +++ b/repos/ports/lib/mk/virtualbox-common.inc @@ -30,16 +30,16 @@ VBOX_CC_OPT += -DRT_OS_FREEBSD VBOX_CC_OPT += -DVBOX_WITH_REM VBOX_CC_OPT += -DVBOX_WITH_HGCM -DVBOX_WITH_HGSMI -VBOX_CC_OPT += -DVBOXBFE_WITHOUT_COM VBOX_CC_OPT += -DVBOX_WITHOUT_TESTING_FEATURES -VBOX_CC_OPT += -DUSE_SDL VBOX_CC_OPT += -DVBOX_WITH_VIDEOHWACCEL VBOX_CC_OPT += -DVBOX_WITH_XPCOM VBOX_CC_OPT += -DRTLOG_REL_ENABLED -DRT_STRICT -DVBOX_STRICT +VBOX_CC_OPT += -DVBOX_WITH_USB -DVBOX_WITH_VUSB + # Enable Intel Network model E1000 VBOX_CC_OPT += -DVBOX_WITH_E1000 diff --git a/repos/ports/lib/mk/virtualbox-devices.mk b/repos/ports/lib/mk/virtualbox-devices.mk index 4856db8c3..97e87dd71 100644 --- a/repos/ports/lib/mk/virtualbox-devices.mk +++ b/repos/ports/lib/mk/virtualbox-devices.mk @@ -24,7 +24,6 @@ SRC_CC += Devices/Storage/ATAPIPassthrough.cpp SRC_CC += Devices/Storage/DevATA.cpp SRC_CC += Devices/Storage/Debug.cpp SRC_CC += Devices/Storage/DevFdc.c -SRC_CC += Devices/Storage/DrvRawImage.cpp SRC_CC += Devices/Network/DevE1000.cpp SRC_CC += Devices/Network/DevE1000Phy.cpp SRC_CC += Devices/Network/DevEEPROM.cpp @@ -35,6 +34,15 @@ SRC_CC += GuestHost/HGSMI/HGSMICommon.cpp SRC_CC += Devices/Serial/DevSerial.cpp SRC_CC += Devices/PC/DevIoApic.cpp +SRC_CC += Devices/USB/DevOHCI.cpp +SRC_CC += Devices/USB/USBProxyDevice.cpp +SRC_CC += Devices/USB/VUSBDevice.cpp +SRC_CC += Devices/USB/VUSBReadAhead.cpp +SRC_CC += Devices/USB/VUSBUrb.cpp +SRC_CC += Devices/Input/UsbMouse.cpp +SRC_CC += Devices/Input/UsbKbd.cpp + +SRC_CC += Devices/build/VBoxDD.cpp INC_DIR += $(VBOX_DIR)/Devices/build INC_DIR += $(VBOX_DIR)/Devices/Bus diff --git a/repos/ports/lib/mk/virtualbox-drivers.mk b/repos/ports/lib/mk/virtualbox-drivers.mk index 8129c2aec..8a81deb6c 100644 --- a/repos/ports/lib/mk/virtualbox-drivers.mk +++ b/repos/ports/lib/mk/virtualbox-drivers.mk @@ -2,19 +2,16 @@ include $(REP_DIR)/lib/mk/virtualbox-common.inc SRC_CC += Devices/Input/DrvKeyboardQueue.cpp SRC_CC += Devices/Input/DrvMouseQueue.cpp +SRC_CC += Devices/USB/DrvVUSBRootHub.cpp SRC_CC += Devices/Storage/DrvBlock.cpp SRC_CC += Devices/Storage/DrvMediaISO.cpp SRC_CC += Devices/Storage/DrvVD.cpp +SRC_CC += Devices/Storage/DrvRawImage.cpp SRC_CC += Devices/PC/DrvACPI.cpp SRC_CC += Devices/Serial/DrvChar.cpp SRC_CC += Devices/Serial/DrvRawFile.cpp SRC_CC += Devices/Serial/DrvHostSerial.cpp -#SRC_CC += Main/src-client/MouseImpl.cpp SRC_CC += network.cpp vpath network.cpp $(REP_DIR)/src/virtualbox - -# includes needed by 'MouseImpl.cpp' -#INC_DIR += $(VBOX_DIR)/Main/include -#INC_DIR += $(VBOX_DIR)/Frontends/VBoxBFE diff --git a/repos/ports/lib/mk/virtualbox-main.mk b/repos/ports/lib/mk/virtualbox-main.mk index 0dd546d30..16aff043c 100644 --- a/repos/ports/lib/mk/virtualbox-main.mk +++ b/repos/ports/lib/mk/virtualbox-main.mk @@ -53,6 +53,7 @@ SRC_CC += Main/src-server/StorageControllerImpl.cpp SRC_CC += Main/src-server/SystemPropertiesImpl.cpp SRC_CC += Main/src-server/TokenImpl.cpp SRC_CC += Main/src-server/USBControllerImpl.cpp +SRC_CC += Main/src-server/USBDeviceFilterImpl.cpp SRC_CC += Main/src-server/USBDeviceFiltersImpl.cpp SRC_CC += Main/src-server/VirtualBoxImpl.cpp SRC_CC += Main/src-server/VRDEServerImpl.cpp diff --git a/repos/ports/lib/mk/virtualbox-runtime.mk b/repos/ports/lib/mk/virtualbox-runtime.mk index 7a8b336e8..1c6379960 100644 --- a/repos/ports/lib/mk/virtualbox-runtime.mk +++ b/repos/ports/lib/mk/virtualbox-runtime.mk @@ -49,6 +49,9 @@ SRC_CC += Runtime/common/misc/assert.cpp SRC_CC += Runtime/common/misc/buildconfig.cpp SRC_CC += Runtime/common/misc/lockvalidator.cpp SRC_CC += Runtime/common/misc/once.cpp +SRC_CC += Runtime/common/misc/req.cpp +SRC_CC += Runtime/common/misc/reqpool.cpp +SRC_CC += Runtime/common/misc/reqqueue.cpp SRC_CC += Runtime/common/misc/sg.cpp SRC_CC += Runtime/common/misc/term.cpp SRC_CC += Runtime/common/misc/RTAssertMsg1Weak.cpp diff --git a/repos/ports/lib/mk/virtualbox-vmm.mk b/repos/ports/lib/mk/virtualbox-vmm.mk index a2a0c2b09..3e48e3212 100644 --- a/repos/ports/lib/mk/virtualbox-vmm.mk +++ b/repos/ports/lib/mk/virtualbox-vmm.mk @@ -33,6 +33,8 @@ SRC_CC += VMM/VMMR3/PDMDevMiscHlp.cpp SRC_CC += VMM/VMMR3/PDMDriver.cpp SRC_CC += VMM/VMMR3/PDMThread.cpp +SRC_CC += VMM/VMMR3/PDMUsb.cpp + SRC_CC += VMM/VMMAll/CPUMAllMsrs.cpp SRC_CC += VMM/VMMAll/CPUMAllRegs.cpp diff --git a/repos/ports/ports/virtualbox.hash b/repos/ports/ports/virtualbox.hash index 0f8577626..86af65a21 100644 --- a/repos/ports/ports/virtualbox.hash +++ b/repos/ports/ports/virtualbox.hash @@ -1 +1 @@ -6fdf666cabbc6926ccc8c54dc00ac471e26a0eac +372dfd49bf530d54f766b4a206c58bebee9a4bc7 diff --git a/repos/ports/ports/virtualbox.port b/repos/ports/ports/virtualbox.port index 8b7cb7e03..f135c8ed2 100644 --- a/repos/ports/ports/virtualbox.port +++ b/repos/ports/ports/virtualbox.port @@ -11,7 +11,7 @@ SHA(virtualbox) := e4c23b713e8715b8e0172fa066f2197756e901fe PATCHES_LIST := acpi_drv dev_e1000 eminternal fake_pci_vendor iconv mouse PATCHES_LIST += pdm_driver poke sharedfolder_pagelist PATCHES_LIST += time-log-deadlock vbox_inc vbox_main network -PATCHES_LIST += vga_fb vga_vbva vmdk vmmdev avoid_yield serial rem_irq +PATCHES_LIST += vga_fb vga_vbva vmdk vmmdev avoid_yield serial rem_irq usb PATCHES := $(addsuffix .patch, $(PATCHES_LIST)) PATCHES := $(addprefix src/virtualbox/patches/, $(PATCHES)) @@ -30,13 +30,14 @@ VBOX_MAIN_CLI += KeyboardImpl SessionImpl VMMDevInterface BusAssignmentManager VBOX_MAIN_CLI += ConsoleImpl GuestImpl MouseImpl VBoxDriversRegister VBOX_MAIN_SRV := AudioAdapterImpl DHCPServerImpl MediumAttachmentImpl -VBOX_MAIN_SRV += NATEngineImpl SerialPortImpl USBControllerImpl +VBOX_MAIN_SRV += NATEngineImpl SerialPortImpl VBOX_MAIN_SRV += BandwidthControlImpl GuestOSTypeImpl MediumFormatImpl -VBOX_MAIN_SRV += NetworkAdapterImpl SnapshotImpl USBDeviceFiltersImpl +VBOX_MAIN_SRV += NetworkAdapterImpl SnapshotImpl VBOX_MAIN_SRV += BandwidthGroupImpl MachineImplCloneVM MediumImpl VBOX_MAIN_SRV += NetworkServiceRunner StorageControllerImpl VirtualBoxImpl VBOX_MAIN_SRV += BIOSSettingsImpl MachineImpl MediumLock ParallelPortImpl VBOX_MAIN_SRV += SystemPropertiesImpl VRDEServerImpl TokenImpl +VBOX_MAIN_SRV += USBControllerImpl USBDeviceFilterImpl USBDeviceFiltersImpl VBOX_MAIN_INC := AdditionsFacilityImpl AudioAdapterImpl AudioSnifferInterface VBOX_MAIN_INC += AutoCaller AutostartDb AutoStateDep BandwidthControlImpl @@ -54,7 +55,8 @@ VBOX_MAIN_INC += PCIDeviceAttachmentImpl Performance ProgressImpl SnapshotImpl VBOX_MAIN_INC += ProgressProxyImpl SerialPortImpl SessionImpl SharedFolderImpl VBOX_MAIN_INC += StorageControllerImpl SystemPropertiesImpl TokenImpl VMMDev VBOX_MAIN_INC += USBControllerImpl USBDeviceFilterImpl USBDeviceFiltersImpl -VBOX_MAIN_INC += VirtualBoxImpl VRDEServerImpl GuestProcessImpl +VBOX_MAIN_INC += USBProxyService VirtualBoxImpl VRDEServerImpl GuestProcessImpl +VBOX_MAIN_INC += USBDeviceImpl HostUSBDeviceImpl Matching VBOX_SRC_VBOX := VMM Devices Runtime GuestHost/HGSMI Storage Disassembler VBOX_SRC_VBOX += HostServices/SharedFolders Main/xml/Settings.cpp @@ -71,6 +73,7 @@ VBOX_INC += VBoxVideo.h Hardware bioslogo.h scsi.h shflsvc.h VBoxGuest2.h vd.h VBOX_INC += vd-plugin.h vd-ifs.h vd-ifs-internal.h vd-image-backend.h VBOX_INC += vd-cache-backend.h vd-filter-backend.h msi.h asmdefs.mac err.mac VBOX_INC += VBoxVideoHost3D.h VBoxVideo3D.h settings.h VBoxAuth.h +VBOX_INC += usb.h usbfilter.h VBOX_INC_COM := array.h assert.h AutoLock.h ErrorInfo.h EventQueue.h Guid.h VBOX_INC_COM += list.h MultiResult.h string.h diff --git a/repos/ports/run/test.vbox b/repos/ports/run/test.vbox index 51a1c70aa..f93f2a9b5 100644 --- a/repos/ports/run/test.vbox +++ b/repos/ports/run/test.vbox @@ -51,7 +51,9 @@ - + + + diff --git a/repos/ports/run/vbox_auto_win7.run b/repos/ports/run/vbox_auto_win7.run index bd877b186..c48282f72 100644 --- a/repos/ports/run/vbox_auto_win7.run +++ b/repos/ports/run/vbox_auto_win7.run @@ -7,4 +7,7 @@ set flavor "win7" # Write overlay back to harddisk if set to 0 set use_ram_fs 0 +set use_usb 0 +set use_ps2 [have_spec ps2] + source ${genode_dir}/repos/ports/run/vbox_win.inc diff --git a/repos/ports/run/vbox_auto_win7_share.run b/repos/ports/run/vbox_auto_win7_share.run index e114c0719..ac1def3b1 100644 --- a/repos/ports/run/vbox_auto_win7_share.run +++ b/repos/ports/run/vbox_auto_win7_share.run @@ -71,6 +71,9 @@ set vdi_image "${flavor}.vdi" set use_ram_fs 0 set overlay_image "overlay_${flavor}.vdi" +set use_usb 0 +set use_ps2 [have_spec ps2] + # # Create .bat file to be executed by Win VM # diff --git a/repos/ports/run/vbox_auto_win8.run b/repos/ports/run/vbox_auto_win8.run index d005b1a3a..bf945c75c 100644 --- a/repos/ports/run/vbox_auto_win8.run +++ b/repos/ports/run/vbox_auto_win8.run @@ -9,4 +9,7 @@ set flavor "win8" # Write overlay back to harddisk if set to 0 set use_ram_fs 0 +set use_usb 0 +set use_ps2 [have_spec ps2] + source ${genode_dir}/repos/ports/run/vbox_win.inc diff --git a/repos/ports/run/virtualbox.run b/repos/ports/run/virtualbox.run index df39b4807..a172a01e2 100644 --- a/repos/ports/run/virtualbox.run +++ b/repos/ports/run/virtualbox.run @@ -1,13 +1,16 @@ set use_net 0 +set use_ps2 [have_spec ps2] +set use_usb 0 set use_serial 0 set build_components { core init virtualbox - drivers/input drivers/framebuffer drivers/timer } +lappend_if [expr $use_ps2] build_components drivers/input +lappend_if [expr $use_usb] build_components drivers/usb lappend_if [expr $use_serial] build_components server/log_terminal lappend_if [have_spec acpi] build_components drivers/acpi lappend_if [have_spec pci] build_components drivers/pci @@ -62,12 +65,25 @@ append_if [expr ![have_spec acpi] && [have_spec pci]] config { } -append_if [have_spec ps2] config { +append_if [expr $use_ps2] config { } +append_if [expr $use_usb] config { + + + + + + + + + + + } + append_if [have_spec framebuffer] config { @@ -139,7 +155,8 @@ exec cp ${genode_dir}/repos/ports/run/test.vbox bin/. set boot_modules { core init timer virtualbox test.iso test.vbox } # platform-specific modules -lappend_if [have_spec ps2] boot_modules ps2_drv +lappend_if [expr $use_usb] boot_modules usb_drv +lappend_if [expr $use_ps2] boot_modules ps2_drv lappend_if [have_spec acpi] boot_modules acpi_drv lappend_if [have_spec pci] boot_modules pci_drv lappend_if [have_spec framebuffer] boot_modules fb_drv @@ -157,7 +174,12 @@ append_if [expr $use_serial] boot_modules { log_terminal } build_boot_image $boot_modules -append qemu_args " -m 512 " -append qemu_args " -cpu phenom " +if {[have_include "power_on/qemu"]} { + append qemu_args " -m 512 " + append qemu_args " -cpu phenom " + if {[expr $use_usb]} { + append qemu_args " -usbdevice mouse -usbdevice keyboard" + } +} run_genode_until forever diff --git a/repos/ports/run/virtualbox_auto.inc b/repos/ports/run/virtualbox_auto.inc index 6b98d5ea2..2f8637441 100644 --- a/repos/ports/run/virtualbox_auto.inc +++ b/repos/ports/run/virtualbox_auto.inc @@ -10,11 +10,12 @@ append build_components { server/part_blk server/rump_fs drivers/ahci - drivers/input drivers/framebuffer drivers/timer } +lappend_if [expr $use_ps2] build_components drivers/input +lappend_if [expr $use_usb] build_components drivers/usb lappend_if [have_spec acpi] build_components drivers/acpi lappend_if [have_spec pci] build_components drivers/pci lappend_if [have_spec x86] build_components drivers/rtc @@ -92,7 +93,7 @@ append_if [expr $use_ram_fs] config { append_if [have_spec acpi] config { - + @@ -110,12 +111,30 @@ append_if [expr ![have_spec acpi] && [have_spec pci]] config { } -append_if [have_spec ps2] config { +append_if [expr $use_ps2] config { + + + + } +append_if [expr $use_usb] config { + + + + + + + + + + + +} + append_if [have_spec framebuffer] config { @@ -153,7 +172,8 @@ lappend_if [expr $use_ram_fs] boot_modules ram_fs lappend_if [expr $use_ram_fs] boot_modules ${overlay_image} # platform-specific modules -lappend_if [have_spec ps2] boot_modules ps2_drv +lappend_if [expr $use_ps2] boot_modules ps2_drv +lappend_if [expr $use_usb] boot_modules usb_drv lappend_if [have_spec acpi] boot_modules acpi_drv lappend_if [have_spec pci] boot_modules pci_drv lappend_if [have_spec framebuffer] boot_modules fb_drv diff --git a/repos/ports/run/vm_win7.vbox b/repos/ports/run/vm_win7.vbox index 6be56fc15..7859ab65b 100644 --- a/repos/ports/run/vm_win7.vbox +++ b/repos/ports/run/vm_win7.vbox @@ -53,7 +53,9 @@ - + + + diff --git a/repos/ports/run/vm_win8.vbox b/repos/ports/run/vm_win8.vbox index c1db59008..f4d685b0a 100644 --- a/repos/ports/run/vm_win8.vbox +++ b/repos/ports/run/vm_win8.vbox @@ -53,7 +53,9 @@ - + + + diff --git a/repos/ports/src/virtualbox/devices.cc b/repos/ports/src/virtualbox/devices.cc index ecef667d8..b38e6fb0b 100644 --- a/repos/ports/src/virtualbox/devices.cc +++ b/repos/ports/src/virtualbox/devices.cc @@ -117,6 +117,10 @@ extern "C" int VBoxDevicesRegister(PPDMDEVREGCB pCallbacks, uint32_t u32Version) if (RT_FAILURE(rc)) return rc; + rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceOHCI); + if (RT_FAILURE(rc)) + return rc; + return VINF_SUCCESS; } diff --git a/repos/ports/src/virtualbox/drivers.cc b/repos/ports/src/virtualbox/drivers.cc index 3e8314f06..eb65a3279 100644 --- a/repos/ports/src/virtualbox/drivers.cc +++ b/repos/ports/src/virtualbox/drivers.cc @@ -32,6 +32,7 @@ extern "C" int VBoxDriversRegister(PCPDMDRVREGCB pCallbacks, uint32_t u32Version &g_DrvHostSerial, &g_DrvVD, &g_DrvHostInterface, + &g_DrvVUSBRootHub, 0 }; diff --git a/repos/ports/src/virtualbox/frontend/GenodeImpl.h b/repos/ports/src/virtualbox/frontend/GenodeImpl.h index f1045c413..46ae4aa02 100644 --- a/repos/ports/src/virtualbox/frontend/GenodeImpl.h +++ b/repos/ports/src/virtualbox/frontend/GenodeImpl.h @@ -85,6 +85,7 @@ class Mouse; class NATEngine; class NATNetwork; class NetworkAdapter; +class OUSBDevice; class ParallelPort; class PCIDeviceAttachment; class SerialPort; @@ -162,7 +163,7 @@ typedef StorageController IStorageController; typedef SystemProperties ISystemProperties; typedef Token IToken; typedef USBController IUSBController; -class IUSBDevice; +typedef OUSBDevice IUSBDevice; typedef USBDeviceFilter IUSBDeviceFilter; typedef USBDeviceFilters IUSBDeviceFilters; typedef VirtualBox IVirtualBox; @@ -269,6 +270,7 @@ typedef struct IFsObjInfo { } IFsObjInfo; #include "MediumImpl.h" #include "SessionImpl.h" #include "HostImpl.h" +#include "USBDeviceImpl.h" class VRDEServerInfo { }; class EmulatedUSB { }; diff --git a/repos/ports/src/virtualbox/frontend/VirtualBoxBase.h b/repos/ports/src/virtualbox/frontend/VirtualBoxBase.h index d32247db1..78f92ea07 100644 --- a/repos/ports/src/virtualbox/frontend/VirtualBoxBase.h +++ b/repos/ports/src/virtualbox/frontend/VirtualBoxBase.h @@ -118,6 +118,8 @@ class VirtualBoxBase : public util::Lockable { RWLockHandle * lockHandle() const; }; +class VirtualBoxTranslatable : public util::Lockable { }; + template class Shareable { diff --git a/repos/ports/src/virtualbox/frontend/dummy/host.cc b/repos/ports/src/virtualbox/frontend/dummy/host.cc index 5cdb57ae7..ab5719542 100644 --- a/repos/ports/src/virtualbox/frontend/dummy/host.cc +++ b/repos/ports/src/virtualbox/frontend/dummy/host.cc @@ -2,6 +2,8 @@ #include "VirtualBoxBase.h" +#include + static bool debug = false; #define TRACE(X) \ @@ -119,25 +121,20 @@ HRESULT Host::buildDVDDrivesList(MediaList &list) DUMMY(E_FAIL) HRESULT Host::buildFloppyDrivesList(MediaList &list) DUMMY(E_FAIL) #ifdef VBOX_WITH_USB -USBProxyService* Host::usbProxyService() DUMMY(nullptr) -HRESULT Host::addChild(HostUSBDeviceFilter *pChild) DUMMY(E_FAIL) -HRESULT Host::removeChild(HostUSBDeviceFilter *pChild) DUMMY(E_FAIL) -VirtualBox* Host::parent() DUMMY(nullptr) +USBProxyService* Host::usbProxyService() +{ + TRACE(nullptr) +} -HRESULT Host::onUSBDeviceFilterChange(HostUSBDeviceFilter *aFilter) DUMMY(E_FAIL) +HRESULT Host::addChild(HostUSBDeviceFilter *pChild) DUMMY(E_FAIL) +HRESULT Host::removeChild(HostUSBDeviceFilter *pChild) DUMMY(E_FAIL) +VirtualBox* Host::parent() DUMMY(nullptr) -void Host::getUSBFilters(Host::USBDeviceFilterList *aGlobalFilters) DUMMY() +HRESULT Host::onUSBDeviceFilterChange(HostUSBDeviceFilter *, BOOL) DUMMY(E_FAIL) + +void Host::getUSBFilters(Host::USBDeviceFilterList *aGlobalFilters) DUMMY() + +HRESULT Host::checkUSBProxyService() TRACE(S_OK) + +int USBFilterMatchRated(PCUSBFILTER pFilter, PCUSBFILTER pDevice) DUMMY(-1) #endif - -/* -void Host::getDVDInfoFromDevTree(std::list > &list) DUMMY() -bool Host::getDVDInfoFromHal(std::list > &list) DUMMY(false) -bool Host::getFloppyInfoFromHal(std::list< ComObjPtr > &list) DUMMY(false) -void Host::parseMountTable(char *mountTable, std::list< ComObjPtr > &list) DUMMY() -bool Host::validateDevice(const char *deviceNode, bool isCDROM) DUMMY(false) -HRESULT Host::checkUSBProxyService() DUMMY(E_FAIL) -HRESULT Host::updateNetIfList() DUMMY(E_FAIL) -void Host::registerDiskMetrics(PerformanceCollector *aCollector) DUMMY() -void Host::registerMetrics(PerformanceCollector *aCollector) DUMMY() -void Host::unregisterMetrics (PerformanceCollector *aCollector) DUMMY() -*/ diff --git a/repos/ports/src/virtualbox/frontend/dummy/rest.cc b/repos/ports/src/virtualbox/frontend/dummy/rest.cc index dde5259e8..841dc579f 100644 --- a/repos/ports/src/virtualbox/frontend/dummy/rest.cc +++ b/repos/ports/src/virtualbox/frontend/dummy/rest.cc @@ -6,6 +6,9 @@ #include "ProgressProxyImpl.h" #include "SharedFolderImpl.h" +#include +#include "USBProxyService.h" + static bool debug = false; #define TRACE(X) \ @@ -205,3 +208,29 @@ void Machine::ClientToken::getId(Utf8Str &strId) HRESULT com::Initialize(bool fGui) TRACE(S_OK) + + + + +HRESULT USBProxyService::captureDeviceForVM(SessionMachine *, IN_GUID) DUMMY(E_FAIL) +HRESULT USBProxyService::detachAllDevicesFromVM(SessionMachine*, bool, bool) DUMMY(E_FAIL) +HRESULT USBProxyService::autoCaptureDevicesForVM(SessionMachine *) DUMMY(E_FAIL) +HRESULT USBProxyService::detachDeviceFromVM(SessionMachine*, GUID, bool) DUMMY(E_FAIL) +void matching::ParsedBoolFilter::parse(com::Bstr const&) DUMMY() + +USBFILTERMATCH USBFilterGetMatchingMethod(PCUSBFILTER, USBFILTERIDX) DUMMY(USBFILTERMATCH_INVALID) +const char * USBFilterGetString(PCUSBFILTER pFilter, USBFILTERIDX enmFieldIdx) DUMMY(nullptr) + +bool USBFilterIsMethodNumeric(USBFILTERMATCH enmMatchingMethod) DUMMY(false) +bool USBFilterMatch(PCUSBFILTER pFilter, PCUSBFILTER pDevice) DUMMY(false) +void USBFilterInit(PUSBFILTER pFilter, USBFILTERTYPE enmType) DUMMY() +int USBFilterSetStringExact(PUSBFILTER, USBFILTERIDX, const char *, bool) DUMMY(-1) +int USBFilterSetNumExact(PUSBFILTER, USBFILTERIDX, uint16_t, bool) DUMMY(-1) +int USBFilterGetNum(PCUSBFILTER pFilter, USBFILTERIDX enmFieldIdx) DUMMY(-1) +bool USBFilterIsNumericField(USBFILTERIDX enmFieldIdx) DUMMY(false) +bool USBFilterIsMethodString(USBFILTERMATCH enmMatchingMethod) DUMMY(false) +bool USBFilterIsStringField(USBFILTERIDX enmFieldIdx) DUMMY(false) +int USBFilterSetStringPattern(PUSBFILTER, USBFILTERIDX, const char *, bool) DUMMY(-1) +int USBFilterSetNumExpression(PUSBFILTER, USBFILTERIDX, const char *, bool) DUMMY(-1) +int USBFilterSetIgnore(PUSBFILTER pFilter, USBFILTERIDX enmFieldIdx) DUMMY(-1) + diff --git a/repos/ports/src/virtualbox/include/VBox/com/defs.h b/repos/ports/src/virtualbox/include/VBox/com/defs.h index 3a225c929..419673610 100644 --- a/repos/ports/src/virtualbox/include/VBox/com/defs.h +++ b/repos/ports/src/virtualbox/include/VBox/com/defs.h @@ -628,4 +628,8 @@ enum HWVirtExPropertyType_T HWVirtExPropertyType_UnrestrictedExecution, }; +enum USBDeviceState_T +{ +}; + #endif /* !___VBox_com_defs_h */ diff --git a/repos/ports/src/virtualbox/patches/usb.patch b/repos/ports/src/virtualbox/patches/usb.patch new file mode 100644 index 000000000..b29817743 --- /dev/null +++ b/repos/ports/src/virtualbox/patches/usb.patch @@ -0,0 +1,131 @@ ++++ src/app/virtualbox/src/VBox/Devices/USB/VUSBDevice.cpp +@@ -230,7 +230,14 @@ + if (i != VUSB_PIPE_DEFAULT) + { + vusbMsgFreeExtraData(pDev->aPipes[i].pCtrl); ++ ++ int rc = RTCritSectDelete(&pDev->aPipes[i].CritSectCtrl); ++ AssertRC(rc); ++ + memset(&pDev->aPipes[i], 0, sizeof(pDev->aPipes[i])); ++ ++ rc = RTCritSectInit(&pDev->aPipes[i].CritSectCtrl); ++ AssertRC(rc); + } + } + memset(pDev->paIfStates, 0, pCfgDesc->Core.bNumInterfaces * sizeof(pDev->paIfStates[0])); +@@ -1134,7 +1134,7 @@ + vusbUrbDoReapAsyncDev(pDev, RT_INDEFINITE_WAIT); + + /* Process any URBs waiting to be cancelled first. */ +- int rc = RTReqQueueProcess(pDev->hReqQueueSync, 0); /* Don't wait if there is nothing to do. */ ++ int rc = RTReqQueueProcess(pDev->hReqQueueSync, pDev->enmState == VUSB_DEVICE_STATE_RESET ? 5 : 0); /* if in reset state (takes 10ms) sleep a bit - otherwise this thread consumes in this loop a lot of cpu time */ + Assert(RT_SUCCESS(rc) || rc == VERR_TIMEOUT); + } + ++++ src/app/virtualbox/src/VBox/Main/src-server/MachineImpl.cpp +@@ -13571,6 +13582,7 @@ + AutoCaller autoCaller(this); + AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); + ++#if 0 + #ifdef VBOX_WITH_USB + HRESULT rc = mUSBDeviceFilters->notifyProxy(true /* aInsertFilters */); + AssertComRC(rc); +@@ -13579,6 +13591,7 @@ + USBProxyService *service = mParent->host()->usbProxyService(); + AssertReturn(service, E_FAIL); + return service->autoCaptureDevicesForVM(this); ++#endif /* if 0 */ + #else + return S_OK; + #endif +@@ -13601,6 +13614,7 @@ + AutoCaller autoCaller(this); + AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); + ++#if 0 + #ifdef VBOX_WITH_USB + HRESULT rc = mUSBDeviceFilters->notifyProxy(false /* aInsertFilters */); + AssertComRC(rc); +@@ -13609,6 +13623,7 @@ + USBProxyService *service = mParent->host()->usbProxyService(); + AssertReturn(service, E_FAIL); + return service->detachAllDevicesFromVM(this, !!aDone, false /* aAbnormal */); ++#endif /* if 0 */ + #else + NOREF(aDone); + return S_OK; ++++ src/app/virtualbox/src/VBox/Main/include/Matching.h +@@ -291,10 +291,12 @@ + return mValueAny || mValue == aValue; + } + ++#if 0 + bool isMatch (const BOOL aValue) const + { + return isMatch (bool (aValue == TRUE)); + } ++#endif /* if 0 */ + + private: + ++++ src/app/virtualbox/src/VBox/Main/src-server/USBDeviceFiltersImpl.cpp +@@ -1037,13 +1037,10 @@ + LogFlowThisFunc(("aInsertFilters=%RTbool\n", aInsertFilters)); + + AutoCaller autoCaller(this); +- AssertComRCReturn(autoCaller.rc(), false); ++ AssertComRCReturnRC(autoCaller.rc()); + + AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); + +- USBProxyService *pProxySvc = m->pHost->usbProxyService(); +- AssertReturn(pProxySvc, E_FAIL); +- + DeviceFilterList::const_iterator it = m->llDeviceFilters->begin(); + while (it != m->llDeviceFilters->end()) + { +@@ -1054,6 +1051,9 @@ + && pFilter->getData().mRemote.isMatch(false) /* and if the filter is NOT remote */ + ) + { ++ USBProxyService *pProxySvc = m->pHost->usbProxyService(); ++ AssertReturn(pProxySvc, E_FAIL); ++ + if (aInsertFilters) + { + AssertReturn(pFilter->getId() == NULL, E_FAIL); ++++ src/app/virtualbox/src/VBox/Devices/USB/USBProxyDevice.cpp +@@ -843,10 +843,14 @@ + /* + * Select backend and open the device. + */ ++ ++ return PDMUSB_SET_ERROR(pUsbIns, VERR_NOT_SUPPORTED, N_("USBProxy: not supported on Genode")); ++#if 0 + if (!fRemote) + pThis->pOps = &g_USBProxyDeviceHost; + else + pThis->pOps = &g_USBProxyDeviceVRDP; ++#endif /* if 0 */ + + pThis->pvInstanceDataR3 = RTMemAllocZ(pThis->pOps->cbBackend); + if (!pThis->pvInstanceDataR3) ++++ src/app/virtualbox/src/VBox/Devices/build/VBoxDD.cpp +@@ -39,6 +39,7 @@ + NULL, + }; + ++#if 0 + + /** + * Register builtin devices. +@@ -329,6 +330,7 @@ + return VINF_SUCCESS; + } + ++#endif /* if 0 */ + + /** + * Register builtin USB device. diff --git a/repos/ports/src/virtualbox/patches/vbox_main.patch b/repos/ports/src/virtualbox/patches/vbox_main.patch index b40f05b81..c14a7d6b6 100644 --- a/repos/ports/src/virtualbox/patches/vbox_main.patch +++ b/repos/ports/src/virtualbox/patches/vbox_main.patch @@ -428,16 +428,6 @@ } hrc = pMachine->COMGETTER(Name)(bstr.asOutParam()); H(); InsertConfigString(pCfg, "StreamName", bstr); -@@ -2430,7 +2446,9 @@ - * The USB Controllers. - */ - com::SafeIfaceArray usbCtrls; -+#if 0 - hrc = pMachine->COMGETTER(USBControllers)(ComSafeArrayAsOutParam(usbCtrls)); H(); -+#endif - bool fOhciPresent = false; /**< Flag whether at least one OHCI controller is presnet. */ - - for (size_t i = 0; i < usbCtrls.size(); ++i) @@ -3533,6 +3551,8 @@ ComPtr pMedium; hrc = pMediumAtt->COMGETTER(Medium)(pMedium.asOutParam()); H(); diff --git a/repos/ports/src/virtualbox/pdm.cc b/repos/ports/src/virtualbox/pdm.cc index 6b2c15068..b8c5eefb7 100644 --- a/repos/ports/src/virtualbox/pdm.cc +++ b/repos/ports/src/virtualbox/pdm.cc @@ -19,6 +19,7 @@ #include #include #include +#include #include "util.h" @@ -73,6 +74,7 @@ int PDMR3LdrGetSymbolR0Lazy(PVM pVM, const char *pszModule, extern "C" int VBoxDriversRegister(PCPDMDRVREGCB, uint32_t); extern "C" int VBoxDevicesRegister(PPDMDEVREGCB, uint32_t); extern "C" int VBoxDriversRegister_Main(PCPDMDRVREGCB, uint32_t); +extern "C" int VBoxUsbRegister(PCPDMUSBREGCB, uint32_t); static int dummy_VBoxDriversRegister(PCPDMDRVREGCB, uint32_t) { return VINF_SUCCESS; } @@ -102,6 +104,10 @@ int PDMR3LdrGetSymbolR3(PVM pVM, const char *pszModule, const char *pszSymbol, *ppvValue = (void *)VBoxDevicesRegister; return VINF_SUCCESS; } + if (Genode::strcmp(pszSymbol, "VBoxUsbRegister") == 0) { + *ppvValue = (void *)VBoxUsbRegister; + return VINF_SUCCESS; + } } if (Genode::strcmp(pszModule, "VBoxDD2") == 0) { diff --git a/repos/ports/src/virtualbox/thread.cc b/repos/ports/src/virtualbox/thread.cc index 7dfca6b23..49f0f03ff 100644 --- a/repos/ports/src/virtualbox/thread.cc +++ b/repos/ports/src/virtualbox/thread.cc @@ -57,7 +57,7 @@ static Genode::Cpu_session * get_cpu_session(RTTHREADTYPE type) { /* upgrade memory of cpu session for frequent used thread type */ if (type == RTTHREADTYPE_IO) - Genode::env()->parent()->upgrade(con[type - 1]->cap(), "ram_quota=4096"); + Genode::env()->parent()->upgrade(con[type - 1]->cap(), "ram_quota=8192"); return con[type - 1]; }