Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.3] papd: update cups_get_printer_status() #696

Merged

Conversation

NJRoadfan
Copy link

@NJRoadfan NJRoadfan commented Jan 23, 2024

More code cleanup. Switch to using solely the CUPS Destination API to speak with the server instead of doing IPP queries ourselves. If we have a DNS-SD discovered printer, we query it directly for the status.

We just need to attempt to connect to a printer here and return.
Switch over entirely from IPP API to using the Destination API to retrieve printer status. Also resolve issues when a temporary queue for a IPP Everywhere printer needs to be built, but isn't ready to return status information.
Remove an unneeded call to cupsConnectDest().
Completely rewrote the status routine. Now we connect directly to DNS-SD discovered printers to pull their status. Otherwise we fall back to the CUPS scheduler.

info = cupsCopyDestInfo(CUPS_HTTP_DEFAULT, dest);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: Seems unnecessary to add indentation here. ;)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blame Microsoft and their editor that doesn't show tab stops.

Sometimes a printer may not respond in time to a status request. If we can connect to the destination, but not the printer itself, don't block print jobs from processing. At this point, the CUPS scheduler is handling the job queuing.
@NJRoadfan
Copy link
Author

I will be testing this PR with an actual IPP Everywhere printer this weekend. Code seems to work, but I might refactor it into something a bit cleaner.

Actual testing with IPP Everywhere printers revealed that they are very specific about the order of queries. Also, they tend to return "false" for "printer-is-accepting-jobs" while printing. Add an extra conditional before disabling client requests the printer.
@rdmark
Copy link
Member

rdmark commented Jan 27, 2024

Sounds good. I’ll test it with my printer tomorrow.

Simplify things a bit. In the end it is easier to just use IPP queries for both permanent queues and DNS-SD printers.
Remove the "none" text if there are no printer state reasons to report.
@rdmark
Copy link
Member

rdmark commented Jan 29, 2024

@NJRoadfan I assume you would like to have this changeset in the upcoming 2.3.1 release?

@NJRoadfan
Copy link
Author

Yes, if possible. Only reason why I'm holding off on this one is testing. Hitting the printer directly for status has a latency hit in some cases. Don't want to introduce any unintended crashes on the client side if it gets something it doesn't like.

@rdmark
Copy link
Member

rdmark commented Jan 30, 2024

@NJRoadfan If there is a potential performance impact concern, that could be an argument for waiting until the next point release. We have a good changeset lined up already. Up to you though. I would like to tag 2.3.1 this coming weekend.

@NJRoadfan NJRoadfan marked this pull request as ready for review February 1, 2024 23:48
@NJRoadfan
Copy link
Author

I've given this a through shakedown. I simulated the worst possible conditions possible with the equipment I have. The setup was minivmac running on WiFi via LToUDP, printing to a IPP Everywhere printer also via WiFi. I can tell you its pretty slow, but the status updates worked fine. No crashing or odd behavior from the LaserWriter 8 driver on System 7.5.

@rdmark rdmark merged commit 1fb269d into Netatalk:branch-netatalk-2-3 Feb 2, 2024
7 checks passed
@NJRoadfan NJRoadfan deleted the papd-update-cups-status branch February 2, 2024 22:46
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Feb 5, 2024
New features

The following compile time option has been added:

    --with-docbook - Used to generate man and html pages from XML
    sources, the latter which are now included in the tarball.

Breaking changes

The following obsoleted features have been removed:

    Kerberos IV UAM - Version IV backwards compatibility headers were
    removed from Kerberos V 1.11 in 2012

    AppleDouble adouble:osx - The AD format that Mac OS X 10.3 used,
    but was removed in subsequent versions

    AppleDouble adouble:sfm - Microsoft's Services For Macintosh
    compatibility mode that required a long-gone hacked version of
    Samba

atalkd

The RTMP broadcast quirks mode that was introduced in v2.3.0 has been
replaced with an automatic activation when atalkd is configured with a
single interface and the -router flag.

Therefore, the now-unneeded -q command line option has been removed.
What's Changed

    [2.3] Fix Zeroconf support on *BSD platforms by @rdmark in
    Netatalk/netatalk#647
    [2.3] Add NetBSD, Solaris, Fedora build workflows by @rdmark in
    Netatalk/netatalk#642
    [2.3] Use correct BSD make syntax in initscripts Makefile by
    @rdmark in Netatalk/netatalk#644
    [2.3] Remove long-outdated README and VERSION files, superseded by
    man pages by @rdmark in
    Netatalk/netatalk#641
    [2.3] Two small memory handling patches ported from
    netatalk-classic by @rdmark in
    Netatalk/netatalk#645
    [2.3] macusers: Fallback output when full name not available by
    @rdmark in Netatalk/netatalk#652
    [2.3] papd: Update cups_print_job() to use CUPS destination API by
    @NJRoadfan in Netatalk/netatalk#651
    [2.3] papd: Update cups_autoadd_printers() to use current API
    call. by @NJRoadfan in
    Netatalk/netatalk#655
    [2.3] workflow: Compile on Debian with cracklib, ldap, quota by
    @rdmark in Netatalk/netatalk#653
    [2.3] Use GitHub actions v4 for workflow jobs by @rdmark in
    Netatalk/netatalk#662
    [2.3] manual: Link to custom download and wiki mirrors in navbar
    by @rdmark in Netatalk/netatalk#671
    [2.3] papd - More cleanup and moderization of print_cups.c by
    @NJRoadfan in Netatalk/netatalk#672
    [2.3] papd - Use cups_get_language() function by @NJRoadfan in
    Netatalk/netatalk#674
    [2.3] papd: Use cupsGetOptions() to get printer URI by @NJRoadfan
    in Netatalk/netatalk#678
    [2.3] atalkd: Fix for RTMP broadcast bug. by @NJRoadfan in
    Netatalk/netatalk#680
    [2.3] Workflow: Bump SonarScanner to v2 by @rdmark in
    Netatalk/netatalk#685
    [2.3] libatalk: Appease Fedora gcc incompatible pointer error by
    @rdmark in Netatalk/netatalk#683
    [2.3] afpd: Remove support for AppleDouble osx and sfm by @rdmark
    in Netatalk/netatalk#673
    [2.3] Remove obsoleted Kerberos v4 UAM by @rdmark in
    Netatalk/netatalk#686
    [2.3] Generate man pages through build system by @rdmark in
    Netatalk/netatalk#690
    [2.3] Cleanup of obsolete gitignore filters by @rdmark in
    Netatalk/netatalk#693
    [2.3] manual: Update URLs to internal resources by @rdmark in
    Netatalk/netatalk#695
    [2.3] papd: Refactor and cleanup cups_get_printer_ppd() by
    @NJRoadfan in Netatalk/netatalk#700
    [2.3] papd: update cups_get_printer_status() by @NJRoadfan in
    Netatalk/netatalk#696
    [2.3] manual: Remove obsoleted html-upload target, and update css
    URL by @rdmark in Netatalk/netatalk#701
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants