From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jean Louis Newsgroups: gmane.emacs.help Subject: Control of fan-speed on Lenovo Thinkpads Date: Mon, 29 Mar 2021 23:36:25 +0300 Message-ID: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7288"; mail-complaints-to="usenet@ciao.gmane.io" To: Help GNU Emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Mar 29 22:37:52 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lQye0-0001nl-Nw for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 29 Mar 2021 22:37:52 +0200 Original-Received: from localhost ([::1]:57086 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lQydz-0001Ou-OI for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 29 Mar 2021 16:37:51 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54512) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lQydI-0001Oc-AV for help-gnu-emacs@gnu.org; Mon, 29 Mar 2021 16:37:08 -0400 Original-Received: from stw1.rcdrun.com ([217.170.207.13]:57783) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lQydF-00057D-Ot for help-gnu-emacs@gnu.org; Mon, 29 Mar 2021 16:37:07 -0400 Original-Received: from localhost ([::ffff:41.202.241.58]) (AUTH: PLAIN securesender, TLS: TLS1.3,256bits,ECDHE_RSA_AES_256_GCM_SHA384) by stw1.rcdrun.com with ESMTPSA id 000000000001E1BA.0000000060623A4E.00000E57; Mon, 29 Mar 2021 13:36:30 -0700 Received-SPF: pass client-ip=217.170.207.13; envelope-from=support1@rcdrun.com; helo=stw1.rcdrun.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:128749 Archived-At: 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