[sane-devel] buttons-daemon for SANE genesys scanner

m. allan noah kitno455 at gmail.com
Sat Jan 10 15:15:01 UTC 2009


On Fri, Jan 9, 2009 at 5:02 PM, Pierre Willenbrock
<pierre at pirsoft.dnsalias.org> wrote:
> m. allan noah schrieb:
>> On Wed, Jan 7, 2009 at 1:09 PM, Pierre Willenbrock
>> <pierre at pirsoft.dnsalias.org> wrote:
> [...]
>>>
>>> I have no experience with the sane interface itself, so comments/patches
>>> are gladly accepted.
>>
>> We have settled on exposing buttons via options with:
>> opt->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_HARD_SELECT | SANE_CAP_ADVANCED;
>>
>> Then the frontend should poll such options occasionally to collect
>> presses. If all buttons are read in one command, the backend should
>> take care to only call it in a way that will not lose button presses.
>> The fujitsu backend does this by maintaining two booleans for each
>> button, one of the value last read from the scanner, and one stating
>> if it has been read by the frontend yet. When the frontend asks for a
>> button a second time, i get all the values and cache them.
>>
> So, the boolean value of the option represents the current state of the
> button, which is TRUE if the button was down anytime since the last time
> the frontend looked? Or is it additionally FALSE, if the option was TRUE
> when read last time, and the button up anytime since then?

If I understand your question, I would say the latter, but see below...

> Another question: Is it okay to only look at the hardware state if the
> frontend asks for the state of the option? That way shorter presses can
> be lost, if the frontend does not poll often enough.

In my case, the scanners are smart enough to buffer the button presses
for 3 seconds, and I effectively read the status of all the buttons
from the scanner every time you ask for the value of the first option.
So, as long as the front-end reads within that 3 second window, no
presses are lost.

If your machines dont buffer, then you might need a thread just to
read the status really quickly? Do you know how frequently the windows
driver reads the buttons?

> Before i start to ask more similar questions: Is this documented
> somewhere? I looked at the html-version of the standard, but could only
> find the capabilities thing for buttons.

Nothing is documented. Everything we are discussing now came about
from prior threads on this list, and thru several iterations of button
support and button daemon work i did for users of the fujitsu backend.
IOW, this might not work for your scanners, so we should modify it if
required.

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



More information about the sane-devel mailing list