[sane-standard] Button handling (was: SANE2 proposal: split
button/option)
m. allan noah
kitno455 at gmail.com
Mon Jan 22 02:20:59 CET 2007
> > as i said in a previous mail, some scanner's 'buttons' are more than
> > just boolean. older fujitsu's have a density 'wheel' that you can
> > turn, which gives an int.
>
> Very nice device ! So SANE 2 standard is wrong about button handling ?
yes. i think the sane2 draft button handling is very weird. i would
scrap that part.
> > what i want from a front-end is to have a sort of logic made available on
> > all the options, not just the boolean pressing of 'buttons'. for instance:
> >
> > if('function-wheel' == 7){mode='lineart',resolution=200}
> > if('button-scan') {scan(),save-to-dir='xxx'}
> > if('button-email') {scan(),emailto='xxx'}
>
> That's quite simple as you expose it, however, you forgot the process of
> detecting which options is button, function, monitoring them depending
> on the types, …. That's as simple as an if () on a string … Also, the
> "wheel" option name is quite fuzzy as well as the 7 it returns. We
> should document names and values.
No. that is _exactly_ my point. you simply cannot know ahead of time
what all the valid
values will be, and so you as a front-end programmer cannot encode
that info into your
program. you will be forever behind the standard. if your frontend
becomes popular, then
other backends will have to emulate the backends that you support
well, rather than provide the best support for their hardware.
instead, we must find a way to have the backend expose options in a
descriptive-enough fashion that the front-end can handle it, and we
must try to keep all backends compliant.
our difference i think is small but important. i have come to think
button handling is best done in sane2 with a new capability bit, which
requests that the front-end poll the backend for changing values. the
TYPE of this option can be any of the normal sane types, since there
might be integer or string or fixed point data instead of just bools.
the front-end can request that the user specify an action to perform
when any button is pressed, or sensor is tripped, or even a
combination, using the boolean logic I included previously.
allan
--
"The truth is an offense, but not a sin"
More information about the sane-standard
mailing list