-
Notifications
You must be signed in to change notification settings - Fork 460
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
PPDs for driverless printing: Make jobs be printed in correct order for face-up/face-down #5345
Closed
Closed
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
0312b79
PPD generator: Generate "*DefaultOutputOrder" and "*PageStackOrder" l…
tillkamppeter 4bb3c2b
Fixed copy-and-paste error in ippFindAttribute() of the previous commit.
tillkamppeter f61b0fe
The printer-output-tray IPP attribute is in octet-string format, adde…
tillkamppeter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3034,6 +3034,7 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */ | |
cups_array_t *sizes; /* Media sizes supported by printer */ | ||
cups_size_t *size; /* Current media size */ | ||
ipp_attribute_t *attr, /* xxx-supported */ | ||
*attr2, | ||
*defattr, /* xxx-default */ | ||
*quality, /* print-quality-supported */ | ||
*x_dim, *y_dim; /* Media dimensions */ | ||
|
@@ -3071,7 +3072,12 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */ | |
/* Locale data */ | ||
cups_array_t *fin_options = NULL; | ||
/* Finishing options */ | ||
|
||
char *defaultoutbin = NULL; | ||
const char *outbin, | ||
*outbin_properties; | ||
int outputorderinfofound = 0, | ||
faceupdown = 1, | ||
firsttolast = 1; | ||
|
||
/* | ||
* Range check input... | ||
|
@@ -3138,6 +3144,51 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */ | |
cupsFilePrintf(fp, "*NickName: \"%s - IPP Everywhere\"\n", model); | ||
cupsFilePrintf(fp, "*ShortNickName: \"%s - IPP Everywhere\"\n", model); | ||
|
||
/* Which is the default output bin? */ | ||
if ((attr = ippFindAttribute(response, "output-bin-default", IPP_TAG_MIMETYPE)) != NULL) | ||
defaultoutbin = strdup(ippGetString(attr, 0, NULL)); | ||
/* Find out on which position of the list of output bins the default one is, if there | ||
is no default bin, take the first of this list */ | ||
i = 0; | ||
if ((attr = ippFindAttribute(response, "output-bin-supported", IPP_TAG_MIMETYPE)) != NULL) | ||
{ | ||
count = ippGetCount(attr); | ||
for (i = 0; i < count; i ++) | ||
{ | ||
outbin = ippGetString(attr, i, NULL); | ||
if (outbin == NULL) | ||
continue; | ||
if (defaultoutbin == NULL) | ||
{ | ||
defaultoutbin = strdup(outbin); | ||
break; | ||
} | ||
else if (strcasecmp(outbin, defaultoutbin) == 0) | ||
break; | ||
} | ||
} | ||
/* Look up the corresponding entry in the "printer-output-tray" attribute */ | ||
if ((attr = ippFindAttribute(response, "printer-output-tray", IPP_TAG_MIMETYPE)) != NULL && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. printer-output-tray is of type 1setOf octetString, so you want IPP_TAG_STRING here. And you'll need to use ippGetOctetString, copy it to a C string, and then look for the properties. |
||
i < ippGetCount(attr)) | ||
{ | ||
outbin_properties = ippGetString(attr, i, NULL); | ||
if (strcasestr(outbin_properties, "pagedelivery=faceUp")) | ||
{ | ||
outputorderinfofound = 1; | ||
faceupdown = -1; | ||
} | ||
if (strcasestr(outbin_properties, "stackingorder=lastToFirst")) | ||
firsttolast = -1; | ||
} | ||
if (outputorderinfofound == 0 && defaultoutbin && strcasestr(defaultoutbin, "face-up")) | ||
faceupdown = -1; | ||
if (defaultoutbin) | ||
free (defaultoutbin); | ||
if (firsttolast * faceupdown < 0) | ||
cupsFilePuts(fp, "*DefaultOutputOrder: Reverse\n"); | ||
else | ||
cupsFilePuts(fp, "*DefaultOutputOrder: Normal\n"); | ||
|
||
if ((attr = ippFindAttribute(response, "color-supported", IPP_TAG_BOOLEAN)) != NULL && ippGetBoolean(attr, 0)) | ||
cupsFilePuts(fp, "*ColorDevice: True\n"); | ||
else | ||
|
@@ -3916,6 +3967,7 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */ | |
cupsFilePrintf(fp, "*OpenUI *OutputBin: PickOne\n" | ||
"*OrderDependency: 10 AnySetup *OutputBin\n" | ||
"*DefaultOutputBin: %s\n", ppdname); | ||
attr2 = ippFindAttribute(response, "printer-output-tray", IPP_TAG_MIMETYPE); | ||
for (i = 0; i < count; i ++) | ||
{ | ||
keyword = ippGetString(attr, i, NULL); | ||
|
@@ -3928,6 +3980,50 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */ | |
msgstr = keyword; | ||
|
||
cupsFilePrintf(fp, "*OutputBin %s/%s: \"\"\n", ppdname, msgstr); | ||
outputorderinfofound = 0; | ||
faceupdown = 1; | ||
firsttolast = 1; | ||
if (attr2 && i < ippGetCount(attr2)) | ||
{ | ||
outbin_properties = ippGetString(attr2, i, NULL); | ||
if (strcasestr(outbin_properties, "pagedelivery=faceUp")) | ||
{ | ||
outputorderinfofound = 1; | ||
faceupdown = -1; | ||
} | ||
else if (strcasestr(outbin_properties, "pagedelivery=faceDown")) | ||
{ | ||
outputorderinfofound = 1; | ||
faceupdown = 1; | ||
} | ||
if (strcasestr(outbin_properties, "stackingorder=lastToFirst")) | ||
{ | ||
outputorderinfofound = 1; | ||
firsttolast = -1; | ||
} | ||
else if (strcasestr(outbin_properties, "stackingorder=firstToLast")) | ||
{ | ||
outputorderinfofound = 1; | ||
firsttolast = 1; | ||
} | ||
} | ||
if (outputorderinfofound == 0) | ||
{ | ||
if (strcasestr(keyword, "face-up")) | ||
{ | ||
outputorderinfofound = 1; | ||
faceupdown = -1; | ||
} | ||
if (strcasestr(keyword, "face-down")) | ||
{ | ||
outputorderinfofound = 1; | ||
faceupdown = 1; | ||
} | ||
} | ||
if (outputorderinfofound) | ||
cupsFilePrintf(fp, "*PageStackOrder %s: %s\n", | ||
ppdname, | ||
(firsttolast * faceupdown < 0 ? "Reverse" : "Normal")); | ||
} | ||
cupsFilePuts(fp, "*CloseUI: *OutputBin\n"); | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This should be IPP_TAG_ZERO to allow for IPP_TAG_KEYWORD or IPP_TAG_NAME values. But not IPP_TAG_MIMETYPE (which is the mimeMediaType syntax...)