class Device(packets.BigEndian): """ Repeating device data """ class Iface(packets.BigEndian): """ Repeating interface data """ fields = [ fields.UInt8('iface_class', default=0xff), fields.UInt8('iface_subclass', default=0xff), fields.UInt8('iface_proto', default=0xff), fields.Padding() ] fields = [ fields.String('path', default='/', size=256), fields.String('bus_id', default='1-1', size=32), fields.UInt32('bus_num', default=1), fields.UInt32('device_num', default=1), fields.UInt32('speed', default=2), fields.UInt16('vendor_id', default=0x0000), fields.UInt16('product_id', default=0x0000), fields.UInt16('device_version', default=0), fields.UInt8('device_class', default=0xff), fields.UInt8('device_subclass', default=0xff), fields.UInt8('device_protocol', default=0xff), fields.UInt8('config_value', default=1), fields.UInt8('config_count', default=1), fields.UInt8('iface_count', default=0), fields.List('ifaces', fields.Packet(default=Iface()), size='iface_count') ]
class UsbIpRetUnlink(packets.BigEndian): """ USBIP - Unlink response """ fields = [ fields.Padding(), fields.Padding(), fields.UInt16('command', default=USBIP_RET_UNLINK), fields.UInt32('seq_num', default=0), fields.UInt32('dev_id', default=0), fields.UInt32('direction', default=0x00000000), fields.UInt32('endpoint', default=0x00000000), fields.UInt32('status', default=0) ]
class UsbIpCmdUnlink(packets.BigEndian): """ USBIP - Unlink request """ fields = [ fields.Padding(), fields.Padding(), fields.UInt16('command', default=USBIP_CMD_UNLINK), fields.UInt32('seq_num', default=0), fields.UInt32('dev_id', default=0), fields.UInt32('direction', default=0x00000000), fields.UInt32('endpoint', default=0x00000000), fields.UInt32('seq_num', default=0) ]
class OpReqDevlist(packets.BigEndian): """ OP - Device list request """ fields = [ fields.UInt16('version', default=USBIP_VERSION), fields.UInt16('command', default=OP_REQ_DEVLIST), fields.UInt32('status', default=0) ]
class OpReqImport(packets.BigEndian): """ OP - Import request """ fields = [ fields.UInt16('version', default=USBIP_VERSION), fields.UInt16('command', default=OP_REQ_IMPORT), fields.UInt32('status', default=0), fields.String('bus_id', default='1-1', size=32) ]
class OpRepDevlist(packets.BigEndian): """ OP - Device list response """ # Packet contains a nested variable size device data structure class Device(packets.BigEndian): """ Repeating device data """ class Iface(packets.BigEndian): """ Repeating interface data """ fields = [ fields.UInt8('iface_class', default=0xff), fields.UInt8('iface_subclass', default=0xff), fields.UInt8('iface_proto', default=0xff), fields.Padding() ] fields = [ fields.String('path', default='/', size=256), fields.String('bus_id', default='1-1', size=32), fields.UInt32('bus_num', default=1), fields.UInt32('device_num', default=1), fields.UInt32('speed', default=2), fields.UInt16('vendor_id', default=0x0000), fields.UInt16('product_id', default=0x0000), fields.UInt16('device_version', default=0), fields.UInt8('device_class', default=0xff), fields.UInt8('device_subclass', default=0xff), fields.UInt8('device_protocol', default=0xff), fields.UInt8('config_value', default=1), fields.UInt8('config_count', default=1), fields.UInt8('iface_count', default=0), fields.List('ifaces', fields.Packet(default=Iface()), size='iface_count') ] fields = [ fields.UInt16('version', default=USBIP_VERSION), fields.UInt16('command', default=OP_REP_DEVLIST), fields.UInt32('status', default=0), fields.UInt32('device_count', default=0), fields.List('devices', fields.Packet(default=Device()), size='device_count') ]
class UsbIpRetSubmit(packets.BigEndian): """ USBIP - Submit response """ fields = [ fields.Padding(), fields.Padding(), fields.UInt16('command', default=USBIP_RET_SUBMIT), fields.UInt32('seq_num', default=0), fields.UInt32('dev_id', default=0), fields.UInt32('direction', default=0x00000000), fields.UInt32('endpoint', default=0x00000000), fields.UInt32('status', default=0), fields.UInt32('actual_len', default=0), fields.UInt32('start_frame', default=0), fields.UInt32('packet_count', default=0), fields.UInt32('error_count', default=0), fields.Packet('setup', default=UrbSetup()) ]
class UsbIpCmdSubmit(packets.BigEndian): """ USBIP - Submit request """ fields = [ fields.Padding(), fields.Padding(), fields.UInt16('command', default=USBIP_CMD_SUBMIT), fields.UInt32('seq_num', default=0), fields.UInt32('dev_id', default=0), fields.UInt32('direction', default=0x00000000), fields.UInt32('endpoint', default=0x00000000), fields.UInt32('transfer_flags', default=0x00000000), fields.UInt32('buffer_len', default=0), fields.UInt32('start_frame', default=0), fields.UInt32('packet_count', default=0), fields.UInt32('interval', default=0), fields.Packet('setup', default=UrbSetup()) ]
class OpRepImport(packets.BigEndian): """ OP - Import response """ fields = [ fields.UInt16('version', default=USBIP_VERSION), fields.UInt16('command', default=OP_REP_IMPORT), fields.UInt32('status', default=0), fields.String('full_path', default='/', size=256), fields.String('bus_id', default='1-1', size=32), fields.UInt32('bus_no', default=1), fields.UInt32('device_no', default=1), fields.UInt32('device_speed', default=2), fields.UInt16('vendor_id', default=0x0000), fields.UInt16('product_id', default=0x0000), fields.UInt16('device_version', default=0), fields.UInt8('device_class', default=0xff), fields.UInt8('device_subclass', default=0xff), fields.UInt8('device_protocol', default=0xff), fields.UInt8('config_value', default=1), fields.UInt8('config_count', default=1), fields.UInt8('iface_count', default=0) ]