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

My point is not a printer that's broken, my point is a printer that appears TO THE COMPUTER to print instantly and successfully.

Just I don't care if any paper comes out anywhere, and would prefer not.

@foone what's your usage case?
@demofox @foone I vaguely recall some kind of virtual pet or aquarium that you fed by printing showing up on corporate computers... possibly a dream.
@demofox I've got a program that keeps printing things at regular intervals, and it wastes several seconds between items. if I had a fake printer, I could do a real print batch at the beginning, then every time it tries to print, it just instantly succeeds, doing nothing.
@foone @demofox I think I used to use a software called PDF995 and set the output directory to a read-only folder for this type of edge case.
@foone @demofox curious what this sociopathic program is
How to add a fake, dummy, null printer in CUPS?

I'm writing a piece of software that supports multiple printers. In order to test it, I need to add multiple printers to my CUPS server. How can I do that? I want to add a few fake printers that w...

Super User
@foone @demofox What about using one of those usb to parallel adapters and install an ancient printer (like a Star LC10). IIRC those don't give any feedback so the computer just assumes it's printing.
@foone That sounds more pleasant than a real USB printer that takes any printout and goes "I'm out of cyan; I can't print this.".
@foone what's the difference between this and a normal USB printer? (Only half joking)
@foone Isn't that how printers work?

@foone Look at the code from the retro printer project, It does similar but for parallel printers as input and outputs to USB/Network printers.

Might be some bits you could borrow

https://www.retroprinter.com/

About the Retro-Printer Module | RetroPrinter.com

The Retro-Printer provides low cost printer port capture hardware to capture data and connect computers & industrial equipment to modern printers.

RetroPrinter.com
@ben @foone okay yeah we made a cheap joke elsewhere in the thread, which everyone else already made, so let us redeem ourselves by mentioning that we know enough about those old protocols to suspect it really is nearly the same except for a USB wrapper
@foone That just sounds like a USB printer though 🖨️

@foone A printer that never throws an error? No fucking way.

SHUT UP AND TAKE MY MONEY! 💸💸💸

"PC LOAD LETTER? What the fuck does that mean?"

@apicultor @foone
Apicultor, if you shove [linux] "loading $BLAH into RAM pages" into a low grade translator, I suspect it looks like that prompt
@foone depends on the OS. i guess that something that emulates a parport and doesn't care about the output may be the lowest common denominator?
@foone hope you like implementing an entire virtual TCP/IP/HTTP stack, because CUPS now requires IPP-over-USB!!
@foone we spent 30 years dealing with shit USB printer driver incompatibility and instead of just fucking agreeing on how to do it properly over USB, we somehow ended up in the bizarre timeline where the oldest display operation in computing history now involves eight million layers of protocols and software
@foone so my old printer, then
@foone Well, considering that I was dealing with a real printer that was doing exactly this earlier today…
@foone Theres probably a way to modify a ppd file to send an exit code 0 at any jobb, while piping the output to /dev/null

@foone

This sounds less like a USB device and more like a device driver with nothing attached.

@foone At least it will never run out of ink or toner. 
@nils_ballmann @foone I guarantee you if someone makes this, it will demand more cyan from time to time.
@foone that's not very realistic though. It should accept any output you send it and then report out of yellow ink/busy/paper jam
@foone apparently not hard at all since we have a half dozen machines at work with exactly this functionality. They're very expensive/dev/null machines
@foone Well, now I want my shredder to appear on the network as a printer.
@trevorflowers @foone even better if it prints as the paper is fed directly to the shredder blades
@foone I'm sure you could make a copy of the Microsoft Print to PDF code and make it print to nothing.
@foone Go for maximum environmental damage.
@foone kinda describing a regular printer there
@foone Those exist! You can buy them anywhere that sells printers. Just ask where they have printers & you can buy any of those & it will do this.
@foone Do you want the hardware, or will a soft solution work?
@foone Will it at least make printing noises?
@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.)
@foone isn’t that just any printer? They almost malfunction.
@darksecond yeah but I specifically want it to lie about the print succeeding
@foone Take a real ink tank printer, disable the paper-out and ink-out sensors,
@foone lpadmin blah blah blah /dev/null
@foone
I have a printer like that.

@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 Sounds like a standard Xerox printer driver to me.
@foone the linux g_printer module and a raspberry pi is probably the most straightforward path, someone already has a project for it: https://github.com/Raspberryy/Emulated_USB_Printer
GitHub - Raspberryy/Emulated_USB_Printer: Using a Raspberry Pi Zero to emulate a USB-Printer

Using a Raspberry Pi Zero to emulate a USB-Printer - Raspberryy/Emulated_USB_Printer

GitHub
@foone That's basically my Brother inkjet without any mods. Plus it starts cleaning itself making burglar noises at 4AM.
@foone Can it at least throw a message about an expired subscription or lack of cyan, to make it more realistic?
@WooShell @foone And at some point a new version should be released that makes a change in how you work with it, that continues to accept the old method but sends a depreciation message somewhere -- accept for 5% of the time when it will send the depreciation message and signal a paper jam instead of a successful print. (Shockingly based on something a somehow still popular third party python tool did until the complaints got loud enough to force a reversion)

@foone almost certainly completely overkill for this task but there's the USB raw gadget samples: https://github.com/xairy/raw-gadget

I've used this to simulate USB devices in the past, and it includes a printer.c example

GitHub - xairy/raw-gadget: USB Raw Gadget — a low-level interface for the Linux USB Gadget subsystem

USB Raw Gadget — a low-level interface for the Linux USB Gadget subsystem - xairy/raw-gadget

GitHub
SteamDeck: Become Printer

Wonderful things happen when we read the documentation. For instance, we’ve all seen a Raspberry Pi work as an Ethernet adapter over USB, or a ESP32-S2 presenting as a storage device. Well, […

Hackaday
@foone Pretty sure there are lots of printers which already do that
@foone go to hp.com and buy any printer at all
@ari @foone HP products are all just ass
@niko @foone one exception, and i'll defend it to death - the HP Prime G2
@ari @foone @niko holy fucking shit fellow hp prime gamer
absolutely peak calculator, god bless RPN
@niko @ari @foone this is true
my hp laptop has over 100 unsafe shutdowns