[sane-devel] Developers take note: Backend initialization

m. allan noah kitno455 at gmail.com
Tue Dec 7 03:17:30 UTC 2010


Authors-

Now that we are seeing more frontends like button monitors, a common
initialization problem has become evident. The sane standard
specifically says that sane_get_devices() can be called repeatedly to
discover new devices. Unfortunately, many backends do this discovery
just once by calling sanei_usb_init() only from sane_init(). This
prevents the backend from detecting device insertion/removal events.
In preparation for the upcoming release, I'd like to ask all backend
authors to please review your code and make the following corrections
if required.

1. Move calls to sanei_usb_init() to sane_get_devices()
2. If a list of devices is maintained within the backend, add/remove
devices as required at each call to sane_get_devices()
3. Do not destroy and recreate devices which have not changed, as the
front-end may have cached that handle.

The fujitsu and canon_dr backends have code to handle these problems,
feel free to borrow and adapt.

A quick git grep shows that the following backends _MAY_ exhibit this problem:

artec_eplus48u
avision
canon630u
cardscan
coolscan2
coolscan3
epson
epson2
genesys
gt68xx
hp3500
hp3900
hp4200
hp5400
hp5590
hpljm1005
kvs1025
kvs20xx
lexmark
ma1509
mustek_usb
plustek
sm3600
sm3840
stv680
umax1220u
xerox_mfp

I'll pick up the kvs* backends, since I added them to the repo.

Thanks!

allan
-- 
"The truth is an offense, but not a sin"



More information about the sane-devel mailing list