Bug 288798

Summary: Sleep does not work when on low battery
Product: [Unmaintained] Active Reporter: Thomas Pfeiffer <thomas.pfeiffer>
Component: GeneralAssignee: active
Status: RESOLVED FIXED    
Severity: normal CC: lamarque
Priority: NOR    
Version: unspecified   
Target Milestone: unscheduled   
Platform: Meego/Harmattan   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Use standby call for sleeping if suspend to RAM is not available.
xsession-errors after the problem occured

Description Thomas Pfeiffer 2011-12-12 14:21:25 UTC
Version:           unspecified
OS:                Linux

When I am on low battery, sleep (either via hardware or software button) only locks the screen but does not put the device to sleep. However, if I reboot it, sleep works again.

Reproducible: Sometimes

Steps to Reproduce:
Wait till the device switches to low battery mode
Tap the shutdown button
Tap Sleep

Actual Results:  
Screen locks but no sleep

Expected Results:  
Sleep activated

Happened on 2011-12-09-20-11-basyskom-plasma-active-testing-meego-usb-live
Comment 1 Lamarque V. Souza 2011-12-12 14:42:41 UTC
I have this problem in VitualBox, I do not know why the kernel does not enable the sleep capability:

# cat /sys/power/state
disk

it should return "mem disk", mem meaning "suspend to ram" or just "sleep".

When the problem happens can you send me the output of the 'cat /sys/power/state' command?
Comment 2 Thomas Pfeiffer 2011-12-13 13:28:30 UTC
Today the problem occurred again with 2011-12-12-19-53-basyskom-plasma-active-testing-meego-usb-live.iso, but it was during a meeting. And the battery was empty before the meeting so I could not launch the command above (and I don't have the charger with me). I'll post it as soon as I can reproduce it again with enough power left ;)
Comment 3 Lamarque V. Souza 2011-12-13 15:31:15 UTC
Created attachment 66698 [details]
Use standby call for sleeping if suspend to RAM is not available.

Can you try the attached file and see if it solves the problem? Just log as root and move the file to /usr/share/kde4/apps/ksmserver/qml.

I do not have a real tablet here so I cannot test the low battery profile.
Comment 4 Thomas Pfeiffer 2011-12-13 18:15:01 UTC
*grrrrr* I can't reproduce it anymore even though I haven't changed anything. 

/sys/power/state returns 
standby mem disk

As soon as it happens again, I'll copy the qml file and see if it goes away.
Comment 5 Thomas Pfeiffer 2012-02-01 16:24:22 UTC
This happened again with both PA2 meego image and 2012-01-31-15-30-basyskom-plasma-active-devel-meego-usb-live.iso, and not only with low battery. Instead, at some point sleep stops working and then only works again after a reboot.
"cat /sys/power/state" always returns
"standby mem disk"
Anything else I can do to diagnose this?
Comment 6 Lamarque V. Souza 2012-02-27 11:34:44 UTC
You can activate all debug messages using kdebugdialog and when the problem happens send me the ~/.xsession-errors file.
Comment 7 Thomas Pfeiffer 2012-02-27 16:31:17 UTC
Okay, I did as you suggested. See the .xsession-errors file in the attachment.
Comment 8 Thomas Pfeiffer 2012-02-27 16:32:06 UTC
Created attachment 69134 [details]
xsession-errors after the problem occured
Comment 9 Lamarque V. Souza 2012-02-27 17:37:59 UTC
Unfortunately, the log does not help to figure out what is going on with this problem.
Comment 10 Lamarque V. Souza 2012-02-28 12:57:47 UTC
I think this problem may happen because kded is frozen. You can check if that is case by issuing this command:

qdbus org.kde.kded

If it does not return then that is the problem. I added some changes in the lastest basysKom's devel image (2012-02-27-14-08-basyskom-plasma-active-devel-meego-usb-live.iso) that among other things fix one problem with kded. The changes are in the startactive package, you can update it from here:

https://build.pub.meego.com/package/binaries?package=startactive&project=Project%3AKDE%3ADevel&repository=MeeGo_1.2_OSS

instead of re-installing. As a bonus the new startactive speeds up boot time.
Comment 11 Thomas Pfeiffer 2012-03-01 18:35:11 UTC
Since I installed 2012-02-27-14-08-basyskom-plasma-active-devel-meego-usb-live.iso (a fresh install was overdue anyway), I haven't had this problem, so it seems to have done the trick, thanks!

As I've had this problem since before the PA2 release, I'd strongly recommend to backport the fix to PA2. I think being unable to put a tablet to sleep is a rather nasty bug.
Comment 12 Lamarque V. Souza 2012-03-01 18:45:17 UTC
I need to talk to Maurice about how to create upgrade packages for PA2. There is no project in build.pub.meego.com with the KDE SC version used in PA2. Basically I cannot create packages for PA2, I can only do it for PA3 devel and testing images. startactive package is noarch (no binary included), so it can be installed in PA2 images, but other packages, like plasma-mobile, will pull the whole KDE SC 4.8.0 used in PA3 if you try to upgrade it.