Bug 233854 - power managemet does not recognize if power cord is plugged or not
Summary: power managemet does not recognize if power cord is plugged or not
Status: RESOLVED DOWNSTREAM
Alias: None
Product: solid
Classification: Frameworks and Libraries
Component: powermanagement-daemon (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Dario Freddi
URL:
Keywords:
: 245862 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-04-09 18:24 UTC by Salvatore Brigaglia
Modified: 2012-12-31 09:09 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Salvatore Brigaglia 2010-04-09 18:24:46 UTC
Version:           4.4.2 (using KDE 4.4.2)
OS:                Linux
Installed from:    openSUSE RPMs

I'v got this new sony vaio VPCS11E7E but the battery icon (wasn't shown automatically at first boot) does not recognize if power chord is plugged or not.
If i boot unplugged it will always show as unplugged and if i boot plugged it will always show as plugged even if i plug/unplug it some times.

acpi events exists on /proc/acpi/ac_adapter/AC/state and /proc/acpi/battery/BAT1/state wich changes accordingly if i plug/unplug the laptop.
Comment 1 Salvatore Brigaglia 2010-04-09 18:39:25 UTC
plus, i noticed that battery state in the applet is changed correctly from charging to discharging and back if i plug and unplug...
Comment 2 Salvatore Brigaglia 2010-05-08 16:27:24 UTC
4.4.3. Still the battery applet does not change the plugged/unplugged state accordingly. I noticed that if i go to standby and plug/unplug the adapter coming back from standby (s2ram) it changes the status.
Comment 3 Kevin Ottens 2010-05-08 16:58:41 UTC
Good that you checked /proc/acpi. Could you also take a look at the output of "lshal" and "solid-hardware list details" please?

Look for the AC adapter and the battery there.

Note that from the behavior I kind of suspect this BR to be in fact about a kernel issue (info would be refreshed when you ask for it, but not notified automatically).
Comment 4 Salvatore Brigaglia 2010-05-10 16:31:48 UTC
you are right. It's a Linux issue. What i did:

cat /sys/devices/LNXSYSTM\:00/device\:00/ACPI0003\:00/power_supply/AC/online

starting with the plug connected to the system. It always give "1", no matter if the plug is in or not. Same thing happens if the computer is booted without the power plug. It always gives me "0".
Comment 5 Salvatore Brigaglia 2010-07-23 13:32:42 UTC
I'm reopening this as i tried the new opensuse11.3 gnome live cd on the same machine where i have installed opensuse 11.3 with kde 4.4.4.

So, on the same machine gnome battery applet behaves correctly where the kde battery plasmoid does behaves like explained in this BR.
Comment 6 Mateusz Ślażyński 2010-08-10 20:24:53 UTC
Same on Sony VAIO VGN-CS11S
Comment 7 Salvatore Brigaglia 2010-08-13 11:59:15 UTC
Still valid for KDE 4.5
Comment 8 Unknown 2010-08-13 20:58:11 UTC
HP Pavillion 9790ed here. 
Sometimes behavior is correct, sometimes it is like described in this bug. It seems to be completely random for me. 
To summarize: most of the time, when i unplug the power cord of the AC-adapter, nothing happens. No state change to powersave. The battery level indicator shows AC Adapter: plugged in. 

But here's something weird:
- Unplug power cord
- Let's assume nothing happens (no governor change to powersave, no message saying AC Adapter is out)
- Open a terminal and read /proc/acpi/ac_adapter/AC/state
- As soon as I read the state, governor seems to go to powersave (screen dims and Fan is running more quiet), but...
- the Battery widget still says it's in 'Performance' mode and AC Adapter is plugged in.

KDE 4.5.0
Linux laptop 2.6.35-ARCH #1 SMP PREEMPT Wed Aug 11 10:57:09 CEST 2010 x86_64 Intel(R) Core(TM)2 Duo CPU T7500 @ 2.20GHz GenuineIntel GNU/Linux

[chris@laptop ACAD]$ lshal | grep adapter
udi = '/org/freedesktop/Hal/devices/computer_power_supply_ac_adapter_ACAD'
  ac_adapter.present = true  (bool)
  info.capabilities = {'ac_adapter'} (string list)
  info.category = 'ac_adapter'  (string)
  info.udi = '/org/freedesktop/Hal/devices/computer_power_supply_ac_adapter_ACAD'  (string)
Comment 9 Chaiwat Suttipongsakul 2010-08-14 14:15:41 UTC
I think this bug is a combination of kernel + hal + kde bugs.

In my laptop (Vaio VPCS116FH). If it was booted while AC plugged in, when you type acpi -V in the terminal it will stay 'on-line' even you already unplug it.

However, if the kernel that you're using is enable the legacy /proc/acpi/ac_adapter/AC/state (this feature was marked as deprecated in Linux kernel), you can just 'cat /proc/acpi/ac_adapter/AC/state' and then 'acpi -V' again will show the corrected status.

My workaround now is putting this command 'screen -d -m watch --interval=1 cat /proc/acpi/ac_adapter/AC/state' in /etc/rc.local to keep refresh the AC adapter state every 1 second.

Maybe we should forward this bug to Linux kernel bug tracker.
Comment 10 Mateusz Ślażyński 2010-08-14 18:39:42 UTC
It's definitely Linux or HAL issue, 'acpi -V' always get correct state of connection on my VGN-CS11S. Maybe we should commit this bug on HAL site?
Comment 11 Unknown 2010-10-27 23:10:01 UTC
This is still happening:
Linux laptop 2.6.35-ARCH #1 SMP PREEMPT Wed Sep 29 08:45:18 CEST 2010 x86_64 Intel(R) Core(TM)2 Duo CPU T7500 @ 2.20GHz GenuineIntel GNU/Linux
KDE 4.5.2

I have an ubuntu installation, which doesn't use Hal, on a 2nd harddisk in the same laptop. Exact same problem occurs in ubuntu on the same hardware. So my guess is this is a kernel issue. At least it's not related to Hal or KDE. Kernel used in Ubuntu: Linux chris-laptop 2.6.35-22-generic #35-Ubuntu SMP Sat Oct 16 20:45:36 UTC 2010 x86_64 GNU/Linux

I'm going to look for a Kernel bug report, and if I can't find anything, i will file a bug there.

What seems odd to me is that there's no more comments / votes here. I can't imagine that "we" are the only ones affected by this.
Comment 12 Unknown 2010-10-28 00:25:07 UTC
created this bug report in kernel bugzilla:
https://bugzilla.kernel.org/show_bug.cgi?id=21322
Comment 13 Dario Freddi 2010-11-09 21:08:32 UTC
Marking this as Downstream, as the bug is not in KDE
Comment 14 Dario Freddi 2010-11-10 01:07:25 UTC
*** Bug 245862 has been marked as a duplicate of this bug. ***
Comment 15 Francescodario Cuzzocrea 2012-12-31 09:09:50 UTC
Ok, sorry if I resume this, but I'm facing the same problem on a Samsung NP535U3C-A02IT running kde 4.9.2 on ArchLinux@3.7.1-ck. I've installed KDE and KDM from the official repo.

If i run : 

cat / /sys/class/power_supply/ADP1/online 

the result is 0 if I've unplugged the chord, 1 if the chord is plugged, according with what we expect, so the kernel sees the supply, but KDE not. I have to reboot (or suspend and resume) the laptop to let the battery status indicator show the change. Same story with GNOME 3.6.2