cups icon indicating copy to clipboard operation
cups copied to clipboard

CUPS Server not passing certain job-attribute settings to IPP-Everywhere Xerox Altalink Copier

Open csfjeff opened this issue 3 years ago • 20 comments

Ubuntu Server 21.04 CUPS 2.3.3op2 CUPS-Filter 1.28.8 Xerox Altalink B8055 with newest firmware (but seems to affect all our Xerox Altalink copiers. Don't have other IPP-Everywhere multi-tray printers, so quite possibly affects other units)

We have centralized CUPS servers with DNS-SD setup for Airprint Discovery. When Mac users try to specify the paper tray to print from, it doesn't seem to work, always using the printer's automatic tray selection instead. Upon further investigation, it seems that CUPS is not passing the inputslot settings to the printer.

On the CUPS server logs, I see that the job is received with an InputSlot setting:

D [02/Sep/2021:08:51:17 -0700] [Job 8722] 3 filters for job:
D [02/Sep/2021:08:51:17 -0700] [Job 8722] pdftopdf (application/pdf to application/vnd.cups-pdf, cost 66)
D [02/Sep/2021:08:51:17 -0700] [Job 8722] - (application/vnd.cups-pdf to printer/BUR-Techno-B8155/application/pdf, cost 10)
D [02/Sep/2021:08:51:17 -0700] [Job 8722] - (printer/BUR-Techno-B8155/application/pdf to printer/BUR-Techno-B8155, cost 0)
D [02/Sep/2021:08:51:17 -0700] [Job 8722] job-sheets=none,none
D [02/Sep/2021:08:51:17 -0700] [Job 8722] argv[0]="BUR-Techno-B8155"
D [02/Sep/2021:08:51:17 -0700] [Job 8722] argv[1]="8722"
D [02/Sep/2021:08:51:17 -0700] [Job 8722] argv[2]="user_name"
D [02/Sep/2021:08:51:17 -0700] [Job 8722] argv[3]="Technician Printing Notes"
D [02/Sep/2021:08:51:17 -0700] [Job 8722] argv[4]="1"
D [02/Sep/2021:08:51:17 -0700] [Job 8722] argv[5]="AP_ColorMatchingMode=AP_ApplicationColorMatching noBookletBinding..b. BookletType..n.=0 collate ColorModel=Gray com.apple.print.DocumentTicket.PMSpoolFormat=application/pdf com.apple.print.JobInfo.PMApplicationName=Typora com.apple.print.JobInfo.PMJobName=Technician\\ Printing\\ Notes com.apple.print.JobInfo.PMJobOwner=System\\ Administrator com.apple.print.PageToPaperMappingMediaName=Letter com.apple.print.PageToPaperMappingType..n.=1 com.apple.print.preset.Orientation..n.=1 nocom.apple.print.preset.PaperInfo..d.paperInfo..d.com.apple.print.PaperInfo.PMCustomPaper..b. com.apple.print.preset.PaperInfo..d.paperInfo..d.com.apple.print.PaperInfo.PMPaperName=na-letter com.apple.print.preset.PaperInfo..d.paperInfo..d.com.apple.print.PaperInfo.PMUnadjustedPageRect..a.0..n.=0 com.apple.print.preset.PaperInfo..d.paperInfo..d.com.apple.print.PaperInfo.PMUnadjustedPageRect..a.1..n.=0 com.apple.print.preset.PaperInfo..d.paperInfo..d.com.apple.print.PaperInfo.PMUnadjustedPageRect..a.2..n.=774.9920654296875 com.apple.print.preset.PaperInfo..d.paperInfo..d.com.apple.print.PaperInfo.PMUnadjustedPageRect..a.3..n.=600.6613883972168 com.apple.print.preset.PaperInfo..d.paperInfo..d.com.apple.print.PaperInfo.PMUnadjustedPaperRect..a.0..n.=-11.338623046875 com.apple.print.preset.PaperInfo..d.paperInfo..d.com.apple.print.PaperInfo.PMUnadjustedPaperRect..a.1..n.=-5.6693000793457031 com.apple.print.preset.PaperInfo..d.paperInfo..d.com.apple.print.PaperInfo.PMUnadjustedPaperRect..a.2..n.=780.661376953125 com.apple.print.preset.PaperInfo..d.paperInfo..d.com.apple.print.PaperInfo.PMUnadjustedPaperRect..a.3..n.=606.3306999206543 com.apple.print.preset.PaperInfo..d.paperInfo..d.com.apple.print.PaperInfo.ppd.PMPaperName=Letter com.apple.print.preset.PaperInfo..d.paperInfo..d.com.apple.print.ticket.APIVersion=01.00 com.apple.print.preset.PaperInfo..d.paperInfo..d.com.apple.print.ticket.type=com.apple.print.PaperInfoTicket com.apple.print.preset.PaperInfo..d.paperInfo..d.PMPPDPaperCodeName=Letter com.apple.print.preset.PaperInfo..d.paperInfo..d.PMPPDTranslationStringPaperName=Letter com.apple.print.preset.PaperInfo..d.paperInfo..d.PMTiogaPaperName=na-letter com.apple.print.PrinterInfo.PMColorDeviceID..n.=9657 com.apple.print.PrintSettings.PMColorSpaceModel..n.=1 com.apple.print.PrintSettings.PMCopies..n.=1 com.apple.print.PrintSettings.PMCopyCollate..b. com.apple.print.PrintSettings.PMDestinationType..n.=1 com.apple.print.PrintSettings.PMDuplexing..n.=2 com.apple.print.PrintSettings.PMFirstPage..n.=1 com.apple.print.PrintSettings.PMLastPage..n.=2147483647 com.apple.print.PrintSettings.PMPageRange..a.0..n.=1 com.apple.print.PrintSettings.PMPageRange..a.1..n.=2147483647 com.apple.print.PrintSettings.PMTotalBeginPages..n.=2 com.apple.print.PrintSettings.PMTotalSidesImaged..n.=2 DestinationPrinterID=BUR-Techno-B8155 Duplex=DuplexNoTumble DuplexBindingEdge..n.=2 InputSlot=tray-4 job-accounting-user-id=user_name job-uuid=urn:uuid:fd3002bd-950c-34e0-617e-72a4a2f55d27 media=Letter PageSize=Letter PaperInfoIsSuggested..b. pserrorhandler-requested=standard PunchMedia=None sides=two-sided-long-edge job-originating-host-name=172.19.0.2 date-time-at-creation= date-time-at-processing= time-at-creation=1630597876 time-at-processing=1630597877"

(Full server log attached)

I also did a packet capture on the printer itself, and investigating the create-print-job command, I don't see any reference to the InputSlot or any kind of tray selection, so it seems at some point the CUPS server is receiving the tray selection but not passing it on to the printer.

        "ipp": {
          "ipp.response_in": "1990",
          "ipp.version": "512",
          "ipp.operation_id": "0x00000005",
          "ipp.request_id": "4",
          "operation-attributes-tag": {
            "attributes-charset (charset): 'utf-8'": {
              "ipp.name": "attributes-charset",
              "ipp.charstring_value": "[ Null ]"
            },
            "attributes-natural-language (naturalLanguage): 'en-us'": {
              "ipp.name": "attributes-natural-language",
              "ipp.charstring_value": "[ Null ]"
            },
            "printer-uri (uri): 'ipp://10.10.10.50:631/ipp/print'": {
              "ipp.name": "printer-uri",
              "ipp.charstring_value": "[ Null ]"
            },
            "requesting-user-name (nameWithoutLanguage): 'jeff_dyck'": {
              "ipp.name": "requesting-user-name",
              "ipp.charstring_value": "[ Null ]"
            },
            "job-name (nameWithoutLanguage): 'Technician Printing Notes'": {
              "ipp.name": "job-name",
              "ipp.charstring_value": "[ Null ]"
            }
          },
          "job-attributes-tag": {
            "job-accounting-user-id (nameWithoutLanguage): 'user_name'": {
              "ipp.name": "job-accounting-user-id",
              "ipp.charstring_value": "[ Null ]"
            },
            "media-col (collection): {media-size{x-dimension,y-dimension},media-left-margin,media-right-margin,media-top-margin,media-bottom-margin}": {
              "ipp.name": "media-col",
              "collection {media-size{x-dimension,y-dimension},media-left-margin,media-right-margin,media-top-margin,media-bottom-margin}": {
                "ipp.memberattrname": "media-size",
                "collection {x-dimension,y-dimension}": {
                  "ipp.memberattrname": "x-dimension",
                  "ipp.integer_value": "21590",
                  "ipp.memberattrname": "y-dimension",
                  "ipp.integer_value": "27940"
                },
                "ipp.memberattrname": "media-left-margin",
                "ipp.integer_value": "200",
                "ipp.memberattrname": "media-right-margin",
                "ipp.integer_value": "200",
                "ipp.memberattrname": "media-top-margin",
                "ipp.integer_value": "400",
                "ipp.memberattrname": "media-bottom-margin",
                "ipp.integer_value": "200"
              }
            },
            "output-bin (keyword): 'right'": {
              "ipp.name": "output-bin",
              "ipp.charstring_value": "[ Null ]"
            },
            "print-color-mode (keyword): 'auto-monochrome'": {
              "ipp.name": "print-color-mode",
              "ipp.charstring_value": "[ Null ]"
            },
            "print-quality (enum): normal": {
              "ipp.name": "print-quality",
              "ipp.enum_value": "4"
            },
            "sides (keyword): 'two-sided-long-edge'": {
              "ipp.name": "sides",
              "ipp.charstring_value": "[ Null ]"
            },
            "multiple-document-handling (keyword): 'separate-documents-collated-copies'": {
              "ipp.name": "multiple-document-handling",
              "ipp.charstring_value": "[ Null ]"
            },
            "finishings (enum): none": {
              "ipp.name": "finishings",
              "ipp.enum_value": "3"
            }
          },
          "end-of-attributes-tag": ""

Any ideas of a way that this can be resolved? We just migrated to CUPS for this new school year and I'm already getting complaints about this.

CUPS-Print-PacketCapture.pcap.zip CUPS-CreateJob.json.zip CUPS-Server-Job-Log.log

csfjeff avatar Sep 02 '21 16:09 csfjeff

I've been digging into this issue further and it's more complicated - there are a set of job-attributes that don't seem to be passed from the CUPS server to the printer. Number of copies, paper tray selection, and some finishing options (like hole punch, while stapling does work).

I've done a tonne of testing and capturing logs, packets, etc and from what I can see the attributes do get logged by the server with the incoming job, but aren't present on the ipp-create-job received by the printer.

I'm including 2 .zip files. Direct.zip is for a sample print direct from my Mac to a printer, where everything works. CUPS.log is the same thing, except printing via a CUPS server. Both zips contain the CUPS job log (created with grep "Job ###" /var/log/cups/*), the results of a get-attributes query, dns-sd records where appropriate, the full packed capture on the printer (for direct look for IP 10.10.10.131, and for cups look for IP 10.7.0.117), as well as a text export of the ipp-create-printer command parsed out of the packet capture.

I'm really hoping this is something that can be resolved. I was subscribed to the user CUPS mailing list, and went to try and put this up there first, but all the links are saying the mailing list no longer exists.

Direct.zip CUPS.zip

csfjeff avatar Sep 03 '21 20:09 csfjeff

The attributes I know for sure that are missing:

  • copies
  • finishings: punch-triple-left (78)
  • memberAttrName: media-source that's part of the media-col collection.

csfjeff avatar Sep 03 '21 20:09 csfjeff

Please let me know if there's anything more I can provide. I've spent months migrating from a Windows print system to CUPS and DNS-SD to better support our Mac (2000 devices) and iPad (5000) device deployment. We're on week 1 of back to school and I'm getting hammered with complaints about this aspect of the new system. Needless to say I'm highly motivated to provide you with any info / logs / tests that would help.

csfjeff avatar Sep 10 '21 23:09 csfjeff

@csfjeff I will be looking at this in more detail today, but please understand that the Github project isn't the place for paid support with guaranteed response times...

michaelrsweet avatar Sep 13 '21 11:09 michaelrsweet

OK, so the first thing I see in your logs is that you are using PaperCut, and the server is using CUPS 2.3.3op2. I need to see the PPD file from the server since I suspect there is an error in the mapping of the media-source values. I have no idea whether this is a CUPS issue or PaperCut at this point... :/

michaelrsweet avatar Sep 13 '21 12:09 michaelrsweet

Hey Michael,

I completely understand the GitHub is probably not the best place for support - I normally used the user level mailing list, but when I try to go to that it says it’s down.

Anyway, I greatly appreciate you looking into this - I’ve attached the ppds from both the server and a client Mac computer in case that’s helpful.

csfjeff avatar Sep 13 '21 16:09 csfjeff

Small update, I removed the PaperCut backend from my test printer and ran through the process again. It did fix one issue - I can now print multiple copies - the ipp-create-job packet now contains the copies attribute. Still lacking the paper tray selection and hole punch option unfortunately. Attaching a zip with the server job log, printer packet capture and the ipp-create-job in case that's helpful. NoPaperCutBackend.zip

csfjeff avatar Sep 13 '21 19:09 csfjeff

I was just able to setup a test CUPS 2.4 running in a SNAP on Ubuntu server without PaperCut integration. Unfortunately it gives the exact same issues - multiple copies works (that seems to be PaperCut for sure), but the inputslot and hole punch options are still being dropped.

csfjeff avatar Sep 14 '21 19:09 csfjeff

@csfjeff Can you provide a copy of the PPD file for the queue?

michaelrsweet avatar Sep 17 '21 15:09 michaelrsweet

For sure - this is the ppd and ppd.O files for the printer I've been focussing my testing on, from the server. It was created when I added the printer via an lpadmin command, targetting ipp://ipaddressofprinter/ipp/print and the -m everywhere flag.

PPDs.zip

csfjeff avatar Sep 17 '21 16:09 csfjeff

Just tested this with iPadOS 15 and it actually works better than macOS... It lets me select the tray, staples and hole punch. Only feature missing still is requested copies, but at this point that's a confirmed PaperCut issue.

Comparing the CUPS logs and Printer packet captures from MacOS vs iPadOS reveals some interesting differences that may help:

On iPad OS, the CUPS logs shows the following job attributes argv[5]: argv[5]="multiple-document-handling=separate-documents-collated-copies page-ranges=1-4 print-scaling=auto-fit finishings=20,78 output-bin=Right print-quality=4 sides=two-sided-long-edge job-uuid=urn:uuid:c98db708-30b0-3109-56e5-f093f98bde3b job-originating-host-name=172.19.0.2 date-time-at-creation= date-time-at-processing= time-at-creation=1632173839 time-at-processing=1632173840 cupsPrintQuality=Normal Duplex=DuplexNoTumble InputSlot=Tray4 media=Letter OutputBin=Right PageSize=Letter PunchMedia=TriplePortrait StapleLocation=SinglePortrait"

On MacOS argv[5], the job attributes section is quite a bit larger, but of particular note is a few differences:

  • PunchMedia:
    • MacOS sends PunchMedia=TripleLeft which doesn't work.
      • The network ipp-create-job attributes contains finishings: staple-top-left
    • iPadOS sends PunchMedia=TriplePortrait which does work.
      • The network ipp-create-job attributes contains finishings: punch-triple-left,staple-top-left
  • InputSlot:
    • MacOS sends InputSlot=tray-4 which doesn't work.
      • Network ipp-create-job attributes is missing media-col memberAttrName: media source keyword value: 'tray-4'
    • iPadOS sends InputSlot=Tray4 which does work.
      • Network ipp-create-job attributes includes media-col memberAttrName: media source keyword value: 'tray-4'

So it almost seems like MacOS is using the wrong ipp flags? tray-4 instead of Tray4, and PunchMedia=TripleLeft instead of TriplePortrait.

csfjeff avatar Sep 20 '21 22:09 csfjeff

@csfjeff OK, so it looks like the macOS print dialog is expecting different choice names than is put in the PPD file, leading to the loss of the punch option. I'll go ahead and file a bug with Apple, but I suspect it will be easier for us to update the IPP Everywhere PPD generator to use the choice names that Apple's UI expects.

For the tray mapping, I think you are also running into a macOS bug - I think that one is fixed in macOS Monterey but we can also make the mapping code flexible WRT "TrayN" vs. "tray-n".

michaelrsweet avatar Sep 21 '21 12:09 michaelrsweet

@csfjeff Can you run the following command to collect the attributes for your printer and attach the result? I'd like to do some testing here with ippeveprinter to simulate the printer you have:

ipptool --ippserver xerox-b8155.conf ipp://10.10.10.50/ipp/print get-printer-attributes.test

(if the IP address has changed, update the above printer URL as needed...)

michaelrsweet avatar Sep 21 '21 13:09 michaelrsweet

Attaching the result of the command as requested xerox-b8155.conf.zip .

csfjeff avatar Sep 21 '21 15:09 csfjeff

@csfjeff OK, I've confirmed that this works correctly with macOS Mavericks (the new one in beta). For reference, what version of macOS are your clients using?

michaelrsweet avatar Sep 22 '21 13:09 michaelrsweet

We're using 10.14, 10.15 and 11 (Big Sur), but most of my in depth testing has been happening on 10.15. I'll do some more testing today with Big Sur to double check. We're a school district so do most of our big refresh in the summer, so just finishing the Big Sur rollout, which means MacOS 12 won't be deployed till summer 2022 for us.

csfjeff avatar Sep 22 '21 16:09 csfjeff

Interestingly Big Sur resolves the hole punch issue (sends attribute PunchMedia=TriplePortrait, which matches iPadOS 15, and works at the printer). Tray selection still sends InputSlot=tray-4 and doesn't work.

csfjeff avatar Sep 22 '21 16:09 csfjeff

It took me a while to figure out, but I managed to use Snapcraft to compile and run the newest checked in version of CUPS to test the recently committed changes. From there I did a fresh setup of the printer as an IPP Everywhere device and began testing.

Unfortunately this doesn't seem to have made any difference for my issues. From MacOS 10.15 through the newest version of CUPS, the printer still receives tray-4 instead of Tray4 for InputSlot, and PunchMedia is still using TripleLeft so these attributes still aren't working for me :(.

Not sure if it's a Snap thing, but I'm not seeing a PPD file get created for the printer in /snap/cups/current/etc/cups/ppds, so currently unable to inspect the PPD generated.

Is there something I need to do to take advantage of the new tweaked attribute mappings, or am I completely misunderstanding what the committed changes were supposed to accomplish?

csfjeff avatar Oct 06 '21 22:10 csfjeff

@csfjeff PPD generation is local to the client, so if it is broken on macOS, it is broken and there really isn't a way to fix it on the server side...

(any macOS fixes will depend on Apple to release the changes for macOS, since code signing and library validation make it impossible for you to install a fix on your own locally...)

michaelrsweet avatar Oct 12 '21 14:10 michaelrsweet

Just tested the beta of Monteray / MacOS 12.0.1 and tray/InputSlot selection still fails (at least with CUPS 2.3.3), won't have a chance to try the 2.4 till Friday.

I've also done more digging and I'm still 90% certain this is something to do with the CUPS server rather than on MacOS.

CUPS queue is missing the printer-input-tray attribute

If I do a 'get-attributes' command directly to the printer, I see 2 entries that have to do with the paper trays:

media-source-supported (1setOf keyword) = auto,tray-1,tray-2,tray-3,tray-4,tray-5

printer-input-tray (1setOf octetString) = type=other;mediafeed=27940;mediaxfeed=43180;maxcapacity=520;level=260;status=0;name=auto,type=sheetFeedAutoRemovableTray;mediafeed=27940;mediaxfeed=43180;maxcapacity=520;level=260;status=0;name=Tray1,type=sheetFeedAutoRemovableTray;mediafeed=21590;mediaxfeed=35560;maxcapacity=520;level=130;status=0;name=Tray2,type=sheetFeedAutoNonRemovableTray;mediafeed=21590;mediaxfeed=27940;maxcapacity=2000;level=500;status=0;name=Tray3,type=sheetFeedAutoNonRemovableTray;mediafeed=21590;mediaxfeed=27940;maxcapacity=2000;level=2000;status=0;name=Tray4,type=sheetFeedManual;mediafeed=21590;mediaxfeed=27940;maxcapacity=100;level=0;status=11;name=Tray5

If I do the same against the CUPS server queue, I only get 1 of those entries:

media-source-supported (1setOf keyword) = auto,tray-1,tray-2,tray-3,tray-4,tray-5

Tray request format: tray-# vs Tray#

  • The CUPS server builds a PPD with InputSlots listed in the form: Tray#.

    OrderDependency: 10 AnySetup *InputSlot
    DefaultInputSlot: Auto
    InputSlot Auto: "<</MediaPosition 0>>setpagedevice"
    en_US.InputSlot Auto/Automatic: ""
    InputSlot Tray1: "<</MediaPosition 20>>setpagedevice"
    en_US.InputSlot Tray1/Tray 1: ""
    InputSlot Tray2: "<</MediaPosition 21>>setpagedevice"
    en_US.InputSlot Tray2/Tray 2: ""
    InputSlot Tray3: "<</MediaPosition 22>>setpagedevice"
    en_US.InputSlot Tray3/Tray 3: ""
    InputSlot Tray4: "<</MediaPosition 23>>setpagedevice"
    en_US.InputSlot Tray4/Tray 4: ""
    InputSlot Tray5: "<</MediaPosition 24>>setpagedevice"
    en_US.InputSlot Tray5/Tray 5: ""
    CloseUI: *InputSlot ```
    
    
  • The CUPS server advertises over IPP-Everywhere media-source-supported in the form: tray-#. media-source-supported (1setOf keyword) = auto,tray-1,tray-2,tray-3,tray-4,tray-5

  • The MacOS PPD builds a PPD with InputSlots listed in the form of tray-#, which I assume it's getting from the 'media-source-supported' attribute advertised by the CUPs queue.

    OrderDependency: 10 AnySetup *InputSlot
    InputSlot auto/Auto Select: ""
    InputSlot tray-1/Tray 1: ""
    InputSlot tray-2/Tray 2: ""
    InputSlot tray-3/Tray 3: ""
    InputSlot tray-4/Tray 4: ""
    InputSlot tray-5/Tray 5: ""
    DefaultInputSlot: Unknown
    CloseUI: *InputSlot```
    
    
  • On the Xerox copier, tray selection works when the server requests the attribute in the form: tray-#

        media-col (collection): {media-size{x-dimension,y-dimension},media-source,media-left-margin,media-right-margin,media-top-margin,media-bottom-margin}
            name: media-col
            collection {media-size{x-dimension,y-dimension},media-source,media-left-margin,media-right-margin,media-top-margin,media-bottom-margin}
                memberAttrName: media-source
                keyword value: 'tray-4'```
    
    

So it seems that the following flow happens:

  1. Setup the CUPS queue by pointing to the IPP Everywhere printer, CUPS builds a PPD with the Tray# format
  2. CUPS advertises only tray-# format to the devices.
  3. An iPad or Mac connects to the queue and uses the queue attributes to build a PPD with the tray-# format.
  4. When the client prints it sends the tray request in the format tray-#, which CUPS doesn't even pass on to copier.
  5. If I manually edit the Mac PPD file to change all the tray-# instances to Tray#, then send the job...
  6. CUPS recieves the request with Tray#, then converts it to tray-# to send to the copier.

It seems like almost every aspect of the InputSlot workflow from client ppd, client job submission, server submission to the printer, printer capability advertising and printer create-job command is all using the tray-# format... EXCEPT the CUPS PPD and the input it accepts when the job is submitted.

It seems like CUPS must have some kind of 'translation' that accepts Tray4 and converts it to tray-4, but doesn't also accept tray-4 as an appropriate input.

Possible solutions:

I think either CUPS needs to recognize that it can accept and pass on the tray-# format, or perhaps it needs to properly advertise the printer-input-tray IPP attribute so that the clients build their PPDs properly.

csfjeff avatar Oct 21 '21 16:10 csfjeff

OK, solution seems to be to allow media-source, media-type, and output-bin to be either the PWG keyword value or a PPD choice name, like we already do for sizes.

[master 7f6801be2] Allow PPD choices and PWG keywords to select media (Issue #238)

[2.4.x d03e33c56] Allow PPD choices and PWG keywords to select media (Issue #238)

michaelrsweet avatar Apr 05 '24 12:04 michaelrsweet