FIX ac_adaptor.present for *really* broken BIOS (Was: Question re on battery vs on mains)

Richard Hughes hughsient at gmail.com
Tue Aug 2 09:29:01 PDT 2005


On Tue, 2005-08-02 at 12:24 -0400, David Zeuthen wrote:
> On Tue, 2005-08-02 at 09:44 +0100, Richard Hughes wrote:
> > On Tue, 2005-08-02 at 09:02 +0100, Richard Hughes wrote:
> > > HAL only does the 30 second fallback reading for battery.type = primary.
> > > This needs to be fixed.
> > 
> > First part of the fix attached. 
> > 
> > For ChangeLog:
> > 
> > hald/linux2/acpi.c (ac_adapter_refresh_poll): New function, just set the
> > present key. This is quicker than setting the capability and category on
> > every forced refresh.
> > (ac_adapter_refresh): Use ac_adapter_refresh_poll and while we are here,
> > add device_property_atomic_update_begin and
> > device_property_atomic_update_end to make atomic.
> > (acpi_poll): Add the ac_adapter updates to make sure we get the value of
> > ac_adapter correct at least on every 30 second forced refresh. This
> > fixes really broken ACPI BIOS's that don't emit acad or batt events.
> 
> I've committed this while also fixing a memory leak.

Thanks, I wondered about the GSlist too.

> > I'll fix the fairly common "no acad events, yes bat events" case this
> > afternoon, but this patch is a bit more involved.
> 
> Hmm, what exactly needs to be done here?

Some BIOS's don't emit a acad event when the ac_adapter is removed, they
just give the batt "discharging" event, so ac_adapter.present never gets
set to false (and programs gets confused)

We need to rescan the ac_adapter (hence why I split up the function with
the patch you commited) on the battery event.

Richard.


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



More information about the Hal mailing list