USB 映射

映射 USB 端口和连接的设备

USBMap 是 SerialTool 的一项功能,可列出有关 USB 主控制器、USB 集线器和连接的 USB 设备的基本信息。

它还从系统注册表中检索设备信息,并通过 USB 请求直接访问设备。 USBMap 的主窗口分为两个面板:左侧面板显示一个面向连接的树状视图,允许选择任何 USB 设备;右侧面板显示与所选 USB 设备相关的 USB 数据结构。
这些结构包括设备、配置、接口和端点描述符,以及设备的当前配置。

USBMap 兼容 Windows、macOS 和 Linux,对于查看连接到计算机不同端口的 USB 设备非常有用。它可以区分 主控制器接口 (USB, Firewire)USB 集线器外部 USB 集线器、通用设备和 串行端口。 在串行端口方面,USBMap 还显示特定 USB 转换器的可用串行端口,这在某个 USB 串行设备能够创建多个串行端口时尤为实用,否则这些端口很难识别。

USBMap 提供的详细信息对开发人员和技术人员非常重要,能够帮助他们分析连接 USB 设备的特定特性。信息的详细程度可能因操作系统不同而有所不同,但 USBMap 始终能够提供全面且准确的设备分析。

USBMap 的一个独特之处在于,这项功能通常在不同的操作系统上仅对开发人员开放,而在 SerialTool 中无需安装任何附加软件包或工具即可直接访问,简化了使用流程。

显示的信息可以直接复制到剪贴板中,USB 端口映射可以导出为 ASCII 格式,方便分析结果的共享和记录。

注释 1: USBMap 显示连接的 USB 设备,而不会显示可能存在的虚拟串行端口。
注释 2: 在 SerialTool 的免费版中,此工具的一些功能可能会受到限制。 立即获取 SerialTool 专业版!



USBMap - 扫描已连接的 USB 端口

具有多个串行端口的 USB 转换器示例

下面是 Nanjing Qinherg Electronics Co. 公司生产的 CH 347 USB 转换器的示例,该转换器在单一 USB 连接下创建了两个串行端口。

Screenshot of USBMap displaying detailed information about a USB device

USBMap - 具有多个串行端口的 USB 转换器详细信息


[Port12] : USB Composite Device
Type: Serial Port
[Multiple Serial Port 1]Serial Port Number: COM9
[Multiple Serial Port 1]Device Description: USB-HiSpeed-SERIAL-B CH347
[Multiple Serial Port 1]Friendly Name: USB-HiSpeed-SERIAL-B CH347 (COM9)
[Multiple Serial Port 1]Manufacturer: wch.cn
[Multiple Serial Port 1]Location Path: PCIROOT(0)#PCI(1400)#USBROOT(0)#USB(12)#USBMI(2)
[Multiple Serial Port 1]USB Parent: USB\VID_1A86&PID_55DA\0123456789
[Multiple Serial Port 1]Driver Key: {4d36e978-e325-11ce-bfc1-08002be10318}\0011
[Multiple Serial Port 1]Hardware ID: USB\VID_1A86&PID_55DA&REV_0441&MI_02
Type: Serial Port
[Multiple Serial Port 2]Serial Port Number: COM10
[Multiple Serial Port 2]Device Description: USB-HiSpeed-SERIAL-A CH347
[Multiple Serial Port 2]Friendly Name: USB-HiSpeed-SERIAL-A CH347 (COM10)
[Multiple Serial Port 2]Manufacturer: wch.cn
[Multiple Serial Port 2]Location Path: PCIROOT(0)#PCI(1400)#USBROOT(0)#USB(12)#USBMI(0)
[Multiple Serial Port 2]USB Parent: USB\VID_1A86&PID_55DA\0123456789
[Multiple Serial Port 2]Driver Key: {4d36e978-e325-11ce-bfc1-08002be10318}\0012
[Multiple Serial Port 2]Hardware ID: USB\VID_1A86&PID_55DA&REV_0441&MI_00

Is Port User Connectable: yes
Is Port Debug Capable: no
Companion Port Number: 22
Companion Hub Symbolic Link Name: USB#ROOT_HUB30#4&3783c1a5&0&0#{f18a0e88-c30c-11d0-8815-00a0c906bed8}
Protocols Supported:
USB 1.1: yes
USB 2.0: yes
USB 3.0: no

---===>Device Information<===---
English product name: "USB Dual_Serial"

ConnectionStatus:
Current Config Value: 0x01
-> Device Bus Speed: High
(is not SuperSpeed or higher capable)
Device Address: 0x29
Open Pipes: 6

===>Device Descriptor<===
bLength: 0x12
bDescriptorType: 0x01
bcdUSB: 0x0200
bDeviceClass: 0xEF
-> This is a Multi-interface Function Code Device
bDeviceSubClass: 0x02
-> This is the Common Class Sub Class
bDeviceProtocol: 0x01
-> This is the Interface Association Descriptor protocol
bMaxPacketSize0: 0x40
= (64) Bytes
idVendor: 0x1A86
= Nanjing Qinherg Electronics Co., Ltd.
idProduct: 0x55DA
bcdDevice: 0x0441
iManufacturer: 0x01
English (United States) "wch.cn"
iProduct: 0x02
English (United States) "USB Dual_Serial"
iSerialNumber: 0x03
English (United States) "0123456789"
bNumConfigurations: 0x01

---===>Open Pipes<===---

===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x81
-> Direction: IN - EndpointID: 1
bmAttributes: 0x03
-> Interrupt Transfer Type
wMaxPacketSize: 0x0040
= 1 transactions per microframe, 0x40 max bytes
bInterval: 0x01

===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x02
-> Direction: OUT - EndpointID: 2
bmAttributes: 0x02
-> Bulk Transfer Type
wMaxPacketSize: 0x0200
= 0x200 max bytes
bInterval: 0x00

===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x82
-> Direction: IN - EndpointID: 2
bmAttributes: 0x02
-> Bulk Transfer Type
wMaxPacketSize: 0x0200
= 0x200 max bytes
bInterval: 0x00

===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x83
-> Direction: IN - EndpointID: 3
bmAttributes: 0x03
-> Interrupt Transfer Type
wMaxPacketSize: 0x0040
= 1 transactions per microframe, 0x40 max bytes
bInterval: 0x01

===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x04
-> Direction: OUT - EndpointID: 4
bmAttributes: 0x02
-> Bulk Transfer Type
wMaxPacketSize: 0x0200
= 0x200 max bytes
bInterval: 0x00

===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x84
-> Direction: IN - EndpointID: 4
bmAttributes: 0x02
-> Bulk Transfer Type
wMaxPacketSize: 0x0200
= 0x200 max bytes
bInterval: 0x00

---===>Full Configuration Descriptor<===---

===>Configuration Descriptor<===
bLength: 0x09
bDescriptorType: 0x02
wTotalLength: 0x008D
-> Validated
bNumInterfaces: 0x04
bConfigurationValue: 0x01
iConfiguration: 0x00
bmAttributes: 0x80
-> Bus Powered
MaxPower: 0x64
= 200 mA

===>IAD Descriptor<===
bLength: 0x08
bDescriptorType: 0x0B
bFirstInterface: 0x00
bInterfaceCount: 0x02
bFunctionClass: 0x02
-> This is Communications (CDC Control) USB Device Interface Class
bFunctionSubClass: 0x02
bFunctionProtocol: 0x01
iFunction: 0x00

===>Interface Descriptor<===
bLength: 0x09
bDescriptorType: 0x04
bInterfaceNumber: 0x00
bAlternateSetting: 0x00
bNumEndpoints: 0x01
bInterfaceClass: 0x02
-> This is Communications (CDC Control) USB Device Interface Class
bInterfaceSubClass: 0x02
bInterfaceProtocol: 0x01
iInterface: 0x00
-> This is a Communications (CDC Control) USB Device Interface Class

===>Descriptor Hex Dump<===
bLength: 0x05
bDescriptorType: 0x24
05
24
00
10
01
-> This is a Communications (CDC Control) USB Device Interface Class

===>Descriptor Hex Dump<===
bLength: 0x05
bDescriptorType: 0x24
05
24
01
00
01
-> This is a Communications (CDC Control) USB Device Interface Class

===>Descriptor Hex Dump<===
bLength: 0x04
bDescriptorType: 0x24
04
24
02
02
-> This is a Communications (CDC Control) USB Device Interface Class

===>Descriptor Hex Dump<===
bLength: 0x05
bDescriptorType: 0x24
05
24
06
00
01

===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x81
-> Direction: IN - EndpointID: 1
bmAttributes: 0x03
-> Interrupt Transfer Type
wMaxPacketSize: 0x0040
= 1 transactions per microframe, 0x40 max bytes
bInterval: 0x01

===>Interface Descriptor<===
bLength: 0x09
bDescriptorType: 0x04
bInterfaceNumber: 0x01
bAlternateSetting: 0x00
bNumEndpoints: 0x02
bInterfaceClass: 0x0A
-> This is a CDC Data USB Device Interface Class
bInterfaceSubClass: 0x00
bInterfaceProtocol: 0x00
iInterface: 0x00

===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x02
-> Direction: OUT - EndpointID: 2
bmAttributes: 0x02
-> Bulk Transfer Type
wMaxPacketSize: 0x0200
= 0x200 max bytes
bInterval: 0x00

===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x82
-> Direction: IN - EndpointID: 2
bmAttributes: 0x02
-> Bulk Transfer Type
wMaxPacketSize: 0x0200
= 0x200 max bytes
bInterval: 0x00

===>IAD Descriptor<===
bLength: 0x08
bDescriptorType: 0x0B
bFirstInterface: 0x02
bInterfaceCount: 0x02
bFunctionClass: 0x02
-> This is Communications (CDC Control) USB Device Interface Class
bFunctionSubClass: 0x02
bFunctionProtocol: 0x01
iFunction: 0x00

===>Interface Descriptor<===
bLength: 0x09
bDescriptorType: 0x04
bInterfaceNumber: 0x02
bAlternateSetting: 0x00
bNumEndpoints: 0x01
bInterfaceClass: 0x02
-> This is Communications (CDC Control) USB Device Interface Class
bInterfaceSubClass: 0x02
bInterfaceProtocol: 0x01
iInterface: 0x00
-> This is a Communications (CDC Control) USB Device Interface Class

===>Descriptor Hex Dump<===
bLength: 0x05
bDescriptorType: 0x24
05
24
00
10
01
-> This is a Communications (CDC Control) USB Device Interface Class

===>Descriptor Hex Dump<===
bLength: 0x05
bDescriptorType: 0x24
05
24
01
00
01
-> This is a Communications (CDC Control) USB Device Interface Class

===>Descriptor Hex Dump<===
bLength: 0x04
bDescriptorType: 0x24
04
24
02
02
-> This is a Communications (CDC Control) USB Device Interface Class

===>Descriptor Hex Dump<===
bLength: 0x05
bDescriptorType: 0x24
05
24
06
02
03

===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x83
-> Direction: IN - EndpointID: 3
bmAttributes: 0x03
-> Interrupt Transfer Type
wMaxPacketSize: 0x0040
= 1 transactions per microframe, 0x40 max bytes
bInterval: 0x01

===>Interface Descriptor<===
bLength: 0x09
bDescriptorType: 0x04
bInterfaceNumber: 0x03
bAlternateSetting: 0x00
bNumEndpoints: 0x02
bInterfaceClass: 0x0A
-> This is a CDC Data USB Device Interface Class
bInterfaceSubClass: 0x00
bInterfaceProtocol: 0x00
iInterface: 0x00

===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x04
-> Direction: OUT - EndpointID: 4
bmAttributes: 0x02
-> Bulk Transfer Type
wMaxPacketSize: 0x0200
= 0x200 max bytes
bInterval: 0x00

===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x84
-> Direction: IN - EndpointID: 4
bmAttributes: 0x02
-> Bulk Transfer Type
wMaxPacketSize: 0x0200
= 0x200 max bytes
bInterval: 0x00

Windows 提供的信息结构

串行端口详细信息:

USB 端口 (Port12) 用于将设备管理为复合 USB 设备,这意味着它具有多个接口,可以管理不同的通信通道。
由设备创建的每个虚拟串行端口都有自己的标识:

- COM9 名称为 "USB-HiSpeed-SERIAL-B CH347"
- COM10 名称为 "USB-HiSpeed-SERIAL-A CH347"

每个串行端口具有:

一个友好名称,用于在系统中标识端口。
一个位置路径 (Location Path),指示设备的物理连接位置。
一个驱动程序键和硬件 ID,它们是设备的唯一信息,帮助操作系统正确识别硬件类型和所需的驱动程序。

连接和传输类型:

此设备支持 USB 1.1 和 USB 2.0,但不支持 USB 3.0。这在 "支持的协议" 部分中进行了说明。 每个端口使用 Bulk 端点(用于大数据量)和 Interrupt 端点(用于更快速和持续的信号)进行数据传输,从而有效地传输串行数据。

设备描述符:

描述符部分提供了有关 USB 设备类型、功能类(例如,通信 (CDC 控制 - 通用串行总线设备类) ) 对于通信设备的详细信息,以及接口的组织方式。 还显示了完整的配置描述,包括设备所需的最大功率(本例中为 200 mA)和与各接口及端点相关的值。

创建多个串行端口的能力:

此设备能够通过单一 USB 物理连接创建多个串行端口。当需要一个多通道串行接口或需要多次通信连接的设备时,这特别有用。

USBMap 的实用性:

使用 USBMap,可以清晰地查看每个创建的端口的详细信息,轻松将每个虚拟串行端口与提供它们的物理设备关联。这在复杂系统中区分不同转换器和串行端口非常有用。 USBMap 还允许检查每个设备关联的端口(或多个端口),并将这些信息导出用于文档或诊断。

该示例展示了一个多端口 USB 转换器如何通过单一 USB 端口管理多个连接。借助像 USBMap 这样的工具,可以详细而深入地查看连接,简化了与 USB 串行通信相关的监控、配置和故障排除。这对与复杂通信设备工作的开发人员、技术人员和系统集成商来说是一个巨大的优势。