/usr/sbin/laptop_mode searches /proc/acpi/ac_adapter/ for information on ac adapter status, this is marked deprecated in newest kernels. This functionality will be moved to /sys/class/power_supply/. Here's a quick patch I created to get the status from sys/class/power_supply/AC/online. It works here (I haven't tested it extensively yet), please test and commit if it's ok: --- laptop_mode 2008-11-19 10:40:20.000000000 +0100 +++ laptop_mode.new 2008-12-21 16:55:59.000000000 +0100 @@ -541,7 +541,9 @@ # Determine the power state. export ON_AC=1 -if [ -d /proc/acpi/ac_adapter ] ; then +if [ -d /sys/class/power_supply/AC ] ; then + read ON_AC < /sys/class/power_supply/AC/online +elif [ -d /proc/acpi/ac_adapter ] ; then ADAPTERS_FOUND=0 ON_AC=0 for ADAPTER in /proc/acpi/ac_adapter/* ; do Reproducible: Always Steps to Reproduce: 1.Compile kernel without deprecated /proc/acpi files and directories (or just prevent laptop_mode from accessing them) 2.Unplug the AC adapter 3.Nada Expected Results: laptop_mode should use the /sys interface to determine power status
Created attachment 176054 [details, diff] patch for /usr/sbin/laptop_mode
UPDATE: I've since found out that this has been fixed in upstream in version 1.36, and battery level checking was fixed in 1.40. Please take no action on my patch, I'm currently testing an ebuild for laptop-mode-tools-1.45 and will submit it for review. p.s: This bug is obviously invalid, but I'm unsure as to which status could be assigned, please advise)
Created attachment 176300 [details] Ebuild or app-laptop/laptop-mode-tools-1.45 Here's an ebuild for laptop-mode-tools-1.45, works on my system. Please test and advise if I've done something wrong. NOTE: a new init script is also necessary (uploading next)
Created attachment 176302 [details] laptop-mode-tools init script
Version 1.47 fixes that