- Better paper-out detection patch still (bug #246222).

This commit is contained in:
Tim Waugh 2007-07-04 12:21:44 +00:00
parent e29fcb789e
commit 812ed7011a
2 changed files with 33 additions and 12 deletions

View File

@ -1,5 +1,5 @@
--- cups-1.2.10/backend/runloop.c.usb-paperout 2006-12-06 20:10:16.000000000 +0000 --- cups-1.2.10/backend/runloop.c.usb-paperout 2006-12-06 20:10:16.000000000 +0000
+++ cups-1.2.10/backend/runloop.c 2007-05-29 19:21:32.000000000 +0100 +++ cups-1.2.10/backend/runloop.c 2007-07-04 12:12:00.000000000 +0100
@@ -40,6 +40,14 @@ @@ -40,6 +40,14 @@
#endif /* __hpux */ #endif /* __hpux */
@ -25,7 +25,7 @@
fprintf(stderr, "DEBUG: backendRunLoop(print_fd=%d, device_fd=%d, use_bc=%d)\n", fprintf(stderr, "DEBUG: backendRunLoop(print_fd=%d, device_fd=%d, use_bc=%d)\n",
@@ -110,12 +121,9 @@ @@ -110,8 +121,6 @@
FD_ZERO(&input); FD_ZERO(&input);
if (!print_bytes) if (!print_bytes)
FD_SET(print_fd, &input); FD_SET(print_fd, &input);
@ -33,13 +33,20 @@
- FD_SET(device_fd, &input); - FD_SET(device_fd, &input);
FD_ZERO(&output); FD_ZERO(&output);
- if (print_bytes || !use_bc) if (print_bytes || !use_bc)
- FD_SET(device_fd, &output); @@ -119,7 +128,10 @@
+ FD_SET(device_fd, &output);
if (use_bc) if (use_bc)
{ {
@@ -141,14 +149,24 @@ - if (select(nfds, &input, &output, NULL, NULL) < 0)
+ struct timeval fives;
+ fives.tv_sec = 5;
+ fives.tv_usec = 0;
+ if (select(nfds, &input, &output, NULL, &fives) < 0)
{
/*
* Pause printing to clear any pending errors...
@@ -141,14 +153,24 @@
* Check if we have back-channel data ready... * Check if we have back-channel data ready...
*/ */
@ -70,7 +77,18 @@
} }
} }
@@ -227,6 +245,9 @@ @@ -219,6 +241,10 @@
offline = 1;
}
}
+ else if (linux_usb_paperout_hack && errno == EAGAIN)
+ {
+ sleep (1);
+ }
else if (errno != EAGAIN && errno != EINTR && errno != ENOTTY)
{
perror("ERROR: Unable to write print data");
@@ -227,6 +253,9 @@
} }
else else
{ {
@ -80,7 +98,7 @@
if (paperout) if (paperout)
{ {
fputs("STATE: -media-empty-error\n", stderr); fputs("STATE: -media-empty-error\n", stderr);
@@ -247,7 +268,42 @@ @@ -247,7 +276,42 @@
total_bytes += bytes; total_bytes += bytes;
} }
} }
@ -90,7 +108,7 @@
+ { + {
+ time_t now; + time_t now;
+ if (!paperout && + if (!paperout &&
+ ((now = time(NULL)) - last_write) > 5) + ((now = time(NULL)) - last_write) >= 5)
+ { + {
+ unsigned int status; + unsigned int status;
+ if (ioctl (device_fd, LPGETSTATUS, &status) == 0 && + if (ioctl (device_fd, LPGETSTATUS, &status) == 0 &&
@ -123,8 +141,8 @@
/* /*
* Return with success... * Return with success...
--- cups-1.2.10/backend/usb-unix.c.usb-paperout 2007-05-29 19:10:08.000000000 +0100 --- cups-1.2.10/backend/usb-unix.c.usb-paperout 2007-07-04 12:11:46.000000000 +0100
+++ cups-1.2.10/backend/usb-unix.c 2007-05-29 19:10:08.000000000 +0100 +++ cups-1.2.10/backend/usb-unix.c 2007-07-04 12:11:46.000000000 +0100
@@ -39,6 +39,11 @@ @@ -39,6 +39,11 @@
#include "ieee1284.c" #include "ieee1284.c"
#include <sys/select.h> #include <sys/select.h>

View File

@ -6,7 +6,7 @@
Summary: Common Unix Printing System Summary: Common Unix Printing System
Name: cups Name: cups
Version: 1.2.11 Version: 1.2.11
Release: 3%{?dist} Release: 4%{?dist}
License: GPL License: GPL
Group: System Environment/Daemons Group: System Environment/Daemons
Source: ftp://ftp.easysw.com/pub/cups/%{version}/cups-%{version}-source.tar.bz2 Source: ftp://ftp.easysw.com/pub/cups/%{version}/cups-%{version}-source.tar.bz2
@ -445,6 +445,9 @@ rm -rf $RPM_BUILD_ROOT
%{cups_serverbin}/daemon/cups-lpd %{cups_serverbin}/daemon/cups-lpd
%changelog %changelog
* Wed Jul 4 2007 Tim Waugh <twaugh@redhat.com> 1:1.2.11-4
- Better paper-out detection patch still (bug #246222).
* Fri Jun 29 2007 Tim Waugh <twaugh@redhat.com> 1:1.2.11-3 * Fri Jun 29 2007 Tim Waugh <twaugh@redhat.com> 1:1.2.11-3
- Applied patch to fix group handling in PPDs (bug #186231, STR #2408). - Applied patch to fix group handling in PPDs (bug #186231, STR #2408).