[patch] asynchronous callouts

David Zeuthen david at fubar.dk
Tue Apr 20 13:45:53 PDT 2004


On Tue, 2004-04-20 at 22:23, Joe Shaw wrote:
> On Tue, 2004-04-20 at 22:07 +0200, David Zeuthen wrote:
> > Hi, I haven't been able to try the patch cause I've only got glib 2.2
> > installed; that should probably be fixed in the patch :-). 
> 
> Oh, the GPid thing?  I forgot about that.  It can safely be replaced
> with "int".  I think they did it for win32 compatibility.
> 

Ah, nice.

> >  1. We should ensure that the HalDevice is in the device list before
> >     calling out (so we can modify the device etc.) ...
> 
> Do you mean that the state of the device might have changed between when
> the callout was queued up and when it runs?  Because right now
> hald.c:gdl_store_changed() is what calls hal_callout_device(), so it'll
> only happen when added to or removed from the GDL.
> 

Ok - thinking a bit more about it, we should probably callout right
after merging from .fdi files..

That is, just before adding to the GDL but after the device is named. 

This means our D-BUS access functions also must search the TDL
(temporary device list), but this should be an easy fix.

This will give us several advantages

 - callouts can access the device using the UDI environment variable;
   no one else will know about the device until then (unless they
   are psychic :-)

 - properties merged and capabilities added from callouts doesn't
   generate d-bus events / callouts as the device isn't in the GDL

 - children waiting for the parent can take advantage of the information
   merged during callouts as they will only see it once it's in the
   GDL

One of the nice applications of this is that we can run a script to
check if a certain device has a userspace driver; e.g.
check-gphoto-callout.sh, which I imagine is quite useful. Not that we
should handle devices with userspace drivers this way, that's another
discussion.

> >     ... and on the 
> >     other ensure hand that we don't send out D-BUS signals before all
> >     callouts are finished (since applications may want to use the
> >     information that callouts can merge).
> 
> Right now we're calling manager_send_signal_device_added() before
> hald_callout_device() in hald.c:gdl_store_changed(), but those can be
> swapped.
> 

Oh, I read the code like hald_callout_device() returned before all
callouts were run?

Chers
David


_______________________________________________
hal mailing list
hal at freedesktop.org
http://freedesktop.org/mailman/listinfo/hal



More information about the Hal mailing list