How to get Keyboard Light keys working on Macbook?

18,002

Solution 1

Add the mactel PPA by following these instructions.

Install packages applesmc-dkms and hid-dkms.

Reboot.

sudo vi /usr/local/bin/keyboard-backlight and add:

#!/bin/bash
VALUE=$(cat /sys/class/leds/smc::kbd_backlight/brightness)
INCREMENT=32
TOTAL=unset

case $1 in
up)
    TOTAL=`expr $VALUE + $INCREMENT`
    ;;
down)
    TOTAL=`expr $VALUE - $INCREMENT`
    ;;
full)
    TOTAL=255
    ;;
off)
    TOTAL=0
    ;;
esac

if [ $TOTAL == unset ]; then
    echo "Please specify up, down, full, or off"
    exit 1
fi

if [ $TOTAL -gt 255 ]; then TOTAL=255; fi
if [ $TOTAL -lt 0 ]; then TOTAL=0; fi 
echo $TOTAL > /sys/class/leds/smc::kbd_backlight/brightness

Followed by sudo chmod 755 /usr/local/bin/keyboard-backlight.

sudo visudo and add the line:

your_username_goes_here ALL=NOPASSWD:/usr/local/bin/keyboard-backlight up, /usr/local/bin/keyboard-backlight down

Go to System > Preferences > Keyboard Shortcuts.

Add new shortcuts:

Increase Keyboard Backlight Brightness/sudo keyboard-backlight up and

Decrease Keyboard Backlight Brightness/sudo keyboard-backlight down.

Set each to the correct key by clicking the key mapping box and pressing the key.

Solution 2

Install the latest Ubuntu release - 11.04 - Natty Narwhal - and keyboard backlight should work out of the box - https://bugs.launchpad.net/ubuntu/+source/gnome-power-manager/+bug/724324

Share:
18,002

Related videos on Youtube

A Student at a University
Author by

A Student at a University

Updated on September 17, 2022

Comments

  • A Student at a University
    A Student at a University over 1 year

    I've got a Macbook Pro with Keyboard Light brightness keys. How to I make them work?

  • A Student at a University
    A Student at a University almost 10 years
    Actually, I wrote this. It is out of date, though.
  • Bruce
    Bruce over 9 years
    Thanks, I can also confirm that this is working on Xubuntu 14.04-1 on a MacBookPro 11,2. Note that I had to install applesmc-dkms from the quantal version, and failed to build/install hid-dkms but it didn't matter.