[sane-devel] sane_cancel and sane_read

Wittawat Yamwong wy-sane-devel at arcor.de
Fri May 12 09:05:41 UTC 2006

On Tuesday 09 May 2006 19:44, Henning Meier-Geinitz wrote:
> [...]
> Why not just kill the reader process in sane_cancel? Do you think the
> way this is done in the existing backends (e.g. mustek) is wrong?

I've implemented a reader process like mustek.c in my backend. Everything 
seems to work and should conform to SANE standard now. Although things become 
more complex and more difficult to debug, I hope I've done it right.

I've also looked at genesis backend. It doesn't implement a reader process 
like mustek backend. From what I see, it does not fork. It would be much more 
easier for me if I can go this way. (I personally would rather avoid forking 
approach in the driver backend if I could.) The backend seems to carry out 
the cancellation request in sane_cancel(). What I don't understand from the 
code is how the driver synchronizes sane_cancel() with the rest of the 
driver? Could someone give me a hint, please.

For pixma devices, a command transaction can be divided into 2 phases, request 
and respone. The transaction must be atomic. I had designed my core driver so 
that the cancel() function just posts a cancellation request. When a safe 
cancellation point is reached, the request will be carried out.

Wittawat Yamwong
Hannover, Germany

More information about the sane-devel mailing list