diff --git a/bin/usb-client b/bin/usb-client index 61ca710..ceccde1 100755 Binary files a/bin/usb-client and b/bin/usb-client differ diff --git a/bin/usb-client.exe b/bin/usb-client.exe new file mode 100755 index 0000000..a6efd2a Binary files /dev/null and b/bin/usb-client.exe differ diff --git a/bin/usb-relay b/bin/usb-relay index b66ed2f..f736f16 100755 Binary files a/bin/usb-relay and b/bin/usb-relay differ diff --git a/internal/usbip/server_windows.go b/internal/usbip/server_windows.go new file mode 100644 index 0000000..40e87c3 --- /dev/null +++ b/internal/usbip/server_windows.go @@ -0,0 +1,47 @@ +//go:build windows + +package usbip + +import ( + "fmt" + "io" + + "github.com/duffy/usb-server/internal/usb" +) + +// Server is a stub on Windows - USB/IP server requires Linux usbdevfs. +type Server struct{} + +func NewServer(dev *usb.Device) *Server { + return &Server{} +} + +func (s *Server) Attach() error { + return fmt.Errorf("USB/IP server not supported on Windows") +} + +func (s *Server) Detach() {} + +func (s *Server) BuildDeviceDescriptor() DeviceDescriptor { + return DeviceDescriptor{} +} + +func (s *Server) BuildInterfaceDescriptors() []InterfaceDescriptor { + return nil +} + +func (s *Server) HandleConnection(r io.Reader, w io.Writer) error { + return fmt.Errorf("USB/IP server not supported on Windows") +} + +func (s *Server) HandleDevlistRequest() ([]byte, error) { + return nil, fmt.Errorf("USB/IP server not supported on Windows") +} + +func (s *Server) HandleImportRequest(requestedBusID string) ([]byte, error) { + return nil, fmt.Errorf("USB/IP server not supported on Windows") +} + +func (s *Server) ReadManagementRequest(r io.Reader) (response []byte, startTransfer bool, err error) { + return nil, false, fmt.Errorf("USB/IP server not supported on Windows") +} diff --git a/internal/usbip/vhci_windows.go b/internal/usbip/vhci_windows.go new file mode 100644 index 0000000..dcf03fd --- /dev/null +++ b/internal/usbip/vhci_windows.go @@ -0,0 +1,21 @@ +//go:build windows + +package usbip + +import "fmt" + +func IsVHCIAvailable() bool { + return false +} + +func FindFreePort(speed uint32) (int, error) { + return -1, fmt.Errorf("VHCI not supported on Windows") +} + +func AttachDevice(port int, sockfd int, devID uint32, speed uint32) error { + return fmt.Errorf("VHCI not supported on Windows") +} + +func DetachDevice(port int) error { + return fmt.Errorf("VHCI not supported on Windows") +}