diff --git a/hplip-device-reconnected.patch b/hplip-device-reconnected.patch new file mode 100644 index 0000000..ccb7fa9 --- /dev/null +++ b/hplip-device-reconnected.patch @@ -0,0 +1,35 @@ +diff -up hplip-3.9.8/prnt/backend/hp.c.device-reconnected hplip-3.9.8/prnt/backend/hp.c +--- hplip-3.9.8/prnt/backend/hp.c.device-reconnected 2009-09-29 16:02:14.717467334 +0100 ++++ hplip-3.9.8/prnt/backend/hp.c 2009-09-29 16:02:20.019342096 +0100 +@@ -638,6 +638,7 @@ int main(int argc, char *argv[]) + HPMUD_DEVICE hd=-1; + HPMUD_CHANNEL cd=-1; + int n, total=0, retry=0, size, pages; ++ int consecutive_failures=0; + enum HPMUD_RESULT stat; + char *printer = getenv("PRINTER"); + +@@ -789,10 +790,23 @@ int main(int argc, char *argv[]) + /* IO error, get printer status. */ + if (loop_test(hd, cd, &pa, argv[0], printer, argv[2], argv[1], argv[3])) + goto bugout; ++ ++ if (++consecutive_failures == 5) ++ { ++ /* hpmud_write_channel has failed several times in ++ * succession but the Device ID-based status says ++ * the printer is happy. Time to face the fact that ++ * the device has probably reconnected, and our USB ++ * channel is invalidated. */ ++ ++ BUG("ERROR: device reconnected?"); ++ goto bugout; ++ } + } + else + { + /* Data was sent to device successfully. */ ++ consecutive_failures = 0; + if (pa.pjl_device) + { + /* Laserjets have a large data buffer, so manually check for operator intervention condition. */ diff --git a/hplip.spec b/hplip.spec index 787541c..504174f 100644 --- a/hplip.spec +++ b/hplip.spec @@ -1,7 +1,7 @@ Summary: HP Linux Imaging and Printing Project Name: hplip Version: 3.9.8 -Release: 16%{?dist} +Release: 17%{?dist} License: GPLv2+ and MIT Group: System Environment/Daemons Conflicts: system-config-printer < 0.6.132 @@ -23,6 +23,7 @@ Patch7: hplip-parenths.patch Patch8: hplip-non-scripts.patch Patch9: hplip-requirespageregion.patch Patch10: hplip-discovery-method.patch +Patch11: hplip-device-reconnected.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires(pre): /sbin/service @@ -142,6 +143,9 @@ rm -rf $RPM_BUILD_DIR/%{name}-%{version} # Fixed hp-setup traceback when discovery page is skipped (bug #523685). %patch10 -p1 -b .discovery-method +# Give up trying to print a job to a reconnected device (bug #515481). +%patch11 -p1 -b .device-reconnected + %build aclocal automake --foreign --add-missing --copy @@ -345,6 +349,9 @@ fi /usr/bin/update-desktop-database &>/dev/null ||: %changelog +* Tue Sep 29 2009 Tim Waugh 3.9.8-17 +- Give up trying to print a job to a reconnected device (bug #515481). + * Wed Sep 23 2009 Tim Waugh 3.9.8-16 - Enable parallel port support when configuring (bug #524979).