Designed and tested for raspberry pi with official 7 inch touchscreen.
Other script that do the same thing:
- go: https://github.com/WestleyK/rpi-backlight
- perl: https://github.com/WestleyK/pi-backlight
- bash/shell: https://github.com/WestleyK/backlight
cd ~/
mkdir raspberrypi-backlight
cd raspberrypi-backlight/
git clone https://github.com/WestleyK/rpi-brightness.git
cd rpi-brightness/
make
sudo make install
Paste or type this in your terminal:
curl https://raw.githubusercontent.com/WestleyK/rpi-backlight/master/easy-install.sh | sh
This will install rpi-brightness
to the current directory.
To finish the install, do:
sudo mv rpi-brightness /usr/local/bin/
cd ~/raspberrypi-backlight/rpi-brightness/
make update
sudo make install
cd ~/raspberrypi-backlight/rpi-brightness/
sudo make uninstall
pi@raspberrypi:~ $ rpi-brightness -help
Usage: rpi-backlight [OPTION]
-h | -help | --help (print help menu)
-u | -up (adjust backlight brighter by: 20/255)
-d | -down (adjust brightness lower by: 20/255)
-s | -sleep (enter sleep mode, press <ENTER> to exit)
-c (print current brightness)
[15-255] (adjust brightness from: 15 to: 255)
-i | -info (print compiled info)
-v | -version | --version (print version & date)
Source code: https://github.com/WestleyK/rpi-brightness
pi@raspberrypi:~ $
For example, you can do:
sudo rpi-backlight 200
And:
sudo rpi-backlight -sleep
Will enter sleep mode.
Make sure you type sudo
before adjusting backlight,
Or you might get this ERROR
pi@raspberrypi:~ $ rpi-brightness -up
ERROR: Brightness file not writable or doesn't exist:
/sys/class/backlight/rpi_backlight/brightness
Try: $ sudo rpi-brightness [OPTION] (or) https://github.com/WestleyK/rpi-brightness (for help)
pi@raspberrypi:~ $
If you you don't like typing sudo
before adjusting brightness, then
run the no-root.sh
script:
sudo ./no-root.sh
sudo reboot
Now you should not need the sudo
.
To undo what you did, type:
sudo rm /etc/udev/rules.d/backlight-permissions.rules
sudo reboot
pi@raspberrypi:~ $ rpi-brightness [OPTION]
ERROR: Brightness file not writable.
Try: sudo rpi-brightness (or) https://github.com/WestleyK/rpi-brightness (for help)
pi@raspberrypi:~ $
Possible causes or fixes:
- Try
sudo
and then the command. - Try updating.
- File does't exist.