OpenPrinting / ps-printer-app

PostScript Printer Application
Apache License 2.0
37 stars 13 forks source link

Usage? connecting CUPS to pappl printer -- what ipp:// uri to use? #9

Closed pgnd closed 1 year ago

pgnd commented 2 years ago

on

lsb_release -rd
    Description:    Fedora release 34 (Thirty Four)
    Release:        34

with

rpm -qa | egrep "cups|^hp"
    cups-2.3.3op2-7.fc34.x86_64
    cups-client-2.3.3op2-7.fc34.x86_64
    cups-filesystem-2.3.3op2-7.fc34.noarch
    cups-filters-1.28.9-2.fc34.x86_64
    cups-filters-libs-1.28.9-2.fc34.x86_64
    cups-ipptool-2.3.3op2-7.fc34.x86_64
    cups-libs-2.3.3op2-7.fc34.x86_64
    cups-printerapp-2.3.3op2-7.fc34.x86_64
    gutenprint-cups-5.3.4-4.fc34.x86_64
    hplip-3.21.2-10.fc34.x86_64
    hplip-common-3.21.2-10.fc34.x86_64
    hplip-libs-3.21.2-10.fc34.x86_64
    python3-cups-2.0.1-10.fc34.x86_64

i've installed the snap

snap list ps-printer-app
    Name            Version  Rev  Tracking     Publisher      Notes
    ps-printer-app  1.0      429  latest/edge  openprinting✓  -

the app's running

ps-printer-app status
    WARNING: cgroup v2 is not fully supported yet, proceeding with partial confinement
    Running, idle since Fri, 03 Sep 2021 21:21:57 GMT

driver's availble for my printer (HPLJ 4050n),

ps-printer-app drivers | grep hp | grep 4050
    WARNING: cgroup v2 is not fully supported yet, proceeding with partial confinement
    hp--laserjet-4050-series--en "HP laserjet 4050 series (en)" "MFG:Hewlett-Packard;MDL:hp laserjet 4050 series;"

in WebUI @

http://localhost:8000

I've added the printer,

ps-printer-app printers
    WARNING: cgroup v2 is not fully supported yet, proceeding with partial confinement
    HPLJ_4050n_pappl

(1) In WebUI, click to send "Test Page" does connect to the printer, but triggers an endless stream of blank pages. "Cancel Job" is required to stop.

(2) I'm trying to get any app -- e.g. Firefox, Brave, Okular -- to recognize the pappl-setup printer.

IIUC (?), need to 'tell' CUPS about it: "print with CUPS, CUPS (and also cups-browsed) discover and treat the printers set up with this Printer Application as driverless IPP printers (IPP Everywhere and AirPrint)."

In CUPS webui @

http://localhost:8000

I assume (?) I need to enter an "ipp://" URI. What form must that take? To date, under "just CUPS", I've always/only used "socket://I.P.addr.ess".

pgnd commented 2 years ago

it appears SNMP support in PAPPL arrived here

https://github.com/michaelrsweet/pappl/issues/17

"Add support for printer discovery and lookup using SNMP, a la the CUPS snmp backend ..."

Checking, my CUPS "Add Printer" dialog, finds/reports:

addprinter2

from where I typically select:

Other Network Printers:
    ...
    [X] AppSocket/HP JetDirect 
    ...
tillkamppeter commented 2 years ago

Could you run

hp-probe -bnet -o5

Does it discover your printer?

Try to vary the timeout seconds (-o option).

tillkamppeter commented 2 years ago

Could you also run

/usr/lib/cups/backend/snmp

and post the output here?

pgnd commented 2 years ago

on my lan, my printer's found @

nmap -sU -p 161 172.28.10.0/24
    ...
    Nmap scan report for printer.mydomain.com (172.28.10.10)
    Host is up (0.027s latency).

    PORT    STATE         SERVICE
    161/udp open|filtered snmp
    MAC Address: 00:30:C1:52:B6:3D (Hewlett Packard)
    ...

snmpwalk returns for my printer

snmpwalk -v1 -Ont -c public 172.28.10.10
    .1.3.6.1.2.1.1.1.0 = STRING: HP ETHERNET MULTI-ENVIRONMENT,ROM G.08.08,JETDIRECT,JD33,EEPROM G.08.49
    .1.3.6.1.2.1.1.2.0 = OID: .1.3.6.1.4.1.11.2.3.9.1
    .1.3.6.1.2.1.1.3.0 = 48385870
    .1.3.6.1.2.1.1.4.0 = STRING: 
    .1.3.6.1.2.1.1.5.0 = STRING: NPI52B63D
    .1.3.6.1.2.1.1.6.0 = STRING: 
    .1.3.6.1.2.1.1.7.0 = INTEGER: 64
    .1.3.6.1.2.1.2.1.0 = INTEGER: 1
    .1.3.6.1.2.1.2.2.1.1.1 = INTEGER: 1
    .1.3.6.1.2.1.2.2.1.2.1 = STRING: HP ETHERNET MULTI-ENVIRONMENT,ROM G.08.08,JETDIRECT,JD33,EEPROM G.08.49
...

hp-probe

hp-probe -bnet -o35

    HP Linux Imaging and Printing System (ver. 3.21.2)
    Printer Discovery Utility ver. 4.1

    Copyright (c) 2001-18 HP Development Company, LP
    This software comes with ABSOLUTELY NO WARRANTY.
    This is free software, and you are welcome to distribute it
    under certain conditions. See COPYING file for more details.

    --------------------
    | DEVICE DISCOVERY |
    --------------------

    Probing network for printers. Please wait, this will take approx. 35 seconds...

    warning: No devices found on the 'net' bus. If this isn't the result you are expecting,
    warning: check your network connections and make sure your internet
    warning: firewall software is disabled.

    Done.

and

/usr/lib/cups/backend/snmp
    (nothing/empty)
pgnd commented 2 years ago

I'm not the first with no response @ hp-probe

https://www.google.com/search?client=firefox-b-1-d&q=hp-probe+%22warning%3A+No+devices+found+on+the+%27net%27+bus.%22

fwiw, @

https://forums.opensuse.org/showthread.php/540559-Configuring-the-firewall-so-that-hp-setup-can-find-network-printers?p=2939444#post2939444

noting

"hp-setup has three different ways of discovering a printer: the Service Location Protocol (SLP, port 427), its own implementation of the Multicast DNS protocol (mDNS aka Zeroconf/Bonjour, port 5353),"

...

"In addition, hp-setup uses a non-standard UDP port for SLP and mDNS, in order to avoid conflicts with other programs that may use these ports on users' systems. "

IIUC, 'hp-*' presumes a native autodiscovery method, and does not use system tools.

AND, hplip-printer-app presumes use of 'hp-*' ?

tillkamppeter commented 2 years ago

I am thinking about re-activating PAPPL's own backends in the HPLIP Printer Appplication allowing the user to use them if HPLIP's do not work for them.

You could already test PAPPL's backend by using the PostScript Printer Application. Does your printer work there?

tillkamppeter commented 2 years ago

I have now submitted an HPLIP with support for the standard PAPPL backends and manual IP input. In around one hour it should be there, and also auto-update on your system.

pgnd commented 2 years ago

I am thinking about re-activating PAPPL's own backends in the HPLIP Printer Appplication allowing the user to use them if HPLIP's do not work for them. You could already test PAPPL's backend by using the PostScript Printer Application. Does your printer work there?

snap install --edge ps-printer-app
    ps-printer-app (edge) 1.0 from OpenPrinting✓ installed

snap list ps-printer-app
    Name            Version  Rev  Tracking     Publisher      Notes
    ps-printer-app  1.0      444  latest/edge  openprinting✓  -

snap enable ps-printer-app
    error: cannot enable "ps-printer-app": snap "ps-printer-app" already enabled

ps ax | grep snap | grep printer
    20903 ?        Ssl    0:00 /snap/ps-printer-app/444/usr/bin/ps-printer-app -o log-level=debug -o log-file=/var/snap/ps-printer-app/common/ps-printer-app.log server

@ https://localhost:8000/

--> "Add Printer"

no auto-discovered printers listed:

addprinter3

adding as "Network Printer" instead, specifying

Hostname/IP Address: 172.28.10.10
Driver Name: Auto-Detect Driver

addprinter4

--> "Print Test Page"

works OK

create a permanent queue

lpadmin -p lj4050-pappl -E -v ipp://localhost:8000/ipp/print/HPLJ_4050n_pappl -m everywhere
ls -al /etc/cups/ppd/lj*
    -rw-r----- 1 root lp 8.0K Sep  8 07:53 /etc/cups/ppd/lj4050-pappl.ppd

@ KDE Kate's PrinterDialog

    select Destination --> "lj4050-pappl"
    click to "Print"

and NOTHING -- no output, no connect to printer

here's the log for that:

print_fail_kate.txt

similarly @ Brave browser's PrinterDialog.

strangely, @ (just) Firefox's PrinterDialog,

    select Destination --> "lj4050-pappl"
    click to "Print"

PRINTS to printer, BUT -- having triple-checked that I'm selecting the "lj4050-pappl" !! -- appears to ignore the pappl/ipp queue, and prints instead via existing CUPS driver. logs are @system, NOT at /var/snap/... path:

2021-09-08T08:09:15.864608-04:00 devcupsd[32054]: Expiring subscriptions...
2021-09-08T08:09:16.082984-04:00 devcupsd[32054]: Expiring subscriptions...
2021-09-08T08:09:16.098942-04:00 devcupsd[32054]: [Job 1630] Adding start banner page "none".
2021-09-08T08:09:16.099029-04:00 devcupsd[32054]: [Job 1630] Queued on "HPLJ_4050n_gutenprint" by "myuser".
2021-09-08T08:09:16.099284-04:00 devcupsd[32054]: REQUEST localhost - - "POST /printers/HPLJ_4050n_gutenprint HTTP/1.1" 200 435 Create-Job successful-ok
2021-09-08T08:09:16.099870-04:00 devcupsd[32054]: [Job 1630] File of type application/pdf queued by "myuser".
2021-09-08T08:09:16.099897-04:00 devcupsd[32054]: [Job 1630] Adding end banner page "none".
2021-09-08T08:09:16.101348-04:00 devcupsd[32054]: [Job 1630] Started filter /usr/lib/cups/filter/pdftopdf (PID 23830)
2021-09-08T08:09:16.101374-04:00 devcupsd[32054]: [Job 1630] Started filter /usr/lib/cups/filter/gstoraster (PID 23831)
2021-09-08T08:09:16.101403-04:00 devcupsd[32054]: [Job 1630] Started filter /usr/lib/cups/filter/rastertogutenprint.5.3 (PID 23832)
2021-09-08T08:09:16.101430-04:00 devcupsd[32054]: [Job 1630] Started backend /usr/lib/cups/backend/socket (PID 23833)
2021-09-08T08:09:16.101778-04:00 devcupsd[32054]: REQUEST localhost - - "POST /printers/HPLJ_4050n_gutenprint HTTP/1.1" 200 14467 Send-Document successful-ok
2021-09-08T08:09:17.107068-04:00 devcupsd[32054]: Expiring subscriptions...
2021-09-08T08:09:18.001154-04:00 devcupsd[32054]: Expiring subscriptions...
2021-09-08T08:09:18.149872-04:00 devcupsd[32054]: HPLJ_4050n_gutenprint myuser 1630 [08/Sep/2021:08:09:18 -0400] total 1 1 localhost xdg-desktop-portal-kde.kpwCpX - one-sided
2021-09-08T08:09:18.150011-04:00 devcupsd[32054]: [Job 1630] Job completed.
2021-09-08T08:09:18.150050-04:00 devcupsd[32054]: Expiring subscriptions...
2021-09-08T08:09:19.151398-04:00 devcupsd[32054]: Expiring subscriptions...

not sure what's going on with FF yet ... but irrelevant to the general print fail, as for Kate, Brave, etc.

tillkamppeter commented 2 years ago

Your attached log, print_fail_kate.txt, has helped me to find the cause of the problem: Your printer (LaserJet 4050) has a bug in the PostScript interpreter which makes it unreliable on printing Ghostscript's PostScript output. Therefore the filter function used in the Snap automatically switcches to the Poppler utility pdftops, and for this in the Snap build a wrong path was given. This path I have corrected now in all the 3 Printer Applications.

Within the next hour the new versions will appear in the Snap Store (and auto-update on your system.

pgnd commented 2 years ago

Within the next hour the new versions will appear in the Snap Store (and auto-update on your system.

I'll test as soon as I see it.

Question:

Using the 'hplip-printer-app' , I can change the device queue's associate PPD to a manually specified one.

If, instead of a -> PS ppd , I want to use a gutenprint-sourced -> PCL6 ppd, generated (e.g.) as

cups-genppd.5.3 -M -v | egrep "lj_4050 |pcl-g_6_l "
    pcl-g_6_l           Generic PCL 6/PCL XL LF Printer
    hp-lj_4050          HP LaserJet 4050

cups-genppd.5.3 -p hp-lj_4050
cups-genppd.5.3 -p pcl-g_6_l

gunzip stp-hp-lj_4050.5.3.ppd.gz
gunzip stp-pcl-g_6_l.5.3.ppd.gz

ls -al *ppd
    -rw-r----- 1 root    lp      170K Sep  6 17:28 stp-hp-lj_4050.5.3.ppd
    -rw-r----- 1 root    lp      185K Sep  6 17:28 stp-pcl-g_6_l.5.3.ppd

grep -i pcl *ppd
    stp-hp-lj_4050.5.3.ppd:*1284DeviceID: "MFG:Hewlett-Packard;MDL:HP LaserJet 4050 Series ;DES:Hewlett-Packard LaserJet 4050 Series;CMD:PJL,MLC,PCL,PCLXL,POSTSCRIPT;"
    stp-hp-lj_4050.5.3.ppd:*StpDriverModelFamily:   "6_pcl"
    stp-pcl-g_6_l.5.3.ppd:*Product: "(Generic PCL 6/PCL XL LF Printer)"
    stp-pcl-g_6_l.5.3.ppd:*ModelName:     "Generic PCL 6/PCL XL LF Printer"
    stp-pcl-g_6_l.5.3.ppd:*ShortNickName: "Generic PCL 6/PCL XL LF Printer"
    stp-pcl-g_6_l.5.3.ppd:*NickName:      "Generic PCL 6/PCL XL LF Printer - CUPS+Gutenprint v5.3.4"
    stp-pcl-g_6_l.5.3.ppd:*StpDriverName:   "pcl-g_6_l"
    stp-pcl-g_6_l.5.3.ppd:*StpDriverModelFamily:    "61_pcl"
    stp-pcl-g_6_l.5.3.ppd:*StpPPDLocation: "/usr/share/cups/model/gutenprint/5.3/C/stp-pcl-g_6_l.5.3.ppd.gz"
    stp-pcl-g_6_l.5.3.ppd:*% End of stp-pcl-g_6_l.5.3.ppd

can/should the 'hplip-printer-app' still be used? or need to switch to a different printer-app flavour?

tillkamppeter commented 2 years ago

First, the fixed hplip-printer-app has already landed. Your printer should work with "HP LaserJet 4050 PostScript" now. I do not know how fast automatic updates on a user's system are.

The hplip-printer-app offers also a non-PostScript option for the LaserJet 4050, simply manually select an entry without "PostScript" for it.

For PCL 6/XL you will need the Ghostscript Printer Application. It has generic entries for most PCL types and it also has an "HP LaserJet 4050 pxlmono" entry.

There is no Printer Application for Gutenprint yet (but is coming soon).

pgnd commented 2 years ago

snap updated

-   hplip-printer-app      1.0                         19     latest/edge    openprinting✓  -
+   hplip-printer-app      1.0                         24     latest/edge    openprinting✓  -

delete pappl queues delete cups queues

systemctl restart cups
snap restart hplip-printer-app

create ("Add Printer") 'HPLJ_4050n_pappl' in PAPPL/hplip-printer-app UI

Name: HPLJ_4050n_pappl
Device: Network Printer
Hostname/IP Address: 172.28.10.10
Driver Name: Auto-Detect Driver

The hplip-printer-app offers also a non-PostScript option for the LaserJet 4050, simply manually select an entry without "PostScript" for it.

Interestingly, the "Auto-Detect" driver auto-selects a PCL3 (not PS) driver, specifically

HP LaserJet 4050 Series pcl3, hpcups 3.21.8

(why HP itself doesn't provide a PCL6XL driver for HPLIP, I dunno)

"Print Test Page" -> OK

create permanent queue

lpadmin -p lj4050-pappl -E -v ipp://localhost:8000/ipp/print/HPLJ_4050n_pappl -m everywhere
ls -al /etc/cups/ppd/lj4050-pappl.ppd
    -rw-r----- 1 root lp 11K Sep  8 14:12 /etc/cups/ppd/lj4050-pappl.ppd

Check queue in 'system-config-printer' CUPS front-end,

addprinter5

@ KDE Kate Select / Print to "lj4050-pappl" printer

Prints OK

log:

print_ok_kate.txt

Testing, similarly

@ Firefox, Select / Print to "lj4050-pappl" printer

Prints OK, as well.

Looks good! now to test more thoroughly, and see if I can get the Gutenprint PCL6 ppd working.

pgnd commented 2 years ago

For eventual backend setup on a shared server, how are multiple printer apps to be concurrently installed?

Iiuc, each presents a WebUI on :8000.

How do you correcntly ensure avoidance of port conflict/collision if, e.g., all of hplip-printer-app, ps-printer-app & ghostscript-printer-app need be concurrently installed?

tillkamppeter commented 2 years ago

You can get PCL 6, but you need to use the Ghostscript Printer Application for that. It is not Gutenprint, but Ghostscript's PCL 6 driver.

And as far as I know Gutenprint does not print with PCL 6/XL. If there is a driver called "pcl6" in Gutenprint, it is a driver for the HP LaserJet 6 and that printer is PCL 5e.

tillkamppeter commented 2 years ago

If you have one Printer Application installed, and you start a second one, it takes port 8001, and so forth.

pgnd commented 2 years ago

And as far as I know Gutenprint does not print with PCL 6/XL. If there is a driver called "pcl6" in Gutenprint, it is a driver for the HP LaserJet 6 and that printer is PCL 5e.

fyi,

rpm -qa | grep -i guten
    gutenprint-libs-5.3.4-4.fc34.x86_64
    gutenprint-5.3.4-4.fc34.x86_64
    gutenprint-cups-5.3.4-4.fc34.x86_64

rpm -ql gutenprint-cups | grep bin
    /usr/bin/cups-calibrate
    /usr/sbin/cups-genppd.5.3
    /usr/sbin/cups-genppdupdate

man cups-genppd

    CUPS-GENPPD(8)           Gutenprint Manual Pages           CUPS-GENPPD(8)

    NAME
           cups-genppd - generate Gutenprint PPD files for use with CUPS

    SYNOPSIS
           cups-genppd [-c localedir] [-l locale] [-p prefix] [-q] [-v] model1 [model2, ...modeln]
           cups-genppd -L [-c localedir]
           cups-genppd -M [-v]
           cups-genppd -h
           cups-genppd -V

    ...
           -M     list available printer models.  By default, only driver names are listed; if verbose  mode  is  used,  the
                  full model name will also be printed
    ...

cups-genppd.5.3 -M -v | egrep "hp.*4050|pcl-g.*6"
    pcl-g_6             Generic PCL 6/PCL XL Printer
    pcl-g_6_l           Generic PCL 6/PCL XL LF Printer
    pcl-g_6_a4          Generic PCL 6 Printer wide margin
    pcl-g_6_lf_a4       Generic PCL 6 LF Printer wide margin
    pcl-g_6_tabloid_a4  Generic PCL 6 Tabl Printer wide margin
    hp-lj_4050          HP LaserJet 4050

cups-genppd.5.3 -p pcl-g_6_l
cups-genppd.5.3 -p lj_4050
gunzip stp-pcl-g_6_l.5.3.ppd.gz
gunzip stp-hp-lj_4050.5.3.ppd.gz

cat stp-pcl-g_6_l.5.3.ppd

--> gp-pcl6.txt

cat stp-hp-lj_4050.5.3.ppd

--> gp-hp-pcl6.txt

grep pcl *ppd
  stp-hp-lj_4050.5.3.ppd:*StpDriverModelFamily:   "6_pcl"
  stp-pcl-g_6_l.5.3.ppd:*StpDriverName:   "pcl-g_6_l"
  stp-pcl-g_6_l.5.3.ppd:*StpDriverModelFamily:    "61_pcl"
  stp-pcl-g_6_l.5.3.ppd:*StpPPDLocation: "/usr/share/cups/model/gutenprint/5.3/C/stp-pcl-g_6_l.5.3.ppd.gz"
  stp-pcl-g_6_l.5.3.ppd:*% End of stp-pcl-g_6_l.5.3.ppd

from Gutenprint, the 'hp-lj_4050' ppd is basically a simple subset of 'pcl-g_6' -- with fewer supported paper/page sizes, appropriate for the specific 4050 printer.

the 'hp-lj_4050' pcl6xl ppd is what I've, of late, been using directly in CUPS-created printers

If you have one Printer Application installed, and you start a second one, it takes port 8001, and so forth.

got it.

tillkamppeter commented 2 years ago

The Ghostscript Printer Application with my latest fix has also arrived now.

tillkamppeter commented 2 years ago

Anything working now? If you need PCL 6/XL, use the Ghostscript Printer Application.

tillkamppeter commented 1 year ago

No further reaction from the original poster, it seems that all childhood diseases of the retro-fitting Printer Applications are cured now. Therefore I am closing this bug.

Please open a new bug report if you still have problems.