> 1. you need a piece of code that understands the button-reading > protocol for every scanner that sane supports. you will end up > replicating a fair bit of code that is already (hopefully) in > sane-backends, esp. for devices that require a bit of initialization > before they can communicate.
A HAL addon could use SANE, reading the buttons which are exported as boolean options so driver code wouldn't have to be duplicated. > 2. what happens when the user fires up scanimage command line tool > without pressing any buttons? how do we deal with the contention for > the device? That's the idea of having the dll backend call a D-BUS method on sane_open - it would get the addon to close the device temporarily so that scanimage or xsane or some other program could use it, and then when the program was done with the device (sane_close was called), it could call another D-BUS method on the HAL scanner object so that the addon could re-open the device and resume button monitoring. Donald Straney