From 5c96e9cb56358de2e81c231f97b86ed66eee8080 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Wed, 10 Jun 2026 09:22:32 +0800 Subject: [PATCH] usbip: fix VBoxUSBMon capture filter type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit USBFILTERTYPE has CAPTURE = 4; the encoded value 5 is END, the enum's out-of-range sentinel, which USBFilterValidate rejects with a negative rc — so ADD_FILTER never installed a filter and no device could be captured. --- common/vboxusb/monitor_windows.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/vboxusb/monitor_windows.go b/common/vboxusb/monitor_windows.go index 803e5e3d8..3b9c70695 100644 --- a/common/vboxusb/monitor_windows.go +++ b/common/vboxusb/monitor_windows.go @@ -136,7 +136,7 @@ func (m *Monitor) ioctl(code uint32, in []byte, out []byte) (uint32, error) { // Layout (offsets): // // 0 u32Magic uint32 (0x19670408) -// 4 enmType uint32 (5 = CAPTURE) +// 4 enmType uint32 (4 = CAPTURE) // 8 aFields [11]{enmMatch uint16, u16Value uint16} (44 bytes) // 52 offCurEnd uint32 (0) // 56 achStrTab [256]byte (0) @@ -148,7 +148,7 @@ func (m *Monitor) ioctl(code uint32, in []byte, out []byte) (uint32, error) { func encodeFilter(f Filter) [312]byte { const ( filterMagic uint32 = 0x19670408 - filterCapture uint32 = 5 // UsbFilterType.CAPTURE + filterCapture uint32 = 4 // UsbFilterType.CAPTURE (5 is END, the enum sentinel) matchIgnore uint16 = 1 // UsbFilterMatch.IGNORE matchNumExact uint16 = 3 // UsbFilterMatch.NUM_EXACT )