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.
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.frameworkwas abandoned due to App Store restrictions and platform limitations. - The pivot to a web app leveraging Chrome's
WebUSBwas chosen for broader accessibility and no installation requirements. - The core of the
printervention.appis thev86emulator, 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/IPon the emulated Linux side andtcpip.js(compilinglwIPto 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-jsandwasm-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.