diff --git a/cups-usb-paperout.patch b/cups-usb-paperout.patch index 2259719..f62952f 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-04-25 18:00:59.000000000 +0100 ++++ cups-1.2.10/backend/runloop.c 2007-05-29 19:21:32.000000000 +0100 @@ -40,6 +40,14 @@ #endif /* __hpux */ @@ -25,7 +25,52 @@ fprintf(stderr, "DEBUG: backendRunLoop(print_fd=%d, device_fd=%d, use_bc=%d)\n", -@@ -227,6 +238,9 @@ +@@ -110,12 +121,9 @@ + FD_ZERO(&input); + if (!print_bytes) + FD_SET(print_fd, &input); +- if (use_bc) +- FD_SET(device_fd, &input); + + FD_ZERO(&output); +- if (print_bytes || !use_bc) +- FD_SET(device_fd, &output); ++ FD_SET(device_fd, &output); + + if (use_bc) + { +@@ -141,14 +149,24 @@ + * Check if we have back-channel data ready... + */ + +- if (FD_ISSET(device_fd, &input)) ++ if (use_bc && FD_ISSET(device_fd, &output)) /* finished writing */ + { +- if ((bc_bytes = read(device_fd, bc_buffer, sizeof(bc_buffer))) > 0) ++ struct timeval nowait; ++ fd_set readback; ++ FD_ZERO (&readback); ++ nowait.tv_sec = 0; ++ nowait.tv_usec = 0; ++ FD_SET(device_fd, &readback); ++ if (select (device_fd + 1, &readback, NULL, NULL, &nowait) && ++ FD_ISSET(device_fd, &readback)) + { +- fprintf(stderr, +- "DEBUG: Received " CUPS_LLFMT " bytes of back-channel data!\n", +- CUPS_LLCAST bc_bytes); +- cupsBackChannelWrite(bc_buffer, bc_bytes, 1.0); ++ if ((bc_bytes = read(device_fd, bc_buffer, sizeof(bc_buffer))) > 0) ++ { ++ fprintf(stderr, ++ "DEBUG: Received " CUPS_LLFMT " bytes of back-channel data!\n", ++ CUPS_LLCAST bc_bytes); ++ cupsBackChannelWrite(bc_buffer, bc_bytes, 1.0); ++ } + } + } + +@@ -227,6 +245,9 @@ } else { @@ -35,7 +80,7 @@ if (paperout) { fputs("STATE: -media-empty-error\n", stderr); -@@ -247,7 +261,42 @@ +@@ -247,7 +268,42 @@ total_bytes += bytes; } } @@ -78,8 +123,8 @@ /* * Return with success... ---- cups-1.2.10/backend/usb-unix.c.usb-paperout 2007-04-25 17:50:06.000000000 +0100 -+++ cups-1.2.10/backend/usb-unix.c 2007-04-25 17:50:06.000000000 +0100 +--- 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 @@ -39,6 +39,11 @@ #include "ieee1284.c" #include diff --git a/cups.spec b/cups.spec index 083de19..7e0e32c 100644 --- a/cups.spec +++ b/cups.spec @@ -6,7 +6,7 @@ Summary: Common Unix Printing System Name: cups Version: 1.2.10 -Release: 11%{?dist} +Release: 12%{?dist} License: GPL Group: System Environment/Daemons Source: ftp://ftp.easysw.com/pub/cups/%{version}/cups-%{version}-source.tar.bz2 @@ -157,7 +157,7 @@ lpd emulation. %patch22 -p1 -b .af_unix-auth %patch23 -p1 -b .str2323 %patch24 -p1 -b .str2109 -#%patch25 -p1 -b .usb-paperout +%patch25 -p1 -b .usb-paperout %patch26 -p1 -b .str2348 %patch27 -p1 -b .adminutil @@ -446,6 +446,9 @@ rm -rf $RPM_BUILD_ROOT %{cups_serverbin}/daemon/cups-lpd %changelog +* Mon Jun 11 2007 Tim Waugh 1:1.2.10-12 +- Better paper-out detection patch (bug #241589). + * Mon May 21 2007 Tim Waugh 1:1.2.10-11 - Fixed _cupsAdminSetServerSettings() sharing/shared handling (bug #238057).