Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Hello i have a sony vaio vpcf236fm. I am unable to disable or control my keyboard backlight. i want to be able to disable it when im running on the battery. Please if i could get help with this id be in your debt.

share|improve this question
2  
Run this command and tell us if it turns it off: sudo su -c "echo 0 > /sys/devices/platform/sony-laptop/kbd_backlight". You will have to type in your password to try it. To open up a terminal, just type Ctrl-Alt-T or open it from the Unity menu. –  Kupiakos Apr 2 '13 at 2:45
    
@Kupiakos you should add that as an answer! –  Mark Paskal Apr 2 '13 at 3:05
    
Done. I also added a nifty automation script in case the code does actually work. –  Kupiakos Apr 2 '13 at 3:22
    
Since you said you are unable to disable it or turn it off does this mean that you cannot turn it on or off in VAIO control center or is is not working? –  user255931 Mar 7 at 20:55

2 Answers 2

up vote 4 down vote accepted

Run this command and tell us if it turns it off: sudo su -c "echo 0 > /sys/devices/platform/sony-laptop/kbd_backlight". You will have to type in your password to try it. To open up a terminal, just type Ctrl-Alt-T or open it from the Unity menu.

I'm just going to go ahead and assume this command works and show a nice little script that will automagically turn the keyboard backlight on and off when you unplug the battery. If the command doesn't work....well the script'll be here for future reference then.

Run the command gksudo gedit '/etc/pm/power.d/99_kbd_backlight'. Type in your password.

Then paste the following into the gedit window:

#!/bin/bash
export DISPLAY=:0.0
if on_ac_power; then
    echo 1 > /sys/devices/platform/sony-laptop/kbd_backlight
else

    echo 0 > /sys/devices/platform/sony-laptop/kbd_backlight
fi

exit 0

Then run this command: sudo chmod +x /etc/pm/power.d/99_kbd_backlight

You may need to restart your computer for this to take effect. Theoretically, this should turn your keyboard backlight on and off when you plug and unplug your charger.

Edited the script from this source: http://www.techytalk.info/ubuntu-disable-enable-compiz-battery-ac-script/

EDIT: This may be a more "proper" answer: Keyboard backlighting not working on a Vaio laptop

share|improve this answer
    
The command sudo su -c "echo 0 > /sys/devices/platform/sony-laptop/kbd_backlight" works perfectly wich is awesome but your script doesnt seem to work after i do what you tell me here it gives me an output of. (gedit:2626): Gtk-WARNING *: Failed to parse /usr/share/themes/Mac-X-Lion/gtk-3.0/settings.ini: Key file contains line '/ ' which is not a key-value pair, group, or comment –  rambo Apr 3 '13 at 0:16
1  
ok i figured it out. not only your script works but it also makes the sensor work!!!! im completely amazed. Your awesome thanks so much :-) –  rambo Apr 3 '13 at 3:46

I do a different way, with this script:

#!/bin/bash
FILE="/sys/devices/platform/sony-laptop/kbd_backlight"
MODE=$1
if [ -z $MODE ]
then
    notify-send -t 8000 "No option specified, no operation done"
    exit
fi
if [ ! -w "$FILE" ]
then
    gksudo chmod a+w /sys/devices/platform/sony-laptop/kbd_backlight
fi

if [ "$MODE" = "on" ]
then
    echo 1 > /sys/devices/platform/sony-laptop/kbd_backlight
    notify-send -t 8000 "Keyboard light turned on"
else
    echo 0 > /sys/devices/platform/sony-laptop/kbd_backlight
    notify-send -t 8000 "Keyboard light turned off"
fi

Then i map the key with this line in my bashrc

 bind '"^[[19;5~": "/home/$(whoami)/bin/keyboard_backlight.sh off\n"'
 bind '"^[[20;5~": "/home/$(whoami)/bin/keyboard_backlight.sh on\n"'
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.