-
Notifications
You must be signed in to change notification settings - Fork 221
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
ppd-cache.c: Check for urf-supported
if image/urf
is found
#890
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks good, just add the check for the other PWG attribute and we should be good.
cups/ppd-cache.c
Outdated
is_pdf = ippContainsString(attr, "application/pdf"); | ||
is_pwg = ippContainsString(attr, "image/pwg-raster") && !is_apple; | ||
is_pwg = ippContainsString(attr, "image/pwg-raster") && !is_apple && | ||
(ippFindAttribute(supported, "pwg-raster-document-resolution-supported", IPP_TAG_KEYWORD) != NULL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should also look for "pwg-raster-document-type-supported"...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@michaelrsweet I thought about the attribute as well (since it is required in the standard too), but according this code further down:
4156 if ((attr = ippFindAttribute(supported, "urf-supported", IPP_TAG_KEYWORD)) == NULL)
4157 if ((attr = ippFindAttribute(supported, "pwg-raster-document-type-supported", IPP_TAG_KEYWORD)) == NULL)
4158 if ((attr = ippFindAttribute(supported, "print-color-mode-supported", IPP_TAG_KEYWORD)) == NULL)
4159 attr = ippFindAttribute(supported, "output-mode-supported", IPP_TAG_KEYWORD);
we fallback to print-color-mode-supported and output-mode-supported if the attribute is missing. We don't use the attribute anywhere else (AFAIK) in the function, so requiring the attribute would break the PPD generation for such devices.
I aimed PR to match with the existing code, so that's why I didn't check the attribute.
I can add the check, but then I would make further changes. So I see the following possibilities:
- add check for the mentioned attribute, and rewrote the code snippet I mentioned to don't do fallback if we have PWG raster,
- add extensive check in is_pwg line, incorporating fallbacks there as well,
- has the PR as it is.
IMO option 3 provides wider support for possibly broken devices, so I would go with that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zdohnal Technically the lack of urf-supported or pwg-raster-document-type-supported means that we have a very low chance of anything working (i.e. if the printer supports PDF but isn't able to print the PDF file we send it, what kind of raster will it accept if it doesn't tell us?)
urf-supported combines the three pwg-raster-document-xxx attributes - resolution (RSn-n-n), type (Wnn, SRGBnn, ADOBERGBnn, etc.), and sheet back (DMn) - that are needed for properly generating raster data. So the Apple Raster (URF) check needs to look at one attribute while the PWG Raster check needs to look at more (pwg-raster-document-{resolution-supported,sheet-back,type-supported} are used for resolution, duplex printing, and color space/bit depth).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@michaelrsweet ok, makes sense this way. I'll add check for pwg-raster-document-type-supported.
@tillkamppeter do you want to add it to libppd as well (through direct push to the repo)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zdohnal OK, will do for libppd.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in OpenPrinting/libppd@c7a62e8c4c37. Thanks for the hint @michaelrsweet and @zdohnal !
3173be1
to
876ac1a
Compare
Some devices have `image/urf` in `document-format-supported`, but is missing `urf-supported` if AirPrint support is turned off, which breaks PPD generation. Check for attribute `urf-supported` when we are about to decide whether the printer uses AirPrint, so in case the device supports another driverless standard, we can use it for PPD generation. Fixes [Fedora issue](https://bugzilla.redhat.com/show_bug.cgi?id=2263053)
If the device reports image/pwg-raster and we are about to use it, check for pwg-raster-document-resolution-supported too.
876ac1a
to
04a0c29
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
…orted" If the printer supports printing input in PWG Raster format, it should not only tell that it accepts PWG Raster in "document-format-supported" but also provide the attributes with the specifications of what raster formats are exactly supported, and here not only resolutions via "pwg-raster-document-resolution-supported" but also color spaces and depths via "pwg-raster-document-type-supported". If one of these two attributes is missing, we disconsider PWG Raster. See also the discussion in OpenPrinting/cups#890 Thanks Zdenek Dohnal and Michael Sweet.
Some devices have
image/urf
indocument-format-supported
, but is missingurf-supported
if AirPrint support is turned off, which breaks PPD generation.Check for attribute
urf-supported
when we are about to decide whether the printer uses AirPrint, so in case the device supports another driverless standard, we can use it for PPD generation.Fixes Fedora issue