diff --git a/serial/tools/list_ports_common.py b/serial/tools/list_ports_common.py index 4199e30d..109c9cba 100644 --- a/serial/tools/list_ports_common.py +++ b/serial/tools/list_ports_common.py @@ -32,7 +32,7 @@ def numsplit(text): class ListPortInfo(object): """Info collection base class for serial ports""" - def __init__(self, device): + def __init__(self, device, skip_link_detection=False): self.device = device self.name = os.path.basename(device) self.description = 'n/a' @@ -46,7 +46,7 @@ def __init__(self, device): self.product = None self.interface = None # special handling for links - if device is not None and os.path.islink(device): + if not skip_link_detection and device is not None and os.path.islink(device): self.hwid = 'LINK={}'.format(os.path.realpath(device)) def usb_description(self): @@ -91,6 +91,7 @@ def __getitem__(self, index): else: raise IndexError('{} > 2'.format(index)) + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - def list_links(devices): """\ @@ -103,6 +104,7 @@ def list_links(devices): links.append(device) return links + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # test if __name__ == '__main__': diff --git a/serial/tools/list_ports_windows.py b/serial/tools/list_ports_windows.py index f28047be..56e28b08 100644 --- a/serial/tools/list_ports_windows.py +++ b/serial/tools/list_ports_windows.py @@ -113,7 +113,7 @@ def __str__(self): RegCloseKey.restype = LONG RegQueryValueEx = advapi32.RegQueryValueExW -RegQueryValueEx.argtypes = [HKEY, LPCTSTR , LPDWORD, LPDWORD, LPBYTE, LPDWORD] +RegQueryValueEx.argtypes = [HKEY, LPCTSTR, LPDWORD, LPDWORD, LPBYTE, LPDWORD] RegQueryValueEx.restype = LONG @@ -206,7 +206,7 @@ def iterate_comports(): # stringify szHardwareID_str = szHardwareID.value - info = list_ports_common.ListPortInfo(port_name_buffer.value) + info = list_ports_common.ListPortInfo(port_name_buffer.value, skip_link_detection=True) # in case of USB, make a more readable string, similar to that form # that we also generate on other platforms