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

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

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

[[388025]]

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

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

系統(tǒng):Centos7

安裝usbutils

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

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

列出usb設(shè)備信息

lsusb用于顯示有關(guān)系統(tǒng)中的USB總線及其連接的設(shè)備的信息,下面運行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ū)動程序和設(shè)備。

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

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

Bus 001: 表示第一個usb控制器,可以使用lspci|grep USB查看主機有幾個usb控制器Device 055: 表示系統(tǒng)分配給這個金士頓存儲設(shè)備的設(shè)備號ID: 表示usb設(shè)備的IDKingston Technology Digital DataTraveler SE9 64GB: 表示其制造商名稱和設(shè)備名稱

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

使用樹狀類型顯示usb信息使用

-t選項,以樹狀結(jié)構(gòu)顯示usb信息:

  1. [root@localhost ~]# lsusb -t 
  2. /:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M 
  3. /:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=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_hub, Driver=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=Hub, Driver=hub/7p, 12M 
  8. /:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M 

 

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

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

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

如何列出USB詳細信息

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

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

查找連接了多少個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è)備的詳細信息。下面實例查看金士頓存儲設(shè)備的詳細信息:

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

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

lsusb -v為我們提供了非常詳細的信息,我們可以配合使用grep命令查找指定的信息,下面過濾出idVendor和Mass Storage,來獲取大容量存儲設(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è)備才是大容量存儲設(shè)備。

本文轉(zhuǎn)載自微信公眾號「Linux就該這么學(xué)」,可以通過以下二維碼關(guān)注。轉(zhuǎn)載本文請聯(lián)系Linux就該這么學(xué)公眾號。

 

責任編輯:武曉燕 來源: Linux就該這么學(xué)
相關(guān)推薦

2021-04-16 11:18:56

LinuxlsusbUSB

2010-12-29 10:48:49

虛擬機

2023-07-04 16:36:03

Linuxcd 命令

2023-07-23 19:26:18

Linuxcat 命令

2023-08-12 15:05:26

Linuxcp 命令

2020-12-07 06:25:14

Linux Truncate 命令

2018-08-21 09:00:30

Linuxtop命令

2023-01-13 23:21:29

netcat命令Linux

2009-06-16 09:06:37

JavaMailJSP

2022-09-11 20:27:17

UbuntuLinux

2022-10-18 10:00:09

Linuxtcpdump命令

2018-11-05 13:50:44

Linux命令tcpdump

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編程語言

2021-01-04 05:43:59

LinuxBasename命令

2022-10-25 09:07:28

Linuxxargs命令

2018-06-26 09:15:24

Linux命令history

2022-11-18 10:16:26

Linuxwc 命令
點贊
收藏

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