Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the Lsusb command to display information about USB devices in Linux

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article shows you how to use the Lsusb command in Linux to display information about USB devices. The content is concise and easy to understand. It will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

In Linux, we use the lsusb command to list USB devices and their properties, and lsusb is used to display the USB bus in the system and the device information to which it is connected.

System: Centos7

Install usbutils

There is no lsusb command in the default Centos7 system, so we need to install the usbutils installation package to use lsusb:

[root@localhost ~] # yum-y install usbutils lists usb device information

Lsusb is used to display information about the USB bus in the system and its connected devices, run lsusb below:

[root@localhost] # lsusb Bus 001 Device 010: ID 0bda:0129 Realtek Semiconductor Corp. RTS5129 Card Reader Controller Bus 001 Device 055: ID 0951 root hub Bus 1665 Kingston Technology Digital DataTraveler SE9 64GB Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1root hub

Lsusb displays drivers and devices that are connected internally to the system.

The above output is explained as follows:

Bus 001 Device 055: ID 0951:1665 Kingston Technology Digital DataTraveler SE9 64GB

Bus 001: indicates the first usb controller. You can use lspci | grep USB to check how many usb controllers the host has. Device 055: indicates the device number assigned by the system to this Kingston storage device ID: indicates the IDKingston Technology Digital DataTraveler SE9 64GB of the usb device: indicates its manufacturer's name and device name.

We also see that USB 2.0 root hub drivers and USB 1.1 root hub drivers are also included in the system.

Use the tree type to display usb information using

-t option to display usb information in a tree structure:

[root@localhost ~] # lsusb-t /: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000m /: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480m | _ _ Port 1: Dev 2, If 0, Class=Mass Storage, Driver=usb-storage, 480m /: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12m | _ Port 1: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid 12m | _ _ Port 2: Dev 3, If 0, Class=Hub, Driver=hub/7p, 12m /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480m

The numbers 12m, 480m and 5000m represent the transmission speed of USB.

12m stands for 12Mbit / s, which is USB 1.0 / 1.1type

480m stands for 480Mbit / s, which is a USB 2.0 type

5000m represents 5Gbit / s, which is the USB3.0 type

Linux recognizes the details of the USB device from / usr/share/hwdata/usb.ids'. The vendor and device name listed by lsusb are identified from this file.

How to list USB details

Use the-v parameter to view usb details:

[root@localhost ~] # lsusb-v | less Bus 001 Device 056: ID 0951 Device 1665 Kingston Technology Digital DataTraveler SE9 64GB Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 idVendor 0x0951 Kingston Technology idProduct 0x1665 Digital DataTraveler SE9 64GB bcdDevice 1.00 iManufacturer 1 Kingston iProduct 2 DataTraveler 2.0 iSerial 3 08606E6B6612FD50771C2A8B bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 32 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0x80 (Bus Powered) MaxPower 100mA Interface Descriptor: bLength 9 bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 8 Mass Storage bInterfaceSubClass 6 SCSI bInterfaceProtocol 80 Bulk-Only iInterface 0 Endpoint Descriptor: BLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 255 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x02 EP 2 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 255Device Qualifier (for other device speed): bLength 10 bDescriptorType 6 bcdUSB 2.00 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 bNumConfigurations 1 Device Status: 0x0000 (Bus Powered) find how many USB devices are connected

To find the number of linked devices, you can find them using the following command:

[root@localhost ~] # find / dev/bus/ dev/bus/ dev/bus/usb/ dev/bus/usb/002/ dev/bus/usb/002/003 / dev/bus/usb/002/002 / dev/bus/usb/002/001 / dev/bus/usb/001/ dev/bus/usb/001/056 / dev/bus/usb/001/010 / dev/bus/usb/001/001

Using the lsusb command in conjunction with the-D parameter, you can output the details of a specific device. The following example views the details of a Kingston storage device:

[root@localhost] # lsusb-D / dev/bus/usb/001/056

Find mass storage Devic

Lsusb-v provides us with very detailed information. We can use the grep command to find the specified information. Filter out idVendor and Mass Storage below to obtain mass storage devices:

[root@localhost ~] # lsusb-v | grep-Ei'(idVendor | Mass\ Storage) 'idVendor 0x0bda Realtek Semiconductor Corp. IdVendor 0x0951 Kingston Technology bInterfaceClass 8 Mass Storage idVendor 0x1d6b Linux Foundation idVendor 0x0e0f VMware, Inc. IdVendor 0x0e0f VMware, Inc. IdVendor 0x1d6b Linux Foundation

You can see that only devices where idVendor is Kingston Technology are mass storage devices.

The above is how to use the Lsusb command in Linux to display information about USB devices. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report