lsusb [-v]
lsusb
lsusb 可以列出連接的 USB 裝置。
例如:
$ lsusb Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 002: ID 80ee:0021 VirtualBox USB Tablet Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
|
Tip
|
OS X 沒有 brew update && brew tap jlhonora/lsusb && brew install lsusb 用法大致上跟 Linux 的版本相同 (背後利用 OS X 內建的 |
每一行都代表一個 USB 裝置,包含 4 項資訊:
<1> <2> <3> (4)
| | | |
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
|
Tip
|
Vendor ID 及 product ID 所代表的名稱,可以到 The USB ID Repository 查詢。 |
在 Linux,每一個 USB bus 都用一個虛擬裝置 root hub 來表示,它的 device number 固定是 001,vendor ID 固定是 1d6b (Linux Foundation),且 product ID 本身就大概能看出 USB bus 的版本:
-
0001- 1.1 root hub ⇒ USB 1.1, Full Speed (12 Mbit/s) -
0002- 2.0 root hub ⇒ USB 2.0, High Speed (480 Mbit/s) -
0003- 3.0 root hub ⇒ USB 3.0, SuperSpeed (5 Gbit/s)
|
Tip
|
由於 root hub 是虛擬裝置,搭配下面提到的 $ lsusb | grep -v 'root hub' Bus 002 Device 002: ID 80ee:0021 VirtualBox USB Tablet |
加 -v (--verbose) 可以顯示裝置的細部資訊,通常會搭配 -s 或 -d 指定裝置:
lsusb -v -s <BUS_NUMBER>:<DEVICE_NUMBER> lsusb -v -d <VENDOR_ID>:<DEVICE_ID>
以上面的 VirtualBox USB Tablet 為例,可以用 -s 2:2 或 -d 80ee:0021 指定,效果是一樣的:
$ lsusb -v -d 80ee:0021
Bus 002 Device 002: ID 80ee:0021 VirtualBox USB Tablet
Couldn't open device, some information will be missing
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x80ee VirtualBox
idProduct 0x0021 USB Tablet
bcdDevice 1.00
iManufacturer 1
iProduct 3
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
...
若想要看出 USB bus 跟裝置間的階層關係 (hierarchy),可以搭配 -t 使用:
lsusb -t
例如:
$ lsusb -t
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ohci-pci/12p, 12M
|__ Port 1: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 12M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/12p, 480M
不過缺點是看不出裝置名稱,只能透過 -s 反查:
lsusb [-v] -s <BUS_NUMBER>:<DEVICE_NUMBER>
例如:
$ lsusb -s 2:2 Bus 002 Device 002: ID 80ee:0021 VirtualBox USB Tablet