[sane-devel] Scanner buttons (kind of RFC)
Wed, 11 Sep 2002 12:27:19 +0200
On Sat, Sep 07, 2002 at 12:27:52AM +0200, Oliver Rauch wrote:
> The button protocoll should not be implemented this way.
> The button protocoll has to be network safe. Imagine what happens
> when 10 frontends poll the buttons at the same time and someone
> does press a button, then up to 10 different people do scan
> the document you want to scan.
Ok, it's obvious that this has to be avoided. I didn't think about
this issue because my scanners don't have buttons.
> We need a locking function that only one frontend is able to
> ask for the button status.
Do we really need an explicit locking function? Can't we just state in
the description of the button option that backends using this option
must lock the device between sane_open and sane_close (e.g. by
exclusively opening the device file)? That's already done by e.g. the
mustek_usb backend. And it's necessary anyway if the backend
contacts the scanner before sane_start (e.g. to read or set option
values). Otherwise one frontend could set brightness to e.g. 50 while
the other one changes it to 100 and the first frontend doesn't know
and just starts scanning.