[sane-devel] Re: How to link the Scan Button of CX3100 to a linux application?

m. allan noah anoah@pfeiffer.edu
Tue, 27 Jan 2004 11:10:35 -0500 (EST)

this also is an issue for any other scanners that have buttons, esp. the 
adf models. unfortunately, i dont see a good way to handle multiple 
scanners, since a frontend would have to load and unload multiple 
backends many times per minute to monitor buttons...

what about a simple frontend that forks a separate child to load each 
backend, and the child exit(1) if no scanners are found, or stays running 
if there are. (might have to fork off child for each scanner not just 
each backend)

then each child could monitor it's scanner by looking at the option 
descriptor for each button (we would have to decide what to call them) 
every couple seconds.

when a child decides a button is pressed, it would exec() to a program of 
the user's choice.

problems with this idea include: what to do on a multi-user system, esp w/ 
regard to X windows, how do we decide which scanning frontend to run on 
which button event for each scanner, and what to do about scanners with 
lots of buttons and wheels and such.


On Tue, 27 Jan 2004, Olaf Meeuwissen wrote:

> Karl Heinz Kremer <khk@khk.net> writes:
> > I assume this is an EPSON CX-3100. In this case, the scanner does not
> > send anything when you press the button. The Windows software checks
> > every half second or second or so to find out if the button was
> > pressed.
> With most of the more recent scanners and all-in-ones, including the
> 3200PHOTO and the CX-3100, pressing the scan button starts the EPSON
> Smart Panel application under Windows.
> Obviously, doing something like this under a Unix-like OS, or any true
> multi-user OS for that matter, is just plain ... eh ... stupid because
> there is absolutely no knowing for which user you need to fire up the
> app.  Let alone trying to figure at on which terminal.
> Per user daemons polling for a button event to start an application
> won't work either because there may be any number of such daemons
> running (so you might as well use a single system-wide one).
> If anyone thinks otherwise, I'd like to know.
> The best one can probably do is what Karl has done in the epson
> backend (and I merged into the epkowa backend with iscan-1.6.0) is
> have the user set up the scan and tell the backend to wait until the
> button is pressed before commencing the scan.
> We are contemplating additional GUI bells and whistles for "Image
> Scan! for Linux" for this functionality but haven't quite made up our
> minds as to the most natural way of doing this.  There's also the case
> of the most desired behaviour when using the ADF ...
> Needless to say, your suggestions are welcome ;-)
> > The problem with handling buttons with Sane is that we don't have an
> > API for this, so every backend would potentially handle this
> > differently. Also, there is no official way to communicate a button
> > event to a frontend.
> >
> > The EPSON backend has a mode where you can setup your scan, and then
> > configure it to wait for a button event. This would not allow you to
> > send the scans to another application, but it's a start :-)
> >
> >
> > On Jan 26, 2004, at 2:12 PM, Till Kamppeter wrote:
> >
> >> I recommend that you post this on the SANE mailing list
> >> (http://www.sane-project.org/), as this is a scanning problem. I am
> >> CCing this posting to there.
> >>
> >> AFAIK noone has written a driver for scanner buttons yet (also not
> >> for other scanner models). The scanner probably sends a certain
> >> signal through the USB which is caught by a background process under
> >> Windows. This process then starts a program to do the scan. The best
> >> way to write a similar program under Linux is to use a USB sniffer
> >> to analyze how the signal looks like and then write a daemon which
> >> listens for such signals.
> >>
> >>    Till
> >>
> >> Alton Hernandez wrote:
> >>> Hi,
> >>> Can anyone tell me how I can link the Scan Button of CX3100 to a Linux
> >>> application?  I believe in the Windows environment, you can just
> >>> press this
> >>> button and the printer will scan the document and send it to your
> >>> application
> >>> of choice.  But in Linux, this button seems to be useless because
> >>> it does not
> >>> do anything.

"so don't tell us it can't be done, putting down what you don't know.
money isn't our god, integrity will free our souls" - Max Cavalera