[sane-devel] Re: [PATCH] generate hal fdi file
m. allan noah
kitno455 at gmail.com
Tue Mar 20 18:03:49 CET 2007
> > > i would rather see a more general, non-linux specific method of
> > > handling buttons. how about a daemon that runs, gets the sane device
> > > list in the normal way, and then monitors each of the found devices
> > > for button presses as regular sane options.
> That's essentially what I propose to do except that monitoring of each
> scanner happens in a separate sub process (which you want to do anyway
> since it's more robust) and it integrates into the standard device model
> offered by HAL, e.g. D-Bus signals and so on.
ok, i am having trouble wrapping my mind around all these
HAL/dbus/Gnome things, so forgivemy ignorance. i have copied part of
an older mail below:
1. User attaches USB scanner 
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  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
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. 
i do not see why #5 and #6 are required. if HAL-started process can
monitor buttons on the device, then why can it not handle the child
process as well? think of all the places linux is used that dont have
a GUI. what am i missing?
"The truth is an offense, but not a sin"
More information about the sane-devel