His scanner wouldn’t work on Linux — so he let Claude study the Windows driver

Christian Schaller, an engineering director at Red Hat and a seasoned contributor to GNOME and Fedora, faced a challenge when he attempted to digitize a collection of family negatives. Armed with a Plustek OpticFilm 8200i scanner, he soon discovered that the device’s chipset was incompatible with Linux, leaving him unable to access the necessary drivers. After several unsuccessful attempts to engage Claude Code for assistance, he decided to pause the project for a few months.

Upon revisiting the task, Schaller adopted a fresh strategy. Within hours, he achieved his first successful scan, and shortly thereafter, the driver was enhanced to support infrared scanning as well.

Schaller subsequently launched an open-source initiative named hw-harness, licensed under the MIT framework. This project consolidates tools designed to capture device behavior, enabling comparisons between functional and non-functional implementations. The aim is to equip developers with the insights needed to tackle hardware that lacks Linux support.

Reverse-engineering the scanner driver

The inspiration for this endeavor stemmed from a post by Tom Crider, known as Glorious Eggroll, who had successfully utilized an AI agent to rectify a mouse driver by interfacing with a Windows machine. Schaller fed this concept to Claude, prompting it to create a similar environment for his scanner.

In a detailed account shared on Wednesday, Schaller recounted the meticulous work involved in deciphering undocumented device protocols through USB captures, register values, and control transfers. While the task itself was not overly complex, he emphasized the necessity of patience and skill. Previous attempts to develop a SANE backend with Claude had faltered due to the absence of a working driver for comparison.

As Schaller put it, Claude “doesn’t get bored.”

With the new setup, Claude was able to execute the manufacturer’s Windows software, capture USB traffic, and juxtapose it with the data sent by the Linux driver. This comparative analysis allowed Claude to identify discrepancies and implement corrections accordingly.

By the project’s conclusion, Schaller’s driver was no longer the sole option available. Another developer had contributed support for the newer OpticFilm 8200i to SANE in September. Schaller expressed a pragmatic approach, stating he would transition to the upstream version once it incorporated the desired features, while retaining his own version as a proof of concept.

A faster SANE scanner driver

Schaller’s implementation boasts several advantages, including infrared dust removal and exposure adjustments for dense negatives, along with color and grayscale scanning capabilities ranging from 300 to 7,200 dpi. The initial issue that prompted the project was a chipset alteration: newer 8200i models utilize a Genesys GL128, replacing the GL845 previously supported by SANE.

In a comparative test of the two drivers, Schaller’s finished a full-resolution scan in 34.6 seconds, while the upstream version took 54.4 seconds. Both drivers achieved the same detail resolution at 3,600 dpi, although SANE offers a broader range of resolution options. While this comparison was limited, Schaller emerged with a functional driver and a methodology applicable to other hardware.

This scanner project also inspired Schaller to develop his own application, aptly named Negative Vibes. Crafted in Rust with assistance from Claude, this GNOME app preserves the original 16-bit scan data, including the infrared channel. Users can then remove dust, adjust images without altering the originals, calibrate colors using ArgyllCMS, and export their results in formats such as TIFF, JPEG, PNG, or DNG.

He called it Negative Vibes, written in Rust with Claude’s help, the GNOME app keeps the original 16-bit scan data intact, including the infrared channel.

Fixing the ThinkPad camera

Schaller also encountered difficulties with the camera on his Lenovo ThinkPad X1 Carbon Gen 14 Aura Edition. Under Linux, images appeared overly dark, exhibiting pronounced corner shading and a yellow-green tint. The laptop’s Sony IMX471 sensor and Intel’s IPU7 imaging system posed a different challenge, as the internal MIPI camera lacked USB traffic for Claude to analyze.

To navigate this obstacle, Schaller provided Claude with the Windows driver’s configuration files, registry entries, ACPI tables, and device properties. Additionally, he connected a USB webcam to offer a functional camera for comparison. This approach proved pivotal; by day’s end, he had developed patches for both the Linux kernel and libcamera.

The kernel modifications addressed three key issues: a crop-selection bug that misdirected libcamera’s pixel area usage, an incorrectly defined test-pattern register, and an analog gain limit that reduced the camera’s sensitivity by approximately 1.8 stops. Claude also identified shortcomings in libcamera’s image processing, including missing lens-shading correction and discrepancies in sensor data calculations that affected white balance.

The impact of these changes was quantifiable. In Schaller’s low-light tests, frame brightness improved from 31.1 to 90.9, and the color ratios aligned more closely with those of the reference webcam.

Despite these advancements, challenges remain. In low-light conditions, the blue channel still lags about 17% behind the reference, and the patches have yet to be integrated. AI technology engineer at Nvidia, Kate Hsuan, is currently reviewing the kernel modifications, while principal software engineer at Red Hat, Wim Taymans, is overseeing the libcamera updates. A separate Claude-generated Linux page-cache fix recently encountered a race condition during its review process.

Schaller has made the hw-harness project available on GitHub. He clarifies that the released version differs from the specific tools he employed for the scanner and camera projects. The setup runs the manufacturer’s Windows driver in a KVM virtual machine, with the physical device passed through to the guest. Claude operates the Windows session remotely while usbmon captures traffic on the Linux host. The developer then switches the device back to Linux, repeats the operation with the experimental driver, and allows Claude to compare the traces.

The repository includes winctl for managing the Windows VM, usbcap for traffic capture, hostdev for device switching, and hwdbg for Linux-side debugging. PowerShell scripts are utilized to gather device descriptors, registry entries, ACPI tables, and INF files.

He says the approach can produce a driver that “a maintainer can actually merge.”

Winsage
His scanner wouldn’t work on Linux — so he let Claude study the Windows driver