Skip to content

Pinebook LCD Brightness script

Peter edited this page Jun 18, 2017 · 4 revisions

1. Get the script

Download the support script, place in /usr/local/bin, and make sure it's executable (i.e. chmod +x)!

2. Create new group to manipulate gpios

sudo addgroup gpio

3. Add current user to gpio group

sudo usermod -aG gpio user-name

4. Allow gpio users to alter required sys paths

4.1 Systemd

Download the systemd service file, place it in /etc/systemd/system and run sudo systemctl enable pinebook-lcd-brightness-gpio to enable it.

4.2 Semi-manually via /etc/rc.local

Add the permission changes to rc.local so they are persistent (add the following line before exit 0):

/usr/local/bin/pinebook_lcd-brightness.sh -b

4.3 Manually via /etc/rc.local

Add permission changes to rc.local so they are persistent (add following lines before exit 0):

chown root:gpio /sys/class/backlight/lcd0/actual_brightness /sys/class/backlight/lcd0/max_brightness /sys/class/backlight/lcd0/brightness
chmod 664 /sys/class/backlight/lcd0/actual_brightness /sys/class/backlight/lcd0/max_brightness /sys/class/backlight/lcd0/brightness

5. install xbindkeys and xbindkeys-config

xbindkeys is the hotkey 'glue', and xbindkeys-config is the GUI config editor. sudo apt-get install -y xbindkeys xbindkeys-config

6. Setup your hotkeys

Run xbindkeys - I needed to run some config initialisation command the first time I ran it...

Then run xbindkeys-config. Basically, Click new to create a new binding. give your key binding a name e.g LCD Up, then choose a hotkey by pressing get key and pressing your prefered combination (eg Ctrl+Fn+UpArrow) and then enter the command as pinebook_lcd-brightness.sh -i 10 (change the number if you want smaller or bigger jumps in brightness). Then add another another one for the LCD down control, and use pinebook_lcd-brightness.sh -d 10 as the command. Click Save & Apply & Exit when you're done.

7. Reboot

This is to allow changes to permissions and user group to take effect

8. See if it works!