USB Device Listener is a Rust command-line application for connecting to USB devices and monitoring incoming data. The application lists all connected USB devices, allows selection of configuration and endpoint, and displays received data in hexadecimal, decimal, and ASCII formats.
- Enumerate all USB devices with detailed information (Vendor ID, Product ID, class, etc.)
- List all device configurations with power requirements
- Display available IN endpoints with transfer types
- Real-time message display in hex, decimal, and ASCII
- Graceful shutdown with Ctrl+C
This application supports reading from endpoints with the following transfer types:
- Interrupt: Low-latency, periodic transfers (keyboards, mice)
- Bulk: Large, non-time-critical transfers (storage devices)
- Cargo 1.85+ (for Rust 2024 Edition support)
Install Cargo by installing Rust using rustup.
macOS and Linux:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shWindows:
Download and run the installer.
Use Cargo to build and run the application.
cargo runFor an optimized build, use the --release flag.
cargo run --releaseUSB device access may require elevated privileges.
sudo cargo run- Select a device from the list of available USB devices
- Select a configuration (most devices have only one)
- Select an IN endpoint to listen on
- View incoming data displayed in multiple formats
- Press Ctrl+C to exit gracefully
A configuration is a mode of operation for a USB device. A device can have multiple configurations, but only one is active at a time. Each configuration defines a set of interfaces and endpoints. Most devices have a single configuration.
An interface is a logical grouping of endpoints that provides a specific function. A keyboard might have one interface for key input and another for media controls.
An endpoint is a communication channel with a direction (IN or OUT) and transfer type:
- Control: Device configuration (all devices have endpoint 0)
- Interrupt: Low-latency, periodic transfers (keyboards, mice)
- Bulk: Large, non-time-critical transfers (storage devices)
- Isochronous: Constant-rate streaming (audio, video)
- IN: Device to host (reading data)
- OUT: Host to device (sending data)
This application only lists IN endpoints since it monitors incoming data.
Another application or kernel driver is using the device. The application attempts to detach kernel drivers automatically, but some devices may require manually unloading drivers.
The selected configuration has no input endpoints. Try a different configuration if available, or the device may only support output operations.
All configuration descriptors failed to load. This may indicate a device communication problem or an unsupported device.
- Check physical connection
- Try a different USB port
- Verify the device is powered on
- On macOS, check System Information > Hardware > USB to confirm the OS sees it
MIT