/*
* "$Id: printers.c 7968 2008-09-19 23:03:01Z mike $"
*
- * Printer routines for the Common UNIX Printing System (CUPS).
+ * Printer routines for the CUPS scheduler.
*
* Copyright 2007-2010 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
IPP_GET_PRINTER_ATTRIBUTES,
IPP_HOLD_JOB,
IPP_RELEASE_JOB,
+ IPP_RESTART_JOB,
IPP_PAUSE_PRINTER,
IPP_RESUME_PRINTER,
IPP_PURGE_JOBS,
IPP_DISABLE_PRINTER,
IPP_HOLD_NEW_JOBS,
IPP_RELEASE_HELD_NEW_JOBS,
+ IPP_CANCEL_JOBS,
+ IPP_CANCEL_MY_JOBS,
+ IPP_CLOSE_JOB,
CUPS_GET_DEFAULT,
CUPS_GET_PRINTERS,
CUPS_ADD_PRINTER,
static const char * const media_col_supported[] =
{ /* media-col-supported values */
"media-bottom-margin",
- "media-color",
"media-left-margin",
"media-right-margin",
"media-size",
+ "media-source",
"media-top-margin",
"media-type"
};
{ /* job-creation-attributes-supported */
"copies",
"finishings",
+ "ipp-attribute-fidelity",
"job-hold-until",
"job-name",
"job-priority",
"printer-info",
"printer-location"
};
+ static const char * const which_jobs[] =
+ { /* which-jobs-supported values */
+ "completed",
+ "not-completed",
+ "aborted",
+ "all",
+ "canceled",
+ "pending",
+ "pending-held",
+ "processing",
+ "processing-stopped"
+ };
if (CommonData)
"ipp-versions-supported", sizeof(versions) / sizeof(versions[0]),
NULL, versions);
+ /* ippget-event-life */
+ ippAddInteger(CommonData, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
+ "ippget-event-life", 15);
+
/* job-creation-attributes-supported */
ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY,
"job-creation-attributes-supported",
"job-hold-until-supported", sizeof(holds) / sizeof(holds[0]),
NULL, holds);
+ /* job-ids-supported */
+ ippAddBoolean(CommonData, IPP_TAG_PRINTER, "job-ids-supported", 1);
+
/* job-priority-supported */
ippAddInteger(CommonData, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
"job-priority-supported", 100);
/* server-is-sharing-printers */
ippAddBoolean(CommonData, IPP_TAG_PRINTER, "server-is-sharing-printers",
BrowseLocalProtocols != 0 && Browsing);
+
+ /* which-jobs-supported */
+ ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY,
+ "which-jobs-supported",
+ sizeof(which_jobs) / sizeof(which_jobs[0]), NULL, which_jobs);
}
int /* O - 1 if something changed, 0 otherwise */
cupsdSetPrinterReasons(
- cupsd_printer_t *p, /* I - Printer */
- const char *s) /* I - Reasons strings */
+ cupsd_printer_t *p, /* I - Printer */
+ const char *s) /* I - Reasons strings */
{
int i, /* Looping var */
changed = 0; /* Did something change? */
cupsArrayAdd(CommonDefaults, _cupsStrAlloc("job-hold-until-default"));
cupsArrayAdd(CommonDefaults, _cupsStrAlloc("job-priority-default"));
cupsArrayAdd(CommonDefaults, _cupsStrAlloc("job-sheets-default"));
- cupsArrayAdd(CommonDefaults, _cupsStrAlloc("media-default"));
cupsArrayAdd(CommonDefaults, _cupsStrAlloc("media-col-default"));
cupsArrayAdd(CommonDefaults, _cupsStrAlloc("number-up-default"));
cupsArrayAdd(CommonDefaults,
_cupsStrAlloc("orientation-requested-default"));
- cupsArrayAdd(CommonDefaults, _cupsStrAlloc("sides-default"));
}
/*
* Check to see if the cache is up-to-date...
*/
- snprintf(cache_name, sizeof(cache_name), "%s/%s.ipp2", CacheDir, p->name);
+ snprintf(cache_name, sizeof(cache_name), "%s/%s.ipp3", CacheDir, p->name);
if (stat(cache_name, &cache_info))
cache_info.st_mtime = 0;
- snprintf(pwg_name, sizeof(pwg_name), "%s/%s.pwg", CacheDir, p->name);
+ snprintf(pwg_name, sizeof(pwg_name), "%s/%s.pwg2", CacheDir, p->name);
if (stat(pwg_name, &pwg_info))
pwg_info.st_mtime = 0;
if (pwgsize)
{
+ ipp_t *col; /* Collection value */
+
input_slot = ppdFindMarkedChoice(ppd, "InputSlot");
media_type = ppdFindMarkedChoice(ppd, "MediaType");
+ col = new_media_col(pwgsize,
+ input_slot ?
+ _pwgGetSource(p->pwg,
+ input_slot->choice) :
+ NULL,
+ media_type ?
+ _pwgGetType(p->pwg,
+ media_type->choice) :
+ NULL);
ippAddCollection(p->ppd_attrs, IPP_TAG_PRINTER, "media-col-default",
- new_media_col(pwgsize,
- input_slot ?
- _pwgGetSource(p->pwg,
- input_slot->choice) :
- NULL,
- media_type ?
- _pwgGetType(p->pwg,
- media_type->choice) :
- NULL));
+ col);
+ ippDelete(col);
}
/*
* Output bin...
*/
- if ((output_bin = ppdFindOption(ppd, "OutputBin")) != NULL)
+ if (p->pwg && p->pwg->num_bins > 0)
{
attr = ippAddStrings(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
- "output-bin-supported", output_bin->num_choices,
+ "output-bin-supported", p->pwg->num_bins,
NULL, NULL);
if (attr != NULL)
{
for (i = 0, val = attr->values;
- i < output_bin->num_choices;
+ i < p->pwg->num_bins;
i ++, val ++)
- val->string.text = _cupsStrAlloc(output_bin->choices[i].choice);
+ val->string.text = _cupsStrAlloc(p->pwg->bins[i].pwg);
}
+ if ((output_bin = ppdFindOption(ppd, "OutputBin")) != NULL)
+ {
+ for (i = 0; i < p->pwg->num_bins; i ++)
+ if (!strcmp(p->pwg->bins[i].ppd, output_bin->defchoice))
+ break;
+
+ if (i >= p->pwg->num_bins)
+ i = 0;
+
+ ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
+ "output-bin-default", NULL, p->pwg->bins[i].pwg);
+ }
+ else
+ ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
+ "output-bin-default", NULL, p->pwg->bins[0].pwg);
+ }
+ else if (((ppd_attr = ppdFindAttr(ppd, "DefaultOutputOrder",
+ NULL)) != NULL &&
+ !strcasecmp(ppd_attr->value, "Reverse")) ||
+ (!ppd_attr && ppd->manufacturer && /* EPSON "compatibility heuristic" */
+ !strcasecmp(ppd->manufacturer, "epson")))
+ {
+ /*
+ * Report that this printer has a single output bin that leaves pages face
+ * up.
+ */
+
+ ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
+ "output-bin-supported", NULL, "face-up");
+ ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
+ "output-bin-default", NULL, "face-up");
+ }
+ else
+ {
+ ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
+ "output-bin-supported", NULL, "face-down");
ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
- "output-bin-default", NULL, output_bin->defchoice);
+ "output-bin-default", NULL, "face-down");
}
/*
i < resolution->num_choices;
i ++, choice ++)
{
- xdpi = (int)strtol(choice->choice, (char **)&resptr, 10);
- if (resptr > choice->choice && xdpi > 0)
- {
- if (*resptr == 'x')
- ydpi = (int)strtol(resptr + 1, (char **)&resptr, 10);
- else
- ydpi = xdpi;
- }
+ xdpi = ydpi = (int)strtol(choice->choice, (char **)&resptr, 10);
+ if (resptr > choice->choice && xdpi > 0 && *resptr == 'x')
+ ydpi = (int)strtol(resptr + 1, (char **)&resptr, 10);
if (xdpi <= 0 || ydpi <= 0)
{
* Just the DefaultResolution to report...
*/
- xdpi = (int)strtol(ppd_attr->value, (char **)&resptr, 10);
+ xdpi = ydpi = (int)strtol(ppd_attr->value, (char **)&resptr, 10);
if (resptr > ppd_attr->value && xdpi > 0)
{
if (*resptr == 'x')
ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
"sides-default", NULL, "one-sided");
}
+ else
+ {
+ ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
+ "sides-supported", NULL, "one-sided");
+ ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
+ "sides-default", NULL, "one-sided");
+ }
if (ppdFindOption(ppd, "Collate") != NULL)
p->type |= CUPS_PRINTER_COLLATE;
"x-dimension", size->width);
ippAddInteger(media_size, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
"y-dimension", size->length);
-
ippAddCollection(media_col, IPP_TAG_PRINTER, "media-size", media_size);
+ ippDelete(media_size);
+
ippAddInteger(media_col, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
"media-bottom-margin", size->bottom);
ippAddInteger(media_col, IPP_TAG_PRINTER, IPP_TAG_INTEGER,