#!/usr/bin/env perl use warnings; use diagnostics; use lib "../../lib"; use HotSaNICparser; use HotSaNICshellio; my @CONFmod=HotSaNICparser::read_settings(".",$MODNAME); if ( ! -e "settings" ) { $OUTFILE="settings"; } else { $OUTFILE="settings.new"; } open OUTFILE,">$OUTFILE" || die "could not open $MODNAME settings file for writing.\n"; print OUTFILE "# SHORT DESCRIPTION # # all entries have to be of the form: # SENSOR=,,,,,, # # path to the file under /proc which holds the device-data # # an unique filename for the database # # a brief description for the webpage # # 2 for fan-speed and 3 for temperature and voltage # this represents the position of the value in the # proc-file # # correction-factor to scale the data correctly # ( to understand this look at the lm_sensors howto ) # # value to add to shift the data correctly # ( for e.g. +12V - see lm_sensors howto ) # # unit to be shown in diagrams and on webpage # ( for example °C, V, Volts, RPM etc... ) # # Example: # # SENSOR=/proc/sys/dev/sensors/gl518sm-i2c-0-2d/temp,temp,CPU temp,3,1,0,°C # # # # FreeBSD Users: # The only fields required are: # which is an item from the left column in 'mbmon -rc1' # as above # as above # # Example: # SENSOR=,TEMP0,Motherboard Temp,,,,C "; if ($OUTFILE eq "settings.new") { for (@CONFmod) { print OUTFILE $_,"\n" if /^SENSOR *=/; } } else { my @files=(); if ( -e "/proc/sys/dev/sensors") { require File::Find; $File::Find::name=""; # suppress stupid warning... File::Find::find( {wanted => sub { lstat($_) && -f _ && push @files, $File::Find::name; } }, "/proc/sys/dev/sensors"); } print "\n"; for $file (@files) { if ( $file !~ /sensors\/(eeprom|chips)/ ) { print $file,":\n"; open FILE,$file; $line= || ""; chomp $line; print " ",$line,"\n"; close FILE; $input=HotSaNICshellio::askyesno("Do you want to use this file","n"); if ($input eq "y") { # configure sensor # @entries=split /\s/,$line; ($dbname=$file) =~ s/.*\///g; $descr="value"; $unit="units"; $device="some"; if ( $dbname =~ /temp/ ) { $unit="°C"; $descr="temperature"; } elsif ( $dbname =~ /v/ ) { $unit="Volts"; $descr="voltage"; } elsif ( $dbname =~ /fan/ ) { $unit="RPM"; $descr="speed"; } if ( $dbname =~ /vdd/) { $device="CPU"; } print "SENSOR=$file,$dbname,$device $descr,".($#entries+1).",1,0,$unit\n" } } print "\n"; } } close OUTFILE; if ($OUTFILE eq "settings.new") { HotSaNICparser::backup_file("settings"); rename "settings.new","settings"; } if ($^O eq "freebsd") { print "FreeBSD support is ONLY via xmbmon (http://www.nt.phys.kyushu-u.ac.jp/shimizu/download/) version 2.0 or greater. Please ensure you have this installed. "; } print "Please check the settings file and adapt it to satisfy your needs. for your info: this configuration is a bit tricky\n"; WebSVN - hotsanic - Blame - Rev 29 - /branches/HotSaNIC-0.5.0-jablonecka/modules/sensors/setup.pl
  jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [branches/] [HotSaNIC-0.5.0-jablonecka/] [modules/] [sensors/] [setup.pl] - Blame information for rev 29

 

Line No. Rev Author Line

Powered by WebSVN 2.2.1