diff options
author | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2013-01-10 17:01:44 +0000 |
---|---|---|
committer | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2013-01-10 17:01:44 +0000 |
commit | 0fa6c7fa54164ee70ee9ccfa936b889a637d5ecd (patch) | |
tree | d84095ec3813ddd6d09ac71499ab00df3f9450f2 /backend | |
parent | c1420c8744235de1249c34b956b7c11ccafd659d (diff) |
Merge changes from CUPS 1.7svn-r10791.
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@4120 a1ca3aef-8c08-0410-bb20-df032aa958be
Diffstat (limited to 'backend')
-rw-r--r-- | backend/ipp.c | 40 | ||||
-rw-r--r-- | backend/usb-darwin.c | 13 | ||||
-rw-r--r-- | backend/usb-libusb.c | 19 |
3 files changed, 51 insertions, 21 deletions
diff --git a/backend/ipp.c b/backend/ipp.c index d3dd8de9c..19ce3f2d3 100644 --- a/backend/ipp.c +++ b/backend/ipp.c @@ -3,7 +3,7 @@ * * IPP backend for CUPS. * - * Copyright 2007-2012 by Apple Inc. + * Copyright 2007-2013 by Apple Inc. * Copyright 1997-2007 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the @@ -1066,10 +1066,10 @@ main(int argc, /* I - Number of command-line args */ } else if (!compression) { - if (ippContainsString(compression_sup, "deflate")) - compression = "deflate"; - else if (ippContainsString(compression_sup, "gzip")) + if (ippContainsString(compression_sup, "gzip")) compression = "gzip"; + else if (ippContainsString(compression_sup, "deflate")) + compression = "deflate"; if (compression) fprintf(stderr, "DEBUG: Automatically using \"%s\" compression.\n", @@ -1354,8 +1354,9 @@ main(int argc, /* I - Number of command-line args */ /* * If the printer only claims to support IPP/1.0, or if the user specifically * included version=1.0 in the URI, then do not try to use Create-Job or - * Send-Document. This is another dreaded compatibility hack, but unfortunately - * there are enough broken printers out there that we need this for now... + * Send-Document. This is another dreaded compatibility hack, but + * unfortunately there are enough broken printers out there that we need + * this for now... */ if (version == 10) @@ -1812,6 +1813,27 @@ main(int argc, /* I - Number of command-line args */ goto cleanup; } + else if (ipp_status == IPP_STATUS_ERROR_CUPS_UPGRADE_REQUIRED) + { + /* + * Server is configured incorrectly; the policy for Create-Job and + * Send-Document has to be the same (auth or no auth, encryption or + * no encryption). Force the queue to stop since printing will never + * work. + */ + + fputs("DEBUG: The server or printer is configured incorrectly.\n", + stderr); + fputs("DEBUG: The policy for Create-Job and Send-Document must have the " + "same authentication and encryption requirements.\n", stderr); + + ipp_status = IPP_STATUS_ERROR_INTERNAL; + + if (job_id > 0) + cancel_job(http, uri, job_id, resource, argv[2], version); + + goto cleanup; + } else if (ipp_status == IPP_NOT_FOUND) { /* @@ -1851,6 +1873,12 @@ main(int argc, /* I - Number of command-line args */ backendCheckSideChannel(snmp_fd, http->hostaddr); /* + * Check printer state... + */ + + check_printer_state(http, uri, resource, argv[2], version); + + /* * Build an IPP_GET_JOB_ATTRIBUTES request... */ diff --git a/backend/usb-darwin.c b/backend/usb-darwin.c index 98cf9804a..33f1fb648 100644 --- a/backend/usb-darwin.c +++ b/backend/usb-darwin.c @@ -151,9 +151,9 @@ struct crashreporter_annotations_t { uint64_t dialog_mode; // unsigned int }; -CRASH_REPORTER_CLIENT_HIDDEN -struct crashreporter_annotations_t gCRAnnotations - __attribute__((section("__DATA," CRASHREPORTER_ANNOTATIONS_SECTION))) +CRASH_REPORTER_CLIENT_HIDDEN +struct crashreporter_annotations_t gCRAnnotations + __attribute__((section("__DATA," CRASHREPORTER_ANNOTATIONS_SECTION))) = { CRASHREPORTER_ANNOTATIONS_VERSION, 0, 0, 0, 0, 0, 0 }; /* @@ -280,6 +280,7 @@ typedef struct globals_s */ globals_t g = { 0 }; /* Globals */ +int Iterating = 0; /* Are we iterating the bus? */ /* @@ -1106,6 +1107,8 @@ sidechannel_thread(void *reference) static void iterate_printers(iterator_callback_t callBack, void *userdata) { + Iterating = 1; + mach_port_t masterPort = 0x0; kern_return_t kr = IOMasterPort (bootstrap_port, &masterPort); @@ -1143,6 +1146,8 @@ static void iterate_printers(iterator_callback_t callBack, } mach_port_deallocate(mach_task_self(), masterPort); } + + Iterating = 0; } @@ -1431,7 +1436,7 @@ static kern_return_t load_classdriver(CFStringRef driverPath, _cups_fc_result_t result = _cupsFileCheck(bundlestr, _CUPS_FILE_CHECK_DIRECTORY, 1, - _cupsFileCheckFilter, NULL); + Iterating ? NULL : _cupsFileCheckFilter, NULL); if (result && driverPath) return (load_classdriver(NULL, interface, printerDriver)); diff --git a/backend/usb-libusb.c b/backend/usb-libusb.c index da7e0cce9..0d472ed25 100644 --- a/backend/usb-libusb.c +++ b/backend/usb-libusb.c @@ -672,10 +672,10 @@ print_device(const char *uri, /* I - Device URI */ * If it didn't exit abort the pending read and wait an additional * second... */ - + if (!g.read_thread_done) { - fputs("DEBUG: Read thread still active, aborting the pending read...\n", + fputs("DEBUG: Read thread still active, aborting the pending read...\n", stderr); g.wait_eof = 0; @@ -683,7 +683,7 @@ print_device(const char *uri, /* I - Device URI */ gettimeofday(&tv, NULL); cond_timeout.tv_sec = tv.tv_sec + 1; cond_timeout.tv_nsec = tv.tv_usec * 1000; - + while (!g.read_thread_done) { if (pthread_cond_timedwait(&g.read_thread_cond, &g.read_thread_mutex, @@ -696,9 +696,6 @@ print_device(const char *uri, /* I - Device URI */ pthread_mutex_unlock(&g.read_thread_mutex); } - if (print_fd) - close(print_fd); - /* * Close the connection and input file and general clean up... */ @@ -758,7 +755,7 @@ close_device(usb_printer_t *printer) /* I - Printer */ */ if (printer->origconf > 0 && printer->origconf != number2) { - fprintf(stderr, "DEBUG: Restoring USB device configuration: %d -> %d\n", + fprintf(stderr, "DEBUG: Restoring USB device configuration: %d -> %d\n", number2, printer->origconf); if ((errcode = libusb_set_configuration(printer->handle, printer->origconf)) < 0) @@ -919,7 +916,7 @@ find_device(usb_cb_t cb, /* I - Callback function */ */ if (((altptr->bInterfaceClass != LIBUSB_CLASS_PRINTER || - altptr->bInterfaceSubClass != 1) && + altptr->bInterfaceSubClass != 1) && ((printer.quirks & USBLP_QUIRK_BAD_CLASS) == 0)) || (altptr->bInterfaceProtocol != 1 && /* Unidirectional */ altptr->bInterfaceProtocol != 2) || /* Bidirectional */ @@ -997,7 +994,7 @@ find_device(usb_cb_t cb, /* I - Callback function */ bEndpointAddress; } else - fprintf(stderr, "DEBUG: Uni-directional USB communication " + fprintf(stderr, "DEBUG: Uni-directional USB communication " "only!\n"); printer.write_endp = confptr->interface[printer.iface]. altsetting[printer.altset]. @@ -1376,7 +1373,7 @@ open_device(usb_printer_t *printer, /* I - Printer */ printer->origconf = current; - if ((errcode = + if ((errcode = libusb_get_config_descriptor (printer->device, printer->conf, &confptr)) < 0) { @@ -1388,7 +1385,7 @@ open_device(usb_printer_t *printer, /* I - Printer */ if (number1 != current) { - fprintf(stderr, "DEBUG: Switching USB device configuration: %d -> %d\n", + fprintf(stderr, "DEBUG: Switching USB device configuration: %d -> %d\n", current, number1); if ((errcode = libusb_set_configuration(printer->handle, number1)) < 0) { |