概述
Ubuntu下查看usb设备信息
新来了一个usb 设备, 飞天的加密狗. 怎样来熟悉它?
插上硬件
1. 用dmesg 看看内核说什么?
[ 1738.688160] usb 1-1.2: new full-speed USB device number 8 using ehci-pci
[ 1738.798968] usb 1-1.2: New USB device found, idVendor=096e, idProduct=0209
[ 1738.798974] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1738.798977] usb 1-1.2: Product: ROCKEY ARM
[ 1738.798980] usb 1-1.2: Manufacturer: FT
[ 1738.801750] hid-generic 0003:096E:0209.0003: hiddev0,hidraw2: USB HID v1.10 Device [FT ROCKEY ARM] on usb-0000:00:1d.0-1.2/input0
说是设备号8,使用ehci-pci全速usb设备,产品商ROCKEY ARM, 制造商FT
查阅得知,在/dev 目录下,多了两个设备
/dev/usb/hiddev0
/dev/hidraw2
2. lsusb 查看
Bus 001 Device 008: ID 096e:0209 Feitian Technologies, Inc.
简约,说是bus1,设备号8, ID 096e:0209 飞天公司.
lsusb -v -d 096e:
有详细的描述.
3. 怎样查找设备驱动. 还可以用lshw ,见补充
sudo cat /sys/kernel/debug/usb/devices > 1.txt
从文件中查找096e:0209 关键字,发现其驱动为usbhid
P: Vendor=096e ProdID=0209 Rev= 1.09
I:* If#= 0 Alt= 0 #EPs= 2 Cls=03(HID ) Sub=00 Prot=00 Driver=usbhid
简单的,用lsusb -t (以树形方式列出usb设备) 也可以找到
4. lsmod | grep usb
发现有usbhid 驱动
5. locate usbhid.
发现其在如下位置.
/lib/modules/4.15.0-118-generic/kernel/drivers/hid/usbhid/usbhid.ko
驱动程序被编译成模块都在如下位置.
/lib/modules/uname -r/kernel/drivers/
总结: 查找设备使用了哪个驱动, 先要确定设备是谁. 通过dmesg或lsusb 找到idVendor,idProduct
然后再找到驱动,通过/sys/kernel/debug/usb/devices 找到驱动.
再确认驱动是存在的. lsmod, locate命令.
补充:
另外 lshw -short 查询硬件设备也很好用.
我用lshw -c input 查到了自己需要的信息.(只列出input 类别)
$ sudo lshw -c input
*-usb:0
description: Human interface device
product: ROCKEY ARM
vendor: FT
physical id: 2
bus info: usb@1:1.2
version: 1.09
capabilities: usb-1.10
configuration: driver=usbhid maxpower=100mA speed=12Mbit/s
补充一下如何查看显卡信息:
如何查看显卡驱动:
------------------------------------------------------------------------------------------------
lspci 和 lshw 两种命令.
lspci 的使用与lsusb 有点相似. 具体见下面实例.
$ lspci |grep -i vga 查显卡
00:02.0 VGA compatible controller: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller (rev 06)
[hjj@centos7 ~]$ lspci -v -s00:02.0 // 查driver
00:02.0 VGA compatible controller: Intel Corporation Xeon
E3-1200 v3/4th Gen Core Processor Integrated Graphics
Controller (rev 06) (prog-if 00 [VGA controller])
Subsystem: ASUSTeK Computer Inc. Device 8534
Flags: bus master, fast devsel, latency 0, IRQ 39
Memory at f7800000 (64-bit, non-prefetchable)
[size=4M]
Memory at e0000000 (64-bit, prefetchable)
[size=256M]
I/O ports at f000 [size=64]
Expansion ROM at <unassigned>
[disabled]
Capabilities: <access denied>
Kernel driver in use: i915
Kernel modules: i915
[hjj@centos7 ~]$ sudo lshw -c video // 查configuration
[sudo] hjj 的密码:
*-display
description: VGA compatible controller
product: Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller
vendor: Intel Corporation
physical id: 2
bus info: pci@0000:00:02.0
version: 06
width: 64 bits
clock: 33MHz
capabilities: msi pm vga_controller bus_master cap_list rom
configuration: driver=i915 latency=0
resources: irq:39 memory:f7800000-f7bfffff
memory:e0000000-efffffff ioport:f000(size=64)
最后
以上就是天真寒风为你收集整理的Ubuntu下查看usb设备信息的全部内容,希望文章能够帮你解决Ubuntu下查看usb设备信息所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复