Patch for parallel.c

Godfried cups at gfgf.xs4all.nl
Thu Aug 26 10:12:32 PDT 2004


Hi all,

I found cups very good, there was only one annoying feature/bug. When my printer is off, the backend blocks at a write system call. When I switch on the printer, the job doesn't print well, and I had to restart the job.

I changed the mode of the lp-device to non blocking, and check for EAGAIN. Now it works fine.

I add the diff output.

Perhaps you like it, perhaps 12000 people already changed it, but for me it works great.

Cheers,

Godfried

My config:
Linux tommy 2.4.23 #4 Fri Jul 16 18:05:59 CEST 2004 i686 unknown
Kyocera FS-1010 on /dev/lp0 in ECP-mode

--
tommy:~/download/cups-1.1.20-gf/backend$ diff ../../cups-1.1.20/backend/parallel.c parallel.c
61a62
> #define BLOCK_TRIES 3
96a98
>   int tries;          /* gfgf: NON_BLOCK :) */
209a212
>   fcntl(fd, F_SETFL, O_NONBLOCK);
257a261,262
>       tries = 0;
>
276,277c281,296
<         perror("ERROR: Unable to send print file to printer");
<         break;
---
>         if(errno == EAGAIN)
>         {
>           wbytes = 0;
>           if(tries > BLOCK_TRIES) {
>                 tries = 0;
>                 puts("INFO: device temporary unavailable, retrying in 30 seconds");
>                 sleep(30);
>               } else {
>                 sleep(1);
>                 tries++;
>               }
>         } else
>         {
>           perror("ERROR: Unable to send print file to printer");
>           break;
>         }





More information about the cups mailing list