I wonder how hard it is to make a fake USB printer.
Like, a printer that takes any printout and goes "yep, that printed just fine" but nothing ever comes out anywhere
@foone Because this was bugging me, i played with it, and i found that you can actually just create a printer on the nul: port under Windows, and have it successfully print jobs to the void.
@foone If it can be a network printer instead of USB, it's pretty easy to do, PCL uses port 9100 to send the print job, it's possible to just have some software listen locally (or remotely) to that port, accept the data, and just discard it.
I've done that in the past with a generic LaserJet PCL driver, both to discard unwanted print jobs that would never clear until successful, or capture it for data extraction.
@foone Not sure myself, but I'm p sure the functionality's there since MS already has a 'Print to PDF' function in windows so ideally. that should lay groundwork for that
@foone At my dad's business, there's a printer that dumps paper straight a trash can, because something insists that it MUST print logs that no human cares about, and if you unplug the printer the fuel pumps will stop working, and they won't be able to refuel their fleet for trucks.
(It's serial, not USB, but it's the same problem.)
So if you have a computer with a device-mode-capable USB controller (many SBCs as long as there is no USB hub between the SoC and the physical ports; maybe even some desktop PCs with USB-C nowadays?), it should just be a matter of building a kernel with the printer gadget module.
@foone I did that by accident in 2003 on Windows 2000.
I wrote a printer driver that was a virtualized printer, saving the EMF stream. It automatically selected the nearest one based on the room location and streamed it there. Sometimes it didn't go anywhere.
My biggest surprise was to reuse this knowledge in 2007 to implement printing in Chrome, given the renderer didn't have direct access to the printer. Heck I got a patent for that.
@foone Linux is happy to be a USB printer for you: https://www.kernel.org/doc/Documentation/usb/gadget_printer.rst (I've done the gadget side of the USB mass storage class and it was basically fun and easy. I'm guessing the gadget side of the printer class is similar but who knows.)