usbip: fix VBoxUSBMon capture filter type

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.
This commit is contained in:
世界
2026-06-10 09:22:32 +08:00
parent 8e1ea856e8
commit 5c96e9cb56
+2 -2
View File
@@ -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
)