![]() |
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. |
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. |
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. :) |
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 Code:
restore_value() Code:
value=`gconftool-2 --get XXX` |
Re: MCE stop and start
This guy talks about steeing screen dim/timeouts form the cli.
|
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. :) |
Re: MCE stop and start
Quote:
Quote:
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:
Please don't give up on me with this. :) |
Re: MCE stop and start
Quote:
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. |
Re: MCE stop and start
Quote:
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! |
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 |
Re: MCE stop and start
Quote:
Quote:
Replace XXX with /apps/adv-backlight/brightness |
Re: MCE stop and start
Quote:
Yeah, that actually works! Only for one second though and then it immediately reverts back to the Control Panel -> Display -> Brightness setting it seems like. I've tried it 5 times now. Poops. :( Okay. If you were to run this from Xterm: /etc/init.d/mce stop sudo /etc/init.d/mce start I just would like the Brightness, Brightness period and Switch off display numbers to be the exact same and functioning as they were before entering those two command lines. I hope that makes sense and thank you so much for sticking with me on this. You rock dude! :) |
Re: MCE stop and start
Eep! :D
I added this at the end of my script: gconftool-2 -s "/system/osso/dsm/display/display_dim_timeout" 30 -t INT gconftool-2 -s "/system/osso/dsm/display/display_blank_timeout" 30 -t INT Now after I've restarted MCE again, the dim and blank times remain the same like they were before (30 seconds each). :) Is there a way to catch what these two values are at the beginning of the script and then enter them back in afterward? Like using variables or whatever? All that's left is to get a better handle on the brightness setting, which goes weird after MCE restart, and then I'm gold. :) |
Re: MCE stop and start
Quote:
The restore_value code should have worked, try changing the function to: Code:
restore_value() Oops! I forgot about DSME when setting the brightness, you can change the value with that file but DSME restores it. The /etc/mce.conf file has a line that loads a filter-brightness-als module, should only work on n810 but maybe if you remove it by commenting out the line and making a copy without that module it might stop reseting brightness. I'll try to write some real code to set DSME brightness when I wake up, poke me if I forget. :) |
Re: MCE stop and start
Okay, here's the poke you wanted. *lol*
Is there just a simple way to read all of these values before the script and then return them back afterward? gconftool-2 --type int --set /apps/osso/applet/osso-applet-display/turn_off_display ? gconftool-2 --type int --set /apps/osso/applet/osso-applet-display/brightness_period ? gconftool-2 --type int --set /system/osso/dsm/display/display_dim_timeout ? gconftool-2 --type int --set /system/osso/dsm/display/display_blank_timeout ? |
Re: MCE stop and start
Quote:
I put together a small program to set the backlight, download it here http://asui.garage.maemo.org/download.html . You don't need to download the source file. Code:
# advanced backlight |
Re: MCE stop and start
I'm so bad at coding that I'm going to be shameless and ask if you could edit my current script that I'm using with your new backlight app thingy. :)
#! /bin/sh gconftool-2 --set -t bool /system/osso/af/keyboard-attached true /etc/init.d/mce stop killall xbindkeys xbindkeys -f /home/user/.xbindkeysrc_adom xmodmap ~/.Xmodmap_adom xkbd -geometry +65536+65992 -k /media/mmc2/N800/Keyboards/Flat2.xkbd & xkbd -geometry +725+360 -k /media/mmc2/N800/Keyboards/Keypad.xkbd & ssh -l james ancardius.ath.cx gconftool-2 --set -t bool /system/osso/af/keyboard-attached false killall xbindkeys killall xkbd setxkbmap sudo /etc/init.d/mce start gconftool-2 -s "/system/osso/dsm/display/display_brightness_level_step" 1 -t INT gconftool-2 -s "/system/osso/dsm/display/max_display_brightness_levels" 127 -t INT gconftool-2 -s "/system/osso/dsm/display/display_brightness" 16 -t INT gconftool-2 -s "/system/osso/dsm/display/display_dim_timeout" 30 -t INT gconftool-2 -s "/system/osso/dsm/display/display_blank_timeout" 30 -t INT gconftool-2 -s "/system/osso/dsm/display/display_brightness_level_step" 1 -t INT gconftool-2 -s "/system/osso/dsm/display/max_display_brightness_levels" 5 -t INT xbindkeys killall roxterm |
Re: MCE stop and start
Code:
/FULL/PATH/set-brightness `gconftool-2 --get /apps/adv-backlight/brightness` |
Re: MCE stop and start
Awesome!
That works! Eeeeeeeee! :D The correct argument though is /usr/bin/set-backlight `gconftool-2 --get /apps/adv-backlight/brightness` I'm still unsure how to use these with variables. gconftool-2 -s "/system/osso/dsm/display/display_brightness_level_step" 1 -t INT gconftool-2 -s "/system/osso/dsm/display/max_display_brightness_levels" 127 -t INT gconftool-2 -s "/system/osso/dsm/display/display_brightness" 16 -t INT gconftool-2 -s "/system/osso/dsm/display/display_dim_timeout" 30 -t INT gconftool-2 -s "/system/osso/dsm/display/display_blank_timeout" 30 -t INT I'd like to use variables to restore the settings back to how they were rather than force something that's always static like how I'm currently doing this. Thanks chief! :) |
Re: MCE stop and start
On the N900 this resets the back light to what ever level it was set to after MCE restarts:
Code:
sleep2 |
Re: MCE stop and start
^ Thanks but that didn't work even though it didn't give me any errors.
|
Re: MCE stop and start
I have the blank timeout set at 30 seconds.
After restarting mce and running this... gconftool -s /system/osso/dsm/display/display_blank_timeout \ `gconftool -g /system/osso/dsm/display/display_blank_timeout` -t int It doesn't reset. It blanks after 2 minutes now. Should there be quotes or something in that command line? |
Re: MCE stop and start
Quote:
Quote:
If you scroll back to my second post you will see that I wrote a nice little function that automates this for you. You just have to pass it the key and type and it handles getting and setting. @ jonww, that key is for the default brightness, he is using adv-backlight which has its own key. |
Re: MCE stop and start
I wasn't trying to be a punk. *lol*
I was simply pointing out that /usr/bin/set-backlight `gconftool-2 --get /apps/adv-backlight/brightness` and not /FULL/PATH/set-brightness `gconftool-2 --get /apps/adv-backlight/brightness` the way you wrote it was correct. :) Anyway, I'll look over your post one more time and see if I can't get your other junk to work as well. Cheers buddy. :) |
Re: MCE stop and start
Sorry.
What am I doing wrong here? #! /bin/sh gconftool-2 --set -t bool /system/osso/af/keyboard-attached true /etc/init.d/mce stop killall xbindkeys xbindkeys -f /home/user/.xbindkeysrc_adom xmodmap ~/.Xmodmap_adom xkbd -geometry +65536+65992 -k /media/mmc2/N800/Keyboards/Flat2.xkbd & xkbd -geometry +725+360 -k /media/mmc2/N800/Keyboards/Keypad.xkbd & filterm ascii-ascii cp437-utf8 telnet becksbbs.synchro.net gconftool-2 --set -t bool /system/osso/af/keyboard-attached false killall xbindkeys killall xkbd setxkbmap sudo /etc/init.d/mce start /usr/bin/set-backlight `gconftool-2 --get /apps/adv-backlight/brightness` 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 xbindkeys killall roxterm |
Re: MCE stop and start
Quote:
|
Re: MCE stop and start
It appears that there is no error to anything you wrote.
Everything seems to go back to their original settings (brightness, brightness period). The one that doesn't restore is the switch off display timer. Other than that, it looks like I'm all good. :) |
Re: MCE stop and start
Look at turn_off_display and brightness_period in /apps/osso/applet/osso-applet-display.
|
Re: MCE stop and start
Are you referring to
/usr/share/osso-applet-display/RX-34.schemas ? That's all I'm really finding that's close to what you wrote. |
Re: MCE stop and start
The gconf keys /apps/osso/applet/osso-applet-display/turn_off_display and /apps/osso/applet/osso-applet-display/brightness_period, add restore_value lines for them and see if that works.
|
Re: MCE stop and start
Okay. So do you mean this?
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 int /apps/osso/applet/osso-applet-display/turn_off_display restore_value int /apps/osso/applet/osso-applet-display/brightness_period restore_value bool /system/osso/dsm/locks/touchscreen_keypad_autolock_enabled restore_value bool /system/osso/dsm/display/display_on_with_charger No errors on any of this but it's not restoring the Switch off Display setting thingy still. Thanks again for your patience with me. :) |
Re: MCE stop and start
Try switching the order so the two system keys are below the two apps keys. Dunno what else to try if that doesn't work.
|
Re: MCE stop and start
I did change the order like you mentioned.
No such luck though. So either I need to force it back with a static number, which works, or somehow use a variable setting instead, which I don't know how to do. It's weird that the blank timeout is the only setting that doesn't take. |
Re: MCE stop and start
Quote:
Code:
blank=`gconftool-2 -g /system/osso/dsm/display/display_blank_timeout` |
Re: MCE stop and start
So like this?
#! /bin/sh gconftool-2 --set -t bool /system/osso/af/keyboard-attached true blank=`gconftool-2 -g /system/osso/dsm/display/display_blank_timeout` /etc/init.d/mce stop killall xbindkeys xbindkeys -f /home/user/.xbindkeysrc_adom xmodmap ~/.Xmodmap_adom xkbd -geometry +65536+65992 -k /media/mmc2/N800/Keyboards/Flat2.xkbd & xkbd -geometry +725+360 -k /media/mmc2/N800/Keyboards/Keypad.xkbd & filterm ascii-ascii cp437-utf8 telnet becksbbs.synchro.net gconftool-2 --set -t bool /system/osso/af/keyboard-attached false killall xbindkeys killall xkbd setxkbmap sudo /etc/init.d/mce start /usr/bin/set-backlight `gconftool-2 --get /apps/adv-backlight/brightness` restore_value() { gconftool-2 --type $1 --set $2 `gconftool-2 --get $2` } restore_value int /apps/osso/applet/osso-applet-display/turn_off_display restore_value int /apps/osso/applet/osso-applet-display/brightness_period gconftool-2 -t int -s /system/osso/dsm/display/display_blank_timeout 300 gconftool-2 -t int -s /system/osso/dsm/display/display_blank_timeout $blank 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 xbindkeys killall roxterm Before this runs: Brightness period - 30 seconds Switch off display - 30 seconds After: Brightness period - 30 seconds Switch off display - 5 minutes |
Re: MCE stop and start
Quote:
It doesn't make sense why the line that sets 300 works but the line after doesn't. Try putting this line in the code after the MCE start line and see what it prints out when you run the script. Code:
echo `gconftool-2 -g /system/osso/dsm/display/display_blank_timeout` Why do you sudo to start MCE but not to stop? |
Re: MCE stop and start
Quote:
I've been working on this script for 18 months now so it's been awhile. *lol* In the control panel, the switch off display says one thing (30 seconds) but the timer is something else (5 minutes). It defaults to 2 minutes when MCE restarts without your script thingy. That's why I used to bring up the display panel and just click Okay since that seemed to restore all the values correctly. |
Re: MCE stop and start
Last question, is there a way to map the power button when MCE has stopped?
In Xterm: xbindkeys -k It's not recognizing anything when I depress that hardware button. How is advanced-systemui picking up when this key is being pressed? |
Re: MCE stop and start
Quote:
HAL sends a signal over dbus when power button is pressed or you can listen to /dev/input/event0(n800) or 1(n810) like ASUI does. It's not a normal key like the others, so no easy way to bind it. |
Re: MCE stop and start
^ Thank you so much for everything you put into this thread.
I surely appreciate your great efforts to provide answers for me. :) |
All times are GMT. The time now is 20:16. |
vBulletin® Version 3.8.8