自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

教你在Linux中使用lsusb命令顯示有關(guān)USB設(shè)備信息

系統(tǒng) Linux
在Linux中我們使用lsusb命令列出USB設(shè)備及其屬性,lsusb用于顯示系統(tǒng)中的USB總線及其連接的設(shè)備信息。下面介紹如何安裝并使用。

[[393589]]

 在Linux中我們使用lsusb命令列出USB設(shè)備及其屬性,lsusb用于顯示系統(tǒng)中的USB總線及其連接的設(shè)備信息。下面介紹如何安裝并使用。

系統(tǒng)環(huán)境

系統(tǒng):Centos7

安裝usbutils

默認(rèn)Centos7系統(tǒng)中沒(méi)有l(wèi)susb命令,我們需要安裝usbutils安裝包,才能使用lsusb:

  1. [root@localhost ~]# yum -y install usbutils 

列出usb設(shè)備信息

lsusb用于顯示有關(guān)系統(tǒng)中的USB總線及其連接的設(shè)備的信息,下面運(yùn)行l(wèi)susb: 

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

lsusb將顯示系統(tǒng)內(nèi)部連接的驅(qū)動(dòng)程序和設(shè)備。

上面輸出內(nèi)容解釋如下:

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

Bus 001: 表示第一個(gè)usb控制器,可以使用lspci|grep USB查看主機(jī)有幾個(gè)usb控制器

Device 055: 表示系統(tǒng)分配給這個(gè)金士頓存儲(chǔ)設(shè)備的設(shè)備號(hào)

ID: 表示usb設(shè)備的ID

Kingston Technology Digital DataTraveler SE9 64GB: 表示其制造商名稱和設(shè)備名稱

我們還看到,系統(tǒng)中還附有USB 2.0 root hub 驅(qū)動(dòng)程序和USB 1.1 root hub 驅(qū)動(dòng)程序。

使用樹(shù)狀類(lèi)型顯示usb信息

使用-t選項(xiàng),以樹(shù)狀結(jié)構(gòu)顯示usb信息: 

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

數(shù)字12M、480M、5000M表示USB的傳輸速度。

  •  12M表示12Mbit / s,這是USB 1.0 / 1.1類(lèi)型
  •  480M表示480Mbit / s,這是USB 2.0類(lèi)型
  •  5000M表示5Gbit / s,這是USB3.0類(lèi)型

Linux從/usr/share/hwdata/usb.ids'識(shí)別USB設(shè)備的詳細(xì)信息。lsusb列出的vendor和device name都是從這個(gè)文件里面識(shí)別出來(lái)的。

如何列出USB詳細(xì)信息

使用-v參數(shù)查看usb詳細(xì)信息: 

  1. [root@localhost ~]# lsusb -v | less  
  2. Bus 001 Device 056: ID 0951:1665 Kingston Technology Digital DataTraveler SE9 64GB  
  3. Device Descriptor:  
  4.   bLength                18  
  5.   bDescriptorType         1  
  6.   bcdUSB               2.00  
  7.   bDeviceClass            0 (Defined at Interface level)  
  8.   bDeviceSubClass         0   
  9.   bDeviceProtocol         0   
  10.   bMaxPacketSize0        64  
  11.   idVendor           0x0951 Kingston Technology  
  12.   idProduct          0x1665 Digital DataTraveler SE9 64GB  
  13.   bcdDevice            1.00  
  14.   iManufacturer           1 Kingston  
  15.   iProduct                2 DataTraveler 2.0  
  16.   iSerial                 3 08606E6B6612FD50771C2A8B  
  17.   bNumConfigurations      1  
  18.   Configuration Descriptor:  
  19.     bLength                 9  
  20.     bDescriptorType         2  
  21.     wTotalLength           32  
  22.     bNumInterfaces          1  
  23.     bConfigurationValue     1  
  24.     iConfiguration          0   
  25.     bmAttributes         0x80  
  26.       (Bus Powered)  
  27.     MaxPower              100mA  
  28.     Interface Descriptor:  
  29.       bLength                 9  
  30.       bLength                 9  
  31.       bDescriptorType         4  
  32.       bInterfaceNumber        0  
  33.       bAlternateSetting       0  
  34.       bNumEndpoints           2  
  35.       bInterfaceClass         8 Mass Storage  
  36.       bInterfaceSubClass      6 SCSI  
  37.       bInterfaceProtocol     80 Bulk-Only  
  38.       iInterface              0   
  39.       Endpoint Descriptor:  
  40.         bLength                 7  
  41.         bDescriptorType         5  
  42.         bEndpointAddress     0x81  EP 1 IN  
  43.         bmAttributes            2  
  44.           Transfer Type            Bulk  
  45.           Synch Type               None  
  46.           Usage Type               Data  
  47.         wMaxPacketSize     0x0200  1x 512 bytes  
  48.         bInterval             255  
  49.       Endpoint Descriptor:  
  50.         bLength                 7  
  51.         bDescriptorType         5  
  52.         bEndpointAddress     0x02  EP 2 OUT  
  53.         bmAttributes            2  
  54.           Transfer Type            Bulk  
  55.           Synch Type               None  
  56.           Usage Type               Data  
  57.         wMaxPacketSize     0x0200  1x 512 bytes  
  58.         bInterval             255  
  59. Device Qualifier (for other device speed):  
  60.   bLength                10  
  61.   bDescriptorType         6  
  62.   bcdUSB               2.00  
  63.   bDeviceClass            0 (Defined at Interface level)  
  64.   bDeviceSubClass         0   
  65.   bDeviceProtocol         0   
  66.   bMaxPacketSize0        64  
  67.   bNumConfigurations      1  
  68. Device Status:     0x0000  
  69.   (Bus Powered) 

查找連接了多少個(gè)USB設(shè)備

查找鏈接的設(shè)備數(shù)量,可以使用下面命令查找: 

  1. [root@localhost ~]# find /dev/bus  
  2. /dev/bus  
  3. /dev/bus/usb  
  4. /dev/bus/usb/002  
  5. /dev/bus/usb/002/003  
  6. /dev/bus/usb/002/002  
  7. /dev/bus/usb/002/001  
  8. /dev/bus/usb/001  
  9. /dev/bus/usb/001/056  
  10. /dev/bus/usb/001/010  
  11. /dev/bus/usb/001/001 

結(jié)合使用lsusb命令和-D參數(shù),可以輸出特定設(shè)備的詳細(xì)信息。下面實(shí)例查看金士頓存儲(chǔ)設(shè)備的詳細(xì)信息:

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

查找大容量存儲(chǔ)設(shè)備

lsusb -v為我們提供了非常詳細(xì)的信息,我們可以配合使用grep命令查找指定的信息,下面過(guò)濾出idVendor和Mass Storage,來(lái)獲取大容量存儲(chǔ)設(shè)備: 

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

可以看到只有idVendor是Kingston Technology的設(shè)備才是大容量存儲(chǔ)設(shè)備。 

 

責(zé)任編輯:龐桂玉 來(lái)源: 良許Linux
相關(guān)推薦

2021-03-17 08:07:28

Linux Lsusb命令

2010-12-29 10:48:49

虛擬機(jī)

2023-08-12 15:05:26

Linuxcp 命令

2023-07-04 16:36:03

Linuxcd 命令

2023-07-23 19:26:18

Linuxcat 命令

2020-12-07 06:25:14

Linux Truncate 命令

2009-06-16 09:06:37

JavaMailJSP

2018-08-21 09:00:30

Linuxtop命令

2023-01-13 23:21:29

netcat命令Linux

2022-09-11 20:27:17

UbuntuLinux

2018-11-05 13:50:44

Linux命令tcpdump

2022-10-18 10:00:09

Linuxtcpdump命令

2013-07-02 10:25:03

LinuxUSB設(shè)備

2010-02-07 11:13:04

Android設(shè)備間

2013-05-14 10:13:06

WindowsLinux操作系統(tǒng)

2023-03-14 08:17:40

Bash編程語(yǔ)言

2018-05-16 10:32:06

Linux命令find

2018-06-26 09:15:24

Linux命令history

2022-11-18 10:16:26

Linuxwc 命令

2022-10-25 09:07:28

Linuxxargs命令
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)