Difference between revisions of "USB Device Diagnostics in Linux"
m |
m |
||
Line 18: | Line 18: | ||
Another way is to dump the information from the running kernel | Another way is to dump the information from the running kernel | ||
− | + | sudo cat /sys/kernel/debug/usb/devices | |
+ | Parse it a little | ||
sudo cat /sys/kernel/debug/usb/devices | grep -E "^([TSPD]:.*|)$" | sudo cat /sys/kernel/debug/usb/devices | grep -E "^([TSPD]:.*|)$" | ||
Revision as of 19:28, 28 February 2019
To detect your USB device, in a terminal, you can try:
lsusb lsusb -v
The second, verbose, offering more detail.
Device are mainly identified using a pair of hexadecimal numbers, like 04b3:3108
The 4 first hexadecimal digits are the Vendor ID (04b3 = IBM).
The 4 last hexadecimal digits are the Device ID (3108 = ThinkPad 800dpi Optical Travel Mouse).
When your device is listed as "unknown" you can update your local usb-id definition by running update-usbids as root.
Try this:
lsusb -v | grep -E '\<(Bus|iProduct|bDeviceClass|bDeviceProtocol)' 2>/dev/null
Another way is to dump the information from the running kernel
sudo cat /sys/kernel/debug/usb/devices
Parse it a little
sudo cat /sys/kernel/debug/usb/devices | grep -E "^([TSPD]:.*|)$"
USB Input Devices
Input devices include keyboards, mice, remotes, etc.
They do not include flash drives.
summary
Another tool that provides extensive details for USB diagnostics:
sudo lsinput
You may have to install it first, it is part of input-utils
sudo apt install input-utils
A tool to show the device being recognized when inserted is
udevadm monitor --udev
The udevadm command cannot be run by itself. You must include a parameter to tell it what to do.
input-utils package
input-utils: utilities for the input layer of the Linux kernel: This is a collection of utilities which are useful when working with the input layer of the Linux kernel (version 2.6 and later). Included are utilities to list the input devices known to the kernel, show the input events that are received by a device, and query or modify keyboard maps. Specifically the tools deal with /dev/input/event* input devices.
- lsinput - dumps out all the input devices and the associated details
- input-kbd - dump out the keyboard mapping of a particular event device, must specify the device number such as 'sudo input-kbd 3'
- input-events - observe input events for watching a specific input device, must specify the device number such as 'sudo input-events 3'
udevadm
udevadm can be used to monitor USB connections
udevadm -h Usage: udevadm [--help] [--version] [--debug] COMMAND [COMMAND OPTIONS] info query sysfs or the udev database trigger request events from the kernel settle wait for the event queue to finish control control the udev daemon monitor listen to kernel and udev events hwdb maintain the hardware database index test test an event run test-builtin test a built-in command
To monitor USB connections here are some command usage examples:
udevadm monitor --subsystem-match=usb --property udevadm monitor --subsystem-match=usb --property --udev
discover package
use the command discover
discover