[sane-devel] Scanner buttons (kind of RFC)
Wed, 11 Sep 2002 14:58:26 +0200
On Wed, Sep 11, 2002 at 12:55:07PM +0200, Oliver Rauch wrote:
> 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.
Or ask the users to close the fronend once they have finished
scanning. As scanning involves physically going to the scanner (or at
least telling someone to go there to insert a paper/film) it's a bit
different than using a printer in my opinion. Manual "locking" by
opening the frontend is not that bad in this case.
> 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!
Depends on what is more important for you. There is not only the
privacy problem, you don't even know if the scanner you want to use is
the same, after you have closed the device file.
This is especially a problem with hot-pluggable devices like USB. If
you keep the device file open, you will get an error if the device was
unplugged and another one was plugged during sane_open and sane_start.
If you close the file, you have to redo all the detection and
calibration stuff every time you open it because you don't know if
it's the same device. If there are two identical devices connected, you
can't even distinguish them with vendor/product ids.
I don't even know if reading the button's status works like this (open
device -- read status --close device). At least the buttons of the
lm983x based scanners will have to be set up before they can be used
and maybe even the scanner will have to be reset. You don't know the
status of the scanner, if you close the device file.