Linux LSUSB命令 - 打印有关系统上USB的信息
时间:2020-03-05 15:28:35 来源:igfitidea点击:
通用串行总线或者USB旨在标准化计算机外围设备的连接,如键盘,指点设备,打印机,数码相机,便携式媒体播放器,磁盘驱动器和网络适配器"来源:维基百科
由于它成为一个行业标准,现在它很难看到没有USB端口的电脑。
USB FlashDisk的用法使其更受欢迎。
在Linux上,我们有LSUSB列出USB设备及其属性。
什么是lsusb.
从其手册页中,LSUSB定义为:
用于在系统中显示有关USB总线的信息和连接到它们的设备的实用程序。
如何运行LSUSB
要运行LSUS,我们可以直接从控制台键入lsusb。
$lsusb Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 002 Device 003: ID 17ef:4811 Lenovo Integrated Webcam [R5U877] Bus 008 Device 002: ID 0a5c:217f Broadcom Corp. Bluetooth Controller
LSUS将向我们展示内部附在系统上的驱动程序和设备。这是如何读取输出的方法。我从上面的输出中获取最后一行:总线008设备002:ID 0A5C:217F Broadcom Corp.蓝牙控制器
- 总线008:装置附上设备的手段
- 设备002:表示这是添加的第二个设备
- ID:表示此设备的ID号
- Broadcom Corp.蓝牙控制器:表示其制造商名称和设备名称
我们还看到我们的系统中还有USB 2.0根集线器驱动程序和USB 1.1根集线器驱动程序。
还可以使用DMESG命令显示这一点。
这是它的一个例子。
$dmesg |grep -i usb [ 0.353138] usbcore: registered new interface driver usbfs [ 0.353150] usbcore: registered new interface driver hub [ 0.353182] usbcore: registered new device driver usb [ 0.730026] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver [ 0.730116] ehci_hcd 0000:00:1a.7: new USB bus registered, assigned bus number 1 [ 0.748019] ehci_hcd 0000:00:1a.7: USB 2.0 started, EHCI 1.00 [ 0.748169] hub 1-0:1.0: USB hub found [ 0.748336] ehci_hcd 0000:00:1d.7: new USB bus registered, assigned bus number 2 [ 0.768019] ehci_hcd 0000:00:1d.7: USB 2.0 started, EHCI 1.00 [ 0.768147] hub 2-0:1.0: USB hub found [ 0.768236] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver [ 0.768251] uhci_hcd: USB Universal Host Controller Interface driver
如何列出USB详细信息
使用"-v" paramater来做。
这是它的示例。
$lsusb -v Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 5 bNumEndpoints 2 bInterfaceClass 224 Wireless bInterfaceSubClass 1 Radio Frequency bInterfaceProtocol 1 Bluetooth iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x83 EP 3 IN bmAttributes 1 Transfer Type Isochronous Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 1 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x03 EP 3 OUT bmAttributes 1 Transfer Type Isochronous Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 1
找到连接了多少USB设备
要找到它使用此命令
$find /dev/bus
然后你将有一个这样的输出:
/dev/bus /dev/bus/usb /dev/bus/usb/008 /dev/bus/usb/008/002 /dev/bus/usb/008/001 /dev/bus/usb/007 /dev/bus/usb/007/001 /dev/bus/usb/006 /dev/bus/usb/006/001 /dev/bus/usb/005 /dev/bus/usb/005/001 /dev/bus/usb/004 /dev/bus/usb/004/001 /dev/bus/usb/003 /dev/bus/usb/003/001 /dev/bus/usb/002 /dev/bus/usb/002/004 /dev/bus/usb/002/003 /dev/bus/usb/002/001 /dev/bus/usb/001 /dev/bus/usb/001/001
使用LSUSB命令与-d
参数组合,我们可以打印特定设备的详细信息。
以下是查看Broadcom蓝牙设备的示例。
$lsusb -D /dev/bus/usb/008/002 Device: ID 0a5c:217f Broadcom Corp. Bluetooth Controller Couldn't open device, some information will be missing Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 224 Wireless bDeviceSubClass 1 Radio Frequency bDeviceProtocol 1 Bluetooth bMaxPacketSize0 64 idVendor 0x0a5c Broadcom Corp. idProduct 0x217f Bluetooth Controller bcdDevice 3.60 iManufacturer 1 iProduct 2 iSerial 3 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2
找到大容量存储
由于LSUSB -V
向我们提供了一个非常详细信息,因此我们可能会错过读取的东西。
我们可以使用Grep命令专注于特定信息。
这是一些示例 。
大众存储将有供应商名称和ID。
我们可以用它作为起点。
$lsusb -v |grep -Ei '(idVendor|Mass\ Storage)' idVendor 0x1005 Apacer Technology, Inc. bInterfaceClass 8 Mass Storage
我们可以看出,我们在我们的系统上附有一个USB大众存储,来自Apacer Technology,Inc。
将物理USB设备层次结构转储为树
使用"-t"参数来满足此目的。
$lsusb -t /: Bus 08.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M /: Bus 07.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M /: Bus 06.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M /: Bus 05.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M /: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M /: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M /: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci_hcd/6p, 480M |__ Port 1: Dev 4, If 0, Class=stor., Driver=usb-storage, 480M |__ Port 6: Dev 3, If 0, Class='bInterfaceClass 0x0e not yet handled', Driver=uvcvideo, 480M |__ Port 6: Dev 3, If 1, Class='bInterfaceClass 0x0e not yet handled', Driver=uvcvideo, 480M /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci_hcd/6p, 480M
12m和480m的数字表示USB类型的传输速率速度。
- 12M表示12Mbit/s,它为USB 1.0/1.1型
- 480m表示480Mbit/s,它是USB 2.0类型
如果找到5.0g,则意味着我们有3.0型。
它具有5.0Gbit/s的转移率。
Linux识别来自'/var/lib/usbutils/usb.ids'的USB设备的细节。
我们可以访问Linux-USB.org以获取USB ID的最新列表或者通用串行总线的实用教程。