I used the top answer on this as basis for my own script for managing backlight brightness: Brightness Controls Not Working on a Dell Inspiron N4010 Laptop
Unlike OP (
user152748 ) there and similarly to you, backlight controls were basically working, but i just wanted the ability to fine tune it. This method will not affect how your normal backlight brightness adjustment works.
So what you need to know is if /sys/class/backlight/intel_backlight/brightness
is the correct file for your system.
You could test it with sudo echo $VALUE | tee /sys/class/backlight/intel_backlight/brightness
where $VALUE
is a number you want to try. Your permitted values are probably different from mine (0 to ~4000). In the case of my Dell laptop, it just doesnt work if i try an incorrect value.
If this method works for you, then you just have to make a script and assign hotkeys to it. My modified version of bcbc's script is this one (at the lower end adjusts by increments of 1; the higher the brightness level, the bigger the increment):
#!/bin/bash
# Dell N4010 brightness control workaround
# Note: add the following to /etc/rc.local
# chmod 777 /sys/class/backlight/intel_backlight/brightness
# The file .config/khotkeysrc should contain the hotkeys CTRL+SHIFT+F4/F5 to
# adjust brightness down and up respectively.
#
# Usage:
# ./brightness.sh up # bump up brightness
# ./brightness.sh down # bump down brightness
#
curr=`cat /sys/class/backlight/intel_backlight/brightness`
bump=$(( $curr / 50 ))
if [ "$1" == "up" ]; then
curr=`echo "$curr + $bump + 1" | bc`
else
curr=`echo "$curr - $bump - 1" | bc`
fi
# Set the brightness to the new level. 0 is the lower limit. Cant set it lower than that.
echo $curr | tee /sys/class/backlight/intel_backlight/brightness
echo $bump
If you're interested i can walk you through the code step by step.
As the comments in the code indicate, you need to edit the file /etc/rc.local
(which is run at a certain point in the boot process) to include this line chmod 777 /sys/class/backlight/intel_backlight/brightness
(changes permissions of this brightness file to allow anything to it by anyone) before this line: exit 0
(because in rc.local
all code must be before exit 0
).
You also need to set up your hotkeys which can be done via GUI (The link at the top has instructions how to do that in Ubuntu or you can search the web for "how to set custom hotkeys ubuntu"). You have to choose some key combination for it (i prefer something close to the original brightness adjustment keys). The second half of setting up custom hotkeys is telling it what to do when said keys are pressed. You want 2 hotkeys, one running $path_to_your_file/your_file.sh up
and the other one $path_to_your_file/your_file.sh down
.
Alternatively you can manually edit the file where hotkeys are stored on Ubuntu and its derivatives: $home/.config/khotkeysrc
Ill be happy to elaborate anything unclear.
sudo
in front of the command for superuser privileges (you will also be prompted for your password)? If you already did that correctly, then it's odd, but i would try changing the target file's permissions then with:sudo chmod 777 /sys/class/backlight/intel_backlight/brightness
. – Carolus Jan 14 '16 at 01:41sudo chmod 777 /sys/class/backlight/intel_backlight/brightness
- this one should change the permissions of the file in the command to permit anyone to read, write and execute it.sudo echo 500 | tee /sys/class/backlight/intel_backlight/brightness
- this one should change your backlight level to 500. Could you please copy the whole error message here? You can do that by selecting the text with mouse and then pressing CTRL+SHIFT+C and then paste it like you normally do. – Carolus Jan 14 '16 at 12:28Sometimes new hotkeys wont start working until after a restart. So try that.
Try running the script from the shell exactly as you have it for the hotkey. Usually you will be told about a lot of different problems when you try to run your problematic thing from the shell. If this works, then probably there's a problem with the hotkey. If this doesnt work, then for example the script file might not be marked as an executable or you might not have the permissions to run it.