HN
Today

Rescuing old printers with an in-browser Linux VM bridged to WebUSB over USB/IP

Frustrated by perfectly good printers rendered obsolete by OS updates, a developer engineered a brilliant web-based solution to revive them. This deep dive into WebUSB, Linux VMs, and clever networking showcases how modern web technologies can tackle hardware compatibility woes. It's a testament to ingenuity, offering a surprisingly elegant fix for 'digital landfill' that appeals to the tinkerer in all of us.

12
Score
0
Comments
#6
Highest Rank
3h
on Front Page
First Seen
Apr 7, 5:00 PM
Last Seen
Apr 7, 7:00 PM
Rank Over Time
1267

The Lowdown

The author recounts a journey to rescue old Canon SELPHY photo printers from obsolescence, starting with the discovery that modern operating systems like macOS no longer support them. Initially, a Linux machine served as a print server via AirPrint, but the author sought a more universal and accessible software-only solution to combat e-waste.

  • An initial idea for a native Mac app using Virtualization.framework was abandoned due to App Store restrictions and platform limitations.
  • The pivot to a web app leveraging Chrome's WebUSB was chosen for broader accessibility and no installation requirements.
  • The core of the printervention.app is the v86 emulator, running Alpine Linux with CUPS and Gutenprint directly in the browser.
  • Early attempts to bridge CUPS and WebUSB involved custom backends, initially a shell script and then a 9p filesystem, but these lacked bidirectional communication.
  • A key breakthrough was using USB/IP on the emulated Linux side and tcpip.js (compiling lwIP to WebAssembly) on the JavaScript side to create a full bidirectional network stack for USB communication.
  • This bidirectional bridge allowed CUPS to fully interact with the printer, providing status updates and enabling future features like scanner support (SANE).
  • Further refinements included embedding JPEGs in hand-rolled PDFs for correct sizing and handling HEIC conversions with libheif-js and wasm-mozjpeg, preserving ICC profiles.

The resulting printervention.app offers a unique, in-browser solution to extend the life of older printers, demonstrating the power of combining virtualization, web standards, and open-source software in novel ways. The author also hints at future expansion, including a similar app for old scanners and potential white-labeling opportunities for consumables firms.