[sane-devel] python-sane - checking for active device

m. allan noah anoah at pfeiffer.edu
Tue Mar 21 14:25:19 UTC 2006

On Tue, 21 Mar 2006, Horst Herb wrote:

> What is the correct way of checking whether a device is available (plugged in,
> switched on) using the python SANE interface?
> If I switch my scanner off, sane.get_devices(), sane keeps reporting the
> scanner as if it was still available.
> If I start the program with the scanner switched off, and switch it on *after*
> calling sane.get_devices(), no scanner is found.

i am willing to bet that is a mis-designed sane backend. the sane spec 
says that a front end can call sane_get_devices to learn about newly 
attached scanners. but most backends that i have seen are written 
incorrectly, and load the list of scanners into a global in sane_init 

of course, i could be wrong, and the python layer could be doing something 
strange, i know nothing of that.

i would suggest that you read the source for the backend you use, and 
maybe turn up its debug vars when running your py program.


"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

More information about the sane-devel mailing list