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

Sam Hanes sam at maltera.com
Tue Aug 9 10:01:29 PDT 2016


On 08/09/2016 03:42 AM, 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


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.

--
Sam Hanes



More information about the cups mailing list