Open
Description
pyftdi finds my device:
pyftdi.ftdi.Ftdi.show_devices()
Result:
Available interfaces:
ftdi://vid:pid:0025/1 (my device)
But can't open it:
bitbang = pyftdi.ftdi.Ftdi()
bitbang.open_bitbang_from_url("ftdi://vid:pid:0025/1")
Result:
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.
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.
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.
bitbang.open_bitbang(VID, PID, serial="0025")
Metadata
Metadata
Assignees
Labels
No labels