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

Bjoern Brill brill@fs.math.uni-frankfurt.de
Tue, 27 Jan 2004 19:00:42 +0100 (CET)

[I've cut CCs to people who I know to be on sane-devel]

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).
AFAIR, the SANE 2 proposal contains a provision whereby a frontend would
have to obtain an exclusive lock on a scanner's buttons before polling
them (and a mechanism to steal the lock after a timeout so noone can block
the device forever by forgetting to close the frontend).
I didn't like the technical implementation in the proposal, but the
idea seems OK.

> If anyone thinks otherwise, I'd like to know.
I think it is OK to cover only a few common setups. Two which come to
1.) "home use": scanner is accessible only from the PC it's
    attached to, and that PC has no more than one user logged in at any
    given time (typically with an X session). In this case, a per user
    daemon with session lifetime does the job even without locking.

2.) "large office": scanner is networked, accessible from many different
    terminals. People have to walk several metres to the scanner, maybe
    even into a different room. In this case, a simple remote control
    feature like the one described below (set up scan parameters from
    terminal, scan once for every scanner button press) would be extremely
       With increasing distance from terminal to scanner, more complex
    remote control functionality becomes convenient, e.g. walk up to the
    scanner with a bunch of documents and route them to different
    applications right from the scanner. Given the scanner has enough
    buttons of course :)
      Here, locking is a Good Thing, but it may suffice to implement
    it inside saned.

> 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.

Best regards,

Bjoern Brill
Bj"orn Brill <brill@fs.math.uni-frankfurt.de>
Frankfurt am Main, Germany