diff --git a/pyftdi/ftdi.py b/pyftdi/ftdi.py index 0a75e521..e518731b 100644 --- a/pyftdi/ftdi.py +++ b/pyftdi/ftdi.py @@ -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 diff --git a/pyftdi/usbtools.py b/pyftdi/usbtools.py index 3355d8ed..32e536c5 100644 --- a/pyftdi/usbtools.py +++ b/pyftdi/usbtools.py @@ -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) @@ -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()