How to check USB devices on Raspberry Pi

Since the Raspberry Pi is frequently accessed remotely, such as through an SSH or VNC connection, we can’t always take a peek at the device to see which USB devices are physically connected to it. Furthermore, it can be useful to query the USB ports from the system itself, just to see if the devices or connections are actually being detected. In this tutorial, you will see how to check the USB devices that are connected to a Raspberry Pi.

In this tutorial you will learn:

  • How to check which USB devices are connected to a Raspberry Pi
How to check USB devices on Raspberry Pi
How to check USB devices on Raspberry Pi
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Raspberry Pi
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to check USB devices on Raspberry Pi




Try some of the various commands below to get some hints about which USB devices are connected to your Raspberry Pi.

WARNING
Unfortunately, USB devices do not always contain the most descriptive labels. At the very least, you should be able to determine whether a USB device is indeed connected or not, but it can be difficult to discern what kind of device it is, depending on how it is labelled inside of the system.
  1. The most useful command to detect USB devices will be lsusb.
    $ lsusb
    
    Output of lsusb command on Raspberry Pi
    Output of lsusb command on Raspberry Pi

    Here we can see that two Logitech devices are connected to the Raspberry Pi. They are labelled as ‘unifying receivers’ and are actually a wireless keyboard and wireless mouse. It is hard to tell which is which, but we can at least determine that two Logitech devices are connected properly. Other than that, we see lines for a USB 3.0 and USB 2.0 root hub, and VIA Labs. These are just default lines and are not indicative of any USB devices being connected to the Raspberry Pi.

  2. Another way to get some useful information on USB devices connected to the Raspberry Pi is with the usb-devices command. This mostly produces the same information as lsusb, but can occasionally offer additional hints as to which USB devices are connected.
    $ usb-devices
    

    Output of usb-devices command on Raspberry Pi
    Output of usb-devices command on Raspberry Pi



  3. A third way to check for USB devices is by looking inside of the /dev/usb directory. Each USB device connected to the Raspberry Pi will have its own file in this directory. The system can then use this device file to interact with the USB component.
    $ ls /dev/usb
    
    Checking the USB devices directory in a Raspberry Pi
    Checking the USB devices directory in a Raspberry Pi

    This output does not help us much with identifying what kind of USB devices are connected, but we can at least determine that there are indeed two different USB devices plugged into the Raspberry Pi.

Closing Thoughts




In this tutorial, we saw how to check the USB devices connected to a Raspberry Pi system. This can be useful for remote users that are administering their Raspberry Pi via VNC or SSH, or can also be used just to verify that the Raspberry Pi is able to properly detect a USB device connected to it for troubleshooting purposes.



Comments and Discussions
Linux Forum