#140 PySerial not enumerating all COM ports

v2.6
closed-duplicate
None
5
2013-10-14
2013-01-14
No

I'm on a Windows 7 x64 machine, using Python 2.7.2 and the PySerial 2.6, as downloaded from PyPi.

Using serial.tools.list_ports.comports() enumerates 3 of my COM ports, however, it ignores a USB-to-Serial dongle I have. The dongle is recognized by other programs, by Windows, etc... If I manually enter the 'missing' COM port, PySerial connects. So, it seems to be an issue with enumeration.

I am successfully able to enumerate the missing COM port using this code (stolen from the interwebs):
""" Uses the Win32 registry to return an
iterator of serial (COM) ports
existing on this computer.
"""
path = 'HARDWARE\\DEVICEMAP\\SERIALCOMM'
try:
key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, path)
except WindowsError:
raise IterationError

for i in itertools.count():
try:
val = winreg.EnumValue(key, i)
yield str(val[1])
except EnvironmentError:
break

Discussion

  • Chris Liechti

    Chris Liechti - 2013-10-14

    The enumeration code has been updated and should now find more ports (in pySerial 2.7).

    The solution with enumerating HARDWARE\DEVICEMAP\SERIALCOMM does not provide the required information such as hardware id and friendly name.

     
  • Chris Liechti

    Chris Liechti - 2013-10-14
    • status: open --> closed-duplicate
    • assigned_to: Chris Liechti
    • Group: --> v2.6
     

Log in to post a comment.