Using AI to reverse engineer hardware
TL;DR Highlight
Diffing Windows-driver and Linux USB captures let Claude produce a scanner driver and camera patches.
Who Should Read
A developer with hardware lacking Linux drivers who wants to try AI agents for reverse engineering it.
Core Mechanics
- Diffing reference captures is the core trick
- Run the vendor Windows driver in a KVM VM and record USB traffic on the host with usbmon.
- Repeat the same operation on Linux with your own driver and capture it the same way.
- The diff between the two traces is your list of driver bugs.
- Devices without a bus use Windows-side inspection
- For something like an internal MIPI camera, look at INF files, registry data, ACPI tables and device properties.
- No code is copied, only configuration is extracted, so every constant traces back to a recording.
- Scanner driver got a first scan in hours
- The Plustek OpticFilm 8200i (Genesys GL128) had been stuck for months, then produced a first scan within hours.
- Days later it had a near-perfect driver including infrared scanning.
- Upstream SANE had meanwhile added support for the same scanner.
- Compared with upstream, it was a mixed result
- Both resolve the same fine detail at 3600 dpi.
- Full-resolution scan took 34.6 s for the author's driver vs 54.4 s upstream.
- The author's driver supports infrared dust removal, while upstream offers more resolution steps.
- MIPI camera improved via kernel and libcamera patches
- In the IMX471 driver: a crop-selection bug, a wrong-width test-pattern register, and an analogue gain cap too low (about 1.8 stops lost).
- In libcamera's software ISP: lens shading correction was missing (corners about 2.7 stops darker) and white-balance stats used mismatched bit depth.
- In a low-light test, frame brightness rose from 31.1 to 90.9.
- Having a comparison device makes it far easier
- For the MIPI camera, connecting a USB camera so Claude could compare two captures was critical.
- AI is good at the tedium: decoding captures, writing probes, cross-checking constants.
- A human still has to hold the physical hardware and verify.
Community Reactions
- A pro-audio company owner decompiled competitors' firmware with AI
- They had Claude run the original ROM in an emulator to confirm it was the real code, and say the results sound phenomenal.
- They worry anyone can now do this and that the hardware moat has vanished.
- Someone unpacked a router firmware with a cheap model
- They soldered UART onto an unknown Alcatel modem/router and an agent built an OpenWRT pipeline within half a day.
- They report the cost was $0.86.
- A printer driver built with the human as the AI's hands
- Claude asked them to unload paper and check duplex while diagnosing, they say.
- Their view: point a strong model at a device and burn tokens, even with little hardware knowledge.
- A counterpoint: tools already existed
- One commenter noted NegPy already covers negative conversion with a reverse-engineered 8200i.
- Another suggested auditing upstream's contribution against your code and submitting only what's missing.
How to Apply
- Plug a device into USB and hand it to an AI
- Take a USB device without a Linux driver and paste its lsusb output and usbmon capture into an AI.
- Ask it to find repeating patterns and which bytes change, and guess their meaning.
- Build a pair of good and failing captures
- Record the same action in a working setup (e.g., a Windows VM) and in the failing one.
- Give both to the AI and have it list the differences.
- Feed hw-harness to your Claude or Codex session
- Use the author's hw-harness for the KVM passthrough, usbmon capture and diff workflow.
- The author says it is not identical to the code they used, so expect to adapt it.
- Verify results on real hardware
- Test every AI-proposed constant and patch on the actual device before merging.
- Check first whether upstream already has the same code.
Try It
# Paste into Claude Code or Claude/ChatGPT (simplified version of the article's method)
You are a driver reverse-engineering assistant. Below are USB traffic captures of the same operation in a working environment and a failing one.
[Working capture]
{{working capture}}
[Failing capture]
{{failing capture}}
1. Compare the captures step by step and list the differences.
2. For each difference, hypothesize which register or control transfer is responsible, citing the capture lines.
3. Propose test code to check each hypothesis one at a time.
Next: paste the test results back and narrow the hypotheses.Terminology
Related Papers
Frostbite: A new CPU architecture discovered, designed and verified by AI
AI agents designed a CPU from scratch, claiming 4.59x perf/W over a traditional core
Restricting AI agents in mobile operating systems platforms from capturing data
Signal now blocks OS-level AI agents from reading its screen on iOS 27 and Android
Actions Speak Louder than Words: Stateful Privacy Sniffing of LLM Agents via Behavioral Covert Channels in Web Interactions
Agents' link choices alone let attackers rebuild user queries at F1 0.89; SOR cuts it to 0.39.
Tracking and Limiting Unsupported Claim Propagation in Multi-Agent LLM Systems: A Provenance-Aware Framework
Passing claims with source, evidence and history kept equivalence at 5 agent stages at 96% versus 31%.
LLM assisted reverse engineering
Pointing an agent at binaries with skills and MD notes made years-long hacks feasible
Metrics-in-the-Loop: Complexity Feedback Reshapes Agent-Written Code
Injecting per-turn complexity reports into coding agents cut code erosion without changing correctness
Why is Gemini 4 Carbon taking so long?
Carbon took nearly an hour on bug fixes that Astra and Opus finished in minutes, mostly from extra unrequested work.
Weight-Space Programming builds neural networks like a 1990s researcher
LLM hand-wrote MNIST weights to 91.3%, using 1990s-style techniques