Refresh ACPI APM and PMU devices on resume
Richard Hughes
hughsient at gmail.com
Thu Mar 30 11:23:11 PST 2006
On Thu, 2006-03-30 at 14:04 -0500, David Zeuthen wrote:
> On Thu, 2006-03-30 at 09:45 +0100, Richard Hughes wrote:
> > The attached patch makes selected HAL devices Rescan() on resume.
>
> Sounds good.
>
> > 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?
Yes, with lid values mainly. People are having so many problems with
ACPI after suspend this didn't fix all of them -- but I suspect this may
fix the majority.
> > 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
> > present.
> >
> > 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.
That's what I guessed.
> 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!).
Heh, maybe after the exams... :-)
> Also.. I think this is OK as your use of dbus-send doesn't block [1]
> 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?
Okay, I'll mention it next time I'm on IRC and see what the response is.
> So please commit this, thanks!
Nice one, thanks:
2006-03-30 Richard Hughes <richard at hughsie.com>
* tools/hal-system-power-hibernate, tools/hal-system-power-suspend:
Refresh device types button, battery and ac_adapter on resume, as a
suspend or hibernate can do funny things to ACPI. This fixes a common
problem where HAL forgets the value of the lid button when it is
resuming and may fix other related problems also.
Richard.
More information about the hal
mailing list