Apr 19, 2016 ThinkPad Fan Control. Unfortunately this project is NOT in the active development. I don't own a ThinkPad laptop for years now, and I don't plan to continue development on this. Feel free to check forks fine people made or issue a.
Hack to control the keyboard backlight level on a Thinkpad Lenovo X1 Carbon Touch
tmp.c
/* gcc -o tmp `pkg-config --libs --cflags glib-2.0` tmp.c |
* |
* # modprobe ec_sys |
* |
* # watch -n 0.1 hexdump -C /sys/kernel/debug/ec/ec0/io |
* |
* 00000000 a7 05 a0 e2 00 86 05 00 00 00 47 00 00 03 00 10 |..........G.....| |
* 00000000 a7 05 a0 e2 00 86 05 00 00 00 47 00 00 43 00 10 |..........G..C..| |
* 00000000 a7 05 a0 e2 00 86 05 00 00 00 47 00 00 83 00 10 |..........G.....| |
* |
* # ./tmp 0 |
* # ./tmp 1 |
* # ./tmp 2 |
* |
*/ |
#include<glib.h> |
#include<sys/stat.h> |
#include<fcntl.h> |
#include<errno.h> |
char levels[] = { |
0x03, |
0x43, |
0x83 |
}; |
staticvoid |
usage (char **argv) |
{ |
g_print ('%s [level]n', argv[0]); |
g_print ('Where level is between 1 and 3n'); |
} |
intmain (int argc, char **argv) |
{ |
int fd; |
int level; |
if (argc < 2) { |
usage (argv); |
return1; |
} |
level = atoi(argv[1]); |
if (level < 0 || level > 3) { |
usage (argv); |
return1; |
} |
fd = open ('/sys/kernel/debug/ec/ec0/io', O_RDWR); |
if (fd < 0) { |
g_print ('open: %sn', g_strerror (errno)); |
return1; |
} |
if (lseek (fd, 0xd, SEEK_CUR) < 0) { |
g_print ('seek: %sn', g_strerror (errno)); |
return1; |
} |
if (write (fd, &levels[level], 1) < 0) { |
g_print ('write: %sn', g_strerror (errno)); |
return1; |
} |
return0; |
} |
commented Dec 29, 2013
Thank you for this great gist, as it solved our needed issue. I posted an answer based on this gist: |
commented Apr 19, 2014
Any chance this will work for the 2014 none touch version? |
commented Aug 12, 2014
Thanks! Confirmed this works on a Fedora 20 system, compiled with: |
commented Nov 9, 2014
Dude, nice one. 1 coffee @changetip |
commented Feb 23, 2015
is this code gonna work on Toshiba U945, or do I need change this code for getting my keyboard backling works? |
commented Aug 13, 2015
I've the 3rd edition of the x1 carbon, running ubuntu on it with kernel 3.19.0-25-generic. Seems to be that the path on this machine is different. There is no '/sys/kernel/debug/ec/ec0/io' on my system. Any idea? Thanks in advance! |
commented Aug 31, 2015
I am experiencing the same issue as @maltinho, with the same laptop. By the way, even if I expect no difference, my thinkpad is not a touch one. Hopping this will be solved, thanks in advance |
commented Sep 28, 2015
Works on ThinkPad T430s with Ubuntu 14.04, thanks! It's really helpful since my Fn key stopped working. |
commented Nov 6, 2015
Here's a version that doesn't need libglib: |
commented May 5, 2016
@maltinho, bruno066, just sudo modprobe ec_sys to get that (if your kernel is configured to ship it as a module) |
commented May 22, 2016
Here is a bash script version which does not require compilation. Works on my X260. Thanks for figuring out registers! |
commented Nov 2, 2018
On Fedora at least, compiled versions need chown root:root <filename>; chmod +s <filename> to gain root permissions.The ec_sys kernel module is not loaded automatically on my system (X230 Tablet) so needs # echo ec_sys > /etc/modules_load.d to load, and #echo options ec_sys write-support=1 > /etc/modprobe.d/ec_sys.conf to be able to write to the relevant device persistently after reboot.Once that's done, works like a charm! |
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment