Автор Тема: fans on fedora10  (Прочетена 3596 пъти)

detence

  • Напреднали
  • *****
  • Публикации: 139
  • Distribution: Ubuntu
  • Window Manager: gnome
  • nedkov
    • Профил
    • WWW
fans on fedora10
« -: Jan 11, 2009, 19:24 »
Здравейте можете ли да ми кажете програма или нещо подобно което да намели скоростта на вентилаторите на моя компютър dell studio 1535 защото постоянно работят на максимум и вдигат страшно много шум. докато преди на убунтуто се включваха за малко и после пак ставаха тихи.
Благодаря предварително.
Активен

BULFON

  • Administrator
  • Напреднали
  • *****
  • Публикации: 478
  • Distribution: Fedora
  • Window Manager: Gnome
    • Профил
Re: fans on fedora10
« Отговор #1 -: Jan 11, 2009, 20:20 »
свали и инсталирай htop
(yum install htop)
и ни кажи коя програма заема най-много от процесорното време.
Активен

фонокартен телефонен апарат

detence

  • Напреднали
  • *****
  • Публикации: 139
  • Distribution: Ubuntu
  • Window Manager: gnome
  • nedkov
    • Профил
    • WWW
Re: fans on fedora10
« Отговор #2 -: Jan 11, 2009, 20:33 »
ами най много процесорно време харчи гнома.
http://pics.data.bg/categories/1/%d0%be%d0%b1%d1%89%d0%b8/85af43004c2be032762a835cfcd6e51f/htop/
Активен

BULFON

  • Administrator
  • Напреднали
  • *****
  • Публикации: 478
  • Distribution: Fedora
  • Window Manager: Gnome
    • Профил
Re: fans on fedora10
« Отговор #3 -: Jan 13, 2009, 10:16 »
И други имат твоя проблем. Трябва да си обновиш биоса. Намерих го, като потърсих в google: "dell studio 1535 fans"

http://shield008.blogspot.com/2008/12/dell-studio-1535-fan-seed-problem-and.html
Активен

фонокартен телефонен апарат

detence

  • Напреднали
  • *****
  • Публикации: 139
  • Distribution: Ubuntu
  • Window Manager: gnome
  • nedkov
    • Профил
    • WWW
Re: fans on fedora10
« Отговор #4 -: Jan 21, 2009, 19:43 »
Добре това го направих всичко update-нах биоса, но проблема с вентилаторите остава все още са по шумни от колкото с ubuntu.
Резултатите на lm sensor-a са 50градуса а едното ядро и 51 на другото. Което според мен е добре. Но вентилаторите въртят доста повече от преди.
Активен

tyuio

  • Гост
Re: fans on fedora10
« Отговор #5 -: Jan 22, 2009, 00:01 »
какво да ти река, виж ако на живо цд на убунту е ок. Какви модули, демони и процеси ти е заредило и виж дали може да направиш същата дандания на федорката.
Активен

c2h5oh

  • Напреднали
  • *****
  • Публикации: 675
  • Distribution: CentOS 7.4 Fedora 28
  • Window Manager: Plasma Desktop
    • Профил
Re: fans on fedora10
« Отговор #6 -: Jan 22, 2009, 03:34 »
Настройките на cpuspeed? fancontrol? Там всичко ли е наред?
Активен

detence

  • Напреднали
  • *****
  • Публикации: 139
  • Distribution: Ubuntu
  • Window Manager: gnome
  • nedkov
    • Профил
    • WWW
Re: fans on fedora10
« Отговор #7 -: Jan 22, 2009, 08:10 »
не знам дали ти трябва това, но нека предположим.
Това е за cpuspeed
Цитат
#!/bin/sh
# Startup script for cpuspeed
#
# chkconfig: 12345 06 99
# description: Run dynamic CPU speed daemon and/or load appropriate
#              cpu frequency scaling kernel modules and/or governors

# Source function library.
. /etc/rc.d/init.d/functions

prog="cpuspeed"

[ -f /usr/sbin/$prog ] || exit 5

# Get config.
if [ -f /etc/sysconfig/$prog ]; then
  . /etc/sysconfig/$prog
fi

cpu0freqd=/sys/devices/system/cpu/cpu0/cpufreq
cpus='/sys/devices/system/cpu/cpu[0-9]*'
testpat="${cpus}/cpufreq/scaling_driver"
lockfile="/var/lock/subsys/$prog"
xendir="/proc/xen"
logger="/usr/bin/logger -p info -t $prog"
IGNORE_NICE=${IGNORE_NICE:-0}
module_loaded=false

some_file_exist() {
  while [ "$1" ] ; do
    [ -f "$1" ] && return 0
    shift
  done
  return 1
}

governor_is_module() {
  # Check to see if the requested cpufreq governor
  # is provided as a kernel module or not
  module_info=`/sbin/modinfo cpufreq-${governor}`
  return $?
}

governor_module_loaded() {
# Check to see if we have a module loaded for
# the current cpufreq governor
  if [ -e ${cpu0freqd}/scaling_governor ]; then
    governor=`cat ${cpu0freqd}/scaling_governor`
  else
    governor="none"
  fi
  if [ "${governor}" != "none" -a `/sbin/lsmod | grep -c -w "cpufreq.${governor}"` -ge 1 ]; then
    return 0
  fi
  return 1
}

adjust_cpufreq() {
  # First arg is a param under $cpu/cpufreq/
  # Second arg is the value you want to set that param to
  for cpu in ${cpus}; do
    echo $2 > $cpu/cpufreq/$1
  done
}

start_cpuspeed() {
  echo -n $"Starting $prog: "
  # cpuspeed daemon thresholds are specified as idle percentages,
  # cpufreq modules as busy percentages, so we need to do some
  # math here for use of unified config...
  # DOWN_THRESHOLD doesn't mean exactly the same thing for
  # cpuspeed as it does for the cpufreq governors, but close
  # enough, and if not specified, we use same defaults as governors.
  if [ -n "$UP_THRESHOLD" ]; then
    let UP_THRESHOLD=100-$UP_THRESHOLD
  else
    UP_THRESHOLD=20
  fi
  if [ -n "$DOWN_THRESHOLD" ]; then
    let DOWN_THRESHOLD=100-$DOWN_THRESHOLD
  else
    DOWN_THRESHOLD=80
  fi
  OPTS="$OPTS -p $UP_THRESHOLD $DOWN_THRESHOLD"
  if [ -n "$MIN_SPEED" ]; then
    OPTS="$OPTS -m $MIN_SPEED"
  fi
  if [ -n "$MAX_SPEED" ]; then
    OPTS="$OPTS -M $MAX_SPEED"
  fi
  if [ "$IGNORE_NICE" -eq 1 ]; then
    OPTS="$OPTS -n"
  fi
  daemon $prog -d $OPTS
  RETVAL=$?
  return $RETVAL
}

stop_cpuspeed() {
  if [ -n "`pidof $prog`" ]; then
    echo -n $"Stopping $prog: "
    killproc $prog -USR1
    killproc $prog -INT
  fi
  if [ -n "`pidof $prog`" ]; then
    killproc $prog
  fi
  RETVAL=$?
  return $RETVAL
}

start() {
  if [ ! -f $lockfile ] && [ ! -d "$xendir" ]; then
    cpu_vendor=$(awk '/vendor_id/{print $3}' /proc/cpuinfo | tail -n 1)
    cpu_family=$(awk '/cpu family/{print $4}' /proc/cpuinfo | tail -n 1)
    if ! some_file_exist $testpat ; then
      # Attempt to load scaling_driver if not loaded
      # but it is configured
      if [ -n "$DRIVER" ]; then
        /sbin/modprobe "$DRIVER"
      elif [ "$cpu_vendor" == AuthenticAMD ] && [ "$cpu_family" -ge 7 ]; then
        # Try loading powernow-k8 if this is an AMD processor,
        # family 7 or greater (Athlon XP/MP was family 6)
        pk8m=$(/sbin/modinfo powernow-k8 > /dev/null 2>&1)
        if [ "$?" -eq 0 ]; then
          /sbin/modprobe powernow-k8 2> /dev/null
          [ -d ${cpu0freqd} ] || /sbin/modprobe -r powernow-k8 2> /dev/null
        fi
      elif [ -d /proc/acpi ]; then
        # use ACPI as a fallback
        /sbin/modprobe acpi-cpufreq 2> /dev/null
        # if even ACPI didn't work, remove it
        # and then next test will bail out.
        [ -d ${cpu0freqd} ] || /sbin/modprobe -r acpi-cpufreq 2> /dev/null
      fi
      if [ ! -d ${cpu0freqd} -a "$cpu_vendor" == GenuineIntel ]; then
        # last-ditch effort for Intel proc boxes, try our neutered p4-clockmod
        # to get at least passive cooling support (no clock changes)
        /sbin/modprobe p4-clockmod 2> /dev/null
        [ -d ${cpu0freqd} ] || /sbin/modprobe -r p4-clockmod 2> /dev/null
      fi
    fi

    # If we get this far with no driver, we must have no scaling.
    # We're doomed.
    [ ! -f ${cpu0freqd}/scaling_driver ] && return 6

    # Okay, we have a driver, carry on...
    drv=`cat ${cpu0freqd}/scaling_driver`

    # Figure out default governor to use
    case "$drv" in
      centrino|powernow-k8|acpi-cpufreq|e_powersaver)
        default_governor=ondemand
        ;;
      p4-clockmod)
        default_governor=none
        ;;
      *)
        default_governor=userspace
        ;;
    esac
    governor=${GOVERNOR:-${default_governor}}

    # Load governor module, if need be, and validate
    governor_is_module && /sbin/modprobe cpufreq-${governor}
    if [ `grep -c -w ${governor} ${cpu0freqd}/scaling_available_governors` -ge 1 ]; then
      $logger "Enabling ${governor} cpu frequency scaling governor"
    else
      $logger "Invalid governor \"${governor}\" specified, falling back to ${default_governor}"
      governor_is_module && /sbin/modprobe -r cpufreq-${governor}
      governor=${default_governor}
      governor_is_module && /sbin/modprobe cpufreq-${governor}
    fi

    # Set governor
    adjust_cpufreq scaling_governor ${governor}

    # Run cpuspeed daemon for userspace gov, kernel ones otherwise
    if [ "${governor}" == "userspace" ]; then
      start_cpuspeed
      RETVAL=$?
    elif [ "${drv}" == "p4-clockmod" -a "${governor}" == "none" ]; then
      echo -n "Enabling p4-clockmod driver (passive cooling only): "
      success
      RETVAL=0
    else
      if [ -n "$MIN_SPEED" ]; then
        adjust_cpufreq scaling_min_freq $MIN_SPEED
      fi
      if [ -n "$MAX_SPEED" ]; then
        adjust_cpufreq scaling_max_freq $MAX_SPEED
      fi
      if [ -n "$UP_THRESHOLD" -a ${governor} == "ondemand" ]; then
        adjust_cpufreq ondemand/up_threshold $UP_THRESHOLD
      fi
      if [ -n "$DOWN_THRESHOLD" -a ${governor} == "conservative" ]; then
        adjust_cpufreq conservative/down_threshold $DOWN_THRESHOLD
      fi
      if [ "$IGNORE_NICE" -eq 1 -a ${governor} == "ondemand" -o ${governor} == "conservative" ]; then
        adjust_cpufreq ${governor}/ignore_nice_load $IGNORE_NICE
      fi
      echo -n "Enabling ${governor} cpu frequency scaling: "
      success
      RETVAL=0
    fi
    echo
    # Technically, not quite right in non-cpuspeed daemon
    # cases, but close enough to indicate that we're
    # doing some sort of cpu frequency scaling.
    [ $RETVAL = 0 ] && touch $lockfile
  else
    if [ -d "$xendir" ]; then
      $logger "CPU Frequency scaling is currently not supported on xen kernels"
    fi
    return 0
  fi
  return $RETVAL
}

stop() {
  [ ! -f ${cpu0freqd}/scaling_driver ] && return 0
  drv=`cat ${cpu0freqd}/scaling_driver`
  governor_module_loaded && module_loaded=true

  if [ "${governor}" != "userspace" ]; then
    echo -n "Disabling ${governor} cpu frequency scaling: "
    $logger "Disabling ${governor} cpu frequency scaling governor"
    for cpu in ${cpus}; do
      echo userspace > $cpu/cpufreq/scaling_governor
      cat $cpu/cpufreq/cpuinfo_max_freq > $cpu/cpufreq/scaling_setspeed
    done
    if [ $module_loaded == true ]; then
      /sbin/modprobe -r cpufreq-${governor}
    fi
    success
    RETVAL=0
  else
    stop_cpuspeed
    RETVAL=$?
  fi
  echo
  [ -n "$DRIVER" ] && /sbin/modprobe -r $DRIVER
  [ $RETVAL = 0 ] && RETVAL=$?
  [ $RETVAL = 0 ] && rm -f $lockfile
  return $RETVAL
}

case "$1" in
  start)
    start
    ;;

  stop)
    stop
    ;;

  status)
    governor_module_loaded && module_loaded=true
    if [ -d "$xendir" ]; then
      echo "Frequency scaling not supported under xen kernels"
    elif [ $module_loaded == true -o ${governor} == "performance" ]; then
      echo "Frequency scaling enabled using ${governor} governor"
    else
      status $prog
    fi
    ;;

  restart)
    stop
    start
    ;;

  condrestart)
    governor_module_loaded && module_loaded=true
    if [ $module_loaded == true -o -n "`pidof $prog`" -o ${governor} == "performance" ]; then
      stop
      start
    fi
    ;;

  *)
    echo $"Usage: $0 {start|stop|restart|condrestart|status}"
    exit 3
    ;;
esac

exit $RETVAL
A това за fancontrol
Цитат
#!/bin/bash
#
# Simple script implementing a temperature dependent fan speed control
#
# Version 0.67
#
# Usage: fancontrol [CONFIGFILE]
#
# Dependencies:
#   bash, egrep, sed, cut, sleep, 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-2008 Jean Delvare <khali@linux-fr.org>
#
#    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="/var/run/fancontrol.pid"

#DEBUG=1
MAX=255

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

declare -i pwmval

function LoadConfig {
   echo "Loading configuration from $1 ..."
   # grep configuration from file
   INTERVAL=`egrep '^INTERVAL=.*$' $1 | sed -e 's/INTERVAL=//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!"
      exit 1
   fi
   if [ "$INTERVAL" -le 0 ]
   then
      echo "Error in configuration file:"
      echo "INTERVAL must be at least 1"
      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:"
         echo "FCTEMPS value is improperly formatted"
         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]}):"
         echo "MINTEMP must be less than MAXTEMP"
         exit 1
      fi
      if [ "${AFCMAXPWM[$fcvcount]}" -gt 255 ]
      then
         echo "Error in configuration file (${AFCPWM[$fcvcount]}):"
         echo "MAXPWM must be at most 255"
         exit 1
      fi
      if [ "${AFCMINSTOP[$fcvcount]}" -ge "${AFCMAXPWM[$fcvcount]}" ]
      then
         echo "Error in configuration file (${AFCPWM[$fcvcount]}):"
         echo "MINSTOP must be less than MAXPWM"
         exit 1
      fi
      if [ "${AFCMINSTOP[$fcvcount]}" -lt "${AFCMINPWM[$fcvcount]}" ]
      then
         echo "Error in configuration file (${AFCPWM[$fcvcount]}):"
         echo "MINSTOP must be greater than or equal to MINPWM"
         exit 1
      fi
      if [ "${AFCMINPWM[$fcvcount]}" -lt 0 ]
      then
         echo "Error in configuration file (${AFCPWM[$fcvcount]}):"
         echo "MINPWM must be at least 0"
         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
}

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

DIR=/proc/sys/dev/sensors
if [ ! -d $DIR ]
then
   # For Linux 2.6, detect if config file uses the hwmon class or not yet
   if echo "${AFCPWM[0]}" | egrep -q '^hwmon[0-9]'
   then
      SDIR=/sys/class/hwmon
   else
      SDIR=/sys/bus/i2c/devices
   fi

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

# $1 = pwm file name
function pwmdisable()
{
   if [ -n "$SYSFS" ]
   then
      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
   else
      echo $MAX 0 > $1
   fi
}

# $1 = pwm file name
function pwmenable()
{
   if [ "$SYSFS" = "1" ]
   then
      ENABLE=${1}_enable
      if [ -f $ENABLE ]
      then
         echo 1 > $ENABLE 2> /dev/null
         if [ $? -ne 0 ]
         then
            return 1
         fi
      fi
      echo $MAX > $1
   else
      echo $MAX 1 > $1
   fi
}

function restorefans()
{
   local status=$1
   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 {
   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]}
      mint=${AFCMINTEMP[$fcvcount]}
      maxt=${AFCMAXTEMP[$fcvcount]}
      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
      if [ "$SYSFS" = "1" ]
      then
         let tval="($tval+500)/1000"
      else
         tval=`echo ${tval} | cut -d' ' -f3 | cut -d'.' -f1`
      fi

      read pwmpval < ${pwmo}
      if [ $? -ne 0 ]
      then
         echo "Error reading PWM value from $DIR/$pwmo"
         restorefans 1
      fi
      if [ "$SYSFS" != "1" ]
      then
         pwmpval=`echo ${pwmpval} | cut -d' ' -f1`
      fi
      
      # If fanspeed-sensor output shall be used, do it
      if [[ -n ${fan} ]]
      then
         read fanval < ${fan}
         if [ $? -ne 0 ]
         then
            echo "Error reading Fan value from $DIR/$fan"
            restorefans 1
         fi
         if [ "$SYSFS" != "1" ]
         then
            fanval=`echo ${fanval} | cut -d' ' -f2`
         fi
      else
         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"
      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 $fanval -eq 0 ]
        then # if fan was stopped start it using a safe value
           echo $minsa > $pwmo
         # Sleep while still handling signals
         read < <(exec sleep 1)
        fi
      fi
      echo $pwmval > $pwmo # write new value to pwm output
      if [ $? -ne 0 ]
      then
         echo "Error writing PWM value to $DIR/$pwmo"
         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"
      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
   read < <(exec sleep $INTERVAL)
done
P.S. Извинявам се за дългият отговоро. И все пак ако не е това което ти трябва кажи как да намеря точната информация.
« Последна редакция: Jan 22, 2009, 08:15 от detence »
Активен

Подобни теми
Заглавие Започната от Отговора Прегледи Последна публикация
For Star Wars Fans
Хумор
Martin_Beltov 1 2536 Последна публикация Jun 30, 2005, 12:11
от Dimitar_Ouzounoff