diff -up -rN cups-1.4.4.orig/backend/Makefile cups-1.4.4/backend/Makefile --- cups-1.4.4.orig/backend/Makefile 2010-06-09 20:58:19.641591399 +1200 +++ cups-1.4.4/backend/Makefile 2010-06-09 20:51:06.025595868 +1200 @@ -267,7 +267,7 @@ usb: usb.o ../cups/$(LIBCUPS) libbackend echo Linking $@... $(CC) $(LDFLAGS) -o usb usb.o libbackend.a $(LIBUSB) \ $(BACKLIBS) $(LIBS) -usb.o: usb.c usb-darwin.c usb-libusb.c usb-unix.c +usb.o: usb.c usb-darwin.c usb-hybrid.c usb-libusb.c usb-unix.c # diff -up -rN cups-1.4.4.orig/backend/ieee1284.c cups-1.4.4/backend/ieee1284.c --- cups-1.4.4.orig/backend/ieee1284.c 2009-12-08 15:13:42.000000000 +1300 +++ cups-1.4.4/backend/ieee1284.c 2010-06-09 20:51:06.357598941 +1200 @@ -255,6 +255,7 @@ backendGetDeviceID( cups_option_t *values; /* Keys and values in device ID */ const char *mfg, /* Manufacturer */ *mdl, /* Model */ + *des, /* Description */ *sern; /* Serial number */ char temp[256], /* Temporary manufacturer string */ *tempptr; /* Pointer into temp string */ @@ -285,10 +286,20 @@ backendGetDeviceID( } else { - strlcpy(temp, make_model, sizeof(temp)); + /* + * No manufacturer? Use the model string or description... + */ + + if (mdl) + _ppdNormalizeMakeAndModel(mdl, temp, sizeof(temp)); + else if ((des = cupsGetOption("DESCRIPTION", num_values, values)) != NULL || + (des = cupsGetOption("DES", num_values, values)) != NULL) + _ppdNormalizeMakeAndModel(des, temp, sizeof(temp)); + else + strlcpy(temp, "Unknown", sizeof(temp)); if ((tempptr = strchr(temp, ' ')) != NULL) - *tempptr = '\0'; + *tempptr = '\0'; mfg = temp; } diff -up -rN cups-1.4.4.orig/backend/usb-hybrid.c cups-1.4.4/backend/usb-hybrid.c --- cups-1.4.4.orig/backend/usb-hybrid.c 1970-01-01 12:00:00.000000000 +1200 +++ cups-1.4.4/backend/usb-hybrid.c 2010-06-09 20:51:06.441597823 +1200 @@ -0,0 +1,88 @@ +/* + * "Id: usb-hybrid.c 8807 2009-08-31 18:45:43Z mike " + * + * USB port backend for the Common UNIX Printing System (CUPS). + * + * This file is included from "usb.c" when compiled on Linux. + * + * 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 + * property of Apple Inc. and are protected by Federal copyright + * law. Distribution and use rights are outlined in the file "LICENSE.txt" + * "LICENSE" which should have been included with this file. If this + * file is missing or damaged, see the license at "http://www.cups.org/". + * + * This file is subject to the Apple OS-Developed Software exception. + * + * Contents: + * + * print_device() - Print a file to a USB device. + * list_devices() - List all USB devices. + */ + +/* + * Include necessary headers. + */ + +#include + +/* + * Include the two USB implementations used under Linux ... + */ + +#define USB_HYBRID 1 +#include "usb-libusb.c" +#include "usb-unix.c" + +/* + * '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 */ +{ + int result; + for(;;) + { + result = print_device_unix(uri, hostname, resource, options, print_fd, + copies, argc, argv); + if (result == -1) + { + result = print_device_libusb(uri, hostname, resource, options, print_fd, + copies, argc, argv); + if (result == -1) + sleep(5); + else + return(result); + } + else + return(result); + } +} + +/* + * 'list_devices()' - List all USB devices. + */ + +void +list_devices(void) +{ + /* Try both discovery methods, each device will appear only under one + of them */ + list_devices_libusb(); + list_devices_unix(); +} + + +/* + * End of "Id: usb-hybrid.c 8807 2009-08-31 18:45:43Z mike ". + */ diff -up -rN cups-1.4.4.orig/backend/usb-libusb.c cups-1.4.4/backend/usb-libusb.c --- cups-1.4.4.orig/backend/usb-libusb.c 2009-09-12 08:03:31.000000000 +1200 +++ cups-1.4.4/backend/usb-libusb.c 2010-06-09 20:51:06.533598662 +1200 @@ -13,16 +13,16 @@ * * Contents: * - * list_devices() - List the available printers. - * print_device() - Print a file to a USB device. + * list_devices_libusb() - List the available printers. + * print_device_libusb() - Print a file to a USB device. * close_device() - Close the connection to the USB printer.