Installing HP LaserJet CP1525n color on Fedora 29

I finally figured out how to properly install my venerable HP LaserJet CP1525n color yesterday after system-upgrading to Fedora 29! The printer is connected via Ethernet, and previously I used Fedora's Settings > Devices > Printers GUI wizard to install a driver. Since there is/was no exact match in the driver list, I selected HP Color LaserJet Series PCL 6 CUPS (color) or something like that, thanks to this thread I found on the HP Community forums. While that worked and I could actually print black&white (or so I thought) text, the quality was ranging from acceptable to borderline unusable: The letters on a page had a growing, from left to right, kind of blue (colored!?) shadow which made e.g. papers with small font sizes effectively unreadable. As usual, everything works fine under Microsoft Windows 10, so I knew it had to be a driver issue (alignment?) but didn't have any clue how to go about fixing it. And yes, I also tried to set up HPLIP (HP Linux Imaging and Printing) several times before, but always failed with some sort of "connection error" IIRC. Anyways, after upgrading to Fedora 29 Workstation a couple of days ago I decided to give HPLIP another try—I must have been missing something after all. And indeed (I already gave it away), this time I found the missing piece! Here's what worked for me:

$ sudo dnf install hplip hplip-gui
$ xhost +local:root  # allow root to connect to our X server
$ sudo hp-setup
HP Linux Imaging and Printing System (ver. 3.18.6)
Printer/Fax Setup Utility ver. 9.0

Copyright (c) 2001-15 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.

QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'

HP Device Manager - Setup: Device Discovery

Searching... (bus=net, timeout=5, ttl=4, search=(None) desc=0, method=slp)

HP Device Manager - Setup: Device Discovery

Now when I click through, I always got the following error:

error: Unable to communicate with device (code=12): hp:/net/HP_LaserJet_CP1525N?ip=192.168.1.1
error:  Unable to print to printer.  Please check device and try again.

HP Device Manager - Setup: Unable to print to printer

I finally found the solution to this problem on the LinuxQuestions.org forums in a thread with the apt title hplip error: Unable to communicate with device (code=12): One simply needs to enable (read-only) SNMP access on the printer. Duh! So let's do this.

HP LaserJet CP1525n web interface: Networking SNMP configuration

Success! Now to be honest, it might very well be that I had explicitly disabled SNMP during initial setup years ago (it isn't required with MS Windows, mind you). I can't remember. Nevertheless the error message "Unable to print to printer" (oh really!?) is a classic. A tiny hint regarding SNMP would have allowed me to solve this in virtually no time (well, presumably). This is actually one of my pet peeves, because omitting anything meaningful or tangible/actionable seems just so prevalent. Yeah, it could be worse. ∗sigh∗ Incidentally, I have this link to a 5 minute read about The Art of the Error Message in my bookmarks.

I'm also pretty sure there is a way to accomplish all of this without the need for a graphical user interface (X, web browser) and clicking on a mouse button, but I'm rather happy for now…

$ xhost -local:root  # revoke access again