maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   Serious power saving with dbus-scripts and pkill -STOP (https://talk.maemo.org/showthread.php?t=73038)

Xagoln 2011-05-13 17:27

Serious power saving with dbus-scripts and pkill -STOP
 
We all know that many processes run in the background constantly. Some of the worst offenders are:
  • scim-panel-gtk
  • browserd
  • tracker
  • image-viewer
  • ...

dbus-scripts (see the excellent Maemo Wiki page) is a nifty tool to listen to internal system events and respond accordingly.

Now, in catching the D-Bus messages for screen dimming and especially screen lock, we can 'pause' these processes using the standard Unix 'SIGSTOP' signal, meaning they shouldn't consume any CPU cycles/power until awoken.

Some of you might question putting browserd in there, firstly because of dsme/watchdog, and secondly because you might be downloading something and lock the screen. The good news is that I found that dsme/watchdog will not trigger a reboot if browserd is paused. As long as it is in the process list, no probs. Re downloading, I'd probably use Opera in that case.

Be sure you know what you're doing, or are prepared to reflash

How it's done:

As root:
Code:

$ root

# apt-get install dbus-scripts

Fīle: /etc/dbus-scripts.d/screen-lock
Code:

/usr/local/share/dbus-scripts/screen-lock  * * com.nokia.mce.signal tklock_mode_ind locked
/usr/local/share/dbus-scripts/screen-unlock * * com.nokia.mce.signal tklock_mode_ind unlocked

(The above should be two long lines, bear that in mind if it has word-wrapped into 4 or more)


Fīle: /usr/local/share/dbus-scripts/screen-lock
Code:

#!/bin/ash

for process in browserd scim-panel-gtk image-viewer
do
  /usr/bin/pkill -STOP $process
done


Fīle: /usr/local/share/dbus-scripts/screen-unlock
Code:

#!/bin/ash

for process in browserd scim-panel-gtk image-viewer
do
  /usr/bin/pkill -CONT $process
done

Make all of the above scripts executable!

Now restart dbus-scripts:
Code:

# killall dbus-scripts
You can do likewise for screen dimming, keyboard closing etc, to your preference. Just be sure to think through the consequences.

Xagoln 2011-05-13 17:45

Re: Serious power saving with dbus-scripts and pkill -STOP
 
I will leave my phone locked overnight to see how it fares.

Could be worth holding off on doing this until I confirm long periods of locking don't cause any issues.

hawaii 2011-05-13 18:25

Re: Serious power saving with dbus-scripts and pkill -STOP
 
FWIW, I use dbuscron as it seems to be more stable for me. With some intelligent scripting and fcron, it would be possible to grab the PID that's chewing unnecessary cycles and pause it when locked.

A lot of user spawned processes can be paused that aren't necessary; calendar, hildon-input-method, camera-ui are a few I've been doing with no issue.

Curiously, I wonder what happens if you try and issue STOP to hildon-desktop, hildon-home and hildon-status-menu...

hawaii 2011-05-13 19:17

Re: Serious power saving with dbus-scripts and pkill -STOP
 
Don't bother pausing hildon-desktop or home on lock trigger. Too many processes hook into them, namely phone calls don't work :P

I've shut off osso-xterm, calendar, camera-ui, browserd, image-viewer, hildon-input-method.

I want thumbnailer and tracker to run, so renice to +19 and call it a day.

vi_ 2011-05-13 21:20

Re: Serious power saving with dbus-scripts and pkill -STOP
 
Quote:

Originally Posted by hawaii (Post 1005727)
Don't bother pausing hildon-desktop or home on lock trigger. Too many processes hook into them, namely phone calls don't work :P

I've shut off osso-xterm, calendar, camera-ui, browserd, image-viewer, hildon-input-method.

I want thumbnailer and tracker to run, so renice to +19 and call it a day.

You have my attention, please tell me more about this hawaii...

FYI I have 2 scripts.

1. Under-clocks and under-volts the phone to THE MAX. This is tied into the n900 'device inactive' dbus signal. I am unsure what the trigger is but it seems to appear a short while after the screen goes off. This only happens if the keyboard is closed AND the back light is off. This means if the n900 is doing something that will take a while and i don't want it to under power I just leave the keyboard open.


2. A clock and voltage back up script, this is triggered when the device is unlocked.


This means that i have been able to get rid of the kernel-power-settings script (I have a local copy loading settings). For some reason it occasionally causes my n900 to spazz out with ~8000 wake ups per second keeping it in C0.

For a while I was experimenting with stopping bme when the device was asleep however it wasnt easy to detect the 'plugged in, bme not started' condition (there is no dbus signal when BME is stopped), further more BME would just stop working after a bunch of start/stops :/ Although stopping BME was saving me around 200~wakeups/30s...

vi_ 2011-05-13 21:22

Re: Serious power saving with dbus-scripts and pkill -STOP
 
Quote:

Originally Posted by hawaii (Post 1005727)
Don't bother pausing hildon-desktop or home on lock trigger. Too many processes hook into them, namely phone calls don't work :P

I've shut off osso-xterm, calendar, camera-ui, browserd, image-viewer, hildon-input-method.

I want thumbnailer and tracker to run, so renice to +19 and call it a day.

Also who do I have to renice to get a bl0w...the process that deals with teh phone, what is his nice and can I crank it to the max?

Also what is hawaii's opinion on the mlocker application?

Megaltariak 2011-05-13 21:31

Re: Serious power saving with dbus-scripts and pkill -STOP
 
Simpler, if you don't want default services to be running you can look in /usr/share/applications/hildon/ and open .desktop files (the modest one for example), then comment out with a # these kind of lines:
X-Maemo-Prestarted=always
X-Maemo-Prestarted-Priority=2000

hawaii 2011-05-13 21:52

Re: Serious power saving with dbus-scripts and pkill -STOP
 
Quote:

Originally Posted by vi_ (Post 1005789)
Also who do I have to renice to get a bl0w...the process that deals with teh phone, what is his nice and can I crank it to the max?

Also what is hawaii's opinion on the mlocker application?

omhd already takes care of setting priority for daemons and applications that handle incoming calls.

I use mlocker for the X server and I automatically set hildon-home, hildon-desktop and a few other core processes to FIFO or RR real time status when using the BFS scheduler.

I have no idea why you'd want to stop BME?

dimbert 2011-05-13 22:04

Re: Serious power saving with dbus-scripts and pkill -STOP
 
Any chance of making a script/app that you can choose witch process to stop and setup the trigger behavior!!!

I love my N900 and read all the TMO just for increase my batt life!

Good work you all!

Xagoln 2011-05-14 00:42

Re: Serious power saving with dbus-scripts and pkill -STOP
 
Quote:

Originally Posted by Megaltariak (Post 1005797)
Simpler, if you don't want default services to be running you can look in /usr/share/applications/hildon/ and open .desktop files (the modest one for example), then comment out with a # these kind of lines:
X-Maemo-Prestarted=always
X-Maemo-Prestarted-Priority=2000

Thanks for the tip.

Some of these services, like scim-panel-gtk, are very useful to have when using the phone interactively. And totally redundant when the device is locked.

Also, I'd be weary of dsme/watchdog. Out of ignorance, a few weeks ago I renamed the actual browserd executable, frustrated that it would always run and seemed to often keep my CPU busy even when I'd closed all my browser windows. The dsme rebooted the phone within 5 seconds, and I ended up with a reboot loop.

Would adjusting those values satisfy dsme and stop it rebooting?


All times are GMT. The time now is 22:48.

vBulletin® Version 3.8.8