maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   OS2008 / Maemo 4 / Chinook - Diablo (https://talk.maemo.org/forumdisplay.php?f=29)
-   -   MCE stop and start (https://talk.maemo.org/showthread.php?t=72220)

Addison 2011-04-16 09:19

MCE stop and start
 
I have a script that runs
/etc/init.d/mce stop
so I can use more of the hardware keys to do different junk.

After I'm done using this I then
sudo /etc/init.d/mce start

The thing is, my original screen brightness and screen blanking timeout numbers are different afterwards.

I then have to go to the Control panel, Display, then click on Okay for them to restore back to their original settings.

Is there any command that I can add to the script so it will do this for me?

I'm using Advanced-Backlight by the way.

Thanks.

auouymous 2011-04-17 06:26

Re: MCE stop and start
 
Not sure why your timeout would be different but MCE does set brightness back to its 1-5 value. You can read the value adv-brightness uses from gconf and write it to /sys/devices/platform/omapfb/panel/backlight_level (multiply it by 2 and add 1). Install gconf-editor to find the gconf value, each app has its own folder.

What are you using the hardware keys for? You can get the power button from a HAL dbus signal and the home key can be used by current app if you grab the keyboard with X. The other keys are all sent to current app.

Addison 2011-04-17 09:21

Re: MCE stop and start
 
I'm currently using this script with ADOM.

Since I only have an N800, it just gives me three extra hardware keys that I can bind for the game, but for me, it's worth it.

I also use this with some of the emulators like DrNokSnes.

But yeah, as far as I know, the only way to get control of these three keys (Escape, Menu, and Home buttons) is to stop MCE.

Once MCE starts again, all of the display settings are thrown completely off unless I go to the Control Panel, Display and then click on Okay.

All of my scripts are mostly copies and pastes from other users here with a simple twist.

I can't program a single thing.

I was hoping for something I could add to my script to do this instead of doing the whole App Manager garbage manually.

Hope this makes sense. :)

auouymous 2011-04-18 13:54

Re: MCE stop and start
 
Do you know how to create shell scripts and execute them from icons?

This code will open the display control panel. You could put it in a shell script after the MCE start command so the display control panel always opens immediately after restarting MCE.
Code:

run-standalone.sh dbus-send --system --type=method_call -dest=com.nokia.controlpanel /com/nokia/controlpanel/rpc com.nokia.controlpanel.run_applet string:libcpdisplay.so boolean:true
Or you could put the following code after the MCE start command and it should read the current values from gconf and write them back to gconf maybe causing MCE to see the correct values.
Code:

restore_value()
{
  gconftool-2 --type $1 --set $2 `gconftool-2 --get $2`
}
restore_value int /system/osso/dsm/display/display_blank_timeout
restore_value int /system/osso/dsm/display/display_dim_timeout
restore_value bool /system/osso/dsm/locks/touchscreen_keypad_autolock_enabled
restore_value bool /system/osso/dsm/display/display_on_with_charger

And this code should update the brightness but you will need to use gconf-editor to find the key used by adv-brightness to store the value and replace XXX.
Code:

value=`gconftool-2 --get XXX`
echo `expr $value \* 2 + 1` > /sys/devices/platform/omapfb/panel/backlight_level


vi_ 2011-04-18 14:03

Re: MCE stop and start
 
This guy talks about steeing screen dim/timeouts form the cli.

Addison 2011-04-19 00:38

Re: MCE stop and start
 
Thank you!

I'll give this a try later tonight I hope.

Before, at the end of my script, I had this...
/usr/bin/controlpanel

And then just redid the settings manually.

I like your ideas so much better. :)

Addison 2011-04-23 01:07

Re: MCE stop and start
 
Quote:

run-standalone.sh dbus-send --system --type=method_call -dest=com.nokia.controlpanel /com/nokia/controlpanel/rpc com.nokia.controlpanel.run_applet string:libcpdisplay.so boolean:true

Usage: dbus-send [--help] [--system | --session] [--dest=NAME] [--type=TYPE] [--print-reply=(literal)] [--reply-timeout=MSEC] <destination object path> <message name> [contents ...]
[1|user@Nokia-N800-43-7|~]
This wouldn't open the Control Panel.


Quote:

restore_value()
{
gconftool-2 --type $1 --set $2 `gconftool-2 --get $2`
}
restore_value int /system/osso/dsm/display/display_blank_timeout
restore_value int /system/osso/dsm/display/display_dim_timeout
restore_value bool /system/osso/dsm/locks/touchscreen_keypad_autolock_enabled
restore_value bool /system/osso/dsm/display/display_on_with_charger
This doesn't work either.

I have
Brightness period: 30 secs.
Switch off display: 30 secs.

However, once MCE starts again, even with your script, it dims at 90 secs. then blanks at 2 minutes.

I believe it also reloads the brightness value from the control panel and not Advanced Backlight.

Quote:

value=`gconftool-2 --get XXX`
echo `expr $value \* 2 + 1` > /sys/devices/platform/omapfb/panel/backlight_level
I'm not sure how to get the value of XXX using g-conf.

Please don't give up on me with this. :)

auouymous 2011-04-23 05:55

Re: MCE stop and start
 
Quote:

Originally Posted by Addison (Post 993951)
This doesn't work either.

I'm not sure how to get the value of XXX using g-conf.

Does it produce an error?

You need to install the "gconf-editor" package, run it, open the apps folder and find adv-backlight's folder. Inside this folder there will be a key that sounds like it holds the brightness level. Replace XXX with the full path (folders and key name) to that key.

Addison 2011-04-23 06:02

Re: MCE stop and start
 
Quote:

Does it produce an error?
Nope, no error at all.

Do you have Advanced Backlight?

I thought that came with the SSU because it best supports the whole screen rotation thing?

And I'll try your gconf-editor suggestion right now. :)

Thanks!

Addison 2011-04-23 06:10

Re: MCE stop and start
 
Okay. It looks like I can't see the entire address because it's grayed out.

http://img854.imageshack.us/img854/8...1042302085.png


All times are GMT. The time now is 03:29.

vBulletin® Version 3.8.8