From fc487781b9d55f885474d898cdc1bdfd84ec7647 Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Jul 04 2007 12:20:56 +0000 Subject: - Better paper-out detection patch still (bug #246222). --- diff --git a/cups-usb-paperout.patch b/cups-usb-paperout.patch index f62952f..82123f4 100644 --- a/cups-usb-paperout.patch +++ b/cups-usb-paperout.patch @@ -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 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 @@ #endif /* __hpux */ @@ -25,7 +25,7 @@ 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); if (!print_bytes) FD_SET(print_fd, &input); @@ -33,13 +33,20 @@ - FD_SET(device_fd, &input); FD_ZERO(&output); -- if (print_bytes || !use_bc) -- FD_SET(device_fd, &output); -+ FD_SET(device_fd, &output); + if (print_bytes || !use_bc) +@@ -119,7 +128,10 @@ 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... */ @@ -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 { @@ -80,7 +98,7 @@ if (paperout) { fputs("STATE: -media-empty-error\n", stderr); -@@ -247,7 +268,42 @@ +@@ -247,7 +276,42 @@ total_bytes += bytes; } } @@ -90,7 +108,7 @@ + { + time_t now; + if (!paperout && -+ ((now = time(NULL)) - last_write) > 5) ++ ((now = time(NULL)) - last_write) >= 5) + { + unsigned int status; + if (ioctl (device_fd, LPGETSTATUS, &status) == 0 && @@ -123,8 +141,8 @@ /* * 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 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-07-04 12:11:46.000000000 +0100 @@ -39,6 +39,11 @@ #include "ieee1284.c" #include diff --git a/cups.spec b/cups.spec index 54133ad..af07d1a 100644 --- a/cups.spec +++ b/cups.spec @@ -445,6 +445,9 @@ rm -rf $RPM_BUILD_ROOT %{cups_serverbin}/daemon/cups-lpd %changelog +* Wed Jul 4 2007 Tim Waugh +- Better paper-out detection patch still (bug #246222). + * Fri Jun 29 2007 Tim Waugh 1:1.2.11-2 - Applied patch to fix group handling in PPDs (bug #186231, STR #2408).