[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Control of fan-speed on Lenovo Thinkpads
From: |
Jean Louis |
Subject: |
Control of fan-speed on Lenovo Thinkpads |
Date: |
Mon, 29 Mar 2021 23:36:25 +0300 |
Here is how I control Lenovo Thinkpad T410 (and others) fan speed. I
remember controlling it on different notebooks, I just forgot
which. You may find that you need to change variable
`my-fan-proc-file' to something else. Most of people do not need this,
it will be automatically controlled. But I need it sometimes to cool
down my fan and my palms.
(defun sudo (arguments)
"Executes list ARGUMENTS with system command `sudo'."
(let* ((command (format "sudo su -c -- root -c \"%s\"" (string-join (list
arguments))))
(return (shell-command-to-string command)))
return))
(defvar my-fan-proc-file "/proc/acpi/ibm/fan")
(defun fan-speed (arg)
"Controls fan speed provided user has superuser rights and system
command `sudo' works without password. Function will mostly work
on Lenovo Thinkpad notebooks. Prefix argument ARG shall be
numbers from 1 to 9. Numbers from 1 to 7 determine the fan speed
level, number 8 represents auto fan speed level and number 9
represents full fan speed. Activate with `C-u NUMBER M-x
fan-speed'. If invoked without arguments it will show the
contents of the fan control file."
(interactive "P")
(when (and (file-exists-p my-fan-proc-file)
(rcd-which "sudo"))
(if arg
(cond ((= arg 7) (sudo (format "echo level %s >> %s" arg
my-fan-proc-file)))
((= arg 8) (sudo (format "echo level auto >> %s"
my-fan-proc-file)))
((= arg 9) (sudo (format "echo level full-speed >> %s"
my-fan-proc-file)))
((and (< arg 7) (> arg 0)) (if (y-or-n-p (format "Really set fan
speed to %s?" arg))
(sudo (format "echo level %s >>
%s" 7 my-fan-proc-file))))
(t (message "Supply better numeric argument to this function from
1 to 9.")))
(message (file-to-string my-fan-proc-file)))))
Thanks,
Jean Louis
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
- Control of fan-speed on Lenovo Thinkpads,
Jean Louis <=
- Re: Control of fan-speed on Lenovo Thinkpads, Michael Albinus, 2021/03/30
- Re: Control of fan-speed on Lenovo Thinkpads, Jean Louis, 2021/03/30
- Re: Control of fan-speed on Lenovo Thinkpads, Jean Louis, 2021/03/30
- Re: Control of fan-speed on Lenovo Thinkpads, Michael Albinus, 2021/03/30
- Finding simpler better sudo for Emacs, Jean Louis, 2021/03/30
- Re: Finding simpler better sudo for Emacs, Michael Albinus, 2021/03/30
- Re: Finding simpler better sudo for Emacs, Jean Louis, 2021/03/30
- Re: Finding simpler better sudo for Emacs, Michael Albinus, 2021/03/30
- Re: Finding simpler better sudo for Emacs, Jean Louis, 2021/03/30
- Re: Finding simpler better sudo for Emacs, Michael Albinus, 2021/03/30