From f3da326297dcaae555247042c576b254550ad5da Mon Sep 17 00:00:00 2001 From: cliechti Date: Fri, 31 May 2013 01:00:57 +0000 Subject: [Bug pyserial:144] com0com ports ignored due to missing "friendly name" git-svn-id: http://svn.code.sf.net/p/pyserial/code/trunk/pyserial@458 f19166aa-fa4f-0410-85c2-fa1106f25c8a --- CHANGES.txt | 4 ++-- serial/tools/list_ports_windows.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index cda018b..143ac23 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -445,7 +445,7 @@ Version 2.7 2012-nn-nn Bugfixes: - [Bug 3540332] SerialException not returned -- [Bug pyserial:45] Error in socket_connection.py +- [Bug pyserial:145] Error in socket_connection.py Bugfixes (posix): @@ -458,5 +458,5 @@ Bugfixes (win32): - [Bug 3444941] ctypes.WinError() unicode error - [Bug 3550043] on Window in tools global name 'GetLastError' is not defined - [Bug pyserial:146] flush() does nothing in windows (despite docs) - +- [Bug pyserial:144] com0com ports ignored due to missing "friendly name" diff --git a/serial/tools/list_ports_windows.py b/serial/tools/list_ports_windows.py index a9e200c..c158dd5 100644 --- a/serial/tools/list_ports_windows.py +++ b/serial/tools/list_ports_windows.py @@ -186,9 +186,10 @@ def comports(): szFriendlyName = byte_buffer(250) if not SetupDiGetDeviceRegistryProperty(g_hdi, ctypes.byref(devinfo), SPDRP_FRIENDLYNAME, None, ctypes.byref(szFriendlyName), ctypes.sizeof(szFriendlyName) - 1, None): # Ignore ERROR_INSUFFICIENT_BUFFER - if ctypes.GetLastError() != ERROR_INSUFFICIENT_BUFFER: + #~ if ctypes.GetLastError() != ERROR_INSUFFICIENT_BUFFER: #~ raise IOError("failed to get details for %s (%s)" % (devinfo, szHardwareID.value)) - port_name = None + # ignore errors and still include the port in the list, friendly name will be same as port name + yield string(port_name_buffer), string(port_name_buffer), string(szHardwareID) else: # the real com port name has to read differently... hkey = SetupDiOpenDevRegKey(g_hdi, ctypes.byref(devinfo), DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_READ) -- cgit v1.2.1