GNOME Bugzilla – Bug 309398
AC adapter state not updated if no event accompanies the change.
Last modified: 2005-07-03 19:37:10 UTC
Distribution/Version: Ubuntu 5.04 The AC adapter state can change without ACPI event in the following method (at least on my laptop): -Initial state: plugged in -Put laptop to sleep (or suspend to disk) -Unplug AC adapter -Resume laptop. (or vice-versa, plugging laptop in during sleep if it was originally not does same thing) The battstat applet will continue for eternity to have the icon suggest that AC power is connected. Here is a quick patch I used for my purposes: --- gnome-applets-2.10.1/battstat/acpi-linux.c 2005-01-13 23:06:40.000000000 -0500 +++ gnome-applets-2.10.1-patch/battstat/acpi-linux.c 2005-07-01 22:55:32.000000000 -0400 @@ -374,6 +375,8 @@ /* Get the remaining capacity for the batteries. Other information * such as AC state and battery max capacity are read only when they * change using acpi_process_event(). */ + /* State changes during sleep do not have associated events */ + update_ac_info(acpiinfo); while ((procdirentry=readdir(procdir))) { if (procdirentry->d_name[0]!='.') There might be another approach more elegant, i.e. being notified explicitly of resume, however, no ACPI event accompanies it that I can tell and other solutions would require sleep/resume scripts to pass data to battstat, which varies between distros. This approach checks status of ac adapter every battery update, which means it doesn't update immediately on resume, but at least it is better than the current behavior.
Hi. Thanks for the report and the patch. A patch similar to yours is already in bug 163013. This is a long-standing known issue and we're looking at a better way of fixing it. Doing an update of the AC info for every battery refresh is a little bit excessive. If we were to go this route, a lot of the current ACPI code would just be completely ripped out (since this removes the point of separate event notifications). *** This bug has been marked as a duplicate of 163013 ***