Commit Graph

9 Commits

Author SHA1 Message Date
世界 0443becf97 usbip: restore VBoxUSB INF assets corrupted by line-ending normalization
The catalog signature covers the INF bytes; git's CRLF-to-LF
normalization made SetupCopyOEMInfW reject the package with
ERROR_FILE_HASH_NOT_IN_CATALOG, so the drivers could never install.
Restore the pristine upstream bytes and mark both driver asset trees
-text so checkout cannot corrupt them again.
2026-06-10 09:23:04 +08:00
世界 bb60072e01 usbip: restart device nodes so VBoxUSB capture and release take effect
VBoxUSBMon only rewrites a device's IDs while PnP enumerates it, so
adding a filter for an already-plugged device captured nothing until a
physical replug, and releasing one left it dead under VBoxUSB.sys.
Capture and release now drive the cfgmgr32 restart sequence
(query-and-remove, hub port cycle, re-setup) around the filter change,
mirroring usbipd-win's RestartingDevice.

Capture also changes the devnode's identity to the VBox stub ID, which
broke everything keyed on it: enumeration now reads the true
vendor/product/class/speed from the parent hub's descriptor cache (the
registry hardware ID reads as 80EE:CAFE once captured), data sessions
locate the VBoxUSB interface by bus/address instead of the original
instance ID, and Reconcile keeps exports alive through the
re-enumeration window with a short absence grace.
2026-06-10 09:22:55 +08:00
世界 5da1096a91 usbip: use a dedicated overlapped event per VBoxUSB ioctl
Device and Monitor shared one manual-reset event across all in-flight
IOCTLs, while the session layer runs one goroutine per endpoint: the
first completion released every GetOverlappedResult waiter with the
first operation's byte count, returning before the driver finished
writing the other buffers. Each overlappedIoctl call now owns its
event, making concurrent URBs (and aborts) on one handle safe.
2026-06-10 09:22:41 +08:00
世界 5c96e9cb56 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.
2026-06-10 09:22:32 +08:00
世界 8e1ea856e8 usbip: fix VBoxUSB ioctl codes missing the FILE_WRITE_ACCESS bit
Every SUPUSB/SUPUSBFLT CTL_CODE was computed with Access = 0 instead of
FILE_WRITE_ACCESS (2 << 14), so the driver dispatch rejected each call
with STATUS_INVALID_DEVICE_REQUEST and the export host could not even
pass monitor GET_VERSION. Values now match usbipd-win's interop
definitions (VBoxUsb.cs / VBoxUsbMon.cs).
2026-06-10 09:22:12 +08:00
世界 c3946c00a3 usbip: fix correctness findings from protocol audit
Windows export now reports the real USB link speed, probed from the
parent hub (IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX and _V2 for
SuperSpeedPlus), so SuperSpeed devices route to the correct root-hub
speed domain instead of advertising speed=0.

- protocol: pin DeviceInfoTruncated/DeviceInterface wire sizes with
  two-sided compile-time assertions so a struct change fails the build
  instead of silently mis-bounding the reader
- server: bound inbound connections with a handshake read deadline and a
  per-iteration idle deadline on the control loop, plus write deadlines
  on control writes; clear the deadline before the conn becomes a data
  session
- server: serialize import reservation under reconcileAccess so a reserve
  cannot interleave a reconcile pass that would release a busy device
- data: validate CMD_SUBMIT iso descriptor offset/length against the
  transfer buffer before forwarding to a platform engine
- darwin: make darwinUSBHostDevice.Close idempotent via sync.Once to
  avoid a double close/free under concurrent shutdown
- windows: guard windowsExport.device with a mutex and hand the claimed
  handle to a single closer
2026-06-09 14:38:23 +08:00
世界 b3fb32abc0 usbip: remove dead code, ceremonial guards, and WHAT comments 2026-06-09 10:42:36 +08:00
世界 d9704cc220 vboxusb: include upstream SPDX license stubs for embedded driver assets
The VBoxUSB.sys / VBoxUSBMon.sys / .inf / .cat binaries copied from
dorssel/usbipd-win Drivers/{x64,arm64}/ ship paired SPDX
*.license files that record Oracle's GPL-3.0-only copyright. Carrying
them next to the assets keeps the provenance discoverable.
2026-06-09 10:42:35 +08:00
世界 6a4ae5263e usbip: extract URBEngine + userspaceURBSession from darwin backend
Both the existing darwin backend and the upcoming windows backend
drive USB devices from user space (IOUSBHost CGO calls vs. VBoxUSB
IOCTLs). Refactor the per-attachment URB loop out of host_darwin.go
into a platform-agnostic userspaceURBSession that talks to a URBEngine
interface; the darwin-specific dispatch becomes a 30-line
darwinIOUSBHostEngine. Linux's kernelHandoffSession is untouched.

Move hex8 into shared.go and add usbipStatusEIO so the shared session
does not depend on golang.org/x/sys/unix (Windows has no equivalent).
2026-06-09 10:42:35 +08:00