[sane-devel] sane_cancel() functionality

Kåre Särs kare.sars at iki.fi
Thu Mar 4 12:44:56 UTC 2010


I wanted to implement support for the "wait for button" option, available at 
least in epson2 and epkowa backends, but I have a problem with sane_cancel().

If the "wait for button"  parameter is set to true, sane (the backend) stops 
at sane_start() and waits for the user to press the button on the scanner. 

Now, if the user decides that he/she wants to cancel the scan, it does not 
seem possible to do it without pressing the button on the scanner. With the 
epson2 backend sane_cancel() did not return before  the button was pressed and 
with the epkowa backend sane_cancel() did return, but sane_start() did not.

In an earlier version of libksane, I tried to use sane_cancel() from a 
different thread, but that resulted in segmentation faults. So this time I 
tried to ensure that sane_cancel() only would be called once while the scan 
thread is waiting for sane_start() to return.

What is the status on sane_cancel() and thread safety? 

Should sane_start() return if sane_cancel() is called?


More information about the sane-devel mailing list