16 lines
404 B
Python
16 lines
404 B
Python
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)
|
|
available_ports[port.name] = port.vid
|
|
devices = [port for port in available_ports.keys()]
|
|
print(devices)
|
|
print(ports[1].manufacturer)
|
|
#print(ports[0].name)
|