From 88034ef8363c4d06da878512aa54b97c8dacc85e Mon Sep 17 00:00:00 2001 From: Christian Prochaska Date: Fri, 8 May 2015 19:19:05 +0200 Subject: [PATCH] vbox: enable USB (OHCI) pass-through support The information about connected devices is obtained from a ROM file named 'usb_devices', which is supposed to contain a device list as in the device report generated by the USB driver (see issue #1506). A policy for 'report_rom' would look like: If the 'usb_devices' ROM file is not available, a warning message gets printed and VirtualBox continues without USB pass-through support. The devices to be passed-through need to have a matching device filter in the '.vbox' file. Example: The feature was tested with HID devices (mouse, keyboard) and a flatbed scanner. Mass storage devices didn't work correctly (they also didn't work with VirtualBox on Linux without the closed-source extension pack). It should be made sure that the USB driver does not try to control the devices to be passed-through itself, for example, when passing-through a HID device, the '' config option should not be set. Fixes #1507 --- repos/ports/lib/mk/virtualbox-main.mk | 3 + repos/ports/lib/mk/virtualbox-runtime.mk | 1 + repos/ports/ports/virtualbox.hash | 2 +- repos/ports/ports/virtualbox.port | 12 +- repos/ports/run/vbox_win.inc | 4 + repos/ports/run/virtualbox_auto.inc | 10 +- .../frontend/USBProxyDevice-genode.cpp | 480 ++++++++++++++++++ .../frontend/USBProxyServiceGenode.h | 262 ++++++++++ .../ports/src/virtualbox/frontend/console.cc | 6 +- .../src/virtualbox/frontend/dummy/host.cc | 51 +- .../src/virtualbox/frontend/dummy/rest.cc | 30 -- repos/ports/src/virtualbox/patches/usb.patch | 75 ++- .../src/virtualbox/patches/vbox_main.patch | 190 +++++-- repos/ports/src/virtualbox/target.mk | 4 + repos/ports/src/virtualbox/unimpl.cc | 2 - 15 files changed, 985 insertions(+), 147 deletions(-) create mode 100644 repos/ports/src/virtualbox/frontend/USBProxyDevice-genode.cpp create mode 100644 repos/ports/src/virtualbox/frontend/USBProxyServiceGenode.h diff --git a/repos/ports/lib/mk/virtualbox-main.mk b/repos/ports/lib/mk/virtualbox-main.mk index e3ce46d34..d2650c77b 100644 --- a/repos/ports/lib/mk/virtualbox-main.mk +++ b/repos/ports/lib/mk/virtualbox-main.mk @@ -30,6 +30,7 @@ SRC_CC += Main/src-client/MouseImpl.cpp SRC_CC += Main/src-client/VBoxDriversRegister.cpp SRC_CC += Main/src-client/VMMDevInterface.cpp SRC_CC += Main/src-client/SessionImpl.cpp +SRC_CC += Main/src-client/USBDeviceImpl.cpp SRC_CC += Main/src-server/AudioAdapterImpl.cpp SRC_CC += Main/src-server/BandwidthControlImpl.cpp @@ -38,6 +39,7 @@ SRC_CC += Main/src-server/BIOSSettingsImpl.cpp SRC_CC += Main/src-server/ClientToken.cpp SRC_CC += Main/src-server/DHCPServerImpl.cpp SRC_CC += Main/src-server/GuestOSTypeImpl.cpp +SRC_CC += Main/src-server/HostUSBDeviceImpl.cpp SRC_CC += Main/src-server/MachineImpl.cpp SRC_CC += Main/src-server/MachineImplCloneVM.cpp SRC_CC += Main/src-server/Matching.cpp @@ -57,6 +59,7 @@ 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/USBProxyService.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 1c6379960..1bf2faec0 100644 --- a/repos/ports/lib/mk/virtualbox-runtime.mk +++ b/repos/ports/lib/mk/virtualbox-runtime.mk @@ -33,6 +33,7 @@ SRC_CC += Runtime/common/log/logrel.cpp \ $(addprefix Runtime/generic/,$(filter-out $(FILTERED_OUT_SRC_CC), $(GENERIC_SRC_CC))) SRC_CC += Runtime/common/err/RTErrConvertFromErrno.cpp +SRC_CC += Runtime/common/alloc/alloc.cpp SRC_CC += Runtime/common/alloc/memcache.cpp SRC_CC += Runtime/common/alloc/heapoffset.cpp SRC_CC += Runtime/common/checksum/alt-md5.cpp diff --git a/repos/ports/ports/virtualbox.hash b/repos/ports/ports/virtualbox.hash index 7a52c5437..3e38572fd 100644 --- a/repos/ports/ports/virtualbox.hash +++ b/repos/ports/ports/virtualbox.hash @@ -1 +1 @@ -43d2aa6fa21dcf782a5c2539d6056575602bc545 +1722a638eb0095d736afffa29431c9c4da8f1d9b diff --git a/repos/ports/ports/virtualbox.port b/repos/ports/ports/virtualbox.port index a55296e4c..307ea91ff 100644 --- a/repos/ports/ports/virtualbox.port +++ b/repos/ports/ports/virtualbox.port @@ -28,17 +28,18 @@ VBOX_MAIN_ALL += VirtualBoxBase VBOX_MAIN_CLI := AdditionsFacilityImpl ConsoleImpl2 DisplayImpl HGCM HGCMThread VBOX_MAIN_CLI += HGCMObjects VBOX_MAIN_CLI += KeyboardImpl SessionImpl VMMDevInterface BusAssignmentManager -VBOX_MAIN_CLI += ConsoleImpl GuestImpl MouseImpl VBoxDriversRegister +VBOX_MAIN_CLI += ConsoleImpl GuestImpl MouseImpl USBDeviceImpl VBoxDriversRegister -VBOX_MAIN_SRV := AudioAdapterImpl ClientToken DHCPServerImpl Matching MediumAttachmentImpl -VBOX_MAIN_SRV += NATEngineImpl SerialPortImpl -VBOX_MAIN_SRV += BandwidthControlImpl GuestOSTypeImpl MediumFormatImpl -VBOX_MAIN_SRV += NetworkAdapterImpl SnapshotImpl +VBOX_MAIN_SRV := AudioAdapterImpl ClientToken DHCPServerImpl Matching +VBOX_MAIN_SRV += MediumAttachmentImpl NATEngineImpl SerialPortImpl +VBOX_MAIN_SRV += BandwidthControlImpl GuestOSTypeImpl HostUSBDeviceImpl +VBOX_MAIN_SRV += MediumFormatImpl 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_SRV += USBProxyService VBOX_MAIN_INC := AdditionsFacilityImpl AudioAdapterImpl AudioSnifferInterface VBOX_MAIN_INC += AutoCaller AutostartDb AutoStateDep BandwidthControlImpl @@ -60,6 +61,7 @@ VBOX_MAIN_INC += USBProxyService VirtualBoxImpl VRDEServerImpl GuestProcessImpl VBOX_MAIN_INC += USBDeviceImpl HostUSBDeviceImpl Matching Wrapper VBOX_SRC_VBOX := VMM Devices Runtime GuestHost/HGSMI Storage Disassembler +VBOX_SRC_VBOX += HostDrivers/VBoxUSB/USBFilter.cpp VBOX_SRC_VBOX += HostServices/SharedFolders Main/xml/Settings.cpp VBOX_SRC_VBOX += Main/xml/VirtualBox-settings.xsd Main/xml/SchemaDefs.xsl VBOX_SRC_VBOX += $(addsuffix .h, $(addprefix Main/include/, $(VBOX_MAIN_INC))) diff --git a/repos/ports/run/vbox_win.inc b/repos/ports/run/vbox_win.inc index 9c3e9b861..413463830 100644 --- a/repos/ports/run/vbox_win.inc +++ b/repos/ports/run/vbox_win.inc @@ -75,6 +75,7 @@ append config_of_app { + @@ -156,6 +157,9 @@ append config_of_app { + + + diff --git a/repos/ports/run/virtualbox_auto.inc b/repos/ports/run/virtualbox_auto.inc index 0e8a7769b..c41464067 100644 --- a/repos/ports/run/virtualbox_auto.inc +++ b/repos/ports/run/virtualbox_auto.inc @@ -141,10 +141,16 @@ append_if [expr $use_ps2] config { append_if [expr $use_usb] config { - - + + + + + + + + diff --git a/repos/ports/src/virtualbox/frontend/USBProxyDevice-genode.cpp b/repos/ports/src/virtualbox/frontend/USBProxyDevice-genode.cpp new file mode 100644 index 000000000..9e54dbc2e --- /dev/null +++ b/repos/ports/src/virtualbox/frontend/USBProxyDevice-genode.cpp @@ -0,0 +1,480 @@ +/* + * \brief USBProxyDevice implementation for Genode + * \author Christian Prochaska + * \date 2015-04-13 + */ + +/* + * Copyright (C) 2015 Genode Labs GmbH + * + * This file is distributed under the terms of the GNU General Public License + * version 2. + */ + +#include +#include +#include +#include +#include + +#include + +#include "USBProxyDevice.h" + +namespace Usb_proxy_device_genode { + + static constexpr bool debug = false; + + struct State_change_signal_context : Genode::Signal_context { }; + struct Ack_avail_signal_context : Genode::Signal_context { }; + struct Timeout_signal_context : Genode::Signal_context { }; + struct Wakeup_signal_context : Genode::Signal_context { }; + + class Data + { + private: + + Genode::Allocator_avl _alloc; + + public: + + Usb::Connection usb_connection; + Timer::Connection timer; + + State_change_signal_context state_change_signal_context; + Ack_avail_signal_context ack_avail_signal_context; + Timeout_signal_context timeout_signal_context; + Wakeup_signal_context wakeup_signal_context; + Genode::Signal_context_capability wakeup_signal_context_cap; + + Genode::Signal_receiver signal_receiver; + + Data(unsigned int vendor_id, unsigned int product_id) + : _alloc(Genode::env()->heap()), + usb_connection(&_alloc, vendor_id, product_id) + { + /* wait until device and server are ready */ + + Genode::Signal_context_capability state_change_signal_context_cap = + signal_receiver.manage(&state_change_signal_context); + + usb_connection.sigh_state_change(state_change_signal_context_cap); + + signal_receiver.wait_for_signal(); + + /* register the other signal handlers */ + + Genode::Signal_context_capability ack_avail_signal_context_cap = + signal_receiver.manage(&ack_avail_signal_context); + usb_connection.tx_channel()->sigh_ack_avail(ack_avail_signal_context_cap); + + Genode::Signal_context_capability timeout_signal_context_cap = + signal_receiver.manage(&timeout_signal_context); + timer.sigh(timeout_signal_context_cap); + + wakeup_signal_context_cap = signal_receiver.manage(&wakeup_signal_context); + } + + }; + + /* keep a reference to the VirtualBox URB in a packet descriptor */ + struct Urb_preserve_completion : Usb::Completion + { + PVUSBURB pUrb; + + void complete(Usb::Packet_descriptor &p) { } + + Urb_preserve_completion(PVUSBURB pUrb) : pUrb(pUrb) { } + virtual ~Urb_preserve_completion() { } + }; + + static int open(PUSBPROXYDEV pProxyDev, const char *pszAddress, void *pvBackend); + static int init(PUSBPROXYDEV pProxyDev); + static void close(PUSBPROXYDEV pProxyDev); + static int reset(PUSBPROXYDEV pProxyDev, bool fResetOnLinux); + static int set_config(PUSBPROXYDEV pProxyDev, int iCfg); + static int claim_interface(PUSBPROXYDEV pProxyDev, int iIf); + static int release_interface(PUSBPROXYDEV pProxyDev, int iIf); + static int set_interface(PUSBPROXYDEV pProxyDev, int iIf, int iSetting); + static int clear_halted_endpoint(PUSBPROXYDEV pDev, unsigned int iEp); + static int urb_queue(PUSBPROXYDEV pProxyDev, PVUSBURB pUrb); + static int urb_cancel(PUSBPROXYDEV pProxyDev, PVUSBURB pUrb); + static PVUSBURB urb_reap(PUSBPROXYDEV pProxyDev, RTMSINTERVAL cMillies); + static int wakeup(PUSBPROXYDEV pProxyDev); + +}; + +int Usb_proxy_device_genode::open(PUSBPROXYDEV pProxyDev, const char *pszAddress, void *pvBackend) +{ + char vendor_id_hex_str[7] = "0x"; + char product_id_hex_str[7] = "0x"; + const char *separator = strchr(pszAddress, ':'); + + Genode::strncpy(&vendor_id_hex_str[2], pszAddress, 5); + Genode::strncpy(&product_id_hex_str[2], separator + 1, 5); + + unsigned int vendor_id; + unsigned int product_id; + + Genode::ascii_to(vendor_id_hex_str, vendor_id); + Genode::ascii_to(product_id_hex_str, product_id); + + if (debug) + PDBG("vendor_id: %x, product_id: %x", vendor_id, product_id); + + Usb_proxy_device_genode::Data *data = + USBPROXYDEV_2_DATA(pProxyDev, Usb_proxy_device_genode::Data*); + + Genode::construct_at(data, vendor_id, product_id); + + return VINF_SUCCESS; +} + +int Usb_proxy_device_genode::init(PUSBPROXYDEV pProxyDev) +{ + if (debug) + PDBG("not implemented, returning VINF_SUCCESS anyway"); + return VINF_SUCCESS; +} + +void Usb_proxy_device_genode::close(PUSBPROXYDEV pProxyDev) +{ + Usb_proxy_device_genode::Data *data = + USBPROXYDEV_2_DATA(pProxyDev, Usb_proxy_device_genode::Data*); + + data->~Data(); + + if (debug) + PDBG("not implemented"); +} + +int Usb_proxy_device_genode::reset(PUSBPROXYDEV pProxyDev, bool fResetOnLinux) +{ + if (debug) + PDBG("not implemented, returning VINF_SUCCESS anyway"); + return VINF_SUCCESS; +} + +int Usb_proxy_device_genode::set_config(PUSBPROXYDEV pProxyDev, int iCfg) +{ + if (iCfg == 1) { + /* default configuration */ + if (debug) + PDBG("not implemented, returning VINF_SUCCESS anyway"); + return VINF_SUCCESS; + } else { + if (debug) + PDBG("not implemented and iCfg != 1"); + return -1; + } +} + +int Usb_proxy_device_genode::claim_interface(PUSBPROXYDEV pProxyDev, int iIf) +{ + if (debug) + PDBG("not implemented, returning VINF_SUCCESS anyway"); + return VINF_SUCCESS; +} + +int Usb_proxy_device_genode::release_interface(PUSBPROXYDEV pProxyDev, int iIf) +{ + if (debug) + PDBG("not implemented"); + return -1; +} + +int Usb_proxy_device_genode::set_interface(PUSBPROXYDEV pProxyDev, int iIf, int iSetting) +{ + if (debug) + PDBG("not implemented"); + return -1; +} + +int Usb_proxy_device_genode::clear_halted_endpoint(PUSBPROXYDEV pDev, unsigned int iEp) +{ + if (debug) + PDBG("not implemented, returning VINF_SUCCESS anyway"); + return VINF_SUCCESS; +} + +int Usb_proxy_device_genode::urb_queue(PUSBPROXYDEV pProxyDev, PVUSBURB pUrb) +{ + if (debug) + PDBG("EndPt = %u, enmType = %d, enmDir = %d, cbData = %u", + pUrb->EndPt, pUrb->enmType, pUrb->enmDir, pUrb->cbData); + + static int count = 0; + + const char *dir_str = (pUrb->enmDir == VUSBDIRECTION_OUT) ? "OUT" : "IN"; + + Usb_proxy_device_genode::Data *data = + USBPROXYDEV_2_DATA(pProxyDev, Usb_proxy_device_genode::Data*); + + if (!data->usb_connection.source()->ready_to_submit()) { + PERR("%s: not ready to submit", __PRETTY_FUNCTION__); + return -1; + } + + try { + + if (pUrb->enmType == VUSBXFERTYPE_MSG) { + + if (pUrb->cbData < sizeof(VUSBSETUP)) + return VERR_BUFFER_UNDERFLOW; + + PVUSBSETUP pSetup = (PVUSBSETUP)pUrb->abData; + + if (debug) + PDBG("control %s transfer: request_type = 0x%x, request = 0x%x," + "value = 0x%x, index = 0x%x, length = %u, cbData = %u", + dir_str, pSetup->bmRequestType, pSetup->bRequest, + pSetup->wValue, pSetup->wIndex, pSetup->wLength, pUrb->cbData); + + Usb::Packet_descriptor p = data->usb_connection.source()->alloc_packet(pSetup->wLength); + + p.type = Usb::Packet_descriptor::CTRL; + p.succeded = false; + p.control.request = pSetup->bRequest; + p.control.request_type = pSetup->bmRequestType; + p.control.value = pSetup->wValue; + p.control.index = pSetup->wIndex; + p.control.timeout = 1000; + p.completion = new Urb_preserve_completion(pUrb); + + if ((pUrb->enmDir == VUSBDIRECTION_OUT) && (pSetup->wLength > 0)) { + char *packet_content = data->usb_connection.source()->packet_content(p); + Genode::memcpy(packet_content, (pSetup + 1), pSetup->wLength); + } + + if (debug) + PDBG("submitting packet: %d", ++count); + + data->usb_connection.source()->submit_packet(p); + + return VINF_SUCCESS; + + } else if ((pUrb->enmType == VUSBXFERTYPE_INTR) || + (pUrb->enmType == VUSBXFERTYPE_BULK)) { + + Usb::Packet_descriptor p = data->usb_connection.source()->alloc_packet(pUrb->cbData); + + if (pUrb->enmType == VUSBXFERTYPE_INTR) { + if (debug) + PDBG("interrupt %s transfer", dir_str); + p.type = Usb::Packet_descriptor::IRQ; + } else { + if (debug) + PDBG("bulk %s transfer", dir_str); + p.type = Usb::Packet_descriptor::BULK; + } + + p.succeded = false; + p.transfer.ep = pUrb->EndPt | (pUrb->enmDir == VUSBDIRECTION_IN ? + Usb::ENDPOINT_IN : + Usb::ENDPOINT_OUT); + p.transfer.timeout = 100; + p.completion = new Urb_preserve_completion(pUrb); + + if ((pUrb->enmDir == VUSBDIRECTION_OUT) && (pUrb->cbData > 0)) { + char *packet_content = data->usb_connection.source()->packet_content(p); + Genode::memcpy(packet_content, pUrb->abData, pUrb->cbData); + } + + if (debug) + PDBG("submitting packet: %d", ++count); + + data->usb_connection.source()->submit_packet(p); + + return VINF_SUCCESS; + + } else + PERR("%s: unsupported transfer type %d", __PRETTY_FUNCTION__, (int)pUrb->enmType); + + } catch (Usb::Session::Tx::Source::Packet_alloc_failed) { + + if (debug) + PDBG("packet allocation failed"); + + return -1; + + } catch (...) { + + PWRN("%s: an unhandled exception occured", __PRETTY_FUNCTION__); + return -1; + + } + + return -1; +} + +int Usb_proxy_device_genode::urb_cancel(PUSBPROXYDEV pProxyDev, PVUSBURB pUrb) +{ + if (debug) + PDBG("not implemented, returning VINF_SUCCESS anyway"); + return VINF_SUCCESS; +} + +PVUSBURB Usb_proxy_device_genode::urb_reap(PUSBPROXYDEV pProxyDev, RTMSINTERVAL cMillies) +{ + if (debug) + PDBG("cMillies = %u", cMillies); + + Usb_proxy_device_genode::Data *data = + USBPROXYDEV_2_DATA(pProxyDev, Usb_proxy_device_genode::Data*); + + if (!data->usb_connection.source()->ack_avail()) { + + unsigned long elapsed_ms_start = data->timer.elapsed_ms(); + + if (cMillies != RT_INDEFINITE_WAIT) + data->timer.trigger_once(cMillies * 1000); + + for (;;) { + + if (debug) + PDBG("waiting for signal"); + + Genode::Signal signal = data->signal_receiver.wait_for_signal(); + + Genode::Signal_context *context = signal.context(); + + if (dynamic_cast(context)) { + + if (cMillies == RT_INDEFINITE_WAIT) { + /* received an old signal */ + if (debug) + PDBG("old timeout signal received"); + continue; + } + + unsigned long elapsed_ms_now = data->timer.elapsed_ms(); + + if (elapsed_ms_now - elapsed_ms_start < cMillies) { + /* received an old signal */ + if (debug) + PDBG("old timeout signal received"); + continue; + } + + if (debug) + PDBG("timeout signal received"); + + return 0; + + } else if (dynamic_cast(context)) { + + if (debug) + PDBG("wakeup signal received"); + + return 0; + + } else if (dynamic_cast(context)) { + + if (debug) + PDBG("ack avail signal received"); + + if (data->usb_connection.source()->ack_avail()) + break; + else + continue; + + } else if (dynamic_cast(context)) { + + if (debug) + PDBG("state change signal received"); + + return 0; + } + } + } + + Usb::Packet_descriptor p = data->usb_connection.source()->get_acked_packet(); + + static int count = 0; + + if (debug) + PDBG("got packet: %d, succeded = %d", ++count, p.succeded); + + Urb_preserve_completion *completion = static_cast(p.completion); + PVUSBURB pUrb = completion->pUrb; + delete completion; + + if (!p.succeded) { + pUrb->enmStatus = VUSBSTATUS_DNR; + return pUrb; + } + + if (pUrb->enmType == VUSBXFERTYPE_MSG) { + + PVUSBSETUP pSetup = (PVUSBSETUP)pUrb->abData; + + pSetup->wLength = p.control.actual_size; + pUrb->cbData = sizeof(VUSBSETUP) + pSetup->wLength; + + if (debug) + PDBG("pSetup->wLength = %u, pUrb->cbData = %u", + pSetup->wLength, pUrb->cbData); + + if ((pUrb->enmDir == VUSBDIRECTION_IN) && (pSetup->wLength > 0)) { + char *packet_content = data->usb_connection.source()->packet_content(p); + Genode::memcpy((pSetup + 1), packet_content, pSetup->wLength); + } + + data->usb_connection.source()->release_packet(p); + + pUrb->enmStatus = VUSBSTATUS_OK; + + } else if ((pUrb->enmType == VUSBXFERTYPE_INTR) || + (pUrb->enmType == VUSBXFERTYPE_BULK)) { + + pUrb->cbData = p.transfer.actual_size; + + if ((pUrb->enmDir == VUSBDIRECTION_IN) && (pUrb->cbData > 0)) { + char *packet_content = data->usb_connection.source()->packet_content(p); + Genode::memcpy(pUrb->abData, packet_content, pUrb->cbData); + } + + data->usb_connection.source()->release_packet(p); + + pUrb->enmStatus = VUSBSTATUS_OK; + + } else { + PERR("%s: unsupported transfer type %d", __PRETTY_FUNCTION__, (int)pUrb->enmType); + } + + return pUrb; + +} + +int Usb_proxy_device_genode::wakeup(PUSBPROXYDEV pProxyDev) +{ + if (debug) + PDBG("wakeup()"); + + Usb_proxy_device_genode::Data *data = + USBPROXYDEV_2_DATA(pProxyDev, Usb_proxy_device_genode::Data*); + + Genode::Signal_transmitter(data->wakeup_signal_context_cap).submit(); + + return VINF_SUCCESS; +} + +extern const USBPROXYBACK g_USBProxyDeviceHost = +{ + "host", + sizeof(Usb_proxy_device_genode::Data), + Usb_proxy_device_genode::open, + Usb_proxy_device_genode::init, + Usb_proxy_device_genode::close, + Usb_proxy_device_genode::reset, + Usb_proxy_device_genode::set_config, + Usb_proxy_device_genode::claim_interface, + Usb_proxy_device_genode::release_interface, + Usb_proxy_device_genode::set_interface, + Usb_proxy_device_genode::clear_halted_endpoint, + Usb_proxy_device_genode::urb_queue, + Usb_proxy_device_genode::urb_cancel, + Usb_proxy_device_genode::urb_reap, + Usb_proxy_device_genode::wakeup, + 0 +}; diff --git a/repos/ports/src/virtualbox/frontend/USBProxyServiceGenode.h b/repos/ports/src/virtualbox/frontend/USBProxyServiceGenode.h new file mode 100644 index 000000000..11f988859 --- /dev/null +++ b/repos/ports/src/virtualbox/frontend/USBProxyServiceGenode.h @@ -0,0 +1,262 @@ +/* + * \brief USBProxyService implementation for Genode + * \author Christian Prochaska + * \date 2015-04-13 + */ + +/* + * Copyright (C) 2015 Genode Labs GmbH + * + * This file is distributed under the terms of the GNU General Public License + * version 2. + */ + +#ifndef ____H_USBPROXYSERVICEGENODE +#define ____H_USBPROXYSERVICEGENODE + +#include +#include +#include +#include + +#include + +class USBProxyServiceGenode : public USBProxyService +{ + private: + + static constexpr bool debug = false; + + struct Device_list_change_signal_context : Genode::Signal_context { }; + struct Timeout_signal_context : Genode::Signal_context { }; + struct Wakeup_signal_context : Genode::Signal_context { }; + + Timer::Connection _timer; + Genode::Signal_receiver _signal_receiver; + Device_list_change_signal_context _device_list_change_signal_context; + Timeout_signal_context _timeout_signal_context; + Wakeup_signal_context _wakeup_signal_context; + Genode::Signal_context_capability _wakeup_signal_context_cap; + + Genode::Attached_rom_dataspace *_usb_devices_ds = 0; + + Genode::Timed_semaphore _wait_sem; + + PUSBDEVICE _create_usb_device(Genode::Xml_node &device_node) + { + unsigned int vendor_id = 0; + unsigned int product_id = 0; + + device_node.attribute("vendor_id").value(&vendor_id); + device_node.attribute("product_id").value(&product_id); + + if (debug) + PDBG("vendor_id: %4x, product_id: %4x", vendor_id, product_id); + + char address_buf[10]; + Genode::snprintf(address_buf, sizeof(address_buf), + "%4x:%4x", vendor_id, product_id); + + PUSBDEVICE dev = (PUSBDEVICE)RTMemAllocZ(sizeof(USBDEVICE)); + + dev->idVendor = vendor_id; + dev->idProduct = product_id; + dev->pszAddress = RTStrDup(address_buf); + + dev->pNext = 0; + dev->pPrev = 0; + dev->pszManufacturer = 0; + dev->pszSerialNumber = 0; + dev->pszProduct = ""; + dev->bcdDevice = 0; + dev->bcdUSB = 0; + dev->bDeviceClass = 0x0; + dev->bDeviceSubClass = 0x0; + dev->bDeviceProtocol = 0x0; + dev->bNumConfigurations = 1; + dev->enmState = USBDEVICESTATE_UNUSED; + dev->enmSpeed = USBDEVICESPEED_LOW; + dev->u64SerialHash = 0; + dev->bBus = 1; + dev->bPort = 1; + dev->bDevNum = 3; + + return dev; + } + + public: + + USBProxyServiceGenode(Host *aHost) : USBProxyService(aHost) + { + try { + _usb_devices_ds = new Genode::Attached_rom_dataspace("usb_devices"); + + Genode::Signal_context_capability device_list_change_signal_context_cap = + _signal_receiver.manage(&_device_list_change_signal_context); + _usb_devices_ds->sigh(device_list_change_signal_context_cap); + + } catch (...) { + PWRN("Could not retrieve the \"usb_devices\" ROM file." + "USB device pass-through unavailable."); + } + + Genode::Signal_context_capability timeout_signal_context_cap = + _signal_receiver.manage(&_timeout_signal_context); + _timer.sigh(timeout_signal_context_cap); + + _wakeup_signal_context_cap = _signal_receiver.manage(&_wakeup_signal_context); + } + + ~USBProxyServiceGenode() + { + delete _usb_devices_ds; + } + + HRESULT init() + { + if (debug) + RTLogPrintf("USBProxyServiceGenode::init()\n"); + + /* + * Start the poller thread. + */ + return (HRESULT)start(); + } + + PUSBDEVICE getDevices() + { + if (debug) + RTLogPrintf("USBProxyServiceGenode::getDevices()\n"); + + PUSBDEVICE first_dev = 0; + + if (!_usb_devices_ds) + return first_dev; + + _usb_devices_ds->update(); + + if (!_usb_devices_ds->is_valid()) + return first_dev; + + try { + char *content = _usb_devices_ds->local_addr(); + + if (debug) + PDBG("content: %s", content); + + Genode::Xml_node devices_node(_usb_devices_ds->local_addr()); + + Genode::Xml_node device_node = devices_node.sub_node("device"); + + first_dev = _create_usb_device(device_node); + + PUSBDEVICE prev_dev = first_dev; + for (;;) { + device_node = device_node.next("device"); + PUSBDEVICE dev = _create_usb_device(device_node); + prev_dev->pNext = dev; + dev->pPrev = prev_dev; + prev_dev = dev; + } + + } catch (...) { } + + return first_dev; + } + + int wait(RTMSINTERVAL aMillies) + { + if (debug) + RTLogPrintf("USBProxyServiceGenode::wait(): aMillies = %u\n", + aMillies); + + unsigned long elapsed_ms_start = _timer.elapsed_ms(); + + if (aMillies != RT_INDEFINITE_WAIT) + _timer.trigger_once(aMillies * 1000); + + for (;;) { + + if (debug) + PDBG("waiting for signal"); + + Genode::Signal signal = _signal_receiver.wait_for_signal(); + + Genode::Signal_context *context = signal.context(); + + if (dynamic_cast(context)) { + + if (aMillies == RT_INDEFINITE_WAIT) { + /* received an old signal */ + if (debug) + PDBG("old timeout signal received"); + continue; + } + + unsigned long elapsed_ms_now = _timer.elapsed_ms(); + + if (elapsed_ms_now - elapsed_ms_start < aMillies) { + /* received an old signal */ + if (debug) + PDBG("old timeout signal received"); + continue; + } + + if (debug) + PDBG("timeout signal received"); + + break; + + } else if (dynamic_cast(context)) { + + if (debug) + PDBG("wakeup signal received"); + + break; + + } else if (dynamic_cast(context)) { + + if (debug) + PDBG("device list change signal received"); + + break; + } + } + + return VINF_SUCCESS; + } + + int interruptWait() + { + if (debug) + RTLogPrintf("USBProxyServiceGenode::interruptWait()\n"); + + Genode::Signal_transmitter(_wakeup_signal_context_cap).submit(); + + return VINF_SUCCESS; + } + + int captureDevice(HostUSBDevice *aDevice) + { + if (debug) + RTLogPrintf("USBProxyServiceGenode::captureDevice()\n"); + + interruptWait(); + + return VINF_SUCCESS; + } + + bool updateDeviceState(HostUSBDevice *aDevice, + PUSBDEVICE aUSBDevice, + bool *aRunFilters, + SessionMachine **aIgnoreMachine) + { + if (debug) + RTLogPrintf("USBProxyServiceGenode::updateDeviceState()\n"); + + return updateDeviceStateFake(aDevice, aUSBDevice, aRunFilters, aIgnoreMachine); + } + +}; + +#endif // ____H_USBPROXYSERVICEGENODE diff --git a/repos/ports/src/virtualbox/frontend/console.cc b/repos/ports/src/virtualbox/frontend/console.cc index 43f85a687..7ab436a3a 100644 --- a/repos/ports/src/virtualbox/frontend/console.cc +++ b/repos/ports/src/virtualbox/frontend/console.cc @@ -86,8 +86,10 @@ HRESULT Console::onCPUExecutionCapChange(ULONG aExecutionCap) HRESULT Console::onStorageControllerChange() DUMMY(E_FAIL) HRESULT Console::onMediumChange(IMediumAttachment *aMediumAttachment, BOOL) DUMMY(E_FAIL) HRESULT Console::onVRDEServerChange(BOOL aRestart) DUMMY(E_FAIL) -HRESULT Console::onUSBDeviceAttach(IUSBDevice *, IVirtualBoxErrorInfo *, ULONG) DUMMY(E_FAIL) -HRESULT Console::onUSBDeviceDetach(IN_BSTR aId, IVirtualBoxErrorInfo *aError) DUMMY(E_FAIL) + +void Console::onUSBDeviceStateChange(IUSBDevice *aDevice, bool aAttached, + IVirtualBoxErrorInfo *aError) TRACE() + HRESULT Console::onShowWindow(BOOL aCheck, BOOL *aCanShow, LONG64 *aWinId) DUMMY(E_FAIL) HRESULT Console::onNetworkAdapterChange(INetworkAdapter *, BOOL changeAdapter) DUMMY(E_FAIL) HRESULT Console::onStorageDeviceChange(IMediumAttachment *, BOOL, BOOL) DUMMY(E_FAIL) diff --git a/repos/ports/src/virtualbox/frontend/dummy/host.cc b/repos/ports/src/virtualbox/frontend/dummy/host.cc index d108ba8ef..6f43a88eb 100644 --- a/repos/ports/src/virtualbox/frontend/dummy/host.cc +++ b/repos/ports/src/virtualbox/frontend/dummy/host.cc @@ -3,6 +3,7 @@ #include "VirtualBoxBase.h" #include +#include #include "dummy/macros.h" @@ -11,6 +12,13 @@ static bool debug = false; +struct Host::Data +{ + VirtualBox *pParent; + USBDeviceFilterList llUSBDeviceFilters; // USB device filters in use by the USB proxy service + USBProxyService *pUSBProxyService; +}; + STDMETHODIMP Host::COMGETTER(DVDDrives)(ComSafeArrayOut(IMedium *, drives)) DUMMY(E_FAIL) STDMETHODIMP Host::COMGETTER(FloppyDrives)(ComSafeArrayOut(IMedium *, drives)) DUMMY(E_FAIL) STDMETHODIMP Host::COMGETTER(USBDevices)(ComSafeArrayOut(IHostUSBDevice *, aUSBDevices)) DUMMY(E_FAIL) @@ -61,11 +69,36 @@ HRESULT Host::findHostDriveById(DeviceType_T, com::Guid const&, bool, HRESULT Host::saveSettings(settings::Host&) TRACE(S_OK) -HRESULT Host::init(VirtualBox *aParent) TRACE(S_OK) +HRESULT Host::init(VirtualBox *aParent) +{ + HRESULT hrc; + + m = new Data(); + + m->pParent = aParent; + + m->pUSBProxyService = new USBProxyServiceGenode(this); + + hrc = m->pUSBProxyService->init(); + AssertComRCReturn(hrc, hrc); + + return S_OK; +} + HRESULT Host::loadSettings(const settings::Host &) TRACE(S_OK) HRESULT Host::FinalConstruct() TRACE(S_OK) void Host::FinalRelease() DUMMY() -void Host::uninit() DUMMY() + +void Host::uninit() +{ + delete m->pUSBProxyService; + m->pUSBProxyService = 0; + + m->llUSBDeviceFilters.clear(); + + delete m; + m = 0; +} void Host::generateMACAddress(Utf8Str &mac) { @@ -109,18 +142,24 @@ HRESULT Host::buildFloppyDrivesList(MediaList &list) DUMMY(E_FAIL) #ifdef VBOX_WITH_USB USBProxyService* Host::usbProxyService() { - TRACE(nullptr) + return m->pUSBProxyService; } HRESULT Host::addChild(HostUSBDeviceFilter *pChild) DUMMY(E_FAIL) HRESULT Host::removeChild(HostUSBDeviceFilter *pChild) DUMMY(E_FAIL) -VirtualBox* Host::parent() DUMMY(nullptr) + +VirtualBox* Host::parent() +{ + return m->pParent; +} HRESULT Host::onUSBDeviceFilterChange(HostUSBDeviceFilter *, BOOL) DUMMY(E_FAIL) -void Host::getUSBFilters(Host::USBDeviceFilterList *aGlobalFilters) DUMMY() +void Host::getUSBFilters(Host::USBDeviceFilterList *aGlobalFilters) +{ + *aGlobalFilters = m->llUSBDeviceFilters; +} HRESULT Host::checkUSBProxyService() TRACE(S_OK) -int USBFilterMatchRated(PCUSBFILTER pFilter, PCUSBFILTER pDevice) DUMMY(-1) #endif diff --git a/repos/ports/src/virtualbox/frontend/dummy/rest.cc b/repos/ports/src/virtualbox/frontend/dummy/rest.cc index a958564e8..607020a7a 100644 --- a/repos/ports/src/virtualbox/frontend/dummy/rest.cc +++ b/repos/ports/src/virtualbox/frontend/dummy/rest.cc @@ -178,36 +178,6 @@ HRESULT SharedFolder::init(Console*, com::Utf8Str const&, com::Utf8Str const&, bool, bool, bool) DUMMY(E_FAIL) -/* USBFilter.cpp */ - -#include "VBox/usbfilter.h" - -USBFILTERMATCH USBFilterGetMatchingMethod(PCUSBFILTER, USBFILTERIDX) DUMMY(USBFILTERMATCH_INVALID) -int USBFilterGetNum(PCUSBFILTER pFilter, USBFILTERIDX enmFieldIdx) DUMMY(-1) -const char * USBFilterGetString(PCUSBFILTER pFilter, USBFILTERIDX enmFieldIdx) DUMMY(nullptr) -void USBFilterInit(PUSBFILTER pFilter, USBFILTERTYPE enmType) DUMMY() -bool USBFilterIsMethodNumeric(USBFILTERMATCH enmMatchingMethod) DUMMY(false) -bool USBFilterIsMethodString(USBFILTERMATCH enmMatchingMethod) DUMMY(false) -bool USBFilterIsNumericField(USBFILTERIDX enmFieldIdx) DUMMY(false) -bool USBFilterIsStringField(USBFILTERIDX enmFieldIdx) DUMMY(false) -bool USBFilterMatch(PCUSBFILTER pFilter, PCUSBFILTER pDevice) DUMMY(false) -int USBFilterSetIgnore(PUSBFILTER pFilter, USBFILTERIDX enmFieldIdx) DUMMY(-1) -int USBFilterSetNumExact(PUSBFILTER, USBFILTERIDX, uint16_t, bool) DUMMY(-1) -int USBFilterSetNumExpression(PUSBFILTER, USBFILTERIDX, const char *, bool) DUMMY(-1) -int USBFilterSetStringExact(PUSBFILTER, USBFILTERIDX, const char *, bool) DUMMY(-1) -int USBFilterSetStringPattern(PUSBFILTER, USBFILTERIDX, const char *, bool) DUMMY(-1) - - -/* USBProxyService.cpp */ - -#include "USBProxyService.h" - -HRESULT USBProxyService::autoCaptureDevicesForVM(SessionMachine *) DUMMY(E_FAIL) -HRESULT USBProxyService::captureDeviceForVM(SessionMachine *, IN_GUID) DUMMY(E_FAIL) -HRESULT USBProxyService::detachAllDevicesFromVM(SessionMachine*, bool, bool) DUMMY(E_FAIL) -HRESULT USBProxyService::detachDeviceFromVM(SessionMachine*, IN_GUID, bool) DUMMY(E_FAIL) - - /* VirtualBoxImpl.cpp */ #include "VirtualBoxImpl.h" diff --git a/repos/ports/src/virtualbox/patches/usb.patch b/repos/ports/src/virtualbox/patches/usb.patch index d22402b0f..786d96cd2 100644 --- a/repos/ports/src/virtualbox/patches/usb.patch +++ b/repos/ports/src/virtualbox/patches/usb.patch @@ -1,26 +1,22 @@ usb.patch diff --git a/src/app/virtualbox/src/VBox/Devices/USB/USBProxyDevice.cpp b/src/app/virtualbox/src/VBox/Devices/USB/USBProxyDevice.cpp -index a51bc36..bed42e8 100644 +index a51bc36..d21c6cb 100644 --- a/src/app/virtualbox/src/VBox/Devices/USB/USBProxyDevice.cpp +++ b/src/app/virtualbox/src/VBox/Devices/USB/USBProxyDevice.cpp -@@ -843,10 +843,14 @@ static DECLCALLBACK(int) usbProxyConstruct(PPDMUSBINS pUsbIns, int iInstance, PC - /* - * Select backend and open the device. +@@ -845,8 +845,10 @@ static DECLCALLBACK(int) usbProxyConstruct(PPDMUSBINS pUsbIns, int iInstance, PC */ -+ -+ return PDMUSB_SET_ERROR(pUsbIns, VERR_NOT_SUPPORTED, N_("USBProxy: not supported on Genode")); -+#if 0 if (!fRemote) pThis->pOps = &g_USBProxyDeviceHost; ++#if 0 else pThis->pOps = &g_USBProxyDeviceVRDP; -+#endif /* if 0 */ ++#endif pThis->pvInstanceDataR3 = RTMemAllocZ(pThis->pOps->cbBackend); if (!pThis->pvInstanceDataR3) diff --git a/src/app/virtualbox/src/VBox/Devices/USB/VUSBDevice.cpp b/src/app/virtualbox/src/VBox/Devices/USB/VUSBDevice.cpp -index 4790fcb..4efa818 100644 +index 4790fcb..d649ad6 100644 --- a/src/app/virtualbox/src/VBox/Devices/USB/VUSBDevice.cpp +++ b/src/app/virtualbox/src/VBox/Devices/USB/VUSBDevice.cpp @@ -230,7 +230,14 @@ bool vusbDevDoSelectConfig(PVUSBDEV pDev, PCVUSBDESCCONFIGEX pCfgDesc) @@ -38,7 +34,18 @@ index 4790fcb..4efa818 100644 } } memset(pDev->paIfStates, 0, pCfgDesc->Core.bNumInterfaces * sizeof(pDev->paIfStates[0])); -@@ -1134,7 +1141,7 @@ static DECLCALLBACK(int) vusbDevUrbIoThread(RTTHREAD hThread, void *pvUser) +@@ -1089,8 +1096,10 @@ static DECLCALLBACK(int) vusbDevCancelAllUrbsWorker(PVUSBDEV pDev, bool fDetachi + PVUSBURB pNext = pUrb->VUsb.pNext; + Assert(pUrb->VUsb.pDev == pDev); + ++#if 0 + AssertMsgFailed(("%s: Leaking left over URB! state=%d pDev=%p[%s]\n", + pUrb->pszDesc, pUrb->enmState, pDev, pDev->pUsbIns->pszName)); ++#endif + vusbUrbUnlink(pUrb); + /* Unlink isn't enough, because boundary timer and detaching will try to reap it. + * It was tested with MSD & iphone attachment to vSMP guest, if +@@ -1134,7 +1143,7 @@ static DECLCALLBACK(int) vusbDevUrbIoThread(RTTHREAD hThread, void *pvUser) vusbUrbDoReapAsyncDev(pDev, RT_INDEFINITE_WAIT); /* Process any URBs waiting to be cancelled first. */ @@ -84,41 +91,21 @@ index 2f01f69..9b13e37 100644 private: -diff --git a/src/app/virtualbox/src/VBox/Main/src-server/MachineImpl.cpp b/src/app/virtualbox/src/VBox/Main/src-server/MachineImpl.cpp -index 5fcb53c..b4016b2 100644 ---- a/src/app/virtualbox/src/VBox/Main/src-server/MachineImpl.cpp -+++ b/src/app/virtualbox/src/VBox/Main/src-server/MachineImpl.cpp -@@ -13582,6 +13582,7 @@ STDMETHODIMP SessionMachine::AutoCaptureUSBDevices() - AutoCaller autoCaller(this); - AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); +diff --git a/src/app/virtualbox/src/VBox/Main/src-client/ConsoleImpl.cpp b/src/app/virtualbox/src/VBox/Main/src-client/ConsoleImpl.cpp +index 141bb98..43cedfe 100644 +--- a/src/app/virtualbox/src/VBox/Main/src-client/ConsoleImpl.cpp ++++ b/src/app/virtualbox/src/VBox/Main/src-client/ConsoleImpl.cpp +@@ -9136,10 +9136,9 @@ HRESULT Console::captureUSBDevices(PUVM pUVM) + * us back from under its lock (e.g. onUSBDeviceAttach()) which would + * produce an inter-process dead-lock otherwise. */ + alock.release(); +-#if 0 ++ + HRESULT hrc = mControl->AutoCaptureUSBDevices(); + ComAssertComRCRetRC(hrc); +-#endif + } -+#if 0 - #ifdef VBOX_WITH_USB - HRESULT rc = mUSBDeviceFilters->notifyProxy(true /* aInsertFilters */); - AssertComRC(rc); -@@ -13590,6 +13591,7 @@ STDMETHODIMP SessionMachine::AutoCaptureUSBDevices() - USBProxyService *service = mParent->host()->usbProxyService(); - AssertReturn(service, E_FAIL); - return service->autoCaptureDevicesForVM(this); -+#endif /* if 0 */ - #else - return S_OK; - #endif -@@ -13612,6 +13614,7 @@ STDMETHODIMP SessionMachine::DetachAllUSBDevices(BOOL aDone) - AutoCaller autoCaller(this); - AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); - -+#if 0 - #ifdef VBOX_WITH_USB - HRESULT rc = mUSBDeviceFilters->notifyProxy(false /* aInsertFilters */); - AssertComRC(rc); -@@ -13620,6 +13623,7 @@ STDMETHODIMP SessionMachine::DetachAllUSBDevices(BOOL aDone) - 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; diff --git a/src/app/virtualbox/src/VBox/Main/src-server/USBDeviceFiltersImpl.cpp b/src/app/virtualbox/src/VBox/Main/src-server/USBDeviceFiltersImpl.cpp index 09b42f5..c179ca6 100644 diff --git a/repos/ports/src/virtualbox/patches/vbox_main.patch b/repos/ports/src/virtualbox/patches/vbox_main.patch index ccddad538..a7bcc394c 100644 --- a/repos/ports/src/virtualbox/patches/vbox_main.patch +++ b/repos/ports/src/virtualbox/patches/vbox_main.patch @@ -325,16 +325,18 @@ index b43f5a6..6aef9df 100644 //////////////////////////////////////////////////////////////////////////////// // diff --git a/src/app/virtualbox/src/VBox/Main/src-client/ConsoleImpl.cpp b/src/app/virtualbox/src/VBox/Main/src-client/ConsoleImpl.cpp -index 69e3109..9ed6cdd 100644 +index 69e3109..141bb98 100644 --- a/src/app/virtualbox/src/VBox/Main/src-client/ConsoleImpl.cpp +++ b/src/app/virtualbox/src/VBox/Main/src-client/ConsoleImpl.cpp -@@ -51,23 +51,32 @@ +@@ -51,23 +51,34 @@ #include "KeyboardImpl.h" #include "MouseImpl.h" #include "DisplayImpl.h" +#if 0 #include "MachineDebuggerImpl.h" ++#endif #include "USBDeviceImpl.h" ++#if 0 #include "RemoteUSBDeviceImpl.h" +#endif #include "SharedFolderImpl.h" @@ -361,7 +363,7 @@ index 69e3109..9ed6cdd 100644 #include "VBoxEvents.h" #include "AutoCaller.h" -@@ -75,7 +84,9 @@ +@@ -75,7 +86,9 @@ #include #include "VBox/com/ErrorInfo.h" @@ -371,7 +373,7 @@ index 69e3109..9ed6cdd 100644 #include #include -@@ -90,6 +101,7 @@ +@@ -90,14 +103,17 @@ #include #include @@ -379,7 +381,17 @@ index 69e3109..9ed6cdd 100644 #include #include #include -@@ -109,14 +121,17 @@ + #include + #include ++#endif + #ifdef VBOX_WITH_USB + # include + #endif ++#if 0 + #ifdef VBOX_WITH_NETSHAPER + # include + #endif /* VBOX_WITH_NETSHAPER */ +@@ -109,14 +125,17 @@ #include #include @@ -398,7 +410,7 @@ index 69e3109..9ed6cdd 100644 #include #include #include // for auto_ptr -@@ -278,6 +293,8 @@ struct VMSaveTask : public VMTask +@@ -278,6 +297,8 @@ struct VMSaveTask : public VMTask Reason_T mReason; }; @@ -407,7 +419,7 @@ index 69e3109..9ed6cdd 100644 // Handler for global events //////////////////////////////////////////////////////////////////////////////// inline static const char *networkAdapterTypeToName(NetworkAdapterType_T adapterType); -@@ -383,6 +400,7 @@ typedef ListenerImpl VmEventListenerImpl; +@@ -383,6 +404,7 @@ typedef ListenerImpl VmEventListenerImpl; VBOX_LISTENER_DECLARE(VmEventListenerImpl) @@ -415,7 +427,7 @@ index 69e3109..9ed6cdd 100644 // constructor / destructor ///////////////////////////////////////////////////////////////////////////// -@@ -530,6 +548,7 @@ HRESULT Console::init(IMachine *aMachine, IInternalMachineControl *aControl, Loc +@@ -530,6 +552,7 @@ HRESULT Console::init(IMachine *aMachine, IInternalMachineControl *aControl, Loc rc = mDisplay->init(this); AssertComRCReturnRC(rc); @@ -423,7 +435,7 @@ index 69e3109..9ed6cdd 100644 unconst(mVRDEServerInfo).createObject(); rc = mVRDEServerInfo->init(this); AssertComRCReturnRC(rc); -@@ -538,6 +557,7 @@ HRESULT Console::init(IMachine *aMachine, IInternalMachineControl *aControl, Loc +@@ -538,6 +561,7 @@ HRESULT Console::init(IMachine *aMachine, IInternalMachineControl *aControl, Loc rc = mEmulatedUSB->init(this); AssertComRCReturnRC(rc); @@ -431,7 +443,7 @@ index 69e3109..9ed6cdd 100644 /* Grab global and machine shared folder lists */ rc = fetchSharedFolders(true /* aGlobal */); -@@ -545,10 +565,12 @@ HRESULT Console::init(IMachine *aMachine, IInternalMachineControl *aControl, Loc +@@ -545,10 +569,12 @@ HRESULT Console::init(IMachine *aMachine, IInternalMachineControl *aControl, Loc rc = fetchSharedFolders(false /* aGlobal */); AssertComRCReturnRC(rc); @@ -444,7 +456,7 @@ index 69e3109..9ed6cdd 100644 /* Figure out size of meAttachmentType vector */ ComPtr pVirtualBox; -@@ -574,9 +596,11 @@ HRESULT Console::init(IMachine *aMachine, IInternalMachineControl *aControl, Loc +@@ -574,9 +600,11 @@ HRESULT Console::init(IMachine *aMachine, IInternalMachineControl *aControl, Loc // unconst(m_pVMMDev) = new VMMDev(this); // AssertReturn(mVMMDev, E_FAIL); @@ -456,7 +468,7 @@ index 69e3109..9ed6cdd 100644 FirmwareType_T enmFirmwareType; mMachine->COMGETTER(FirmwareType)(&enmFirmwareType); if ( enmFirmwareType == FirmwareType_EFI -@@ -584,8 +608,10 @@ HRESULT Console::init(IMachine *aMachine, IInternalMachineControl *aControl, Loc +@@ -584,8 +612,10 @@ HRESULT Console::init(IMachine *aMachine, IInternalMachineControl *aControl, Loc || enmFirmwareType == FirmwareType_EFI64 || enmFirmwareType == FirmwareType_EFIDUAL) { @@ -467,7 +479,7 @@ index 69e3109..9ed6cdd 100644 } #ifdef VBOX_WITH_USB_CARDREADER -@@ -593,6 +619,7 @@ HRESULT Console::init(IMachine *aMachine, IInternalMachineControl *aControl, Loc +@@ -593,6 +623,7 @@ HRESULT Console::init(IMachine *aMachine, IInternalMachineControl *aControl, Loc AssertReturn(mUsbCardReader, E_FAIL); #endif @@ -475,7 +487,7 @@ index 69e3109..9ed6cdd 100644 /* VirtualBox events registration. */ { ComPtr pES; -@@ -609,6 +636,7 @@ HRESULT Console::init(IMachine *aMachine, IInternalMachineControl *aControl, Loc +@@ -609,6 +640,7 @@ HRESULT Console::init(IMachine *aMachine, IInternalMachineControl *aControl, Loc rc = pES->RegisterListener(aVmListener, ComSafeArrayAsInParam(eventTypes), true); AssertComRC(rc); } @@ -483,7 +495,7 @@ index 69e3109..9ed6cdd 100644 } /* Confirm a successful initialization when it's the case */ -@@ -625,6 +653,7 @@ HRESULT Console::init(IMachine *aMachine, IInternalMachineControl *aControl, Loc +@@ -625,6 +657,7 @@ HRESULT Console::init(IMachine *aMachine, IInternalMachineControl *aControl, Loc return S_OK; } @@ -491,7 +503,7 @@ index 69e3109..9ed6cdd 100644 /** * Uninitializes the Console object. */ -@@ -1035,6 +1064,8 @@ void Console::guestPropertiesVRDPUpdateDisconnect(uint32_t u32ClientId) +@@ -1035,6 +1068,8 @@ void Console::guestPropertiesVRDPUpdateDisconnect(uint32_t u32ClientId) #endif /* VBOX_WITH_GUEST_PROPS */ @@ -500,7 +512,7 @@ index 69e3109..9ed6cdd 100644 bool Console::isResetTurnedIntoPowerOff(void) { Bstr value; -@@ -1046,6 +1077,8 @@ bool Console::isResetTurnedIntoPowerOff(void) +@@ -1046,6 +1081,8 @@ bool Console::isResetTurnedIntoPowerOff(void) return false; } @@ -509,7 +521,7 @@ index 69e3109..9ed6cdd 100644 #ifdef VBOX_WITH_EXTPACK /** * Used by VRDEServer and others to talke to the extension pack manager. -@@ -1505,6 +1538,7 @@ void Console::VRDPInterceptClipboard(uint32_t u32ClientId) +@@ -1505,6 +1542,7 @@ void Console::VRDPInterceptClipboard(uint32_t u32ClientId) return; } @@ -517,7 +529,7 @@ index 69e3109..9ed6cdd 100644 //static const char *Console::sSSMConsoleUnit = "ConsoleData"; -@@ -1970,6 +2004,8 @@ STDMETHODIMP Console::COMGETTER(Display)(IDisplay **aDisplay) +@@ -1970,6 +2008,8 @@ STDMETHODIMP Console::COMGETTER(Display)(IDisplay **aDisplay) return S_OK; } @@ -526,7 +538,7 @@ index 69e3109..9ed6cdd 100644 STDMETHODIMP Console::COMGETTER(Debugger)(IMachineDebugger **aDebugger) { CheckComArgOutPointerValid(aDebugger); -@@ -2069,6 +2105,7 @@ Console::COMGETTER(SharedFolders)(ComSafeArrayOut(ISharedFolder *, aSharedFolder +@@ -2069,6 +2109,7 @@ Console::COMGETTER(SharedFolders)(ComSafeArrayOut(ISharedFolder *, aSharedFolder return S_OK; } @@ -534,7 +546,7 @@ index 69e3109..9ed6cdd 100644 STDMETHODIMP Console::COMGETTER(EventSource)(IEventSource ** aEventSource) { -@@ -2085,6 +2122,8 @@ STDMETHODIMP Console::COMGETTER(EventSource)(IEventSource ** aEventSource) +@@ -2085,6 +2126,8 @@ STDMETHODIMP Console::COMGETTER(EventSource)(IEventSource ** aEventSource) return hrc; } @@ -543,7 +555,7 @@ index 69e3109..9ed6cdd 100644 STDMETHODIMP Console::COMGETTER(AttachedPCIDevices)(ComSafeArrayOut(IPCIDeviceAttachment *, aAttachments)) { CheckComArgOutSafeArrayPointerValid(aAttachments); -@@ -2134,6 +2173,7 @@ STDMETHODIMP Console::COMSETTER(UseHostClipboard)(BOOL aUseHostClipboard) +@@ -2134,6 +2177,7 @@ STDMETHODIMP Console::COMSETTER(UseHostClipboard)(BOOL aUseHostClipboard) // IConsole methods ///////////////////////////////////////////////////////////////////////////// @@ -551,7 +563,7 @@ index 69e3109..9ed6cdd 100644 STDMETHODIMP Console::PowerUp(IProgress **aProgress) { -@@ -2291,6 +2331,8 @@ STDMETHODIMP Console::PowerDown(IProgress **aProgress) +@@ -2291,6 +2335,8 @@ STDMETHODIMP Console::PowerDown(IProgress **aProgress) return rc; } @@ -560,7 +572,7 @@ index 69e3109..9ed6cdd 100644 STDMETHODIMP Console::Reset() { LogFlowThisFuncEnter(); -@@ -3451,6 +3493,8 @@ STDMETHODIMP Console::RestoreSnapshot(ISnapshot *aSnapshot, IProgress **aProgres +@@ -3451,6 +3497,8 @@ STDMETHODIMP Console::RestoreSnapshot(ISnapshot *aSnapshot, IProgress **aProgres return S_OK; } @@ -569,7 +581,7 @@ index 69e3109..9ed6cdd 100644 // Non-interface public methods ///////////////////////////////////////////////////////////////////////////// -@@ -3526,6 +3570,8 @@ HRESULT Console::convertBusPortDeviceToLun(StorageBus_T enmBus, LONG port, LONG +@@ -3526,6 +3574,8 @@ HRESULT Console::convertBusPortDeviceToLun(StorageBus_T enmBus, LONG port, LONG } } @@ -578,7 +590,7 @@ index 69e3109..9ed6cdd 100644 // private methods ///////////////////////////////////////////////////////////////////////////// -@@ -4388,6 +4434,8 @@ HRESULT Console::onNATRedirectRuleChange(ULONG ulInstance, BOOL aNatRuleRemove, +@@ -4388,6 +4438,8 @@ HRESULT Console::onNATRedirectRuleChange(ULONG ulInstance, BOOL aNatRuleRemove, return rc; } @@ -587,7 +599,7 @@ index 69e3109..9ed6cdd 100644 VMMDevMouseInterface *Console::getVMMDevMouseInterface() { return m_pVMMDev; -@@ -4398,6 +4446,8 @@ DisplayMouseInterface *Console::getDisplayMouseInterface() +@@ -4398,6 +4450,8 @@ DisplayMouseInterface *Console::getDisplayMouseInterface() return mDisplay; } @@ -596,7 +608,25 @@ index 69e3109..9ed6cdd 100644 /** * Parses one key value pair. * -@@ -6490,6 +6540,8 @@ void Console::onMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelati +@@ -5333,6 +5387,8 @@ HRESULT Console::onSharedFolderChange(BOOL aGlobal) + return rc; + } + ++#endif ++ + /** + * Called by IInternalSessionControl::OnUSBDeviceAttach() or locally by + * processRemoteUSBDevices() after IInternalMachineControl::RunUSBDeviceFilters() +@@ -5499,7 +5555,7 @@ HRESULT Console::onUSBDeviceDetach(IN_BSTR aId, + return E_FAIL; + #endif /* !VBOX_WITH_USB */ + } +- ++#if 0 + /** + * Called by IInternalSessionControl::OnBandwidthGroupChange(). + * +@@ -6490,6 +6546,8 @@ void Console::onMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelati fireMouseCapabilityChangedEvent(mEventSource, supportsAbsolute, supportsRelative, supportsMT, needsHostCursor); } @@ -605,7 +635,7 @@ index 69e3109..9ed6cdd 100644 void Console::onStateChange(MachineState_T machineState) { AutoCaller autoCaller(this); -@@ -6497,6 +6549,8 @@ void Console::onStateChange(MachineState_T machineState) +@@ -6497,6 +6555,8 @@ void Console::onStateChange(MachineState_T machineState) fireStateChangedEvent(mEventSource, machineState); } @@ -614,7 +644,7 @@ index 69e3109..9ed6cdd 100644 void Console::onAdditionsStateChange() { AutoCaller autoCaller(this); -@@ -6555,6 +6609,8 @@ void Console::onUSBDeviceStateChange(IUSBDevice *aDevice, bool aAttached, +@@ -6555,6 +6615,8 @@ void Console::onUSBDeviceStateChange(IUSBDevice *aDevice, bool aAttached, fireUSBDeviceStateChangedEvent(mEventSource, aDevice, aAttached, aError); } @@ -623,7 +653,7 @@ index 69e3109..9ed6cdd 100644 void Console::onRuntimeError(BOOL aFatal, IN_BSTR aErrorID, IN_BSTR aMessage) { AutoCaller autoCaller(this); -@@ -6563,6 +6619,8 @@ void Console::onRuntimeError(BOOL aFatal, IN_BSTR aErrorID, IN_BSTR aMessage) +@@ -6563,6 +6625,8 @@ void Console::onRuntimeError(BOOL aFatal, IN_BSTR aErrorID, IN_BSTR aMessage) fireRuntimeErrorEvent(mEventSource, aFatal, aErrorID, aMessage); } @@ -632,7 +662,7 @@ index 69e3109..9ed6cdd 100644 HRESULT Console::onShowWindow(BOOL aCheck, BOOL *aCanShow, LONG64 *aWinId) { AssertReturn(aCanShow, E_POINTER); -@@ -6626,6 +6684,8 @@ HRESULT Console::onShowWindow(BOOL aCheck, BOOL *aCanShow, LONG64 *aWinId) +@@ -6626,6 +6690,8 @@ HRESULT Console::onShowWindow(BOOL aCheck, BOOL *aCanShow, LONG64 *aWinId) return S_OK; } @@ -641,7 +671,7 @@ index 69e3109..9ed6cdd 100644 // private methods //////////////////////////////////////////////////////////////////////////////// -@@ -6819,6 +6879,8 @@ HRESULT Console::consoleInitReleaseLog(const ComPtr aMachine) +@@ -6819,6 +6885,8 @@ HRESULT Console::consoleInitReleaseLog(const ComPtr aMachine) } } @@ -650,7 +680,7 @@ index 69e3109..9ed6cdd 100644 char szError[RTPATH_MAX + 128]; int vrc = com::VBoxLogRelCreate("VM", logFile.c_str(), RTLOGFLAGS_PREFIX_TIME_PROG | RTLOGFLAGS_RESTRICT_GROUPS, -@@ -6839,6 +6901,8 @@ HRESULT Console::consoleInitReleaseLog(const ComPtr aMachine) +@@ -6839,6 +6907,8 @@ HRESULT Console::consoleInitReleaseLog(const ComPtr aMachine) if (SUCCEEDED(hrc) || cHistoryFiles) RTDirFlush(logDir.c_str()); @@ -659,7 +689,7 @@ index 69e3109..9ed6cdd 100644 return hrc; } -@@ -7113,6 +7177,10 @@ HRESULT Console::powerUp(IProgress **aProgress, bool aPaused) +@@ -7113,6 +7183,10 @@ HRESULT Console::powerUp(IProgress **aProgress, bool aPaused) } #endif @@ -670,7 +700,7 @@ index 69e3109..9ed6cdd 100644 // If there is immutable drive the process that. VMPowerUpTask::ProgressList progresses(task->hardDiskProgresses); -@@ -7123,7 +7191,8 @@ HRESULT Console::powerUp(IProgress **aProgress, bool aPaused) +@@ -7123,7 +7197,8 @@ HRESULT Console::powerUp(IProgress **aProgress, bool aPaused) ++cOperations; ulTotalOperationsWeight += 1; } @@ -680,7 +710,7 @@ index 69e3109..9ed6cdd 100644 progressDesc.raw(), TRUE, // Cancelable cOperations, -@@ -7136,13 +7205,15 @@ HRESULT Console::powerUp(IProgress **aProgress, bool aPaused) +@@ -7136,13 +7211,15 @@ HRESULT Console::powerUp(IProgress **aProgress, bool aPaused) else if ( mMachineState == MachineState_Saved || (!fTeleporterEnabled && !fFaultToleranceSyncEnabled)) { @@ -698,7 +728,7 @@ index 69e3109..9ed6cdd 100644 progressDesc.raw(), TRUE /* aCancelable */, 3 /* cOperations */, -@@ -7153,7 +7224,8 @@ HRESULT Console::powerUp(IProgress **aProgress, bool aPaused) +@@ -7153,7 +7230,8 @@ HRESULT Console::powerUp(IProgress **aProgress, bool aPaused) } else if (fFaultToleranceSyncEnabled) { @@ -708,7 +738,7 @@ index 69e3109..9ed6cdd 100644 progressDesc.raw(), TRUE /* aCancelable */, 3 /* cOperations */, -@@ -7399,6 +7471,7 @@ HRESULT Console::powerDown(IProgress *aProgress /*= NULL*/) +@@ -7399,6 +7477,7 @@ HRESULT Console::powerDown(IProgress *aProgress /*= NULL*/) * safe to release the object lock now if needed) * ---------------------------------------------------------------------- */ @@ -716,7 +746,7 @@ index 69e3109..9ed6cdd 100644 /* Stop the VRDP server to prevent new clients connection while VM is being * powered off. */ if (mConsoleVRDPServer) -@@ -7413,6 +7486,7 @@ HRESULT Console::powerDown(IProgress *aProgress /*= NULL*/) +@@ -7413,6 +7492,7 @@ HRESULT Console::powerDown(IProgress *aProgress /*= NULL*/) alock.acquire(); } @@ -724,7 +754,7 @@ index 69e3109..9ed6cdd 100644 /* advance percent count */ if (aProgress) -@@ -7649,6 +7723,8 @@ HRESULT Console::setMachineState(MachineState_T aMachineState, +@@ -7649,6 +7729,8 @@ HRESULT Console::setMachineState(MachineState_T aMachineState, return rc; } @@ -733,7 +763,7 @@ index 69e3109..9ed6cdd 100644 /** * Searches for a shared folder with the given logical name * in the collection of shared folders. -@@ -7684,6 +7760,8 @@ HRESULT Console::findSharedFolder(const Utf8Str &strName, +@@ -7684,6 +7766,8 @@ HRESULT Console::findSharedFolder(const Utf8Str &strName, return VBOX_E_FILE_ERROR; } @@ -742,7 +772,7 @@ index 69e3109..9ed6cdd 100644 /** * Fetches the list of global or machine shared folders from the server. * -@@ -8353,6 +8431,8 @@ DECLCALLBACK(void) Console::vmstateChangeCallback(PUVM pUVM, VMSTATE enmState, V +@@ -8353,6 +8437,8 @@ DECLCALLBACK(void) Console::vmstateChangeCallback(PUVM pUVM, VMSTATE enmState, V } } @@ -751,7 +781,57 @@ index 69e3109..9ed6cdd 100644 /** * Changes the clipboard mode. * -@@ -8875,6 +8955,8 @@ HRESULT Console::detachFromTapInterface(INetworkAdapter *networkAdapter) +@@ -8426,7 +8512,7 @@ void Console::changeDragAndDropMode(DragAndDropMode_T aDragAndDropMode) + + pVMMDev->hgcmHostCall("VBoxDragAndDropSvc", DragAndDropSvc::HOST_DND_SET_MODE, 1, &parm); + } +- ++#endif /* if 0 */ + #ifdef VBOX_WITH_USB + /** + * Sends a request to VMM to attach the given host device. +@@ -8472,6 +8558,7 @@ HRESULT Console::attachUSBDevice(IUSBDevice *aHostDevice, ULONG aMaskedIfs) + Address.c_str(), uuid.raw())); + + void *pvRemoteBackend = NULL; ++#if 0 + if (fRemote) + { + RemoteUSBDevice *pRemoteUSBDevice = static_cast(aHostDevice); +@@ -8479,7 +8566,7 @@ HRESULT Console::attachUSBDevice(IUSBDevice *aHostDevice, ULONG aMaskedIfs) + if (!pvRemoteBackend) + return E_INVALIDARG; /* The clientId is invalid then. */ + } +- ++#endif + USHORT portVersion = 1; + hrc = aHostDevice->COMGETTER(PortVersion)(&portVersion); + AssertComRCReturnRC(hrc); +@@ -8590,12 +8677,13 @@ HRESULT Console::detachUSBDevice(const ComObjPtr &aHostDevice) + setErrorStatic(hrc2, "GetRemote() failed"); + + PCRTUUID pUuid = aHostDevice->id().raw(); ++#if 0 + if (fRemote) + { + Guid guid(*pUuid); + consoleVRDPServer()->USBBackendReleasePointer(&guid); + } +- ++#endif + alock.release(); + int vrc = VMR3ReqCallWaitU(ptrVM.rawUVM(), 0 /* idDstCpu (saved state, see #6232) */, + (PFNRT)usbDetachCallback, 5, +@@ -8639,7 +8727,7 @@ Console::usbDetachCallback(Console *that, PUVM pUVM, PCRTUUID aUuid) + return vrc; + } + #endif /* VBOX_WITH_USB */ +- ++#if 0 + /* Note: FreeBSD needs this whether netflt is used or not. */ + #if ((defined(RT_OS_LINUX) && !defined(VBOX_WITH_NETFLT)) || defined(RT_OS_FREEBSD)) + /** +@@ -8875,6 +8963,8 @@ HRESULT Console::detachFromTapInterface(INetworkAdapter *networkAdapter) } #endif /* (RT_OS_LINUX || RT_OS_FREEBSD) && !VBOX_WITH_NETFLT */ @@ -760,7 +840,7 @@ index 69e3109..9ed6cdd 100644 /** * Called at power down to terminate host interface networking. * -@@ -9046,9 +9128,10 @@ HRESULT Console::captureUSBDevices(PUVM pUVM) +@@ -9046,9 +9136,10 @@ HRESULT Console::captureUSBDevices(PUVM pUVM) * us back from under its lock (e.g. onUSBDeviceAttach()) which would * produce an inter-process dead-lock otherwise. */ alock.release(); @@ -772,7 +852,7 @@ index 69e3109..9ed6cdd 100644 } return S_OK; -@@ -9077,6 +9160,8 @@ void Console::detachAllUSBDevices(bool aDone) +@@ -9077,6 +9168,8 @@ void Console::detachAllUSBDevices(bool aDone) mControl->DetachAllUSBDevices(aDone); } @@ -781,7 +861,7 @@ index 69e3109..9ed6cdd 100644 /** * @note Locks this object for writing. */ -@@ -9249,6 +9334,8 @@ void Console::processRemoteUSBDevices(uint32_t u32ClientId, VRDEUSBDEVICEDESC *p +@@ -9249,6 +9342,8 @@ void Console::processRemoteUSBDevices(uint32_t u32ClientId, VRDEUSBDEVICEDESC *p LogFlowThisFuncLeave(); } @@ -790,7 +870,7 @@ index 69e3109..9ed6cdd 100644 /** * Progress cancelation callback for fault tolerance VM poweron */ -@@ -9346,6 +9433,7 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser) +@@ -9346,6 +9441,7 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser) /* Create the VRDP server. In case of headless operation, this will * also create the framebuffer, required at VM creation. */ @@ -798,7 +878,7 @@ index 69e3109..9ed6cdd 100644 ConsoleVRDPServer *server = pConsole->consoleVRDPServer(); Assert(server); -@@ -9392,6 +9480,7 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser) +@@ -9392,6 +9488,7 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser) vrc, errMsg.c_str())); throw setErrorStatic(E_FAIL, errMsg.c_str()); } @@ -806,7 +886,7 @@ index 69e3109..9ed6cdd 100644 ComPtr pMachine = pConsole->machine(); ULONG cCpus = 1; -@@ -9416,8 +9505,10 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser) +@@ -9416,8 +9513,10 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser) alock.acquire(); @@ -817,7 +897,7 @@ index 69e3109..9ed6cdd 100644 if (RT_SUCCESS(vrc)) { -@@ -9441,9 +9532,11 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser) +@@ -9441,9 +9540,11 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser) /* * Synchronize debugger settings */ @@ -829,7 +909,7 @@ index 69e3109..9ed6cdd 100644 /* * Shared Folders -@@ -9719,6 +9812,7 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser) +@@ -9719,6 +9820,7 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser) return VINF_SUCCESS; } @@ -837,7 +917,7 @@ index 69e3109..9ed6cdd 100644 /** * Reconfigures a medium attachment (part of taking or deleting an online snapshot). -@@ -10209,6 +10303,8 @@ DECLCALLBACK(int) Console::saveStateThread(RTTHREAD Thread, void *pvUser) +@@ -10209,6 +10311,8 @@ DECLCALLBACK(int) Console::saveStateThread(RTTHREAD Thread, void *pvUser) return VINF_SUCCESS; } @@ -846,7 +926,7 @@ index 69e3109..9ed6cdd 100644 /** * Thread for powering down the Console. * -@@ -10367,8 +10463,6 @@ Console::i_pdmIfSecKey_KeyRelease(PPDMISECKEY pInterface, const char *pszId) +@@ -10367,8 +10471,6 @@ Console::i_pdmIfSecKey_KeyRelease(PPDMISECKEY pInterface, const char *pszId) } @@ -855,7 +935,7 @@ index 69e3109..9ed6cdd 100644 /** * The Main status driver instance data. */ -@@ -10461,9 +10555,11 @@ DECLCALLBACK(int) Console::drvStatus_MediumEjected(PPDMIMEDIANOTIFY pInterface, +@@ -10461,9 +10563,11 @@ DECLCALLBACK(int) Console::drvStatus_MediumEjected(PPDMIMEDIANOTIFY pInterface, alock.release(); ComPtr pNewMediumAtt; diff --git a/repos/ports/src/virtualbox/target.mk b/repos/ports/src/virtualbox/target.mk index c0d5aaf98..e503fa826 100644 --- a/repos/ports/src/virtualbox/target.mk +++ b/repos/ports/src/virtualbox/target.mk @@ -10,6 +10,7 @@ SRC_CC = frontend/main.cc frontend/console.cc \ frontend/VBoxAPIWrap/MediumFormatWrap.cpp \ frontend/VBoxAPIWrap/TokenWrap.cpp \ frontend/VirtualBoxErrorInfoImpl.cpp \ + frontend/USBProxyDevice-genode.cpp \ devices.cc drivers.cc dummies.cc libc.cc \ logger.cc mm.cc pdm.cc pgm.cc rt.cc sup.cc iommio.cc ioport.cc \ hm.cc thread.cc dynlib.cc unimpl.cc @@ -30,6 +31,8 @@ INC_DIR += $(call select_from_repositories,src/lib/pthread) INC_DIR += $(VBOX_DIR)/Runtime/include +SRC_CC += HostDrivers/VBoxUSB/USBFilter.cpp + SRC_CC += HostServices/SharedFolders/service.cpp SRC_CC += HostServices/SharedFolders/mappings.cpp SRC_CC += HostServices/SharedFolders/vbsf.cpp @@ -46,6 +49,7 @@ INC_DIR += $(REP_DIR)/src/virtualbox/frontend INC_DIR += $(REP_DIR)/src/virtualbox/frontend/VBoxAPIWrap INC_DIR += $(VBOX_DIR)/Main/xml +INC_DIR += $(VBOX_DIR)/Devices/USB # search path to 'scan_code_set_2.h' INC_DIR += $(call select_from_repositories,src/drivers/input/ps2) diff --git a/repos/ports/src/virtualbox/unimpl.cc b/repos/ports/src/virtualbox/unimpl.cc index cc72b199c..5b5d1fcc4 100644 --- a/repos/ports/src/virtualbox/unimpl.cc +++ b/repos/ports/src/virtualbox/unimpl.cc @@ -123,8 +123,6 @@ DUMMY(RTPathAppend) DUMMY(RTPathChangeToDosSlashes) DUMMY(RTSemEventWaitEx) -DUMMY(RTMemDupExTag) -DUMMY(RTMemDupTag) DUMMY(RTMemExecFree) DUMMY(SELMR3GetSelectorInfo)