通用串行总线(USB)被设计成为连接计算机外设的标准,如键盘、鼠标、打印机、数码相机、便携式媒体播放器、磁盘和网络适配器等等 - 来源:Wikipedia

它已经成为了一个工业标准,现在很难看到一个没有USB口的计算机了。USB闪存的使用使得它更加流行。在Linux上,我们可以使用lsusb来列出USB设备和它的属性。

什么是lsusb

在它的手册上,lsusb定义成:

显示系统中以及连接到系统的USB总线信息的工具。

如何运行lsusb? 要运行lsusb,你可以直接在控制台输入lsusb。

$ lsusb

Bus  Device : ID 1d6b: Linux Foundation 2.0 root hub
Bus Device : ID 1d6b: Linux Foundation 2.0 root hub
Bus Device : ID 1d6b: Linux Foundation 1.1 root hub
Bus Device : ID 1d6b: Linux Foundation 1.1 root hub
Bus Device : ID 1d6b: Linux Foundation 1.1 root hub
Bus Device : ID 1d6b: Linux Foundation 1.1 root hub
Bus Device : ID 1d6b: Linux Foundation 1.1 root hub
Bus Device : ID 1d6b: Linux Foundation 1.1 root hub
Bus Device : ID 17ef: Lenovo Integrated Webcam [R5U877]
Bus Device : ID 0a5c:217f Broadcom Corp. Bluetooth Controller

lsusb会显示驱动和内部连接到你系统的设备。

下面介绍如何理解输出。我抓取了上面输出的最后一行:

Bus  Device  : ID 0a5c:217f Broadcom Corp. Bluetooth Controller
  • Bus 008 : 指明设备连接到哪(哪条总线)
  • Device 002 : 表明这是连接到总线上的第二台设备
  • ID : 设备的ID
  • Broadcom Corp. Bluetooth Controller :生产商名字和设备名

我们同样可以看到在我们的系统中同时使用了USB2.0 root hub驱动和USB 1.1 root hub驱动。

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 ::1a.: new USB bus registered, assigned bus number
[ 0.748019] ehci_hcd ::1a.: USB 2.0 started, EHCI 1.00
[ 0.748169] hub -:1.0: USB hub found
[ 0.748336] ehci_hcd ::1d.: new USB bus registered, assigned bus number
[ 0.768019] ehci_hcd ::1d.: USB 2.0 started, EHCI 1.00
[ 0.768147] hub -: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选项来开启。下面是一个例子。

$ lsusb -v

Interface Descriptor:
bLength
bDescriptorType
bInterfaceNumber
bAlternateSetting
bNumEndpoints
bInterfaceClass Wireless
bInterfaceSubClass Radio Frequency
bInterfaceProtocol Bluetooth
iInterface
Endpoint Descriptor:
bLength
bDescriptorType
bEndpointAddress × EP IN
bmAttributes
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize × 1x bytes
bInterval
Endpoint Descriptor:
bLength
bDescriptorType
bEndpointAddress × EP OUT
bmAttributes
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize × 1x bytes
bInterval

找出连接了多少USB设备

使用下面的命令

$ find /dev/bus

接着你会看到像下面的输出:

/dev/bus
/dev/bus/usb
/dev/bus/usb/
/dev/bus/usb//
/dev/bus/usb//
/dev/bus/usb/
/dev/bus/usb//
/dev/bus/usb/
/dev/bus/usb//
/dev/bus/usb/
/dev/bus/usb//
/dev/bus/usb/
/dev/bus/usb//
/dev/bus/usb/
/dev/bus/usb//
/dev/bus/usb/
/dev/bus/usb//
/dev/bus/usb//
/dev/bus/usb//
/dev/bus/usb/
/dev/bus/usb//
使用lsusb 命令 的-D 选项,你可以打印特定设备的详细信息。下面是一个博通蓝牙设备的示例。 $ lsusb -D /dev/bus/usb// Device: ID 0a5c:217f Broadcom Corp. Bluetooth Controller
Couldn’t open device, some information will be missing
Device Descriptor:
bLength
bDescriptorType
bcdUSB 2.00
bDeviceClass Wireless
bDeviceSubClass Radio Frequency
bDeviceProtocol Bluetooth
bMaxPacketSize0
idVendor 0x0a5c Broadcom Corp.
idProduct 0x217f Bluetooth Controller
bcdDevice 3.60
iManufacturer
iProduct
iSerial
bNumConfigurations
Configuration Descriptor:
bLength
bDescriptorType
wTotalLength
bNumInterfaces
bConfigurationValue
iConfiguration
bmAttributes 0xe0
Self Powered
Remote Wakeup
MaxPower 0mA
Interface Descriptor:
bLength
bDescriptorType
bInterfaceNumber
bAlternateSetting
bNumEndpoints
bInterfaceClass Wireless
bInterfaceSubClass Radio Frequency
bInterfaceProtocol Bluetooth
iInterface
Endpoint Descriptor:
bLength
bDescriptorType
bEndpointAddress × EP IN
bmAttributes
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize × 1x bytes
bInterval
Endpoint Descriptor:
bLength
bDescriptorType
bEndpointAddress × EP IN
bmAttributes
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize × 1x bytes
bInterval
Endpoint Descriptor:
bLength
bDescriptorType
bEndpointAddress × EP OUT
bmAttributes
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize × 1x bytes
bInterval

找出大容量存储设备

既然 lsusb -v给我们很详细的信息,那么你或许会错过一些信息。我们可以使用grep命令指定特定的信息。

大容量存储设备会有一个供应商名和ID。我们可以用它作为一个起点。

$ lsusb -v |grep -Ei ‘(idVendor|Mass\ Storage)’

idVendor 0×1005 Apacer Technology, Inc.
bInterfaceClass 8 Mass Storage

你可以看到,我们系统上有一个来自Apacer Technology, Inc的USB大容量存储设备。

以树层级结构输出USB设备

使用 -t选项满足这个要求

$ lsusb -t

/: Bus .Port : Dev , class="root"\_hub, Driver=uhci_hcd/2p, 12M
/: Bus .Port : Dev , class="root"\_hub, Driver=uhci_hcd/2p, 12M
/: Bus .Port : Dev , class="root"\_hub, Driver=uhci_hcd/2p, 12M
/: Bus .Port : Dev , class="root"\_hub, Driver=uhci_hcd/2p, 12M
/: Bus .Port : Dev , class="root"\_hub, Driver=uhci_hcd/2p, 12M
/: Bus .Port : Dev , class="root"\_hub, Driver=uhci_hcd/2p, 12M
/: Bus .Port : Dev , class="root"\_hub, Driver=ehci_hcd/6p, 480M
|__ Port : Dev , If , class="stor"., Driver=usb-storage, 480M
|__ Port : Dev , If , Class=’bInterfaceClass 0x0e not yet handled’, Driver=uvcvideo, 480M
|__ Port : Dev , If , Class=’bInterfaceClass 0x0e not yet handled’, Driver=uvcvideo, 480M
/: Bus .Port : Dev , class="root"\_hub, Driver=ehci_hcd/6p, 480M

数字12M和480M 是指USB类型的传输速率。

  • 12M 意味着 USB 1.0 / 1.1的速率是 12Mbit/s
  • 480M 意味着 USB 2.0的速率是 480Mbit/s

如果你找到5.0G,那意味这你有USB 3.0类型接口。它有5.0Gbit/s的传输速率。Linux从/var/lib/usbutils/usb.ids识别USB设备的详细信息。或者你可以访问Linux-USB.org获取最新的USB ID列表。

这些就是lsusb命令的基础。你可以用lsusb命令对你的系统上的USB设备做一个诊断。一般来说,你可以通过lsusb的手册探索命令的更多详细细节。只要输入man lsab来打开它的手册。

Linux中显示系统中USB信息的lsusb命令的更多相关文章

  1. [linux]top命令详解-实时显示系统中各个进程的资源占用状况

    简介 top命令是Linux下常用的性能分析工具,能够实时显示系统中各个进程的资源占用状况,类似于Windows的任务管理器. top显示系统当前的进程和其他状况,是一个动态显示过程,即可以通过用户按 ...

  2. Linux显示系统的诊断信息

    Linux显示系统的诊断信息 youhaidong@youhaidong-ThinkPad-Edge-E545:~$ dmesg [ 1.492480] EDD information not ava ...

  3. free - 显示系统中已用和未用的内存空间总和.

    总览 (SYNOPSIS) free [-b | -k | -m] [-o] [-s delay ] [-t] [-V] 描述 (DESCRIPTION) free 显示 系统中 已用和未用的 物理内 ...

  4. 9.7 top:实时显示系统中各个进程的资源占用状况

    top命令 用于实时地对系统处理器状态进行监控,它能够实时地显示系统中各个进程的资源占用状况.该命令可以按照CPU的使用.内存的使用和执行时间对系统任务进程进行排序显示,同时top命令还可以通过交互式 ...

  5. 在Installshield的安装进度中显示自己设置的信息

    原文:在Installshield的安装进度中显示自己设置的信息 以Installscript msi project为例,在installshield所制作的安装包安装过程中显示安装进度的,就在On ...

  6. 让Win10显示系统中隐藏的文件夹

    让Win10显示系统中隐藏的文件夹.. ------------------------- -----------------------

  7. 4. 在Inspector面板中显示类中变量+ 拓展编辑器

    1. C#脚本如下: using UnityEngine; using System.Collections; public class MyTest : MonoBehaviour { ; ; [S ...

  8. 浅谈ListBox控件,将对象封装在listBox中,在ListBox中显示对象中某个属性,在ListBox中移除和移动信息

    大家好,俗称万事开头难,不经历风雨,怎能见彩虹.在此小编给大家带来一个自己练习的小实例,希望与大家一起分享与交流.下面进入应用场景,从SQL2008数据库取出数据,给ListBox赋值在界面并显示出来 ...

  9. Android 在界面中显示以及输入文本信息 TextView和EditText

    Android控件之TextView和EditTextTextView:显示文本框控件EditText:输入文本框TextView和EditText的常用属性TextView控件的常用属性androi ...

随机推荐

  1. DNS服务——搭建企业内网DNS服务器的作用

    前言 DNS服务——服务端 和 客户端 配置 介绍了如何在DNS安装DNS服务,更改一下配置文件就可以依据根提示解析全球域名.既然使用互联网上的DNS服务器就可以解析全球域名,为何还要自掏腰包搭建DN ...

  2. 运维开发笔记整理-template的使用

    运维开发笔记整理-Django的template的使用 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 在上一篇博客中我们学习了HttpResponse 和JsonResponse方 ...

  3. Windows server 2012 利用ntdsutil工具实现AD角色转移及删除域控方法

    场景1:主域控制器与辅助域控制器运行正常,相互间可以实现AD复制功能.需要把辅助域控制器提升为主域控制器 ,把主域控制器降级为普通成员服务器:这种场景一般应用到原主域控制器进行系统升级(先转移域角色, ...

  4. Go语言中的数据格式(json、xml 、msgpack、protobuf)

    在分布式的系统中,因为涉及到数据的传输,所以一定会进行数据的交换,此时就要定义数据交换的格式,例如二进制.Json.Xml等等.本篇文章就是总结一下常用的几种数据格式. 一.Json格式 如果想使用J ...

  5. NXP LPC系列学习笔记汇总(持续更新中)

    1. LPC11E68循环冗余校验CRC学习笔记 文章主要介绍了如何使用LPC11E68的CRC外设功能,并介绍了与CRC引擎相关的寄存器,然后以生成CRC-CCITT多项式校验为例进行了介绍. 2. ...

  6. subprocess、struct模块的简单应用与ssh模型(黏包)

    一.subprocess模块 #可以通过传递字符串命令,帮你去实现一些操作系统的命令. import subprocess res = subprocess.Popen("dir" ...

  7. P2341 [HAOI2006]受欢迎的牛[SCC缩点]

    题目描述 每头奶牛都梦想成为牛棚里的明星.被所有奶牛喜欢的奶牛就是一头明星奶牛.所有奶 牛都是自恋狂,每头奶牛总是喜欢自己的.奶牛之间的"喜欢"是可以传递的--如果A喜 欢B,B喜 ...

  8. Entity Framework 在MySQL中执行SQL语句,关于参数问题

    在Entity Framework中添加MySQL模型,在写代码的过程中需要直接执行SQL语句. 在SQL语句中用到了@curRank := 0 这样在SQL语句中定义参数,同时还会有传入参数:ai. ...

  9. @EnableCircuitBreaker熔断超时机制

    客户端请求服务端的时候总是报超时,默认熔断机制是1S

  10. Spring MVC框架及标签库

    1.Spring MVC技术 1. 当DispatcherServlet接到请求时,他先回查找适当的处理程序来处理请求.DispatcherServlet通过一个或者多个处理程序映射,将每个请求映射到 ...