Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pyftdi/ftdi.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,9 @@ def __init__(self):
def create_from_url(cls, url: str) -> 'Ftdi':
"""Create an Ftdi instance from an URL

URL scheme: ftdi://[vendor[:product[:index|:serial]]]/interface
URL scheme: ftdi://[vendor[:product[:index]]]/interface
URL scheme: ftdi://[vendor[:product[::serial]]]/interface
URL scheme: ftdi://[vendor[:product[:bus:address]]]/interface

:param url: FTDI device selector
:return: a fresh, open Ftdi instance
Expand Down
4 changes: 3 additions & 1 deletion pyftdi/usbtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ def enumerate_candidates(cls, urlparts: SplitResult,
bus = None
address = None
locators = specifiers[2:]
if len(locators) > 1:
if len(locators) > 1 and locators[0]:
try:
bus = int(locators[0], 16)
address = int(locators[1], 16)
Expand All @@ -427,6 +427,8 @@ def enumerate_candidates(cls, urlparts: SplitResult,
idx = devidx-1
except ValueError:
sernum = locators[0]
if locators and len(locators) > 1:
sernum = locators[1]
candidates = []
vendors = [vendor] if vendor else set(vdict.values())
vps = set()
Expand Down