/*
- * "$Id$"
- *
* LIBUSB interface code for CUPS.
*
- * Copyright 2007-2014 by Apple Inc.
+ * Copyright 2007-2015 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
#include <libusb.h>
#include <cups/cups-private.h>
+#include <cups/ppd-private.h>
#include <cups/dir.h>
#include <pthread.h>
#include <sys/select.h>
#define USB_QUIRK_USB_INIT 0x0010 /* Needs vendor USB init string */
#define USB_QUIRK_VENDOR_CLASS 0x0020 /* Descriptor uses vendor-specific
Class or SubClass */
+#define USB_QUIRK_DELAY_CLOSE 0x0040 /* Delay close */
#define USB_QUIRK_WHITELIST 0x0000 /* no quirks */
* Close the connection and input file and general clean up...
*/
+ if (g.printer->quirks & USB_QUIRK_DELAY_CLOSE)
+ sleep(1);
+
close_device(g.printer);
/*
write_endp = endp;
}
- if (write_endp >= 0)
+ if (write_endp != 0xff)
{
/*
* Save the best match so far...
if (strstr(line, " blacklist"))
quirk->quirks |= USB_QUIRK_BLACKLIST;
+ if (strstr(line, " delay-close"))
+ quirk->quirks |= USB_QUIRK_DELAY_CLOSE;
+
if (strstr(line, " no-reattach"))
quirk->quirks |= USB_QUIRK_NO_REATTACH;
else
{
printer->usblp_attached = 0;
- fprintf(stderr, "DEBUG: Failed to check whether %04x:%04x has the \"usblp\" kernel module attached\n",
- devdesc.idVendor, devdesc.idProduct);
- goto error;
+
+ if (errcode != LIBUSB_ERROR_NOT_SUPPORTED)
+ {
+ fprintf(stderr,
+ "DEBUG: Failed to check whether %04x:%04x has the \"usblp\" "
+ "kernel module attached\n", devdesc.idVendor, devdesc.idProduct);
+ goto error;
+ }
}
/*
goto error;
}
+ else if ((errcode = libusb_detach_kernel_driver(printer->handle, printer->iface)) < 0)
+ {
+ fprintf(stderr,
+ "DEBUG: Failed to detach \"usblp\" module from %04x:%04x\n",
+ devdesc.idVendor, devdesc.idProduct);
+
+ goto error;
+ }
+
+ sleep (1);
}
/*
return (errcode);
}
-
-
-/*
- * End of "$Id$".
- */
-