[-]
[+]
|
Changed |
sensors.spec
|
|
[-]
[+]
|
Deleted |
lm_sensors-r5757-LPC47M233-not-supported.patch
^
|
@@ -1,16 +0,0 @@
-Upstream commit: http://www.lm-sensors.org/changeset/5757
-
-The SMSC LPC47M233 isn't currently supported. If it ever is, it will most
-probably not be by the smsc47m1 driver.
-
---- lm_sensors-3.1.1.orig/prog/detect/sensors-detect
-+++ lm_sensors-3.1.1/prog/detect/sensors-detect
-@@ -1415,7 +1415,7 @@ use constant FEAT_SMBUS => (1 << 7);
- features => FEAT_FAN,
- }, {
- name => "SMSC LPC47M233 Super IO Sensors",
-- driver => "smsc47m1",
-+ driver => "to-be-written",
- devid => 0x6b80,
- devid_mask => 0xff80,
- logdev => 0x0a,
|
[-]
[+]
|
Deleted |
lm_sensors-r5760-rename-modprobe-conf.patch
^
|
@@ -1,53 +0,0 @@
-Upstream commit: http://www.lm-sensors.org/changeset/5760
-
-Recent versions of module-init-tools only want *.conf files under
-/etc/modprobe.d. So rename our configuration file to lm_sensors.conf
-there. Also let "make install" rename the file if it already exists.
-
---- lm_sensors-3.1.1.orig/Makefile
-+++ lm_sensors-3.1.1/Makefile
-@@ -118,6 +118,7 @@ SRCDIRS += lib/test
- MKDIR := mkdir -p
- RMDIR := rmdir
- RM := rm -f
-+MV := mv -f
- BISON := bison
- FLEX := flex
- AR := ar
---- lm_sensors-3.1.1.orig/etc/Module.mk
-+++ lm_sensors-3.1.1/etc/Module.mk
-@@ -28,6 +28,10 @@ install-etc:
- fi
- $(MKDIR) $(DESTDIR)$(BINDIR)
- $(INSTALL) -m 755 $(ETC_DIR)/sensors-conf-convert $(DESTDIR)$(BINDIR)
-+ if [ -e $(DESTDIR)$(ETCDIR)/modprobe.d/lm_sensors \
-+ -a ! -e $(DESTDIR)$(ETCDIR)/modprobe.d/lm_sensors.conf ] ; then \
-+ $(MV) $(DESTDIR)$(ETCDIR)/modprobe.d/lm_sensors $(DESTDIR)$(ETCDIR)/modprobe.d/lm_sensors.conf ; \
-+ fi
-
- user_install :: install-etc
-
---- lm_sensors-3.1.1.orig/prog/detect/sensors-detect
-+++ lm_sensors-3.1.1/prog/detect/sensors-detect
-@@ -5430,8 +5430,8 @@ sub write_config
-
- if (defined $configfile) {
- my $have_modprobe_d = -d '/etc/modprobe.d';
-- printf "Do you want to \%s /etc/modprobe.d/lm_sensors? (\%s): ",
-- (-e '/etc/modprobe.d/lm_sensors' ? 'overwrite' : 'generate'),
-+ printf "Do you want to \%s /etc/modprobe.d/lm_sensors.conf? (\%s): ",
-+ (-e '/etc/modprobe.d/lm_sensors.conf' ? 'overwrite' : 'generate'),
- ($have_modprobe_d ? 'YES/no' : 'yes/NO');
- $_ = <STDIN>;
- if (($have_modprobe_d and not m/^\s*n/i) or m/^\s*y/i) {
-@@ -5439,8 +5439,8 @@ sub write_config
- mkdir('/etc/modprobe.d', 0777)
- or die "Sorry, can't create /etc/modprobe.d ($!)";
- }
-- open(local *MODPROBE_D, ">/etc/modprobe.d/lm_sensors")
-- or die "Sorry, can't create /etc/modprobe.d/lm_sensors ($!)";
-+ open(local *MODPROBE_D, ">/etc/modprobe.d/lm_sensors.conf")
-+ or die "Sorry, can't create /etc/modprobe.d/lm_sensors.conf ($!)";
- print MODPROBE_D "# Generated by sensors-detect on " . scalar localtime() . "\n";
- print MODPROBE_D $configfile;
- close(MODPROBE_D);
|
[-]
[+]
|
Changed |
lm_sensors-3.3.2.tar.bz2/CHANGES
^
|
@@ -1,6 +1,53 @@
lm-sensors CHANGES file
-----------------------
+3.3.2 (2012-03-14)
+ libsensors: Added support for new sysfs attributes
+ Change sysfs detection to survive upcoming kernel changes
+ sensord: Fix memory leaks revealed by valgrind
+ Minor performance improvements
+ sensors: Added support for new sysfs attributes
+ Display both instantaneous and average power if available.
+ Report thermal sensor type 1 as CPU diode
+ Align power values better
+ Fix power interval output
+ fancontrol: Support setup where one PWM output controls several fans
+ Output error messages to stderr
+ sensors-detect: Stop calling for PIIX5 SMBus testers
+ Improve filtering of fake DMI data
+ Print DMI system/product version if available
+ Fix loading of the cpuid module
+ Make LM73 detection less problematic
+ Add detection of National Semiconductor LM96163
+ Add detection of GMT G781
+ Properly handle Super-I/O chips without logical device
+ Add detection of National Semiconductor LM96080
+ Add detection of ITE IT8771E
+ Add detection of ITE IT8781F, IT8782F and IT8783F
+ Add detection of ITE IT8510E/TE/G, IT8511E/TE/G,
+ IT8513E/F/G, and IT8518E
+ Add detection of ST Microelectronics STTS2002 and STTS3000
+ Add detection of IDT TSE2002GB2, TS3000GB2, Microchip MCP9804,
+ and Atmel AT30TS00
+
+3.3.1 (2011-07-21)
+ isadump: Add support for word (16-bit) and long (32-bit) reads
+ isaset: Add support for word (16-bit) and long (32-bit) writes
+ sensors.conf.default: Add a section for the EMC6W201
+ sensors-detect: Add AMD family 15h CPU detection
+ Add detection of ADT7461A / NCT1008
+ Add detection of ITE IT8516E/F/G
+ Integrate with systemd
+ Drop unreliable smart battery detection
+ Add detection of SMSC EMC6W201
+ Drop unreliable detection of Maxim MAX6650
+ Add detection of SMSC EMC2300
+ Add detection of MAX6642
+ Add detection of ITE IT8772E
+ Don't advertise the ipmisensors driver
+ Add detection of SA56004
+ Add detection of LM95245
+
3.3.0 (2011-03-28)
Makefile: Check for bison and flex
libsensors: Add support for intrusion detection (#2370)
|
[-]
[+]
|
Changed |
lm_sensors-3.3.2.tar.bz2/doc/developers/lm_sensors.lsm
^
|
@@ -1,7 +1,7 @@
Begin4
Title: lm_sensors
-Version: 3.3.0
-Entered-date: 2011-03-28
+Version: 3.3.2
+Entered-date: 2012-03-14
Description: Hardware health monitoring package for Linux. It consists of
a library to allow applications to read sensors data more
easily, and of an example program to pretty print this data.
@@ -11,8 +11,8 @@
Author: khali@linux-fr.org (Jean Delvare)
Maintained-by: khali@linux-fr.org (Jean Delvare)
Primary-site: http://dl.lm-sensors.org /lm-sensors/releases/
- lm_sensors-3.3.0.tar.bz2
- lm_sensors-3.3.0.tar.bz2.sig
+ lm_sensors-3.3.2.tar.bz2
+ lm_sensors-3.3.2.tar.bz2.sig
Alternate-site: ftp.netroedge.com /pub/lm-sensors/
Copying-policy: GPL/LGPL
End
|
[-]
[+]
|
Changed |
lm_sensors-3.3.2.tar.bz2/doc/donations
^
|
@@ -96,6 +96,10 @@
ASUSTeK ASUS P5MT-S 2006-03
Platform for W83792D related development Rudolf Marek
+Winbond Asus P4P800-VM 2006-08
+ This board has a Winbond W83627THF hardware Jean Delvare
+ monitoring chip.
+
Winbond Asus P4P800-X, Pentium 4 2.8 GHz, 512 MB RAM 2006-08
This board has an (hidden) Intel 82801EB Jean Delvare
(ICH5) SMBus with SPD EEPROMs connected, and
@@ -124,3 +128,6 @@
and power supply. Guenter Roeck
Used to add support for NCT6775F (W83677HG-I)
to w83627ehf driver.
+
+AMD Asus EAH6450 Silent video card 2011-12
+ Jean Delvare
|
[-]
[+]
|
Changed |
lm_sensors-3.3.2.tar.bz2/doc/libsensors-API.txt
^
|
@@ -6,7 +6,20 @@
authors can quickly figure out how to test for the availability of a
given new feature.
-0x431 lm-sensors 3.3.0
+0x432
+* Added support for new sysfs attributes
+ enum sensors_subfeature_type SENSORS_SUBFEATURE_IN_AVERAGE
+ enum sensors_subfeature_type SENSORS_SUBFEATURE_IN_LOWEST
+ enum sensors_subfeature_type SENSORS_SUBFEATURE_IN_HIGHEST
+ enum sensors_subfeature_type SENSORS_SUBFEATURE_TEMP_LOWEST
+ enum sensors_subfeature_type SENSORS_SUBFEATURE_TEMP_HIGHEST
+ enum sensors_subfeature_type SENSORS_SUBFEATURE_CURR_AVERAGE
+ enum sensors_subfeature_type SENSORS_SUBFEATURE_CURR_LOWEST
+ enum sensors_subfeature_type SENSORS_SUBFEATURE_CURR_HIGHEST
+ enum sensors_subfeature_type SENSORS_SUBFEATURE_FAN_MAX
+ enum sensors_subfeature_type SENSORS_SUBFEATURE_FAN_MIN_ALARM
+ enum sensors_subfeature_type SENSORS_SUBFEATURE_FAN_MAX_ALARM
+0x431 lm-sensors 3.3.0 to 3.3.1
* Added support for intrusion detection
enum sensors_feature_type SENSORS_FEATURE_INTRUSION
enum sensors_subfeature_type SENSORS_SUBFEATURE_INTRUSION_ALARM
|
[-]
[+]
|
Changed |
lm_sensors-3.3.2.tar.bz2/doc/progs
^
|
@@ -25,7 +25,7 @@
isadump -k 0x55 0x2e 0x2f
* prog/hotplug/unhide_ICH_SMBus (shell script, not installed)
- It unhides the ICH Intel SMBus for 2.6 kernels
+ It unhides the ICH Intel SMBus for kernel 2.6.5 and later.
* prog/init/lm_sensors.init (shell script, not installed)
A SysV init script to be installed in /etc/rc.d/init.d/
|
[-]
[+]
|
Changed |
lm_sensors-3.3.2.tar.bz2/doc/svn
^
|
@@ -4,9 +4,9 @@
that users can have direct access to up-to-the-minute code.
(http://subversion.tigris.org/)
-Driver development for 2.6 kernels is taking place directly in the kernel
-using GIT. Do not use the drivers from our SVN repository for 2.6 kernels, it
-will not work. The user-space tools will work though.
+Driver development for kernel version 3 is taking place directly in the kernel
+using GIT. Do not use the drivers from our SVN repository for kernel version
+2.6 or 3, it will not work. The user-space tools will work though.
We presume that you have Subversion installed on your machine. To check out a
working copy of the code for this project use the following commands:
|
[-]
[+]
|
Changed |
lm_sensors-3.3.2.tar.bz2/etc/sensors-conf-convert
^
|
@@ -1,7 +1,7 @@
#!/usr/bin/perl -w -pi.old
# Convert a sensors.conf file from the old (Linux 2.4, lm-sensors 2)
-# symbol names to the new (Linux 2.6, lm-sensors 3) symbol names.
+# symbol names to the new (Linux 2.6 or 3, lm-sensors 3) symbol names.
#
# Copyright (C) 2007 Jean Delvare <khali@linux-fr.org>
#
|
[-]
[+]
|
Changed |
lm_sensors-3.3.2.tar.bz2/etc/sensors.conf.default
^
|
@@ -12,7 +12,7 @@
# Such custom configuration files for specific mainboards can be found at
# http://www.lm-sensors.org/wiki/Configurations
-chip "lm78-*" "lm79-*" "lm80-*"
+chip "lm78-*" "lm79-*" "lm80-*" "lm96080-*"
label temp1 "M/B Temp"
@@ -223,7 +223,8 @@
label temp1 "SIO Temp"
-chip "lm85-*" "lm85b-*" "lm85c-*" "adm1027-*" "adt7463-*" "adt7468-*" "emc6d100-*" "emc6d102-*"
+chip "lm85-*" "lm85b-*" "lm85c-*" "adm1027-*" "adt7463-*" "adt7468-*" \
+ "emc6d100-*" "emc6d102-*" "emc6d103-*" "emc6d103s-*"
label in1 "Vcore"
label in2 "+3.3V"
@@ -242,6 +243,14 @@
label temp2 "M/B Temp"
+chip "emc6w201-*"
+
+ label in2 "+3.3V"
+ label in3 "+5V"
+
+ label temp6 "M/B Temp"
+
+
chip "pc87365-*" "pc87366-*"
# Voltage inputs
@@ -314,7 +323,7 @@
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.0 * 1.10
+ set in8_max 3.3 * 1.10
chip "w83627uhg-*"
@@ -331,7 +340,7 @@
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
+ set in8_max 3.3 * 1.10
chip "f71805f-*"
@@ -447,7 +456,7 @@
set in6_max 3.0 * 1.10
-chip "f71808e-*" "f71862fg-*" "f71869-*" "f71882fg-*" \
+chip "f71808e-*" "f71808a-*" "f71862fg-*" "f71869-*" "f71869a-*" "f71882fg-*" \
"f71889fg-*" "f71889ed-*" "f71889a-*"
label in0 "+3.3V"
|
[-]
[+]
|
Changed |
lm_sensors-3.3.2.tar.bz2/lib/Module.mk
^
|
@@ -33,7 +33,7 @@
# changed in a backward incompatible way. The interface is defined by
# the public header files - in this case they are error.h and sensors.h.
LIBMAINVER := 4
-LIBMINORVER := 3.1
+LIBMINORVER := 3.2
LIBVER := $(LIBMAINVER).$(LIBMINORVER)
# The static lib name, the shared lib name, and the internal ('so') name of
|
[-]
[+]
|
Changed |
lm_sensors-3.3.2.tar.bz2/lib/sensors.h
^
|
@@ -31,7 +31,7 @@
when the API + ABI breaks), the third digit is incremented to track small
API additions like new flags / enum values. The second digit is for tracking
larger additions like new methods. */
-#define SENSORS_API_VERSION 0x431
+#define SENSORS_API_VERSION 0x432
#define SENSORS_CHIP_NAME_PREFIX_ANY NULL
#define SENSORS_CHIP_NAME_ADDR_ANY (-1)
@@ -157,6 +157,9 @@
SENSORS_SUBFEATURE_IN_MAX,
SENSORS_SUBFEATURE_IN_LCRIT,
SENSORS_SUBFEATURE_IN_CRIT,
+ SENSORS_SUBFEATURE_IN_AVERAGE,
+ SENSORS_SUBFEATURE_IN_LOWEST,
+ SENSORS_SUBFEATURE_IN_HIGHEST,
SENSORS_SUBFEATURE_IN_ALARM = (SENSORS_FEATURE_IN << 8) | 0x80,
SENSORS_SUBFEATURE_IN_MIN_ALARM,
SENSORS_SUBFEATURE_IN_MAX_ALARM,
@@ -166,11 +169,14 @@
SENSORS_SUBFEATURE_FAN_INPUT = SENSORS_FEATURE_FAN << 8,
SENSORS_SUBFEATURE_FAN_MIN,
+ SENSORS_SUBFEATURE_FAN_MAX,
SENSORS_SUBFEATURE_FAN_ALARM = (SENSORS_FEATURE_FAN << 8) | 0x80,
SENSORS_SUBFEATURE_FAN_FAULT,
SENSORS_SUBFEATURE_FAN_DIV,
SENSORS_SUBFEATURE_FAN_BEEP,
SENSORS_SUBFEATURE_FAN_PULSES,
+ SENSORS_SUBFEATURE_FAN_MIN_ALARM,
+ SENSORS_SUBFEATURE_FAN_MAX_ALARM,
SENSORS_SUBFEATURE_TEMP_INPUT = SENSORS_FEATURE_TEMP << 8,
SENSORS_SUBFEATURE_TEMP_MAX,
@@ -181,6 +187,8 @@
SENSORS_SUBFEATURE_TEMP_LCRIT,
SENSORS_SUBFEATURE_TEMP_EMERGENCY,
SENSORS_SUBFEATURE_TEMP_EMERGENCY_HYST,
+ SENSORS_SUBFEATURE_TEMP_LOWEST,
+ SENSORS_SUBFEATURE_TEMP_HIGHEST,
SENSORS_SUBFEATURE_TEMP_ALARM = (SENSORS_FEATURE_TEMP << 8) | 0x80,
SENSORS_SUBFEATURE_TEMP_MAX_ALARM,
SENSORS_SUBFEATURE_TEMP_MIN_ALARM,
@@ -215,6 +223,9 @@
SENSORS_SUBFEATURE_CURR_MAX,
SENSORS_SUBFEATURE_CURR_LCRIT,
SENSORS_SUBFEATURE_CURR_CRIT,
+ SENSORS_SUBFEATURE_CURR_AVERAGE,
+ SENSORS_SUBFEATURE_CURR_LOWEST,
+ SENSORS_SUBFEATURE_CURR_HIGHEST,
SENSORS_SUBFEATURE_CURR_ALARM = (SENSORS_FEATURE_CURR << 8) | 0x80,
SENSORS_SUBFEATURE_CURR_MIN_ALARM,
SENSORS_SUBFEATURE_CURR_MAX_ALARM,
|
[-]
[+]
|
Changed |
lm_sensors-3.3.2.tar.bz2/lib/sysfs.c
^
|
@@ -24,6 +24,7 @@
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/vfs.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
@@ -40,6 +41,7 @@
/****************************************************************************/
#define ATTR_MAX 128
+#define SYSFS_MAGIC 0x62656572
/*
* Read an attribute from sysfs
@@ -233,6 +235,8 @@
{ "lcrit", SENSORS_SUBFEATURE_TEMP_LCRIT },
{ "emergency", SENSORS_SUBFEATURE_TEMP_EMERGENCY },
{ "emergency_hyst", SENSORS_SUBFEATURE_TEMP_EMERGENCY_HYST },
+ { "lowest", SENSORS_SUBFEATURE_TEMP_LOWEST },
+ { "highest", SENSORS_SUBFEATURE_TEMP_HIGHEST },
{ "alarm", SENSORS_SUBFEATURE_TEMP_ALARM },
{ "min_alarm", SENSORS_SUBFEATURE_TEMP_MIN_ALARM },
{ "max_alarm", SENSORS_SUBFEATURE_TEMP_MAX_ALARM },
@@ -252,6 +256,9 @@
{ "max", SENSORS_SUBFEATURE_IN_MAX },
{ "lcrit", SENSORS_SUBFEATURE_IN_LCRIT },
{ "crit", SENSORS_SUBFEATURE_IN_CRIT },
+ { "average", SENSORS_SUBFEATURE_IN_AVERAGE },
+ { "lowest", SENSORS_SUBFEATURE_IN_LOWEST },
+ { "highest", SENSORS_SUBFEATURE_IN_HIGHEST },
{ "alarm", SENSORS_SUBFEATURE_IN_ALARM },
{ "min_alarm", SENSORS_SUBFEATURE_IN_MIN_ALARM },
{ "max_alarm", SENSORS_SUBFEATURE_IN_MAX_ALARM },
@@ -264,9 +271,12 @@
static const struct subfeature_type_match fan_matches[] = {
{ "input", SENSORS_SUBFEATURE_FAN_INPUT },
{ "min", SENSORS_SUBFEATURE_FAN_MIN },
+ { "max", SENSORS_SUBFEATURE_FAN_MAX },
{ "div", SENSORS_SUBFEATURE_FAN_DIV },
{ "pulses", SENSORS_SUBFEATURE_FAN_PULSES },
{ "alarm", SENSORS_SUBFEATURE_FAN_ALARM },
+ { "min_alarm", SENSORS_SUBFEATURE_FAN_MIN_ALARM },
+ { "max_alarm", SENSORS_SUBFEATURE_FAN_MAX_ALARM },
{ "fault", SENSORS_SUBFEATURE_FAN_FAULT },
{ "beep", SENSORS_SUBFEATURE_FAN_BEEP },
{ NULL, 0 }
@@ -302,6 +312,9 @@
{ "max", SENSORS_SUBFEATURE_CURR_MAX },
{ "lcrit", SENSORS_SUBFEATURE_CURR_LCRIT },
{ "crit", SENSORS_SUBFEATURE_CURR_CRIT },
+ { "average", SENSORS_SUBFEATURE_CURR_AVERAGE },
+ { "lowest", SENSORS_SUBFEATURE_CURR_LOWEST },
+ { "highest", SENSORS_SUBFEATURE_CURR_HIGHEST },
{ "alarm", SENSORS_SUBFEATURE_CURR_ALARM },
{ "min_alarm", SENSORS_SUBFEATURE_CURR_MIN_ALARM },
{ "max_alarm", SENSORS_SUBFEATURE_CURR_MAX_ALARM },
@@ -585,11 +598,11 @@
/* returns !0 if sysfs filesystem was found, 0 otherwise */
int sensors_init_sysfs(void)
{
- struct stat statbuf;
+ struct statfs statfsbuf;
snprintf(sensors_sysfs_mount, NAME_MAX, "%s", "/sys");
- if (stat(sensors_sysfs_mount, &statbuf) < 0
- || statbuf.st_nlink <= 2) /* Empty directory */
+ if (statfs(sensors_sysfs_mount, &statfsbuf) < 0
+ || statfsbuf.f_type != SYSFS_MAGIC)
return 0;
return 1;
|
[-]
[+]
|
Changed |
lm_sensors-3.3.2.tar.bz2/prog/detect/sensors-detect
^
|
@@ -41,7 +41,7 @@
use vars qw(@pci_adapters @chip_ids @ipmi_ifs @non_hwmon_chip_ids
$i2c_addresses_to_scan $revision @i2c_byte_cache);
-$revision = '$Revision: 5946 $ ($Date: 2011-03-23 11:54:44 +0100 (mer. 23 mars 2011) $)';
+$revision = '$Revision: 6031 $ ($Date: 2012-03-07 17:14:01 +0100 (mer. 07 mars 2012) $)';
$revision =~ s/\$\w+: (.*?) \$/$1/g;
$revision =~ s/ \([^()]*\)//;
@@ -60,7 +60,7 @@
vendid => 0x8086,
devid => 0x7603,
procid => "Intel 82372FB PIIX5 ACPI",
- driver => "to-be-tested",
+ driver => "to-be-written",
}, {
vendid => 0x8086,
devid => 0x719b,
@@ -153,6 +153,26 @@
driver => "i2c-i801",
}, {
vendid => 0x8086,
+ devid => 0x1D22,
+ procid => "Intel Patsburg (PCH)",
+ driver => "i2c-i801",
+ }, {
+ vendid => 0x8086,
+ devid => 0x2330,
+ procid => "Intel DH89xxCC (PCH)",
+ driver => "i2c-i801",
+ }, {
+ vendid => 0x8086,
+ devid => 0x1E22,
+ procid => "Intel Panther Point (PCH)",
+ driver => "i2c-i801",
+ }, {
+ vendid => 0x8086,
+ devid => 0x8C22,
+ procid => "Intel Lynx Point (PCH)",
+ driver => "i2c-i801",
+ }, {
+ vendid => 0x8086,
devid => 0x8119,
procid => "Intel SCH",
driver => "i2c-isch",
@@ -520,7 +540,12 @@
name => "National Semiconductor LM80",
driver => "lm80",
i2c_addrs => [0x28..0x2f],
- i2c_detect => sub { lm80_detect(@_); },
+ i2c_detect => sub { lm80_detect(@_, 0); },
+ }, {
+ name => "National Semiconductor LM96080",
+ driver => "lm80",
+ i2c_addrs => [0x28..0x2f],
+ i2c_detect => sub { lm80_detect(@_, 1); },
}, {
name => "National Semiconductor LM85",
driver => "lm85",
@@ -557,11 +582,16 @@
i2c_addrs => [0x2c..0x2e],
i2c_detect => sub { lm85_detect(@_, 6); },
}, {
- name => "SMSC EMC6D103S",
- driver => "to-be-written", # lm85
+ name => "SMSC EMC6D103S or EMC2300",
+ driver => "lm85",
i2c_addrs => [0x2c..0x2e],
i2c_detect => sub { lm85_detect(@_, 8); },
}, {
+ name => "SMSC EMC6W201",
+ driver => "emc6w201",
+ i2c_addrs => [0x2c..0x2e],
+ i2c_detect => sub { emc6w201_detect(@_); },
+ }, {
name => "Winbond WPCD377I",
driver => "not-a-sensor",
i2c_addrs => [0x2c..0x2e],
@@ -613,7 +643,7 @@
i2c_detect => sub { adt7410_detect(@_); },
}, {
name => "Analog Devices ADT7411",
- driver => "to-be-written",
+ driver => "adt7411",
i2c_addrs => [0x48, 0x4a, 0x4b],
i2c_detect => sub { adt7411_detect(@_); },
}, {
@@ -652,8 +682,8 @@
i2c_addrs => [0x2c..0x2e],
i2c_detect => sub { lm93_detect(@_, 0); },
}, {
- name => "National Semiconductor LM94",
- driver => "to-be-written", # Most likely lm93
+ name => "National Semiconductor LM94 or LM96194",
+ driver => "lm93",
i2c_addrs => [0x2c..0x2e],
i2c_detect => sub { lm93_detect(@_, 1); },
}, {
@@ -813,6 +843,11 @@
i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e],
i2c_detect => sub { adm1021_detect(@_, 1); },
}, {
+ name => "Global Mixed-mode Technology G781",
+ driver => "lm90",
+ i2c_addrs => [0x4c, 0x4d],
+ i2c_detect => sub { lm90_detect(@_, 15); },
+ }, {
name => "Maxim MAX1617",
driver => "adm1021",
i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e],
@@ -843,10 +878,10 @@
i2c_addrs => [0x2c, 0x2e, 0x2f],
i2c_detect => sub { max6639_detect(@_); },
}, {
- name => "Maxim MAX6650/MAX6651",
- driver => "max6650",
- i2c_addrs => [0x1b, 0x1f, 0x48, 0x4b],
- i2c_detect => sub { max6650_detect(@_); },
+ name => "Maxim MAX6642",
+ driver => "max6642",
+ i2c_addrs => [0x48..0x4f],
+ i2c_detect => sub { max6642_detect(@_); },
}, {
name => "Maxim MAX6655/MAX6656",
driver => "max6655",
@@ -954,7 +989,7 @@
i2c_detect => sub { max6680_95_detect(@_, 1); },
}, {
name => "Winbond W83L771W/G",
- driver => "to-be-written",
+ driver => "lm90",
i2c_addrs => [0x4c],
i2c_detect => sub { lm90_detect(@_, 8); },
}, {
@@ -994,7 +1029,7 @@
i2c_detect => sub { amc6821_detect(@_); },
}, {
name => "National Semiconductor LM95231",
- driver => "to-be-written",
+ driver => "lm95241",
i2c_addrs => [0x2b, 0x19, 0x2a],
i2c_detect => sub { lm95231_detect(@_, 0); },
}, {
@@ -1003,6 +1038,11 @@
i2c_addrs => [0x2b, 0x19, 0x2a],
i2c_detect => sub { lm95231_detect(@_, 1); },
}, {
+ name => "National Semiconductor LM95245",
+ driver => "lm95245",
+ i2c_addrs => [0x18, 0x19, 0x29, 0x4c, 0x4d],
+ i2c_detect => sub { lm95231_detect(@_, 2); },
+ }, {
name => "National Semiconductor LM63",
driver => "lm63",
i2c_addrs => [0x4c],
@@ -1013,6 +1053,11 @@
i2c_addrs => [0x18, 0x4e],
i2c_detect => sub { lm63_detect(@_, 3); },
}, {
+ name => "National Semiconductor LM96163",
+ driver => "lm63",
+ i2c_addrs => [0x4c],
+ i2c_detect => sub { lm63_detect(@_, 4); },
+ }, {
name => "Fintek F75363SG",
driver => "lm63", # Not yet
i2c_addrs => [0x4c],
@@ -1045,6 +1090,16 @@
i2c_addrs => [0x4c..0x4d],
i2c_detect => sub { lm90_detect(@_, 5); },
}, {
+ name => "Analog Devices ADT7461A, ON Semiconductor NCT1008",
+ driver => "lm90",
+ i2c_addrs => [0x4c..0x4d],
+ i2c_detect => sub { lm90_detect(@_, 13); },
+ }, {
+ name => "NXP/Philips SA56004",
+ driver => "lm90",
+ i2c_addrs => [0x48..0x4f],
+ i2c_detect => sub { lm90_detect(@_, 14); },
+ }, {
name => "Analog Devices ADT7481",
driver => "to-be-written",
i2c_addrs => [0x4c, 0x4b],
@@ -1295,6 +1350,16 @@
i2c_addrs => [0x18..0x1f],
i2c_detect => sub { jedec_JC42_4_detect(@_, 10); },
}, {
+ name => "ST STTS2002",
+ driver => "jc42",
+ i2c_addrs => [0x18..0x1f],
+ i2c_detect => sub { jedec_JC42_4_detect(@_, 11); },
+ }, {
+ name => "ST STTS3000",
+ driver => "jc42",
+ i2c_addrs => [0x18..0x1f],
+ i2c_detect => sub { jedec_JC42_4_detect(@_, 12); },
+ }, {
name => "NXP SE97/SE97B",
driver => "jc42",
i2c_addrs => [0x18..0x1f],
@@ -1320,6 +1385,11 @@
i2c_addrs => [0x18..0x1f],
i2c_detect => sub { jedec_JC42_4_detect(@_, 5); },
}, {
+ name => "Microchip MCP9804",
+ driver => "jc42",
+ i2c_addrs => [0x18..0x1f],
+ i2c_detect => sub { jedec_JC42_4_detect(@_, 13); },
+ }, {
name => "Microchip MCP98242",
driver => "jc42",
i2c_addrs => [0x18..0x1f],
@@ -1340,10 +1410,10 @@
i2c_addrs => [0x18..0x1f],
i2c_detect => sub { jedec_JC42_4_detect(@_, 9); },
}, {
- name => "Smart Battery",
- driver => "sbs", # ACPI driver, not sure if it always works
- i2c_addrs => [0x0b],
- i2c_detect => sub { smartbatt_detect(@_); },
+ name => "Atmel AT30TS00",
+ driver => "jc42",
+ i2c_addrs => [0x18..0x1f],
+ i2c_detect => sub { jedec_JC42_4_detect(@_, 14); },
}
);
@@ -1351,12 +1421,12 @@
@ipmi_ifs = (
{
name => "IPMI BMC KCS",
- driver => "ipmisensors",
+ driver => "to-be-written", # ipmisensors
isa_addrs => [0x0ca0],
isa_detect => sub { ipmi_detect(@_); },
}, {
name => "IPMI BMC SMIC",
- driver => "ipmisensors",
+ driver => "to-be-written", # ipmisensors
isa_addrs => [0x0ca8],
isa_detect => sub { ipmi_detect(@_); },
}
@@ -1545,10 +1615,35 @@
logdev => 0x14,
features => FEAT_IN | FEAT_TEMP,
}, {
- # Shouldn't be in this family, but there it is
- name => "ITE IT8512E/F Super IO",
- driver => "not-a-sensor",
+ name => "ITE IT8510E/TE/G Super IO",
+ driver => "to-be-written",
+ devid => 0x8510,
+ features => FEAT_IN | FEAT_FAN,
+ }, {
+ name => "ITE IT8511E/TE/G Super IO",
+ driver => "to-be-written",
+ devid => 0x8511,
+ features => FEAT_IN | FEAT_FAN,
+ }, {
+ name => "ITE IT8512E/F/G Super IO",
+ driver => "to-be-written",
devid => 0x8512,
+ features => FEAT_IN | FEAT_FAN,
+ }, {
+ name => "ITE IT8513E/F/G Super IO",
+ driver => "to-be-written",
+ devid => 0x8513,
+ features => FEAT_IN | FEAT_FAN,
+ }, {
+ name => "ITE IT8516E/F/G Super IO",
+ driver => "to-be-written",
+ devid => 0x8516,
+ features => FEAT_IN | FEAT_FAN,
+ }, {
+ name => "ITE IT8518E Super IO",
+ driver => "to-be-written",
+ devid => 0x8518,
+ features => FEAT_IN | FEAT_FAN,
}
);
@@ -1665,7 +1760,10 @@
features => FEAT_FAN,
}, {
name => "SMSC LPC47M584-NC Super IO",
- # No datasheet
+ # No datasheet (Dell-specific part). Not compatible with
+ # smsc47m1 nor dme1737 nor LPC47M233. No evidence that this
+ # chip can do any hardware monitoring at all.
+ driver => "not-a-sensor",
devid => 0x76,
}, {
name => "SMSC LPC47N252 Super IO Fan Sensors",
@@ -1772,6 +1870,16 @@
},
logdev => 0x0c,
features => FEAT_IN | FEAT_FAN | FEAT_TEMP,
+ }, {
+ name => "SMSC SCH5636 Super IO",
+ driver => "sch5636",
+ devid => 0xc7,
+ regs => {
+ basereg_lsb => 0x66,
+ basereg_msb => 0x67,
+ },
+ logdev => 0x0c,
+ features => FEAT_IN | FEAT_FAN | FEAT_TEMP,
}
);
@@ -1875,7 +1983,7 @@
logdev => 0x0b,
features => FEAT_IN | FEAT_FAN | FEAT_TEMP,
}, {
- name => "Winbond W83627DHG-P Super IO Sensors",
+ name => "Winbond W83627DHG-P/W83527HG Super IO Sensors",
driver => "w83627ehf",
devid => 0xB070,
devid_mask => 0xFFF0,
@@ -1904,7 +2012,7 @@
features => FEAT_IN | FEAT_FAN | FEAT_TEMP,
}, {
name => "Nuvoton W83677HG-I (NCT6771F/NCT6772F/NCT6775F) Super IO Sensors",
- driver => "to-be-written", # Probably w83627ehf
+ driver => "w83627ehf",
devid => 0xB470,
devid_mask => 0xFFF0,
logdev => 0x0b,
@@ -1921,7 +2029,7 @@
features => FEAT_IN | FEAT_FAN | FEAT_TEMP,
}, {
name => "Nuvoton NCT6776F Super IO Sensors",
- driver => "to-be-written",
+ driver => "w83627ehf",
devid => 0xC333,
logdev => 0x0b,
features => FEAT_IN | FEAT_FAN | FEAT_TEMP,
@@ -1939,7 +2047,7 @@
features => FEAT_IN | FEAT_FAN | FEAT_TEMP,
}, {
name => "Fintek F71808A Super IO Sensors",
- driver => "to-be-written",
+ driver => "f71882fg",
devid => 0x1001,
logdev => 0x04,
features => FEAT_IN | FEAT_FAN | FEAT_TEMP,
@@ -1957,7 +2065,7 @@
features => FEAT_IN | FEAT_FAN | FEAT_TEMP,
}, {
name => "Fintek F71869A Super IO Sensors",
- driver => "to-be-written",
+ driver => "f71882fg",
devid => 0x1007,
logdev => 0x04,
features => FEAT_IN | FEAT_FAN | FEAT_TEMP,
@@ -1993,7 +2101,7 @@
features => FEAT_IN | FEAT_FAN | FEAT_TEMP,
}, {
name => "Fintek F71889A Super IO Sensors",
- driver => "to-be-written",
+ driver => "f71882fg",
devid => 0x1005,
logdev => 0x04,
features => FEAT_IN | FEAT_FAN | FEAT_TEMP,
@@ -2007,7 +2115,7 @@
devid => 0x0206,
}, {
name => "Fintek F81865F Super IO Sensors",
- driver => "to-be-written",
+ driver => "f71882fg",
devid => 0x0704,
logdev => 0x04,
features => FEAT_IN | FEAT_FAN | FEAT_TEMP,
@@ -2091,6 +2199,36 @@
devid => 0x8728,
logdev => 0x04,
features => FEAT_IN | FEAT_FAN | FEAT_TEMP,
+ }, {
+ name => "ITE IT8771E Super IO Sensors",
+ driver => "to-be-written", # it87
+ devid => 0x8771,
+ logdev => 0x04,
+ features => FEAT_IN | FEAT_FAN | FEAT_TEMP,
+ }, {
+ name => "ITE IT8772E Super IO Sensors",
+ driver => "to-be-written", # it87
+ devid => 0x8772,
+ logdev => 0x04,
+ features => FEAT_IN | FEAT_FAN | FEAT_TEMP,
+ }, {
+ name => "ITE IT8781F Super IO Sensors",
+ driver => "to-be-written", # it87
+ devid => 0x8781,
+ logdev => 0x04,
+ features => FEAT_IN | FEAT_FAN | FEAT_TEMP,
+ }, {
+ name => "ITE IT8782F Super IO Sensors",
+ driver => "to-be-written", # it87
+ devid => 0x8782,
+ logdev => 0x04,
+ features => FEAT_IN | FEAT_FAN | FEAT_TEMP,
+ }, {
+ name => "ITE IT8783F Super IO Sensors",
+ driver => "to-be-written", # it87
+ devid => 0x8783,
+ logdev => 0x04,
+ features => FEAT_IN | FEAT_FAN | FEAT_TEMP,
}
);
@@ -2105,7 +2243,7 @@
# first.
@superio_ids = (
{
- family => "National Semiconductor",
+ family => "National Semiconductor/ITE",
enter =>
{
0x2e => [],
@@ -2169,7 +2307,7 @@
}, {
name => "AMD K8 thermal sensors",
driver => "k8temp",
- detect => \&k8temp_pci_detect,
+ detect => sub { amd_pci_detect('1103') },
}, {
name => "AMD Family 10h thermal sensors",
driver => "k10temp",
@@ -2177,11 +2315,19 @@
}, {
name => "AMD Family 11h thermal sensors",
driver => "k10temp",
- detect => \&fam11h_pci_detect,
+ detect => sub { amd_pci_detect('1303') },
}, {
name => "AMD Family 12h and 14h thermal sensors",
driver => "k10temp",
- detect => \&fam12h_14h_pci_detect,
+ detect => sub { amd_pci_detect('1703') },
+ }, {
+ name => "AMD Family 15h thermal sensors",
+ driver => "k10temp",
+ detect => sub { amd_pci_detect('1603') },
+ }, {
+ name => "AMD Family 15h power sensors",
+ driver => "fam15h_power",
+ detect => sub { amd_pci_detect('1604') },
}, {
name => "Intel digital thermal sensor",
driver => "coretemp",
@@ -2394,7 +2540,7 @@
if (!$use_udev) {
# Try some known default udev db locations, just in case
if (-e '/dev/.udev.tdb' || -e '/dev/.udev'
- || -e '/dev/.udevdb') {
+ || -e '/dev/.udevdb' || -e '/run/udev') {
$use_udev = 1;
$dev_i2c = '/dev/i2c-';
}
@@ -2717,8 +2863,11 @@
);
# Many BIOS have broken DMI data, filter it out
my %fake = (
- 'System Manufacturer' => 1,
- 'System Name' => 1,
+ 'system manufacturer' => 1,
+ 'system product name' => 1,
+ 'system name' => 1,
+ 'system version' => 1,
+ 'to be filled by o.e.m.' => 1,
);
my $dmi_id_dir;
@@ -2747,7 +2896,7 @@
next;
}
$dmi{$k} =~ s/\s*$//;
- delete $dmi{$k} if $dmi{$k} eq '' || exists $fake{$dmi{$k}};
+ delete $dmi{$k} if $dmi{$k} eq '' || exists $fake{lc($dmi{$k})};
}
}
@@ -2763,6 +2912,7 @@
if (defined $system) {
print "# System: $system";
+ print " [$dmi{product_version}]" if defined $dmi{product_version};
print " (laptop)" if (is_laptop());
print "\n";
}
@@ -2923,16 +3073,8 @@
next unless exists $pci_list{$key};
$device = $pci_list{$key};
- if ($try->{driver} eq "to-be-tested") {
- print "\nWe are currently looking for testers for this adapter!\n".
- "Please check http://www.lm-sensors.org/wiki/Devices\n".
- "and/or contact us if you want to help.\n\n".
- "Continue... ";
- <STDIN>;
- print "\n";
- }
- if ($try->{driver} =~ m/^to-be-/) {
+ if ($try->{driver} eq "to-be-written") {
printf "No known driver for device \%s: \%s\n",
pci_busid($device), $try->{procid};
} else {
@@ -3694,6 +3836,10 @@
print "\n (hardware monitoring capabilities accessible via SMBus only)\n";
return FEAT_SMBUS;
}
+ if (!exists $chip->{logdev}) {
+ print "\n (no support yet)\n";
+ return 0;
+ }
# Switch to the sensor logical device
outb($addrreg, $superio{logdevreg});
@@ -4002,7 +4148,9 @@
# Bits that always return 0
return if ($conf & 0x0c) or ($status & 0x10);
- return if i2c_smbus_read_word_data($file, 0x07) != 0x9001;
+ # Test with byte read first to avoid confusing other chips
+ return if i2c_smbus_read_byte_data($file, 0x07) != 0x01
+ or i2c_smbus_read_word_data($file, 0x07) != 0x9001;
# Make sure the chip supports SMBus read word transactions
my $cur = i2c_smbus_read_word_data($file, 0x00);
@@ -4181,11 +4329,15 @@
return ($slope == 0x10 && $counter <= $slope) ? 3 : 2;
}
+# Chip to detect: 0 = LM80, 1 = LM96080
# Registers used:
# 0x00: Configuration register
# 0x02: Interrupt state register
-# 0x2a-0x3d: Limits registers
-# This one is easily misdetected since it doesn't provide identification
+# 0x07: Converstion rate register (LM96080 only)
+# 0x2a-0x3d: Limits registers (LM80 only)
+# 0x3e: Manufacturer's ID register (LM96080 only)
+# 0x3f: Stepping/die revision ID register (LM96080 only)
+# The LM80 is easily misdetected since it doesn't provide identification
# registers. So we have to use some tricks:
# - 6-bit addressing, so limits readings modulo 0x40 should be unchanged
# - positive temperature limits
@@ -4198,44 +4350,51 @@
# to loose comparisons did not change the score.
sub lm80_detect
{
- my ($file, $addr) = @_;
+ my ($file, $addr, $chip) = @_;
my ($i, $reg);
return if (i2c_smbus_read_byte_data($file, 0x00) & 0x80) != 0;
return if (i2c_smbus_read_byte_data($file, 0x02) & 0xc0) != 0;
- for ($i = 0x2a; $i <= 0x3d; $i++) {
- $reg = i2c_smbus_read_byte_data($file, $i);
- return if i2c_smbus_read_byte_data($file, $i+0x40) != $reg;
- return if i2c_smbus_read_byte_data($file, $i+0x80) != $reg;
- return if i2c_smbus_read_byte_data($file, $i+0xc0) != $reg;
- }
-
- # Refine a bit by checking whether limits are in the correct order
- # (min<max for voltages, hyst<max for temperature). Since it is still
- # possible that the chip is an LM80 with limits not properly set,
- # a few "errors" are tolerated.
- my $confidence = 0;
- for ($i = 0x2a; $i <= 0x3a; $i++) {
+ if ($chip == 0) {
+ for ($i = 0x2a; $i <= 0x3d; $i++) {
+ $reg = i2c_smbus_read_byte_data($file, $i);
+ return if i2c_smbus_read_byte_data($file, $i+0x40) != $reg;
+ return if i2c_smbus_read_byte_data($file, $i+0x80) != $reg;
+ return if i2c_smbus_read_byte_data($file, $i+0xc0) != $reg;
+ }
+
+ # Refine a bit by checking whether limits are in the correct order
+ # (min<max for voltages, hyst<max for temperature). Since it is still
+ # possible that the chip is an LM80 with limits not properly set,
+ # a few "errors" are tolerated.
+ my $confidence = 0;
+ for ($i = 0x2a; $i <= 0x3a; $i++) {
+ $confidence++
+ if i2c_smbus_read_byte_data($file, $i) < i2c_smbus_read_byte_data($file, $i+1);
+ }
+ # hot temp<OS temp
$confidence++
- if i2c_smbus_read_byte_data($file, $i) < i2c_smbus_read_byte_data($file, $i+1);
- }
- # hot temp<OS temp
- $confidence++
- if i2c_smbus_read_byte_data($file, 0x38) < i2c_smbus_read_byte_data($file, 0x3a);
+ if i2c_smbus_read_byte_data($file, 0x38) < i2c_smbus_read_byte_data($file, 0x3a);
- # Negative temperature limits are unlikely.
- for ($i = 0x3a; $i <= 0x3d; $i++) {
- $confidence++ if (i2c_smbus_read_byte_data($file, $i) & 0x80) == 0;
- }
+ # Negative temperature limits are unlikely.
+ for ($i = 0x3a; $i <= 0x3d; $i++) {
+ $confidence++ if (i2c_smbus_read_byte_data($file, $i) & 0x80) == 0;
+ }
- # $confidence is between 0 and 14
- $confidence = ($confidence >> 1) - 4;
- # $confidence is now between -4 and 3
+ # $confidence is between 0 and 14
+ $confidence = ($confidence >> 1) - 4;
+ # $confidence is now between -4 and 3
- return unless $confidence > 0;
+ return unless $confidence > 0;
+ return $confidence;
+ } elsif ($chip == 1) {
+ return if (i2c_smbus_read_byte_data($file, 0x07) & 0xfe) != 0;
+ return if i2c_smbus_read_byte_data($file, 0x3e) != 0x01;
+ return if i2c_smbus_read_byte_data($file, 0x3f) != 0x08;
- return $confidence;
+ return 6;
+ }
}
# Registers used:
@@ -4314,11 +4473,13 @@
# 4 = MAX6654, 5 = ADT7461,
# 6 = MAX6646/MAX6647/MAX6648/MAX6649/MAX6692,
# 8 = W83L771W/G, 9 = TMP401, 10 = TMP411,
-# 11 = W83L771AWG/ASG, 12 = MAX6690
+# 11 = W83L771AWG/ASG, 12 = MAX6690,
+# 13 = ADT7461A/NCT1008, 14 = SA56004,
+# 15 = G781
# Registers used:
# 0x03: Configuration
# 0x04: Conversion rate
-# 0xbf: Configuration 2 (National Semiconductor and Winbond only)
+# 0xbf: Configuration 2 (National Semiconductor, Winbond, and Philips only)
# 0xfe: Manufacturer ID
# 0xff: Chip ID / die revision
sub lm90_detect
@@ -4413,6 +4574,25 @@
return if $mid != 0x4d; # Maxim
return 8 if $cid == 0x09; # MAX6690
}
+ if ($chip == 13) {
+ return if ($conf & 0x1b) != 0;
+ return if $rate > 0x0a;
+ return if $mid != 0x41; # Analog Devices
+ return 8 if $cid == 0x57; # ADT7461A, NCT1008
+ }
+ if ($chip == 14) {
+ return if ($conf & 0x2a) != 0;
+ return if ($conf2 & 0xfe) != 0;
+ return if $rate > 0x09;
+ return if $mid != 0xa1; # NXP Semiconductor/Philips
+ return 6 if $cid == 0x00; # SA56004
+ }
+ if ($chip == 15) {
+ return if ($conf & 0x3f) != 0;
+ return if $rate > 0x08;
+ return if $mid != 0x47; # GMT
+ return 8 if $cid == 0x01; # G781
+ }
return;
}
@@ -4484,12 +4664,14 @@
return 5;
}
-# Chip to detect: 0 = LM95231, 1 = LM95241
+# Chip to detect: 0 = LM95231, 1 = LM95241, 2 = LM95245
# Registers used:
# 0x02: Status (3 unused bits)
# 0x03: Configuration (3 unused bits)
-# 0x06: Remote diode filter control (6 unused bits)
-# 0x30: Remote diode model type select (6 unused bits)
+# 0x06: Remote diode filter control (6 unused bits, LM95231 and LM95241)
+# 0x30: Remote diode model type select (6 unused bits, LM95231 and LM95241)
+# 0x30: Local Temperature LSB (5 unused bits, LM95245)
+# 0x33: Status register 2 (6 unused bits, LM95245)
# 0xfe: Manufacturer ID
# 0xff: Revision ID
sub lm95231_detect
@@ -4499,13 +4681,21 @@
my $cid = i2c_smbus_read_byte_data($file, 0xff);
return if $mid != 0x01; # National Semiconductor
- return if $chip == 0 && $cid != 0xa1; # LM95231
- return if $chip == 1 && $cid != 0xa4; # LM95231
- return if i2c_smbus_read_byte_data($file, 0x02) & 0x70;
- return if i2c_smbus_read_byte_data($file, 0x03) & 0x89;
- return if i2c_smbus_read_byte_data($file, 0x06) & 0xfa;
- return if i2c_smbus_read_byte_data($file, 0x30) & 0xfa;
+ if ($chip == 0 || $chip == 1) {
+ return if $chip == 0 && $cid != 0xa1; # LM95231
+ return if $chip == 1 && $cid != 0xa4; # LM95241
+ return if i2c_smbus_read_byte_data($file, 0x02) & 0x70;
+ return if i2c_smbus_read_byte_data($file, 0x03) & 0x89;
+ return if i2c_smbus_read_byte_data($file, 0x06) & 0xfa;
+ return if i2c_smbus_read_byte_data($file, 0x30) & 0xfa;
+ } elsif ($chip == 2) {
+ return if $cid != 0xb3; # LM95245
+ return if i2c_smbus_read_byte_data($file, 0x02) & 0x68;
+ return if i2c_smbus_read_byte_data($file, 0x03) & 0xa1;
+ return if i2c_smbus_read_byte_data($file, 0x30) & 0x1f;
+ return if i2c_smbus_read_byte_data($file, 0x33) & 0x3f;
+ }
return 6;
}
@@ -4531,7 +4721,7 @@
return 6;
}
-# Chip to detect: 1 = LM63, 2 = F75363SG, 3 = LM64
+# Chip to detect: 1 = LM63, 2 = F75363SG, 3 = LM64, 4 = LM96163
# Registers used:
# 0xfe: Manufacturer ID
# 0xff: Chip ID / die revision
@@ -4561,6 +4751,11 @@
|| $cid != 0x51; # LM64
return if ($conf & 0x18) != 0x00
|| ($mask & 0xa4) != 0xa4;
+ } elsif ($chip == 4) {
+ return if $mid != 0x01 # National Semiconductor
+ || $cid != 0x49; # LM96163
+ return if ($conf & 0x18) != 0x00
+ || ($mask & 0xa4) != 0xa4;
}
return 6;
@@ -4834,7 +5029,7 @@
# Chip to detect: 0 = LM85, 1 = LM96000, 2 = ADM1027, 3 = ADT7463,
# 4 = EMC6D100/101, 5 = EMC6D102, 6 = EMC6D103,
-# 7 = WPCD377I (no sensors), 8 = EMC6D103S
+# 7 = WPCD377I (no sensors), 8 = EMC6D103S/EMC2300
# Registers used:
# 0x3e: Vendor register
# 0x3d: Device ID register (Analog Devices only)
@@ -4873,7 +5068,7 @@
&& $verstep != 0x69; # EMC6D103 A1
} elsif ($chip == 8) {
return if $vendor != 0x5c; # SMSC
- return if $verstep != 0x6a; # EMC6D103S
+ return if $verstep != 0x6a; # EMC6D103S/EMC2300
}
if ($vendor == 0x41) { # Analog Devices
@@ -4903,6 +5098,29 @@
return 7;
}
+# Registers used:
+# 0x3e: Vendor register
+# 0x3f: Version/Stepping register
+# 0x40: Configuration register (reserved bits + ready)
+sub emc6w201_detect
+{
+ my ($file, $addr) = @_;
+ my $vendor = i2c_smbus_read_byte_data($file, 0x3e);
+ my $verstep = i2c_smbus_read_byte_data($file, 0x3f);
+ my $conf = i2c_smbus_read_byte_data($file, 0x40);
+ my $stepping;
+
+ return if $vendor != 0x5c; # SMSC
+ return if ($verstep & 0xf0) != 0xb0; # EMC6W201
+ return if ($conf & 0xf4) != 0x04;
+
+ $stepping = $verstep & 0x0f;
+ return if $stepping > 3;
+
+ # So far we've only seen stepping 1 chips
+ return $stepping <= 1 ? 6 : 3;
+}
+
# Chip to detect: 0 = LM87, 1 = ADM1024
# Registers used:
# 0x3e: Company ID
@@ -5677,19 +5895,6 @@
return 6;
}
-# This checks for non-FFFF values for temperature, voltage, and current.
-# The address (0x0b) is specified by the SMBus standard so it's likely
-# that this really is a smart battery.
-sub smartbatt_detect
-{
- my ($file, $addr) = @_;
-
- return if i2c_smbus_read_word_data($file, 0x08) == 0xffff
- || i2c_smbus_read_word_data($file, 0x09) == 0xffff
- || i2c_smbus_read_word_data($file, 0x0a) == 0xffff;
- return 5;
-}
-
# Chip to detect: 0 = W83L784R/AR/G, 1 = W83L785R/G, 2 = W83L786NR/NG/R/G,
# 3 = W83L785TS-S
# Registers used:
@@ -5746,32 +5951,38 @@
return 6;
}
-# The max6650 has no device ID register. However, a few registers have
-# spare bits, which are documented as being always zero on read. We read
-# all of these registers check the spare bits. Any non-zero means this
-# is not a max6650/1.
-#
-# The always zero bits are:
-# configuration byte register (0x02) - top 2 bits
-# gpio status register (0x14) - top 3 bits
-# alarm enable register (0x08) - top 3 bits
-# alarm status register (0x0A) - top 3 bits
-# tachometer count time register (0x16) - top 6 bits
-# Additionally, not all values are possible for lower 3 bits of
-# the configuration register.
-sub max6650_detect
+# Chip to detect: MAX6642
+# Registers used:
+# 0x02: Status register
+# 0x03: Configuration register
+# 0xfe: Manufacturer ID
+# 0x04, 0x06, 0xff: No registers
+# We use the 0x04, 0x06 and 0xff addresses (unused) to improve reliability.
+# These are not real registers and will always return the last returned value.
+# This isn't documented.
+sub max6642_detect
{
my ($file, $addr) = @_;
+ my ($man_id, $conf, $status);
- my $conf = i2c_smbus_read_byte_data($file, 0x02);
-
- return if i2c_smbus_read_byte_data($file, 0x16) & 0xFC;
- return if i2c_smbus_read_byte_data($file, 0x0A) & 0xE0;
- return if i2c_smbus_read_byte_data($file, 0x08) & 0xE0;
- return if i2c_smbus_read_byte_data($file, 0x14) & 0xE0;
- return if ($conf & 0xC0) or ($conf & 0x07) > 4;
+ $man_id = i2c_smbus_read_byte_data($file, 0xfe);
+ return unless $man_id == 0x4d; # Maxim
+ return if i2c_smbus_read_byte_data($file, 0x04, NO_CACHE) != $man_id;
+ return if i2c_smbus_read_byte_data($file, 0x06, NO_CACHE) != $man_id;
+ return if i2c_smbus_read_byte_data($file, 0xff, NO_CACHE) != $man_id;
+
+ $status = i2c_smbus_read_byte_data($file, 0x02);
+ # Bit 5, 3, 1 and 0 should be zero
+ return unless ($status & 0x2b) == 0x00;
+ return if i2c_smbus_read_byte_data($file, 0x04, NO_CACHE) != $status;
+ return if i2c_smbus_read_byte_data($file, 0x06, NO_CACHE) != $status;
+ return if i2c_smbus_read_byte_data($file, 0xff, NO_CACHE) != $status;
+
+ $conf = i2c_smbus_read_byte_data($file, 0x03);
+ # The 4 lower bits should be zero
+ return unless ($conf & 0x0f) == 0x00;
- return 2;
+ return 5;
}
sub max6655_detect
@@ -5794,7 +6005,8 @@
# Chip to detect: 0 = STTS424, 1 = SE97/SE97B, 2 = SE98, 3 = ADT7408,
# 4 = TS3000/TSE2002, 5 = MAX6604, 6 = MCP98242,
# 7 = MCP98243, 8 = MCP9843, 9 = CAT6095 / CAT34TS02,
-# 10 = STTS424E
+# 10 = STTS424E, 11 = STTS2002, 12 = STTS3000
+# 13 = MCP9804, 14 = AT30TS00
# Registers used:
# 0x00: Capabilities
# 0x01: Configuration
@@ -5851,6 +6063,18 @@
} elsif ($chip == 10) {
return unless $manid == 0x10; # STMicrolectronics
return unless $devid == 0x00; # STTS424E02
+ } elsif ($chip == 11) {
+ return unless $manid == 0x10; # STMicrolectronics
+ return unless $devid == 0x03; # STTS2002
+ } elsif ($chip == 12) {
+ return unless $manid == 0x10; # STMicrolectronics
+ return unless $devid == 0x02; # STTS3000
+ } elsif ($chip == 13) {
+ return unless $manid == 0x00; # MCP
+ return unless $devid == 02; # MCP9804
+ } elsif ($chip == 14) {
+ return unless $manid == 0x00; # Atmel
+ return unless $devid == 0x82; # AT30TS00
}
# Now, do it all again with words. Note that we get
@@ -5877,7 +6101,7 @@
return unless $devid == 0x0108; # ADT7408
} elsif ($chip == 4) {
return unless $manid == 0xb300; # IDT
- return unless $devid == 0x0329; # TS3000/TSE2002
+ return unless $devid == 0x0329 || $devid == 0x1229; # TS3000/TSE2002
} elsif ($chip == 5) {
return unless $manid == 0x4d00; # MAXIM
return unless $devid == 0x003e; # MAX6604
@@ -5896,6 +6120,18 @@
} elsif ($chip == 10) {
return unless $manid == 0x4a10; # STMicrolectronics
return unless ($devid & 0xfeff) == 0x0000; # STTS424E02
+ } elsif ($chip == 11) {
+ return unless $manid == 0x4a10; # STMicrolectronics
+ return unless ($devid & 0xfeff) == 0x0003; # STTS2002
+ } elsif ($chip == 12) {
+ return unless $manid == 0x4a10; # STMicrolectronics
+ return unless ($devid & 0xfeff) == 0x0002; # STTS3000
+ } elsif ($chip == 13) {
+ return unless $manid == 0x5400; # MCP
+ return unless ($devid & 0xfcff) == 0x0002; # MCP9804
+ } elsif ($chip == 14) {
+ return unless $manid == 0x1f00; # Atmel
+ return unless ($devid & 0xfeff) == 0x0082; # AT30TS00
}
return 5;
@@ -5985,6 +6221,7 @@
sub ipmi_from_smbios
{
my ($version, $if, @ipmi_if);
+ my $ipmi_driver = "to-be-written"; # ipmisensors
return 0 unless check_dmidecode_version();
@@ -6020,13 +6257,13 @@
$if->{type}));
}
print "Success!\n".
- " (confidence 8, driver `ipmisensors')\n";
+ " (confidence 8, driver `$ipmi_driver')\n";
my $new_hash = {
conf => 8,
isa_addr => $if->{addr} || 0,
chipname => $if->{type},
};
- add_isa_to_chips_detected("ipmisensors", $new_hash);
+ add_isa_to_chips_detected($ipmi_driver, $new_hash);
}
return scalar @ipmi_if;
@@ -6091,9 +6328,10 @@
return 9;
}
-sub k8temp_pci_detect
+sub amd_pci_detect
{
- return unless exists $pci_list{'1022:1103'};
+ my $f3_id = shift;
+ return unless exists $pci_list{"1022:$f3_id"};
return 9;
}
@@ -6123,18 +6361,6 @@
return;
}
-sub fam11h_pci_detect
-{
- return unless exists $pci_list{'1022:1303'};
- return 9;
-}
-
-sub fam12h_14h_pci_detect
-{
- return unless exists $pci_list{'1022:1703'};
- return 9;
-}
-
sub intel_amb_detect
{
if ((exists $pci_list{'8086:25f0'}) || # Intel 5000
@@ -6442,6 +6668,22 @@
}
close(SYSCONFIG);
+ if (-x "/bin/systemctl" && -d "/lib/systemd/system" &&
+ ! -f "/lib/systemd/system/lm_sensors.service") {
+ print "Copy prog/init/lm_sensors.service to /lib/systemd/system\n".
+ "and run 'systemctl enable lm_sensors.service'\n".
+ "for initialization at boot time.\n";
+ return;
+ }
+
+ if (-x "/bin/systemctl" &&
+ -f "/lib/systemd/system/lm_sensors.service") {
+ system("/bin/systemctl", "enable", "lm_sensors.service");
+ system("/bin/systemctl", "start", "lm_sensors.service");
+ # All done, don't check for /etc/init.d/lm_sensors
+ return;
+ }
+
print "Copy prog/init/lm_sensors.init to /etc/init.d/lm_sensors\n".
"for initialization at boot time.\n"
unless -f "/etc/init.d/lm_sensors";
@@ -6497,8 +6739,10 @@
exit -1;
}
- if (-x "/sbin/service" && -f "/etc/init.d/lm_sensors" &&
- -f "/var/lock/subsys/lm_sensors") {
+ if (-x "/bin/systemctl" && -f "/lib/systemd/system/lm_sensors.service") {
+ system("/bin/systemctl", "stop", "lm_sensors.service");
+ } elsif (-x "/sbin/service" && -f "/etc/init.d/lm_sensors" &&
+ -f "/var/lock/subsys/lm_sensors") {
system("/sbin/service", "lm_sensors", "stop");
}
@@ -6525,7 +6769,7 @@
"Do you want to scan for them? This is totally safe. (YES/no): ";
unless (<STDIN> =~ /^\s*n/i) {
# Load the cpuid driver if needed
- unless (-e "/dev/cpu/$cpu[0]->{nr}/cpuid") {
+ unless (-e "$sysfs_root/class/cpuid") {
load_module("cpuid");
udev_settle();
}
|
[-]
[+]
|
Changed |
lm_sensors-3.3.2.tar.bz2/prog/dump/isadump.8
^
|
@@ -1,10 +1,11 @@
-.TH ISADUMP 8 "August 2004"
+.TH ISADUMP 8 "April 2011"
.SH NAME
isadump \- examine ISA registers
.SH SYNOPSIS
.B isadump
.RB [ -y ]
+.RB [ -W | -L ]
.RB [ "-k V1,V2..." ]
.I addrreg
.I datareg
@@ -12,8 +13,10 @@
#for I2C-like access
.br
.B isadump
+.B -f
.RB [ -y ]
-.BI "-f " address
+.RB [ -W | -L ]
+.I address
.RI [ "range " [ "bank " [ bankreg ]]]
#for flat address space
@@ -39,6 +42,12 @@
the chip configuration mode. Most Super-I/O chips need this.
Known key sequences are: 0x87,0x01,0x55,0x55 for ITE, 0x55 for SMSC, 0x87,0x87
for Winbond and VIA, none needed for National Semiconductor.
+.TP
+.B -W
+Perform 16-bit reads.
+.TP
+.B -L
+Perform 32-bit reads.
.SH OPTIONS (I2C-like access mode)
At least two options must be provided to isadump. \fIaddrreg\fR contains the
|
[-]
[+]
|
Changed |
lm_sensors-3.3.2.tar.bz2/prog/dump/isadump.c
^
|
@@ -2,7 +2,7 @@
isadump.c - isadump, a user-space program to dump ISA registers
Copyright (C) 2000 Frodo Looijaard <frodol@dds.nl>, and
Mark D. Studebaker <mdsxyz123@yahoo.com>
- Copyright (C) 2004,2007 Jean Delvare <khali@linux-fr.org>
+ Copyright (C) 2004-2011 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
@@ -52,9 +52,15 @@
{
fprintf(stderr,
"Syntax for I2C-like access:\n"
- " isadump [-y] [-k V1,V2...] ADDRREG DATAREG [BANK [BANKREG]]\n"
+ " isadump [OPTIONS] [-k V1,V2...] ADDRREG DATAREG [BANK [BANKREG]]\n"
"Syntax for flat address space:\n"
- " isadump [-y] -f ADDRESS [RANGE [BANK [BANKREG]]]\n");
+ " isadump -f [OPTIONS] ADDRESS [RANGE [BANK [BANKREG]]]\n"
+ "Options:\n"
+ " -k Super-I/O configuration access key\n"
+ " -f Enable flat address space mode\n"
+ " -y Assume affirmative answer to all questions\n"
+ " -W Read and display word (16-bit) values\n"
+ " -L Read and display long (32-bit) values\n");
}
static int default_bankreg(int flat, int addrreg, int datareg)
@@ -96,9 +102,10 @@
int bank = -1; /* -1 means no bank operation */
int bankreg;
int oldbank = 0;
- int i, j, res;
+ int i, j;
+ unsigned long res;
int flags = 0;
- int flat = 0, yes = 0;
+ int flat = 0, yes = 0, width = 1;
char *end;
unsigned char enter_key[SUPERIO_MAX_KEY+1];
@@ -118,6 +125,8 @@
}
flags++;
break;
+ case 'W': width = 2; break;
+ case 'L': width = 4; break;
default:
fprintf(stderr, "Warning: Unsupported flag "
"\"-%c\"!\n", argv[1+flags][1]);
@@ -270,9 +279,12 @@
if (bank >= 0)
oldbank = set_bank(flat, addrreg, datareg, bank, bankreg);
- if (flat)
- printf(" ");
- printf(" 0 1 2 3 4 5 6 7 8 9 a b c d e f\n");
+ /* print column headers */
+ printf("%*s", flat ? 5 : 3, "");
+ for (j = 0; j < 16; j += width)
+ printf(" %*x", width * 2, j);
+ printf("\n");
+
for (i = 0; i < range; i += 16) {
if (flat)
printf("%04x: ", addrreg + i);
@@ -288,19 +300,19 @@
if (enter_key[0])
superio_write_key(addrreg, enter_key);
- for (j = 0; j < 16; j++) {
+ for (j = 0; j < 16; j += width) {
fflush(stdout);
if (flat) {
- res = inb(addrreg + i + j);
+ res = inx(addrreg + i + j, width);
} else {
outb(i+j, addrreg);
if (i+j == 0 && inb(addrreg) == 0x80) {
/* Bit 7 appears to be a busy flag */
range = 128;
}
- res = inb(datareg);
+ res = inx(datareg, width);
}
- printf("%02x ", res);
+ printf("%0*lx ", width * 2, res);
}
printf("\n");
}
|
[-]
[+]
|
Changed |
lm_sensors-3.3.2.tar.bz2/prog/dump/isaset.8
^
|
@@ -1,10 +1,11 @@
-.TH ISASET 8 "May 2005"
+.TH ISASET 8 "April 2011"
.SH "NAME"
isaset \- set ISA registers
.SH SYNOPSIS
.B isaset
.RB [ -y ]
+.RB [ -W | -L ]
.I addrreg
.I datareg
.I address
@@ -13,8 +14,10 @@
#for I2C-like access
.br
.B isaset
+.B -f
.RB [ -y ]
-.BI "-f " address
+.RB [ -W | -L ]
+.I address
.I value
.RI [ mask ]
#for flat address space
@@ -33,6 +36,12 @@
from the user before messing with the ISA bus. When this flag is used, it
will perform the operation directly. This is mainly meant to be used in
scripts.
+.TP
+.B -W
+Perform a 16-bit write.
+.TP
+.B -L
+Perform a 32-bit write.
.SH OPTIONS (I2C-like access mode)
Four options must be provided to isaset. \fIaddrreg\fR contains the
|
[-]
[+]
|
Changed |
lm_sensors-3.3.2.tar.bz2/prog/dump/isaset.c
^
|
@@ -2,7 +2,7 @@
isaset.c - isaset, a user-space program to write ISA registers
Copyright (C) 2000 Frodo Looijaard <frodol@dds.nl>, and
Mark D. Studebaker <mdsxyz123@yahoo.com>
- Copyright (C) 2004,2007 Jean Delvare <khali@linux-fr.org>
+ Copyright (C) 2004-2011 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
@@ -48,17 +48,22 @@
{
fprintf(stderr,
"Syntax for I2C-like access:\n"
- " isaset [-y] ADDRREG DATAREG ADDRESS VALUE [MASK]\n"
+ " isaset [OPTIONS] ADDRREG DATAREG ADDRESS VALUE [MASK]\n"
"Syntax for flat address space:\n"
- " isaset [-y] -f ADDRESS VALUE [MASK]\n");
+ " isaset -f [OPTIONS] ADDRESS VALUE [MASK]\n"
+ "Options:\n"
+ " -f Enable flat address space mode\n"
+ " -y Assume affirmative answer to all questions\n"
+ " -W Write a word (16-bit) value\n"
+ " -L Write a long (32-bit) value\n");
}
int main(int argc, char *argv[])
{
- int addrreg, datareg = 0, value, addr = 0, vmask = 0;
- unsigned char res;
+ int addrreg, datareg = 0, addr = 0;
+ unsigned long value, vmask = 0, maxval = 0xff, res;
int flags = 0;
- int flat = 0, yes = 0;
+ int flat = 0, yes = 0, width = 1;
char *end;
/* handle (optional) flags first */
@@ -66,6 +71,8 @@
switch (argv[1+flags][1]) {
case 'f': flat = 1; break;
case 'y': yes = 1; break;
+ case 'W': width = 2; maxval = 0xffff; break;
+ case 'L': width = 4; maxval = 0xffffffff; break;
default:
fprintf(stderr, "Warning: Unsupported flag "
"\"-%c\"!\n", argv[1+flags][1]);
@@ -128,29 +135,30 @@
if (!flat)
flags += 2;
- value = strtol(argv[flags+2], &end, 0);
+ value = strtoul(argv[flags+2], &end, 0);
if (*end) {
fprintf(stderr, "Error: Invalid value!\n");
help();
exit(1);
}
- if (value < 0 || value > 0xff) {
+ if (value > maxval) {
fprintf(stderr, "Error: Value out of range "
- "(0x00-0xff)!\n");
+ "(0x%0*u-%0*lu)!\n", width * 2, 0, width * 2, maxval);
help();
exit(1);
}
if (flags+3 < argc) {
- vmask = strtol(argv[flags+3], &end, 0);
+ vmask = strtoul(argv[flags+3], &end, 0);
if (*end) {
fprintf(stderr, "Error: Invalid mask!\n");
help();
exit(1);
}
- if (vmask < 0 || vmask > 0xff) {
+ if (vmask > maxval) {
fprintf(stderr, "Error: Mask out of range "
- "(0x00-0xff)!\n");
+ "(0x%0*u-%0*lu)!\n", width * 2, 0,
+ width * 2, maxval);
help();
exit(1);
}
@@ -167,13 +175,15 @@
"system crashes, data loss and worse!\n");
if (flat)
- fprintf(stderr, "I will write value 0x%02x%s to address "
- "0x%x.\n", value, vmask ? " (masked)" : "",
- addrreg);
+ fprintf(stderr,
+ "I will write value 0x%0*lx%s to address "
+ "0x%x.\n", width * 2, value,
+ vmask ? " (masked)" : "", addrreg);
else
- fprintf(stderr, "I will write value 0x%02x%s to address "
+ fprintf(stderr,
+ "I will write value 0x%0*lx%s to address "
"0x%02x of chip with address register 0x%x\n"
- "and data register 0x%x.\n",
+ "and data register 0x%x.\n", width * 2,
value, vmask ? " (masked)" : "", addr,
addrreg, datareg);
@@ -206,26 +216,22 @@
#endif
if (vmask) {
- int oldvalue;
+ unsigned long oldvalue;
if (flat) {
- oldvalue = inb(addrreg);
+ oldvalue = inx(addrreg, width);
} else {
outb(addr, addrreg);
- oldvalue = inb(datareg);
- }
-
- if (oldvalue < 0) {
- fprintf(stderr, "Error: Failed to read old value\n");
- exit(1);
+ oldvalue = inx(datareg, width);
}
value = (value & vmask) | (oldvalue & ~vmask);
if (!yes) {
- fprintf(stderr, "Old value 0x%02x, write mask "
- "0x%02x: Will write 0x%02x to %s "
- "0x%02x\n", oldvalue, vmask, value,
+ fprintf(stderr, "Old value 0x%0*lx, write mask "
+ "0x%0*lx: Will write 0x%0*lx to %s "
+ "0x%02x\n", width * 2, oldvalue,
+ width * 2, vmask, width * 2, value,
flat ? "address" : "register",
flat ? addrreg : addr);
@@ -241,20 +247,21 @@
/* do the real thing */
if (flat) {
/* write */
- outb(value, addrreg);
+ outx(value, addrreg, width);
/* readback */
- res = inb(addrreg);
+ res = inx(addrreg, width);
} else {
/* write */
outb(addr, addrreg);
- outb(value, datareg);
+ outx(value, datareg, width);
/* readback */
- res = inb(datareg);
+ res = inx(datareg, width);
}
if (res != value) {
- fprintf(stderr, "Data mismatch, wrote 0x%02x, "
- "read 0x%02x back.\n", value, res);
+ fprintf(stderr, "Data mismatch, wrote 0x%0*lx, "
+ "read 0x%0*lx back.\n", width * 2, value,
+ width * 2, res);
}
exit(0);
|
[-]
[+]
|
Changed |
lm_sensors-3.3.2.tar.bz2/prog/dump/util.c
^
|
@@ -11,6 +11,13 @@
#include <stdio.h>
#include "util.h"
+/* To keep glibc2 happy */
+#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 0
+#include <sys/io.h>
+#else
+#include <asm/io.h>
+#endif
+
/* Return 1 if we should continue, 0 if we should abort */
int user_ack(int def)
{
@@ -46,3 +53,32 @@
return ret;
}
+/* I/O read of specified size */
+unsigned long inx(int addr, int width)
+{
+ switch (width) {
+ case 2:
+ return inw(addr);
+ break;
+ case 4:
+ return inl(addr);
+ break;
+ default:
+ return inb(addr);
+ }
+}
+
+/* I/O write of specified size */
+void outx(unsigned long value, int addr, int width)
+{
+ switch (width) {
+ case 2:
+ outw(value, addr);
+ break;
+ case 4:
+ outl(value, addr);
+ break;
+ default:
+ outb(value, addr);
+ }
+}
|
[-]
[+]
|
Changed |
lm_sensors-3.3.2.tar.bz2/prog/dump/util.h
^
|
@@ -12,5 +12,7 @@
#define _UTIL_H
extern int user_ack(int def);
+extern unsigned long inx(int addr, int width);
+extern void outx(unsigned long value, int addr, int width);
#endif /* _UTIL_H */
|
[-]
[+]
|
Changed |
lm_sensors-3.3.2.tar.bz2/prog/hotplug/README.p4b
^
|
@@ -3,7 +3,7 @@
It unhides the SMBus of Intel ICH southbridges hidden on Asus P4B series
and some other Asus and non-Asus systems. It is implemented as a shell
-script for the 2.6 kernel: unhide_ICH_SMBus.
+script for kernel 2.6.5 and later: unhide_ICH_SMBus.
It works with the following chips:
* ICH2 (82801BA)
@@ -19,9 +19,8 @@
irritated by just another PCI Device in the Win98 device manager."
Really funny :-).
-For 2.6 kernels, activation is normally handled by the code in
-drivers/pci/quirks.c in the kernel source. If you have the 2.6 kernel and
-the quirks code does not activate your SMBus, you may:
+Activation is normally handled by the code in drivers/pci/quirks.c in the
+kernel source. If the quirks code does not activate your SMBus, you may:
* first of all, read the paragraph "Hidden ICH SMBus" in
Documentation/i2c/busses/i2c-i801 in the kernel source.
|
[-]
[+]
|
Changed |
lm_sensors-3.3.2.tar.bz2/prog/hotplug/unhide_ICH_SMBus
^
|
@@ -43,7 +43,7 @@
modprobe fakephp &> /dev/null
if [ ! -d "$pcibus" ] ; then
- echo "You need the fake PCI hotplug driver! (fakephp.ko and 2.6 kernel)"
+ echo "You need the fake PCI hotplug driver! (fakephp.ko, kernel 2.6.5 or later)"
exit 255;
fi
|
[-]
[+]
|
Added |
lm_sensors-3.3.2.tar.bz2/prog/init/lm_sensors.service
^
|
@@ -0,0 +1,14 @@
+[Unit]
+Description=Initialize hardware monitoring sensors
+After=syslog.target
+
+[Service]
+EnvironmentFile=/etc/sysconfig/lm_sensors
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=-/sbin/modprobe -qab $BUS_MODULES $HWMON_MODULES
+ExecStart=/usr/bin/sensors -s
+ExecStop=-/sbin/modprobe -qabr $BUS_MODULES $HWMON_MODULES
+
+[Install]
+WantedBy=multi-user.target
|
[-]
[+]
|
Changed |
lm_sensors-3.3.2.tar.bz2/prog/pwm/fancontrol
^
|
@@ -49,7 +49,7 @@
echo "Loading configuration from $1 ..."
if [ ! -r "$1" ]
then
- echo "Error: Can't read configuration file"
+ echo "Error: Can't read configuration file" >&2
exit 1
fi
@@ -70,13 +70,13 @@
# 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!"
+ echo "Some mandatory settings missing, please check your config file!" >&2
exit 1
fi
if [ "$INTERVAL" -le 0 ]
then
- echo "Error in configuration file:"
- echo "INTERVAL must be at least 1"
+ echo "Error in configuration file:" >&2
+ echo "INTERVAL must be at least 1" >&2
exit 1
fi
@@ -90,8 +90,8 @@
do
if ! echo $fcv | egrep -q '='
then
- echo "Error in configuration file:"
- echo "FCTEMPS value is improperly formatted"
+ echo "Error in configuration file:" >&2
+ echo "FCTEMPS value is improperly formatted" >&2
exit 1
fi
@@ -110,32 +110,32 @@
# 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"
+ 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]}):"
- echo "MAXPWM must be at most 255"
+ 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]}):"
- echo "MINSTOP must be less than MAXPWM"
+ 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]}):"
- echo "MINSTOP must be greater than or equal to MINPWM"
+ 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]}):"
- echo "MINPWM must be at least 0"
+ echo "Error in configuration file (${AFCPWM[$fcvcount]}):" >&2
+ echo "MINPWM must be at least 0" >&2
exit 1
fi
@@ -185,7 +185,7 @@
if [ "`DevicePath "$device"`" != "$path" ]
then
- echo "Device path of $device has changed"
+ echo "Device path of $device has changed" >&2
outdated=1
fi
done
@@ -197,7 +197,7 @@
if [ "`DeviceName "$device"`" != "$name" ]
then
- echo "Device name of $device has changed"
+ echo "Device name of $device has changed" >&2
outdated=1
fi
done
@@ -215,7 +215,7 @@
pwmo=${AFCPWM[$fcvcount]}
if [ ! -w $pwmo ]
then
- echo "Error: file $pwmo doesn't exist"
+ echo "Error: file $pwmo doesn't exist" >&2
outdated=1
fi
let fcvcount=$fcvcount+1
@@ -227,7 +227,7 @@
tsen=${AFCTEMP[$fcvcount]}
if [ ! -r $tsen ]
then
- echo "Error: file $tsen doesn't exist"
+ echo "Error: file $tsen doesn't exist" >&2
outdated=1
fi
let fcvcount=$fcvcount+1
@@ -236,21 +236,24 @@
let fcvcount=0
while (( $fcvcount < ${#AFCFAN[@]} )) # go through all fan inputs
do
- fan=${AFCFAN[$fcvcount]}
- if [ ! -r $fan ]
- then
- echo "Error: file $fan doesn't exist"
- outdated=1
- fi
+ # 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
- echo "At least one referenced file is missing. Either some required kernel"
- echo "modules haven't been loaded, or your configuration file is outdated."
- echo "In the latter case, you should run pwmconfig again."
+ 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
@@ -274,13 +277,13 @@
then
DIR=/sys/bus/i2c/devices
else
- echo "$0: Invalid path to sensors"
+ 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?)'
+ echo $0: 'No sensors found! (did you load the necessary modules?)' >&2
exit 1
fi
cd $DIR
@@ -288,19 +291,19 @@
# Check for configuration change
if [ -z "$DEVPATH" -o -z "$DEVNAME" ]
then
- echo "Configuration is too old, please run pwmconfig again"
+ echo "Configuration is too old, please run pwmconfig again" >&2
exit 1
fi
if ! ValidateDevices "$DEVPATH" "$DEVNAME"
then
- echo "Configuration appears to be outdated, please run pwmconfig again"
+ echo "Configuration appears to be outdated, please run pwmconfig again" >&2
exit 1
fi
CheckFiles || exit 1
if [ -f "$PIDFILE" ]
then
- echo "File $PIDFILE exists, is fancontrol already running?"
+ echo "File $PIDFILE exists, is fancontrol already running?" >&2
exit 1
fi
echo $$ > "$PIDFILE"
@@ -405,12 +408,31 @@
# 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
+ 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
fanval=1 # set it to a non zero value, so the rest of the script still works
fi
@@ -430,6 +452,7 @@
echo "tval=$tval"
echo "pwmpval=$pwmpval"
echo "fanval=$fanval"
+ echo "min_fanval=$min_fanval"
fi
if (( $tval <= $mint ))
@@ -439,7 +462,7 @@
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 ]
+ 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
@@ -450,7 +473,7 @@
echo $pwmval > $pwmo # write new value to pwm output
if [ $? -ne 0 ]
then
- echo "Error writing PWM value to $DIR/$pwmo"
+ echo "Error writing PWM value to $DIR/$pwmo" >&2
restorefans 1
fi
if [ "$DEBUG" != "" ]
@@ -469,7 +492,7 @@
pwmenable $pwmo
if [ $? -ne 0 ]
then
- echo "Error enabling PWM on $DIR/$pwmo"
+ echo "Error enabling PWM on $DIR/$pwmo" >&2
restorefans 1
fi
let fcvcount=$fcvcount+1
|
[-]
[+]
|
Changed |
lm_sensors-3.3.2.tar.bz2/prog/sensord/sense.c
^
|
@@ -82,13 +82,21 @@
return (int) (val + 0.5);
}
-static int get_features(const sensors_chip_name *chip,
- const FeatureDescriptor *feature, int action,
- char *label, int alrm, int beep)
+static int do_features(const sensors_chip_name *chip,
+ const FeatureDescriptor *feature, int action)
{
- int i, ret;
+ char *label;
+ const char *formatted;
+ int i, alrm, beep, ret;
double val[MAX_DATA];
+ /* If only scanning, take a quick exit if alarm is off */
+ alrm = get_flag(chip, feature->alarmNumber);
+ if (alrm == -1)
+ return -1;
+ if (action == DO_SCAN && !alrm)
+ return 0;
+
for (i = 0; feature->dataNumbers[i] >= 0; i++) {
ret = sensors_get_value(chip, feature->dataNumbers[i],
val + i);
@@ -101,39 +109,32 @@
}
}
+ /* For RRD, we don't need anything else */
if (action == DO_RRD) {
if (feature->rrd) {
const char *rrded = feature->rrd(val);
- /* FIXME: Jean's review comment:
- * sprintf would me more efficient.
- */
- strcat(strcat (rrdBuff, ":"), rrded ? rrded : "U");
+ sprintf(rrdBuff + strlen(rrdBuff), ":%s",
+ rrded ? rrded : "U");
}
- } else {
- const char *formatted = feature->format(val, alrm, beep);
- if (!formatted) {
- sensorLog(LOG_ERR, "Error formatting sensor data");
- return -1;
- }
-
- if (action == DO_READ) {
- sensorLog(LOG_INFO, " %s: %s", label, formatted);
- } else {
- sensorLog(LOG_ALERT, "Sensor alarm: Chip %s: %s: %s",
- chipName(chip), label, formatted);
- }
+ return 0;
}
- return 0;
-}
-static int do_features(const sensors_chip_name *chip,
- const FeatureDescriptor *feature, int action)
-{
- char *label;
- int alrm, beep;
+ /* For scanning and logging, we need extra information */
+ beep = get_flag(chip, feature->beepNumber);
+ if (beep == -1)
+ return -1;
+
+ formatted = feature->format(val, alrm, beep);
+ if (!formatted) {
+ sensorLog(LOG_ERR, "Error formatting sensor data");
+ return -1;
+ }
+ /* FIXME: It would be more efficient to store the label at
+ * initialization time.
+ */
label = sensors_get_label(chip, feature->feature);
if (!label) {
sensorLog(LOG_ERR, "Error getting sensor label: %s/%s",
@@ -141,17 +142,15 @@
return -1;
}
- alrm = get_flag(chip, feature->alarmNumber);
- if (alrm == -1)
- return -1;
- else if (action == DO_SCAN && !alrm)
- return 0;
+ if (action == DO_READ)
+ sensorLog(LOG_INFO, " %s: %s", label, formatted);
+ else
+ sensorLog(LOG_ALERT, "Sensor alarm: Chip %s: %s: %s",
+ chipName(chip), label, formatted);
- beep = get_flag(chip, feature->beepNumber);
- if (beep == -1)
- return -1;
+ free(label);
- return get_features(chip, feature, action, label, alrm, beep);
+ return 0;
}
static int doKnownChip(const sensors_chip_name *chip,
|
[-]
[+]
|
Changed |
lm_sensors-3.3.2.tar.bz2/prog/sensord/sensord.8
^
|
@@ -347,7 +347,6 @@
echo OK.
echo -n "Starting sensord: "
daemon sensord
-...
.fi
.PP
Ignore the platform-specific shell functions; the general idea
|
[-]
[+]
|
Changed |
lm_sensors-3.3.2.tar.bz2/prog/sensord/sensord.c
^
|
@@ -204,7 +204,11 @@
} else if (pid != 0) {
fprintf(file, "%d\n", pid);
fclose(file);
- unloadLib();
+
+ freeChips();
+ if (unloadLib())
+ exit(EXIT_FAILURE);
+
exit(EXIT_SUCCESS);
}
|
[-]
[+]
|
Changed |
lm_sensors-3.3.2.tar.bz2/prog/sensors/chips.c
^
|
@@ -201,10 +201,8 @@
const sensors_feature *feature,
const struct sensor_subfeature_list *sfl,
struct sensor_subfeature_data *limits,
- int max_limits,
int *num_limits,
struct sensor_subfeature_data *alarms,
- int max_alarms,
int *num_alarms)
{
const sensors_subfeature *sf;
@@ -219,33 +217,21 @@
* (it is implied to be active if queued).
*/
if (get_value(name, sf)) {
- if (*num_alarms >= max_alarms) {
- fprintf(stderr,
- "Not enough %s buffers (%d)\n",
- "alarm", max_alarms);
- } else {
- alarms[*num_alarms].name = sfl->name;
- (*num_alarms)++;
- }
+ alarms[*num_alarms].name = sfl->name;
+ (*num_alarms)++;
}
} else {
/*
* Always queue limit subfeatures with their value.
*/
- if (*num_limits >= max_limits) {
- fprintf(stderr,
- "Not enough %s buffers (%d)\n",
- "limit", max_limits);
- } else {
- limits[*num_limits].value = get_value(name, sf);
- limits[*num_limits].name = sfl->name;
- (*num_limits)++;
- }
+ limits[*num_limits].value = get_value(name, sf);
+ limits[*num_limits].name = sfl->name;
+ (*num_limits)++;
}
if (sfl->exists) {
get_sensor_limit_data(name, feature, sfl->exists,
- limits, max_limits, num_limits,
- alarms, max_alarms, num_alarms);
+ limits, num_limits,
+ alarms, num_alarms);
}
}
}
@@ -280,15 +266,24 @@
{ SENSORS_SUBFEATURE_TEMP_CRIT, temp_crit_sensors, 0, "crit" },
{ SENSORS_SUBFEATURE_TEMP_EMERGENCY, temp_emergency_sensors, 0,
"emerg" },
+ { SENSORS_SUBFEATURE_TEMP_LOWEST, NULL, 0, "lowest" },
+ { SENSORS_SUBFEATURE_TEMP_HIGHEST, NULL, 0, "highest" },
{ -1, NULL, 0, NULL }
};
+#define NUM_TEMP_ALARMS 6
+#define NUM_TEMP_SENSORS (ARRAY_SIZE(temp_sensors) \
+ + ARRAY_SIZE(temp_max_sensors) \
+ + ARRAY_SIZE(temp_crit_sensors) \
+ + ARRAY_SIZE(temp_emergency_sensors) \
+ - NUM_TEMP_ALARMS - 4)
+
static void print_chip_temp(const sensors_chip_name *name,
const sensors_feature *feature,
int label_size)
{
- struct sensor_subfeature_data sensors[8];
- struct sensor_subfeature_data alarms[5];
+ struct sensor_subfeature_data sensors[NUM_TEMP_SENSORS];
+ struct sensor_subfeature_data alarms[NUM_TEMP_ALARMS];
int sensor_count, alarm_count;
const sensors_subfeature *sf;
double val;
@@ -321,8 +316,7 @@
sensor_count = alarm_count = 0;
get_sensor_limit_data(name, feature, temp_sensors,
- sensors, ARRAY_SIZE(sensors), &sensor_count,
- alarms, ARRAY_SIZE(alarms), &alarm_count);
+ sensors, &sensor_count, alarms, &alarm_count);
for (i = 0; i < sensor_count; i++) {
if (fahrenheit)
@@ -345,7 +339,7 @@
sens = 4;
printf(" sensor = %s", sens == 0 ? "disabled" :
- sens == 1 ? "diode" :
+ sens == 1 ? "CPU diode" :
sens == 2 ? "transistor" :
sens == 3 ? "thermal diode" :
sens == 4 ? "thermistor" :
@@ -365,17 +359,23 @@
{ SENSORS_SUBFEATURE_IN_MIN, NULL, 0, "min" },
{ SENSORS_SUBFEATURE_IN_MAX, NULL, 0, "max" },
{ SENSORS_SUBFEATURE_IN_CRIT, NULL, 0, "crit max" },
+ { SENSORS_SUBFEATURE_IN_AVERAGE, NULL, 0, "avg" },
+ { SENSORS_SUBFEATURE_IN_LOWEST, NULL, 0, "lowest" },
+ { SENSORS_SUBFEATURE_IN_HIGHEST, NULL, 0, "highest" },
{ -1, NULL, 0, NULL }
};
+#define NUM_IN_ALARMS 5
+#define NUM_IN_SENSORS (ARRAY_SIZE(voltage_sensors) - NUM_IN_ALARMS - 1)
+
static void print_chip_in(const sensors_chip_name *name,
const sensors_feature *feature,
int label_size)
{
const sensors_subfeature *sf;
char *label;
- struct sensor_subfeature_data sensors[4];
- struct sensor_subfeature_data alarms[4];
+ struct sensor_subfeature_data sensors[NUM_IN_SENSORS];
+ struct sensor_subfeature_data alarms[NUM_IN_ALARMS];
int sensor_count, alarm_count;
double val;
@@ -396,8 +396,7 @@
sensor_count = alarm_count = 0;
get_sensor_limit_data(name, feature, voltage_sensors,
- sensors, ARRAY_SIZE(sensors), &sensor_count,
- alarms, ARRAY_SIZE(alarms), &alarm_count);
+ sensors, &sensor_count, alarms, &alarm_count);
print_limits(sensors, sensor_count, alarms, alarm_count, label_size,
"%s = %+6.2f V");
@@ -409,7 +408,7 @@
const sensors_feature *feature,
int label_size)
{
- const sensors_subfeature *sf, *sfmin, *sfdiv;
+ const sensors_subfeature *sf, *sfmin, *sfmax, *sfdiv;
double val;
char *label;
@@ -436,24 +435,36 @@
sfmin = sensors_get_subfeature(name, feature,
SENSORS_SUBFEATURE_FAN_MIN);
+ sfmax = sensors_get_subfeature(name, feature,
+ SENSORS_SUBFEATURE_FAN_MAX);
sfdiv = sensors_get_subfeature(name, feature,
SENSORS_SUBFEATURE_FAN_DIV);
- if (sfmin && sfdiv)
- printf(" (min = %4.0f RPM, div = %1.0f)",
- get_value(name, sfmin),
- get_value(name, sfdiv));
- else if (sfmin)
- printf(" (min = %4.0f RPM)",
- get_value(name, sfmin));
- else if (sfdiv)
- printf(" (div = %1.0f)",
- get_value(name, sfdiv));
+ if (sfmin || sfmax || sfdiv) {
+ printf(" (");
+ if (sfmin)
+ printf("min = %4.0f RPM",
+ get_value(name, sfmin));
+ if (sfmax)
+ printf("%smax = %4.0f RPM",
+ sfmin ? ", " : "",
+ get_value(name, sfmax));
+ if (sfdiv)
+ printf("%sdiv = %1.0f",
+ (sfmin || sfmax) ? ", " : "",
+ get_value(name, sfdiv));
+ printf(")");
+ }
sf = sensors_get_subfeature(name, feature,
SENSORS_SUBFEATURE_FAN_ALARM);
- if (sf && get_value(name, sf)) {
+ sfmin = sensors_get_subfeature(name, feature,
+ SENSORS_SUBFEATURE_FAN_MIN_ALARM);
+ sfmax = sensors_get_subfeature(name, feature,
+ SENSORS_SUBFEATURE_FAN_MAX_ALARM);
+ if ((sf && get_value(name, sf)) ||
+ (sfmin && get_value(name, sfmin)) ||
+ (sfmax && get_value(name, sfmax)))
printf(" ALARM");
- }
printf("\n");
}
@@ -506,6 +517,11 @@
static const struct sensor_subfeature_list power_inst_sensors[] = {
{ SENSORS_SUBFEATURE_POWER_INPUT_LOWEST, NULL, 0, "lowest" },
{ SENSORS_SUBFEATURE_POWER_INPUT_HIGHEST, NULL, 0, "highest" },
+ { SENSORS_SUBFEATURE_POWER_AVERAGE, NULL, 0, "avg" },
+ { SENSORS_SUBFEATURE_POWER_AVERAGE_LOWEST, NULL, 0, "avg lowest" },
+ { SENSORS_SUBFEATURE_POWER_AVERAGE_HIGHEST, NULL, 0, "avg highest" },
+ { SENSORS_SUBFEATURE_POWER_AVERAGE_INTERVAL, NULL, 0,
+ "interval" },
{ -1, NULL, 0, NULL }
};
@@ -517,14 +533,19 @@
{ -1, NULL, 0, NULL }
};
+#define NUM_POWER_ALARMS 4
+#define NUM_POWER_SENSORS (ARRAY_SIZE(power_common_sensors) \
+ + ARRAY_SIZE(power_inst_sensors) \
+ - NUM_POWER_ALARMS - 2)
+
static void print_chip_power(const sensors_chip_name *name,
const sensors_feature *feature,
int label_size)
{
double val;
const sensors_subfeature *sf;
- struct sensor_subfeature_data sensors[6];
- struct sensor_subfeature_data alarms[3];
+ struct sensor_subfeature_data sensors[NUM_POWER_SENSORS];
+ struct sensor_subfeature_data alarms[NUM_POWER_ALARMS];
int sensor_count, alarm_count;
char *label;
const char *unit;
@@ -540,35 +561,50 @@
sensor_count = alarm_count = 0;
- /* Power sensors come in 2 flavors: instantaneous and averaged.
- To keep things simple, we assume that each sensor only implements
- one flavor. */
+ /*
+ * Power sensors come in 2 flavors: instantaneous and averaged.
+ * Most devices only support one flavor, so we try to display the
+ * average power if the instantaneous power attribute does not exist.
+ * If both instantaneous power and average power are supported,
+ * average power is displayed as limit.
+ */
sf = sensors_get_subfeature(name, feature,
SENSORS_SUBFEATURE_POWER_INPUT);
get_sensor_limit_data(name, feature,
sf ? power_inst_sensors : power_avg_sensors,
- sensors, ARRAY_SIZE(sensors), &sensor_count,
- alarms, ARRAY_SIZE(alarms), &alarm_count);
+ sensors, &sensor_count, alarms, &alarm_count);
/* Add sensors common to both flavors. */
- get_sensor_limit_data(name, feature,
- power_common_sensors,
- sensors, ARRAY_SIZE(sensors), &sensor_count,
- alarms, ARRAY_SIZE(alarms), &alarm_count);
+ get_sensor_limit_data(name, feature, power_common_sensors,
+ sensors, &sensor_count, alarms, &alarm_count);
if (!sf)
sf = sensors_get_subfeature(name, feature,
SENSORS_SUBFEATURE_POWER_AVERAGE);
if (sf && get_input_value(name, sf, &val) == 0) {
scale_value(&val, &unit);
- printf("%6.2f %sW ", val, unit);
+ printf("%6.2f %sW%*s", val, unit, 2 - (int)strlen(unit), "");
} else
printf(" N/A ");
- for (i = 0; i < sensor_count; i++)
- scale_value(&sensors[i].value, &sensors[i].unit);
-
+ for (i = 0; i < sensor_count; i++) {
+ /*
+ * Unit is W and needs to be scaled for all attributes except
+ * interval, which does not need to be scaled and is reported in
+ * seconds.
+ */
+ if (strcmp(sensors[i].name, "interval")) {
+ char *tmpstr;
+
+ tmpstr = alloca(4);
+ scale_value(&sensors[i].value, &unit);
+ snprintf(tmpstr, 4, "%sW", unit);
+ sensors[i].unit = tmpstr;
+ } else {
+ sensors[i].unit = "s";
+ }
+ }
print_limits(sensors, sensor_count, alarms, alarm_count,
- label_size, "%s = %6.2f %sW");
+ label_size, "%s = %6.2f %s");
printf("\n");
}
@@ -653,9 +689,15 @@
{ SENSORS_SUBFEATURE_CURR_MIN, NULL, 0, "min" },
{ SENSORS_SUBFEATURE_CURR_MAX, NULL, 0, "max" },
{ SENSORS_SUBFEATURE_CURR_CRIT, NULL, 0, "crit max" },
+ { SENSORS_SUBFEATURE_CURR_AVERAGE, NULL, 0, "avg" },
+ { SENSORS_SUBFEATURE_CURR_LOWEST, NULL, 0, "lowest" },
+ { SENSORS_SUBFEATURE_CURR_HIGHEST, NULL, 0, "highest" },
{ -1, NULL, 0, NULL }
};
+#define NUM_CURR_ALARMS 5
+#define NUM_CURR_SENSORS (ARRAY_SIZE(current_sensors) - NUM_CURR_ALARMS - 1)
+
static void print_chip_curr(const sensors_chip_name *name,
const sensors_feature *feature,
int label_size)
@@ -663,8 +705,8 @@
const sensors_subfeature *sf;
double val;
char *label;
- struct sensor_subfeature_data sensors[4];
- struct sensor_subfeature_data alarms[4];
+ struct sensor_subfeature_data sensors[NUM_CURR_SENSORS];
+ struct sensor_subfeature_data alarms[NUM_CURR_ALARMS];
int sensor_count, alarm_count;
if (!(label = sensors_get_label(name, feature))) {
@@ -684,8 +726,7 @@
sensor_count = alarm_count = 0;
get_sensor_limit_data(name, feature, current_sensors,
- sensors, ARRAY_SIZE(sensors), &sensor_count,
- alarms, ARRAY_SIZE(alarms), &alarm_count);
+ sensors, &sensor_count, alarms, &alarm_count);
print_limits(sensors, sensor_count, alarms, alarm_count, label_size,
"%s = %+6.2f A");
|
[-]
[+]
|
Changed |
lm_sensors-3.3.2.tar.bz2/version.h
^
|
@@ -1 +1 @@
-#define LM_VERSION "3.3.0"
+#define LM_VERSION "3.3.2"
|