Summary: | In Powerdevil's Advanced Settings, the shutdown on critical battery level doesn't work | ||
---|---|---|---|
Product: | [Unmaintained] solid | Reporter: | kero <keikoz> |
Component: | powermanagement-daemon | Assignee: | Dario Freddi <drf> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | afiestas, alevkovich, kde, oliver.henshaw, u463726, wengxt |
Priority: | NOR | ||
Version: | 4.9.1 | ||
Target Milestone: | --- | ||
Platform: | Arch Linux | ||
OS: | Linux | ||
Latest Commit: | http://commits.kde.org/kde-workspace/fdc4aa9c298004ccd397fd2b451065d52cbf1ee0 | Version Fixed In: | 4.11.2 |
Sentry Crash Report: | |||
Attachments: | patch to help you really fix this problem |
Description
kero
2012-09-22 19:54:33 UTC
I can reproduce this in 4.10 Problem lies in: Powerdevilcore passes PowerDevilSettings::batteryCriticalAction() which is 3 for shutdown. In the SuspendAction (which is eventually triggered after dozens of roundtrips), however, it checks for "Mode" which has ShutdownMode = 8 3 != 8 and this is why shutdown doesn't work. ToRamMode is 1 and ToDiskMode is 2 which matches the number in powerdevilcore. Good find - looks like battery critical actions weren't ported in 0189a3a49142731db37db69b83fa5e49a85f84c9 Ideally we'd be using the SuspendSession::Mode enum everywhere rather than magic numbers. Git commit 05740a7b53ff1deebd5d83485c6ef901f2ce328d by Dario Freddi. Committed on 20/04/2013 at 15:25. Pushed by dafre into branch 'master'. powerdevil: Do not use magic numbers for configuration. People affected by 307228 might need to change their configuration. M +6 -4 powerdevil/kcmodule/global/GeneralPage.cpp http://commits.kde.org/kde-workspace/05740a7b53ff1deebd5d83485c6ef901f2ce328d This problem was not fixed for me in 4.11.0. Did you configure the action again? ie. change it to another, apply, and change it back and apply? Yes PowerDevil::BundledActions::SuspendSession::ShutdownMode enum Mode { None = 0, ToRamMode = 1, ToDiskMode = 2, SuspendHybridMode = 4, ShutdownMode = 8, LogoutDialogMode = 16, LockScreenMode = 32, TurnOffScreenMode = 64 }; ShutdownMode == 8 powerdevil/daemon/powerdevilcore.cpp bool Core::emitBatteryChargePercentNotification(int currentPercent, int previousPercent) { if (m_backend->acAdapterState() == BackendInterface::Plugged) { return false; } if (currentPercent <= PowerDevilSettings::batteryCriticalLevel() && previousPercent > PowerDevilSettings::batteryCriticalLevel()) { switch (PowerDevilSettings::batteryCriticalAction()) { case 3: emitRichNotification("criticalbattery", i18n("Battery Critical (%1% Remaining)", currentPercent), i18n("Your battery level is critical, the computer will be halted in 30 seconds.")); m_criticalBatteryTimer->start(); break; it should be case 8 or PowerDevil::BundledActions::SuspendSession::ShutdownMode. Am I right? Reopening based on comment #5. See also bug 323992. Created attachment 81916 [details]
patch to help you really fix this problem
this patch for kde 4.11. It fixes the problem.
Hi, Alex, I committed your patch.. though I typed the wrong bug number commit message.. 4.11.1 is already tagged yesterday so it will be included in 4.11.2 I guess. http://commits.kde.org/kde-workspace/fdc4aa9c298004ccd397fd2b451065d52cbf1ee0 Sorry to dig up old thread but having issues with power management machine will not shutdown or suspend on critical critical at 60% have changed etc. if below critical level at startup will boot so far then shutdown (during startup) thats the only time critical shutdown/suspend works killed battery in 3 months Kubuntu 14.04 KDE 4.13.3 kernel 3.13.0-46 please let me know what logs etc I can provide thanks in advance alan |