freedomofpress / securedrop-client

a Qt-based GUI for SecureDrop journalists 📰🗞️
GNU Affero General Public License v3.0
40 stars 39 forks source link

Print: Find alternative to PPD #2088

Open deeplow opened 2 months ago

deeplow commented 2 months ago

Description

The workstation's print workflow relies on PPD files, which according to the CUPS's lpadmin manpage:

The following lpadmin options are deprecated:

-i filename

  • This option historically has been used to provide either a System V interface script or (as an implementation side-effect) a PPD file. Note: Interface scripts are not supported by CUPS. PPD files and printer drivers are deprecated and will not be supported in a future version of CUPS.

-P ppd-file

  • Specifies a PostScript Printer Description (PPD) file to use with the printer. Note: PPD files and printer drivers are deprecated and will not be supported in a future version of CUPS.

update: found the respective CUPS issue about the removal of PPD https://github.com/OpenPrinting/cups-sharing/issues/4

This is also warned when running _setup_printer(). Running the same line manually on my system succeeds but shows the following on stderr:

lpadmin: Printer drivers are deprecated and will stop working in a future version of CUPS.

Steps to Reproduce

Not relevant,

Expected Behavior

Use of supported system.

Actual Behavior

Warning about using something that may not be supported in the future.

Comments

legoktm commented 2 months ago

Related: https://github.com/freedomofpress/securedrop-engineering/issues/71 and https://github.com/freedomofpress/securedrop-client/issues/2156.

deeplow commented 2 months ago

This is also warned when running _setup_printer(). Running the same line manually on my system succeeds but shows the following on stderr:

lpadmin: Printer drivers are deprecated and will stop working in a future version of CUPS.

I have confirmed now that this line also appears on the sd-device's logs.

rocodes commented 2 months ago

We have sadly known about this for a while and even tried to suppress those warnings: https://github.com/freedomofpress/securedrop-client/commit/9bcd76a6561889da66b10d999fb0c47329ae8c91 Another good reason to move away from this approach and towards the modern age :)

deeplow commented 3 weeks ago

I looked a bit into this yesterday. I was able to successfully set up an HP printer without drivers (IPP).

How I got it working

  1. Created debian-12-based a standalone qube (to make testing easier)
  2. Add qubes services: avahi and cups
  3. Start the qube and connect the printer's USB to it
  4. sudo apt install ipp-usb cups
  5. system-config-printer, just add the printer, selecting the "Generic" driver and then "IPP Everywhere". (note, the printer showed up in two places: close to the top of the list and then also under Network printers. In my case, both worked)

That was it. In the final version we may want to automate some of the steps using lp commands, but for now I'd say this already provides satisfactory results.

Research on driverless printing

I found the Debian wiki a very valuable resource. Many of my findings come from there.

How to detect if a printer supports IPP?

Run lsusb -v | grep -A 3 bInterfaceClass.*7

Then check for a value of 4 for bInterfaceProtocol indicates a USB IPP device:

  bInterfaceClass 7 Printer
  bInterfaceSubClass 1 Printer  
  bInterfaceProtocol 4  
  iInterface 0  

The interface is usually referred to as being a 7/1/4 one.

deeplow commented 3 weeks ago

@rocodes and I have both had successful experiences with setting up driverless printers. The Debian wiki provides a lot of detail on the topic and it was my main resource to get things working. However, none of us managed to fully automate the process (yet).