Ниже приведен код, который, как я полагаю, содержит информацию о портах на моем ПК.Мой компьютер имеет 1 COM-порт и 10 портов USB 2.0.Но когда я выполняюсь, он просто показывает информацию о COM-порте.
Вот мой код Python:
import serial.tools.list_ports
for port in serial.tools.list_ports.comports():
print("hwid:", port.hwid)
print("device:", port.device)
print("name:", port.name)
print("description:", port.description)
print("pid:", port.pid)
print("vid:", port.vid)
print("serial_number:", port.serial_number)
print("location:", port.location)
print("manufacturer:", port.manufacturer)
print("product:", port.product)
print("interface:", port.interface)
Вот результат:
hwid: ACPI\PNP0501\1
device: COM1
name: None
description: Communications Port (COM1)
pid: None
vid: None
serial_number: None
location: None
manufacturer: (Standard port types)
product: None
interface: None
Как вы можетевидите, что в списке нет USB-устройств.
Какова ваша идея?