I'm trying to list the serial ports in my Windows based PC.
This is my port list: (COM3 & COM8)
Code:
if sys.platform.startswith("win32"):
from serial.tools.list_ports_windows import *
elif sys.platform.startswith("linux"):
from serial.tools.list_ports import *
else:
raise ImportError("Sorry: no implementation for your platform {} available".format(sys.platform))
.........Class definition and other methods..................
def GetList(self, verbose=True):
"""
gets the list of all available ports
"""
results = []
hits = 0
iterator = sorted(comports())
# list them
for port, desc, hwid in iterator:
comPort = port
if verbose:
descValue = desc
hwidValue = hwid
results.append({'comPort': comPort, 'descValue': descValue, 'hwidValue': hwidValue})
else:
results.append({'comPort': comPort})
hits += 1
results.append({"available": "{} ports found".format(hits)})
return results
Output:
[{'hwidValue': 'PCI\\VEN_8086&DEV_1E3D&SUBSYS_21F317AA&REV_04', 'descValue': 'Intel(R) Active Management Technology - SOL (COM3)', 'comPort': 'COM3'}, {'available': '1 ports found'}]
Question:
Why can't i see all the ports in my PC is there a problem in my code?
as you can see in the picture i have 2 ports COM3 and COM8.
Does list_ports_windows
has limitations for Virtual com ports?