Re: Have a "scan" button? Read this...

From: abel deuring (adeuring@gmx.net)
Date: Thu Mar 08 2001 - 15:10:18 PST

  • Next message: Juergen E. Fischer: "Re: Have a "scan" button? Read this..."

    Frederik Ramm wrote:
    >
    > Hi,
    >
    > my scanner has a "scan" button that (at least using their Windows
    > driver) can be used to launch certain programs on the host system.
    >
    > I've written something similar for the SANE environment. It's called
    > "sensed" and works by sending a SCSI "REQUEST SENSE" command to the
    > scanner in regular intervals (every 2 sec). If the response indicates
    > that the scan button has been pressed, a program is launched. (This
    > would usually mean scanadf or scanimage, maybe called by a shell
    > script that stores the results away properly.)
    >
    > The current, initial version is very crude, has only been tested with
    > my Fujitsu M3091DCd scanner, and it doesn't even have a Makefile etc.
    > (it relies on the SANE SCSI core so you'll have to stuff it into the
    > "backend" directory, compile and link with libsanei.a).
    >
    > It's here: http://www.remote.org/frederik/projects/software/sane/
    >
    > Feel free to play with it. If anyone's willing to help me make this a
    > proper part of SANE, including it in the "tools" directory, putting it
    > in CVS and tweaking the Makefiles accordingly, you're most welcome.
    > But perhaps that should wait for a version that is more configurable
    > and supports more scanners.
    >
    > For the SCSI gurus out there, is there any potential disruption by
    > sending REQUEST SENSE to a device every two seconds? I noticed that
    > while someone has "grabbed" the device, the call blocks anyway (which
    > doesn't hurt my program). sensed does not attempt to grab and release
    > the device; should it?

    Frederik,

    Two minor two problems might occur:

    1. Older versions of the Linux aha152x driver refused to accept a
    REQUEST SENSE command. This is fixed in recent versions; I don't know,
    if other adapter driver have similar restrictions.

    2. sanei_scsi_open opens the device file O_EXCL. So, if a frontend is
    started independently from you daemon, this call might fail, if this
    call happens, while your daemon is accessing the scanner.

    Abel

    --
    Source code, list archive, and docs: http://www.mostang.com/sane/
    To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com
    



    This archive was generated by hypermail 2b29 : Thu Mar 08 2001 - 14:40:23 PST