You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "bitbang.py", line 25, in <module>
bitbang.open_bitbang_from_url("ftdi://vid:pid:0025/1")
File "c:\temp\pyftdi\pyftdi\ftdi.py", line 799, in open_bitbang_from_url
devdesc, interface = self.get_identifiers(url)
File "c:\temp\pyftdi\pyftdi\ftdi.py", line 421, in get_identifiers
cls.DEFAULT_VENDOR)
File "c:\temp\pyftdi\pyftdi\usbtools.py", line 349, in parse_url
urlstr) from None
pyftdi.usbtools.UsbToolsError: No USB device matches URL ftdi://vid:pid:0025/1
Reason is that UsbTools.enumerate_candidates attempts to parse the serial number as an integer and uses it as an index into the list of candidates (which has only 1 element). The third specifier (the serial number) is only considered a serial number if it does not parse as an integer.
Devices that do not have a serial number - there are many of them - used to be accessed with a index, and the third field in the URL is either used as a index or a serial number. If the S/N is an integer, it is used an index, if not it is used as an integer - as FTDI generated S/N always contains some non-digit characters.
I agree this is an issue with S/N made of digit only characters.
How to fix this w/o breaking backward compatibility is not going to be easy. I'm open to suggestions.
pyftdi finds my device:
Result:
But can't open it:
Result:
Reason is that
UsbTools.enumerate_candidates
attempts to parse the serial number as an integer and uses it as an index into the list of candidates (which has only 1 element). The third specifier (the serial number) is only considered a serial number if it does not parse as an integer.pyftdi/pyftdi/usbtools.py
Lines 422 to 427 in c77136f
I don't know why you attempt to parse as an integer, so it's hard for me to fix.
I need this line to run to match device with the specific serial number.
pyftdi/pyftdi/usbtools.py
Line 429 in c77136f
I can open the device with open_bitbang just fine, but all the GPIO etc classes require URL to be used.
The text was updated successfully, but these errors were encountered: