eblot / pyftdi

FTDI device driver written in pure Python
Other
509 stars 211 forks source link

Custom FTDI Device is not supported #15

Closed cospan closed 10 years ago

cospan commented 10 years ago

in /pyftdi/pyftdi/ftdi.py the 'type' property does not support custom FTDI devices.

FTDI gave me a product ID number I can use with my board and pyftdi does not recognize it.

In order to fix it how about a static field called 'TYPES' in the FTDI class with the dictionary that is within the type function and a static method to allow users to add their device to the dictionary:

TYPES = { (0x0403, 0x6001, 0x200) : 'ft232am',                                                               
          (0x0403, 0x6001, 0x400) : 'ft232bm',                                                               
          (0x0403, 0x6001, 0x600) : 'ft232r',                                                                
          (0x0403, 0x6014, 0x900) : 'ft232h',                                                                
          (0x0403, 0x6010, 0x500) : 'ft2232d',                                                               
          (0x0403, 0x6010, 0x600) : 'ft232c',                                                                
          (0x0403, 0x6010, 0x700) : 'ft2232h',                                                               
          (0x0403, 0x6011, 0x800) : 'ft4232h' }                                                              

@staticmethod
def add_type(vendor, product, bcdDevice, data):
    Ftdi.TYPES[(vendor, product, bcdDevice)] = data 
eblot commented 10 years ago

Could improved support from v0.10.0 be enough?

cospan commented 10 years ago

I just tested it out, it works great!

Thank you so much!

eblot commented 10 years ago

Ok, thanks for the feedback, and sorry for the delay.