Skip to main content

usb-rea

ci license usb-rea MCP server

usb-rea reads a USB capture (pcap or pcapng, from usbmon or USBPcap) and does the step after Wireshark: it infers the command and protocol structure from labelled actions, then writes a Markdown report and a standalone pyusb driver. I built it for gadgets that only ship a Windows vendor app, such as a case LCD, an RGB controller, a mouse or a "smart" lamp. No hardware is needed to try it.

usb-rea demo: capture labelled clicks, get the protocol and a working driver

From captures of the NZXT Kraken X (1e71:170e) fan command, it recovers 02 4d <channel> 00 <duty> byte for byte, as liquidctl's kraken2.py sends it, and the generated driver emits identical packets for duty values it never saw. The same holds for the SteelSeries Rival 100 DPI, polling and RGB tables from rivalcfg. Those checks run in CI; details are in validation.

Install

pip install usb-rea

On Arch Linux, use pipx install usb-rea instead; the FAQ has the packages for capture.

Example

usb-rea demo --device fan
mode         100%  0x5a | counter (+1 per message) | 0x30 | lookup 1→0x11, 2→0x22, 3→0x47 | 0x00 | 0x00 | u16le crc16_modbus(bytes[0:6])
fan          100%  0x5a | counter (+1 per message) | 0x10 | u16be round(value * 1 + 0) | 0x00 | u16le crc16_modbus(bytes[0:6])
color        100%  0x5a | counter (+1 per message) | 0x20 | RGB bytes | u16le crc16_modbus(bytes[0:6])
  color only sent while mode 3: the driver sets it first

It writes a synthetic capture of a fan controller, recovers the protocol and the replies, and writes report.md (every claim linked to Wireshark frame numbers) plus a working pyusb driver. --device lamp is a simpler 8-bit device; --device lcd is a pump cap screen; --device dial shows 32-bit values and packed bitfields.

Add --try to the fan demo and usb-rea then loads the driver it just wrote and drives a simulated fan with it: it opens a session with a fresh token, sets the speed and a color (switching to turbo first, as the vendor app did) and reads the status back. The simulated fan follows the real protocol rather than the inferred one, so a wrong CRC, token or mode byte is rejected.

On a real device, label each click in the vendor app, then infer:

sudo modprobe usbmon
usb-rea capture start -o lamp.pcapng
usb-rea mark -m lamp.pcapng.actions.json "brightness 0%"   # then click it; 3+ values per setting
usb-rea capture stop
usb-rea report lamp.pcapng -o report.md
usb-rea scaffold lamp.pcapng -o lamp_driver.py

Captured on Windows with USBPcap and no markers? List the actions in order and usb-rea splits the traffic at the pauses. The full CLI, including markers, replies, handshakes, image streams and HID, is in usage.

Before you capture, usb-rea lookup 1e71:170e (or the ID 1e71:170e form from lsusb) checks a VID:PID against devices whose protocol an open-source project already implements. The offline table is in known devices.

Limitations

Status: alpha (v0.7.15, on PyPI). It is validated on synthetic devices, on protocols documented by liquidctl, rivalcfg and turing-smart-screen-python, on public Wireshark captures, and on a real AIO cooler LCD capture a user shared. Linear fits must survive leave-one-out cross-checks; otherwise usb-rea falls back to a lookup table and says so. A matching USB ID alone does not prove your unit speaks the same protocol.

How this differs from Wireshark is in the FAQ.

Reverse engineering for interoperability is permitted (EU Directive 2009/24/EC Art. 6, US DMCA §1201(f)). usb-rea only analyzes traffic of devices you own and never redistributes vendor code.

Have a Windows-only device? Open a device request with a capture and I will run it and publish the result.

Docs

Getting started

Capturing

Results

MCP Registry name: io.github.emirmrkaljevic/usb-rea

License

MIT

Support my open-source work: get a SkinToScan pack
If you find this useful, you can support me by getting a SkinToScan pack, my other project. It's a one-time purchase that directly funds my open-source work.

Buy Single Picture Check, €4.49 Buy 5 Picture Pack, €19.99 (popular) Buy 15 Picture Pack, €54.99

Metadata

Release files for usb-rea 0.7.15

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for usb-rea 0.7.15
File Size Uploaded Provenance Actions
usb_rea-0.7.15.tar.gz 770.7 kB With provenance Details for usb_rea-0.7.15.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for usb-rea 0.7.15
File Interpreter ABI Platform Actions
usb_rea-0.7.15-py3-none-any.whl Python 3 none any Details for usb_rea-0.7.15-py3-none-any.whl

Total release size: 889.6 kB

Release files / usb_rea-0.7.15.tar.gz

Download URL usb_rea-0.7.15.tar.gz
Size 770.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d416a65ed7858286b2a9b55580e232b314f3a673888af7e7abdd063bf481f4d8
BLAKE2b-256 checksum
How to use checksums
fdf9abf33c6b9d7322182a3b544bab946051849067a7fe113b552d09741e51a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Release files / usb_rea-0.7.15-py3-none-any.whl

Download URL usb_rea-0.7.15-py3-none-any.whl
Size 118.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a23297259953eac1818869742efd743092c6ce420b1704abda73976da74730ed
BLAKE2b-256 checksum
How to use checksums
6408fb6d5d2f7cfc815f63bd3f5c01fcb88b7afbebb0d98f68d6e962dc91c7e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Security for usb-rea 0.7.15

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for usb_rea-0.7.15.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page