
Emulate legacy printer drivers for CUPS with QEMU - onny
https://blog.project-insanity.org/2020/05/19/cups-airprint-server-with-legacy-printer-driver-support/
======
dehrmann
Reminds me of ndiswrapper. Linux doesn't support your network card? Use the
Windows drivers! The time I used it, even with the adapter layer, it was
_more_ stable than the native Linux drivers.

~~~
cbhl
And ndiswrapper ran _binary_ drivers. Literally ran the machine code and
provided hooks to make the driver work.

Of course, that meant you couldn't plug a Windows-only USB Wifi stick into an
ARM machine (say, a Raspberry Pi 1) and use ndiswrapper. Luckily, Broadcom
added Wi-Fi to the newer Pis...

~~~
voltagex_
I haven't run into a USB wifi stick that I couldn't find a driver for, for a
while. Now the problem is which of the 11 Github forks to trust.

Are there any other manufacturers still bothering with USB wifi devices other
than Realtek and Mediatek?

------
tyingq
That's an interesting approach. For these "win printers" that need host-side
processing, another solution is this generic HBPL cups driver:
[https://github.com/mikerr/foo2zjs](https://github.com/mikerr/foo2zjs)

------
dmarinus
I love these hacks! Did you know you can find the source code of this "driver"
(foo2hbpl1) on the internet archive?
[http://web.archive.org/web/20151008025637/http://www.cyberco...](http://web.archive.org/web/20151008025637/http://www.cybercom.net/~dcoffin/hbpl/foo2hbpl1.c)

~~~
mobilio
Source is here:

[https://github.com/mikerr/foo2zjs](https://github.com/mikerr/foo2zjs)

~~~
asveikau
Wait. Their "legacy driver I need qemu to run" is foo2zjs? The gpl thing that
I remember being in a bunch of Linux distro package repos? The one that I have
run on arm just fine?

Still in debian. [https://packages.debian.org/buster/printer-driver-
foo2zjs](https://packages.debian.org/buster/printer-driver-foo2zjs)

~~~
mobilio
Yup.

I didn't understand it too.

------
Tade0
A few years ago my father had a similar problem so I "emulated" the drivers by
firing up a VirtualBox machine with Windows XP, which had them, because the
printer was from that era.

Worked like a charm.

------
asveikau
I run lpd on a raspberry pi to share my printer. I used to share it to Windows
hosts with samba but then I realized Windows supports lpd printers. (As does
Mac and anything Unix-like.)

I am probably 20 years late in saying this, but I honestly don't know why cups
is a thing. lpd works fine and has always struck me as simpler. It's smaller
with fewer dependencies. This config is way more complicated than mine. Any
time people talk about Unix printing they always assume you mean cups.

~~~
kstrauser
LPD was awesome for sending a file, as-is, to a pre-configured printer. CUPS
is awesome for changing things on the fly, like color vs. black-and-white or
two-sided printing, or for giving clients enough information about the printer
that they can automatically configure the correct driver.

------
b3lvedere
Did something similar with an old Dymo LabelWriter 320 which does not work on
Windows 10. So i connected it to a Raspberry Pi, installed Cups, compiled the
Dymo drivers and now i have a small print server.

~~~
wolfhumble
Which server did you decide to run on the Raspberry Pi?

~~~
throwaway2048
CUPS is a (network) Print Server

------
fithisux
It would be better if companies released documentation. Governments should
have done their job. Doing. the "emulator" thing is a short term solution.
Continuing the emulator thing is like agreeing that governments can get away
by not doing their job.

~~~
Wowfunhappy
Even if the documentation was public, there's no guarantee anyone would take
the time to get drivers working on ARM in modern Linux.

I actually think emulation is a good long-term solution for legacy
applications. My NES rom of Super Mario Brothers is probably the most cross-
platform and future-proof piece of software on my computer, because every
platform has an NES emulator! You write (or port) an emulator once per
platform, and suddenly the whole NES library opens up.

~~~
swiley
Wasn’t this the idea behind java?

~~~
Wowfunhappy
Java runs in a VM rather than an emulator, but, basically yes!

------
myself248
I wonder if this overall concept can be done for Synaptics touchpad drivers.
Just wrap them in an emulator so I can use the vendor's drivers that work
well.

~~~
tyingq
That would be pretty similar to how ndiswrapper[1] works for network drivers.

[1]
[https://en.m.wikipedia.org/wiki/NDISwrapper](https://en.m.wikipedia.org/wiki/NDISwrapper)

------
rubatuga
AirPrint is great for iOS devices, where you can't install printer drivers.

------
rietta
I love this. How to keep a working older printer going and make it useful!

------
baq
i have an oldish canon printer in the same situation and an rpi right next to
it... bookmarked!

------
riedel
qemu was the only way I could my fathers printer working on his new arm
chromebook by installing cups on the Linux subsystem . It is really ridiculous
how many Linux supported printers only support x86 .

