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).
This commit is contained in:
世界
2026-05-18 12:38:47 +08:00
parent e59e14d89d
commit 6a4ae5263e
24 changed files with 2110 additions and 467 deletions
+1
View File
@@ -26,6 +26,7 @@ const (
maxUSBIPIsoPackets = 1024
nonIsoPacketCount = -1
usbipTransferFlagIsoASAP = 0x0002
usbipStatusEIO = -5
usbipStatusECONNRESET = -104
)