I'd like to print out of a VM (KVM/QEMU via virt-manager).
For the VM to host connection there is an emulated parallel port in the VM that should be connected to a Unix Socket.
I tried to create a listen socket with socat, which should then be redirected to a cups printer by typing
socat unix-listen:/tmp/kvmpr localhost:631/printers/pdf
which didn't work.
Now that I didn't have time to tinker around more because my customer wanted his machine back, I tried emulating the same thing by setting up a unix listen port that prints to a cups PDF printer, and letting another cups printer (dummy) print to port 9100 who redirects to the created socket. When i do that i get following errors on the one side:
socat -d -d tcp4-listen:9100 /tmp/kvmpr
2021/01/20 17:01:43 socat[5523] N listening on AF=2 0.0.0.0:9100
2021/01/20 17:02:11 socat[5523] N accepting connection from AF=2 127.0.0.1:36160 on AF=2 127.0.0.1:9100
2021/01/20 17:02:11 socat[5523] N opening connection to AF=1 "/tmp/kvmpr"
2021/01/20 17:02:11 socat[5523] N successfully connected from local address AF=1 "\x7E\x@D\xB9U"
2021/01/20 17:02:11 socat[5523] N successfully connected via <anon>
2021/01/20 17:02:11 socat[5523] N starting data transfer loop with FDs [6,6] and [5,5]
2021/01/20 17:02:11 socat[5523] N socket 2 (fd 5) is at EOF
2021/01/20 17:02:11 socat[5523] N socket 2 (fd 5) is at EOF
2021/01/20 17:02:11 socat[5523] E write(5, 0x55c9ae7f46b0, 3763): Broken pipe
2021/01/20 17:02:11 socat[5523] N exit(1)
and this one on the other:
socat unix-listen:/tmp/kvmpr TCP:127.0.0.1:631/printers/PDF
2021/01/20 17:02:11 socat[5513] E write(5, 0x55d5325f2930, 8192): Broken pipe
I don't know what to do, I can't find anything related to how I send data to cups via something like socat.
A "quick and dirty" solution from my side was letting the parallel port print into a file and then use a script utilizing ghostpdl to output a pdf, but that is just too complicated for the user to execute.
I'd be very happy if someone could help me with my problem, thanks in advance for answering!