Mailinglist Archive: opensuse-commit (1092 mails)
| < Previous | Next > |
commit sensors
- From: root@xxxxxxxxxxxxxxx (h_root)
- Date: Mon, 04 Feb 2008 17:41:24 +0100
- Message-id: <20080204164125.1200B678182@xxxxxxxxxxxxxxx>
Hello community,
here is the log from the commit of package sensors
checked in at Mon Feb 4 17:41:24 CET 2008.
--------
--- sensors/sensors.changes 2008-01-19 11:08:13.000000000 +0100
+++ /mounts/work_src_done/STABLE/sensors/sensors.changes 2008-02-04
10:41:27.747972000 +0100
@@ -1,0 +2,8 @@
+Mon Feb 4 10:36:48 CET 2008 - jdelvare@xxxxxxx
+
+- Update to lm_sensors 3.0.1
+ * Library no longer depends on libsysfs
+ * Library initialization is much faster
+ * Better service integration in sensors-detect
+
+-------------------------------------------------------------------
Old:
----
lm_sensors-3.0.0.dif
lm_sensors-3.0.0-sensord-fix-rrd-support.patch
lm_sensors-3.0.0-sensors.conf-fix-voltage-references.patch
lm_sensors-3.0.0.tar.bz2
New:
----
lm_sensors-3.0.1.dif
lm_sensors-3.0.1.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ sensors.spec ++++++
--- /var/tmp/diff_new_pack.m25336/_old 2008-02-04 17:41:14.000000000 +0100
+++ /var/tmp/diff_new_pack.m25336/_new 2008-02-04 17:41:14.000000000 +0100
@@ -1,5 +1,5 @@
#
-# spec file for package sensors (Version 3.0.0)
+# spec file for package sensors (Version 3.0.1)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@@ -11,21 +11,19 @@
# norootforbuild
Name: sensors
-BuildRequires: bison flex rrdtool-devel sysfsutils
+BuildRequires: bison flex rrdtool-devel
Url: http://www.lm-sensors.org/
-Version: 3.0.0
-Release: 18
+Version: 3.0.1
+Release: 1
Summary: Hardware health monitoring for Linux
License: GPL v2 or later
Group: System/Monitoring
Requires: modules
AutoReqProv: on
-Source0: lm_sensors-3.0.0.tar.bz2
-Patch: lm_sensors-3.0.0.dif
+Source0: lm_sensors-3.0.1.tar.bz2
+Patch: lm_sensors-3.0.1.dif
Patch1: lm_sensors-3.0.0-sensord-separate.dif
Patch2: lm_sensors-3.0.0-sysconfig_metadata.patch
-Patch3: lm_sensors-3.0.0-sensord-fix-rrd-support.patch
-Patch4: lm_sensors-3.0.0-sensors.conf-fix-voltage-references.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
ExcludeArch: s390 s390x
@@ -96,7 +94,6 @@
Summary: Hardware health monitoring library
Group: Development/Libraries/C and C++
Requires: libsensors4 = %{version}
-Requires: sysfsutils
Provides: sensors:/usr/include/sensors/sensors.h
AutoReqProv: on
Conflicts: libsensors3-devel
@@ -124,8 +121,6 @@
%patch
%patch1
%patch2
-%patch3
-%patch4
%build
RPM_OPT_FLAGS="$RPM_OPT_FLAGS"
@@ -201,6 +196,11 @@
%doc /usr/share/man/man3/*.3.gz
%changelog
+* Mon Feb 04 2008 jdelvare@xxxxxxx
+- Update to lm_sensors 3.0.1
+ * Library no longer depends on libsysfs
+ * Library initialization is much faster
+ * Better service integration in sensors-detect
* Sat Jan 19 2008 jdelvare@xxxxxxx
- Pass PREFIX and MANDIR on the command line from the spec file
rather than patching the Makefile. This is easier to maintain.
++++++ lm_sensors-3.0.0-sysconfig_metadata.patch ++++++
--- /var/tmp/diff_new_pack.m25336/_old 2008-02-04 17:41:14.000000000 +0100
+++ /var/tmp/diff_new_pack.m25336/_new 2008-02-04 17:41:14.000000000 +0100
@@ -2,7 +2,7 @@
===================================================================
--- prog/detect/sensors-detect.orig
+++ prog/detect/sensors-detect
-@@ -5898,6 +5898,12 @@ sub main
+@@ -5892,6 +5892,12 @@ sub main
open(local *SYSCONFIG, ">/etc/sysconfig/lm_sensors")
or die "Sorry, can't create /etc/sysconfig/lm_sensors ($!)";
print SYSCONFIG <<'EOT';
++++++ lm_sensors-3.0.0.dif -> lm_sensors-3.0.1.dif ++++++
--- sensors/lm_sensors-3.0.0.dif 2008-01-19 09:48:14.000000000 +0100
+++ /mounts/work_src_done/STABLE/sensors/lm_sensors-3.0.1.dif 2008-02-04
09:51:38.342261000 +0100
@@ -2,7 +2,7 @@
===================================================================
--- Makefile.orig
+++ Makefile
-@@ -133,7 +133,7 @@ ifeq ($(DEBUG),1)
+@@ -136,7 +136,7 @@ ifeq ($(DEBUG),1)
ALL_CPPFLAGS += -DDEBUG
ALL_CFLAGS += -O -g
else
@@ -11,19 +11,6 @@
endif
ifeq ($(WARN),1)
-Index: prog/detect/sensors-detect
-===================================================================
---- prog/detect/sensors-detect.orig
-+++ prog/detect/sensors-detect
-@@ -5945,6 +5945,8 @@ EOT
- 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";
-+ system("/sbin/insserv", "/etc/init.d/lm_sensors")
-+ if -f "/etc/init.d/lm_sensors";
- }
- }
-
Index: prog/init/README
===================================================================
--- prog/init/README.orig
++++++ lm_sensors-3.0.0.tar.bz2 -> lm_sensors-3.0.1.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/lm_sensors-3.0.0/CHANGES new/lm_sensors-3.0.1/CHANGES
--- old/lm_sensors-3.0.0/CHANGES 2007-11-24 14:32:18.000000000 +0100
+++ new/lm_sensors-3.0.1/CHANGES 2008-01-28 18:47:23.000000000 +0100
@@ -1,6 +1,32 @@
lm-sensors CHANGES file
-----------------------
+3.0.1 (2008-01-28)
+ documentation: Update the application writing guidelines
+ libsensors: No longer depend on libsysfs (#2262)
+ Don't guess the bus type from the device ID format (#2240)
+ Add support for attributes in the hwmon class device (#2260)
+ Makefile: No warnings about ld configuration for staged installations
+ Document the variable overriding mechanism (#2296)
+ pwmconfig: Really hide errors on sysfs writes
+ Deal gracefully with read-only pwm_enable files
+ Warn about outputs found in automatic mode
+ Repeat available configuration options before prompt (#2289)
+ Fix duplicate warning message when config file is broken
+ fancontrol: Detect improperly formatted FCTEMPS value (#2293)
+ sensord: Fix rrd support (#2276)
+ Use the same colors for daily and weekly charts
+ Drop workaround needed by old versions of rrdtool
+ sensors: Fix error path on library initialization error
+ sensors.conf.eg: Fix voltage value references (g520sm, lm80, pc87366)
+ sensors-detect: Drop PCA9540 detection
+ Improve sysconfig and modprobe.d integration
+ Add SMSC SCH5514D-NS detection (no sensors)
+ Lower the confidence of MAX6650/MAX6651
+ Add Fintek F71858DG detection
+ Add Fintek F81216D detection (no sensors)
+ unhide_ICH_SMBus: Add support for the 82801AA (ICH)
+
3.0.0 (2007-11-24)
Makefile: Fix MODULE_DIR usage in etc
Fix build on PPC
@@ -10,6 +36,7 @@
Mention the f75375s driver
Add SMSC LPC47B367-NC detection (no sensors)
Reduce w83781d/lm78 I2C address probing range
+ Add Intel Celeron 4xx and Penryn (CPU on 45nm) detection
3.0.0-rc3 (2007-10-28)
libsensors: Add a default configuration file
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/lm_sensors-3.0.0/doc/developers/applications
new/lm_sensors-3.0.1/doc/developers/applications
--- old/lm_sensors-3.0.0/doc/developers/applications 2007-06-27
16:53:36.000000000 +0200
+++ new/lm_sensors-3.0.1/doc/developers/applications 2007-12-02
14:25:16.000000000 +0100
@@ -1,113 +1,53 @@
-How to write applications which use our drivers
------------------------------------------------
+How to write applications which use the hwmon drivers
+=====================================================
-You have several choices in accessing sensor devices using the
-drivers in our package. This document will briefly
-describe these methods, their advantages and disadvantages,
-and provide examples.
+You have several choices in accessing sensor devices using the hwmon drivers.
+This document will briefly describe these methods, their advantages and
+disadvantages, and provide examples.
From lowest-level to the highest-level, the access methods are:
- 1) Character device access to the i2c bus driver
- via /dev/i2c-x
- 2) I2C bus access functions as defined in <linux/i2c-dev.h>
- 3) sysfs access to the chip device driver
- 4) libsensors library
- 5) sensors program
+ 1. sysfs access
+ 2. libsensors library
+ 3. sensors program
Details:
-1. Direct /dev access using ioctls
-----------------------------------
- Character device access to the i2c bus driver via ioctls on a /dev
- device. This device could be i2cx, i2c-x, or i2c/x, where x is an
- integer. The ioctls are defined in doc/dev-interface in the
- i2c package or Documentation/i2c/dev-interface in the linux kernel
- sources.
-
- This method does not use a chip device driver at all.
- However it does require the i2c-dev module.
- The driver must set an individual chip address on the bus via
- an ioctl, so it must use locking if multiple devices on the
- bus are being accessed. No access is provided for non-i2c
- busses such as ISA.
-
- For good examples, see i2cdetect.c (in the i2c-tools package) and
- prog/detect/sensors-detect.
-
-
-2. Direct /dev access using inline functions
---------------------------------------------
- I2C bus access inline functions as defined in <linux/i2c-dev.h>,
- and in doc/dev-interface in the i2c package or
- Documentation/i2c/dev-interface in the linux kernel sources.
- Note that these used to be defined in <linux/i2c-dev.h> in the kernel
- source tree. However, userspace applications are not supposed to
- include kernel headers, so the inline functions were removed from
- the kernel file in recent kernels. Use the header file from the
- i2c-tools package instead.
-
- This method does not use a chip device driver at all.
- However it does require the i2c-dev module.
- The driver must set an individual chip address on the bus via
- an ioctl, so it must use locking if multiple devices on the
- bus are being accessed. No access is provided for non-i2c
- busses such as ISA.
-
- For good examples, see i2cdetect.c, i2cdump.c, and i2cset.c (all in the
- i2c-tools package).
-
-
-3. sysfs access
+1. sysfs access
---------------
- Chip drivers using the i2c-sensor module create subdirectories in
- the sysfs filesystem (usually /sys) which can be accessed
- directly by applications.
+ Hwmon drivers create subdirectories in the sysfs filesystem (usually /sys)
+ which can be accessed directly by applications.
Naming and content standards for the entries in these subdirectories
- is documented in the file Documentation/i2c/sysfs-interface in the
- 2.6 kernel source tree. Note that these standards may not be
- strictly followed.
-
- If a new driver adheres to these standards then an application may
- be able to support new devices on-the-fly.
-
- sysfs access provides a method to read and write sensor values
- for any driver, including ISA chip drivers.
-
- This method may also works well for shell and perl scripts
- written to access a specific device. Note that sysfs is
- standard in 2.6 kernels.
+ are documented in the file Documentation/hwmon/sysfs-interface in the 2.6
+ kernel source tree. sysfs is the lowest-level access to sensor values.
Note that most drivers provide only raw sensor readings via /sys;
many readings must be scaled or adjusted, and these adjustments
must often be changed by the user. An application using /sys must
generally provide adjustment facilities and the requirements
- of the adjustments can be quite complex. If you need adjustment
- facilities, consider the libsensors library, below.
+ of the adjustments can be quite complex. For this reason, this
+ approach isn't recommended. Instead, consider the libsensors library,
+ which offers a higher-level interface on top of sysfs (see below.)
- For an examples of a program using /sys accesses, see gkrellm.
- See also lib/proc.c and i2cbusses.c (in the i2c-tools package) for
- examples. The sysfsutils package may also be helpful.
- Also search freshmeat for sensors and sysfs applications.
+ Still, this method may work well for shell and perl scripts written to
+ access a specific device.
+ For an example of a program using /sys accesses, see gkrellm (though
+ recent versions use libsensors instead.) See also lib/sysfs.c.
-4. libsensors library
+2. libsensors library
---------------------
The libsensors library provides standardized access to all chip drivers.
It also provides a translation layer with settings in /etc/sensors.conf
so that your application sees adjusted (scaled) values using settings
- provided by the user. Other facilities are sensor renaming, limit setting,
- and ignoring individual sensors.
- The libsensors library supports both 2.4 and 2.6 kernels.
-
- Unfortunately there is little documentation for libsensors. See the
- 'sensors' application in prog/sensors for an example. The source
- for libsensors is in the lib/ directory. Another example
- is in prog/sensord. Also search freshmeat for sensors applications.
-
- One other limitation of libsensors is that it is relatively
- cumbersome to add support for new devices.
+ provided by the user. Other facilities are sensor labelling, limit setting,
+ and ignoring individual sensors. This is the recommended way to access
+ the sensor chips.
+
+ The library API is documented in the libsensors(3) manual page. The
+ configuration file format is documented in the sensors.conf(5) manual
+ page.
Note that libsensors falls under the GPL, not the LGPL.
In more human language, that means it is FORBIDDEN to link any application
@@ -115,12 +55,16 @@
does not fall under the GPL. This may or may not be changed in the future.
Contact us if you wish to discuss your application.
- For an examples of a program using libsensors accesses, see
- prog/sensors/sensors. Also search freshmeat for sensors applications.
+ For examples of programs using libsensors accesses, see prog/sensors and
+ prog/sensord.
-5. sensors program
+3. sensors program
------------------
The 'sensors' program is a text-based application that uses libsensors.
The output is fairly standardized; therefore this output could be
used by other applications.
One simple method is 'sensors|grep ALARM'.
+ Note though that there is no guarantee that the output format won't change
+ in the future, so be careful. We might improve the command-line interface
+ of 'sensors' someday to make it more convenient for external programs to
+ use it as a back-end.
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/lm_sensors-3.0.0/doc/developers/lm_sensors.lsm
new/lm_sensors-3.0.1/doc/developers/lm_sensors.lsm
--- old/lm_sensors-3.0.0/doc/developers/lm_sensors.lsm 2007-11-24
14:32:18.000000000 +0100
+++ new/lm_sensors-3.0.1/doc/developers/lm_sensors.lsm 2008-01-28
18:47:23.000000000 +0100
@@ -1,7 +1,7 @@
Begin4
Title: lm_sensors
-Version: 3.0.0
-Entered-date: 2007-11-24
+Version: 3.0.1
+Entered-date: 2008-01-28
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@xxxxxxxxxxxx (Jean Delvare)
Maintained-by: khali@xxxxxxxxxxxx (Jean Delvare)
Primary-site: http://dl.lm-sensors.org /lm-sensors/releases/
- lm_sensors-3.0.0.tar.bz2
- lm_sensors-3.0.0.tar.bz2.asc
+ lm_sensors-3.0.1.tar.bz2
+ lm_sensors-3.0.1.tar.bz2.asc
Alternate-site: ftp.netroedge.com /pub/lm-sensors/
Copying-policy: GPL
End
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/lm_sensors-3.0.0/doc/developers/makefiles
new/lm_sensors-3.0.1/doc/developers/makefiles
--- old/lm_sensors-3.0.0/doc/developers/makefiles 2007-10-09
14:03:13.000000000 +0200
+++ new/lm_sensors-3.0.1/doc/developers/makefiles 2007-12-02
14:12:48.000000000 +0100
@@ -23,7 +23,7 @@
for example lib/Module.mk. They are not too difficult to understand.
There are several variables which can be set in the main Makefile. You can
-also specify them on the command-line; this overrules any definitions
+also specify them on the command-line; this overrules any definitions
within the Makefile. For example: 'make all WARN=1' will enable all warnings.
Examine main Makefile to see which ones are available. The most important
ones for developers:
@@ -36,9 +36,9 @@
Several files are generated by Makefiles:
* .rd
Dependency files for executables. Automatically generated.
- * .ao
+ * .ad
Dependency files for static libraries. Automatically generated.
- * .lo
+ * .ld
Dependency files for shared libraries. Automatically generated.
* .ro
Object files for executables. They will be linked together to create
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/lm_sensors-3.0.0/doc/developers/release_checklist
new/lm_sensors-3.0.1/doc/developers/release_checklist
--- old/lm_sensors-3.0.0/doc/developers/release_checklist 2007-11-02
11:22:29.000000000 +0100
+++ new/lm_sensors-3.0.1/doc/developers/release_checklist 2007-11-25
11:19:08.000000000 +0100
@@ -9,9 +9,7 @@
functionality is added, and patch if only bugs are fixed.
`svn diff -r Vx-y-z lib' is your friend.
- Update the CHANGES file (add the release date)
-- Update lm_sensors.lsm (Version, Entered-date and Primary-site) and send
- it to the LSM by mailing it to lsm@xxxxxxx with the subject `add' (no
- quotes).
+- Update lm_sensors.lsm (Version, Entered-date and Primary-site)
- Update version.h
- Commit
- Tag the release using SVN:
@@ -29,15 +27,19 @@
scp lm_sensors-3.x.x.tar.bz2* \
devel.atrpms.net:/srv/lm-sensors.org/dl/lm-sensors/releases
- Set correct permissions:
- ssh devel.atrpms.net chmod 664
+ ssh devel.atrpms.net chmod 664 \
'/srv/lm-sensors.org/dl/lm-sensors/releases/lm_sensors-3.x.x.tar.bz2*'
After release, remember to:
- Copy to mirrors
- Update the Download page on lm-sensors.org, then add a news item
- Announce on Freshmeat
-- Change CHANGES and version.h back to SVN
+- Add "+SVN" to version.h
- Mark the corresponding release milestone as complete using trac-admin
- e.g. 'trac-admin /srv/lm-sensors.org/trac milestone completed 2.10.2
2006-12-31'
+ e.g. 'trac-admin /srv/lm-sensors.org/trac milestone completed 3.0.0
2007-11-24'
+- Create a new version for the bug tracking system using trac-admin
+ e.g. 'trac-admin /srv/lm-sensors.org/trac version add 3.0.0 2007-11-24'
- Create a new release milestone using trac-admin
- e.g. 'trac-admin /srv/lm-sensors.org/trac milestone add 2.10.2 2006-12-31'
+ e.g. 'trac-admin /srv/lm-sensors.org/trac milestone add 3.0.1 2008-02-15'
+- Send lm_sensors.lsm to the LSM by mailing it to lsm@xxxxxxx with the
+ subject `add' (no quotes)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/lm_sensors-3.0.0/doc/developers/sysfs-interface
new/lm_sensors-3.0.1/doc/developers/sysfs-interface
--- old/lm_sensors-3.0.0/doc/developers/sysfs-interface 2007-09-24
11:44:48.000000000 +0200
+++ new/lm_sensors-3.0.1/doc/developers/sysfs-interface 1970-01-01
01:00:00.000000000 +0100
@@ -1,10 +0,0 @@
-sysfs access
-------------
-
-In the 2.6 kernel, sensor chip drivers create subdirectories in
-the sysfs filesystem (usually /sys) which can be accessed
-directly by applications, or preferably through libsensors.
-
-Naming and content standards for the entries in these subdirectories
-is documented in the file Documentation/hwmon/sysfs-interface in the
-2.6 kernel source tree.
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/lm_sensors-3.0.0/etc/sensors.conf.eg
new/lm_sensors-3.0.1/etc/sensors.conf.eg
--- old/lm_sensors-3.0.0/etc/sensors.conf.eg 2007-10-24 15:03:36.000000000
+0200
+++ new/lm_sensors-3.0.1/etc/sensors.conf.eg 2007-12-17 22:59:15.000000000
+0100
@@ -937,7 +937,7 @@
#
compute in2 (197/47)*@ , @/(197/47)
- compute in4 (5*@)-(4*in0) , (@+4*in0)/5
+ compute in4 (5*@)-(4*in0_input) , (@+4*in0_input)/5
# set in0_min 4.8
# set in0_max 5.2
@@ -987,8 +987,8 @@
compute in2 (22.1/30 + 1) * @ , @ / (22.1/30 + 1)
compute in3 (2.8/1.9) * @, @ * 1.9/2.8
compute in4 (160/30.1 + 1) * @, @ / (160/30.1 + 1)
- compute in5 (160/35.7)*(@ - in0) + @, (@ + in0 * 160/35.7)/ (1 + 160/35.7)
- compute in6 (36/16.2)*(@ - in0) + @, (@ + in0 * 36/16.2) / (1 + 36/16.2)
+ compute in5 (160/35.7)*(@ - in0_input) + @, (@ + in0_input * 160/35.7)/ (1
+ 160/35.7)
+ compute in6 (36/16.2)*(@ - in0_input) + @, (@ + in0_input * 36/16.2) / (1
+ 36/16.2)
# set in0_min 5 * 0.95
# set in0_max 5 * 1.05
@@ -2064,12 +2064,12 @@
# We also assume that you have a working in10 (which is forcibly enabled by
# default). If not, use 3.3 instead, but you lose accuracy.
- compute temp4 3435 / (` (1 / (1 - @ / in10) - 1) + 3435 / 298.15) -
273.15, \
- in10 * (1 - 1 / (1 + (^ (3435 / (273.15 + @) - 3435 /
298.15))))
- compute temp5 3435 / (` (1 / (1 - @ / in10) - 1) + 3435 / 298.15) -
273.15, \
- in10 * (1 - 1 / (1 + (^ (3435 / (273.15 + @) - 3435 /
298.15))))
- compute temp6 3435 / (` (1 / (1 - @ / in10) - 1) + 3435 / 298.15) -
273.15, \
- in10 * (1 - 1 / (1 + (^ (3435 / (273.15 + @) - 3435 /
298.15))))
+ compute temp4 3435 / (` (1 / (1 - @ / in10_input) - 1) + 3435 / 298.15) -
273.15, \
+ in10_input * (1 - 1 / (1 + (^ (3435 / (273.15 + @) - 3435 /
298.15))))
+ compute temp5 3435 / (` (1 / (1 - @ / in10_input) - 1) + 3435 / 298.15) -
273.15, \
+ in10_input * (1 - 1 / (1 + (^ (3435 / (273.15 + @) - 3435 /
298.15))))
+ compute temp6 3435 / (` (1 / (1 - @ / in10_input) - 1) + 3435 / 298.15) -
273.15, \
+ in10_input * (1 - 1 / (1 + (^ (3435 / (273.15 + @) - 3435 /
298.15))))
# set temp4_min 0
# set temp4_max 70
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/lm_sensors-3.0.0/INSTALL new/lm_sensors-3.0.1/INSTALL
--- old/lm_sensors-3.0.0/INSTALL 2007-11-24 14:19:08.000000000 +0100
+++ new/lm_sensors-3.0.1/INSTALL 2007-12-11 23:56:47.000000000 +0100
@@ -14,13 +14,11 @@
* gcc
* bison
* flex
-* libsysfs header files (from sysfsutils-devel)
* rrd header files (optional, for sensord)
Run-time dependencies:
-* libsysfs (from sysfsutils)
* perl (for sensors-detect)
-* rrd (optional, for sensord)
+* rrdtool >= 1.2.1 (optional, for sensord)
* proper kernel configuration (see below)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/lm_sensors-3.0.0/lib/access.c
new/lm_sensors-3.0.1/lib/access.c
--- old/lm_sensors-3.0.0/lib/access.c 2007-09-23 15:17:53.000000000 +0200
+++ new/lm_sensors-3.0.1/lib/access.c 2007-12-18 11:06:58.000000000 +0100
@@ -431,7 +431,7 @@
if (expr->kind == sensors_kind_var) {
if (!(subfeature = sensors_lookup_subfeature_name(chip_features,
expr->data.var)))
- return SENSORS_ERR_NO_ENTRY;
+ return -SENSORS_ERR_NO_ENTRY;
if (!(res = sensors_get_value(&chip_features->chip,
subfeature->number, result)))
return res;
@@ -495,7 +495,7 @@
if (!subfeature) {
sensors_parse_error("Unknown feature name",
chip->sets[i].lineno);
- err = SENSORS_ERR_NO_ENTRY;
+ err = -SENSORS_ERR_NO_ENTRY;
continue;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/lm_sensors-3.0.0/lib/Module.mk
new/lm_sensors-3.0.1/lib/Module.mk
--- old/lm_sensors-3.0.0/lib/Module.mk 2007-09-23 14:36:56.000000000 +0200
+++ new/lm_sensors-3.0.1/lib/Module.mk 2008-01-28 18:47:23.000000000 +0100
@@ -32,7 +32,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 := 0.0
+LIBMINORVER := 0.1
LIBVER := $(LIBMAINVER).$(LIBMINORVER)
# The static lib name, the shared lib name, and the internal ('so') name of
@@ -59,7 +59,7 @@
# How to create the shared library
$(MODULE_DIR)/$(LIBSHLIBNAME): $(LIBSHOBJECTS)
- $(CC) -shared -Wl,-soname,$(LIBSHSONAME) -o $@ $^ -lc -lm -lsysfs
+ $(CC) -shared -Wl,-soname,$(LIBSHSONAME) -o $@ $^ -lc -lm
$(MODULE_DIR)/$(LIBSHSONAME): $(MODULE_DIR)/$(LIBSHLIBNAME)
$(RM) $@
@@ -115,35 +115,35 @@
# so we can't make any assumptions.
install-lib: all-lib
$(MKDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(LIBINCLUDEDIR)
$(DESTDIR)$(LIBMAN3DIR) $(DESTDIR)$(LIBMAN5DIR)
- @if [ ! -e "$(DESTDIR)$(LIBDIR)/$(LIBSHSONAME)" ] ; then \
+ @if [ -z "$(DESTDIR)" -a ! -e "$(LIBDIR)/$(LIBSHSONAME)" ] ; then \
echo
'******************************************************************************'
; \
echo 'Warning: This is the first installation of the
$(LIBSHSONAME)*' ; \
- echo ' library files in $(DESTDIR)$(LIBDIR)!' ; \
+ echo ' library files in $(LIBDIR)!' ; \
echo ' You must update the library cache or the userspace
tools may fail' ; \
echo ' or have unpredictable results!' ; \
- echo ' Run the following command: /sbin/ldconfig' ; \
+ echo ' Run the following command: /sbin/ldconfig' ; \
echo
'******************************************************************************'
; \
fi
$(INSTALL) -m 644 $(LIB_DIR)/$(LIBSTLIBNAME) $(DESTDIR)$(LIBDIR)
$(INSTALL) -m 755 $(LIB_DIR)/$(LIBSHLIBNAME) $(DESTDIR)$(LIBDIR)
$(LN) $(LIBSHLIBNAME) $(DESTDIR)$(LIBDIR)/$(LIBSHSONAME)
$(LN) $(LIBSHSONAME) $(DESTDIR)$(LIBDIR)/$(LIBSHBASENAME)
- @if [ "$(DESTDIR)$(LIBDIR)" != "/usr/lib" -a "$(DESTDIR)$(LIBDIR)" !=
"/lib" ] ; then \
+ @if [ -z "$(DESTDIR)" -a "$(LIBDIR)" != "/usr/lib" -a "$(LIBDIR)" !=
"/lib" ] ; then \
if [ -e "/usr/lib/$(LIBSHSONAME)" -o -e "/usr/lib/$(LIBSHBASENAME)"
] ; then \
echo
'******************************************************************************'
; \
echo 'Warning: You have at least one $(LIBSHBASENAME) library file
in /usr/lib' ; \
- echo ' and the new library files are in
$(DESTDIR)$(LIBDIR)!' ; \
+ echo ' and the new library files are in $(LIBDIR)!' ; \
echo ' These old files must be removed or the userspace
tools may fail' ; \
echo ' or have unpredictable results!' ; \
echo ' Run the following command: rm
/usr/lib/$(LIBSHBASENAME)*' ; \
echo
'******************************************************************************'
; \
fi ; \
- grep -q '^$(DESTDIR)$(LIBDIR)$$' /etc/ld.so.conf || \
- grep -q '^$(DESTDIR)$(LIBDIR)[[:space:]:,=]' /etc/ld.so.conf || \
- grep -q '[[:space:]:,]$(DESTDIR)$(LIBDIR)$$' /etc/ld.so.conf || \
- grep -q '[[:space:]:,]$(DESTDIR)$(LIBDIR)[[:space:]:,=]'
/etc/ld.so.conf || \
+ grep -q '^$(LIBDIR)$$' /etc/ld.so.conf || \
+ grep -q '^$(LIBDIR)[[:space:]:,=]' /etc/ld.so.conf || \
+ grep -q '[[:space:]:,]$(LIBDIR)$$' /etc/ld.so.conf || \
+ grep -q '[[:space:]:,]$(LIBDIR)[[:space:]:,=]' /etc/ld.so.conf || \
( echo
'******************************************************************************'
; \
- echo 'Warning: Library directory $(DESTDIR)$(LIBDIR) is not
in /etc/ld.so.conf!' ; \
+ echo 'Warning: Library directory $(LIBDIR) is not in
/etc/ld.so.conf!' ; \
echo ' Add it and run /sbin/ldconfig for the
userspace tools to work.' ; \
echo
'******************************************************************************'
) ; \
fi
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/lm_sensors-3.0.0/lib/sysfs.c
new/lm_sensors-3.0.1/lib/sysfs.c
--- old/lm_sensors-3.0.0/lib/sysfs.c 2007-09-29 20:48:20.000000000 +0200
+++ new/lm_sensors-3.0.1/lib/sysfs.c 2008-01-05 16:20:13.000000000 +0100
@@ -28,13 +28,111 @@
#include <stdlib.h>
#include <limits.h>
#include <errno.h>
-#include <sysfs/libsysfs.h>
+#include <dirent.h>
#include "data.h"
#include "error.h"
#include "access.h"
#include "general.h"
#include "sysfs.h"
+
+/****************************************************************************/
+
+#define ATTR_MAX 128
+
+/*
+ * Read an attribute from sysfs
+ * Returns a pointer to a freshly allocated string; free it yourself.
+ * If the file doesn't exist or can't be read, NULL is returned.
+ */
+static char *sysfs_read_attr(const char *device, const char *attr)
+{
+ char path[NAME_MAX];
+ char buf[ATTR_MAX], *p;
+ FILE *f;
+
+ snprintf(path, NAME_MAX, "%s/%s", device, attr);
+
+ if (!(f = fopen(path, "r")))
+ return NULL;
+ p = fgets(buf, ATTR_MAX, f);
+ fclose(f);
+ if (!p)
+ return NULL;
+
+ /* Last byte is a '\n'; chop that off */
+ p = strndup(buf, strlen(buf) - 1);
+ if (!p)
+ sensors_fatal_error(__FUNCTION__, "out of memory");
+ return p;
+}
+
+/*
+ * Call an arbitrary function for each class device of the given class
+ * Returns 0 on success (all calls returned 0), a positive errno for
+ * local errors, or a negative error value if any call fails.
+ */
+static int sysfs_foreach_classdev(const char *class_name,
+ int (*func)(const char *, const char *))
+{
+ char path[NAME_MAX];
+ int path_off, ret;
+ DIR *dir;
+ struct dirent *ent;
+
+ path_off = snprintf(path, NAME_MAX, "%s/class/%s",
+ sensors_sysfs_mount, class_name);
+ if (!(dir = opendir(path)))
+ return errno;
+
+ ret = 0;
+ while (!ret && (ent = readdir(dir))) {
+ if (ent->d_name[0] == '.') /* skip hidden entries */
+ continue;
+
+ snprintf(path + path_off, NAME_MAX - path_off, "/%s",
+ ent->d_name);
+ ret = func(path, ent->d_name);
+ }
+
+ closedir(dir);
+ return ret;
+}
+
+/*
+ * Call an arbitrary function for each device of the given bus type
+ * Returns 0 on success (all calls returned 0), a positive errno for
+ * local errors, or a negative error value if any call fails.
+ */
+static int sysfs_foreach_busdev(const char *bus_type,
+ int (*func)(const char *, const char *))
+{
+ char path[NAME_MAX];
+ int path_off, ret;
+ DIR *dir;
+ struct dirent *ent;
+
+ path_off = snprintf(path, NAME_MAX, "%s/bus/%s/devices",
+ sensors_sysfs_mount, bus_type);
+ if (!(dir = opendir(path)))
+ return errno;
+
+ ret = 0;
+ while (!ret && (ent = readdir(dir))) {
+ if (ent->d_name[0] == '.') /* skip hidden entries */
+ continue;
+
+ snprintf(path + path_off, NAME_MAX - path_off, "/%s",
+ ent->d_name);
+ ret = func(path, ent->d_name);
+ }
+
+ closedir(dir);
+ return ret;
+}
+
+/****************************************************************************/
+
char sensors_sysfs_mount[NAME_MAX];
#define MAX_SENSORS_PER_TYPE 20
@@ -176,22 +274,36 @@
return SENSORS_SUBFEATURE_UNKNOWN;
}
+static int sensors_get_attr_mode(const char *device, const char *attr)
+{
+ char path[NAME_MAX];
+ struct stat st;
+ int mode = 0;
+
+ snprintf(path, NAME_MAX, "%s/%s", device, attr);
+ if (!stat(path, &st)) {
+ if (st.st_mode & S_IRUSR)
+ mode |= SENSORS_MODE_R;
+ if (st.st_mode & S_IWUSR)
+ mode |= SENSORS_MODE_W;
+ }
+ return mode;
+}
+
static int sensors_read_dynamic_chip(sensors_chip_features *chip,
- struct sysfs_device *sysdir)
+ const char *dev_path)
{
int i, fnum = 0, sfnum = 0, prev_slot;
- struct sysfs_attribute *attr;
- struct dlist *attrs;
+ DIR *dir;
+ struct dirent *ent;
sensors_subfeature *all_subfeatures;
sensors_subfeature *dyn_subfeatures;
sensors_feature *dyn_features;
sensors_feature_type ftype;
sensors_subfeature_type sftype;
- attrs = sysfs_get_device_attributes(sysdir);
-
- if (attrs == NULL)
- return -ENOENT;
+ if (!(dir = opendir(dev_path)))
+ return -errno;
/* We use a large sparse table at first to store all found
subfeatures, so that we can store them sorted at type and index
@@ -201,10 +313,13 @@
if (!all_subfeatures)
sensors_fatal_error(__FUNCTION__, "Out of memory");
- dlist_for_each_data(attrs, attr, struct sysfs_attribute) {
- char *name = attr->name;
+ while ((ent = readdir(dir))) {
+ char *name = ent->d_name;
int nr;
+ if (ent->d_name[0] == '.')
+ continue;
+
sftype = sensors_subfeature_get_type(name, &nr);
if (sftype == SENSORS_SUBFEATURE_UNKNOWN)
continue;
@@ -257,13 +372,11 @@
all_subfeatures[i].name = strdup(name);
if (!(sftype & 0x80))
all_subfeatures[i].flags |= SENSORS_COMPUTE_MAPPING;
- if (attr->method & SYSFS_METHOD_SHOW)
- all_subfeatures[i].flags |= SENSORS_MODE_R;
- if (attr->method & SYSFS_METHOD_STORE)
- all_subfeatures[i].flags |= SENSORS_MODE_W;
+ all_subfeatures[i].flags |= sensors_get_attr_mode(dev_path,
name);
sfnum++;
}
+ closedir(dir);
if (!sfnum) { /* No subfeature */
chip->subfeature = NULL;
@@ -333,39 +446,59 @@
{
struct stat statbuf;
- /* libsysfs will return success even if sysfs is not mounted,
- so we have to double-check */
- if (sysfs_get_mnt_path(sensors_sysfs_mount, NAME_MAX)
- || stat(sensors_sysfs_mount, &statbuf) < 0
+ snprintf(sensors_sysfs_mount, NAME_MAX, "%s", "/sys");
+ if (stat(sensors_sysfs_mount, &statbuf) < 0
|| statbuf.st_nlink <= 2) /* Empty directory */
return 0;
return 1;
}
-/* returns: 0 if successful, !0 otherwise */
-static int sensors_read_one_sysfs_chip(struct sysfs_device *dev)
+/* returns: number of devices added (0 or 1) if successful, <0 otherwise */
+static int sensors_read_one_sysfs_chip(const char *dev_path,
+ const char *dev_name,
+ const char *hwmon_path)
{
int domain, bus, slot, fn;
int err = -SENSORS_ERR_KERNEL;
- struct sysfs_attribute *attr, *bus_attr;
- char bus_path[SYSFS_PATH_MAX];
+ char *bus_attr;
+ char bus_path[NAME_MAX];
+ char linkpath[NAME_MAX];
+ char subsys_path[NAME_MAX], *subsys;
+ int sub_len;
sensors_chip_features entry;
/* ignore any device without name attribute */
- if (!(attr = sysfs_get_device_attr(dev, "name")))
+ if (!(entry.chip.prefix = sysfs_read_attr(hwmon_path, "name")))
return 0;
- /* NB: attr->value[attr->len-1] == '\n'; chop that off */
- entry.chip.prefix = strndup(attr->value, attr->len - 1);
- if (!entry.chip.prefix)
- sensors_fatal_error(__FUNCTION__, "out of memory");
-
- entry.chip.path = strdup(dev->path);
+ entry.chip.path = strdup(hwmon_path);
if (!entry.chip.path)
sensors_fatal_error(__FUNCTION__, "out of memory");
- if (sscanf(dev->name, "%hd-%x", &entry.chip.bus.nr, &entry.chip.addr)
== 2) {
+ /* Find bus type */
+ snprintf(linkpath, NAME_MAX, "%s/subsystem", dev_path);
+ sub_len = readlink(linkpath, subsys_path, NAME_MAX - 1);
+ if (sub_len < 0 && errno == ENOENT) {
+ /* Fallback to "bus" link for kernels <= 2.6.17 */
+ snprintf(linkpath, NAME_MAX, "%s/bus", dev_path);
+ sub_len = readlink(linkpath, subsys_path, NAME_MAX - 1);
+ }
+ if (sub_len < 0) {
+ /* Older kernels (<= 2.6.11) have neither the subsystem
+ symlink nor the bus symlink */
+ if (errno == ENOENT)
+ subsys = NULL;
+ else
+ goto exit_free;
+ } else {
+ subsys_path[sub_len] = '\0';
+ subsys = strrchr(subsys_path, '/') + 1;
+ }
+
+ if ((!subsys || !strcmp(subsys, "i2c")) &&
+ sscanf(dev_name, "%hd-%x", &entry.chip.bus.nr,
+ &entry.chip.addr) == 2) {
/* find out if legacy ISA or not */
if (entry.chip.bus.nr == 9191) {
entry.chip.bus.type = SENSORS_BUS_TYPE_ISA;
@@ -373,45 +506,45 @@
} else {
entry.chip.bus.type = SENSORS_BUS_TYPE_I2C;
snprintf(bus_path, sizeof(bus_path),
- "%s/class/i2c-adapter/i2c-%d/device/name",
+ "%s/class/i2c-adapter/i2c-%d/device",
sensors_sysfs_mount, entry.chip.bus.nr);
- if ((bus_attr = sysfs_open_attribute(bus_path))) {
- if (sysfs_read_attribute(bus_attr)) {
- sysfs_close_attribute(bus_attr);
- goto exit_free;
- }
-
- if (bus_attr->value
- && !strncmp(bus_attr->value, "ISA ", 4)) {
+ if ((bus_attr = sysfs_read_attr(bus_path, "name"))) {
+ if (!strncmp(bus_attr, "ISA ", 4)) {
entry.chip.bus.type =
SENSORS_BUS_TYPE_ISA;
entry.chip.bus.nr = 0;
}
- sysfs_close_attribute(bus_attr);
+ free(bus_attr);
}
}
- } else if (sscanf(dev->name, "spi%hd.%d", &entry.chip.bus.nr,
- &entry.chip.addr) == 2) {
+ } else
+ if ((!subsys || !strcmp(subsys, "spi")) &&
+ sscanf(dev_name, "spi%hd.%d", &entry.chip.bus.nr,
+ &entry.chip.addr) == 2) {
/* SPI */
entry.chip.bus.type = SENSORS_BUS_TYPE_SPI;
- } else if (sscanf(dev->name, "%*[a-z0-9_].%d", &entry.chip.addr) == 1) {
+ } else
+ if ((!subsys || !strcmp(subsys, "platform"))) {
/* must be new ISA (platform driver) */
+ if (sscanf(dev_name, "%*[a-z0-9_].%d", &entry.chip.addr) != 1)
+ entry.chip.addr = 0;
entry.chip.bus.type = SENSORS_BUS_TYPE_ISA;
entry.chip.bus.nr = 0;
- } else if (sscanf(dev->name, "%x:%x:%x.%x", &domain, &bus, &slot, &fn)
== 4) {
+ } else
+ if ((!subsys || !strcmp(subsys, "pci")) &&
+ sscanf(dev_name, "%x:%x:%x.%x", &domain, &bus, &slot, &fn) == 4) {
/* PCI */
entry.chip.addr = (domain << 16) + (bus << 8) + (slot << 3) +
fn;
entry.chip.bus.type = SENSORS_BUS_TYPE_PCI;
entry.chip.bus.nr = 0;
} else {
- /* platform device with no id? */
- entry.chip.bus.type = SENSORS_BUS_TYPE_ISA;
- entry.chip.bus.nr = 0;
- entry.chip.addr = 0;
+ /* Ignore unknown device */
+ err = 0;
+ goto exit_free;
}
- if (sensors_read_dynamic_chip(&entry, dev) < 0)
+ if (sensors_read_dynamic_chip(&entry, hwmon_path) < 0)
goto exit_free;
if (!entry.subfeature) { /* No subfeature, discard chip */
err = 0;
@@ -419,7 +552,7 @@
}
sensors_add_proc_chips(&entry);
- return 0;
+ return 1;
exit_free:
free(entry.chip.prefix);
@@ -427,125 +560,101 @@
return err;
}
+static int sensors_add_hwmon_device_compat(const char *path,
+ const char *dev_name)
+{
+ int err;
+
+ err = sensors_read_one_sysfs_chip(path, dev_name, path);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
/* returns 0 if successful, !0 otherwise */
static int sensors_read_sysfs_chips_compat(void)
{
- struct sysfs_bus *bus;
- struct dlist *devs;
- struct sysfs_device *dev;
- int ret = 0;
+ int ret;
- if (!(bus = sysfs_open_bus("i2c"))) {
- if (errno && errno != ENOENT)
- ret = -SENSORS_ERR_KERNEL;
- goto exit0;
- }
-
- if (!(devs = sysfs_get_bus_devices(bus))) {
- if (errno && errno != ENOENT)
- ret = -SENSORS_ERR_KERNEL;
- goto exit1;
- }
+ ret = sysfs_foreach_busdev("i2c", sensors_add_hwmon_device_compat);
+ if (ret && ret != ENOENT)
+ return -SENSORS_ERR_KERNEL;
- dlist_for_each_data(devs, dev, struct sysfs_device)
- if ((ret = sensors_read_one_sysfs_chip(dev)))
- goto exit1;
+ return 0;
+}
-exit1:
- /* this frees bus and devs */
- sysfs_close_bus(bus);
+static int sensors_add_hwmon_device(const char *path, const char *classdev)
+{
+ char linkpath[NAME_MAX];
+ char device[NAME_MAX], *device_p;
+ int dev_len, err;
+ (void)classdev; /* hide warning */
+
+ snprintf(linkpath, NAME_MAX, "%s/device", path);
+ dev_len = readlink(linkpath, device, NAME_MAX - 1);
+ if (dev_len < 0)
+ return -SENSORS_ERR_KERNEL;
+ device[dev_len] = '\0';
+ device_p = strrchr(device, '/') + 1;
-exit0:
- return ret;
+ /* The attributes we want might be those of the hwmon class device,
+ or those of the device itself. */
+ err = sensors_read_one_sysfs_chip(linkpath, device_p, path);
+ if (err == 0)
+ err = sensors_read_one_sysfs_chip(linkpath, device_p, linkpath);
+ if (err < 0)
+ return err;
+ return 0;
}
/* returns 0 if successful, !0 otherwise */
int sensors_read_sysfs_chips(void)
{
- struct sysfs_class *cls;
- struct dlist *clsdevs;
- struct sysfs_class_device *clsdev;
- int ret = 0;
+ int ret;
- if (!(cls = sysfs_open_class("hwmon"))) {
+ ret = sysfs_foreach_classdev("hwmon", sensors_add_hwmon_device);
+ if (ret == ENOENT) {
/* compatibility function for kernel 2.6.n where n <= 13 */
return sensors_read_sysfs_chips_compat();
}
- if (!(clsdevs = sysfs_get_class_devices(cls))) {
- if (errno && errno != ENOENT)
- ret = -SENSORS_ERR_KERNEL;
- goto exit;
- }
-
- dlist_for_each_data(clsdevs, clsdev, struct sysfs_class_device) {
- struct sysfs_device *dev;
- if (!(dev = sysfs_get_classdev_device(clsdev))) {
- ret = -SENSORS_ERR_KERNEL;
- goto exit;
- }
- if ((ret = sensors_read_one_sysfs_chip(dev)))
- goto exit;
- }
-
-exit:
- /* this frees cls and clsdevs */
- sysfs_close_class(cls);
+ if (ret > 0)
+ ret = -SENSORS_ERR_KERNEL;
return ret;
}
/* returns 0 if successful, !0 otherwise */
-int sensors_read_sysfs_bus(void)
+static int sensors_add_i2c_bus(const char *path, const char *classdev)
{
- struct sysfs_class *cls;
- struct dlist *clsdevs;
- struct sysfs_class_device *clsdev;
sensors_bus entry;
- int ret = 0;
- if (!(cls = sysfs_open_class("i2c-adapter"))) {
- if (errno && errno != ENOENT)
- ret = -SENSORS_ERR_KERNEL;
- goto exit0;
- }
-
- if (!(clsdevs = sysfs_get_class_devices(cls))) {
- if (errno && errno != ENOENT)
- ret = -SENSORS_ERR_KERNEL;
- goto exit1;
- }
-
- dlist_for_each_data(clsdevs, clsdev, struct sysfs_class_device) {
- struct sysfs_device *dev;
- struct sysfs_attribute *attr;
-
- /* Get the adapter name from the classdev "name" attribute
- * (Linux 2.6.20 and later). If it fails, fall back to
- * the device "name" attribute (for older kernels). */
- if (!(attr = sysfs_get_classdev_attr(clsdev, "name"))
- && !((dev = sysfs_get_classdev_device(clsdev)) &&
- (attr = sysfs_get_device_attr(dev, "name"))))
- continue;
+ if (sscanf(classdev, "i2c-%hd", &entry.bus.nr) != 1 ||
+ entry.bus.nr == 9191) /* legacy ISA */
+ return 0;
+ entry.bus.type = SENSORS_BUS_TYPE_I2C;
- if (sscanf(clsdev->name, "i2c-%hd", &entry.bus.nr) != 1 ||
- entry.bus.nr == 9191) /* legacy ISA */
- continue;
- entry.bus.type = SENSORS_BUS_TYPE_I2C;
+ /* Get the adapter name from the classdev "name" attribute
+ * (Linux 2.6.20 and later). If it fails, fall back to
+ * the device "name" attribute (for older kernels). */
+ entry.adapter = sysfs_read_attr(path, "name");
+ if (!entry.adapter)
+ entry.adapter = sysfs_read_attr(path, "device/name");
+ if (entry.adapter)
+ sensors_add_proc_bus(&entry);
- /* NB: attr->value[attr->len-1] == '\n'; chop that off */
- entry.adapter = strndup(attr->value, attr->len - 1);
- if (!entry.adapter)
- sensors_fatal_error(__FUNCTION__, "out of memory");
+ return 0;
+}
- sensors_add_proc_bus(&entry);
- }
+/* returns 0 if successful, !0 otherwise */
+int sensors_read_sysfs_bus(void)
+{
+ int ret;
-exit1:
- /* this frees *cls _and_ *clsdevs */
- sysfs_close_class(cls);
+ ret = sysfs_foreach_classdev("i2c-adapter", sensors_add_i2c_bus);
+ if (ret && ret != ENOENT)
+ return -SENSORS_ERR_KERNEL;
-exit0:
- return ret;
+ return 0;
}
int sensors_read_sysfs_attr(const sensors_chip_name *name,
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/lm_sensors-3.0.0/Makefile new/lm_sensors-3.0.1/Makefile
--- old/lm_sensors-3.0.0/Makefile 2007-11-23 20:50:05.000000000 +0100
+++ new/lm_sensors-3.0.1/Makefile 2008-01-19 11:20:45.000000000 +0100
@@ -33,6 +33,9 @@
DEBUG := 0
#DEBUG := 1
+# Note that all the installation paths below can also be set on the make
+# command line (e.g. "make PREFIX=/usr").
+
# If you want to install at some other place then at from which you will run
# everything, set DESTDIR to the extra prefix.
DESTDIR :=
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/lm_sensors-3.0.0/prog/detect/sensors-detect
new/lm_sensors-3.0.1/prog/detect/sensors-detect
--- old/lm_sensors-3.0.0/prog/detect/sensors-detect 2007-11-11
22:20:16.000000000 +0100
+++ new/lm_sensors-3.0.1/prog/detect/sensors-detect 2008-01-22
13:22:47.000000000 +0100
@@ -47,7 +47,7 @@
use vars qw(@pci_adapters @chip_ids $i2c_addresses_to_scan @superio_ids
@cpu_ids $revision);
-$revision = '$Revision: 5016 $ ($Date: 2007-11-11 22:20:16 +0100 (dim, 11 nov
2007) $)';
+$revision = '$Revision: 5108 $ ($Date: 2008-01-22 13:22:47 +0100 (mar, 22 jan
2008) $)';
$revision =~ s/\$\w+: (.*?) \$/$1/g;
$revision =~ s/ \([^()]*\)//;
@@ -1462,12 +1462,6 @@
i2c_detect => sub { fintek_detect(7, @_); },
},
{
- name => "Philips Semiconductors PCA9540",
- driver => "pca9540",
- i2c_addrs => [0x70],
- i2c_detect => sub { pca9540_detect(@_); },
- },
- {
name => "Smart Battery",
driver => "smartbatt",
i2c_addrs => [0x0b],
@@ -1698,12 +1692,12 @@
logdev => 0x0f,
},
{
- name => "Nat. Semi. PC87371 Super IO",
+ name => "Nat. Semi. PC87317 Super IO",
driver => "not-a-sensor",
devid => 0xd0,
},
{
- name => "Nat. Semi. PC97371 Super IO",
+ name => "Nat. Semi. PC97317 Super IO",
driver => "not-a-sensor",
devid => 0xdf,
},
@@ -1919,6 +1913,12 @@
driver => "not-a-sensor",
devid => 0x79,
},
+ {
+ name => "SMSC SCH5514D-NS Super IO",
+ # No datasheet
+ driver => "not-a-sensor",
+ devid => 0x83,
+ },
],
# Non-standard SMSC detection callback and chip list. These chips differ
# from the standard ones listed above in that the device ID register
@@ -2049,12 +2049,23 @@
logdev => 0x04,
},
{
+ name => "Fintek F71858DG Super IO Sensors",
+ driver => "to-be-written",
+ devid => 0x0507,
+ logdev => 0x02,
+ },
+ {
name => "Fintek F71882FG/F71883FG Super IO Sensors",
driver => "f71882fg",
devid => 0x0541,
logdev => 0x04,
},
{
+ name => "Fintek F81216D Super IO",
+ driver => "not-a-sensor",
+ devid => 0x0208,
+ },
+ {
name => "Fintek F81218D Super IO",
driver => "not-a-sensor",
devid => 0x0206,
@@ -5213,24 +5224,6 @@
return 7;
}
-# $_[0]: A reference to the file descriptor to access this chip.
-# $_[1]: Address
-# Returns: undef if not detected, 1 if detected
-# Detection is rather difficult, since the PCA9540 has a single register.
-# Fortunately, no other device is known to live at this address.
-sub pca9540_detect
-{
- my ($file, $addr) = @_;
- my $reg = i2c_smbus_read_byte($file);
-
- return if ($reg & 0xfa);
- return if $reg != i2c_smbus_read_byte($file);
- return if $reg != i2c_smbus_read_byte($file);
- return if $reg != i2c_smbus_read_byte($file);
-
- return 1;
-}
-
# 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.
@@ -5325,7 +5318,7 @@
# if somebody finds a way to distinguish MAX6650 and MAX6651.
# $_[1]: A reference to the file descriptor to access this chip.
# $_[2]: Address
-# Returns: undef if not detected, 4 if detected.
+# Returns: undef if not detected, 3 if detected.
#
# 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
@@ -5352,7 +5345,7 @@
return if i2c_smbus_read_byte_data($file,0x14) & 0xE0;
return if ($conf & 0xC0) or ($conf & 0x07) > 4;
- return 4;
+ return 3;
}
# $_[0]: Chip to detect. Always zero.
@@ -5472,7 +5465,9 @@
if ($probecpu->{'vendor_id'} eq 'GenuineIntel' &&
$probecpu->{'cpu family'} == 6 &&
($probecpu->{'model'} == 14 ||
- $probecpu->{'model'} == 15)) {
+ $probecpu->{'model'} == 15 ||
+ $probecpu->{'model'} == 0x16 ||
+ $probecpu->{'model'} == 0x17)) {
return 9;
}
}
@@ -5856,35 +5851,34 @@
}
print "\n";
- print "I will now generate the commands needed to load the required
modules.\n".
- "Just press ENTER to continue: ";
- <STDIN>;
-
- print "\n";
my ($modprobes, $configfile) = generate_modprobes 1; # 1 == prefer ISA
+
if (defined $configfile) {
- print "To make the sensors modules behave correctly, add these lines to\n".
- "$modules_conf:\n\n";
- print "#----cut here----\n".
- $configfile.
- "#----cut here----\n\n";
+ 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'),
+ ($have_modprobe_d ? 'YES/no' : 'yes/NO');
+ $_ = <STDIN>;
+ if (($have_modprobe_d and not m/^\s*n/i) or m/^\s*y/i) {
+ unless ($have_modprobe_d) {
+ 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 ($!)";
+ print MODPROBE_D
+ "# Generated by sensors-detect on " . scalar localtime() . "\n";
+ print MODPROBE_D $configfile;
+ close(MODPROBE_D);
+ } else {
+ print "To make the sensors modules behave correctly, add these lines
to\n".
+ "$modules_conf:\n\n";
+ print "#----cut here----\n".
+ $configfile.
+ "#----cut here----\n\n";
+ }
}
- print "To load everything that is needed, add this to some /etc/rc*
file:\n\n";
- print "#----cut here----\n".
- $modprobes.
- "# sleep 2 # optional\n".
- (-e '/usr/bin/sensors' ?
- "/usr/bin/sensors -s # recommended\n" :
- "/usr/local/bin/sensors -s # recommended\n") .
- "#----cut here----\n\n";
-
- print "If you have some drivers built into your kernel, the list above
will\n".
- "contain too many modules. Skip the appropriate ones! You really\n".
- "should try these commands right now to make sure everything is\n".
- "working properly. Monitoring programs won't work until the needed\n".
- "modules are loaded.\n\n";
-
my $have_sysconfig = -d '/etc/sysconfig';
printf "Do you want to \%s /etc/sysconfig/lm_sensors? (\%s): ",
(-e '/etc/sysconfig/lm_sensors' ? 'overwrite' : 'generate'),
@@ -5941,10 +5935,33 @@
$i++;
}
print SYSCONFIG $sysconfig;
+ close(SYSCONFIG);
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";
+
+ if (-x "/sbin/insserv" && -f "/etc/init.d/lm_sensors") {
+ system("/sbin/insserv", "/etc/init.d/lm_sensors");
+ } else {
+ print "You should now start the lm_sensors service to load the
required\n".
+ "kernel modules.\n\n";
+ }
+ } else {
+ print "To load everything that is needed, add this to one of the system\n".
+ "initialization scripts (e.g. /etc/rc.d/rc.local):\n\n";
+ print "#----cut here----\n".
+ $modprobes.
+ (-e '/usr/bin/sensors' ?
+ "/usr/bin/sensors -s\n" :
+ "/usr/local/bin/sensors -s\n") .
+ "#----cut here----\n\n";
+
+ print "If you have some drivers built into your kernel, the list above
will\n".
+ "contain too many modules. Skip the appropriate ones! You really\n".
+ "should try these commands right now to make sure everything is\n".
+ "working properly. Monitoring programs won't work until the
needed\n".
+ "modules are loaded.\n\n";
}
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/lm_sensors-3.0.0/prog/hotplug/unhide_ICH_SMBus
new/lm_sensors-3.0.1/prog/hotplug/unhide_ICH_SMBus
--- old/lm_sensors-3.0.0/prog/hotplug/unhide_ICH_SMBus 2007-10-13
20:42:16.000000000 +0200
+++ new/lm_sensors-3.0.1/prog/hotplug/unhide_ICH_SMBus 2007-12-19
14:27:40.000000000 +0100
@@ -10,6 +10,7 @@
#
# Supports the following Intel ICH chipsets:
# PCI ID
+# ICH 8086:2410
# ICH2 8086:2440
# ICH2-M 8086:244C
# ICH3 8086:2480
@@ -33,10 +34,10 @@
exit
fi
-intel=`lspci -n -s $device.0 | grep -i '8086:24[48CD][0C]'`
+intel=`lspci -n -s $device.0 | grep -i '8086:24[148CD][0C]'`
if [ -z "$intel" ] ; then
echo "Not for your chipset - Intel (ICH) only"
- echo "Supported: ICH2, ICH2-M, ICH3, ICH3-M, ICH4, ICH4-M, ICH5"
+ echo "Supported: ICH, ICH2, ICH2-M, ICH3, ICH3-M, ICH4, ICH4-M, ICH5"
exit 255;
fi
modprobe fakephp &> /dev/null
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/lm_sensors-3.0.0/prog/pwm/fancontrol
new/lm_sensors-3.0.1/prog/pwm/fancontrol
--- old/lm_sensors-3.0.0/prog/pwm/fancontrol 2007-07-08 13:17:26.000000000
+0200
+++ new/lm_sensors-3.0.1/prog/pwm/fancontrol 2008-01-09 11:59:48.000000000
+0100
@@ -82,6 +82,13 @@
let fcvcount=0
for fcv in $FCTEMPS
do
+ if ! echo $fcv | egrep -q '='
+ then
+ echo "Error in configuration file:"
+ echo "FCTEMPS value is improperly formatted"
+ exit 1
+ fi
+
AFCPWM[$fcvcount]=`echo $fcv |cut -d'=' -f1`
AFCTEMP[$fcvcount]=`echo $fcv |cut -d'=' -f2`
AFCFAN[$fcvcount]=`echo $FCFANS |sed -e 's/ /\n/g' |egrep
"${AFCPWM[$fcvcount]}" |cut -d'=' -f2`
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/lm_sensors-3.0.0/prog/pwm/pwmconfig
new/lm_sensors-3.0.1/prog/pwm/pwmconfig
--- old/lm_sensors-3.0.0/prog/pwm/pwmconfig 2007-11-18 17:16:41.000000000
+0100
+++ new/lm_sensors-3.0.1/prog/pwm/pwmconfig 2008-01-27 15:18:24.000000000
+0100
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# pwmconfig v0.8
+# pwmconfig $Revision: 5112 $
# Tests the pwm outputs of sensors and configures fancontrol
#
# Warning!!! This program will stop your fans, one at a time,
@@ -110,6 +110,24 @@
}
# $1 = pwm file name
+function is_pwm_auto()
+{
+ if [ -n "$SYSFS" ]
+ then
+ ENABLE=${1}_enable
+ if [ -f $ENABLE ]
+ then
+ if [ "`cat $ENABLE`" -gt 1 ]
+ then
+ return 0
+ fi
+ fi
+ fi
+
+ return 1
+}
+
+# $1 = pwm file name
function pwmdisable()
{
if [ -n "$SYSFS" ]
@@ -123,7 +141,7 @@
fi
# Try pwmN_enable=0
- echo 0 > $ENABLE 2> /dev/null
+ echo 0 2>/dev/null > $ENABLE
if [ "`cat $ENABLE`" -eq 0 ]
then
# Success
@@ -131,7 +149,7 @@
fi
# It didn't work, try pwmN_enable=1 pwmN=255
- echo 1 > $ENABLE 2> /dev/null
+ echo 1 2>/dev/null > $ENABLE
if [ "`cat $ENABLE`" -ne 1 ]
then
echo "$ENABLE stuck to `cat $ENABLE`" >&2
@@ -161,7 +179,7 @@
ENABLE=${1}_enable
if [ -w $ENABLE ]
then
- echo 1 > $ENABLE 2> /dev/null
+ echo 1 2>/dev/null > $ENABLE
if [ $? -ne 0 ]
then
return 1
@@ -192,18 +210,41 @@
echo " $i"
if [ -w $i ]
then
+ # First check if PWM output is in automatic mode
+ if is_pwm_auto $i
+ then
+ echo "$i is currently setup for automatic speed
control."
+ echo 'In general, automatic mode is preferred over
manual mode, as'
+ echo 'it is more efficient and it reacts faster. Are
you sure that'
+ echo -n 'you want to setup this output for manual
control? (n) '
+ read X
+ if [ "$X" = "" -o "$X" != "y" -a "$X" != "Y" ]
+ then
+ continue
+ fi
+ fi
+
pwmdisable $i
if [ $? -ne 0 ]
then
- echo "Failed to set $i to full speed" >&2
- echo "Something's wrong, check your fans!" >&2
- exit 1
+ echo "Manual control mode not supported, skipping $i."
+ elif [ "$GOODPWM" = "" ]
+ then
+ GOODPWM=$i
+ else
+ GOODPWM="$GOODPWM $i"
fi
else
NOTROOT=1
fi
done
+if [ "$GOODPWM" = "" ]
+then
+ echo 'There are no usable PWM outputs.'
+ exit 1
+fi
+
echo
echo "Giving the fans some time to reach full speed..."
sleep $DELAY
@@ -343,7 +384,7 @@
echo
}
-for i in $PWM
+for i in $GOODPWM
do
echo Testing pwm control $i ...
pwmenable $i
@@ -511,6 +552,7 @@
MINSTOP=""
MINPWM=""
MAXPWM=""
+ return 0
fi
done
}
@@ -584,7 +626,11 @@
DEFMINSTART=150
DEFMINSTOP=100
-#the section below has a high potential for usability improvements
+# "select" won't repeat the list of options, so we enclose it in a
+# never-ending loop so that it starts over again with each iteration.
+# I admit it's not exactly nice, but I do not have a better idea to
+# keep usability at an acceptable level.
+while [ 1 ] ; do
echo
echo 'Select fan output to configure, or other action:'
select pwms in $pwmactive "Change INTERVAL" "Just quit" "Save and quit" "Show
configuration"; do
@@ -592,8 +638,9 @@
"Change INTERVAL")
echo
echo "Current interval is $INTERVAL seconds."
- echo -n "Enter the interval at which fancontrol should update
PWM values (in s):"
- read INTERVAL ;; #check user input here
+ echo -n "Enter the interval at which fancontrol should update
PWM values (in s): "
+ read INTERVAL #check user input here
+ break ;;
"Just quit")
exit ;;
"Save and quit")
@@ -613,10 +660,13 @@
echo " MAXTEMP=`echo $MAXTEMP |sed -e \"s/ /\n/g\"
|egrep \"${pwmo}\" |sed -e \"s/.*=//g\"`"
echo " MINSTART=`echo $MINSTART |sed -e \"s/ /\n/g\"
|egrep \"${pwmo}\" |sed -e \"s/.*=//g\"`"
echo " MINSTOP=`echo $MINSTOP |sed -e \"s/ /\n/g\"
|egrep \"${pwmo}\" |sed -e \"s/.*=//g\"`"
- echo " MINPWM=`echo $MINPWM |sed -e \"s/ /\n/g\"
|egrep \"${pwmo}\" |sed -e \"s/.*=//g\"`"
- echo " MAXPWM=`echo $MAXPWM |sed -e \"s/ /\n/g\"
|egrep \"${pwmo}\" |sed -e \"s/.*=//g\"`"
+ XMINP=`echo $MINPWM | sed -e "s/ /\n/g" | egrep
"${pwmo}" | sed -e "s/.*=//g"`
+ [ -n "$XMINP" ] && echo " MINPWM=$XMINP"
+ XMAXP=`echo $MAXPWM | sed -e "s/ /\n/g" | egrep
"${pwmo}" | sed -e "s/.*=//g"`
+ [ -n "$XMAXP" ] && echo " MAXPWM=$XMAXP"
done
- echo ;;
+ echo
+ break ;;
"`echo ${pwmactive} |sed -e 's/ /\n/g' | egrep \"${pwms}\"`" )
pwmsed=`echo ${pwms} | sed -e 's/\//\\\\\//g'` #escape / for sed
@@ -749,11 +799,12 @@
fi
echo
break;
- done ;;
+ done
+ break ;;
*)
- grep $pwm
-
- echo "No such option. Enter a number." ;;
+ echo "No such option. Enter a number."
+ break ;;
esac
done
+done
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/lm_sensors-3.0.0/prog/sensord/rrd.c
new/lm_sensors-3.0.1/prog/sensord/rrd.c
--- old/lm_sensors-3.0.0/prog/sensord/rrd.c 2007-09-23 14:47:27.000000000
+0200
+++ new/lm_sensors-3.0.1/prog/sensord/rrd.c 2007-12-11 23:56:47.000000000
+0100
@@ -40,11 +40,9 @@
#include <sys/stat.h>
#include <sys/types.h>
-#include <getopt.h>
#include <rrd.h>
#include "sensord.h"
-#include "lib/error.h"
#define DO_READ 0
#define DO_SCAN 1
@@ -156,10 +154,10 @@
for (index0 = 0; (ret == 0) && (num < MAX_RRD_SENSORS) &&
features[index0].format; ++ index0) {
const FeatureDescriptor *feature = features + index0;
- const char *rawLabel = features->feature->name;
+ const char *rawLabel = feature->feature->name;
char *label = NULL;
- if (!(label = sensors_get_label (chip, features->feature))) {
+ if (!(label = sensors_get_label (chip, feature->feature))) {
sensorLog (LOG_ERR, "Error getting sensor label: %s/%s",
chip->prefix, rawLabel);
ret = -1;
} else {
@@ -252,10 +250,6 @@
argc += num;
argv[argc ++] = rraBuff;
argv[argc] = NULL;
- optind = 1;
- opterr = 0;
- optopt = '?';
- optarg = NULL;
if ((ret = rrd_create (argc, (char **) /* WEAK */ argv))) {
sensorLog (LOG_ERR, "Error creating RRD file: %s: %s", rrdFile,
rrd_get_error ());
}
@@ -294,12 +288,36 @@
return 0;
}
+/* Compute an arbitrary color based on the sensor label. This is preferred
+ over a random value because this guarantees that daily and weekly charts
+ will use the same colors. */
+static int
+rrdCGI_color
+(const char *label) {
+ unsigned long color = 0, brightness;
+ const char *c;
+
+ for (c = label; *c; c++) {
+ color = (color << 6) + (color >> (*c & 7));
+ color ^= (*c) * 0x401;
+ }
+ color &= 0xffffff;
+ /* Adjust very light colors */
+ brightness = (color & 0xff) + ((color >> 8) & 0xff) + (color >> 16);
+ if (brightness > 672)
+ color &= 0x7f7f7f;
+ /* Adjust very dark colors */
+ else if (brightness < 96)
+ color |= 0x808080;
+ return color;
+}
+
static int
rrdCGI_LINE
(void *_data, const char *rawLabel, const char *label, const FeatureDescriptor
*feature) {
struct gr *data = (struct gr *) _data;
if (!feature || (feature->rrd && (feature->type == data->type)))
- printf ("\n\tLINE2:%s#%.6x:\"%s\"", rawLabel, (int) random () & 0xffffff,
label);
+ printf ("\n\tLINE2:%s#%.6x:\"%s\"", rawLabel, rrdCGI_color(label), label);
return 0;
}
@@ -394,10 +412,6 @@
const char *argv[] = {
"sensord", rrdFile, rrdBuff, NULL
};
- optind = 1;
- opterr = 0;
- optopt = '?';
- optarg = NULL;
if ((ret = rrd_update (3, (char **) /* WEAK */ argv))) {
sensorLog (LOG_ERR, "Error updating RRD file: %s: %s", rrdFile,
rrd_get_error ());
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/lm_sensors-3.0.0/prog/sensors/main.c
new/lm_sensors-3.0.1/prog/sensors/main.c
--- old/lm_sensors-3.0.0/prog/sensors/main.c 2007-10-25 11:49:34.000000000
+0200
+++ new/lm_sensors-3.0.1/prog/sensors/main.c 2008-01-05 10:14:28.000000000
+0100
@@ -105,7 +105,8 @@
err = sensors_init(config_file);
if (err) {
fprintf(stderr, "sensors_init: %s\n", sensors_strerror(err));
- fclose(config_file);
+ if (config_file)
+ fclose(config_file);
return 1;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn
--exclude=.svnignore old/lm_sensors-3.0.0/version.h
new/lm_sensors-3.0.1/version.h
--- old/lm_sensors-3.0.0/version.h 2007-11-24 14:32:18.000000000 +0100
+++ new/lm_sensors-3.0.1/version.h 2008-01-28 18:47:23.000000000 +0100
@@ -1 +1 @@
-#define LM_VERSION "3.0.0"
+#define LM_VERSION "3.0.1"
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-commit+help@xxxxxxxxxxxx
| < Previous | Next > |