- Retry when connecting to device fails (bug #532112).

This commit is contained in:
Tim Waugh 2010-01-05 15:19:52 +00:00
parent 3c9d434ca5
commit b7f8884abe
2 changed files with 35 additions and 0 deletions

30
hplip-retry-open.patch Normal file
View File

@ -0,0 +1,30 @@
diff -up hplip-3.9.8/prnt/backend/hp.c.retry-open hplip-3.9.8/prnt/backend/hp.c
--- hplip-3.9.8/prnt/backend/hp.c.retry-open 2010-01-05 15:11:56.045911892 +0000
+++ hplip-3.9.8/prnt/backend/hp.c 2010-01-05 15:12:04.236911642 +0000
@@ -724,11 +724,21 @@ int main(int argc, char *argv[])
/* Open hp device. */
while ((stat = hpmud_open_device(argv[0], ma.prt_mode, &hd)) != HPMUD_R_OK)
{
- if (stat != HPMUD_R_DEVICE_BUSY)
- {
- BUG("ERROR: cannot open device stat=%d: %s\n", stat, argv[0]);
- goto bugout;
- }
+ if (getenv ("CLASS") != NULL)
+ {
+ /* If the CLASS environment variable is set we
+ * need to give other class members a chance in
+ * case their devices are ready to go.
+ */
+
+ BUG("INFO: cannot open device stat=%d: %s\n", stat, argv[0]);
+ BUG("INFO: queuing on next printer in class...\n");
+
+ /* Prevent job requeuing too quickly. */
+ sleep (5);
+
+ goto bugout;
+ }
/* Display user error. */
device_event(argv[0], printer, 5000+stat, argv[2], argv[1], argv[3]);

View File

@ -20,6 +20,7 @@ Patch4: hplip-no-asm.patch
Patch5: hplip-clear-previous-state-reasons.patch
Patch6: hplip-state-reasons-newline.patch
Patch7: hplip-parenths.patch
Patch8: hplip-retry-open.patch
Patch9: hplip-requirespageregion.patch
Patch10: hplip-discovery-method.patch
Patch11: hplip-device-reconnected.patch
@ -136,6 +137,9 @@ rm -rf $RPM_BUILD_DIR/%{name}-%{version}
# Fixed typos in page sizes (bug #515469).
%patch7 -p1 -b .parenths
# Retry when connecting to device fails (bug #532112).
%patch8 -p1 -b .retry-open
# Set RequiresPageRegion in hpcups PPDs (bug #518756).
%patch9 -p1 -b .requirespageregion
@ -367,6 +371,7 @@ fi
%changelog
* Tue Jan 5 2010 Tim Waugh <twaugh@redhat.com> - 3.9.8-26
- Retry when connecting to device fails (bug #532112).
- Don't ship PolicyKit mechanism (bug #551773).
- Don't run automake/autoconf etc as it causes build failures.