简体   繁体   English

如何将 lsusb 列出的 usb 设备与 dmesg 显示的 usb 序列号匹配?

[英]How to match usb device listed with lsusb with usb serial number displayed with dmesg?

I have a setup here with a lot of USB devices connected this is my lsusb output:我在这里设置了很多 USB 设备,这是我的lsusb output:

Bus 003 Device 013: ID 16c0:05dc Van Ooijen Technische Informatica shared ID for use with libusb
Bus 003 Device 014: ID 16c0:05dc Van Ooijen Technische Informatica shared ID for use with libusb
Bus 003 Device 011: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 003 Device 015: ID 16c0:05dc Van Ooijen Technische Informatica shared ID for use with libusb
Bus 003 Device 009: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 003 Device 016: ID 16c0:05dc Van Ooijen Technische Informatica shared ID for use with libusb
Bus 003 Device 017: ID 16c0:05dc Van Ooijen Technische Informatica shared ID for use with libusb
Bus 003 Device 018: ID 16c0:05dc Van Ooijen Technische Informatica shared ID for use with libusb
Bus 003 Device 008: ID 16c0:05dc Van Ooijen Technische Informatica shared ID for use with libusb
Bus 003 Device 006: ID 08bb:29c6 Texas Instruments PCM2906C Audio CODEC
Bus 003 Device 003: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 003 Device 002: ID 0424:2517 Standard Microsystems Corp. Hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 013: ID 16c0:05dc Van Ooijen Technische Informatica shared ID for use with libusb
Bus 001 Device 014: ID 16c0:05dc Van Ooijen Technische Informatica shared ID for use with libusb
Bus 001 Device 015: ID 16c0:05dc Van Ooijen Technische Informatica shared ID for use with libusb
Bus 001 Device 012: ID 04b4:00f8 Cypress Semiconductor Corp. 
Bus 001 Device 010: ID 04b4:00f3 Cypress Semiconductor Corp. 
Bus 001 Device 016: ID 16c0:05dc Van Ooijen Technische Informatica shared ID for use with libusb
Bus 001 Device 017: ID 16c0:05dc Van Ooijen Technische Informatica shared ID for use with libusb
Bus 001 Device 004: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 005: ID 8087:0aaa Intel Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

as you can see there are multiple of the same devices and multiple hubs with the same vendor id and all.如您所见,有多个相同的设备和多个具有相同供应商 ID 的集线器。 I am monitoring these with Wireshark (tshark actually) and I get some errors like this:我正在使用 Wireshark(实际上是 tshark)监控这些,我得到一些像这样的错误:

293549  43.514117       3.17.1 → host         USB 66 URB_BULK in[Malformed Packet]

However, I can't physically identify which device it is without the device's serial number.但是,如果没有设备的序列号,我无法从物理上识别它是哪个设备。

I can see this serial number on dmesg我可以在 dmesg 上看到这个序列号

[Wed Feb 17 16:03:29 2021] usb 1-3.2.1: New USB device found, idVendor=16c0, idProduct=05dc
[Wed Feb 17 16:03:29 2021] usb 1-3.2.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[Wed Feb 17 16:03:29 2021] usb 1-3.2.1: Product: USB BDC
[Wed Feb 17 16:03:29 2021] usb 1-3.2.1: Manufacturer: www.engineeredarts.co.uk
[Wed Feb 17 16:03:29 2021] usb 1-3.2.1: SerialNumber: 345B34673238

My question is: How can I match these two things?我的问题是:我怎样才能匹配这两个东西? or at least, how can I get that same 'SerialNumber' that dmesg displays, of the numbers I get from tshark?或者至少,我怎样才能获得与dmesg显示的相同的“序列号”,以及我从 tshark 获得的数字?

(resetting each device to see which one is which while watching dmesg and lsusb isn't an option) (在观看 dmesg 和 lsusb 时重置每个设备以查看哪个设备不是一个选项)

Got it!知道了! Turns out you can see the serial with sudo lsusb -v .原来你可以用sudo lsusb -v看到这个序列。 It has to be run as root otherwise the files will be empty, then to clean all the useless info did a quick grep like so:它必须以 root 身份运行,否则文件将为空,然后清理所有无用的信息,快速 grep 如下所示:

lsusb -v | grep '^Bus\|iSerial'

This is grepping 2 results (separated by \| which is the OR operator), first one are stuff that start(^) with the word Bus and the second one is that it contains the word serial这是 grepping 2 个结果(由 OR 运算符分隔的 \| 分隔),第一个是用单词 Bus 开始(^)的东西,第二个是它包含单词 serial

also stumbled across another command that I didn't know about:还偶然发现了另一个我不知道的命令:

usb-devices

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM