linux - 如何将 lsusb 列出的 USB 设备与 dmesg 显示的 USB 序列号匹配?
问题描述
我在这里有一个连接了很多 USB 设备的设置,这是我的lsusb
输出:
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
如您所见,有多个相同的设备和多个具有相同供应商 ID 的集线器。我正在使用 Wireshark(实际上是 tshark)监控这些,我得到一些像这样的错误:
293549 43.514117 3.17.1 → host USB 66 URB_BULK in[Malformed Packet]
但是,如果没有设备的序列号,我无法从物理上识别它是哪个设备。
我可以在 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
我的问题是:我怎样才能匹配这两个东西?或者至少,dmesg
在我从 tshark 获得的数字中,我怎样才能获得相同的“序列号”?
(在观看 dmesg 和 lsusb 时重置每个设备以查看哪个设备不是一个选项)
解决方案
知道了!原来你可以用sudo lsusb -v
. 它必须以 root 身份运行,否则文件将为空,然后要清理所有无用的信息,请执行如下快速 grep 操作:
lsusb -v | grep '^Bus\|iSerial'
这是 grepping 2 个结果(由 OR 运算符分隔的 \| 分隔),第一个是用单词 Bus 开始(^)的东西,第二个是它包含单词 serial
还偶然发现了另一个我不知道的命令:
usb-devices
推荐阅读
- spring - 使用 pom.xml 管理 Nexus 存储库
- ruby - 执行测试时无法加载此类文件 - dbd-pg (LoadError)
- elasticsearch - 如何将聚合结果重新索引到 Elasticsearch 中的另一个索引中?
- html - 从 dom 中删除 svg 后,svg 中的图像会继续加载
- android - 何时将数据保存在 DB 中,何时保存在简单类中更好
- angular - Angular 项目中的 CSS
- asp.net - 为什么应用程序也会访问本地 ADFS?
- python - Python 2.7 和 3.9 之间 ord() 函数的区别
- reactjs - React-Saga 效果
- python - SQLAlchemy 'Connection' 对象没有属性 '_Inspector__engine'