From: Jean Louis <bugs@gnu.support>
To: Help GNU Emacs <help-gnu-emacs@gnu.org>
Subject: Control of fan-speed on Lenovo Thinkpads
Date: Mon, 29 Mar 2021 23:36:25 +0300 [thread overview]
Message-ID: <courier.0000000060623A4E.00000E57@stw1.rcdrun.com> (raw)
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
next reply other threads:[~2021-03-29 20:36 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-29 20:36 Jean Louis [this message]
2021-03-30 8:12 ` Control of fan-speed on Lenovo Thinkpads Michael Albinus
2021-03-30 9:42 ` Jean Louis
2021-03-30 9:44 ` Jean Louis
2021-03-30 10:13 ` Michael Albinus
2021-03-30 10:23 ` Finding simpler better sudo for Emacs Jean Louis
2021-03-30 10:34 ` Michael Albinus
2021-03-30 10:43 ` Jean Louis
2021-03-30 10:52 ` Michael Albinus
2021-03-30 11:05 ` Jean Louis
2021-03-30 11:13 ` Michael Albinus
2021-03-30 11:40 ` Jean Louis
2021-03-30 15:01 ` Control of fan-speed on Lenovo Thinkpads Stefan Monnier
2021-03-30 20:06 ` Jean Louis
2021-03-31 1:23 ` Stefan Monnier
2021-03-31 5:35 ` Jean Louis
2021-03-31 14:23 ` Stefan Monnier
2021-03-31 20:02 ` Jean Louis
2021-03-31 20:19 ` Stefan Monnier
2021-04-01 9:46 ` Jean Louis
[not found] <8735wcogti.fsf@gmail.com>
[not found] ` <YGNq8IGh12I+QL9I@protected.localdomain>
2021-03-31 5:49 ` Utkarsh Singh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=courier.0000000060623A4E.00000E57@stw1.rcdrun.com \
--to=bugs@gnu.support \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.