Exemple #1
0
 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()
     ]
Exemple #2
0
class UrbSetup(packets.LittleEndian):
    """ URB Setup Block """
    fields = [
        fields.UInt8('bmRequestType', default=0x00),
        fields.UInt8('bRequest', default=0x00),
        fields.UInt16('wValue', default=0x0000),
        fields.UInt16('wIndex', default=0x0000),
        fields.UInt16('wLength', default=0x0000)
    ]
Exemple #3
0
class EndpointDescriptor(packets.LittleEndian):
    """ USB Endpoint Descriptor """
    fields = [
        fields.UInt8('bLength', default=0),
        fields.UInt8('bDescriptorType', default=0),
        fields.UInt8('bEndpointAddress', default=0),
        fields.UInt8('bmAttributes', default=0),
        fields.UInt16('wMaxPacketSize', default=0),
        fields.UInt8('bInterval', default=0)
    ]
Exemple #4
0
class DeviceDescriptor(packets.LittleEndian):
    """ USB Device descriptor sub packet """
    fields = [
        fields.UInt8('bLength', default=0),
        fields.UInt8('bDescriptorType', default=0),
        fields.UInt16('bcdUSB', default=0),
        fields.UInt8('bDeviceClass', default=0),
        fields.UInt8('bDeviceSubClass', default=0),
        fields.UInt8('bDeviceProtocol', default=0),
        fields.UInt8('bMaxPacketSize', default=0),
        fields.UInt16('idVendor', default=0),
        fields.UInt16('idProduct', default=0),
        fields.UInt16('bcdDevice', default=0),
        fields.UInt8('iManufacturer', default=0),
        fields.UInt8('iProduct', default=0),
        fields.UInt8('iSerialNumber', default=0),
        fields.UInt8('bNumConfigurations', default=0)
    ]
Exemple #5
0
class InterfaceDescriptor(packets.LittleEndian):
    """ USB Interface Descriptor """
    fields = [
        fields.UInt8('bLength', default=0),
        fields.UInt8('bDescriptorType', default=0),
        fields.UInt8('bInterfaceNumber', default=0),
        fields.UInt8('bAlternateSetting', default=0),
        fields.UInt8('bNumEndpoints', default=0),
        fields.UInt8('bInterfaceClass', default=0),
        fields.UInt8('bInterfaceSubClass', default=0),
        fields.UInt8('bInterfaceProtocol', default=0),
        fields.UInt8('iInterface', default=0),
        fields.List('endpoints',
                    fields.Packet(default=EndpointDescriptor()),
                    size='bNumEndpoints')
    ]
Exemple #6
0
    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')
        ]
Exemple #7
0
class ConfigurationDescriptor(packets.LittleEndian):
    """ USB Configuration Descriptor """
    fields = [
        fields.UInt8('bLength', default=0),
        fields.UInt8('bDescriptorType', default=0),
        fields.UInt16('wTotalLength', default=0),
        fields.UInt8('bNumInterfaces', default=0),
        fields.UInt8('bConfigurationValue', default=0),
        fields.UInt8('iConfiguration', default=0),
        fields.UInt8('bmAttributes', default=0),
        fields.UInt8('bMaxPower', default=0),
        fields.List('interfaces',
                    fields.Packet(default=InterfaceDescriptor()),
                    size='bNumInterfaces')
    ]
Exemple #8
0
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)
    ]