USB Device Diagnostics in Linux
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]:.*|)$"
Contents
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
a working example
I have connected a tiny USB receiver for an unknown pointing device. The manufacturer is unknown. I'm not sure if it is the correct dongle and if the device works. Here is where I start:
udevadm monitor --udev
Now that it is running, I will insert the USB receiver.
A lot of information showed up. Too many lines to share here. Whats important is this one:
UDEV [42556.827151] add /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.7/2-1.7:1.0/0003:26E3:106C.0015 (hid)
I can find the device identification which is: 0003:26E3:106C.0015 and that it is a human interface device (hid) which includes the category of mouse and keyboard