Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Regolazione velocità ventola cpu notebook
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian)
View previous topic :: View next topic  
Author Message
saverik
Apprentice
Apprentice


Joined: 18 Oct 2008
Posts: 290

PostPosted: Fri Apr 21, 2017 1:08 pm    Post subject: Regolazione velocità ventola cpu notebook Reply with quote

Buongiorno,

con lìaggiornamento del kernel la rumorosità della ventola cpu e' aumentata.
Inutilmente ho cercato il modo di regolare la ventola di raffreddamento della cpu del mio notebook.
Ecco le mie azioni:

Code:
EliteBook saverik # sensors
acpitz-virtual-0
Adapter: Virtual device
temp1:        +41.0°C  (crit = +128.0°C)
temp2:         +0.0°C  (crit = +128.0°C)
temp3:        +38.0°C  (crit = +128.0°C)
temp4:        +31.0°C  (crit = +128.0°C)
temp5:        +27.0°C  (crit = +128.0°C)
temp6:         +0.0°C  (crit = +128.0°C)

coretemp-isa-0000
Adapter: ISA adapter
Physical id 0:  +44.0°C  (high = +86.0°C, crit = +100.0°C)
Core 0:         +41.0°C  (high = +86.0°C, crit = +100.0°C)
Core 1:         +43.0°C  (high = +86.0°C, crit = +100.0°C)

EliteBook saverik # pwmconfig
# pwmconfig revision 3.4.0+git_45ffa15cf02e63f70ff3b85c23e22dfbab7e8f9c
This program will search your sensors for pulse width modulation (pwm)
controls, and test each one to see if it controls a fan on
your motherboard. Note that many motherboards do not have pwm
circuitry installed, even if your sensor chip supports pwm.

We will attempt to briefly stop each fan using the pwm controls.
The program will attempt to restore each fan to full speed
after testing. However, it is ** very important ** that you
physically verify that the fans have been to full speed
after the program has completed.

/usr/sbin/pwmconfig: There are no pwm-capable sensor modules installed
EliteBook saverik # sensors-detect
# sensors-detect revision 3.4.0+git_45ffa15cf02e63f70ff3b85c23e22dfbab7e8f9c
# System: Hewlett-Packard HP EliteBook 8460p [A0000C02] (laptop)
# Board: Hewlett-Packard 161C
# Kernel: 4.9.16-gentoo x86_64
# Processor: Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz (6/42/7)

This program will help you determine which kernel modules you need
to load to use lm_sensors most effectively. It is generally safe
and recommended to accept the default answers to all questions,
unless you know what you're doing.

Gentoo config file protection is active. Every file this program will
modify must be merged before the change will become active using
default Gentoo tools such as dispatch-conf, cfg-update, and etc-update.

Some south bridges, CPUs or memory controllers contain embedded sensors.
Do you want to scan for them? This is totally safe. (YES/no): y
Module cpuid loaded successfully.
Silicon Integrated Systems SIS5595...                       No
VIA VT82C686 Integrated Sensors...                          No
VIA VT8231 Integrated Sensors...                            No
AMD K8 thermal sensors...                                   No
AMD Family 10h thermal sensors...                           No
AMD Family 11h thermal sensors...                           No
AMD Family 12h and 14h thermal sensors...                   No
AMD Family 15h thermal sensors...                           No
AMD Family 16h thermal sensors...                           No
AMD Family 15h power sensors...                             No
AMD Family 16h power sensors...                             No
Intel digital thermal sensor...                             Success!
    (driver `coretemp')
Intel AMB FB-DIMM thermal sensor...                         No
Intel 5500/5520/X58 thermal sensor...                       No
VIA C7 thermal sensor...                                    No
VIA Nano thermal sensor...                                  No

Some Super I/O chips contain embedded sensors. We have to write to
standard I/O ports to probe them. This is usually safe.
Do you want to scan for Super I/O sensors? (YES/no): y
Probing for Super-I/O at 0x2e/0x2f
Trying family `National Semiconductor/ITE'...               No
Trying family `SMSC'...                                     Yes
Found unknown chip with ID 0x0701
Probing for Super-I/O at 0x4e/0x4f
Trying family `National Semiconductor/ITE'...               No
Trying family `SMSC'...                                     Yes
Found `SMSC LPC47N217 Super IO'                             
    (no hardware monitoring capabilities)

Some hardware monitoring chips are accessible through the ISA I/O ports.
We have to write to arbitrary I/O ports to probe them. This is usually
safe though. Yes, you do have ISA I/O ports even if you do not have any
ISA slots! Do you want to scan the ISA I/O ports? (YES/no): y
Probing for `National Semiconductor LM78' at 0x290...       No
Probing for `National Semiconductor LM79' at 0x290...       No
Probing for `Winbond W83781D' at 0x290...                   No
Probing for `Winbond W83782D' at 0x290...                   No

Lastly, we can probe the I2C/SMBus adapters for connected hardware
monitoring devices. This is the most risky part, and while it works
reasonably well on most systems, it has been reported to cause trouble
on some systems.
Do you want to probe the I2C/SMBus adapters now? (YES/no): y
Sorry, no supported PCI bus adapters found.
Module i2c-dev loaded successfully.

Next adapter: i915 gmbus ssc (i2c-0)
Do you want to scan it? (yes/NO/selectively): y

Next adapter: i915 gmbus vga (i2c-1)
Do you want to scan it? (yes/NO/selectively): y

Next adapter: i915 gmbus panel (i2c-2)
Do you want to scan it? (yes/NO/selectively): y
Client found at address 0x28
Probing for `National Semiconductor LM78'...                No
Probing for `National Semiconductor LM79'...                No
Probing for `National Semiconductor LM80'...                No
Probing for `National Semiconductor LM96080'...             No
Probing for `Winbond W83781D'...                            No
Probing for `Winbond W83782D'...                            No
Probing for `Nuvoton NCT7802Y'...                           No
Probing for `Winbond W83627HF'...                           No
Probing for `Winbond W83627EHF'...                          No
Probing for `Winbond W83627DHG/W83667HG/W83677HG'...        No
Probing for `Asus AS99127F (rev.1)'...                      No
Probing for `Asus AS99127F (rev.2)'...                      No
Probing for `Asus ASB100 Bach'...                           No
Probing for `Analog Devices ADM1029'...                     No
Probing for `ITE IT8712F'...                                No

Next adapter: i915 gmbus dpc (i2c-3)
Do you want to scan it? (yes/NO/selectively): y

Next adapter: i915 gmbus dpb (i2c-4)
Do you want to scan it? (yes/NO/selectively): y

Next adapter: i915 gmbus dpd (i2c-5)
Do you want to scan it? (yes/NO/selectively): y

Next adapter: DPDDC-B (i2c-6)
Do you want to scan it? (yes/NO/selectively): y

Next adapter: DPDDC-C (i2c-7)
Do you want to scan it? (yes/NO/selectively): y

Next adapter: DPDDC-D (i2c-8)
Do you want to scan it? (yes/NO/selectively): y


Now follows a summary of the probes I have just done.
Just press ENTER to continue:

Driver `coretemp':
  * Chip `Intel digital thermal sensor' (confidence: 9)

Do you want to overwrite '/etc/modules-load.d/lm_sensors.conf'? (yes/NO): y

 * IMPORTANT: At least 1 config file(s) in '/etc' need updating.
 * See the CONFIGURATION FILES and CONFIGURATION FILES UPDATE TOOLS
 * sections of the emerge man page to learn how to update config files.

Note: You only have created the required configuration to autoload the
required modules to use your sensors on boot. If you want to start using
your sensors right now you have to either load them now once manually, to
reboot this system or to execute the following command(s) _AFTER_
you have updated your config files:

  # /etc/init.d/modules-load restart

Unloading i2c-dev... OK
Unloading cpuid... OK


da quanto sopra mi sembra di capire che il mio notebook (HP8460p) non possiede il modulo pwm .

Il file sensor3.conf non contiene il driver coretemp

Code:
# libsensors configuration file
# -----------------------------
#
# This default configuration file only includes statements which do not
# differ from one mainboard to the next. Only label, compute and set
# statements for internal voltage and temperature sensors are included.
#
# In general, local changes should not be added to this file, but rather
# placed in custom configuration files located in /etc/sensors.d. This
# approach makes further updates much easier.
#
# Such custom configuration files for specific mainboards can be found at
# http://www.lm-sensors.org/wiki/Configurations

chip "lm78-*" "lm79-*" "lm80-*" "lm96080-*"

    label temp1 "M/B Temp"


chip "w83792d-*"

    label in0 "VcoreA"
    label in1 "VcoreB"
    label in6 "+5V"
    label in7 "5VSB"
    label in8 "Vbat"

    set in6_min  5.0 * 0.90
    set in6_max  5.0 * 1.10
    set in7_min  5.0 * 0.90
    set in7_max  5.0 * 1.10
    set in8_min  3.0 * 0.90
    set in8_max  3.0 * 1.10


chip "w83793-*"

    label in0 "VcoreA"
    label in1 "VcoreB"
    label in7 "+5V"
    label in8 "5VSB"
    label in9 "Vbat"

    set in7_min  5.0 * 0.90
    set in7_max  5.0 * 1.10
    set in8_min  5.0 * 0.90
    set in8_max  5.0 * 1.10
    set in9_min  3.0 * 0.90
    set in9_max  3.0 * 1.10


chip "w83795g-*" "w83795adg-*"

    label in12 "+3.3V"
    label in13 "3VSB"
    label in14 "Vbat"

    set in12_min  3.3 * 0.90
    set in12_max  3.3 * 1.10
    set in13_min  3.3 * 0.90
    set in13_max  3.3 * 1.10
    set in14_min  3.0 * 0.90
    set in14_max  3.3 * 1.10


chip "via686a-*"

    label in0 "Vcore"
    label in2 "+3.3V"
    label in3 "+5V"
    label in4 "+12V"

    set in2_min  3.3 * 0.90
    set in2_max  3.3 * 1.10
    set in3_min  5.0 * 0.90
    set in3_max  5.0 * 1.10
    set in4_min 12.0 * 0.90
    set in4_max 12.0 * 1.10


chip "adm1025-*" "ne1619-*"

    label in1 "Vcore"
    label in2 "+3.3V"
    label in3 "+5V"
    label in4 "+12V"
    label in5 "VCC"

    set in2_min  3.3 * 0.90
    set in2_max  3.3 * 1.10
    set in3_min  5.0 * 0.90
    set in3_max  5.0 * 1.10
    set in5_min  3.3 * 0.90
    set in5_max  3.3 * 1.10
# Depending on how your chip is hardwired, you may or may not have
# +12V readings.
#    set in4_min 12.0 * 0.90
#    set in4_max 12.0 * 1.10

    label temp1 "CPU Temp"
    label temp2 "M/B Temp"


chip "lm87-*" "adm1024-*"

    label in1 "Vcore"
    label in2 "+3.3V"
    label in3 "+5V"
    label in4 "+12V"

    set in2_min  3.3 * 0.90
    set in2_max  3.3 * 1.10
    set in3_min  5.0 * 0.90
    set in3_max  5.0 * 1.10
    set in4_min 12.0 * 0.90
    set in4_max 12.0 * 1.10

    label temp1 "M/B Temp"
    label temp2 "CPU Temp"


chip "it87-*" "it8712-*" "it8716-*" "it8718-*" "it8720-*"

    label in8 "Vbat"


chip "fscpos-*" "fscher-*"
#FSC "Hermes"

    label in0 "+12V"
    label in1 "+5V"
    label in2 "Vbat"

    label temp1 "CPU Temp"
    label temp2 "M/B Temp"
    label temp3 "Aux Temp"


chip "fscscy-*"
#FSC "Scylla"

    label in0 "+12V"
    label in1 "+5V"
    label in2 "+3.3V"

    label temp1 "CPU0 Temp"
    label temp2 "CPU1 Temp"
    label temp3 "M/B Temp"
    label temp4 "Aux Temp"


chip "fschds-*"
# Fujitsu Technology Solutions, "Hades"-Chip

# Temperatures
    label temp1 "CPU Temp"
    label temp2 "Super I/O Temp"
    label temp3 "System Temp"

# Fans
    label fan1 "PSU Fan"
    label fan2 "CPU Fan"
    label fan3 "System FAN2"
    label fan4 "System FAN3"
    label fan5 "System FAN4"

# Voltages
    label in0 "+12V"
    label in1 "+5V"
    label in2 "Vbat"

chip "fscsyl-*"
# Fujitsu Technology Solutions, "Syleus"-Chip

# Temperatures
    label temp1 "CPU Temp"
    label temp4 "Super I/O Temp"
    label temp5 "Northbridge Temp"

# Fans
    label fan1 "CPU Fan"
    label fan2 "System FAN2"
    label fan3 "System FAN3"
    label fan4 "System FAN4"
    label fan7 "PSU Fan"

# Voltages
    label in0 "+12V"
    label in1 "+5V"
    label in2 "Vbat"
    label in3 "+3.3V"
    label in5 "+3.3V-Aux"

chip "vt1211-*"

    label in5 "+3.3V"

    label temp2 "SIO Temp"


chip "vt8231-*"

    label in5 "+3.3V"


chip "smsc47m192-*"

    label in1 "Vcore"
    label in2 "+3.3V"
    label in3 "+5V"
    label in4 "+12V"
    label in5 "VCC"

    set in2_min  3.3 * 0.90
    set in2_max  3.3 * 1.10
    set in3_min  5.0 * 0.90
    set in3_max  5.0 * 1.10
    set in4_min 12.0 * 0.90
    set in4_max 12.0 * 1.10
    set in5_min  3.3 * 0.90
    set in5_max  3.3 * 1.10

    label temp1 "SIO Temp"


chip "lm85-*" "lm85b-*" "lm85c-*" "adm1027-*" "adt7463-*" "adt7468-*" \
     "emc6d100-*" "emc6d102-*" "emc6d103-*" "emc6d103s-*"

    label in1 "Vcore"
    label in2 "+3.3V"
    label in3 "+5V"
    label in4 "+12V"

    set in2_min  3.3 * 0.90
    set in2_max  3.3 * 1.10
    set in3_min  5.0 * 0.90
    set in3_max  5.0 * 1.10
# Depending on how your chip is hardwired, you may or may not have
# +12V readings.
#    set in4_min 12.0 * 0.90
#    set in4_max 12.0 * 1.10

    label temp2 "M/B Temp"


chip "emc6w201-*"

    label in2 "+3.3V"
    label in3 "+5V"

    label temp6 "M/B Temp"


chip "pc87365-*" "pc87366-*"

# Voltage inputs

    label in7 "3VSB"
    label in8 "VDD"
    label in9 "Vbat"
    label in10 "AVDD"

    compute in7   @*2, @/2
    compute in8   @*2, @/2
    compute in10  @*2, @/2

# These are the operating conditions as recommended by National
# Semiconductor
    set in7_min   3.0
    set in7_max   3.6
    set in8_min   3.0
    set in8_max   3.6
    set in10_min  3.0
    set in10_max  3.6
# Depending on the hardware setup, the battery voltage may or may not
# be monitored.
#    set in9_min   2.4
#    set in9_max   3.6

    label temp3 "SIO Temp"

    set temp3_min    0
    set temp3_max   70
    set temp3_crit  85


chip "adm1030-*" "adm1031-*"

    label temp1 "M/B Temp"


chip "w83627thf-*"

    label in3 "+5V"
    label in7 "5VSB"
    label in8 "Vbat"

    # Internal resistors
    compute in3  @ * (1 + 34/51), @ / (1 + 34/51)
    compute in7  @ * (1 + 34/51), @ / (1 + 34/51)

    set in3_min  5.0 * 0.90
    set in3_max  5.0 * 1.10
    set in7_min  5.0 * 0.90
    set in7_max  5.0 * 1.10
# The battery voltage may or may not be monitored.
#    set in8_min  3.0 * 0.90
#    set in8_max  3.0 * 1.10


chip "w83627ehf-*" "w83627dhg-*" "w83667hg-*" "nct6775-*" "nct6776-*" "nct6779-*" "nct6791-*"

    label in0 "Vcore"
    label in2 "AVCC"
    label in3 "+3.3V"
    label in7 "3VSB"
    label in8 "Vbat"

    set in2_min  3.3 * 0.90
    set in2_max  3.3 * 1.10
    set in3_min  3.3 * 0.90
    set in3_max  3.3 * 1.10
    set in7_min  3.3 * 0.90
    set in7_max  3.3 * 1.10
    set in8_min  3.0 * 0.90
    set in8_max  3.3 * 1.10


chip "w83627uhg-*"

    label in2 "AVCC"
    label in3 "+5V"
    label in7 "5VSB"
    label in8 "Vbat"

    set in2_min  5.0 * 0.90
    set in2_max  5.0 * 1.10
    set in3_min  5.0 * 0.90
    set in3_max  5.0 * 1.10
    set in7_min  5.0 * 0.90
    set in7_max  5.0 * 1.10
    set in8_min  3.0 * 0.90
    set in8_max  3.3 * 1.10


chip "f71805f-*"

    label in0 "+3.3V"

    set in0_min  3.3 * 0.90
    set in0_max  3.3 * 1.10


chip "f71872f-*"

    label in0 "+3.3V"
    label in9 "Vbat"
    label in10 "3VSB"

    set in0_min   3.3 * 0.90
    set in0_max   3.3 * 1.10
    set in9_min   3.0 * 0.90
    set in9_max   3.0 * 1.10
    set in10_min  3.3 * 0.90
    set in10_max  3.3 * 1.10


chip "k8temp-*"

    label temp1 "Core0 Temp"
    label temp2 "Core0 Temp"
    label temp3 "Core1 Temp"
    label temp4 "Core1 Temp"


chip "dme1737-*"

    label in0 "5VSB"
    label in1 "Vcore"
    label in2 "+3.3V"
    label in3 "+5V"
    label in4 "+12V"
    label in5 "3VSB"
    label in6 "Vbat"

    label temp2 "SIO Temp"

    set in0_min  5.0 * 0.90
    set in0_max  5.0 * 1.10
    set in2_min  3.3 * 0.90
    set in2_max  3.3 * 1.10
    set in3_min  5.0 * 0.90
    set in3_max  5.0 * 1.10
    set in4_min 12.0 * 0.90
    set in4_max 12.0 * 1.10
    set in5_min  3.3 * 0.90
    set in5_max  3.3 * 1.10
    set in6_min  3.0 * 0.90
    set in6_max  3.0 * 1.10


chip "sch311x-*"

    label in1 "Vcore"
    label in2 "+3.3V"
    label in3 "+5V"
    label in4 "+12V"
    label in5 "3VSB"
    label in6 "Vbat"

    label temp2 "SIO Temp"

    set in2_min  3.3 * 0.90
    set in2_max  3.3 * 1.10
    set in3_min  5.0 * 0.90
    set in3_max  5.0 * 1.10
    set in4_min 12.0 * 0.90
    set in4_max 12.0 * 1.10
    set in5_min  3.3 * 0.90
    set in5_max  3.3 * 1.10
    set in6_min  3.0 * 0.90
    set in6_max  3.0 * 1.10


chip "sch5027-*"

    label in0 "5VSB"
    label in1 "Vcore"
    label in2 "+3.3V"
    label in5 "3VSB"
    label in6 "Vbat"

    label temp2 "SIO Temp"

    set in0_min  5.0 * 0.90
    set in0_max  5.0 * 1.10
    set in2_min  3.3 * 0.90
    set in2_max  3.3 * 1.10
    set in5_min  3.3 * 0.90
    set in5_max  3.3 * 1.10
    set in6_min  3.0 * 0.90
    set in6_max  3.0 * 1.10


chip "sch5127-*"

    label in2 "+3.3V"
    label in5 "3VSB"
    label in6 "Vbat"

    set in2_min  3.3 * 0.90
    set in2_max  3.3 * 1.10
    set in5_min  3.3 * 0.90
    set in5_max  3.3 * 1.10
    set in6_min  3.0 * 0.90
    set in6_max  3.0 * 1.10


chip "f71808e-*" "f71808a-*" "f71862fg-*" "f71869-*" "f71869a-*" "f71882fg-*" \
     "f71889fg-*" "f71889ed-*" "f71889a-*"

    label in0 "+3.3V"
    label in7 "3VSB"
    label in8 "Vbat"

    compute in0  @*2, @/2
    compute in7  @*2, @/2
    compute in8  @*2, @/2


chip "f71858fg-*" "f8000-*"

    label in0 "+3.3V"
    label in1 "3VSB"
    label in2 "Vbat"

    compute in0  @*2, @/2
    compute in1  @*2, @/2
    compute in2  @*2, @/2


chip "f81865f-*"

    label in0 "+3.3V"
    label in5 "3VSB"
    label in6 "Vbat"

    compute in0  @*2, @/2
    compute in5  @*2, @/2
    compute in6  @*2, @/2


chip "adt7473-*" "adt7475-*"

    label in2 "+3.3V"

    set in2_min  3.3 * 0.90
    set in2_max  3.3 * 1.10

    label temp2 "Board Temp"


chip "adt7476-*" "adt7490-*"

    label in1 "Vcore"
    label in2 "+3.3V"
    label in3 "+5V"
    label in4 "+12V"

    set in2_min  3.3 * 0.90
    set in2_max  3.3 * 1.10
    set in3_min  5.0 * 0.90
    set in3_max  5.0 * 1.10
# Depending on how your ADT7476 is hardwired, you may or may not have
# +12V readings.
#    set in4_min 12.0 * 0.90
#    set in4_max 12.0 * 1.10

    label temp2 "M/B Temp"

ed il file /usr/sbin/fancontrol presenta degli errori all'interno:
Code:

#!/bin/bash
#
# Simple script implementing a temperature dependent fan speed control
# Supported Linux kernel versions: 2.6.5 and later
#
# Version 0.71
#
# Usage: fancontrol [CONFIGFILE]
#
# Dependencies:
#   bash, egrep, sed, cut, sleep, readlink, lm_sensors :)
#
# Please send any questions, comments or success stories to
# marius.reiner@hdev.de
# Thanks!
#
# For configuration instructions and warnings please see fancontrol.txt, which
# can be found in the doc/ directory or at the website mentioned above.
#
#
#    Copyright 2003 Marius Reiner <marius.reiner@hdev.de>
#    Copyright (C) 2007-2014 Jean Delvare <jdelvare@suse.de>
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
#    MA 02110-1301 USA.
#
#

PIDFILE="/run/fancontrol.pid"

#DEBUG=1
MAX=255

function LoadConfig
{
   local fcvcount fcv

   echo "Loading configuration from $1 ..."
   if [ ! -r "$1" ]
   then
      echo "Error: Can't read configuration file" >&2
      exit 1
   fi

   # grep configuration from file
   INTERVAL=`egrep '^INTERVAL=.*$' $1 | sed -e 's/INTERVAL=//g'`
   DEVPATH=`egrep '^DEVPATH=.*$' $1 | sed -e 's/DEVPATH= *//g'`
   DEVNAME=`egrep '^DEVNAME=.*$' $1 | sed -e 's/DEVNAME= *//g'`
   FCTEMPS=`egrep '^FCTEMPS=.*$' $1 | sed -e 's/FCTEMPS=//g'`
   MINTEMP=`egrep '^MINTEMP=.*$' $1 | sed -e 's/MINTEMP=//g'`
   MAXTEMP=`egrep '^MAXTEMP=.*$' $1 | sed -e 's/MAXTEMP=//g'`
   MINSTART=`egrep '^MINSTART=.*$' $1 | sed -e 's/MINSTART=//g'`
   MINSTOP=`egrep '^MINSTOP=.*$' $1 | sed -e 's/MINSTOP=//g'`
   # optional settings:
   FCFANS=`egrep '^FCFANS=.*$' $1 | sed -e 's/FCFANS=//g'`
   MINPWM=`egrep '^MINPWM=.*$' $1 | sed -e 's/MINPWM=//g'`
   MAXPWM=`egrep '^MAXPWM=.*$' $1 | sed -e 's/MAXPWM=//g'`

   # Check whether all mandatory settings are set
   if [[ -z ${INTERVAL} || -z ${FCTEMPS} || -z ${MINTEMP} || -z ${MAXTEMP} || -z ${MINSTART} || -z ${MINSTOP} ]]
   then
      echo "Some mandatory settings missing, please check your config file!" >&2
      exit 1
   fi
   if [ "$INTERVAL" -le 0 ]
   then
      echo "Error in configuration file:" >&2
      echo "INTERVAL must be at least 1" >&2
      exit 1
   fi

   # write settings to arrays for easier use and print them
   echo
   echo "Common settings:"
   echo "  INTERVAL=$INTERVAL"

   let fcvcount=0
   for fcv in $FCTEMPS
   do
      if ! echo $fcv | egrep -q '='
      then
         echo "Error in configuration file:" >&2
         echo "FCTEMPS value is improperly formatted" >&2
         exit 1
      fi

      AFCPWM[$fcvcount]=`echo $fcv |cut -d'=' -f1`
      AFCTEMP[$fcvcount]=`echo $fcv |cut -d'=' -f2`
      AFCFAN[$fcvcount]=`echo $FCFANS |sed -e 's/ /\n/g' |egrep "${AFCPWM[$fcvcount]}" |cut -d'=' -f2`
      AFCMINTEMP[$fcvcount]=`echo $MINTEMP |sed -e 's/ /\n/g' |egrep "${AFCPWM[$fcvcount]}" |cut -d'=' -f2`
      AFCMAXTEMP[$fcvcount]=`echo $MAXTEMP |sed -e 's/ /\n/g' |egrep "${AFCPWM[$fcvcount]}" |cut -d'=' -f2`
      AFCMINSTART[$fcvcount]=`echo $MINSTART |sed -e 's/ /\n/g' |egrep "${AFCPWM[$fcvcount]}" |cut -d'=' -f2`
      AFCMINSTOP[$fcvcount]=`echo $MINSTOP |sed -e 's/ /\n/g' |egrep "${AFCPWM[$fcvcount]}" |cut -d'=' -f2`
      AFCMINPWM[$fcvcount]=`echo $MINPWM |sed -e 's/ /\n/g' |egrep "${AFCPWM[$fcvcount]}" |cut -d'=' -f2`
      [ -z "${AFCMINPWM[$fcvcount]}" ] && AFCMINPWM[$fcvcount]=0
      AFCMAXPWM[$fcvcount]=`echo $MAXPWM |sed -e 's/ /\n/g' |egrep "${AFCPWM[$fcvcount]}" |cut -d'=' -f2`
      [ -z "${AFCMAXPWM[$fcvcount]}" ] && AFCMAXPWM[$fcvcount]=255

      # verify the validity of the settings
      if [ "${AFCMINTEMP[$fcvcount]}" -ge "${AFCMAXTEMP[$fcvcount]}" ]
      then
         echo "Error in configuration file (${AFCPWM[$fcvcount]}):" >&2
         echo "MINTEMP must be less than MAXTEMP" >&2
         exit 1
      fi
      if [ "${AFCMAXPWM[$fcvcount]}" -gt 255 ]
      then
         echo "Error in configuration file (${AFCPWM[$fcvcount]}):" >&2
         echo "MAXPWM must be at most 255" >&2
         exit 1
      fi
      if [ "${AFCMINSTOP[$fcvcount]}" -ge "${AFCMAXPWM[$fcvcount]}" ]
      then
         echo "Error in configuration file (${AFCPWM[$fcvcount]}):" >&2
         echo "MINSTOP must be less than MAXPWM" >&2
         exit 1
      fi
      if [ "${AFCMINSTOP[$fcvcount]}" -lt "${AFCMINPWM[$fcvcount]}" ]
      then
         echo "Error in configuration file (${AFCPWM[$fcvcount]}):" >&2
         echo "MINSTOP must be greater than or equal to MINPWM" >&2
         exit 1
      fi
      if [ "${AFCMINPWM[$fcvcount]}" -lt 0 ]
      then
         echo "Error in configuration file (${AFCPWM[$fcvcount]}):" >&2
         echo "MINPWM must be at least 0" >&2
         exit 1
      fi

      echo
      echo "Settings for ${AFCPWM[$fcvcount]}:"
      echo "  Depends on ${AFCTEMP[$fcvcount]}"
      echo "  Controls ${AFCFAN[$fcvcount]}"
      echo "  MINTEMP=${AFCMINTEMP[$fcvcount]}"
      echo "  MAXTEMP=${AFCMAXTEMP[$fcvcount]}"
      echo "  MINSTART=${AFCMINSTART[$fcvcount]}"
      echo "  MINSTOP=${AFCMINSTOP[$fcvcount]}"
      echo "  MINPWM=${AFCMINPWM[$fcvcount]}"
      echo "  MAXPWM=${AFCMAXPWM[$fcvcount]}"
      let fcvcount=fcvcount+1
   done
   echo
}

function DevicePath()
{
   if [ -h "$1/device" ]
   then
      readlink -f "$1/device" | sed -e 's/^\/sys\///'
   fi
}

function DeviceName()
{
   if [ -r "$1/name" ]
   then
      cat "$1/name" | sed -e 's/[[:space:]=]/_/g'
   elif [ -r "$1/device/name" ]
   then
      cat "$1/device/name" | sed -e 's/[[:space:]=]/_/g'
   fi
}

function ValidateDevices()
{
   local OLD_DEVPATH="$1" OLD_DEVNAME="$2" outdated=0
   local entry device name path

   for entry in $OLD_DEVPATH
   do
      device=`echo "$entry" | sed -e 's/=[^=]*$//'`
      path=`echo "$entry" | sed -e 's/^[^=]*=//'`

      if [ "`DevicePath "$device"`" != "$path" ]
      then
         echo "Device path of $device has changed" >&2
         outdated=1
      fi
   done

   for entry in $OLD_DEVNAME
   do
      device=`echo "$entry" | sed -e 's/=[^=]*$//'`
      name=`echo "$entry" | sed -e 's/^[^=]*=//'`

      if [ "`DeviceName "$device"`" != "$name" ]
      then
         echo "Device name of $device has changed" >&2
         outdated=1
      fi
   done

   return $outdated
}

function FixupDeviceFiles
{
   local DEVICE="$1"
   local fcvcount pwmo tsen fan

   let fcvcount=0
   while (( $fcvcount < ${#AFCPWM[@]} )) # go through all pwm outputs
   do
      pwmo=${AFCPWM[$fcvcount]}
      AFCPWM[$fcvcount]=${pwmo//$DEVICE\/device/$DEVICE}
      if [ "${AFCPWM[$fcvcount]}" != "$pwmo" ]
      then
         echo "Adjusing $pwmo -> ${AFCPWM[$fcvcount]}"
      fi
      let fcvcount=$fcvcount+1
   done

   let fcvcount=0
   while (( $fcvcount < ${#AFCTEMP[@]} )) # go through all temp inputs
   do
      tsen=${AFCTEMP[$fcvcount]}
      AFCTEMP[$fcvcount]=${tsen//$DEVICE\/device/$DEVICE}
      if [ "${AFCTEMP[$fcvcount]}" != "$tsen" ]
      then
         echo "Adjusing $tsen -> ${AFCTEMP[$fcvcount]}"
      fi
      let fcvcount=$fcvcount+1
   done

   let fcvcount=0
   while (( $fcvcount < ${#AFCFAN[@]} )) # go through all fan inputs
   do
      fan=${AFCFAN[$fcvcount]}
      AFCFAN[$fcvcount]=${fan//$DEVICE\/device/$DEVICE}
      if [ "${AFCFAN[$fcvcount]}" != "$fan" ]
      then
         echo "Adjusing $fan -> ${AFCFAN[$fcvcount]}"
      fi
      let fcvcount=$fcvcount+1
   done
}

# Some drivers moved their attributes from hard device to class device
function FixupFiles
{
   local DEVPATH="$1"
   local entry device

   for entry in $DEVPATH
   do
      device=`echo "$entry" | sed -e 's/=[^=]*$//'`

      if [ -e "$device/name" ]
      then
         FixupDeviceFiles "$device"
      fi
   done
}

# Check that all referenced sysfs files exist
function CheckFiles
{
   local outdated=0 fcvcount pwmo tsen fan

   let fcvcount=0
   while (( $fcvcount < ${#AFCPWM[@]} )) # go through all pwm outputs
   do
      pwmo=${AFCPWM[$fcvcount]}
      if [ ! -w $pwmo ]
      then
         echo "Error: file $pwmo doesn't exist" >&2
         outdated=1
      fi
      let fcvcount=$fcvcount+1
   done

   let fcvcount=0
   while (( $fcvcount < ${#AFCTEMP[@]} )) # go through all temp inputs
   do
      tsen=${AFCTEMP[$fcvcount]}
      if [ ! -r $tsen ]
      then
         echo "Error: file $tsen doesn't exist" >&2
         outdated=1
      fi
      let fcvcount=$fcvcount+1
   done

   let fcvcount=0
   while (( $fcvcount < ${#AFCFAN[@]} )) # go through all fan inputs
   do
      # A given PWM output can control several fans
      for fan in $(echo ${AFCFAN[$fcvcount]} | sed -e 's/+/ /')
      do
         if [ ! -r $fan ]
         then
            echo "Error: file $fan doesn't exist" >&2
            outdated=1
         fi
      done
      let fcvcount=$fcvcount+1
   done

   if [ $outdated -eq 1 ]
   then
      echo >&2
      echo "At least one referenced file is missing. Either some required kernel" >&2
      echo "modules haven't been loaded, or your configuration file is outdated." >&2
      echo "In the latter case, you should run pwmconfig again." >&2
   fi

   return $outdated
}

if [ -f "$1" ]
then
   LoadConfig $1
else
   LoadConfig /etc/fancontrol
fi

# Detect path to sensors
if echo "${AFCPWM[0]}" | egrep -q '^/'
then
   DIR=/
elif echo "${AFCPWM[0]}" | egrep -q '^hwmon[0-9]'
then
   DIR=/sys/class/hwmon
elif echo "${AFCPWM[0]}" | egrep -q '^[1-9]*[0-9]-[0-9abcdef]{4}'
then
   DIR=/sys/bus/i2c/devices
else
   echo "$0: Invalid path to sensors" >&2
   exit 1
fi

if [ ! -d $DIR ]
then
   echo $0: 'No sensors found! (did you load the necessary modules?)' >&2
   exit 1
fi
cd $DIR

# Check for configuration change
if [ "$DIR" != "/" ] && [ -z "$DEVPATH" -o -z "$DEVNAME" ]
then
   echo "Configuration is too old, please run pwmconfig again" >&2
   exit 1
fi
if [ "$DIR" = "/" -a -n "$DEVPATH" ]
then
   echo "Unneeded DEVPATH with absolute device paths" >&2
   exit 1
fi
if ! ValidateDevices "$DEVPATH" "$DEVNAME"
then
   echo "Configuration appears to be outdated, please run pwmconfig again" >&2
   exit 1
fi
if [ "$DIR" = "/sys/class/hwmon" ]
then
   FixupFiles "$DEVPATH"
fi
CheckFiles || exit 1

if [ -f "$PIDFILE" ]
then
   echo "File $PIDFILE exists, is fancontrol already running?" >&2
   exit 1
fi
echo $$ > "$PIDFILE"

# $1 = pwm file name
function pwmdisable()
{
   local ENABLE=${1}_enable

   # No enable file? Just set to max
   if [ ! -f $ENABLE ]
   then
      echo $MAX > $1
      return 0
   fi

   # Try pwmN_enable=0
   echo 0 > $ENABLE 2> /dev/null
   if [ `cat $ENABLE` -eq 0 ]
   then
      # Success
      return 0
   fi

   # It didn't work, try pwmN_enable=1 pwmN=255
   echo 1 > $ENABLE 2> /dev/null
   echo $MAX > $1
   if [ `cat $ENABLE` -eq 1 -a `cat $1` -ge 190 ]
   then
      # Success
      return 0
   fi

   # Nothing worked
   echo "$ENABLE stuck to" `cat $ENABLE` >&2
   return 1
}

# $1 = pwm file name
function pwmenable()
{
   local ENABLE=${1}_enable

   if [ -f $ENABLE ]
   then
      echo 1 > $ENABLE 2> /dev/null
      if [ $? -ne 0 ]
      then
         return 1
      fi
   fi
   echo $MAX > $1
}

function restorefans()
{
   local status=$1 fcvcount pwmo

   echo 'Aborting, restoring fans...'
   let fcvcount=0
   while (( $fcvcount < ${#AFCPWM[@]} )) # go through all pwm outputs
   do
      pwmo=${AFCPWM[$fcvcount]}
      pwmdisable $pwmo
      let fcvcount=$fcvcount+1
   done
   echo 'Verify fans have returned to full speed'
   rm -f "$PIDFILE"
   exit $status
}

trap 'restorefans 0' SIGQUIT SIGTERM
trap 'restorefans 1' SIGHUP SIGINT

# main function
function UpdateFanSpeeds
{
   local fcvcount
   local pwmo tsens fan mint maxt minsa minso minpwm maxpwm
   local tval pwmpval fanval min_fanval one_fan one_fanval
   local -i pwmval

   let fcvcount=0
   while (( $fcvcount < ${#AFCPWM[@]} )) # go through all pwm outputs
   do
      #hopefully shorter vars will improve readability:
      pwmo=${AFCPWM[$fcvcount]}
      tsens=${AFCTEMP[$fcvcount]}
      fan=${AFCFAN[$fcvcount]}
      let mint="${AFCMINTEMP[$fcvcount]}*1000"
      let maxt="${AFCMAXTEMP[$fcvcount]}*1000"
      minsa=${AFCMINSTART[$fcvcount]}
      minso=${AFCMINSTOP[$fcvcount]}
      minpwm=${AFCMINPWM[$fcvcount]}
      maxpwm=${AFCMAXPWM[$fcvcount]}

      read tval < ${tsens}
      if [ $? -ne 0 ]
      then
         echo "Error reading temperature from $DIR/$tsens"
         restorefans 1
      fi

      read pwmpval < ${pwmo}
      if [ $? -ne 0 ]
      then
         echo "Error reading PWM value from $DIR/$pwmo"
         restorefans 1
      fi

      # If fanspeed-sensor output shall be used, do it
      if [[ -n ${fan} ]]
      then
         min_fanval=100000
         fanval=
         # A given PWM output can control several fans
         for one_fan in $(echo $fan | sed -e 's/+/ /')
         do
            read one_fanval < ${one_fan}
            if [ $? -ne 0 ]
            then
               echo "Error reading Fan value from $DIR/$one_fan" >&2
               restorefans 1
            fi

            # Remember the minimum, it only matters if it is 0
            if [ $one_fanval -lt $min_fanval ]
            then
               min_fanval=$one_fanval
            fi

            if [ -z "$fanval" ]
            then
               fanval=$one_fanval
            else
               fanval="$fanval/$one_fanval"
            fi
         done
      else
         min_fanval=1  # set it to a non zero value, so the rest of the script still works
      fi

      # debug info
      if [ "$DEBUG" != "" ]
      then
         echo "pwmo=$pwmo"
         echo "tsens=$tsens"
         echo "fan=$fan"
         echo "mint=$mint"
         echo "maxt=$maxt"
         echo "minsa=$minsa"
         echo "minso=$minso"
         echo "minpwm=$minpwm"
         echo "maxpwm=$maxpwm"
         echo "tval=$tval"
         echo "pwmpval=$pwmpval"
         echo "fanval=$fanval"
         echo "min_fanval=$min_fanval"
      fi

      if (( $tval <= $mint ))
        then pwmval=$minpwm # below min temp, use defined min pwm
      elif (( $tval >= $maxt ))
        then pwmval=$maxpwm # over max temp, use defined max pwm
      else
        # calculate the new value from temperature and settings
        pwmval="(${tval}-${mint})*(${maxpwm}-${minso})/(${maxt}-${mint})+${minso}"
        if [ $pwmpval -eq 0 -o $min_fanval -eq 0 ]
        then # if fan was stopped start it using a safe value
           echo $minsa > $pwmo
         # Sleep while still handling signals
         sleep 1 &
         wait
        fi
      fi
      echo $pwmval > $pwmo # write new value to pwm output
      if [ $? -ne 0 ]
      then
         echo "Error writing PWM value to $DIR/$pwmo" >&2
         restorefans 1
      fi
      if [ "$DEBUG" != "" ]
      then
         echo "new pwmval=$pwmval"
      fi
      let fcvcount=$fcvcount+1
   done
}

echo 'Enabling PWM on fans...'
let fcvcount=0
while (( $fcvcount < ${#AFCPWM[@]} )) # go through all pwm outputs
do
   pwmo=${AFCPWM[$fcvcount]}
   pwmenable $pwmo
   if [ $? -ne 0 ]
   then
      echo "Error enabling PWM on $DIR/$pwmo" >&2
      restorefans 1
   fi
   let fcvcount=$fcvcount+1
done

echo 'Starting automatic fan control...'

# main loop calling the main function at specified intervals
while true
do
   UpdateFanSpeeds
   # Sleep while still handling signals
   sleep $INTERVAL &
   wait
done




suggerimenti sul come si possa intervenire?
_________________
Elitebook G840_G3 cpu i5-6300u ,16GbRam,ToshibaNvme512Gb
Linux= Gentoo64bit+xfce4+LightDm+Openrc
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum