View Single Post
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.