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

Oliver Rauch oliver.rauch@rauch-domain.de
Wed, 11 Sep 2002 22:30:54 +0200

Matto Marjanovic schrieb:

> I don't see how not locking the device continuously from sane_open() to
>  sane_close() has any advantage, aside from not requiring users to quit
>  xsane when they are done with a job.

You ask the wrong question. The people do not close their frontend and this
would make it impossible for the others to scan when the device is locked.

>    b)  With ADF or automatic slide feeding, the document state is even more
>         complex, because multiple sane_start()'s need to be called by the
>         same user, sequentially.
As I already wrote it makes sense to keep the deviced locked while an adf scan.
But it is not necessary to lock the device in sane_open, it is ok to lock it
in the first sane_start and release it when the scan is complete in sane_cancel.

>    c)  Some scanners have internal state (which is not necessarily accessible
>         by the driver).  For example, the microtek backend keeps track of
>         whether or not the scanner has calibrated itself for particular mode.
>         By skipping calibration later, the backend saves time; but if the
>         scanner has become calibrated for the wrong mode, it locks up.  The
>         backend thus has to maintain control of the entire session, since
>         it can't read this state from the scanner.

Also no problem.
When you start a new session (the device is not locked when sane_start is called)
then you have to do a new calibration. In general it is senseless to skip calibration
for longer than e.g. half an hour because the light of the lamp does change in this
time so it is necessary to do a new claibration.

> With the scanner, when someone opens up a frontend to it, they should be
>  effectively reserving/holding the scanner for their exclusive use.  Then
>  they disconnect the frontend (e.g. quit) when they are done.  If someone
>  else tries to connect in the meantime, they will discover that the scanner
>  is already in use by someone else, so they wait.

You do not understand that the people do not behave like you expect.
The first one opens the frontend and keeps it running and nobody else is
able to scan. Then I do not need a scanner at all.

> An idea, perhaps for SANE2:  a fancy saned could actually maintain a queue
>  of clients waiting to use the scanner.  This would be great in a large
>  multi-user facility.  If multiple users try to claim the same scanner,
>  the requests line up (with a "pending/waiting/in-use-by-X" message given),
>  and when the scanner is released by the last person, it becomes locked by
>  the next person in line.

This also does not solve the problem:
When the first one who locked the device does close the frontend then the
next one gets access but he may be at lunch when he gets access. This
does not solve anything.


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