Get usb device info linux

Getting information on my usb devices

There used to be lots of info on usb devices, coming form /proc/bus/usb/devices. Then this was no longer auto mounted, so you had to mount it yourself (usbdevfs it was called, or something) Now, in 11.04, even that doesn’t work. How can I get some info on my device now?

3 Answers 3

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 

What more do you need to know?

If you need more there is usbview on sourceforge: USBView is a GTK program that displays the topography of the devices that are plugged into the USB bus on a Linux machine. It also displays information on each of the devices. This can be useful to determine if a device is working properly or not.

enter image description here

did not try usbview in 11.04 btw

/proc is becoming deprecated, /sys/bus/usb/devices is what you are looking for. A program to query for USB devices is lsusb .

Here are a few nice tools for gathering USB info about connected devices,

This is part of the DEFAULT PACKAGE usbutils on 18.04 LTS. Specimen output:

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 is part of the DEFAULT PACKAGE udev on 18.04 LTS.

Читайте также:  Postgresql восстановить базу из бэкапа linux

Execute this command BEFORE you connect your USB device.

Note in the specimen output below it tells us which block device the USB flash drive loaded as:

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) 

Источник

List USB Devices Linux

In the world of USB computer peripherals, almost everyone uses some sort of USB devices in their computer. These days there are USB webcams, USB hard drives, USB stick also known as PenDrive etc. Almost every device has a USB version of it. So if you’re using Linux, listing what USB device is connected to your system might be necessary at some point.

There are many programs and many ways to list USB devices on Linux.

In this article, I will show you how to list USB devices on Linux. I am using Ubuntu 18.04 Bionic Beaver for the demonstration, but these commands are available on every Linux distribution. So let’s get started.

Читайте также:  Linux kernel based virtual machine kvm

Listing USB Devices using lsusb Command

The widely used lsusb command can be used to list all the connected USB devices in Linux.

As you can see from the output of the lsusb command in the screenshot below, all the connected USB device is listed. The Bus ID, Device ID, USB ID, and a title is displayed in the output of lsusb command.

As you can see in the marked section of the screenshot below, Realtek Semiconductor Corp. with ID 0bda:57cb, this is my USB Webcam.

You can’t tell that it’s a Webcam by looking at the output of lsusb command, Can you? Nope! So how do I know this? It’s because I checked the output of the lsusb command before and after connecting the USB Webcam and once I compared the outputs, the newly added row is the USB device I connected. Plain! But there are ways to find out what the USB device is.

You can use the dmesg command to find out more information about the connected USB devices. The last connected USB device is the easiest to find with dmesg command. It is more widely used for debugging purpose. You will shortly see why.

You run dmesg command as follows:

As you can see in the yellow marked box in the screenshot below, these are information about the USB device I connected last, which was my USB Webcam. You can see in one of the blue marked box, the USB device I connected is a HD UVC WebCam and its ID is 0bda:57cb.

By now you may have found out that the output of dmesg command is system log messages. Well yes, it is.

You can also search for a specific USB device by its ID in the dmesg system log.

Run the following command to open the output of dmesg command with less text pager:

You should see the following window:

Now to search for a string, press / key on your keyboard. And you should the a / appear on the bottom of terminal window as marked in the screenshot below.

Читайте также:  Light browser for linux

Now type in the USB device ID. For example, earlier when I listed the connected USB devices with lsusb command, one of the USB device had ID 0bda:57cb

Type in the USB Device ID and press . As you can see in the marked section of the screenshot below, the search string is marked white.

You may press and arrow keys to navigate up and down and read through it. You should find a lot of information about that USB device as you can see in the marked section of the screenshot below.

Listing USB devices with usb-devices Command

You can run the following command to list all the connected USB devices of your system:

As you can see in the screenshot below, all the connected USB devices are listed. we can find out pretty much the same information as before with usb-devices command.

Listing Block USB Devices

If you want to list all the USB block storage devices, that is all the USB storage devices, then you can use the lsblk or fdisk command to do so.

Listing USB block storage devices with lsblk:

As you can see in the screenshot below, all the available block storage devices (including the USB block storage devices) are listed.

You can get almost the same information as lsblk command with blkid command. But you have to run it as root as follows:

You can also use fdisk command to list all the USB block storage devices as follows:

As you can see in the screenshot below, the connected block storage devices (including the USB devices) are listed.

That’s how you list all the USB devices on Linux. Thanks for reading this article.

About the author

Shahriar Shovon

Freelancer & Linux System Administrator. Also loves Web API development with Node.js and JavaScript. I was born in Bangladesh. I am currently studying Electronics and Communication Engineering at Khulna University of Engineering & Technology (KUET), one of the demanding public engineering universities of Bangladesh.

Источник

Оцените статью
Adblock
detector