2024-10-08 17:47:23 +04:00
|
|
|
import serial.tools.list_ports
|
|
|
|
|
|
|
|
ports = serial.tools.list_ports.comports()
|
|
|
|
|
|
|
|
for port, desc, hwid in sorted(ports):
|
|
|
|
print("{}: {} [{}]".format(port, desc, hwid))
|
|
|
|
|
|
|
|
available_ports = {}
|
|
|
|
for port in ports:
|
|
|
|
print(port.serial_number)
|
2024-10-08 22:37:24 +04:00
|
|
|
available_ports[port.name] = port.vid
|
2024-10-08 17:47:23 +04:00
|
|
|
devices = [port for port in available_ports.keys()]
|
|
|
|
print(devices)
|
|
|
|
print(ports[1].manufacturer)
|
|
|
|
#print(ports[0].name)
|