maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   Is somebody working on a "deep sleep" application? Silent/offline/... all in one (https://talk.maemo.org/showthread.php?t=37219)

benny1967 2009-12-14 21:49

Is somebody working on a "deep sleep" application? Silent/offline/... all in one
 
Following situation, not too unusual for me:

Battery is low, I can't charge, but I won't use the device anyway for some time. (Wonder when this happens? Well, I go to a cinema. Or I am in a fancy restaurant where cell phones are considered inappropriate.)

I want it to work afterwards, though, and I don't want to switch it off. So (depending on which device I have with me) I go through a couple of steps to switch off what I think consumes battery. I might choose offline mode, silent profile, I might want to close all running applications just in case one of them misbehaves, I shut down GPS if there is any on the device... and then lock the screen.

Now wouldn't it be nice if I could do all of this with one single click?
A "deep sleep"-application that would add one more button to where the profiles and presence settings are. Press it and all is done.

The application should have a configuration part, of course, so I can choose which parts of the device go down when I activate this mode. Someone might want to keep applications running, another user may want to keep GPS or wifi... just a list of things with checkboxes.

Is this already in the making somewhere (seems so obvious to me) or do I have to politely ask for it? ;)

Kieron 2009-12-14 21:55

Re: Is somebody working on a "deep sleep" application? Silent/offline/... all in one
 
Quote:

Originally Posted by benny1967 (Post 427846)
Following situation, not too unusual for me:

Battery is low, I can't charge, but I won't use the device anyway for some time. (Wonder when this happens? Well, I go to a cinema. Or I am in a fancy restaurant where cell phones are considered inappropriate.)

I want it to work afterwards, though, and I don't want to switch it off. So (depending on which device I have with me) I go through a couple of steps to switch off what I think consumes battery. I might choose offline mode, silent profile, I might want to close all running applications just in case one of them misbehaves, I shut down GPS if there is any on the device... and then lock the screen.

Now wouldn't it be nice if I could do all of this with one single click?
A "deep sleep"-application that would add one more button to where the profiles and presence settings are. Press it and all is done.

The application should have a configuration part, of course, so I can choose which parts of the device go down when I activate this mode. Someone might want to keep applications running, another user may want to keep GPS or wifi... just a list of things with checkboxes.

Is this already in the making somewhere (seems so obvious to me) or do I have to politely ask for it? ;)

I was thinking this too on the train, whilst the N900 was complaining of low battery and I was frantically trying to reduce screen brightness, decrease volumes, disable connections, etc. You beat me to it. :)

qwerty12 2009-12-14 22:04

Re: Is somebody working on a "deep sleep" application? Silent/offline/... all in one
 
I got it: Pull the battery. :D

OK, a button in the status area that switches the profile to silent, switches the device to offline mode, and locks the device would be v.easy to do; even for me with my bad programming skills.

GPS... I believe you must close the application using it to stop it (AFAIK ;)), and closing all the apps on the screen... Possible, I guess - wmctrl gets a list, at least but you'd have to kill -9 'em to make sure that they'd all gone - we don't need no confirmation screens hanging around. ;)

rambo 2009-12-14 22:07

Re: Is somebody working on a "deep sleep" application? Silent/offline/... all in one
 
Quote:

Originally Posted by benny1967 (Post 427846)
Is this already in the making somewhere (seems so obvious to me) or do I have to politely ask for it? ;)

I don't think so, but making one should be relatively simple. Just about everything in the device is controllable via DBUS and programs should respond to POSIX signals.

Making it all configurable and nice UI is going to be plenty of work, but it's not hard, read up on some python and start experimenting :)

pycage 2009-12-14 22:12

Re: Is somebody working on a "deep sleep" application? Silent/offline/... all in one
 
Wasn't there such a thing as "Soft-Poweroff" on the N900 that could be enabled by modifying some file? Or was this only on N8x0?

qwerty12 2009-12-14 22:42

Re: Is somebody working on a "deep sleep" application? Silent/offline/... all in one
 
Here's an extremely crude hack:

Code:

#! /bin/sh

dbus-send --session --dest=com.nokia.profiled --type=method_call /com/nokia/profiled com.nokia.profiled.set_profile string:"silent"
dbus-send --system --dest=com.nokia.mce --type=method_call /com/nokia/mce/request com.nokia.mce.request.req_device_mode_change string:"offline"
wmctrl -l -p | grep -v hildon-home | grep -v hildon-status-menu | grep -v desktop | awk '{print $3}' | sort | uniq | while read p; do kill -9 $p; done
dbus-send --system --dest=com.nokia.mce --type=method_call /com/nokia/mce/request com.nokia.mce.request.req_tklock_mode_change string:"locked"

Requires wmctrl. Will set the profile into silent, put the device into offline mode, proceed to kill -9 apps with a visible window, and then lock the screen and keys.

benny1967 2009-12-14 22:52

Re: Is somebody working on a "deep sleep" application? Silent/offline/... all in one
 
Gonna try this tommorrow ;)

Quote:

Originally Posted by qwerty12 (Post 427963)
Requires wmctrl.

... what's that? Or better: Where is it?

qwerty12 2009-12-14 22:57

Re: Is somebody working on a "deep sleep" application? Silent/offline/... all in one
 
Quote:

Originally Posted by benny1967 (Post 427984)
Where is it?

I wgetted it from http://qole.org/repository/pool/main...07-6_armel.deb, used dpkg to install, got an error saying libxmu6 was missing; apt-get -f install worked a treat.

Oh, BTW, I'd recommend not running that script from an X Terminal. Make a desktop file or something. ;)

DaveQB 2009-12-15 01:41

Re: Is somebody working on a "deep sleep" application? Silent/offline/... all in one
 
Hijack..
Is there a way to turn off all sounds?
I thought Silent profile meant silent, but I find alarms, games etc all happily create sounds. I was hoping for a way to use it in confidence that not a peep will be heard from it.

Thanks
Sorry for the hijack, I thought it was a little related.

debernardis 2009-12-15 05:56

Re: Is somebody working on a "deep sleep" application? Silent/offline/... all in one
 
Faheem: works beautifully :)
Benny: thanks for the idea, the best way to save power for those like me who use it as a tablet, more than like a phone :)

DaSilva 2009-12-15 08:59

Re: Is somebody working on a "deep sleep" application? Silent/offline/... all in one
 
Isn't it possible to edit the offline profile to make it the same like silent but without any connections? I have done this on my Nokia 5800 and when I go to bed I simply choose the offline profile and then all sounds (except alarm, which is good) are off and every connection (Bluetooth, GPS, GSM, 3G) is disabled. Isn't it the same on the N900 with the offline profile? I can't test it because I have to wait for my N900 :(

benny1967 2009-12-15 12:14

Re: Is somebody working on a "deep sleep" application? Silent/offline/... all in one
 
1 Attachment(s)
Quote:

Originally Posted by qwerty12 (Post 427963)
Here's an extremely crude hack:

Code:

#! /bin/sh

dbus-send --session --dest=com.nokia.profiled --type=method_call /com/nokia/profiled com.nokia.profiled.set_profile string:"silent"
dbus-send --system --dest=com.nokia.mce --type=method_call /com/nokia/mce/request com.nokia.mce.request.req_device_mode_change string:"offline"
wmctrl -l -p | grep -v hildon-home | grep -v hildon-status-menu | grep -v desktop | awk '{print $3}' | sort | uniq | while read p; do kill -9 $p; done
dbus-send --system --dest=com.nokia.mce --type=method_call /com/nokia/mce/request com.nokia.mce.request.req_tklock_mode_change string:"locked"


OK, it almost works now. I left out the wmctrl-part for the time being, but I still need some help because the way I do it, a black window keeps active even after un-locking the device.... But lets start:

One of my desktops has a pretty sleep symbol now. (Got the icon from here.) Tapping on it executes your script. So nice!

I put your script in the home directory and made it executable. Then I added a deepsleep.desktop file to /usr/share/applications/hildon/ (bug #1303 seems to be still open, so I didn't even try to do it in my $HOME):
Code:

[Desktop Entry]
Encoding=UTF-8
Version=0.1
Name=Sleep
Terminal=false
Type=Application
Comment=Akku schonen
Exec=/home/user/deepsleep.sh
Icon=sleep
X-Window-Icon=   
X-HildonDesk-ShowInToolbar=true
X-Osso-Type=application/x-executable

No idea about all the X-entries, it was copypasted from another thread here.

The icon sleep.png went to /usr/share/icons/hicolor/48x48/hildon/

That was it. My first Maemo 5 application. ;)
(OK, it's your code, but I made it appear in the applications menu :D ...)

Beautiful solution? Almost. It does everything it should do, except that it keeps a black window open. This window shows while the script shuts down the services, but it's still there after I unlock the screen afterwards. Tapping on the task switcher makes in disappear, but it simply isn't nice. What's that? Anything in the .desktop file causing it? Or do I need to exit the script in a special way to prevent this?

msa 2009-12-15 12:34

Re: Is somebody working on a "deep sleep" application? Silent/offline/... all in one
 
does it still receive calls when in deepsleep-mode?

benny1967 2009-12-15 12:46

Re: Is somebody working on a "deep sleep" application? Silent/offline/... all in one
 
Quote:

Originally Posted by msa (Post 428838)
does it still receive calls when in deepsleep-mode?

no. that's the whole point, isn't it?

it's in "offline mode", just like it is when you manually select "offline mode" on the device.

but as i wrote in my original post, the ideal solution would be to be able to configure which parts of the system go down and which stay up.

as it is now, if you want to disconnect from LAN but still receive phone calls (maybe you'd like to switch back from 3G or dual mode to plain GSM when you do this), you'll need to edit qwerty12's script - but don't ask me how. ;)

go1dfish 2009-12-15 12:48

Re: Is somebody working on a "deep sleep" application? Silent/offline/... all in one
 
Quote:

Originally Posted by benny1967 (Post 428818)
Beautiful solution? Almost. It does everything it should do, except that it keeps a black window open. This window shows while the script shuts down the services, but it's still there after I unlock the screen afterwards. Tapping on the task switcher makes in disappear, but it simply isn't nice. What's that? Anything in the .desktop file causing it? Or do I need to exit the script in a special way to prevent this?

You might try the Terminal variable: http://standards.freedesktop.org/des...t/ar01s05.html

I'm not sure which value will give you the behavior your looking for though. I haven't tried doing any desktop icons on maemo yet.

You might also try adding a & to the end of your exec line, to possibly run the process in the background.

qwerty12 2009-12-15 13:46

Re: Is somebody working on a "deep sleep" application? Silent/offline/... all in one
 
Quote:

Originally Posted by benny1967 (Post 428818)
Almost. It does everything it should do, except that it keeps a black window open. This window shows while the script shuts down the services, but it's still there after I unlock the screen afterwards. Tapping on the task switcher makes in disappear, but it simply isn't nice. What's that? Anything in the .desktop file causing it? Or do I need to exit the script in a special way to prevent this?

This is a Maemo 5 hildon-desktop speciality. I also get that window even when deepsleep.sh contains "exit 0".

Anyway, there's a partial-workaround for this: Use X-App-Loading-Image=none in the desktop file. The reason why it's partial is, if you unlock using the touchscreen slider, it will be gone. If you unlock using the physical slider, it will reside on the screen. Blame hildon-desktop. See below.

Quote:

Originally Posted by benny1967
but as i wrote in my original post, the ideal solution would be to be able to configure which parts of the system go down and which stay up.

I have no need for this, personally, so I won't be making anything configurable but I can make a quick and simple widget that resides in the status-menu area (in C; not Python) that will do the above with one press and will not have that window bug. Let me know.

benny1967 2009-12-15 14:09

Re: Is somebody working on a "deep sleep" application? Silent/offline/... all in one
 
Quote:

Originally Posted by qwerty12 (Post 428942)
This is a Maemo 5 hildon-desktop speciality. I also get that window even when deepsleep.sh contains "exit 0".

[…]

Blame hildon-desktop. See below.

So is this actually a bug in hildon-desktop? I'm missing the "see below"-part ;)

DaSilva 2009-12-16 07:16

Re: Is somebody working on a "deep sleep" application? Silent/offline/... all in one
 
Quote:

Originally Posted by DaSilva (Post 428619)
Isn't it possible to edit the offline profile to make it the same like silent but without any connections? I have done this on my Nokia 5800 and when I go to bed I simply choose the offline profile and then all sounds (except alarm, which is good) are off and every connection (Bluetooth, GPS, GSM, 3G) is disabled. Isn't it the same on the N900 with the offline profile? I can't test it because I have to wait for my N900 :(

I still don't understand why this does not the same. Can someone please explain it to me. Maybe I am wrong because I cannot test it. Thanks

benny1967 2009-12-16 07:50

Re: Is somebody working on a "deep sleep" application? Silent/offline/... all in one
 
Quote:

Originally Posted by DaSilva (Post 430061)
I still don't understand why this does not the same. Can someone please explain it to me. Maybe I am wrong because I cannot test it. Thanks

I don't see a simple way to edit profiles at all on the N900. I can select them, but not edit them (except setting vibration on/off for each profile).

Also. a profile wouldn't help me to shut down running applications.

DaSilva 2009-12-16 08:13

Re: Is somebody working on a "deep sleep" application? Silent/offline/... all in one
 
Ah, now I understand. I thought you could edit the profiles like on other Nokia phones but maybe Nokia will release this feature with a new firmware.

DaSilva 2010-01-03 01:02

Re: Is somebody working on a "deep sleep" application? Silent/offline/... all in one
 
Is it possible to make this script act like a switch? So on the first run it goes offline and silent and with the second run it goes back to general and online (maybe together with an icon change)?

mas5acre 2010-01-03 02:18

Re: Is somebody working on a "deep sleep" application? Silent/offline/... all in one
 
it be cool if there were configurable profiles, like sleep mode, low power mode, basically just the phone part with processes terminated for other things and high performance mode, etc.

DaSilva 2010-01-03 11:44

Re: Is somebody working on a "deep sleep" application? Silent/offline/... all in one
 
Quote:

Originally Posted by qwerty12 (Post 428942)
This is a Maemo 5 hildon-desktop speciality. I also get that window even when deepsleep.sh contains "exit 0".

Anyway, there's a partial-workaround for this: Use X-App-Loading-Image=none in the desktop file. The reason why it's partial is, if you unlock using the touchscreen slider, it will be gone. If you unlock using the physical slider, it will reside on the screen. Blame hildon-desktop. See below.



I have no need for this, personally, so I won't be making anything configurable but I can make a quick and simple widget that resides in the status-menu area (in C; not Python) that will do the above with one press and will not have that window bug. Let me know.

It would be really nice if you could create this widget :)


All times are GMT. The time now is 10:56.

vBulletin® Version 3.8.8