[sane-devel] Uninterrupted HP LaserJet M1005 Backend

Couriousous couriousous at mandriva.org
Thu Jan 31 22:42:06 UTC 2008

> > If break scaning with signal 2, then see next:
> >
> >     1. backend stalled into sane_cancel.get_data... - next step only
> > 'killall scanimage'
> Ok, this is because sane_cancel() is called from a signal handler. I've
> re-read the sane API documentation and the backend should handle that.

Here is a fix. I've re-re-read the sane API doc more carefully and 
sane_cancel() can only initiate the canceling. So I use a flag to tell 
sane_read() to cancel the scan. 

I'm not completly happy with this solution since a race condition is possible 
if sane_cancel() is called after the last test of sane_read().

Moreover if sane_cancel() is called synchronously between sane_start() and 
sane_read(), the canceling will only be done at sane_close() call...

So, comments are really welcome !

-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-cancel.patch
Type: text/x-diff
Size: 2104 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20080131/55ced976/attachment.patch 

More information about the sane-devel mailing list