Notices


Reply
Thread Tools
Posts: 2,152 | Thanked: 1,490 times | Joined on Jan 2006 @ Czech Republic
#21
Thanks Austin. Finally tried it after few years(?) of planning to do it. Works fine so far. First glitch is that N810 keyboard light stays in the state when mce was stopped (either on or off). I need to change /sys/class/leds/keyboard/brightness by hand. This is actually good thing that mce manages it and we can change it when powerlaunch is running because when screen backlight is on minimum (with advanced applet), keyboard light is too bright for me at night.
__________________
Newbies click here before posting. Thanks.

If you really need to PM me with troubleshooting question please consider posting it to the forum instead. It is OK to PM me a link to such post then. Thank you.
 
Posts: 34 | Thanked: 21 times | Joined on Feb 2008
#22
Yes setting the keyboard led depending on the light sensor reading is unimplemented.
 
Posts: 2,152 | Thanked: 1,490 times | Joined on Jan 2006 @ Czech Republic
#23
It does not depend on light sensor. I have mce with als module disabled and it still lights up keyboard when opened and turns it off when doing tklock or closing the slide. But I know what you mean, it is not implemented. Is it posible to do it easily via some powerlaunch configuration script (waiting for some dbus/hal event and writing the value to /sys or via HAL somehow)?
__________________
Newbies click here before posting. Thanks.

If you really need to PM me with troubleshooting question please consider posting it to the forum instead. It is OK to PM me a link to such post then. Thank you.
 
Posts: 34 | Thanked: 21 times | Joined on Feb 2008
#24
The keyboard event is already caught in n810.conf. You can try playing around with something like this:
keyboard_slide_open = if $islocked unlock_keys; exec "sudo /bin/sh -c 'echo ... > /sys/...'"
 
Posts: 2,152 | Thanked: 1,490 times | Joined on Jan 2006 @ Czech Republic
#25
Thanks a lot, it works. I have added to /etc/sudoers this
Code:
user ALL = NOPASSWD: /etc/powerlaunch/*
then created /etc/powerlaunch/kb_light
Code:
#!/bin/sh
b=/sys/class/leds/keyboard/brightness
lux=/sys/devices/platform/i2c_omap.2/i2c-0/0-0029/lux

on(){
echo >$b 10
}
off(){
echo >$b 0
}

maybe_on(){
if [ `cat $lux` -lt 5 ] ; then on ; else off ; fi
}

case $1 in
    on) on ;;
    off) off ;;
    *) maybe_on ;;
esac
and finally modified/added lines to n810.conf
Code:
keyboard_slide_open = if $islocked unlock_keys ; call keyboard_light_on
keyboard_slide_close = if $relock tklock.main.lock ; call keyboard_light_off
keyboard_light_on =  exec "sudo /etc/powerlaunch/kb_light"
keyboard_light_off =  exec "sudo /etc/powerlaunch/kb_light off"
and it turns keyboard light off when kb is closed and turns it on when opened in a dark. This is already enough for me but perhaps it also needs to be turned on/off when slide is open and screen is turned on/off. However, I am not sure how to do it.
__________________
Newbies click here before posting. Thanks.

If you really need to PM me with troubleshooting question please consider posting it to the forum instead. It is OK to PM me a link to such post then. Thank you.
 
Posts: 34 | Thanked: 21 times | Joined on Feb 2008
#26
Originally Posted by fanoush View Post
and it turns keyboard light off when kb is closed and turns it on when opened in a dark. This is already enough for me but perhaps it also needs to be turned on/off when slide is open and screen is turned on/off. However, I am not sure how to do it.
Thanks. I haven't tried it but shouldn't the keyboard light already be independent of the state of the screen?

I'll put this into the default config. This reminds me why I never got to adding this and a couple other similar things. I was trying to keep sudo out of these powerlaunch scripts. My aim was to get to the point of running two powerlaunch programs, one as root to handle this kind of stuff and one as user to handle UI things, and try to minimize as much of the code that's in powered. For example, the screen locking code in powered is as simple as writing a value to a single file and could easily by implemented in a powerlaunch process run as root.
 
Posts: 2,152 | Thanked: 1,490 times | Joined on Jan 2006 @ Czech Republic
#27
Originally Posted by austin View Post
Thanks. I haven't tried it but shouldn't the keyboard light already be independent of the state of the screen?
Umm, yes, it is, sort of. Default behaviour is that in low light condition kb light is turned on when slide is opened and then turned off with relatively short timeout (10 seconds). It is turned back on when any key is pressed. It is turned immediately off when
- slide is closed
- t&k is locked (lock button or systemui menu item)

I don't like original 10 seconds timeout (too short) and did not find way to configure it (unlike screen dim or off timeout). I often need to do some random first keypress (ctrl is harmless but shift or fn is easier to find in dark) before typing something. Also keyboard is too bright at night.

So yes, it is independent but I don't find it very practical. I would like to turn keyboard light off when display is turned off (for same reason, device is idle). With my current powerlaunch solution keyboard light is turned on indefinitely when keyboard stays opened.

I guess it is a matter of calling keyboard_light_off from correct place where display off event is handled, not sure where exactly it is.

As for sudo, yes, calling external code via sudo is a bit awkward for setting some value in /sys. Also it is not suitable for calling often (like on each keypress if I wanted to do keyboard light timeout + turning back on on keypress).
__________________
Newbies click here before posting. Thanks.

If you really need to PM me with troubleshooting question please consider posting it to the forum instead. It is OK to PM me a link to such post then. Thank you.

Last edited by fanoush; 2008-07-03 at 14:15.
 
Posts: 33 | Thanked: 8 times | Joined on Apr 2008
#28
Originally Posted by joepagiii View Post
hey karel...ive been running it for a while....solely for the ability to have soft power off...thats all...no other reason....or atleast none that i can remember.....if someone would possibly come up with some examples...and post them here ...that would well be awesome...
How does "soft power off" differ from the normal power off?
I've had trouble finding an answer to this, so anyone's feedback is appreciated.
 
Posts: 34 | Thanked: 21 times | Joined on Feb 2008
#29
The event you want is dbus_powered_DisplayState. In common.conf, change the appropriate lines under default section to
Code:
dbus_powered_DisplayState = ifeq $1 on system.device.checksoftpoweroff; ifeq $1 on display_state_on off display_state_off dimmed display_state_dimmed
display_state_on = 
display_state_off = 
display_state_dimmed =
Then in n810.conf, you can configure these events as you wish, e.g. display_state_off = call keyboard_light_off
 
Posts: 2,152 | Thanked: 1,490 times | Joined on Jan 2006 @ Czech Republic
#30
Originally Posted by austin View Post
Then in n810.conf, you can configure these events as you wish, e.g. display_state_off = call keyboard_light_off
This didn't work until I called n810 versions from commo.conf like this
Code:
display_state_on = if $isN810 n810.keys.display_state_on
display_state_off = if $isN810 n810.keys.display_state_off
display_state_dimmed = if $isN810 n810.keys.display_state_dimmed
then I modified n810.conf to set few variables and call sudo only once if needed
Code:
[keys]
display_state_on = if $is_slide_open keyboard_light_on
display_state_off = if $is_slide_open keyboard_light_off
display_state_dimmed = if $is_slide_open keyboard_light_off

hal_org_freedesktop_Hal_devices_platform_kb_lock_button_state_value = if $1 key_press_kb_lock key_release_kb_lock
key_press_kb_lock = switch tklock.main
key_release_kb_lock =
hal_org_freedesktop_Hal_devices_platform_slide_button_state_value = if $1 keyboard_slide_close keyboard_slide_open
keyboard_slide_open = set is_slide_open 1 ; if $islocked unlock_keys ; call keyboard_light_on

# relock if you quickly open and then close the keyboard
unlock_keys = call tklock.main.unlock; set relock 1; timer_set n810.keys.keep_unlocked 10
keep_unlocked = set relock 0
keyboard_slide_close = set is_slide_open 0 ; if $relock tklock.main.lock ; call keyboard_light_off

keyboard_light_on = if $is_kb_light_on nop set_keyboard_light_on ; set is_kb_light_on 1
keyboard_light_off = if $is_kb_light_on set_keyboard_light_off ; set is_kb_light_on 0
set_keyboard_light_on = exec "sudo /etc/powerlaunch/kb_light"
set_keyboard_light_off = exec "sudo /etc/powerlaunch/kb_light off"
This works fine, keyboard light is turned off on display dim or off. The only small bug is that it doesn't work correctly at first until variables are initialized by opening/closing slide, then it is OK.
__________________
Newbies click here before posting. Thanks.

If you really need to PM me with troubleshooting question please consider posting it to the forum instead. It is OK to PM me a link to such post then. Thank you.
 
Reply


 
Forum Jump


All times are GMT. The time now is 14:26.