Skip to content
agentusecases
Software & DevOps

Reverse-engineer driverless hardware for Linux with Claude Code

Christian Schaller of Red Hat gave Claude Code control of a Windows VM running the vendor driver and captured the USB traffic from the Linux host. By comparing captures from the official driver with those from the driver in progress, the agent built a SANE backend for an unsupported film scanner and later fixed the MIPI camera on his laptop.

How it works

  1. Run the vendor's official driver in a Windows VM (KVM) with the real device passed through to the VM.

  2. Capture the traffic on the Linux host with usbmon while performing the reference operation, such as a scan.

  3. Ask the agent to write the Linux driver, repeat the same operation and capture its traffic the same way.

  4. Have the agent compare the two captures and treat every difference as a bug to fix.

  5. For devices with no bus to sniff, such as MIPI cameras, use Windows INF files, the registry and ACPI tables as reference, and validate everything on the physical hardware.

Prompt

Replace anything in [brackets] with your own details.

prompt.txt
I have a USB scanner with no Linux support. Set up a Windows VM with KVM and device passthrough to run the vendor driver, and capture the USB traffic on the host with usbmon while I do a scan. Then write a SANE backend that reproduces that sequence, capture its traffic the same way and compare the two captures. List each difference as a likely bug, fix them one at a time and tell me what to test on the real device. Don't copy code from the Windows driver: only extract observed behavior and constants.

Reported result

First Linux scan within a few hours and, days later, a nearly complete driver: 34.6 s per scan versus 54.4 s with the official driver. In a single day, kernel and libcamera patches for the ThinkPad camera also came out.

As reported by the source. Results depend on your setup and your data.