Re: [Tracker] suspend on battery is broken



On Mon, 2007-09-24 at 02:44 +0200, Michael Biebl wrote:
While checking why suspend on battery doesn't work for me, I noticed,
that the way it currently works, is to poll a fixed set of proc file
names:

        /* battery and ac power checks */
        const gchar *battery_filenames[4] = {
                "/proc/acpi/ac_adapter/AC/state",
                "/proc/acpi/ac_adapter/AC0/state",
                "/proc/acpi/ac_adapter/ADp1/state",
                "/proc/acpi/ac_adapter/ACAD/state"


This approach seems to be broken imho.
First, in my case the correct path would be /proc/acpi/ac_adapter/C134/state.
I'm also sure there are other paths/ways on different platforms.
Second, we have to poll (currently every 2 secs) which defeats all the
recent achievements (like tickless kernel).

Is there a good reason, not to use hal? This would solve 1 and 2.

I dont know enough about hal to use it - any code examples?

hal writes the output to /proc/acpi/ac_adapter/

so we can just parse that periodically but I will change it do this
polling only when indexing is active.

Also there will only ever be one ac_adapter present so we can scan for
it

will fix now

jamie





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]