From: msweet Date: Fri, 27 Jun 2008 20:26:20 +0000 (+0000) Subject: Merge changes from CUPS 1.4svn-r7696. X-Git-Tag: release-1.6.3~160 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=75bd9771f6e44fdd887ee90faac46f403aefc0fc;p=thirdparty%2Fcups.git Merge changes from CUPS 1.4svn-r7696. git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@818 a1ca3aef-8c08-0410-bb20-df032aa958be --- diff --git a/CHANGES-1.3.txt b/CHANGES-1.3.txt index aa85f31d24..ba27857121 100644 --- a/CHANGES-1.3.txt +++ b/CHANGES-1.3.txt @@ -4,6 +4,8 @@ CHANGES-1.3.txt CHANGES IN CUPS V1.3.8 - Documentation updates (STR #2785, STR #2861, STR #2862) + - The scheduler would crash if you started a printer that + pointed to a backend that did not exist (STR #2865) - The ppdLocalize functions incorrectly mapped all generic locales to country-specific locales. - The cups-driverd program did not support Simplified Chinese diff --git a/CHANGES.txt b/CHANGES.txt index 5ada0f3beb..410b57e124 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,8 +1,11 @@ -CHANGES.txt - 2008-06-17 +CHANGES.txt - 2008-06-25 ------------------------ CHANGES IN CUPS V1.4b1 + - The USB backend now uses libusb when available (STR #1575) + - Added ppdLocalizeAttr function to get the localized version + of an attribute. - MIME types now support a priority() attribute (STR #2719) - The standard MIME types are now installed in DataDir/mime (STR #2719) diff --git a/Makedefs.in b/Makedefs.in index 27fc8351e7..0e5068553f 100644 --- a/Makedefs.in +++ b/Makedefs.in @@ -1,5 +1,5 @@ # -# "$Id: Makedefs.in 7016 2007-10-10 22:07:51Z mike $" +# "$Id: Makedefs.in 7687 2008-06-24 01:28:36Z mike $" # # Common makefile definitions for the Common UNIX Printing System (CUPS). # @@ -91,6 +91,7 @@ LIBPNG = @LIBPNG@ LIBSLP = @LIBSLP@ LIBGSSAPI = @LIBGSSAPI@ LIBTIFF = @LIBTIFF@ +LIBUSB = @LIBUSB@ LIBZ = @LIBZ@ # @@ -279,5 +280,5 @@ DBUSDIR = @DBUSDIR@ # -# End of "$Id: Makedefs.in 7016 2007-10-10 22:07:51Z mike $" +# End of "$Id: Makedefs.in 7687 2008-06-24 01:28:36Z mike $" # diff --git a/Makefile b/Makefile index 1c83cc5135..67fd9d84f3 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile 6897 2007-08-30 06:11:59Z mike $" +# "$Id: Makefile 7613 2008-05-22 23:27:52Z mike $" # # Top-level Makefile for the Common UNIX Printing System (CUPS). # @@ -325,5 +325,5 @@ dist: all # -# End of "$Id: Makefile 6897 2007-08-30 06:11:59Z mike $". +# End of "$Id: Makefile 7613 2008-05-22 23:27:52Z mike $". # diff --git a/backend/Makefile b/backend/Makefile index a5e1db3a7f..a2d4b1ed02 100644 --- a/backend/Makefile +++ b/backend/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile 6778 2007-08-08 19:27:51Z mike $" +# "$Id: Makefile 7687 2008-06-24 01:28:36Z mike $" # # Backend makefile for the Common UNIX Printing System (CUPS). # @@ -251,8 +251,8 @@ socket: socket.o ../cups/$(LIBCUPS) libbackend.a usb: usb.o ../cups/$(LIBCUPS) libbackend.a echo Linking $@... - $(CC) $(LDFLAGS) -o usb usb.o libbackend.a $(BACKLIBS) $(LIBS) -usb.o: usb.c usb-darwin.c usb-unix.c + $(CC) $(LDFLAGS) -o usb usb.o libbackend.a $(LIBUSB) $(BACKLIBS) $(LIBS) +usb.o: usb.c usb-darwin.c usb-libusb.c usb-unix.c # @@ -263,5 +263,5 @@ include Dependencies # -# End of "$Id: Makefile 6778 2007-08-08 19:27:51Z mike $". +# End of "$Id: Makefile 7687 2008-06-24 01:28:36Z mike $". # diff --git a/backend/backend-private.h b/backend/backend-private.h index 84feb6b6a6..b7912d59da 100644 --- a/backend/backend-private.h +++ b/backend/backend-private.h @@ -1,5 +1,5 @@ /* - * "$Id: backend-private.h 6649 2007-07-11 21:46:42Z mike $" + * "$Id: backend-private.h 7586 2008-05-16 23:39:39Z mike $" * * Backend support definitions for the Common UNIX Printing System (CUPS). * @@ -272,5 +272,5 @@ extern int backendSNMPSupplies(int snmp_fd, http_addr_t *addr, /* - * End of "$Id: backend-private.h 6649 2007-07-11 21:46:42Z mike $". + * End of "$Id: backend-private.h 7586 2008-05-16 23:39:39Z mike $". */ diff --git a/backend/ieee1284.c b/backend/ieee1284.c index 8b8579d806..ebbd5d18bb 100644 --- a/backend/ieee1284.c +++ b/backend/ieee1284.c @@ -1,9 +1,9 @@ /* - * "$Id: ieee1284.c 7019 2007-10-10 22:48:52Z mike $" + * "$Id: ieee1284.c 7687 2008-06-24 01:28:36Z mike $" * * IEEE-1284 support functions for the Common UNIX Printing System (CUPS). * - * Copyright 2007 by Apple Inc. + * Copyright 2007-2008 by Apple Inc. * Copyright 1997-2007 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the @@ -442,5 +442,5 @@ backendGetMakeModel( /* - * End of "$Id: ieee1284.c 7019 2007-10-10 22:48:52Z mike $". + * End of "$Id: ieee1284.c 7687 2008-06-24 01:28:36Z mike $". */ diff --git a/backend/ipp.c b/backend/ipp.c index 83c0dc669e..9944220a27 100644 --- a/backend/ipp.c +++ b/backend/ipp.c @@ -1,5 +1,5 @@ /* - * "$Id: ipp.c 7018 2007-10-10 22:14:03Z mike $" + * "$Id: ipp.c 7583 2008-05-16 17:47:16Z mike $" * * IPP backend for the Common UNIX Printing System (CUPS). * @@ -1818,5 +1818,5 @@ sigterm_handler(int sig) /* I - Signal */ /* - * End of "$Id: ipp.c 7018 2007-10-10 22:14:03Z mike $". + * End of "$Id: ipp.c 7583 2008-05-16 17:47:16Z mike $". */ diff --git a/backend/lpd.c b/backend/lpd.c index e8233ab289..76123b32dd 100644 --- a/backend/lpd.c +++ b/backend/lpd.c @@ -1,5 +1,5 @@ /* - * "$Id: lpd.c 6910 2007-09-04 20:34:29Z mike $" + * "$Id: lpd.c 7583 2008-05-16 17:47:16Z mike $" * * Line Printer Daemon backend for the Common UNIX Printing System (CUPS). * @@ -1378,5 +1378,5 @@ sigterm_handler(int sig) /* I - Signal */ /* - * End of "$Id: lpd.c 6910 2007-09-04 20:34:29Z mike $". + * End of "$Id: lpd.c 7583 2008-05-16 17:47:16Z mike $". */ diff --git a/backend/pap.c b/backend/pap.c index f89047e1d6..f0f194e730 100644 --- a/backend/pap.c +++ b/backend/pap.c @@ -1,5 +1,5 @@ /* -* "$Id: pap.c 7010 2007-10-10 21:08:51Z mike $" +* "$Id: pap.c 7318 2008-02-15 23:24:41Z mike $" * * Copyright 2004-2008 Apple Inc. All rights reserved. * diff --git a/backend/parallel.c b/backend/parallel.c index 84addcb051..bba472095a 100644 --- a/backend/parallel.c +++ b/backend/parallel.c @@ -1,5 +1,5 @@ /* - * "$Id: parallel.c 7019 2007-10-10 22:48:52Z mike $" + * "$Id: parallel.c 7343 2008-02-25 19:02:09Z mike $" * * Parallel port backend for the Common UNIX Printing System (CUPS). * @@ -678,5 +678,5 @@ side_cb(int print_fd, /* I - Print file */ /* - * End of "$Id: parallel.c 7019 2007-10-10 22:48:52Z mike $". + * End of "$Id: parallel.c 7343 2008-02-25 19:02:09Z mike $". */ diff --git a/backend/runloop.c b/backend/runloop.c index fbb14fdab2..03aa956fee 100644 --- a/backend/runloop.c +++ b/backend/runloop.c @@ -1,5 +1,5 @@ /* - * "$Id: runloop.c 6834 2007-08-22 18:29:25Z mike $" + * "$Id: runloop.c 7647 2008-06-16 17:39:40Z mike $" * * Common run loop APIs for the Common UNIX Printing System (CUPS). * @@ -404,5 +404,5 @@ backendRunLoop( /* - * End of "$Id: runloop.c 6834 2007-08-22 18:29:25Z mike $". + * End of "$Id: runloop.c 7647 2008-06-16 17:39:40Z mike $". */ diff --git a/backend/scsi.c b/backend/scsi.c index 5483327723..7040d4bda5 100644 --- a/backend/scsi.c +++ b/backend/scsi.c @@ -1,5 +1,5 @@ /* - * "$Id: scsi.c 6834 2007-08-22 18:29:25Z mike $" + * "$Id: scsi.c 7193 2008-01-07 23:01:40Z mike $" * * SCSI printer backend for the Common UNIX Printing System (CUPS). * @@ -227,5 +227,5 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ /* - * End of "$Id: scsi.c 6834 2007-08-22 18:29:25Z mike $". + * End of "$Id: scsi.c 7193 2008-01-07 23:01:40Z mike $". */ diff --git a/backend/serial.c b/backend/serial.c index 3ac7ff659f..25dfc8c4fe 100644 --- a/backend/serial.c +++ b/backend/serial.c @@ -1,5 +1,5 @@ /* - * "$Id: serial.c 6910 2007-09-04 20:34:29Z mike $" + * "$Id: serial.c 7647 2008-06-16 17:39:40Z mike $" * * Serial port backend for the Common UNIX Printing System (CUPS). * @@ -1297,5 +1297,5 @@ side_cb(int print_fd, /* I - Print file */ /* - * End of "$Id: serial.c 6910 2007-09-04 20:34:29Z mike $". + * End of "$Id: serial.c 7647 2008-06-16 17:39:40Z mike $". */ diff --git a/backend/snmp.c b/backend/snmp.c index 0364ee2a23..b7bafbf561 100644 --- a/backend/snmp.c +++ b/backend/snmp.c @@ -1,5 +1,5 @@ /* - * "$Id: snmp.c 6649 2007-07-11 21:46:42Z mike $" + * "$Id: snmp.c 7506 2008-04-29 04:38:47Z mike $" * * SNMP discovery backend for the Common UNIX Printing System (CUPS). * @@ -1311,5 +1311,5 @@ update_cache(snmp_cache_t *device, /* I - Device */ /* - * End of "$Id: snmp.c 6649 2007-07-11 21:46:42Z mike $". + * End of "$Id: snmp.c 7506 2008-04-29 04:38:47Z mike $". */ diff --git a/backend/socket.c b/backend/socket.c index 6f2c80ddf8..5992fc5f73 100644 --- a/backend/socket.c +++ b/backend/socket.c @@ -1,5 +1,5 @@ /* - * "$Id: socket.c 6910 2007-09-04 20:34:29Z mike $" + * "$Id: socket.c 7583 2008-05-16 17:47:16Z mike $" * * AppSocket backend for the Common UNIX Printing System (CUPS). * @@ -499,5 +499,5 @@ wait_bc(int device_fd, /* I - Socket */ /* - * End of "$Id: socket.c 6910 2007-09-04 20:34:29Z mike $". + * End of "$Id: socket.c 7583 2008-05-16 17:47:16Z mike $". */ diff --git a/backend/test1284.c b/backend/test1284.c index 2f2766b424..5c9b999636 100644 --- a/backend/test1284.c +++ b/backend/test1284.c @@ -1,5 +1,5 @@ /* - * "$Id: test1284.c 6649 2007-07-11 21:46:42Z mike $" + * "$Id: test1284.c 7465 2008-04-18 16:20:11Z mike $" * * IEEE-1284 support functions test program for the Common UNIX Printing * System (CUPS). @@ -83,5 +83,5 @@ main(int argc, /* I - Number of command-line args */ /* - * End of "$Id: test1284.c 6649 2007-07-11 21:46:42Z mike $". + * End of "$Id: test1284.c 7465 2008-04-18 16:20:11Z mike $". */ diff --git a/backend/usb-darwin.c b/backend/usb-darwin.c index f9197173eb..28d45f29ff 100644 --- a/backend/usb-darwin.c +++ b/backend/usb-darwin.c @@ -1,5 +1,5 @@ /* -* "$Id: usb-darwin.c 6993 2007-09-28 18:05:28Z mike $" +* "$Id: usb-darwin.c 7460 2008-04-16 02:19:54Z mike $" * * Copyright 2005-2008 Apple Inc. All rights reserved. * @@ -2036,5 +2036,5 @@ static void get_device_id(cups_sc_status_t *status, /* - * End of "$Id: usb-darwin.c 6993 2007-09-28 18:05:28Z mike $". + * End of "$Id: usb-darwin.c 7460 2008-04-16 02:19:54Z mike $". */ diff --git a/backend/usb-libusb.c b/backend/usb-libusb.c new file mode 100644 index 0000000000..a2ec1fa574 --- /dev/null +++ b/backend/usb-libusb.c @@ -0,0 +1,680 @@ +/* + * "$Id$" + * + * Libusb interface code for the Common UNIX Printing System (CUPS). + * + * Copyright 2007-2008 by Apple Inc. + * + * These coded instructions, statements, and computer programs are the + * property of Apple Inc. and are protected by Federal copyright + * law. Distribution and use rights are outlined in the file "LICENSE.txt" + * which should have been included with this file. If this file is + * file is missing or damaged, see the license at "http://www.cups.org/". + * + * Contents: + * + */ + +/* + * Include necessary headers... + */ + +#include + + +/* + * Local types... + */ + +typedef struct usb_printer_s /**** USB Printer Data ****/ +{ + struct usb_device *device; /* Device info */ + int conf, /* Configuration */ + iface, /* Interface */ + altset, /* Alternate setting */ + write_endp, /* Write endpoint */ + read_endp; /* Read endpoint */ + struct usb_dev_handle *handle; /* Open handle to device */ +} usb_printer_t; + +typedef int (*usb_cb_t)(usb_printer_t *, const char *, const char *, + const void *); + + +/* + * Local functions... + */ + +static int close_device(usb_printer_t *printer); +static usb_printer_t *find_device(usb_cb_t cb, const void *data); +static int get_device_id(usb_printer_t *printer, char *buffer, + size_t bufsize); +static int list_cb(usb_printer_t *printer, const char *device_uri, + const char *device_id, const void *data); +static char *make_device_uri(usb_printer_t *printer, + const char *device_id, + char *uri, size_t uri_size); +static int open_device(usb_printer_t *printer, int verbose); +static int print_cb(usb_printer_t *printer, const char *device_uri, + const char *device_id, const void *data); + + +/* + * 'list_devices()' - List the available printers. + */ + +void +list_devices(void) +{ + fputs("DEBUG: list_devices\n", stderr); + find_device(list_cb, NULL); +} + + +/* + * 'print_device()' - Print a file to a USB device. + */ + +int /* O - Exit status */ +print_device(const char *uri, /* I - Device URI */ + const char *hostname, /* I - Hostname/manufacturer */ + const char *resource, /* I - Resource/modelname */ + char *options, /* I - Device options/serial number */ + int print_fd, /* I - File descriptor to print */ + int copies, /* I - Copies to print */ + int argc, /* I - Number of command-line arguments (6 or 7) */ + char *argv[]) /* I - Command-line arguments */ +{ + usb_printer_t *printer; /* Printer */ + ssize_t bytes, /* Bytes read/written */ + tbytes; /* Total bytes written */ + char buffer[8192]; /* Print data buffer */ + struct sigaction action; /* Actions for POSIX signals */ + int read_endp, /* Read endpoint */ + write_endp; /* Write endpoint */ + + + fputs("DEBUG: print_device\n", stderr); + + /* + * Connect to the printer... + */ + + while ((printer = find_device(print_cb, uri)) == NULL) + { + _cupsLangPuts(stderr, + _("INFO: Waiting for printer to become available...\n")); + sleep(5); + } + + read_endp = printer->device->config[printer->conf]. + interface[printer->iface]. + altsetting[printer->altset]. + endpoint[printer->read_endp].bEndpointAddress; + write_endp = printer->device->config[printer->conf]. + interface[printer->iface]. + altsetting[printer->altset]. + endpoint[printer->write_endp].bEndpointAddress; + + /* + * If we are printing data from a print driver on stdin, ignore SIGTERM + * so that the driver can finish out any page data, e.g. to eject the + * current page. We only do this for stdin printing as otherwise there + * is no way to cancel a raw print job... + */ + + if (!print_fd) + { + memset(&action, 0, sizeof(action)); + + sigemptyset(&action.sa_mask); + action.sa_handler = SIG_IGN; + sigaction(SIGTERM, &action, NULL); + } + + tbytes = 0; + + while (copies > 0 && tbytes >= 0) + { + copies --; + + if (print_fd != 0) + { + fputs("PAGE: 1 1\n", stderr); + lseek(print_fd, 0, SEEK_SET); + } + + /* + * TODO: Add side-channel and back-channel support, along with better + * error handling for writes. + */ + + while ((bytes = read(print_fd, buffer, sizeof(buffer))) > 0) + { + while (usb_bulk_write(printer->handle, write_endp, buffer, bytes, + 5000) < 0) + { + _cupsLangPrintf(stderr, + _("ERROR: Unable to write %d bytes to printer!\n"), + (int)bytes); + tbytes = -1; + break; + } + + tbytes += bytes; + } + } + + /* + * Close our connection and return... + */ + + close_device(printer); + + return (CUPS_BACKEND_OK); +} + + +/* + * 'close_device()' - Close the connection to the USB printer. + */ + +static int /* I - 0 on success, -1 on failure */ +close_device(usb_printer_t *printer) /* I - Printer */ +{ + if (printer->handle) + { + usb_close(printer->handle); + printer->handle = NULL; + } + + return (0); +} + + +/* + * 'find_device()' - Find or enumerate USB printers. + */ + +static usb_printer_t * /* O - Found printer */ +find_device(usb_cb_t cb, /* I - Callback function */ + const void *data) /* I - User data for callback */ +{ + struct usb_bus *bus; /* Current bus */ + struct usb_device *device; /* Current device */ + struct usb_config_descriptor *confptr;/* Pointer to current configuration */ + struct usb_interface *ifaceptr; /* Pointer to current interface */ + struct usb_interface_descriptor *altptr; + /* Pointer to current alternate setting */ + struct usb_endpoint_descriptor *endpptr; + /* Pointer to current endpoint */ + int conf, /* Current configuration */ + iface, /* Current interface */ + altset, /* Current alternate setting */ + protocol, /* Current protocol */ + endp, /* Current endpoint */ + read_endp, /* Current read endpoint */ + write_endp; /* Current write endpoint */ + char device_id[1024],/* IEEE-1284 device ID */ + device_uri[1024]; + /* Device URI */ + static usb_printer_t printer; /* Current printer */ + + + /* + * Initialize libusb... + */ + + usb_init(); + fprintf(stderr, "DEBUG: usb_find_busses=%d\n", usb_find_busses()); + fprintf(stderr, "DEBUG: usb_find_devices=%d\n", usb_find_devices()); + + /* + * Then loop through the devices it found... + */ + + for (bus = usb_get_busses(); bus; bus = bus->next) + for (device = bus->devices; device; device = device->next) + { + /* + * Ignore devices with no configuration data and anything that is not + * a printer... + */ + + if (!device->config || !device->descriptor.idVendor || + !device->descriptor.idProduct) + continue; + + for (conf = 0, confptr = device->config; + conf < device->descriptor.bNumConfigurations; + conf ++, confptr ++) + for (iface = 0, ifaceptr = confptr->interface; + iface < confptr->bNumInterfaces; + iface ++, ifaceptr ++) + { + /* + * Some printers offer multiple interfaces... + */ + + protocol = 0; + + for (altset = 0, altptr = ifaceptr->altsetting; + altset < ifaceptr->num_altsetting; + altset ++, altptr ++) + { + /* + * Currently we only support unidirectional and bidirectional + * printers. Future versions of this code will support the + * 1284.4 (packet mode) protocol as well. + */ + + if (altptr->bInterfaceClass != USB_CLASS_PRINTER || + altptr->bInterfaceSubClass != 1 || + (altptr->bInterfaceProtocol != 1 && /* Unidirectional */ + altptr->bInterfaceProtocol != 2) || /* Bidirectional */ + altptr->bInterfaceProtocol < protocol) + continue; + + read_endp = -1; + write_endp = -1; + + for (endp = 0, endpptr = altptr->endpoint; + endp < altptr->bNumEndpoints; + endp ++, endpptr ++) + if ((endpptr->bmAttributes & USB_ENDPOINT_TYPE_MASK) == + USB_ENDPOINT_TYPE_BULK) + { + if (endpptr->bEndpointAddress & USB_ENDPOINT_DIR_MASK) + read_endp = endp; + else + write_endp = endp; + } + + if (write_endp >= 0) + { + /* + * Save the best match so far... + */ + + protocol = altptr->bInterfaceProtocol; + printer.altset = altset; + printer.write_endp = write_endp; + printer.read_endp = read_endp; + } + } + + if (protocol > 0) + { + printer.device = device; + printer.conf = conf; + printer.iface = iface; + printer.handle = NULL; + + if (!open_device(&printer, data != NULL)) + { + if (!get_device_id(&printer, device_id, sizeof(device_id))) + { + make_device_uri(&printer, device_id, device_uri, + sizeof(device_uri)); + + if ((*cb)(&printer, device_uri, device_id, data)) + return (&printer); + } + + close_device(&printer); + } + } + } + } + + /* + * If we get this far without returning, then we haven't found a printer + * to print to... + */ + + return (NULL); +} + + +/* + * 'get_device_id()' - Get the IEEE-1284 device ID for the printer. + */ + +static int /* O - 0 on success, -1 on error */ +get_device_id(usb_printer_t *printer, /* I - Printer */ + char *buffer, /* I - String buffer */ + size_t bufsize) /* I - Number of bytes in buffer */ +{ + int length; /* Length of device ID */ + + + if (usb_control_msg(printer->handle, + USB_TYPE_CLASS | USB_ENDPOINT_IN | USB_RECIP_INTERFACE, + 0, 0, + (printer->iface << 8) | + printer->device->config[printer->conf]. + interface[printer->iface]. + altsetting[printer->altset].bAlternateSetting, + buffer, bufsize, 5000) < 0) + { + *buffer = '\0'; + return (-1); + } + + /* + * Extract the length of the device ID string from the first two + * bytes. The 1284 spec says the length is stored MSB first... + */ + + length = (((unsigned)buffer[0] & 255) << 8) + + ((unsigned)buffer[1] & 255); + + /* + * Check to see if the length is larger than our buffer; first + * assume that the vendor incorrectly implemented the 1284 spec, + * and then limit the length to the size of our buffer... + */ + + if (length > (bufsize - 2)) + length = (((unsigned)buffer[1] & 255) << 8) + + ((unsigned)buffer[0] & 255); + + if (length > (bufsize - 2)) + length = bufsize - 2; + + /* + * Copy the device ID text to the beginning of the buffer and + * nul-terminate. + */ + + memmove(buffer, buffer + 2, length); + buffer[length] = '\0'; + + return (0); +} + + +/* + * 'list_cb()' - List USB printers for discovery. + */ + +static int /* O - 0 to continue, 1 to stop */ +list_cb(usb_printer_t *printer, /* I - Printer */ + const char *device_uri, /* I - Device URI */ + const char *device_id, /* I - IEEE-1284 device ID */ + const void *data) /* I - User data (not used) */ +{ + char make_model[1024]; /* Make and model */ + + + /* + * Get the device URI and make/model strings... + */ + + backendGetMakeModel(device_id, make_model, sizeof(make_model)); + + /* + * Report the printer... + */ + + printf("direct %s \"%s\" \"%s USB\" \"%s\"\n", device_uri, make_model, + make_model, device_id); + fflush(stdout); + + /* + * Keep going... + */ + + return (0); +} + + +/* + * 'make_device_uri()' - Create a device URI for a USB printer. + */ + +static char * /* O - Device URI */ +make_device_uri( + usb_printer_t *printer, /* I - Printer */ + const char *device_id, /* I - IEEE-1284 device ID */ + char *uri, /* I - Device URI buffer */ + size_t uri_size) /* I - Size of device URI buffer */ +{ + char options[1024]; /* Device URI options */ + int num_values; /* Number of 1284 parameters */ + cups_option_t *values; /* 1284 parameters */ + const char *mfg, /* Manufacturer */ + *mdl, /* Model */ + *des, /* Description */ + *sern; /* Serial number */ + char tempmfg[256], /* Temporary manufacturer string */ + tempsern[256], /* Temporary serial number string */ + *tempptr; /* Pointer into temp string */ + + + /* + * Get the make, model, and serial numbers... + */ + + num_values = _ppdGet1284Values(device_id, &values); + + if ((sern = cupsGetOption("SERIALNUMBER", num_values, values)) == NULL) + if ((sern = cupsGetOption("SERN", num_values, values)) == NULL) + if ((sern = cupsGetOption("SN", num_values, values)) == NULL) + { + /* + * Try getting the serial number from the device itself... + */ + + int length = usb_get_string_simple(printer->handle, + printer->device->descriptor. + iSerialNumber, + tempsern, sizeof(tempsern) - 1); + if (length > 0) + { + tempsern[length] = '\0'; + sern = tempsern; + } + } + + if ((mfg = cupsGetOption("MANUFACTURER", num_values, values)) == NULL) + mfg = cupsGetOption("MFG", num_values, values); + + if ((mdl = cupsGetOption("MODEL", num_values, values)) == NULL) + mdl = cupsGetOption("MDL", num_values, values); + +#ifdef __APPLE__ + /* + * To maintain compatibility with the original IOKit-based backend on Mac OS X, + * don't map manufacturer names... + */ + + if (!mfg) + +#else + /* + * To maintain compatibility with the original character device backend on + * Linux and *BSD, map manufacturer names... + */ + + if (mfg) + { + if (!strcasecmp(mfg, "Hewlett-Packard")) + mfg = "HP"; + else if (!strcasecmp(mfg, "Lexmark International")) + mfg = "Lexmark"; + } + else +#endif /* __APPLE__ */ + { + /* + * No manufacturer? Use the model string or description... + */ + + if (mdl) + _ppdNormalizeMakeAndModel(mdl, tempmfg, sizeof(tempmfg)); + else if ((des = cupsGetOption("DESCRIPTION", num_values, values)) != NULL || + (des = cupsGetOption("DES", num_values, values)) != NULL) + _ppdNormalizeMakeAndModel(des, tempmfg, sizeof(tempmfg)); + else + strlcpy(tempmfg, "Unknown", sizeof(tempmfg)); + + if ((tempptr = strchr(tempmfg, ' ')) != NULL) + *tempptr = '\0'; + + mfg = tempmfg; + } + + /* + * Generate the device URI from the manufacturer, model, serial number, + * and interface number... + */ + + if (sern) + { + if (printer->iface > 0) + snprintf(options, sizeof(options), "?serial=%s&interface=%d", sern, + printer->iface); + else + snprintf(options, sizeof(options), "?serial=%s", sern); + } + else if (printer->iface > 0) + snprintf(options, sizeof(options), "?interface=%d", printer->iface); + else + options[0] = '\0'; + + httpAssembleURIf(HTTP_URI_CODING_ALL, uri, uri_size, "usb", NULL, mfg, 0, + "/%s%s", mdl, options); + + cupsFreeOptions(num_values, values); + + return (uri); +} + + +/* + * 'open_device()' - Open a connection to the USB printer. + */ + +static int /* O - 0 on success, -1 on error */ +open_device(usb_printer_t *printer, /* I - Printer */ + int verbose) /* I - Update connecting-to-device state? */ +{ + int number; /* Configuration/interface/altset numbers */ + + + /* + * Return immediately if we are already connected... + */ + + if (printer->handle) + return (0); + + /* + * Try opening the printer... + */ + + if ((printer->handle = usb_open(printer->device)) == NULL) + return (-1); + + /* + * Then set the desired configuration... + */ + + if (verbose) + fputs("STATE: +connecting-to-device\n", stderr); + + number = printer->device->config[printer->conf].bConfigurationValue; + while (usb_set_configuration(printer->handle, number) < 0) + { + if (errno != EBUSY) + fprintf(stderr, "DEBUG: Failed to set configuration %d for %04x:%04x\n", + number, printer->device->descriptor.idVendor, + printer->device->descriptor.idProduct); + + goto error; + } + + /* + * Claim interfaces as needed... + */ + + number = printer->device->config[printer->conf].interface[printer->iface]. + altsetting[printer->altset].bInterfaceNumber; + while (usb_claim_interface(printer->handle, number) < 0) + { + if (errno != EBUSY) + fprintf(stderr, "DEBUG: Failed to claim interface %d for %04x:%04x\n", + number, printer->device->descriptor.idVendor, + printer->device->descriptor.idProduct); + + goto error; + } + + if (number != 0) + while (usb_claim_interface(printer->handle, 0) < 0) + { + if (errno != EBUSY) + fprintf(stderr, "DEBUG: Failed to claim interface 0 for %04x:%04x\n", + printer->device->descriptor.idVendor, + printer->device->descriptor.idProduct); + + goto error; + } + + /* + * Set alternate setting... + */ + + number = printer->device->config[printer->conf].interface[printer->iface]. + altsetting[printer->altset].bAlternateSetting; + while (usb_set_altinterface(printer->handle, number) < 0) + { + if (errno != EBUSY) + fprintf(stderr, + "DEBUG: Failed to set alternate interface %d for %04x:%04x\n", + number, printer->device->descriptor.idVendor, + printer->device->descriptor.idProduct); + + goto error; + } + + if (verbose) + fputs("STATE: -connecting-to-device\n", stderr); + + return (0); + + /* + * If we get here, there was a hard error... + */ + + error: + + if (verbose) + fputs("STATE: -connecting-to-device\n", stderr); + + usb_close(printer->handle); + printer->handle = NULL; + + return (-1); +} + + +/* + * 'print_cb()' - Find a USB printer for printing. + */ + +static int /* O - 0 to continue, 1 to stop (found) */ +print_cb(usb_printer_t *printer, /* I - Printer */ + const char *device_uri, /* I - Device URI */ + const char *device_id, /* I - IEEE-1284 device ID */ + const void *data) /* I - User data (make, model, S/N) */ +{ + return (!strcmp((char *)data, device_uri)); +} + + +/* + * End of "$Id$". + */ + diff --git a/backend/usb-unix.c b/backend/usb-unix.c index f180610657..5fbed6ecd9 100644 --- a/backend/usb-unix.c +++ b/backend/usb-unix.c @@ -1,11 +1,11 @@ /* - * "$Id: usb-unix.c 6910 2007-09-04 20:34:29Z mike $" + * "$Id: usb-unix.c 7687 2008-06-24 01:28:36Z mike $" * * USB port backend for the Common UNIX Printing System (CUPS). * * This file is included from "usb.c" when compiled on UNIX/Linux. * - * Copyright 2007 by Apple Inc. + * Copyright 2007-2008 by Apple Inc. * Copyright 1997-2007 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the @@ -28,7 +28,6 @@ * Include necessary headers. */ -#include "ieee1284.c" #include @@ -611,5 +610,5 @@ side_cb(int print_fd, /* I - Print file */ /* - * End of "$Id: usb-unix.c 6910 2007-09-04 20:34:29Z mike $". + * End of "$Id: usb-unix.c 7687 2008-06-24 01:28:36Z mike $". */ diff --git a/backend/usb.c b/backend/usb.c index 396f95ac1c..fddd21d2b7 100644 --- a/backend/usb.c +++ b/backend/usb.c @@ -1,9 +1,9 @@ /* - * "$Id: usb.c 6910 2007-09-04 20:34:29Z mike $" + * "$Id: usb.c 7687 2008-06-24 01:28:36Z mike $" * * USB port backend for the Common UNIX Printing System (CUPS). * - * Copyright 2007 by Apple Inc. + * Copyright 2007-2008 by Apple Inc. * Copyright 1997-2007 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the @@ -30,14 +30,7 @@ # include #endif /* __APPLE__ */ -#include -#include -#include -#include -#include -#include -#include -#include +#include "backend-private.h" #ifdef WIN32 # include @@ -62,7 +55,9 @@ int print_device(const char *uri, const char *hostname, * Include the vendor-specific USB implementation... */ -#ifdef __APPLE__ +#ifdef HAVE_USB_H +# include "usb-libusb.c" +#elif defined(__APPLE__) # include "usb-darwin.c" #elif defined(__linux) || defined(__sun) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__) # include "usb-unix.c" @@ -266,5 +261,5 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ /* - * End of "$Id: usb.c 6910 2007-09-04 20:34:29Z mike $". + * End of "$Id: usb.c 7687 2008-06-24 01:28:36Z mike $". */ diff --git a/berkeley/Makefile b/berkeley/Makefile index 7531c01ddf..7852f245fb 100644 --- a/berkeley/Makefile +++ b/berkeley/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile 6649 2007-07-11 21:46:42Z mike $" +# "$Id: Makefile 7558 2008-05-12 23:46:44Z mike $" # # Berkeley commands makefile for the Common UNIX Printing System (CUPS). # @@ -153,5 +153,5 @@ include Dependencies # -# End of "$Id: Makefile 6649 2007-07-11 21:46:42Z mike $". +# End of "$Id: Makefile 7558 2008-05-12 23:46:44Z mike $". # diff --git a/berkeley/lpc.c b/berkeley/lpc.c index 9471867828..a18eb0e71a 100644 --- a/berkeley/lpc.c +++ b/berkeley/lpc.c @@ -1,5 +1,5 @@ /* - * "$Id: lpc.c 6649 2007-07-11 21:46:42Z mike $" + * "$Id: lpc.c 7079 2007-11-30 01:58:31Z mike $" * * "lpc" command for the Common UNIX Printing System (CUPS). * @@ -450,5 +450,5 @@ show_status(http_t *http, /* I - HTTP connection to server */ /* - * End of "$Id: lpc.c 6649 2007-07-11 21:46:42Z mike $". + * End of "$Id: lpc.c 7079 2007-11-30 01:58:31Z mike $". */ diff --git a/berkeley/lpq.c b/berkeley/lpq.c index 7ffb2a8e92..db089867eb 100644 --- a/berkeley/lpq.c +++ b/berkeley/lpq.c @@ -1,5 +1,5 @@ /* - * "$Id: lpq.c 6649 2007-07-11 21:46:42Z mike $" + * "$Id: lpq.c 7460 2008-04-16 02:19:54Z mike $" * * "lpq" command for the Common UNIX Printing System (CUPS). * @@ -667,5 +667,5 @@ usage(void) /* - * End of "$Id: lpq.c 6649 2007-07-11 21:46:42Z mike $". + * End of "$Id: lpq.c 7460 2008-04-16 02:19:54Z mike $". */ diff --git a/berkeley/lprm.c b/berkeley/lprm.c index d00372c551..eeeca538ba 100644 --- a/berkeley/lprm.c +++ b/berkeley/lprm.c @@ -1,5 +1,5 @@ /* - * "$Id: lprm.c 6649 2007-07-11 21:46:42Z mike $" + * "$Id: lprm.c 7261 2008-01-28 23:09:31Z mike $" * * "lprm" command for the Common UNIX Printing System (CUPS). * @@ -223,5 +223,5 @@ main(int argc, /* I - Number of command-line arguments */ /* - * End of "$Id: lprm.c 6649 2007-07-11 21:46:42Z mike $". + * End of "$Id: lprm.c 7261 2008-01-28 23:09:31Z mike $". */ diff --git a/cgi-bin/Makefile b/cgi-bin/Makefile index d0c0c01555..53911d8450 100644 --- a/cgi-bin/Makefile +++ b/cgi-bin/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile 6649 2007-07-11 21:46:42Z mike $" +# "$Id: Makefile 7558 2008-05-12 23:46:44Z mike $" # # CGI makefile for the Common UNIX Printing System (CUPS). # @@ -398,5 +398,5 @@ include Dependencies # -# End of "$Id: Makefile 6649 2007-07-11 21:46:42Z mike $". +# End of "$Id: Makefile 7558 2008-05-12 23:46:44Z mike $". # diff --git a/cgi-bin/admin.c b/cgi-bin/admin.c index b54d27fdc8..3f94b88269 100644 --- a/cgi-bin/admin.c +++ b/cgi-bin/admin.c @@ -1,5 +1,5 @@ /* - * "$Id: admin.c 7012 2007-10-10 21:22:45Z mike $" + * "$Id: admin.c 7438 2008-04-09 03:27:37Z mike $" * * Administration CGI for the Common UNIX Printing System (CUPS). * @@ -3449,5 +3449,5 @@ match_string(const char *a, /* I - First string */ /* - * End of "$Id: admin.c 7012 2007-10-10 21:22:45Z mike $". + * End of "$Id: admin.c 7438 2008-04-09 03:27:37Z mike $". */ diff --git a/cgi-bin/classes.c b/cgi-bin/classes.c index 39e2d15620..09a3cc64c5 100644 --- a/cgi-bin/classes.c +++ b/cgi-bin/classes.c @@ -1,5 +1,5 @@ /* - * "$Id: classes.c 6889 2007-08-29 22:23:35Z mike $" + * "$Id: classes.c 7301 2008-02-13 00:27:52Z mike $" * * Class status CGI for the Common UNIX Printing System (CUPS). * @@ -432,5 +432,5 @@ show_class(http_t *http, /* I - Connection to server */ /* - * End of "$Id: classes.c 6889 2007-08-29 22:23:35Z mike $". + * End of "$Id: classes.c 7301 2008-02-13 00:27:52Z mike $". */ diff --git a/cgi-bin/help-index.c b/cgi-bin/help-index.c index f1d96832fd..cb88aee173 100644 --- a/cgi-bin/help-index.c +++ b/cgi-bin/help-index.c @@ -1,5 +1,5 @@ /* - * "$Id: help-index.c 6649 2007-07-11 21:46:42Z mike $" + * "$Id: help-index.c 7615 2008-05-25 07:17:07Z mike $" * * Online help index routines for the Common UNIX Printing System (CUPS). * @@ -1327,5 +1327,5 @@ help_sort_words(help_word_t *w1, /* I - Second word */ /* - * End of "$Id: help-index.c 6649 2007-07-11 21:46:42Z mike $". + * End of "$Id: help-index.c 7615 2008-05-25 07:17:07Z mike $". */ diff --git a/cgi-bin/help-index.h b/cgi-bin/help-index.h index d92abbea25..0e6b0b1c73 100644 --- a/cgi-bin/help-index.h +++ b/cgi-bin/help-index.h @@ -1,5 +1,5 @@ /* - * "$Id: help-index.h 6649 2007-07-11 21:46:42Z mike $" + * "$Id: help-index.h 7615 2008-05-25 07:17:07Z mike $" * * Online help index definitions for the Common UNIX Printing System (CUPS). * @@ -71,5 +71,5 @@ extern help_index_t *helpSearchIndex(help_index_t *hi, const char *query, #endif /* !_CUPS_HELP_INDEX_H_ */ /* - * End of "$Id: help-index.h 6649 2007-07-11 21:46:42Z mike $". + * End of "$Id: help-index.h 7615 2008-05-25 07:17:07Z mike $". */ diff --git a/cgi-bin/ipp-var.c b/cgi-bin/ipp-var.c index 79cfaf9479..4ee9ef867c 100644 --- a/cgi-bin/ipp-var.c +++ b/cgi-bin/ipp-var.c @@ -1,5 +1,5 @@ /* - * "$Id: ipp-var.c 6889 2007-08-29 22:23:35Z mike $" + * "$Id: ipp-var.c 7541 2008-05-05 21:22:58Z mike $" * * CGI <-> IPP variable routines for the Common UNIX Printing System (CUPS). * @@ -1384,5 +1384,5 @@ cgiText(const char *message) /* I - Message */ /* - * End of "$Id: ipp-var.c 6889 2007-08-29 22:23:35Z mike $". + * End of "$Id: ipp-var.c 7541 2008-05-05 21:22:58Z mike $". */ diff --git a/cgi-bin/jobs.c b/cgi-bin/jobs.c index 41d58a038f..9af1dd7447 100644 --- a/cgi-bin/jobs.c +++ b/cgi-bin/jobs.c @@ -1,5 +1,5 @@ /* - * "$Id: jobs.c 6889 2007-08-29 22:23:35Z mike $" + * "$Id: jobs.c 7237 2008-01-22 01:38:39Z mike $" * * Job status CGI for the Common UNIX Printing System (CUPS). * @@ -209,5 +209,5 @@ do_job_op(http_t *http, /* I - HTTP connection */ /* - * End of "$Id: jobs.c 6889 2007-08-29 22:23:35Z mike $". + * End of "$Id: jobs.c 7237 2008-01-22 01:38:39Z mike $". */ diff --git a/cgi-bin/printers.c b/cgi-bin/printers.c index de4d769f57..f90632866a 100644 --- a/cgi-bin/printers.c +++ b/cgi-bin/printers.c @@ -1,5 +1,5 @@ /* - * "$Id: printers.c 6889 2007-08-29 22:23:35Z mike $" + * "$Id: printers.c 7301 2008-02-13 00:27:52Z mike $" * * Printer status CGI for the Common UNIX Printing System (CUPS). * @@ -612,5 +612,5 @@ show_printer(http_t *http, /* I - Connection to server */ /* - * End of "$Id: printers.c 6889 2007-08-29 22:23:35Z mike $". + * End of "$Id: printers.c 7301 2008-02-13 00:27:52Z mike $". */ diff --git a/cgi-bin/search.c b/cgi-bin/search.c index 4dc7258590..d8f023c283 100644 --- a/cgi-bin/search.c +++ b/cgi-bin/search.c @@ -1,5 +1,5 @@ /* - * "$Id: search.c 6649 2007-07-11 21:46:42Z mike $" + * "$Id: search.c 7420 2008-04-01 20:32:00Z mike $" * * Search routines for the Common UNIX Printing System (CUPS). * @@ -370,5 +370,5 @@ cgiFreeSearch(void *search) /* I - Search context */ /* - * End of "$Id: search.c 6649 2007-07-11 21:46:42Z mike $". + * End of "$Id: search.c 7420 2008-04-01 20:32:00Z mike $". */ diff --git a/cgi-bin/template.c b/cgi-bin/template.c index 661f6395b9..f20a7a9503 100644 --- a/cgi-bin/template.c +++ b/cgi-bin/template.c @@ -1,5 +1,5 @@ /* - * "$Id: template.c 6986 2007-09-25 15:34:52Z mike $" + * "$Id: template.c 7219 2008-01-14 22:00:02Z mike $" * * CGI template function. * @@ -706,5 +706,5 @@ cgi_puturi(const char *s, /* I - String to output */ /* - * End of "$Id: template.c 6986 2007-09-25 15:34:52Z mike $". + * End of "$Id: template.c 7219 2008-01-14 22:00:02Z mike $". */ diff --git a/cgi-bin/var.c b/cgi-bin/var.c index 596b24d0da..7ceb3ecaac 100644 --- a/cgi-bin/var.c +++ b/cgi-bin/var.c @@ -1,5 +1,5 @@ /* - * "$Id: var.c 6649 2007-07-11 21:46:42Z mike $" + * "$Id: var.c 7460 2008-04-16 02:19:54Z mike $" * * CGI form variable and array functions. * @@ -1039,5 +1039,5 @@ cgi_unlink_file(void) /* - * End of "$Id: var.c 6649 2007-07-11 21:46:42Z mike $". + * End of "$Id: var.c 7460 2008-04-16 02:19:54Z mike $". */ diff --git a/conf/Makefile b/conf/Makefile index 4bb31c9ed6..8d4ffbf2f2 100644 --- a/conf/Makefile +++ b/conf/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile 6649 2007-07-11 21:46:42Z mike $" +# "$Id: Makefile 7670 2008-06-17 22:42:08Z mike $" # # Configuration file makefile for the Common UNIX Printing System (CUPS). # @@ -136,5 +136,5 @@ uninstall: # -# End of "$Id: Makefile 6649 2007-07-11 21:46:42Z mike $". +# End of "$Id: Makefile 7670 2008-06-17 22:42:08Z mike $". # diff --git a/conf/cupsd.conf.in b/conf/cupsd.conf.in index 8939b8a4b9..c48b70626a 100644 --- a/conf/cupsd.conf.in +++ b/conf/cupsd.conf.in @@ -1,5 +1,5 @@ # -# "$Id: cupsd.conf.in 6720 2007-07-25 00:40:03Z mike $" +# "$Id: cupsd.conf.in 7680 2008-06-20 17:37:43Z mike $" # # Sample configuration file for the Common UNIX Printing System (CUPS) # scheduler. See "man cupsd.conf" for a complete description of this @@ -82,10 +82,9 @@ DefaultAuthType Basic # Job-related operations must be done by the owner or an administrator... + AuthType Default Require user @OWNER @SYSTEM Order deny,allow - AuthType Default - Satisfy any # All administration operations require an administrator to authenticate... @@ -104,19 +103,17 @@ DefaultAuthType Basic # Only the owner or an administrator can cancel or authenticate a job... + AuthType Default Require user @OWNER @CUPS_DEFAULT_PRINTADMIN_AUTH@ Order deny,allow - AuthType Default - Satisfy any - Order deny,allow AuthType Default - Satisfy any + Order deny,allow # -# End of "$Id: cupsd.conf.in 6720 2007-07-25 00:40:03Z mike $". +# End of "$Id: cupsd.conf.in 7680 2008-06-20 17:37:43Z mike $". # diff --git a/conf/mime.types b/conf/mime.types index 1852d460cd..83a079a779 100644 --- a/conf/mime.types +++ b/conf/mime.types @@ -1,5 +1,5 @@ # -# "$Id: mime.types 6649 2007-07-11 21:46:42Z mike $" +# "$Id: mime.types 7670 2008-06-17 22:42:08Z mike $" # # MIME types file for the Common UNIX Printing System (CUPS). # @@ -173,5 +173,5 @@ application/vnd.cups-raw (string(0,<1B>E) + !string(2,<1B>%0B)) \ application/octet-stream # -# End of "$Id: mime.types 6649 2007-07-11 21:46:42Z mike $". +# End of "$Id: mime.types 7670 2008-06-17 22:42:08Z mike $". # diff --git a/config-scripts/cups-common.m4 b/config-scripts/cups-common.m4 index 6e81ea5260..a88692f35d 100644 --- a/config-scripts/cups-common.m4 +++ b/config-scripts/cups-common.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id: cups-common.m4 6964 2007-09-17 21:33:57Z mike $" +dnl "$Id: cups-common.m4 7695 2008-06-26 00:46:24Z mike $" dnl dnl Common configuration stuff for the Common UNIX Printing System (CUPS). dnl @@ -83,14 +83,11 @@ LIBMALLOC="" AC_ARG_ENABLE(mallinfo, [ --enable-mallinfo turn on malloc debug information, default=no]) if test x$enable_mallinfo = xyes; then - AC_CHECK_LIB(c,mallinfo,LIBS="$LIBS"; AC_DEFINE(HAVE_MALLINFO),LIBS="$LIBS") - if test "$ac_cv_lib_c_mallinfo" = "no"; then - AC_CHECK_LIB(malloc,mallinfo, - LIBS="$LIBS" - LIBMALLOC="-lmalloc" - AC_DEFINE(HAVE_MALLINFO), - LIBS="$LIBS") - fi + SAVELIBS="$LIBS" + LIBS="" + AC_SEARCH_LIBS(mallinfo, malloc, AC_DEFINE(HAVE_MALLINFO)) + LIBMALLOC="$LIBS" + LIBS="$SAVELIBS" fi AC_SUBST(LIBMALLOC) @@ -170,6 +167,27 @@ AC_TRY_COMPILE([#include ],[struct tm t; dnl See if we have the removefile(3) function for securely removing files AC_CHECK_FUNCS(removefile) +dnl See if we have libusb... +AC_ARG_ENABLE(libusb, [ --enable-libusb use libusb for USB printing, default=auto]) + +LIBUSB="" +AC_SUBST(LIBUSB) + +if test x$enable_libusb = xyes; then + check_libusb=yes +elif test x$enable_libusb != xno -a $uname != Darwin; then + check_libusb=yes +else + check_libusb=no +fi + +if test $check_libusb = yes; then + AC_CHECK_LIB(usb, usb_init,[ + AC_CHECK_HEADER(usb.h, + AC_DEFINE(HAVE_USB_H) + LIBUSB="-lusb")]) +fi + dnl Flags for "ar" command... case $uname in Darwin* | *BSD*) @@ -282,5 +300,5 @@ AC_SUBST(FONTS) AC_SUBST(LEGACY_BACKENDS) dnl -dnl End of "$Id: cups-common.m4 6964 2007-09-17 21:33:57Z mike $". +dnl End of "$Id: cups-common.m4 7695 2008-06-26 00:46:24Z mike $". dnl diff --git a/config-scripts/cups-compiler.m4 b/config-scripts/cups-compiler.m4 index 51a5daa6f8..8598aebb97 100644 --- a/config-scripts/cups-compiler.m4 +++ b/config-scripts/cups-compiler.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id: cups-compiler.m4 6975 2007-09-18 20:37:09Z mike $" +dnl "$Id: cups-compiler.m4 7644 2008-06-16 17:15:47Z mike $" dnl dnl Compiler stuff for the Common UNIX Printing System (CUPS). dnl @@ -543,5 +543,5 @@ case $uname in esac dnl -dnl End of "$Id: cups-compiler.m4 6975 2007-09-18 20:37:09Z mike $". +dnl End of "$Id: cups-compiler.m4 7644 2008-06-16 17:15:47Z mike $". dnl diff --git a/config-scripts/cups-defaults.m4 b/config-scripts/cups-defaults.m4 index f2cff3c2ec..80287e8069 100644 --- a/config-scripts/cups-defaults.m4 +++ b/config-scripts/cups-defaults.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id: cups-defaults.m4 6754 2007-08-01 19:00:07Z mike $" +dnl "$Id: cups-defaults.m4 7649 2008-06-16 17:46:57Z mike $" dnl dnl Default cupsd configuration settings for the Common UNIX Printing System dnl (CUPS). @@ -395,5 +395,5 @@ AC_SUBST(DEFAULT_IPP_PORT) AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IPP_PORT,$DEFAULT_IPP_PORT) dnl -dnl End of "$Id: cups-defaults.m4 6754 2007-08-01 19:00:07Z mike $". +dnl End of "$Id: cups-defaults.m4 7649 2008-06-16 17:46:57Z mike $". dnl diff --git a/config-scripts/cups-dnssd.m4 b/config-scripts/cups-dnssd.m4 index 6ef18a7024..79997d71f8 100644 --- a/config-scripts/cups-dnssd.m4 +++ b/config-scripts/cups-dnssd.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id$" +dnl "$Id: cups-dnssd.m4 7585 2008-05-16 23:13:47Z mike $" dnl dnl DNS Service Discovery (aka Bonjour) stuff for the Common UNIX Printing System (CUPS). dnl @@ -52,5 +52,5 @@ AC_SUBST(DNSSDLIBS) AC_SUBST(MDNS) dnl -dnl End of "$Id$". +dnl End of "$Id: cups-dnssd.m4 7585 2008-05-16 23:13:47Z mike $". dnl diff --git a/config-scripts/cups-ldap.m4 b/config-scripts/cups-ldap.m4 index 14fd549d81..3f5adec235 100644 --- a/config-scripts/cups-ldap.m4 +++ b/config-scripts/cups-ldap.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id: cups-ldap.m4 6649 2007-07-11 21:46:42Z mike $" +dnl "$Id: cups-ldap.m4 7241 2008-01-22 22:34:52Z mike $" dnl dnl LDAP configuration stuff for the Common UNIX Printing System (CUPS). dnl @@ -36,5 +36,5 @@ AC_SUBST(LIBLDAP) dnl -dnl End of "$Id: cups-ldap.m4 6649 2007-07-11 21:46:42Z mike $". +dnl End of "$Id: cups-ldap.m4 7241 2008-01-22 22:34:52Z mike $". dnl diff --git a/config-scripts/cups-network.m4 b/config-scripts/cups-network.m4 index 347dc9a520..f363185759 100644 --- a/config-scripts/cups-network.m4 +++ b/config-scripts/cups-network.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id: cups-network.m4 6649 2007-07-11 21:46:42Z mike $" +dnl "$Id: cups-network.m4 7127 2007-12-17 18:05:32Z mike $" dnl dnl Networking stuff for the Common UNIX Printing System (CUPS). dnl @@ -66,5 +66,5 @@ AC_CHECK_HEADERS(AppleTalk/at_proto.h,AC_DEFINE(HAVE_APPLETALK_AT_PROTO_H),, [#include ]) dnl -dnl End of "$Id: cups-network.m4 6649 2007-07-11 21:46:42Z mike $". +dnl End of "$Id: cups-network.m4 7127 2007-12-17 18:05:32Z mike $". dnl diff --git a/config-scripts/cups-pam.m4 b/config-scripts/cups-pam.m4 index b100053e88..9b49e7ad6e 100644 --- a/config-scripts/cups-pam.m4 +++ b/config-scripts/cups-pam.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id: cups-pam.m4 6649 2007-07-11 21:46:42Z mike $" +dnl "$Id: cups-pam.m4 7149 2007-12-19 19:38:37Z mike $" dnl dnl PAM stuff for the Common UNIX Printing System (CUPS). dnl @@ -86,5 +86,5 @@ AC_SUBST(PAMLIBS) AC_SUBST(PAMMOD) dnl -dnl End of "$Id: cups-pam.m4 6649 2007-07-11 21:46:42Z mike $". +dnl End of "$Id: cups-pam.m4 7149 2007-12-19 19:38:37Z mike $". dnl diff --git a/config-scripts/cups-pdf.m4 b/config-scripts/cups-pdf.m4 index e980f1de54..eaa004f59b 100644 --- a/config-scripts/cups-pdf.m4 +++ b/config-scripts/cups-pdf.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id: cups-pdf.m4 6649 2007-07-11 21:46:42Z mike $" +dnl "$Id: cups-pdf.m4 7449 2008-04-14 18:27:53Z mike $" dnl dnl PDF filter configuration stuff for the Common UNIX Printing System (CUPS). dnl @@ -47,5 +47,5 @@ fi AC_SUBST(PDFTOPS) dnl -dnl End of "$Id: cups-pdf.m4 6649 2007-07-11 21:46:42Z mike $". +dnl End of "$Id: cups-pdf.m4 7449 2008-04-14 18:27:53Z mike $". dnl diff --git a/config-scripts/cups-sharedlibs.m4 b/config-scripts/cups-sharedlibs.m4 index f3962ab85f..e4ca18dc08 100644 --- a/config-scripts/cups-sharedlibs.m4 +++ b/config-scripts/cups-sharedlibs.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id: cups-sharedlibs.m4 6649 2007-07-11 21:46:42Z mike $" +dnl "$Id: cups-sharedlibs.m4 7630 2008-06-09 22:31:44Z mike $" dnl dnl Shared library support for the Common UNIX Printing System (CUPS). dnl @@ -244,5 +244,5 @@ AC_SUBST(IMGLIBS) AC_SUBST(EXPORT_LDFLAGS) dnl -dnl End of "$Id: cups-sharedlibs.m4 6649 2007-07-11 21:46:42Z mike $". +dnl End of "$Id: cups-sharedlibs.m4 7630 2008-06-09 22:31:44Z mike $". dnl diff --git a/config-scripts/cups-slp.m4 b/config-scripts/cups-slp.m4 index cbeb485279..89f87468cc 100644 --- a/config-scripts/cups-slp.m4 +++ b/config-scripts/cups-slp.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id: cups-slp.m4 6649 2007-07-11 21:46:42Z mike $" +dnl "$Id: cups-slp.m4 7241 2008-01-22 22:34:52Z mike $" dnl dnl OpenSLP configuration stuff for the Common UNIX Printing System (CUPS). dnl @@ -34,5 +34,5 @@ AC_SUBST(LIBSLP) dnl -dnl End of "$Id: cups-slp.m4 6649 2007-07-11 21:46:42Z mike $". +dnl End of "$Id: cups-slp.m4 7241 2008-01-22 22:34:52Z mike $". dnl diff --git a/config-scripts/cups-ssl.m4 b/config-scripts/cups-ssl.m4 index cacf94bef8..f5335562c6 100644 --- a/config-scripts/cups-ssl.m4 +++ b/config-scripts/cups-ssl.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id: cups-ssl.m4 6649 2007-07-11 21:46:42Z mike $" +dnl "$Id: cups-ssl.m4 7241 2008-01-22 22:34:52Z mike $" dnl dnl OpenSSL/GNUTLS stuff for the Common UNIX Printing System (CUPS). dnl @@ -123,5 +123,5 @@ AC_SUBST(EXPORT_SSLLIBS) dnl -dnl End of "$Id: cups-ssl.m4 6649 2007-07-11 21:46:42Z mike $". +dnl End of "$Id: cups-ssl.m4 7241 2008-01-22 22:34:52Z mike $". dnl diff --git a/config.h.in b/config.h.in index 5e0c08af1f..7c54621fcd 100644 --- a/config.h.in +++ b/config.h.in @@ -1,5 +1,5 @@ /* - * "$Id: config.h.in 6930 2007-09-08 00:28:06Z mike $" + * "$Id: config.h.in 7687 2008-06-24 01:28:36Z mike $" * * Configuration file for the Common UNIX Printing System (CUPS). * @@ -571,8 +571,15 @@ #undef HAVE_LRAND48 +/* + * Do we have libusb? + */ + +#undef HAVE_USB_H + + #endif /* !_CUPS_CONFIG_H_ */ /* - * End of "$Id: config.h.in 6930 2007-09-08 00:28:06Z mike $". + * End of "$Id: config.h.in 7687 2008-06-24 01:28:36Z mike $". */ diff --git a/configure.in b/configure.in index 769c53cb98..0425660be9 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ dnl -dnl "$Id: configure.in 6717 2007-07-24 23:47:12Z mike $" +dnl "$Id: configure.in 7600 2008-05-20 21:06:23Z mike $" dnl dnl Configuration script for the Common UNIX Printing System (CUPS). dnl @@ -75,5 +75,5 @@ AC_OUTPUT(Makedefs packaging/cups.list init/cups.sh init/cups-lpd cups-config chmod +x cups-config dnl -dnl End of "$Id: configure.in 6717 2007-07-24 23:47:12Z mike $". +dnl End of "$Id: configure.in 7600 2008-05-20 21:06:23Z mike $". dnl diff --git a/cups-config.in b/cups-config.in index 7f53c60ba8..1a68a12c70 100755 --- a/cups-config.in +++ b/cups-config.in @@ -1,6 +1,6 @@ #! /bin/sh # -# "$Id: cups-config.in 6649 2007-07-11 21:46:42Z mike $" +# "$Id: cups-config.in 7394 2008-03-21 23:41:43Z mike $" # # CUPS configuration utility. # @@ -151,5 +151,5 @@ while test $# -gt 0; do done # -# End of "$Id: cups-config.in 6649 2007-07-11 21:46:42Z mike $". +# End of "$Id: cups-config.in 7394 2008-03-21 23:41:43Z mike $". # diff --git a/cups/Makefile b/cups/Makefile index 3bf135002d..6d4a684813 100644 --- a/cups/Makefile +++ b/cups/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile 6649 2007-07-11 21:46:42Z mike $" +# "$Id: Makefile 7589 2008-05-19 00:13:23Z mike $" # # API library Makefile for the Common UNIX Printing System (CUPS). # @@ -600,5 +600,5 @@ include Dependencies # -# End of "$Id: Makefile 6649 2007-07-11 21:46:42Z mike $". +# End of "$Id: Makefile 7589 2008-05-19 00:13:23Z mike $". # diff --git a/cups/adminutil.c b/cups/adminutil.c index e3adf54b44..95393afd06 100644 --- a/cups/adminutil.c +++ b/cups/adminutil.c @@ -1,5 +1,5 @@ /* - * "$Id: adminutil.c 6930 2007-09-08 00:28:06Z mike $" + * "$Id: adminutil.c 7576 2008-05-15 21:05:14Z mike $" * * Administration utility API definitions for the Common UNIX Printing * System (CUPS). @@ -2382,5 +2382,5 @@ write_option(cups_file_t *dstfp, /* I - PPD file */ /* - * End of "$Id: adminutil.c 6930 2007-09-08 00:28:06Z mike $". + * End of "$Id: adminutil.c 7576 2008-05-15 21:05:14Z mike $". */ diff --git a/cups/adminutil.h b/cups/adminutil.h index 8613a3be4a..145dfa0f73 100644 --- a/cups/adminutil.h +++ b/cups/adminutil.h @@ -1,5 +1,5 @@ /* - * "$Id: adminutil.h 6649 2007-07-11 21:46:42Z mike $" + * "$Id: adminutil.h 7026 2007-10-19 00:57:45Z mike $" * * Administration utility API definitions for the Common UNIX Printing * System (CUPS). @@ -77,5 +77,5 @@ extern int cupsAdminSetServerSettings(http_t *http, #endif /* !_CUPS_ADMINUTIL_H_ */ /* - * End of "$Id: adminutil.h 6649 2007-07-11 21:46:42Z mike $". + * End of "$Id: adminutil.h 7026 2007-10-19 00:57:45Z mike $". */ diff --git a/cups/api-array.header b/cups/api-array.header index 34b796f4cb..c4d28b4647 100644 --- a/cups/api-array.header +++ b/cups/api-array.header @@ -1,5 +1,5 @@