DEV Community

Draid Corporation
Draid Corporation

Posted on

I Built a USB Inspection Tool in C for Linux — Switch USB Inspector v0.1-beta

I Built a USB Inspection Tool in C for Linux — Switch USB Inspector v0.1-beta

Hey everyone!

I'm a beginner developer who enjoys programming, Linux, and open-source software. Recently, I've been working on a project called Switch USB Inspector, a comyymand-line tool written in C that uses "libusb" to inspect USB devices visible to Linux.

This is one of my projects where I'm learning by building something practical, testing it, and improving it along the way.

💡 What is Switch USB Inspector?

Switch USB Inspector is a Linux command-line utility that displays information about USB devices detected by the USB library.

The current beta version displays:

  • Vendor ID (VID) and Product ID (PID)
  • USB version
  • USB device class
  • Number of configurations reported by the device

The tool is written in C and uses "libusb" to access USB device information.

Despite the name, the project is not limited to Nintendo Switch devices. Its purpose is to inspect USB devices that are visible to Linux.

🖥️ Testing on Debian 13

I tested the program on Debian 13 running under WSL2.

Here is an example of its terminal output:

================================
Switch USB Inspector

v0.1-beta

USB devices found: 2

Device #1
VID:PID: 1D6B:0003
USB Version: 3.16
USB Class: 0x09
Settings: 1

Device #2
VID:PID: 1D6B:0002
USB Version: 2.00
USB Class: 0x09
Settings: 1

In this test, the two IDs correspond to Linux USB root hubs. They do not necessarily represent physical USB peripherals connected to the computer.

This is an important distinction when inspecting USB devices, especially in virtualized environments such as WSL2.

🛠️ Technologies

The main technologies used in this project are:

  • C — the programming language
  • libusb — the library used to access USB device information
  • Linux — the target operating system
  • Debian 13 on WSL2 — my test environment

I wanted to keep the tool simple and focused on displaying useful USB information directly in the terminal.

📦 Try it out

The project is open source and available on GitHub.

The project is licensed under GNU GPL v2.0.

The prebuilt binary targets Linux x86-64 and requires the appropriate "libusb" runtime library.

🚀 What's next?

This is still an early beta, so there is plenty of room for improvement.

Some possible future improvements include:

  • Better identification of USB devices
  • More detailed device information
  • Clearer error messages
  • Additional testing across Linux environments
  • Improvements to the command-line interface

These are ideas for future development, not features that are already implemented.

🙌 Feedback is welcome!

This is my first time sharing this project with the DEV Community, and I'm excited to learn from other developers.

I'd appreciate constructive feedback about the code, the interface, the features, and possible improvements.

What additional information would you like to see in a Linux USB inspection tool?

Thanks for reading!

Top comments (0)