//go:build darwin package usb import "fmt" // Device access on macOS would go through IOKit, which has no counterpart to // usbdevfs: there is no device node to open and drive with ioctls. Providing // it means writing an IOKit backend with cgo, which is a separate piece of // work — see the platform table in the README. // // These stubs exist so the client builds and its other functions (listing // devices, diagnostics, the relay, the web UI) work on macOS. type DeviceHandle struct{} func OpenDevice(devPath string, busID string) (*DeviceHandle, error) { return nil, fmt.Errorf("sharing USB devices is not implemented on macOS " + "(needs an IOKit backend); this machine can still run the relay") } func (h *DeviceHandle) Close() error { return nil } func (h *DeviceHandle) Fd() int { return -1 } func (h *DeviceHandle) DisconnectDriver() error { return fmt.Errorf("not implemented on macOS") } func (h *DeviceHandle) ConnectDriver() error { return fmt.Errorf("not implemented on macOS") } func (h *DeviceHandle) ClaimInterface(uint32) error { return fmt.Errorf("not implemented on macOS") } func (h *DeviceHandle) ReleaseInterface(uint32) error { return fmt.Errorf("not implemented on macOS") }