获取有关我的 USB 设备的信息

获取有关我的 USB 设备的信息

曾经有很多关于 USB 设备的信息,来自 /proc/bus/usb/devices。

然后它不再自动挂载,所以你必须自己挂载它(它被称为 usbdevfs,或类似的东西)

现在,在 11.04 中,甚至连这个都行不通了。我现在如何才能获取有关我的设备的一些信息?

答案1

lsusb显示如下:

Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 004: ID 0bda:0138 Realtek Semiconductor Corp. 
Bus 001 Device 003: ID 064e:c218 Suyin Corp.  
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

你还需要知道什么?

如果你需要更多,请usbview访问源码:USBView 是一个 GTK 程序,可显示插入 Linux 机器上的 USB 总线的设备的拓扑结构。它还显示每个设备的信息。这对于确定设备是否正常工作很有用。

在此处输入图片描述

顺便说一下,我还没试过 11.04 版的 usbview

答案2

/proc正在被弃用,/sys/bus/usb/devices这就是你要找的。查询 USB 设备的程序是lsusb

答案3

以下是一些用于收集已连接设备 USB 信息的好工具,

usb-devices

这是默认包 usbutils于 18.04 LTS。样本输出:

T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480 MxCh= 6
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=1d6b ProdID=0002 Rev=04.15
S:  Manufacturer=Linux 4.15.0-1050-oem xhci-hcd
S:  Product=xHCI Host Controller
S:  SerialNumber=0000:00:14.0
C:  #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  4 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=0781 ProdID=5571 Rev=01.00
S:  Manufacturer=SanDisk'
S:  Product=Cruzer Fit
S:  SerialNumber=4C530000280331109123
C:  #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=200mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage

udevadm monitor

udevadm默认包 udev在 18.04 LTS 上。

执行此命令您连接您的 USB 设备。

请注意,下面的样本输出告诉我们 USB 闪存驱动器加载为哪个块设备:

udevadm monitor
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent

KERNEL[969.010067] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1 (usb)
KERNEL[969.010367] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0 (usb)
KERNEL[969.018769] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0 (scsi)
KERNEL[969.018849] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/scsi_host/host0 (scsi_host)
KERNEL[969.018934] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0 (usb)
KERNEL[969.019049] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-1 (usb)
UDEV  [969.024995] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1 (usb)
UDEV  [969.031390] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0 (usb)
UDEV  [969.036362] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0 (scsi)
UDEV  [969.041258] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/scsi_host/host0 (scsi_host)
UDEV  [969.046202] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0 (usb)
UDEV  [969.051734] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-1 (usb)
KERNEL[970.051706] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0 (scsi)
KERNEL[970.052068] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0 (scsi)
KERNEL[970.052215] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0 (scsi_disk)
KERNEL[970.052435] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0 (scsi)
KERNEL[970.052585] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0 (scsi_device)
KERNEL[970.052774] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/scsi_generic/sg0 (scsi_generic)
KERNEL[970.052963] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0 (bsg)
UDEV  [970.060833] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0 (scsi)
KERNEL[970.061634] add      /devices/virtual/bdi/8:0 (bdi)
UDEV  [970.069006] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0 (scsi)
UDEV  [970.071467] add      /devices/virtual/bdi/8:0 (bdi)
UDEV  [970.075852] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0 (scsi_disk)
KERNEL[970.079839] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/block/sda (block)
KERNEL[970.079989] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/block/sda/sda1 (block)
UDEV  [970.083556] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0 (scsi)
UDEV  [970.091288] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0 (scsi_device)
UDEV  [970.091755] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/scsi_generic/sg0 (scsi_generic)
UDEV  [970.106807] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0 (bsg)
UDEV  [970.339976] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/block/sda (block)
UDEV  [970.519549] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/block/sda/sda1 (block)

相关内容