[sane-devel] Scanner buttons (kind of RFC)

Oliver Rauch oliver.rauch@rauch-domain.de
Wed, 11 Sep 2002 12:55:07 +0200


Henning Meier-Geinitz schrieb:
> 
> Hi,
> 
> 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.

That is not the way a backend should be implemented.
The backend should store all backend options until sane_start is called.
When sane_start is called it should transmit all values to the scanner.

This way several frontends can open the same device and the options are
set independant.

On my work I think it is normal that 5 people have the frontend(xsane)
opened at the same time, all use the same scanner.

With network scanning it really would be bad if one opens a frontend
and keeps it running all the time and nobody else is able to use
the scanner because the device file is opend exclusive.

The backend should not open (keep open) the device file until sane_start is called!

If this is not described in the backend-writing texts it has to be
added there, this really is important.

I know that there are some backends that do it different, but that is
not the desired way!

Bye
Oliver

-- 
Homepage:	http://www.rauch-domain.de
sane-umax:	http://www.rauch-domain.de/sane-umax
xsane:		http://www.xsane.org
E-Mail:		mailto:Oliver.Rauch@rauch-domain.de