|Summary:||Add option 'Suspend' for PercentageAction and TimeAction|
|Component:||general||Assignee:||Richard Hughes <richard>|
|Status:||RESOLVED MOVED||QA Contact:|
|i915 platform:||i915 features:|
|Attachments:||allow Suspend as CriticalPowerAction|
Description calimeroteknik 2014-01-09 14:08:19 UTC
I don't understand why 'Suspend' wouldn't be allowed in the values for the PercentageAction and TimeAction. My use case is: I'm using my laptop, and run out of battery (I forgot to plug the charger, in most cases, or I thought it was plugged and it isn't). It's nice if I can configure it to suspend, so I see the screen turn black, and I have time to find and plug the charger. A quick web search reveals that many people are in my case. I think it wouldn't hurt to allow users to configure the option "suspend to RAM" when the battery runs out. Reference: UPower.conf from GIT. # The action to take when "TimeAction" or "PercentageAction" above has been # reached for the batteries (UPS or laptop batteries) supplying the computer # # Possible values are: # PowerOff # Hibernate # HybridSleep
Comment 1 Bastien Nocera 2014-03-13 11:07:22 UTC
(In reply to comment #0) > I don't understand why 'Suspend' wouldn't be allowed in the values for the > PercentageAction and TimeAction. > > My use case is: I'm using my laptop, and run out of battery (I forgot to > plug the charger, in most cases, or I thought it was plugged and it isn't). > It's nice if I can configure it to suspend, so I see the screen turn black, > and I have time to find and plug the charger. > > A quick web search reveals that many people are in my case. > > I think it wouldn't hurt to allow users to configure the option "suspend to > RAM" when the battery runs out. If you suspend to RAM when the battery runs out, it will promptly die as if you didn't do anything. Suspending to RAM requires battery. If there's no battery, then you can't suspend to RAM... I fail to see how this is a good idea.
Comment 2 calimeroteknik 2014-03-13 21:46:33 UTC
Say I forget to plug my charger, then my battery reaches 5%, which means the laptop can run something like 10 minutes on battery before dying abruptly, losing my work. At that moment, my laptop suspends, I notice it, and have several hours to find my charger and plug it before it completely runs out of battery. If it hadn't suspended, it would halt abruptly when reaching 0% without me noticing. Actually, I already have a script that does this by polling, and was hoping it could be integrated in upower to avoid the overhead. I have distributed that script when asked, and it is very widely used, and considered a life-saver. Without this function, people reach 0% and their laptop abruptly halts, without them having a few minutes to plug their charger. It's not necessary to suspend to disk just for that.
Comment 3 Bastien Nocera 2014-03-14 10:21:03 UTC
(In reply to comment #2) > Say I forget to plug my charger, then my battery reaches 5%, It's 2 percent by default but we actually prefer to use time-based policies, so it would be 2 minutes of battery left. > Without this function, people reach 0% and their laptop abruptly halts, > without them having a few minutes to plug their charger. > It's not necessary to suspend to disk just for that. Their laptop will abruptly halt if there's no desktop environment running that checks on the warning level for that battery. There's also no need to poll, we send out D-Bus signals when the warning level changes. Allowing suspend in there seems like a great way for users to shoot themselves in the foot by losing their work without a proper shutdown. On systems where hibernation is possible, or hybridsleep is possible, that will actually be preferred. So I really don't see a good reason to add a Suspend option, and for your use case, it can be implemented in a small script without interfering desktop environments or UPower. I'll leave this opened for Richard to look at, if he thinks it's a good idea. I don't.
Comment 4 calimeroteknik 2014-03-14 12:50:11 UTC
Note that just _allowing_ this value doesn't break anything, doesn't force anything on anybody: it just allows more. And incidentally saves the hassle to listen to events with a separate script. :)
Comment 5 Alexander Couzens 2016-10-17 13:13:56 UTC
> Note that just _allowing_ this value doesn't break anything, doesn't force > anything on anybody: it just allows more. +1 Some users *want* to shoot into it's own foot. I'm loosing my work because it's powering off instead of going into suspend. I agree, this shouldn't the default, but works for me. My laptop can survive at least 30min - 1h in suspend when reaching critical level.
Comment 6 Ben Gamari 2016-10-17 17:09:58 UTC
I also see no good reason not to allow suspend as a action. Sure, list caveats in the documentation if you must, but I am also a user who has unnecessarily lost work on several occasions due to unexpected power-off. My laptop easily lasts at hour if I suspend at 5% charge state. This is often more than enough time to find power.
Comment 7 rwman 2017-02-02 21:44:21 UTC
See also: https://bugs.freedesktop.org/show_bug.cgi?id=99658 Allow "ignore" action on critical battery level
Comment 8 Alexander Couzens 2017-09-11 18:04:58 UTC
Created attachment 134166 [details] [review] allow Suspend as CriticalPowerAction
Comment 9 Richard Hughes 2017-09-11 18:16:45 UTC
Suspending uses power. I don't possibly know how this would be a good idea.
Comment 10 Alexander Couzens 2017-09-11 18:30:19 UTC
Hi Richard, I don't want to set this as default. But for rare cases (like me and others) this is useful. My setup doesn't support hibernate. When it comes to the critical event, the system shut's down. So I'll loose all my state. But when it go into suspend, I've a lot of time (usually between 30 minutes and 2h) to find the power supply. This patch doesn't touch the default behaviour, only for users who set this explicit in the configuration file.
Comment 11 Marcin Owsiany 2017-12-13 08:17:20 UTC
+1 to "comment 10", I'm in exactly the same situation. Suspend used to be available as critical action a few years ago and worked perfectly for me. It's not available these days and I lost work twice because of this. I consider this a regression from the old days.
Comment 12 calimeroteknik 2017-12-13 10:43:29 UTC
Suspending gives the user a notification of the low battery situation that's impossible to miss (the screen goes black) and time to plug in the power supply. And I don't possibly know how it could be justified to disallow users from setting the value they'd like on a parameter. This is simply autocratic. Again, nobody wants this to be the default. I would also very much appreciate being able to set this value on systems which do not have access to writable storage, or writable storage so slow that the computer would run out of battery only trying to write the RAM contents to it!
Comment 13 A Sh 2018-02-24 16:02:40 UTC
(In reply to Richard Hughes from comment #9) > Suspending uses power. I don't possibly know how this would be a good idea. As well as I know the hibernation in linux is currently not mature enough for everyday use. There has been a reason disabling it by default! Desktop is very slow after resume in many cases(e.g. when ram in use is more than half the total ram on hibernation point. Take a look at TuxOnIce project). Hibernate not being enabled by default, the default behavior on battery low is power off. Suspend, for obvious reasons, is not the ideal option in a "low battery situation" but considering the hibernate status it's the best we have(better than a power off!). BTW, as well as I remember it was the default action pre-upower days(correct me if I'm wrong)
Comment 14 calimeroteknik 2018-02-25 09:20:58 UTC
A Sh: your remark is both correct *and* besides the point. You're answering as if this RFE was asking to change the default value, which it isn't. While the current *defaults* are perfectly fine as you mentioned, the topic at hand here is to *allow* another value to be manually set by users who wish to use it. Again: this is not about changing anything. It is about *not forbidding* custom configuration for people whose setup and use case makes it the best for them, as explained at length already. Please take due note that *allowing* a value to be set for a given option cannot possibly affect anybody using the software. Unless you are offended at the idea that people could see that it is indeed possible to set this value if they want to. But such thought police would be scary.
Comment 15 GitLab Migration User 2018-06-04 13:31:38 UTC
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/upower/upower/issues/59.