Documentation ¶
Index ¶
- Constants
- Variables
- type DummyUSBDevice
- type USBConfigurationDescriptor
- type USBDescriptorType
- type USBDevice
- type USBDeviceDescriptor
- type USBDeviceImpl
- type USBDirection
- type USBEndpointDescriptor
- type USBHIDDescriptor
- type USBHIDRequestType
- type USBIPCommandSubmitBody
- type USBIPCommandUnlinkBody
- type USBIPControlCommand
- type USBIPControlHeader
- type USBIPDeviceInterface
- type USBIPDeviceSummary
- type USBIPDeviceSummaryHeader
- type USBIPMessageHeader
- type USBIPOpRepDevlist
- type USBIPOpRepImport
- type USBIPReturnSubmitBody
- type USBIPReturnUnlinkBody
- type USBIPServer
- type USBISOPacketDescriptor
- type USBInterfaceDescriptor
- type USBRequestClass
- type USBRequestRecipient
- type USBRequestType
- type USBSetupPacket
- type USBStringDescriptorHeader
Constants ¶
View Source
const ( USB_CONFIG_ATTR_BASE = 0b10000000 USB_CONFIG_ATTR_SELF_POWERED = 0b01000000 USB_CONFIG_ATTR_REMOTE_WAKEUP = 0b00100000 USB_INTERFACE_CLASS_HID = 3 USB_LANGID_ENG_USA = 0x0409 )
View Source
const ( USBIP_VERSION = 0x0111 USBIP_COMMAND_SUBMIT = 0x1 USBIP_COMMAND_UNLINK = 0x2 USBIP_COMMAND_RET_SUBMIT = 0x3 USBIP_COMMAND_RET_UNLINK = 0x4 USBIP_DIR_OUT = 0x0 USBIP_DIR_IN = 0x1 )
Variables ¶
View Source
var USBIPControlCommandDescriptions = map[USBIPControlCommand]string{ USBIP_COMMAND_OP_REQ_DEVLIST: "USBIP_COMMAND_OP_REQ_DEVLIST", USBIP_COMMAND_OP_REP_DEVLIST: "USBIP_COMMAND_OP_REP_DEVLIST", USBIP_COMMAND_OP_REQ_IMPORT: "USBIP_COMMAND_OP_REQ_IMPORT", USBIP_COMMAND_OP_REP_IMPORT: "USBIP_COMMAND_OP_REP_IMPORT", }
Functions ¶
This section is empty.
Types ¶
type DummyUSBDevice ¶
type DummyUSBDevice struct{}
type USBDescriptorType ¶
type USBDescriptorType uint8
const ( USB_DESCRIPTOR_DEVICE USBDescriptorType = 1 USB_DESCRIPTOR_CONFIGURATION USBDescriptorType = 2 USB_DESCRIPTOR_STRING USBDescriptorType = 3 USB_DESCRIPTOR_INTERFACE USBDescriptorType = 4 USB_DESCRIPTOR_ENDPOINT USBDescriptorType = 5 USB_DESCRIPTOR_DEVICE_QUALIFIER USBDescriptorType = 6 USB_DESCRIPTOR_OTHER_SPEED_CONFIGURATION USBDescriptorType = 7 USB_DESCRIPTOR_INTERFACE_POWER USBDescriptorType = 8 USB_DESCRIPTOR_HID USBDescriptorType = 33 USB_DESCRIPTOR_HID_REPORT USBDescriptorType = 34 )
type USBDeviceDescriptor ¶
type USBDeviceDescriptor struct { BLength uint8 BDescriptorType USBDescriptorType BcdUSB uint16 BDeviceClass uint8 BDeviceSubclass uint8 BDeviceProtocol uint8 BMaxPacketSize uint8 IdVendor uint16 IdProduct uint16 BcdDevice uint16 IManufacturer uint8 IProduct uint8 ISerialNumber uint8 BNumConfigurations uint8 }
type USBDeviceImpl ¶
type USBDeviceImpl struct { Index int // contains filtered or unexported fields }
func NewUSBDevice ¶
func NewUSBDevice(ctapHIDServer *ctap_hid.CTAPHIDServer) *USBDeviceImpl
type USBDirection ¶
type USBDirection uint8
const ( USB_HOST_TO_DEVICE USBDirection = 0 USB_DEVICE_TO_HOST USBDirection = 1 )
type USBEndpointDescriptor ¶
type USBHIDDescriptor ¶
type USBHIDDescriptor struct { BLength uint8 BDescriptorType USBDescriptorType BcdHID uint16 BCountryCode uint8 BNumDescriptors uint8 BClassDescriptorType USBDescriptorType WReportDescriptorLength uint16 }
type USBHIDRequestType ¶
type USBHIDRequestType uint8
const ( USB_HID_REQUEST_GET_REPORT USBHIDRequestType = 1 USB_HID_REQUEST_GET_IDLE USBHIDRequestType = 2 USB_HID_REQUEST_GET_PROTOCOL USBHIDRequestType = 3 USB_HID_REQUEST_GET_DESCRIPTOR USBHIDRequestType = 6 USB_HID_REQUEST_SET_DESCRIPTOR USBHIDRequestType = 7 USB_HID_REQUEST_SET_REPORT USBHIDRequestType = 9 USB_HID_REQUEST_SET_IDLE USBHIDRequestType = 10 USB_HID_REQUEST_SET_PROTOCOL USBHIDRequestType = 11 )
type USBIPCommandSubmitBody ¶
type USBIPCommandSubmitBody struct { TransferFlags uint32 TransferBufferLength uint32 StartFrame uint32 NumberOfPackets uint32 Interval uint32 SetupBytes [8]byte }
func (USBIPCommandSubmitBody) Setup ¶
func (body USBIPCommandSubmitBody) Setup() USBSetupPacket
func (USBIPCommandSubmitBody) String ¶
func (body USBIPCommandSubmitBody) String() string
type USBIPCommandUnlinkBody ¶
type USBIPControlCommand ¶
type USBIPControlCommand uint16
const ( USBIP_COMMAND_OP_REQ_DEVLIST USBIPControlCommand = 0x8005 USBIP_COMMAND_OP_REP_DEVLIST USBIPControlCommand = 0x0005 USBIP_COMMAND_OP_REQ_IMPORT USBIPControlCommand = 0x8003 USBIP_COMMAND_OP_REP_IMPORT USBIPControlCommand = 0x0003 )
type USBIPControlHeader ¶
type USBIPControlHeader struct { Version uint16 CommandCode USBIPControlCommand Status uint32 }
func (*USBIPControlHeader) String ¶
func (header *USBIPControlHeader) String() string
type USBIPDeviceInterface ¶
type USBIPDeviceSummary ¶
type USBIPDeviceSummary struct { Header USBIPDeviceSummaryHeader DeviceInterface USBIPDeviceInterface // We only support one interface to use binary.Write/Read }
func (USBIPDeviceSummary) String ¶
func (summary USBIPDeviceSummary) String() string
type USBIPDeviceSummaryHeader ¶
type USBIPDeviceSummaryHeader struct { Path [256]byte BusId [32]byte Busnum uint32 Devnum uint32 Speed uint32 IdVendor uint16 IdProduct uint16 BcdDevice uint16 BDeviceClass uint8 BDeviceSubclass uint8 BDeviceProtocol uint8 BConfigurationValue uint8 BNumConfigurations uint8 BNumInterfaces uint8 }
func (USBIPDeviceSummaryHeader) String ¶
func (header USBIPDeviceSummaryHeader) String() string
type USBIPMessageHeader ¶
type USBIPMessageHeader struct { Command uint32 SequenceNumber uint32 DeviceId uint32 Direction uint32 Endpoint uint32 }
func (USBIPMessageHeader) CommandName ¶
func (header USBIPMessageHeader) CommandName() string
func (USBIPMessageHeader) DirectionName ¶
func (header USBIPMessageHeader) DirectionName() string
func (USBIPMessageHeader) String ¶
func (header USBIPMessageHeader) String() string
type USBIPOpRepDevlist ¶
type USBIPOpRepDevlist struct { Header USBIPControlHeader NumDevices uint32 Devices []USBIPDeviceSummary }
type USBIPOpRepImport ¶
type USBIPOpRepImport struct {
// contains filtered or unexported fields
}
func (USBIPOpRepImport) String ¶
func (reply USBIPOpRepImport) String() string
type USBIPReturnSubmitBody ¶
type USBIPReturnUnlinkBody ¶
type USBIPServer ¶
type USBIPServer struct {
// contains filtered or unexported fields
}
func NewUSBIPServer ¶
func NewUSBIPServer(device USBDevice) *USBIPServer
func (*USBIPServer) Start ¶
func (server *USBIPServer) Start()
type USBISOPacketDescriptor ¶
type USBInterfaceDescriptor ¶
type USBRequestClass ¶
type USBRequestClass uint8
const ( USB_REQUEST_CLASS_STANDARD USBRequestClass = 0 USB_REQUEST_CLASS_CLASS USBRequestClass = 1 USB_REQUEST_CLASS_VENDOR USBRequestClass = 2 USB_REQUEST_CLASS_RESERVED USBRequestClass = 3 )
type USBRequestRecipient ¶
type USBRequestRecipient uint8
const ( USB_REQUEST_RECIPIENT_DEVICE USBRequestRecipient = 0 USB_REQUEST_RECIPIENT_INTERFACE USBRequestRecipient = 1 USB_REQUEST_RECIPIENT_ENDPOINT USBRequestRecipient = 2 USB_REQUEST_RECIPIENT_OTHER USBRequestRecipient = 3 )
type USBRequestType ¶
type USBRequestType uint8
const ( USB_REQUEST_GET_STATUS USBRequestType = 0 USB_REQUEST_CLEAR_FEATURE USBRequestType = 1 USB_REQUEST_SET_FEATURE USBRequestType = 3 USB_REQUEST_SET_ADDRESS USBRequestType = 5 USB_REQUEST_GET_DESCRIPTOR USBRequestType = 6 USB_REQUEST_SET_DESCRIPTOR USBRequestType = 7 USB_REQUEST_GET_CONFIGURATION USBRequestType = 8 USB_REQUEST_SET_CONFIGURATION USBRequestType = 9 USB_REQUEST_GET_INTERFACE USBRequestType = 10 USB_REQUEST_SET_INTERFACE USBRequestType = 11 USB_REQUEST_SYNCH_FRAME USBRequestType = 12 )
type USBSetupPacket ¶
type USBSetupPacket struct { BmRequestType uint8 BRequest USBRequestType WValue uint16 WIndex uint16 WLength uint16 }
func (USBSetupPacket) String ¶
func (setup USBSetupPacket) String() string
type USBStringDescriptorHeader ¶
type USBStringDescriptorHeader struct { BLength uint8 BDescriptorType USBDescriptorType }
Click to show internal directories.
Click to hide internal directories.