Bug 11679

Summary: MSI Wind U100 - /sys/class/power_supply/ADP1/online always contains 1
Product: ACPI Reporter: Rafael J. Wysocki (rjw)
Component: ECAssignee: Alexey Starikovskiy (astarikovskiy)
Status: CLOSED DUPLICATE    
Severity: normal CC: acpi-bugzilla, astarikovskiy
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.27-rc8 Subsystem:
Regression: --- Bisected commit-id:
Attachments: update sysfs state on every access
Output of acpidump
debug ac notify propagation

Description Rafael J. Wysocki 2008-09-30 15:31:52 UTC
Distribution: openSUSE 11.0
Hardware Environment: MSI Wind U100
Problem Description: If the "new" sysfs interface for the AC adapter is not compiled out, the AC adapter is always reported as present, even if it's been unplugged.  The reason for this is apparently that the sysfs attribute /sys/class/power_supply/ADP1/online always contains a '1', even if the adapter is not present.

At the same time, /proc/acpi/ac_adapter/ADP1/state contains the right value if the AC adapter has been unplugged, so there seems to be a bug somewhere in the notification code.

Steps to reproduce: Unplug the AC adapter and look at kpowersave.
Comment 1 Alexey Starikovskiy 2008-09-30 23:14:14 UTC
please provide acpidump output.
Comment 2 Alexey Starikovskiy 2008-09-30 23:34:19 UTC
Created attachment 18124 [details]
update sysfs state on every access

This should help, but it is definitely interesting why there is no notify.
Comment 3 Rafael J. Wysocki 2008-10-01 04:19:51 UTC
Created attachment 18127 [details]
Output of acpidump
Comment 4 Rafael J. Wysocki 2008-10-01 04:22:37 UTC
(In reply to comment #2)
> This should help, but it is definitely interesting why there is no notify.

I'll test it later today, but I'm not sure if it's going to help, unless the userland polls the sysfs attribute.
Comment 5 Alexey Starikovskiy 2008-10-01 05:33:34 UTC
Created attachment 18133 [details]
debug ac notify propagation

Rafael, please check with this patch,
there should be some more printouts for each AC state change.
Comment 6 Rafael J. Wysocki 2008-10-01 12:35:01 UTC
With this applied I've got a single notification when the after unplugging the AC adapter.  However, I haven't got any notification after replugging it (actually i tried to unplug/replug it several times in a row, but there only was one notification).

The relevant lines in dmesg are:

ACPI: EC: expect AC state update
ACPI: received notify of state change
Comment 7 Rafael J. Wysocki 2008-10-01 13:10:14 UTC
The patch from http://bugzilla.kernel.org/show_bug.cgi?id=10724#c142 fixes the problem.  Closing as a duplicate.

*** This bug has been marked as a duplicate of bug 10724 ***