Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This script controll keyboard backlight on IBM ThinkPad X-series
#!/bin/bash
# Vadim Zaliva lord@crocodile.org
# based on https://gist.github.com/hadess/6847281
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
usage() {
echo "This script controll keyboard backlight on IBM ThinkPad X-series"
echo "Usage: ThinkLight [0|1|2]"
echo " 0 - off"
echo " 1 - medium"
echo " 2 - full"
}
if [ "$#" -ne 1 ];then
usage
exit 1
fi
case "$1" in
0)
b="\x03"
;;
1)
b="\x43"
;;
2)
b="\x83"
;;
*)
usage
exit 1
esac
sudo modprobe -r ec_sys
sudo modprobe ec_sys write_support=1
echo -n -e "$b" | sudo dd of="/sys/kernel/debug/ec/ec0/io" bs=1 seek=13 count=1 conv=notrunc 2> /dev/null
@Redsandro

This comment has been minimized.

Copy link

commented May 23, 2016

Also works on Lenovo ThinkPad X1 Carbon. 👍

@thanhlq

This comment has been minimized.

Copy link

commented Jul 5, 2016

Thanks so much for your script - it also works on W541!

@Autotonic

This comment has been minimized.

Copy link

commented Jul 13, 2016

Works on T450s 👍

@ryanjdillon

This comment has been minimized.

Copy link

commented Jul 27, 2016

working on x250. thanks!

@nkhine

This comment has been minimized.

Copy link

commented Aug 16, 2016

works on P50S, thanks

@transparentdata243

This comment has been minimized.

Copy link

commented Sep 28, 2016

works on t460p. thank you!

@xopxe

This comment has been minimized.

Copy link

commented Oct 29, 2016

Works on a X1 Yoga.

@lundsted

This comment has been minimized.

Copy link

commented Nov 12, 2016

Works on s540! Thanks!

@ssj-gz

This comment has been minimized.

Copy link

commented Mar 4, 2017

Works with Kubuntu 14.04 on my T430s - many thanks! :) Can't find anywhere that tells you how to get the Thinklight (the light that sits over the top of the screen, not under the keyboard), though :(

@ericjohnson97

This comment has been minimized.

Copy link

commented Jun 18, 2017

Dope!

@johanlerche

This comment has been minimized.

Copy link

commented Nov 27, 2017

Works on T470s, thanks

@tetebueno

This comment has been minimized.

Copy link

commented Dec 2, 2017

Doesn't seem to work on Lenovo Y520 15IKBN.

@smkamranqadri

This comment has been minimized.

Copy link

commented Dec 19, 2017

Getting this error on t440.

ThinkLight.sh: 6: ThinkLight.sh: [[: not found

@MartinEtcheverry

This comment has been minimized.

Copy link

commented Feb 6, 2018

excelent ! thank you!

@razvan9921

This comment has been minimized.

Copy link

commented Apr 28, 2018

Sorry I am new to linux. How do I run this script ?

@SausCode

This comment has been minimized.

Copy link

commented Jul 29, 2018

@razvan9921 copy and paste into .sh, then chmod +x .sh, then sudo ./.sh 0|1|2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.