[sane-devel] Developers take note: Backend initialization
m. allan noah
kitno455 at gmail.com
Tue Dec 7 03:17:30 UTC 2010
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
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:
I'll pick up the kvs* backends, since I added them to the repo.
"The truth is an offense, but not a sin"
More information about the sane-devel