fixed windows build and build windows version
This commit is contained in:
parent
cfc8a42417
commit
1c4ebddd05
BIN
bin/usb-client
BIN
bin/usb-client
Binary file not shown.
Binary file not shown.
BIN
bin/usb-relay
BIN
bin/usb-relay
Binary file not shown.
|
|
@ -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")
|
||||
}
|
||||
|
|
@ -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")
|
||||
}
|
||||
Loading…
Reference in New Issue