]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Merge changes from CUPS 1.5rc1-r9834.
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Wed, 15 Jun 2011 00:48:47 +0000 (00:48 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Wed, 15 Jun 2011 00:48:47 +0000 (00:48 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@3322 a1ca3aef-8c08-0410-bb20-df032aa958be

scheduler/printers.c

index f6df86a156cd18600b39dd5053be8eba7a7a7d7f..aeec21327badb4dc1be4cf1220ed2bbfb535aa55 100644 (file)
@@ -76,6 +76,9 @@
 #ifdef HAVE_SYS_VFS_H
 #  include <sys/vfs.h>
 #endif /* HAVE_SYS_VFS_H */
+#ifdef __APPLE__
+#  include <asl.h>
+#endif /* __APPLE__ */
 
 
 /*
@@ -90,6 +93,7 @@ static int    compare_printers(void *first, void *second, void *data);
 static void    delete_printer_filters(cupsd_printer_t *p);
 static void    dirty_printer(cupsd_printer_t *p);
 static void    load_ppd(cupsd_printer_t *p);
+static void    log_ipp_conformance(cupsd_printer_t *p, const char *reason);
 static ipp_t   *new_media_col(_pwg_size_t *size, const char *source,
                               const char *type);
 #ifdef __sgi
@@ -2757,6 +2761,10 @@ cupsdSetPrinterReasons(
 
       if (i >= p->num_reasons)
       {
+        if (!strncmp(reason, "cups-ipp-missing-", 17) ||
+           !strncmp(reason, "cups-ipp-wrong-", 15))
+         log_ipp_conformance(p, reason);
+
         if (i >= (int)(sizeof(p->reasons) / sizeof(p->reasons[0])))
        {
          cupsdLogMessage(CUPSD_LOG_ALERT,
@@ -5074,6 +5082,81 @@ load_ppd(cupsd_printer_t *p)             /* I - Printer */
 }
 
 
+/*
+ * 'log_ipp_conformance()' - Log an IPP conformance issue with a printer.
+ */
+
+static void
+log_ipp_conformance(
+    cupsd_printer_t *p,                        /* I - Printer */
+    const char      *reason)           /* I - Printer state reason */
+{
+  const char   *message;               /* Message to log */
+#ifdef __APPLE__
+  aslmsg       aslm;                   /* Apple System Log message */
+#endif /* __APPLE__ */
+
+
+ /*
+  * Strip the leading "cups-ipp-" from the reason and create a log message for
+  * it...
+  */
+
+  reason += 9;
+  if (!strcmp(reason, "missing-cancel-job"))
+    message = "Printer does not support REQUIRED Cancel-Job operation.";
+  else if (!strcmp(reason, "missing-get-job-attributes"))
+    message = "Printer does not support REQUIRED Get-Job-Attributes operation.";
+  else if (!strcmp(reason, "missing-print-job"))
+    message = "Printer does not support REQUIRED Print-Job operation.";
+  else if (!strcmp(reason, "missing-validate-job"))
+    message = "Printer does not support REQUIRED Validate-Job operation.";
+  else if (!strcmp(reason, "missing-get-printer-attributes"))
+    message = "Printer does not support REQUIRED Get-Printer-Attributes operation.";
+  else if (!strcmp(reason, "missing-job-history"))
+    message = "Printer does not provide REQUIRED job history.";
+  else if (!strcmp(reason, "missing-job-id"))
+    message = "Printer does not provide REQUIRED job-id attribute.";
+  else if (!strcmp(reason, "missing-job-state"))
+    message = "Printer does not provide REQUIRED job-state attribute.";
+  else if (!strcmp(reason, "missing-operations-supported"))
+    message = "Printer does not provide REQUIRED operations-supported "
+              "attribute.";
+  else if (!strcmp(reason, "missing-printer-is-accepting-jobs"))
+    message = "Printer does not provide REQUIRED printer-is-accepting-jobs "
+              "attribute.";
+  else if (!strcmp(reason, "missing-printer-state-reasons"))
+    message = "Printer does not provide REQUIRED printer-state-reasons "
+              "attribute.";
+  else if (!strcmp(reason, "wrong-http-version"))
+    message = "Printer does not use REQUIRED HTTP/1.1 transport.";
+  else
+    message = "Unknown IPP conformance failure.";
+
+  cupsdLogMessage(CUPSD_LOG_WARN, "%s: %s", p->name, message);
+
+#ifdef __APPLE__
+ /*
+  * Report the failure information to Apple if the user opts into providing
+  * feedback to Apple...
+  */
+
+  aslm = asl_new(ASL_TYPE_MSG);
+  if (aslm)
+  {
+    asl_set(aslm, "com.apple.message.domain", "com.apple.printing.ipp.conformance");
+    asl_set(aslm, "com.apple.message.domain_scope", "com.apple.printing.ipp.conformance");
+    asl_set(aslm, "com.apple.message.signature", reason);
+    asl_set(aslm, "com.apple.message.signature2",
+           p->make_model ? p->make_model : "Unknown");
+    asl_log(NULL, aslm, ASL_LEVEL_NOTICE, "%s: %s",
+            p->make_model ? p->make_model : "Unknown", message);
+    asl_free(aslm);
+  }
+#endif /* __APPLE__ */
+}
+
+
 /*
  * 'new_media_col()' - Create a media-col collection value.
  */