Re: gnome 2.19 schedule.
- From: David Zeuthen <david fubar dk>
- To: Donald Straney <burntfuse gmail com>
- Cc: desktop-devel-list gnome org
- Subject: Re: gnome 2.19 schedule.
- Date: Mon, 19 Mar 2007 21:58:53 -0400
On Mon, 2007-03-19 at 10:30 -0400, Donald Straney wrote:
> > In fact, imcapd is going to be a HAL add-on, but registering dbus call
> > in order to reclaim/release device. Donald, can you confirm that ?
>
> Right, it could definitely do that as a HAL addon. Each scanner could
> have ReleaseDevice and ReclaimDevice methods which would make it
> temporarily close the device so another program could use it, but that
> still seems like a hack. I guess the real solution here would be to
> make sure all SANE drivers can take multiple connections, but I don't
> know if that's possible (maybe some hardware limits it to one
> connection?). Does anyone know more about this?
>
> So using libusb directly would get around locking problems? Sounds
> good, but it seems like we'd end up with a bunch of duplicated driver
> code, and what if a SCSI scanner or parallel-port scanner has buttons?
> It's not likely, but it seems better to keep it flexible instead of
> tying it into USB.
No, device access via libusb is exclusive (as it needs!) so this is not
possible. One way around this, though, would be to modify libsane to
send a D-Bus message to the HAL add-on so it releases the device (unless
you configured libsane to not do this). That's probably not a lot of
work, I'd just patch backend/dll.c:sane_open() in sane-backends and hey
presto this should work. Getting such a (compile-time) option past the
SANE developers may be harder though, but I guess if you make a good
case for it, then it should be feasible.
Btw, looking at how sanebuttonsd does button detection, it's pretty ugly
http://alioth.debian.org/plugins/scmcvs/cvsweb.php/experimental/button-daemon/sanebuttonsd.c?rev=1.3;cvsroot=sane
e.g. it's polling. I don't suppose there's any way to avoid this, it
only will happen when the scanner is plugged in and powered on.
So here's what I would do
1. Start writing the buttons addon for HAL - this would just link
with libsane and do sane_open (device_file) where you get
device_file from HAL, e.g. "/dev/bus/usb/001/002", when the
addon is launched. Make sure it emit D-Bus events when you
press buttons and this should work if the underlying sane driver
supports button presses.
2. Make the addon export the o.fd.Hal.Device.ScannerButtonMonitor
interface with the InhibitMonitoring and AllowMonitoring that
tells the add-on to release resp. acquire the device file for
monitoring. Need to track when the caller disconnects from the
bus, see e.g. gnome-power-manager and gnome-screensaver for how
to do this. Now you can disable this from the command line and
things actually work
3. Patch libsane's backend/dll.c sane_open() (and sane_close()!) to use
InhibitMonitoring() / AllowMonitoring() on the addon. This probably
includes things like using
libhal_manager_find_device_string_match(hal_ctx, "scanner.device",
"/dev/device_file");
to find the device object and then call InhibitMonitoring() (and
"/dev/device_file" is what the caller passed to sane_open()).
What do you think? Just ask on the HAL list if you need any help!
Hope this helps,
David
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]