Il y a actuellement 228 visiteurs
Jeudi 28 Mars 2024
accueilactualitésdossierscomparer les prixtélécharger gratuitement vos logicielsoffres d'emploiforum informatique
Connexion
Créer un compte

Logiciel de monitoring sous Fedora. • page 2

L'informatique, ce n'est pas qu'un PC équipé de Windows. Ce forum est dédié aux utilisateurs de systèmes d'exploitation dérivés d'unix (GNU/Linux, *BSD, etc...) et aux autres OS alternatifs.

Message le 30 Jan 2009 13:18

Mdr :lol:

Sinon oui en hexa, en ce moment 0X33 = 51°C
Avatar de l'utilisateur
Skynet
Moderateur
Moderateur
 
Messages: 14807
Inscription: 19 Juil 2007 21:12
 


Message le 30 Jan 2009 13:38

C'est quoi ton script perl, tu peux le copier/coller ?
Parce que :
1 - on pourrait le modifier pour avoir du décimal
2 - ce serait surtout interessant de voir pourquoi et où le script trouve ses valeurs
Avatar de l'utilisateur
CaSa
PC-Infopraticien
PC-Infopraticien
 
Messages: 9040
Inscription: 13 Mai 2003 16:32
Localisation: Sisteron... et jamais loin d'une Debian
 

Message le 30 Jan 2009 13:45

Oui pourquoi pas :)

Code: Tout sélectionner
#!/usr/bin/perl -w

# Copyright (C) 2007  Michael Kurz     michi.kurz (at) googlemail.com
# Copyright (C) 2007  Petr Tomasek     tomasek (#) etf,cuni,cz
# Copyright (C) 2007  Carlos Corbacho  cathectic (at) gmail.com
#
# Version 0.6.1 (2007-11-08)
#
# 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 3
# 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.


require 5.004;

use strict;
use Fcntl;
use POSIX;
use File::Basename;

sub initialize_ioports
{
  sysopen (IOPORTS, "/dev/port", O_RDWR)
    or die "/dev/port: $!
";
  binmode IOPORTS;
}

sub close_ioports
{
  close (IOPORTS)
    or print "Warning: $!
";
}



sub inb
{
  my ($res,$nrchars);
  sysseek IOPORTS, $_[0], 0 or return -1;
  $nrchars = sysread IOPORTS, $res, 1;
  return -1 if not defined $nrchars or $nrchars != 1;
  $res = unpack "C",$res ;
  return $res;
}

# $_[0]: value to write
# $_[1]: port to write
# Returns: -1 on failure, 0 on success.
sub outb
{
  if ($_[0] > 0xff)
  {
    my ($package, $filename, $line, $sub) = caller(1);
    print "
*** Called outb with value=$_[1] from line $line
",
          "*** (in $sub). PLEASE REPORT!
",
          "*** Terminating.
";
    exit(-1);
  }
  my $towrite = pack "C", $_[0];
  sysseek IOPORTS, $_[1], 0 or return -1;
  my $nrchars = syswrite IOPORTS, $towrite, 1;
  return -1 if not defined $nrchars or $nrchars != 1;
  return 0;
}

sub wait_write
{
   my $i = 0;
   while ((inb($_[0]) & 0x02) && ($i < 10000)) {
      sleep(0.01);
      $i++;
   }
   return -($i == 10000);
}

sub wait_read
{
   my $i = 0;
   while (!(inb($_[0]) & 0x01) && ($i < 10000)) {
      sleep(0.01);
      $i++;
   }
   return -($i == 10000);
}

sub wait_write_ec
{
   wait_write(0x66);
}

sub wait_read_ec
{
   wait_read(0x66);
}

sub send_ec
{
   if (!wait_write_ec()) { outb($_[0], 0x66); }
   if (!wait_write_ec()) { outb($_[1], 0x62); }
}

sub write_ec
{
   if (!wait_write_ec()) { outb(0x81, 0x66 ); }
   if (!wait_write_ec()) { outb($_[0], 0x62); }
   if (!wait_write_ec()) { outb($_[1], 0x62); }
}

sub read_ec
{
   if (!wait_write_ec()) { outb(0x80, 0x66 ); }
   if (!wait_write_ec()) { outb($_[0], 0x62); }
   if (!wait_read_ec())  { inb(0x62); }
}

sub write_kc
{
   if (!wait_write(0x64)) { outb($_[0], 0x64); }
   if (!wait_write(0x64)) { outb($_[1], 0x60); }
}

sub print_regs
{
   initialize_ioports();

   my @arr = ("00","10","20","30","40","50","60","70","80","90","A0","B0","C0","D0","E0","F0", "");

   my $i = 0;
   my $t = 0;
   print "
     00   01   02   03   04   05   06   07   |   08   09   0A   0B   0C   0D   0E   0F
";
   print "     __   __   __   __   __   __   __   __   |   __   __   __   __   __   __   __   __
";
   print "00 |   ";
   for ($i = 0; $i < 256; $i++)
   {
      $t = read_ec($i);
      print $t;
      print "   ";
      if ((($i + 1) % 8) == 0){
         if ((($i + 1) % 16) == 0) {
            if ($i != 255) { print "
$arr[(($i-(($i + 1) % 16)) / 16) + 1] |   "; }
         } else {
            print "|   ";
         }
      }
   }
   
   print "
";
   
   close_ioports();
}

sub write_temp
{
   initialize_ioports();
   write_ec($_[0],$_[1]);
   close_ioports();
}

sub testnum
{
   my $i;
   for ($i = 0; $i<256;$i++) {
      if ($_[0] eq "$i") { return 1 };
   }
   return 0;
}

my $ii;

if (!$ARGV[0]){
        print "wrong arguments!
";
   print "usage:
";
   print "'acer_ec regs'             dumps all ec registers
";
   print "'acer_ec ledon'             switch on 'mail LED' (WMID)
";
   print "'acer_ec ledoff'             switch off 'mail LED' (WMID)
";
   print "'acer_ec getled'             get 'mail LED' status (WMID)
";
   print "'acer_ec getled2'             get 'mail LED' status(AMW0)
";
   print "'acer_ec getwireless'             get 'wireless' status (AMW0)
";
   print "'acer_ec gettouch'             is the touchpad disabled?
";
   print "'acer_ec setfanthresh <temp>'             set temperature threshhold to <temp>, DANGEROUS!
";
   print "'acer_ec getfanthresh'             get temperature threshhold
";
   print "'acer_ec <temp-number> <temperature>'    for setting a temperature
";
   print "where <temp-number> is from 0-7, and <temperture> is from 0-255
";
   print "'acer_ec ?= <reg>'       Query register's value
";
   print "'acer_ec := <reg> <val>'    Set register's value
";
   print "'acer_ec +f <reg> <val>'    Or register's value with val (to set flags)
";
   print "'acer_ec -f <reg> <val>'    And register's value with ~val (to clear flags)
";
   print "'forcekc'    Try all possible values on writeable RAM of keyboard controller
";
   print "'kcw <cmd> <val>'    Write a command and a value to the keyboard controller
";
} elsif ($ARGV[0] eq "regs") {
   print_regs();
} elsif ($ARGV[0] eq "getled") {
   # TM2490 only (WMID)
   initialize_ioports();
   if (read_ec(0x9f)&0x01) {
      print "Mail LED on
";
   } else {
      print "Mail LED off
"; }
   close_ioports();
} elsif ($ARGV[0] eq "getled2") {
   # Aspire 5020 only (AMW0)
   initialize_ioports();
   if (read_ec(0x0A)&0x80) {
      print "Mail LED on
";
   } else {
      print "Mail LED off
"; }
   close_ioports();
} elsif ($ARGV[0] eq "getwireless") {
   # Aspire 5020 only (AMW0)
   initialize_ioports();
   if (read_ec(0x0A)&0x4) {
      print "Wireless on
";
   } else {
      print "Wireless off
"; }
   close_ioports();
} elsif ($ARGV[0] eq "gettouch") {
   # TM2490 only - needs testing
   initialize_ioports();
   if (read_ec(0x9e)&0x08) {
      print "touchpad disabled
";
   } else {
      print "touchpad enabled
"; }
   close_ioports();
} elsif ($ARGV[0] eq "?=") {
   initialize_ioports();
   my $r = hex($ARGV[1]);
   printf("REG[0x%02x] == 0x%02x
", $r, read_ec($r));
   close_ioports();
} elsif ($ARGV[0] eq ":=") {
   initialize_ioports();
   my $r = hex($ARGV[1]);
   my $f = hex($ARGV[2]);
   my $val = read_ec($r);
   printf("REG[0x%02x] == 0x%02x
", $r, $val);
   printf("REG[0x%02x] := 0x%02x
", $r, $f);
        write_ec( $r, $f);
   printf("REG[0x%02x] == 0x%02x
", $r, read_ec($r));
   close_ioports();
} elsif ($ARGV[0] eq "+f") {
   initialize_ioports();
   my $r = hex($ARGV[1]);
   my $f = hex($ARGV[2]);
   my $val = read_ec($r);
   printf("REG[0x%02x] == 0x%02x
", $r, $val);
   printf("REG[0x%02x] := 0x%02x
", $r, $val | $f);
        write_ec( $r, $val | $f);
   printf("REG[0x%02x] == 0x%02x
", $r, read_ec($r));
   close_ioports();
} elsif ($ARGV[0] eq "-f") {
   initialize_ioports();
   my $r = hex($ARGV[1]);
   my $f = hex($ARGV[2]);
   my $val = read_ec($r);
   printf("REG[0x%02x] == 0x%02x
", $r, $val);
   printf("REG[0x%02x] := 0x%02x
", $r, $val & ~$f);
        write_ec( $r, $val & ~$f);
   printf("REG[0x%02x] == 0x%02x
", $r, read_ec($r));
   close_ioports();
} elsif ($ARGV[0] eq "ledon") {
   # TM2490 only - needs testing
   initialize_ioports();
   if (!wait_write(0x64)) { outb(0x59, 0x64); }
   if (!wait_write(0x64)) { outb(0x92,   0x60); }
   close_ioports();
} elsif ($ARGV[0] eq "ledoff") {
   # TM2490 only - needs testing
   initialize_ioports();
   if (!wait_write(0x64)) { outb(0x59, 0x64); }
   if (!wait_write(0x64)) { outb(0x93,   0x60); }
   close_ioports();
} elsif ($ARGV[0] eq "getfanthresh") {
   initialize_ioports();
   $ii=read_ec(0xa9);
   close_ioports();
        print "Temperature threshhold: $ii (celsius)
";
} elsif (($ARGV[0] eq "setfanthresh") && testnum($ARGV[1])) {
   write_temp(0xA9,$ARGV[1]);
} elsif ($ARGV[0] eq "setbright") {
   # Aspire 5020 only (AMW0)
   if ($ARGV[1] >= 0 && $ARGV[1] <= 15) {
      write_temp(0x83, $ARGV[1]);
   } else {
      print "second argument must be a number between 0 and 15
";
   }
} elsif ($ARGV[0] eq "forcekc") {
   # Be smart - we only send the commands for writing to keyboard RAM
   initialize_ioports();
   my ($kbdata, $cont, $kbreg);
   for ($kbreg = 0x40; $kbreg <= 0x5f; $kbreg++) {
      for ($kbdata = 0; $kbdata < 256; $kbdata++) {
         write_kc($kbreg, $kbdata);

         print sprintf("%0#4x", $kbreg), ", ", sprintf("%0#4x", $kbdata), "
";
         print "Continue? y/n: ";
         $cont = <STDIN>;
         if ($cont eq "n") {
            last;
         }
      }
   }
   close_ioports();
} elsif ($ARGV[0] eq "kcw") {
   initialize_ioports();
   write_kc($ARGV[1], $ARGV[2]);
   close_ioports();
} else {
   print "wrong arguments!
";
}


Ce qui me permet d'une de contrôler quand se déclenche le ventilateur et de deux de
voir la température du CPU.
Avatar de l'utilisateur
Skynet
Moderateur
Moderateur
 
Messages: 14807
Inscription: 19 Juil 2007 21:12
 

Message le 30 Jan 2009 13:48

Oki merci.
Je regarderai et testerai le script sur mon PC par curiosité, ce week-end si je trouve le temps de bidouiller ;)
Avatar de l'utilisateur
CaSa
PC-Infopraticien
PC-Infopraticien
 
Messages: 9040
Inscription: 13 Mai 2003 16:32
Localisation: Sisteron... et jamais loin d'une Debian
 

Message le 30 Jan 2009 13:50

Ok merci ;), il est accompagné d'un autre fichier, un script shell, tu le veux aussi ?

EDIT : Le voici :

Code: Tout sélectionner
#!/bin/bash
#
# acerfand - Rudimentary automatic fan control for noisy Acer Aspire One models
#
# Author Rachel Greenham
#
# version 0.01

LOGGER=$(which logger)
if [ ! -x $LOGGER ] ; then
   LOGGER="/usr/bin/logger"
fi
if [ ! -x $LOGGER ] ; then
   echo "Warning, logger can't be found. Will log to stdout"
   unset LOGGER
fi

LOGLEVEL="info"

log() {
   if [ ! -z "$LOGGER" ] ; then
      $LOGGER -p daemon.$LOGLEVEL -t acerfand "$@"
   else
      echo "$@"
   fi
}

info() {
   LOGLEVEL="info"
   log "$@"
}

notice() {
   LOGLEVEL="notice"
#   log "$@"
}

err() {
   LOGLEVEL="err"
   log "$@"
}

if pgrep acerfand  | grep -v $$ > /dev/null; then
   info "acerfand already running"
   exit 0
fi

ME=$(readlink -f $0)

ACEREC=$(which acer_ec.pl)
if [ -z $ACEREC ] ; then
   ACEREC=$(dirname $ME)/acer_ec.pl
fi

if [ ! -r $ACEREC ] ; then
   err "acer_ec.pl can't be found"
   exit 1
fi

INTERVAL=5
FANOFF=60
FANAUTO=70

if [ -r "/etc/acerfand.conf" ] ; then
   source "/etc/acerfand.conf"
fi

R_FAN=55
R_TEMP=58

FAN_CMD_OFF=af
FAN_CMD_AUTO=00

FAN_STATE_UNRECOGNIZED=0
FAN_STATE_AUTO=1
FAN_STATE_OFF=2
FAN_STATE_NAMES=("Unrecognized" "Auto" "Off")
FAN_STATE_CMDS=("$FAN_CMD_OFF" "$FAN_CMD_AUTO" "$FAN_CMD_OFF")

acer_ec() {
   perl $ACEREC $@
}

getTemp() {
   TEMP=$[$(acer_ec ?= $R_TEMP | cut -f 3 -d' ')]
   notice "temp: $TEMP"
}

getRawFanState() {
   RAW_FAN_STATE=$(acer_ec ?= $R_FAN | cut -f 3 -d' ')
}

getFanState() {
   FAN_STATE=$FAN_STATE_UNRECOGNIZED
   getRawFanState
   if [ "$RAW_FAN_STATE" == "0xaf" ]; then
      FAN_STATE=$FAN_STATE_OFF
   else
      let A="$RAW_FAN_STATE & 0x10" || true
      if [ "$A == 0" ] ; then
         # ASSUMPTION: All values with nybble 1==0 denote auto
         FAN_STATE=$FAN_STATE_AUTO
      fi
   fi
   notice "read fan state ${FAN_STATE_NAMES[$FAN_STATE]}"
}

setFan() {
   info "Set fan ${FAN_STATE_NAMES[$1]}"
   acer_ec := $R_FAN ${FAN_STATE_CMDS[$1]} > /dev/null
}

govern() {
trap "info exiting;setFan $FAN_STATE_AUTO; exit" INT TERM EXIT
info "Starting to govern acer fan speed. Interval: $INTERVAL, fan-off: $FANOFF, fan-auto: $FANAUTO"
while true; do
   getTemp
   getFanState
   case "$FAN_STATE" in
      $FAN_STATE_AUTO)
         if [ "$TEMP" -le "$FANOFF" ] ; then
            setFan $FAN_STATE_OFF
         fi
         ;;
      $FAN_STATE_OFF)
         if [ "$TEMP" -ge "$FANAUTO" ] ; then
            setFan $FAN_STATE_AUTO
         fi
         ;;
      *)
         # weird state. Let's turn it off,
         # then decide next time around
         setFan $FAN_STATE_OFF
         ;;
   esac
   sleep $INTERVAL
done
}

set -e

govern &

Avatar de l'utilisateur
Skynet
Moderateur
Moderateur
 
Messages: 14807
Inscription: 19 Juil 2007 21:12
 

Message le 31 Jan 2009 11:35

Pfou, faut commenter vos programmes les gens, y'en a qui sont morts comme ça ... :wink:
Avatar de l'utilisateur
H3bus
Moderateur
Moderateur
 
Messages: 12195
Inscription: 08 Avr 2008 15:13
Localisation: /home/h3bus
 

Message le 31 Jan 2009 12:43

:lol: Je ne suis pas le programmeur ;).
Avatar de l'utilisateur
Skynet
Moderateur
Moderateur
 
Messages: 14807
Inscription: 19 Juil 2007 21:12
 

Précédente


Sujets similaires

Message Renseignements logiciel
Yop,J'ai une question pour les grands maitres des virus.J'ai quelqu'un qui as acheter CE LOGICIEL.Il essaye de me le faire adopter mais ....Pouvez vous donner votre avis ? ( même si j'ai ma petite idée ).Merci
Réponses: 2

Message Logiciel dématérialisation de documents
Hello !Je suis à la recherche d'un logiciel de dématérialisation pour aider mon entreprise à se conformer à la nouvelle législation en matière de dématérialisation des documents mais aussi dans les avantages que cela peu procurer. Avec l'entrée en vigueur imminente de cette loi, il est crucial pour ...
Réponses: 2

Message Recherche logiciel de base de données
Bonjour à tous !J'ai utilisé (il y a longtemps !) un logiciel sous DOS de base de données pour mes fichiers clients, gestion, ec. il s'agissait de DBase IV...Existe t-il un tel logiciel ou équivalent pour PC sous Win 10 ou Linux (Ubuntu) ?Je n'ai pas trouvé....Merci d'avance.
Réponses: 3

Message Logiciel recovery sms
Bonjour ami(e)s du jour, et bonsoir ami(e)s du soir, Tous d'abord, merci à toi, d'avoir pris le temps de cliquer sur mon poste pour y répondre ! Mon problème: J'aimerais restaurer des SMS " effacée " et je n'arrive pas à trouver de logiciel gratuit ... Qu'est ce que vous avez à me conseill ...
Réponses: 4

Message Logiciel sauvegarde
Yop, Pour une cliente.Elle as un logiciel de sauvegarde sur DD externe.Il fonctionne bien mais ce qu'il lui gêne c'est que le log n?enlève pas les fichiers qu'elle enlève sur son pc.Donc je crois qu'il faut plutôt un log qui synchronise, donc si elle enlève sur son pc, il doit aussi enlever le même ...
Réponses: 2

Message Logiciel gestion réservation
Bonjour,je suis à la recherche pour mon association d'un logiciel de gestion de réservation qui ferait ceci : le demandeur complète un formulaire en ligne, ce qui génère par exemple un fichier Excel (je pense là à un google form).Ensuite, pour la facturation, il faudrait qu'un fichier Word par exemp ...
Réponses: 1

Message PC lent au départ et fonctionement logiciel peu effcace
Bonjour à vous tousvoici le descriptif de mon PC portableHP Laptop 15Intel Celeron N 4000 - 1,10 GHzWindows 10-21H1RAM 4 GoHD 1 To En août 2022 j'ai été suivi par Héraclès pour les mêmes raisons à savoir que j'ai un portable très lent au démarrage, des logiciels très longs à la réponse avec entre au ...
Réponses: 8


Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 11 invités


.: Nous contacter :: Flux RSS :: Données personnelles :.