Ejemplo n.º 1
0
 def __init__(self, app, phy, vid=0x0403, pid=0x6001, rev=0x0100, **kwargs):
     super(USBFtdiDevice, self).__init__(
         app=app,
         phy=phy,
         device_class=USBClass.Unspecified,
         device_subclass=0,
         protocol_rel_num=0,
         max_packet_size_ep0=0x40,
         vendor_id=0x0403,
         product_id=0x6001,
         device_rev=0x0600,
         manufacturer_string='Future Technology Devices International, Ltd',
         product_string='FT232 Serial (UART) IC',
         serial_number_string='FTGQOTV+',
         configurations=[
             USBConfiguration(
                 app=app,
                 phy=phy,
                 index=1,
                 string='FTDI',
                 interfaces=[USBFtdiInterface(app, phy, 0)],
                 attributes=USBConfiguration.ATTR_BASE,
                 max_power=0x2d,
             )
         ],
         usb_vendor=USBFtdiVendor(app=app, phy=phy))
Ejemplo n.º 2
0
 def __init__(self, app, phy, vid=0x05e3, pid=0x0610, rev=0x7732, **kwargs):
     super(USBHubDevice, self).__init__(
         app=app,
         phy=phy,
         device_class=USBClass.Hub,
         device_subclass=0,
         protocol_rel_num=1,
         max_packet_size_ep0=64,
         vendor_id=vid,
         product_id=pid,
         device_rev=rev,
         manufacturer_string='Genesys Logic, Inc',
         product_string='USB2.0 Hub',
         serial_number_string='1234',
         configurations=[
             USBConfiguration(
                 app=app,
                 phy=phy,
                 index=1,
                 string='Emulated Hub',
                 interfaces=[
                     USBHubInterface(app, phy)
                 ],
                 attributes=USBConfiguration.ATTR_SELF_POWERED,
             )
         ],
     )
Ejemplo n.º 3
0
 def __init__(self, app, phy, vid=0x0bda, pid=0x0165, rev=0x2361, **kwargs):
     super(USBSmartcardDevice, self).__init__(
         app=app,
         phy=phy,
         device_class=USBClass.Unspecified,
         device_subclass=0,
         protocol_rel_num=0,
         max_packet_size_ep0=64,
         vendor_id=vid,
         product_id=pid,
         device_rev=rev,
         manufacturer_string='Generic',
         product_string='Smart Card Reader Interface',
         serial_number_string=b'20070818000000000',
         configurations=[
             USBConfiguration(
                 app=app,
                 phy=phy,
                 index=1,
                 string='Emulated Smartcard',
                 interfaces=[
                     USBSmartcardInterface(app, phy)
                 ]
             )
         ],
     )
Ejemplo n.º 4
0
 def __init__(self, app, phy, vid, pid, rev=1, **kwargs):
     self.app = app
     self.phy = phy
     super(USBVendorSpecificDevice, self).__init__(
         app=app,
         phy=phy,
         device_class=USBClass.VendorSpecific,
         device_subclass=1,
         protocol_rel_num=1,
         max_packet_size_ep0=64,
         vendor_id=vid,
         product_id=pid,
         device_rev=rev,
         manufacturer_string='UMAP2. VID:0x%04x' % vid,
         product_string='UMAP2. PID:0x%04x' % pid,
         serial_number_string='123456',
         configurations=[
             USBConfiguration(
                 app=app,
                 phy=phy,
                 index=1,
                 string='Vendor Specific Conf',
                 interfaces=self.get_interfaces(),
                 attributes=USBConfiguration.ATTR_SELF_POWERED,
             )
         ],
     )
Ejemplo n.º 5
0
 def __init__(self, app, phy, vid=0x4e8, pid=0x685c, rev=0x0002, **kwargs):
     super(USBMtpDevice, self).__init__(
         app=app,
         phy=phy,
         device_class=USBClass.Unspecified,
         device_subclass=0,
         protocol_rel_num=0,
         max_packet_size_ep0=64,
         vendor_id=vid,
         product_id=pid,
         device_rev=rev,
         manufacturer_string='Samsung Electronics Co., Ltd',
         product_string='GT-I9250 Phone [Galaxy Nexus]',
         serial_number_string='00001',
         configurations=[
             USBConfiguration(
                 app=app,
                 phy=phy,
                 index=1,
                 string='Android MTP Device',
                 interfaces=[
                     USBMtpInterface(app, phy)
                 ]
             )
         ],
         usb_vendor=USBMsosVendor(app=app, phy=phy),
     )
Ejemplo n.º 6
0
 def __init__(self,
              app,
              phy,
              vid=0x03f0,
              pid=0x4417,
              rev=0x0001,
              usbclass=USBClass.Printer,
              subclass=1,
              proto=2):
     super(USBPrinterDevice, self).__init__(
         app=app,
         phy=phy,
         device_class=USBClass.Unspecified,
         device_subclass=0,
         protocol_rel_num=0,
         max_packet_size_ep0=64,
         vendor_id=vid,
         product_id=pid,
         device_rev=rev,
         manufacturer_string='Hewlett-Packard',
         product_string='HP Color LaserJet CP1515n',
         serial_number_string='00CNC2618971',
         configurations=[
             USBConfiguration(
                 app=app,
                 phy=phy,
                 index=1,
                 string='Printer',
                 interfaces=[
                     USBPrinterInterface(app, phy, 0, usbclass, subclass,
                                         proto),
                     # USBPrinterInterface(app, phy, 1, 0xff, 1, 1),
                 ])
         ],
     )
Ejemplo n.º 7
0
 def __init__(self, app, phy, vid=0x8312, pid=0x8312, **kwargs):
     usb_class = None
     usb_vendor = None
     configurations = [
         USBConfiguration(app=app,
                          phy=phy,
                          index=0x1,
                          string='Billboard configuration',
                          interfaces=[],
                          attributes=0xc0,
                          max_power=0xfa)
     ]
     super(USBBillboardDevice, self).__init__(
         app=app,
         phy=phy,
         device_class=USBClass.Billboard,
         device_subclass=0x0,
         protocol_rel_num=0x0,
         max_packet_size_ep0=0x40,
         vendor_id=vid,
         product_id=pid,
         device_rev=0x0,
         manufacturer_string='numap Inc.',
         product_string='numap Billboard',
         serial_number_string='UMAP2-BILL-0123',
         configurations=configurations,
         descriptors=None,
         usb_class=usb_class,
         usb_vendor=usb_vendor,
     )
     self.usb_spec_version = 0x0210
     self.bos = USBBinaryObjectStore(
         app,
         phy,
         capabilities=[
             DCContainerId(app, phy, container_id=b'UMAP2-BILL-12345'),
             DCBillboard(
                 app,
                 phy,
                 additional_info_idx=self.get_string_id(
                     'https://additional.info/numap'),
                 preferred_alternate_mode=0,
                 vconn_power=0x8000,
                 bm_configured=b'\xff' * 16,
                 alternate_modes=[(vid, 0,
                                   self.get_string_id('alternate_mode_0'))],
             )
         ])
Ejemplo n.º 8
0
 def __init__(self, app, phy, vid=0x2548, pid=0x1001, rev=0x0010, bmCapabilities=0x03, interfaces=None, cs_interfaces=None, cdc_cls=None, **kwargs):
     if cs_interfaces is None:
         cs_interfaces = []
     if cdc_cls is None:
         cdc_cls = self.get_default_class(app, phy)
     if interfaces is None:
         interfaces = []
     control_interface = USBCDCControlInterface(
         app=app, phy=phy,
         interface_number=self.bControlInterface, interface_alternate=0,
         interface_class=USBClass.CDC,
         interface_subclass=self.bControlSubclass,
         interface_protocol=self.bControlProtocol,
         interface_string_index=0,
         endpoints=[
             USBEndpoint(
                 app=app, phy=phy, number=0x3,
                 direction=USBEndpoint.direction_in,
                 transfer_type=USBEndpoint.transfer_type_interrupt,
                 sync_type=USBEndpoint.sync_type_none,
                 usage_type=USBEndpoint.usage_type_data,
                 max_packet_size=0x40,
                 interval=9,
                 handler=self.handle_ep3_buffer_available
             )
         ],
         cs_interfaces=cs_interfaces,
     )
     interfaces.insert(0, control_interface)
     super(USBCDCDevice, self).__init__(
         app=app, phy=phy,
         device_class=USBClass.CDC,
         device_subclass=0,
         protocol_rel_num=0,
         max_packet_size_ep0=64,
         vendor_id=vid,
         product_id=pid,
         device_rev=rev,
         manufacturer_string='UMAP2 NetSolutions',
         product_string='UMAP2 CDC-TRON',
         serial_number_string='UMAP2-13337-CDC',
         configurations=[
             USBConfiguration(
                 app=app, phy=phy,
                 index=1, string='Emulated CDC',
                 interfaces=interfaces,
             )
         ])
Ejemplo n.º 9
0
 def __init__(self, app, phy, vid=0x610b, pid=0x4653, rev=0x1234, **kwargs):
     super(USBKeyboardDevice, self).__init__(
         app=app,
         phy=phy,
         device_class=USBClass.Unspecified,
         device_subclass=0,
         protocol_rel_num=0,
         max_packet_size_ep0=64,
         vendor_id=vid,
         product_id=pid,
         device_rev=rev,
         manufacturer_string='Dell',
         product_string='Dell USB Entry Keyboard',
         serial_number_string='00001',
         configurations=[
             USBConfiguration(app=app,
                              phy=phy,
                              index=1,
                              string='Emulated Keyboard',
                              interfaces=[USBKeyboardInterface(app, phy)])
         ],
     )
Ejemplo n.º 10
0
    def __init__(self,
                 app,
                 phy,
                 vid=0x154b,
                 pid=0x6545,
                 rev=0x0002,
                 usbclass=USBClass.MassStorage,
                 subclass=0x06,
                 proto=0x50,
                 disk_image_filename='stick.img'):
        self.disk_image = DiskImage(disk_image_filename, 0x200)
        self.scsi_device = ScsiDevice(app, self.disk_image)

        super(USBMassStorageDevice, self).__init__(
            app=app,
            phy=phy,
            device_class=USBClass.Unspecified,
            device_subclass=0,
            protocol_rel_num=0,
            max_packet_size_ep0=64,
            vendor_id=vid,
            product_id=pid,
            device_rev=rev,
            manufacturer_string='PNY',
            product_string='USB 2.0 FD',
            serial_number_string=b'4731020ef1914da9',
            configurations=[
                USBConfiguration(app=app,
                                 phy=phy,
                                 index=1,
                                 string='MassStorage config',
                                 interfaces=[
                                     USBMassStorageInterface(
                                         app, phy, self.scsi_device, usbclass,
                                         subclass, proto)
                                 ])
            ],
        )
Ejemplo n.º 11
0
 def __init__(self,
              app,
              phy,
              vid=0x0d8c,
              pid=0x000c,
              rev=0x0001,
              *args,
              **kwargs):
     audio_streaming = AudioStreaming(app, phy, 2, 1)
     usb_class = USBAudioClass(app, phy)
     super(USBAudioDevice, self).__init__(
         app=app,
         phy=phy,
         device_class=USBClass.Unspecified,
         device_subclass=0,
         protocol_rel_num=0,
         max_packet_size_ep0=0x40,
         vendor_id=vid,
         product_id=pid,
         device_rev=rev,
         manufacturer_string='UMAP2 Sound Inc.',
         product_string='UMAP2 Audio Adapter',
         serial_number_string='UMAP2-12345-AUDIO',
         configurations=[
             USBConfiguration(
                 app=app,
                 phy=phy,
                 index=1,
                 string='UMAP2 Audio Configuration',
                 attributes=USBConfiguration.ATTR_BASE,
                 interfaces=[
                     # standard AC interface (4.3.1)
                     # At this point - with no endpoints
                     USBAudioControlInterface(
                         app=app,
                         phy=phy,
                         iface_num=0,
                         iface_alt=0,
                         iface_str_idx=0,
                         cs_ifaces=[
                             # Class specific AC interface: header (4.3.2)
                             USBCSInterface(
                                 'ACHeader', app, phy,
                                 '\x01\x00\x01\x64\x00\x02\x01\x02'),
                             # Class specific AC interface: input terminal (Table 4.3.2.1)
                             USBCSInterface(
                                 'ACInputTerminal0', app, phy,
                                 '\x02\x01\x01\x01\x00\x02\x03\x00\x00\x00'
                             ),
                             USBCSInterface(
                                 'ACInputTerminal1', app, phy,
                                 '\x02\x02\x01\x02\x00\x01\x01\x00\x00\x00'
                             ),
                             # Class specific AC interface: output terminal (Table 4.3.2.2)
                             USBCSInterface('ACOutputTerminal0', app, phy,
                                            '\x03\x06\x01\x03\x00\x09\x00'),
                             USBCSInterface('ACOutputTerminal1', app, phy,
                                            '\x03\x07\x01\x01\x00\x08\x00'),
                             # Class specific AC interface: selector unit (Table 4.3.2.4)
                             USBCSInterface('ACSelectorUnit', app, phy,
                                            '\x05\x08\x01\x0a\x00'),
                             # Class specific AC interface: feature unit (Table 4.3.2.5)
                             USBCSInterface(
                                 'ACFeatureUnit0', app, phy,
                                 '\x06\x09\x0f\x01\x01\x02\x02\x00'),
                             USBCSInterface('ACFeatureUnit1', app, phy,
                                            '\x06\x0a\x02\x01\x43\x00\x00'),
                             USBCSInterface('ACFeatureUnit2', app, phy,
                                            '\x06\x0d\x02\x01\x03\x00\x00'),
                             # Class specific AC interface: mixer unit (Table 4.3.2.3)
                             USBCSInterface(
                                 'ACMixerUnit', app, phy,
                                 '\x04\x0f\x02\x01\x0d\x02\x03\x00\x00\x00\x00'
                             ),
                         ],
                         usb_class=usb_class),
                     USBAudioStreamingInterface(
                         app=app,
                         phy=phy,
                         iface_num=1,
                         iface_alt=0,
                         iface_str_idx=0,
                         cs_ifaces=[
                             USBCSInterface('ASGeneral', app, phy,
                                            '\x01\x01\x01\x01\x00'),
                             USBCSInterface(
                                 'ASFormatType', app, phy,
                                 '\x02\x01\x02\x02\x10\x02\x44\xac\x00\x44\xac\x00'
                             ),
                         ],
                         endpoints=[
                             USBEndpoint(
                                 app=app,
                                 phy=phy,
                                 number=1,
                                 direction=USBEndpoint.direction_out,
                                 transfer_type=USBEndpoint.
                                 transfer_type_isochronous,
                                 sync_type=USBEndpoint.sync_type_adaptive,
                                 usage_type=USBEndpoint.usage_type_data,
                                 max_packet_size=0x40,
                                 interval=1,
                                 handler=audio_streaming.data_available,
                                 cs_endpoints=[
                                     USBCSEndpoint('ASEndpoint', app, phy,
                                                   '\x01\x01\x01\x01\x00')
                                 ],
                                 usb_class=usb_class,
                             )
                         ],
                         usb_class=usb_class,
                     ),
                     USBAudioStreamingInterface(
                         app=app,
                         phy=phy,
                         iface_num=2,
                         iface_alt=0,
                         iface_str_idx=0,
                         cs_ifaces=[
                             USBCSInterface('ASGeneral', app, phy,
                                            '\x01\x07\x01\x01\x00'),
                             USBCSInterface(
                                 'ASFormatType', app, phy,
                                 '\x02\x01\x01\x02\x10\x02\x44\xac\x00\x44\xac\x00'
                             ),
                         ],
                         endpoints=[
                             USBEndpoint(
                                 app=app,
                                 phy=phy,
                                 number=2,
                                 direction=USBEndpoint.direction_in,
                                 transfer_type=USBEndpoint.
                                 transfer_type_isochronous,
                                 sync_type=USBEndpoint.sync_type_async,
                                 usage_type=USBEndpoint.usage_type_data,
                                 max_packet_size=0x40,
                                 interval=1,
                                 handler=audio_streaming.buffer_available,
                                 cs_endpoints=[
                                     USBCSEndpoint('ASEndpoint', app, phy,
                                                   '\x01\x01\x00\x00\x00')
                                 ],
                                 usb_class=usb_class,
                             )
                         ],
                         usb_class=usb_class,
                     )
                 ]),
         ],
         usb_vendor=None)