[cups.bugs] [HIGH] STR #1724: Backchannel data is not read right away

Josh Mathis josh.m at swecoinus.com
Wed May 24 13:12:26 PDT 2006


[STR New]

It appears that the USB backend is not fetching the data from the printer
until the printer driver (filter) has exited (in most cases).

As a test, I modified my filter to just send a status request to the
printer. The printer should return 1 byte in reponse, which I attempt to
read, then exit the filter.

In the error log, I see:

[Job xx] **MY Debug** Wrote status request
[Job xx] **MY Debug** Read -1 backchannel bytes
PID # (my filter) has exited with no errors.
[Job xx] *****DEBUG: Received 1 bytes of back-channel data! 

I set up my filter to try 10 backchannel reads in a row before finally
giving up.

I tried flushing stdout and stderr after every printf to each of those
streams, but with no effect. I then disabled all stream buffering with:

setbuf(stdout, NULL);
setbuf(stderr, NULL);
//and for good measure:
setbuf(stdin, NULL);

After this, the second out of my 10 backchannel reads gets the data back
correctly. No matter the timeout, etc, the first backchannel read will
fail, and the second one seems to always work.

Link: http://www.cups.org/str.php?L1724
Version: 1.2.0





More information about the cups mailing list