- Give up trying to print a job to a reconnected device (bug #515481).

This commit is contained in:
Tim Waugh 2009-09-29 15:25:47 +00:00
parent 0eb82f0532
commit 17e0925125
2 changed files with 43 additions and 1 deletions

View File

@ -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. */

View File

@ -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 <twaugh@redhat.com> 3.9.8-17
- Give up trying to print a job to a reconnected device (bug #515481).
* Wed Sep 23 2009 Tim Waugh <twaugh@redhat.com> 3.9.8-16
- Enable parallel port support when configuring (bug #524979).