git: 1a6d06fb4120 - 2024Q3 - emulators/virtualbox-ose{,-nox11}: fix USB passthrough fails with: Failed to create a proxy device for the USB device

From: Vladimir Druzenko <vvd_at_FreeBSD.org>
Date: Sat, 20 Jul 2024 09:38:58 UTC
The branch 2024Q3 has been updated by vvd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=1a6d06fb4120fc253a48b3b95342748ddd2a651f

commit 1a6d06fb4120fc253a48b3b95342748ddd2a651f
Author:     Igor Malyshev <bsd@itglob.ru>
AuthorDate: 2024-07-20 09:19:29 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2024-07-20 09:38:25 +0000

    emulators/virtualbox-ose{,-nox11}: fix USB passthrough fails with: Failed to create a proxy device for the USB device
    
    Failed to create a proxy device for the USB device. (Error: VERR_INVALID_PARAMETER)
    
    00:00:24.961804 usbProxyConstruct: Failed to open '/dev/ugen0.6', rc=VERR_INVALID_PARAMETER
    
    00:00:24.961881 ERROR [COM]: aRC=NS_ERROR_FAILURE (0x80004005) aIID={872da645-4a9b-1727-bee2-5585105b9eed} aComponent={ConsoleWrap} aText={Failed to create a proxy device for the USB device. (Error: VERR_INVALID_PARAMETER)}, preserve=false aResultDetail=-2
    
    In commit https://cgit.freebsd.org/src/commit/?id=9b077d72bcc313baea2b9283afc7f568739eaadc
    +#define        USB_FS_XFER_MAX 126
    -       if (fs_ep_ptr == NULL || ep_index_max > 127)
    +       if (fs_ep_ptr == NULL || ep_index_max > USB_FS_XFER_MAX)
    To fix VirtualBox decrease USBFBSD_MAXENDPOINTS from 127 to 126:
    -#define USBFBSD_MAXENDPOINTS 127
    +#define USBFBSD_MAXENDPOINTS 126
    
    PR:             270900
    Tested by:      groenveld@acm.org, russo@bogodyn.org
    Approved by:    with hat of vbox (maintainer)
    MFH:            2024Q3
    
    (cherry picked from commit fb231153bf5b66737effcc6b2ca22296893d7510)
---
 emulators/virtualbox-ose-nox11/Makefile                       |  2 +-
 emulators/virtualbox-ose/Makefile                             |  2 +-
 .../patch-src_VBox_Devices_USB_USBProxyDevice-freebsd.cpp     | 11 +++++++++++
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/emulators/virtualbox-ose-nox11/Makefile b/emulators/virtualbox-ose-nox11/Makefile
index d2db9016af94..285b8931e189 100644
--- a/emulators/virtualbox-ose-nox11/Makefile
+++ b/emulators/virtualbox-ose-nox11/Makefile
@@ -1,4 +1,4 @@
-PORTREVISION=	1
+PORTREVISION=	2
 PKGNAMESUFFIX=	-nox11
 
 OPTIONS_EXCLUDE=	ALSA DBUS DEBUG GUESTADDITIONS DOCS NLS PULSEAUDIO \
diff --git a/emulators/virtualbox-ose/Makefile b/emulators/virtualbox-ose/Makefile
index 93cbd55a9d84..b60eff81cff8 100644
--- a/emulators/virtualbox-ose/Makefile
+++ b/emulators/virtualbox-ose/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	virtualbox-ose
 PORTVERSION=	6.1.50
-PORTREVISION?=	3
+PORTREVISION?=	4
 CATEGORIES=	emulators
 MASTER_SITES=	https://download.virtualbox.org/virtualbox/${PORTVERSION}/:src \
 		LOCAL/bofh/emulators/virtualbox-ose:docs
diff --git a/emulators/virtualbox-ose/files/patch-src_VBox_Devices_USB_USBProxyDevice-freebsd.cpp b/emulators/virtualbox-ose/files/patch-src_VBox_Devices_USB_USBProxyDevice-freebsd.cpp
new file mode 100644
index 000000000000..045e328d5c48
--- /dev/null
+++ b/emulators/virtualbox-ose/files/patch-src_VBox_Devices_USB_USBProxyDevice-freebsd.cpp
@@ -0,0 +1,11 @@
+--- src/VBox/Devices/USB/freebsd/USBProxyDevice-freebsd.cpp.orig	2024-01-11 12:23:15 UTC
++++ src/VBox/Devices/USB/freebsd/USBProxyDevice-freebsd.cpp
+@@ -57,7 +57,7 @@
+ #include "../USBProxyDevice.h"
+ 
+ /** Maximum endpoints supported. */
+-#define USBFBSD_MAXENDPOINTS 127
++#define USBFBSD_MAXENDPOINTS 126
+ #define USBFBSD_MAXFRAMES 56
+ 
+ /** This really needs to be defined in vusb.h! */