--- backend/usb-libusb.c~ 2011-06-15 01:03:29.000000000 +0200 +++ backend/usb-libusb.c 2011-10-20 11:56:15.101500474 +0200 @@ -32,6 +32,7 @@ #include #include #include +#include /* @@ -119,6 +120,27 @@ sleep(5); } + /* + * Reset printer device ... + */ + + if (usb_reset(printer->handle) < 0) + { + _cupsLangPrintFilter(stderr, "ERROR", + _("Unable to reset printer.")); + } + /* we have to close and reopen the device after the reset, but + for reopening it we cannot do a simple "open_device(printer, 1)" + as with this some printers, like the HP LaserJet 3390, crash and + reboot and the job gets dropped. Therefore we need to reinitialize + the connection by calling "find_device(print_cb, uri)" again. */ + close_device(printer); + while ((printer = find_device(print_cb, uri)) == NULL) + { + _cupsLangPrintFilter(stderr, "INFO", + _("Waiting for printer to become available.")); + sleep(5); + } /* * If we are printing data from a print driver on stdin, ignore SIGTERM