[cups-devel] The difference of data sent on macOS and Linux

DanTan at pek.destiny.com.cn DanTan at pek.destiny.com.cn
Tue Aug 9 22:44:58 PDT 2016


Dear Sam,

Thank you for your reply. I have tried your suggest, but it doesn’t work.

On Aug 10, 2016, at 1:01 AM, Sam Hanes <sam at maltera.com<mailto:sam at maltera.com>> wrote:

On 08/09/2016 03:42 AM, DanTan at pek.destiny.com.cn<mailto:DanTan at pek.destiny.com.cn> wrote:
I am developing a raster driver (filter) with same code on both macOS
and Linux. In the code I flush stdout every time with a page end. I
wish CUPS will send the page data to printer, so when the driver
handing the next page, the printer can print the current page. The
design is good on Linux, but on macOS, CUPS didn’t send the data,
until filter exit (Check on macOS 10.10.5).

Flushing stdout in your filter will ensure that all the data you've
written up to that point is sent along to the next filter in the
pipeline, but it doesn't force any subsequent filters to flush *their*
buffers so it won't necessarily result in getting everything sent to the
printer.

So, I wonder, if there is a way for filter to force CUPS to send the
data to printer on macOS, or it just a different behavior on
different OS.

If you're the last filter before the backend (which I think should be
the case if you're writing a raster driver and don't use a port
monitor), you can cause the backend to flush its buffers with the
`DRAIN_OUTPUT` command via `cupsSideChannelDoRequest`.

For more info on that, see the documentation:
https://www.cups.org/documentation.php/doc-2.1/api-filter.html#DRAIN_OUTPUT
https://www.cups.org/documentation.php/doc-2.1/api-filter.html#cupsSideChannelDoRequest

Yes, I have tried cupsSideChannelDoRequest with DRAIN_OUTPUT, but it doesn’t work yet.
CUPS debug log as follow, it shows the command is OK.
……….
D [10/Aug/2016:13:41:51 +0800] [Job 77] Read 660 bytes of print data...
D [10/Aug/2016:13:41:51 +0800] [Job 77] Wrote 660 bytes of print data...
D [10/Aug/2016:13:41:51 +0800] [Job 77] backendDrainOutput(print_fd=0, device_fd=8)
……...



If you're not the last filter before the backend I'm not aware of any
way to force a flush of the entire filter pipeline. I'm just a filter
developer, though, not a member of the CUPS project, so one of them may
get back to you with more information.

As the "Figure 1: Raster Filter Chain" in https://www.cups.org/documentation.php/doc-2.1/raster-driver.html#BASICS,
except the “Optional Port Monitor”, the raster filter should be the last filter before backend.
--
Sam Hanes
_______________________________________________
cups-devel mailing list
cups-devel at cups.org<mailto:cups-devel at cups.org>
https://www.cups.org/mailman/listinfo/cups-devel



===========================
Unus pro omnibus, omnes pro uno
-Dan✉


________________________________

The information contained in this transmission may contain privileged and confidential information. It is intended only for the use of the person(s) named above. If you are not the intended recipient, you are hereby notified that any review, dissemination, distribution or duplication of this communication is strictly prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.

本郵件(含所有附件)包含受法律保護以及機密之資訊,僅供本郵件指定的收件人使用。如果您並非指定的收件人,請立即以電子郵件通知寄件人,並將本郵件及所有複印本刪除。請注意,非經授權,嚴格禁止閱覽、散播、散佈或複製本郵件及其內容。


More information about the cups-devel mailing list