Refresh ACPI APM and PMU devices on resume
david at fubar.dk
Thu Mar 30 11:04:58 PST 2006
On Thu, 2006-03-30 at 09:45 +0100, Richard Hughes wrote:
> The attached patch makes selected HAL devices Rescan() on resume.
> We need this patch so that ACPI does not get confused when we resume, as
> often it forgets the state of it's own batteries.
> It especially forgets the value of the lid (frequently), which really
> confuses gnome-power-manager and causes really odd effects on resume.
> You can test this snippet of code if you stop the acpid service, wait a
> while on battery, and then run the code -- there should be a flurry of
> BATx updates.
++ for testing this; thanks! Does the patch fix any problems discovered
in the wild, e.g. with laptops exhibiting these problems?
> Also a common problem this patch should fix, is when you suspend and
> resume, HAL takes a few seconds to realise that there is a battery
> Does this look okay to commit?
OK, so you don't check the return code of hal-find-by-capability but I
guess this is OK as it doesn't return anything if there are no devices
of that capability. We just need to keep this in mind so we don't change
the semantics of h-f-b-c later (on that note, we really ought to have
man pages for all the hal-* tools specifying this; patches welcome!).
Also.. I think this is OK as your use of dbus-send doesn't block 
though it's not clear to me according to the dbus-send man page. Perhaps
send a patch to the dbus list for a --never-block option?
So please commit this, thanks!
 : If they did block, then we would deadlock in the
event /org/fd.o/Hal/d/computer got one of the capabilities 'button
battery ac_adapter'. This is because we now process method calls
sequentially. But this isn't the case anyway...
More information about the hal