[sane-devel] Interactive use of scanner buttons

Paul Wolneykien manowar at altlinux.org
Fri Dec 3 16:00:25 GMT 2021


В Fri, 03 Dec 2021 10:34:05 -0500
ryniker at ryniker.org пишет:

> "m. allan noah" <kitno455 at gmail.com> wrote on Fri, 3 Dec 2021
> 09:02:43 -0500:
> 
> >Frankly, polling over the network once per second is not that much
> >traffic, and certainly easier to implement.  
> 
> Yes, but it is wrong.  Someone will decide it is uncomfortable for
> action to begin immediately on one occasion, yet be delayed for one
> second another time.  Easy to fix: poll at 10 Hz instead of 1 Hz.
> Ugly!
> 
> Somebody else will find it is important to know exactly how many
> times a button was pushed, or want to distinguish between a "long
> push" and a "short push."
> 
> A callback mechanism provides a framework that can naturally avoid
> missed button events, and can support variations such as capture of
> "button down" and "button release" events without a requirement for
> the program with physical access to the hardware to maintain state
> information until a suitable poll operation is received.
> 
> A callback design is better able to support multiple
> buttons. Applications have less need for complex polling operations
> (three buttons... which was pressed first?) 

  Then, I'll try to experiment this way with my scanner.

  And it also would be nice to discuss the notifications design with
people who maintain the SANE base code. Shouldn't I send issues / merge
requests to sane-project.gitlab.io/standard ?



More information about the sane-devel mailing list