[patch] asynchronous callouts
David Zeuthen
david at fubar.dk
Mon Apr 26 12:32:36 PDT 2004
On Mon, 2004-04-26 at 19:38, Joe Shaw wrote:
> On Sun, 2004-04-25 at 20:44 +0200, David Zeuthen wrote:
>
> > I actually think it will work fine in every case.
> >
> > When hald starts up all the devices in the chain above is visited and in
> > the tdl - they start by waiting for the parent; when the parent is there
> > they execute the callouts c0,c1,.. and when the callouts are complete
> > they are in the gdl. Let's assume it takes 2 secs to complete the
> > callouts (way to high, but..)
> >
> > Initially to start the process, pci-device just executes the callouts
> > (it doesn't wait for a parent since the sysfs path indicates that there
> > is no parent) and is then in the gdl after 2 seconds. Then usb root got
> > a parent, executes the callouts and after two secs is put in to the gdl.
> > And so on... Wouldn't this work?
>
> You're right, and my patch seems to work fine with the changes you've
> made. Thank you.
>
> Here's the patch. It's pretty big and hairy, so I'd appreciate a pair
> of eyes on it before I commit it. Unfortunately it uglifies my
> beautiful callout code. ;)
>
Eh, it didn't work with hal-device-manager. The problem was quite tricky
to identify (basically comparing the lshal outputs helped me [1]); so
basically I have three identical PCI devices; one for each USB port so
before your patch they got the UDI's
/org/freedesktop/Hal/devices/pci_106b_3f
/org/freedesktop/Hal/devices/pci_106b_3f/0
/org/freedesktop/Hal/devices/pci_106b_3f/1
as we don't want the UDI to depend on the slot position etc.
But with the patch the UDI is assigned before callout (it has to) and
now there's a delay, due to callouts so all devices get the same UDI.
Which break things. But I've cooked up a patch so we also search the tdl
and then it works - it should apply on top of your patch. You can find
it attached. I'm not complete sure of the refcount issues though, please
review.
The patch also got a hal_device_store_print () utility. It would be nice
if you can add ChangeLog entries for this.
Apart from that the only comment I have is that would be nice to replace
this
+ g_signal_connect (g_object_ref (device_to_add),
+ "callouts_finished",
+ G_CALLBACK (add_to_gdl),
NULL);
+
with a call to something along the lines of the prototype of
hal_device_store_match_key_value_string_async (perhaps without a
timeout).
And we need some async delay for when removing devices, but I suppose
this can wait a bit.
Cheers,
David
[1] : Mental note: It would be good to enhance lshal so both devices and
properties are sorted; I had to diff(1) the sort(1)'ed output..
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hald-async-callout-also-search-tdl.patch
Type: text/x-patch
Size: 7133 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/hal/attachments/20040426/189f54c4/hald-async-callout-also-search-tdl.bin
-------------- next part --------------
_______________________________________________
hal mailing list
hal at freedesktop.org
http://freedesktop.org/mailman/listinfo/hal
More information about the Hal
mailing list