import win32com.client
wmi = win32com.client.GetObject("winmgmts:")
for port in wmi.InstancesOf("Win32_SerialPort"):
print port.DeviceID, port.Name
Detect device names on serial ports in Python
-
31-05-2022 - |
Question
I use a USB connected Nokia phone to send SMS messages via a COM port in Windows using Python. Evertyhing works fine until a COM port changes. Is there a way to detect which COM port my phone is sitting on? If I understand correctly, only way to do this is to get a list of all availalbe ports and to poll them one by one. What would be the safest and quickest way of doing this?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow