[sane-devel] howto Duplex

abel deuring adeuring at gmx.net
Sun Feb 12 12:58:35 UTC 2006


Horst Herb wrote:
> I have an Avision AV220 duplex scanner. Works fine under SANE.
> However, I want to access the Duplex functionality programmatically and cannot 
> figure out how to do it. I am using the Python SANE module to access the 
> scanner
> 
> Horst
> 

Horst,

first a disclaimer: I don't have a scanner for the Avision backend,
and I am too lazy to take a look into the backend's source code.

The Avision backend should have an option that enables the duplex
functionality. I have no idea what its name is, but you can ask a
Python-Sane device instance, which options are available:

#----------------------------------
import sane, sys
sane.init()
devs = sane.get_devices()
if not devs:
    print "no scanner found"
    sys.exit()
print "devices", devs
dev = sane.open(devs[0][0])
for optname in dev.opt.keys():
    print "OPT:", optname
    try:
        opt = dev.opt[optname]
        print " index   ", opt.index
        print " name    ",  opt.name
        print " title   ", opt.title
        print " desc    ", opt.desc
        print " type    ", opt.type
        print " unit    ", opt.unit
        print " size    ", opt.size
        print " cap     ", opt.cap
    except:
        print "(inactive)"
        #pass

# set an option. A decent program should first check, if the
# option is active and settable to avoid an exception.
dev.resolution = 120

# we need to clean up before calling sane.exit, else we'll
# get a segfault
del dev
sane.exit()
#------------------------------------

Abel



More information about the sane-devel mailing list