On Sun, 2007-03-18 at 10:31 +0100, Julien BLACHE wrote: > David Zeuthen <da...@fubar.dk> wrote: > > Hi, > > > Is it possible anyone can apply / comment on this? Thanks! > > It's in.
Great, thanks a lot! Another thing; one of the things we're looking at in GNOME is making the buttons on the scanners work; there's some detail here http://mail.gnome.org/archives/desktop-devel-list/2007-March/msg00199.html Basically what people want to achieve is making sure that something happens (e.g. an app is launched) when a button on the scanner is pressed. To get some context, let me describe the proposed work-flow 1. User attaches USB scanner [0] 2. kernel notices USB device 3. udev creates device nodes; sends event to HAL 4. HAL figures out (via the fdi file that is now in) that the USB device is a scanner supported by SANE 5. HAL launches an add-on [1] to monitor button presses; this would pretty much be like sanebuttonsd, only it would emit D-Bus events via HAL when buttons are pressed 6. The desktop environment (e.g. GNOME, KDE and others) would be able to catch this signal and launch an app for scanning that is using libsane 7. App using libsane starts up and figures out what device to use. When it finds a device it calls sane_open() as usual. 8. /usr/lib/libsane.so is patched so sane_open calls the D-Bus method InhibitMonitoring() on the HAL addon just before it calls into the backend. This makes the addon close the device so the back-end can actually use it. I suppose this can be done in backends/dll.c? 9. sane_close() in /usr/lib/libsane.so calls AllowMonitoring() on the HAL addon right after it returns from the backends sane_close(). This make the addon resume button monitoring. [2] Ideally the HAL addon would also live in the SANE tree since HAL supports plugins. All this would all be a build time option and I don't expect the patch to dll.c to be huge; it would basically just connect the the D-Bus system message bus (private connection) and call a few messages here and there. So I'm curious if a) you think this is a good idea; and b) whether such a patch would be able to go into mainline SANE? Thanks for considering! David [0] : This would also work when booting with the scanner attached; I just left out that use-case to make the flow of the example more linear. [1] : A "HAL addon" is basically a daemon that is tied to the life-time of the device; e.g. it's launched when the device is detected and killed when the device goes away [2] : The addon itself would also track disconnects so if a process dies between sane_open() and sane_close() (e.g. when it have disabled the addon for monitoring) the addon would notice and start monitoring again.