List USB Devices from Command Line

By  on  

I was recently creating a Recalbox with my 5 year old son and it was an awesome experience; I saw the excitement and curiosity in his eyes while helping him put together a video game machine. We added NES, SNES, and Nintendo 64 games to the device but it became apparent that the N64 controller needed its buttons reconfigured in a config file. To do so I needed to know the device's USB name.

You can use the following command line execution to get the listing of connected USB devices:

system_profiler SPUSBDataType

# >>
USB:

    USB 3.0 Bus:

      Host Controller Driver: AppleUSBXHCISPTLP
      PCI Device ID: 0x9d2f
      PCI Revision ID: 0x0021
      PCI Vendor ID: 0x8086

        Generic   USB  Joystick  :

          Product ID: 0x0006
          Vendor ID: 0x0079
          Version: 1.07
          Speed: Up to 1.5 Mb/sec
          Manufacturer: DragonRise Inc.
          Location ID: 0x14400000 / 2
          Current Available (mA): 500
          Current Required (mA): 500
          Extra Operating Current (mA): 0

        iBridge:

          Product ID: 0x8600
          Vendor ID: 0x05ac (Apple Inc.)
          Version: 1.01
          Manufacturer: Apple Inc.
          Location ID: 0x14100000

    USB 3.1 Bus:

      Host Controller Driver: AppleUSBXHCIAR
      PCI Device ID: 0x15d4
      PCI Revision ID: 0x0002
      PCI Vendor ID: 0x8086
      Bus Number: 0x00

    USB 3.1 Bus:

      Host Controller Driver: AppleUSBXHCIAR
      PCI Device ID: 0x15d4
      PCI Revision ID: 0x0002
      PCI Vendor ID: 0x8086
      Bus Number: 0x01

There are methods of viewing connected USB devices via an operating system UI but knowing how to quickly get that information via command line. It's also much easier to copy and paste that data if you need to pass it on!

Recent Features

  • By
    Introducing MooTools Templated

    One major problem with creating UI components with the MooTools JavaScript framework is that there isn't a great way of allowing customization of template and ease of node creation. As of today, there are two ways of creating: new Element Madness The first way to create UI-driven...

  • By
    Responsive and Infinitely Scalable JS Animations

    Back in late 2012 it was not easy to find open source projects using requestAnimationFrame() - this is the hook that allows Javascript code to synchronize with a web browser's native paint loop. Animations using this method can run at 60 fps and deliver fantastic...

Incredible Demos

  • By
    Modal-Style Text Selection with Fokus

    Every once in a while I find a tiny JavaScript library that does something very specific, very well.  My latest find, Fokus, is a utility that listens for text selection within the page, and when such an event occurs, shows a beautiful modal dialog in...

  • By
    AJAX For Evil:  Spyjax with jQuery

    Last year I wrote a popular post titled AJAX For Evil: Spyjax when I described a technique called "Spyjax": Spyjax, as I know it, is taking information from the user's computer for your own use — specifically their browsing habits. By using CSS and JavaScript, I...

Discussion

  1. Hi David,

    on GNU/Linux you have several options.

    The CLI one being lsusb:
    https://wiki.debian.org/HowToIdentifyADevice/USB

    Takes a bit to read it, though…

    Kind regards

    André

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!