OBS User unknown 2008-05-21 23:51:08 +00:00 committed by Git OBS Bridge
parent 160deeac50
commit 6f95e691ac
11 changed files with 39 additions and 205 deletions

View File

@ -2,7 +2,7 @@ Index: prog/detect/sensors-detect
===================================================================
--- prog/detect/sensors-detect.orig
+++ prog/detect/sensors-detect
@@ -5892,6 +5892,12 @@ sub main
@@ -5906,6 +5906,12 @@ sub main
open(local *SYSCONFIG, ">/etc/sysconfig/lm_sensors")
or die "Sorry, can't create /etc/sysconfig/lm_sensors ($!)";
print SYSCONFIG <<'EOT';

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f47f7e46f604054ec32b899a04d3d450a37de533e962c763c5d7068b31b9bc23
size 186183

View File

@ -1,6 +1,8 @@
--- Makefile
+++ Makefile 2008-03-13 00:00:00.000000000 +0100
@@ -136,7 +136,7 @@ ifeq ($(DEBUG),1)
Index: Makefile
===================================================================
--- Makefile.orig
+++ Makefile
@@ -137,7 +137,7 @@ ifeq ($(DEBUG),1)
ALL_CPPFLAGS += -DDEBUG
ALL_CFLAGS += -O -g
else
@ -9,8 +11,10 @@
endif
ifeq ($(WARN),1)
--- prog/init/README
+++ prog/init/README 2008-03-13 00:00:00.000000000 +0100
Index: prog/init/README
===================================================================
--- prog/init/README.orig
+++ prog/init/README
@@ -10,7 +10,7 @@ The script lm_sensors.init is a nice sta
On RH and other RH-based systems (MDK, notably) use this sort of startup
mechanism (i.e. SVR4-based), as opposed to the everything-in-one-script
@ -33,8 +37,10 @@
For more information see the top of the file.
To configure this service one should put appropriate "alias i2c-bus-0 xxx"
--- prog/init/lm_sensors.init.suse
+++ prog/init/lm_sensors.init.suse 2008-03-13 18:49:33.350172134 +0100
Index: prog/init/lm_sensors.init.suse
===================================================================
--- prog/init/lm_sensors.init.suse.orig
+++ prog/init/lm_sensors.init.suse
@@ -1,19 +1,15 @@
#!/bin/sh
#
@ -63,7 +69,7 @@
#
# 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
@@ -39,116 +35,82 @@
@@ -40,116 +36,82 @@
# in order as normal shell variables with the special names:
# MODULE_1, MODULE_2, MODULE_3, etc.
@ -221,7 +227,7 @@
# See how we were called.
case "$1" in
start)
@@ -163,12 +125,12 @@ case "$1" in
@@ -164,12 +126,12 @@ case "$1" in
restart|reload)
restart
;;

3
lm_sensors-3.0.2.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1461fc2e8661ded28b73ed2f7a06cbecf852aa641df974e38aaa0e23977c5b57
size 149734

View File

@ -1,13 +0,0 @@
Index: lib/sysfs.c
===================================================================
--- lib/sysfs.c.orig
+++ lib/sysfs.c
@@ -593,7 +593,7 @@ static int sensors_add_hwmon_device(cons
snprintf(linkpath, NAME_MAX, "%s/device", path);
dev_len = readlink(linkpath, device, NAME_MAX - 1);
if (dev_len < 0)
- return -SENSORS_ERR_KERNEL;
+ return 0;
device[dev_len] = '\0';
device_p = strrchr(device, '/') + 1;

View File

@ -1,65 +0,0 @@
Index: lib/init.c
===================================================================
--- lib/init.c.orig
+++ lib/init.c
@@ -18,8 +18,10 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <locale.h>
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
#include <errno.h>
#include "sensors.h"
#include "data.h"
@@ -33,6 +35,31 @@
#define DEFAULT_CONFIG_FILE ETCDIR "/sensors3.conf"
#define ALT_CONFIG_FILE ETCDIR "/sensors.conf"
+/* Wrapper around sensors_yyparse(), which clears the locale so that
+ the decimal numbers are always parsed properly. */
+static int sensors_parse(void)
+{
+ int res;
+ char *locale;
+
+ /* Remember the current locale and clear it */
+ locale = setlocale(LC_ALL, NULL);
+ if (locale) {
+ locale = strdup(locale);
+ setlocale(LC_ALL, "C");
+ }
+
+ res = sensors_yyparse();
+
+ /* Restore the old locale */
+ if (locale) {
+ setlocale(LC_ALL, locale);
+ free(locale);
+ }
+
+ return res;
+}
+
int sensors_init(FILE *input)
{
int res;
@@ -46,7 +73,7 @@ int sensors_init(FILE *input)
res = -SENSORS_ERR_PARSE;
if (input) {
if (sensors_scanner_init(input) ||
- sensors_yyparse())
+ sensors_parse())
goto exit_cleanup;
} else {
/* No configuration provided, use default */
@@ -55,7 +82,7 @@ int sensors_init(FILE *input)
input = fopen(ALT_CONFIG_FILE, "r");
if (input) {
if (sensors_scanner_init(input) ||
- sensors_yyparse()) {
+ sensors_parse()) {
fclose(input);
goto exit_cleanup;
}

View File

@ -1,24 +0,0 @@
Index: lib/access.c
===================================================================
--- lib/access.c.orig
+++ lib/access.c
@@ -248,7 +248,8 @@ int sensors_get_value(const sensors_chip
subfeature->mapping);
chip = NULL;
- while ((chip = sensors_for_all_config_chips(name, chip)))
+ while (!expr &&
+ (chip = sensors_for_all_config_chips(name, chip)))
for (i = 0; i < chip->computes_count; i++) {
if (!strcmp(feature->name,
chip->computes[i].name)) {
@@ -299,7 +300,8 @@ int sensors_set_value(const sensors_chip
subfeature->mapping);
chip = NULL;
- while ((chip = sensors_for_all_config_chips(name, chip)))
+ while (!expr &&
+ (chip = sensors_for_all_config_chips(name, chip)))
for (i = 0; i < chip->computes_count; i++) {
if (!strcmp(feature->name,
chip->computes[i].name)) {

View File

@ -1,15 +0,0 @@
Index: prog/detect/sensors-detect
===================================================================
--- prog/detect/sensors-detect.orig
+++ prog/detect/sensors-detect
@@ -1269,7 +1269,9 @@ use vars qw(@pci_adapters_sis5595 @pci_a
{
name => "Maxim MAX6633/MAX6634/MAX6635",
driver => "lm92",
- i2c_addrs => [0x40..0x4f],
+ i2c_addrs => [0x48..0x4f], # The MAX6633 can also use 0x40-0x47 but we
+ # don't want to probe these addresses, it's
+ # dangerous.
i2c_detect => sub { lm92_detect(2, @_); },
},
{

View File

@ -1,59 +0,0 @@
Index: prog/detect/sensors-detect
===================================================================
--- prog/detect/sensors-detect.orig
+++ prog/detect/sensors-detect
@@ -2848,6 +2848,43 @@ sub i2c_probe($$$)
}
}
+# $_[0]: Reference to an opened file handle
+# Returns: 1 if the device is safe to access, 0 else.
+# This function is meant to prevent access to 1-register-only devices,
+# which are designed to be accessed with SMBus receive byte and SMBus send
+# byte transactions (i.e. short reads and short writes) and treat SMBus
+# read byte as a real write followed by a read. The device detection
+# routines would write random values to the chip with possibly very nasty
+# results for the hardware. Note that this function won't catch all such
+# chips, as it assumes that reads and writes relate to the same register,
+# but that's the best we can do.
+sub i2c_safety_check
+{
+ my ($file) = @_;
+ my $data;
+
+ # First we receive a byte from the chip, and remember it.
+ $data = i2c_smbus_read_byte($file);
+ return 1 if ($data < 0);
+
+ # We receive a byte again; very likely to be the same for
+ # 1-register-only devices.
+ return 1 if (i2c_smbus_read_byte($file) != $data);
+
+ # Then we try a standard byte read, with a register offset equal to
+ # the byte we received; we should receive the same byte value in return.
+ return 1 if (i2c_smbus_read_byte_data($file, $data) != $data);
+
+ # Then we try a standard byte read, with a slightly different register
+ # offset; we should again receive the same byte value in return.
+ return 1 if (i2c_smbus_read_byte_data($file, $data ^ 1) != ($data ^ 1));
+
+ # Apprently this is a 1-register-only device, restore the original register
+ # value and leave it alone.
+ i2c_smbus_read_byte_data($file, $data);
+ return 0;
+}
+
####################
# ADAPTER SCANNING #
####################
@@ -3192,6 +3229,10 @@ sub scan_adapter
next unless i2c_probe(\*FILE, $addr, $funcs);
printf "Client found at address 0x%02x\n",$addr;
+ if (!i2c_safety_check(\*FILE)) {
+ print "Seems to be a 1-register-only device, skipping.\n";
+ next;
+ }
$| = 1;
foreach $chip (@chip_ids) {

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Sun May 18 19:33:45 CEST 2008 - jdelvare@suse.de
- Update to lm_sensors 3.0.2
* Support for virtual hardware monitoring devices
* Support for power and energy sensors
* Safer sensors-detect
* FAQ is gone
-------------------------------------------------------------------
Mon May 12 09:59:21 CEST 2008 - jdelvare@suse.de

View File

@ -1,5 +1,5 @@
#
# spec file for package sensors (Version 3.0.1)
# spec file for package sensors (Version 3.0.2)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@ -14,22 +14,17 @@
Name: sensors
BuildRequires: bison flex rrdtool-devel
Url: http://www.lm-sensors.org/
Version: 3.0.1
Release: 33
Version: 3.0.2
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.1.tar.bz2
Patch: lm_sensors-3.0.1.dif
Source0: lm_sensors-%{version}.tar.bz2
Patch: lm_sensors-%{version}.dif
Patch1: lm_sensors-3.0.0-sensord-separate.dif
Patch2: lm_sensors-3.0.0-sysconfig_metadata.patch
Patch3: lm_sensors-r5169-parse-config-in-C-locale.patch
Patch4: lm_sensors-r5175-compute-statements-override.patch
Patch5: lm_sensors-ignore-missing-device-link.patch
Patch6: lm_sensors-r5235-dont-probe-I2C-addr-40-47.patch
Patch7: lm_sensors-r5245-skip-1-reg-only-I2C-devs.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
ExcludeArch: s390 s390x
@ -130,11 +125,6 @@ Authors:
%patch
%patch1
%patch2
%patch3
%patch4
%patch5
%patch6
%patch7
%build
RPM_OPT_FLAGS="$RPM_OPT_FLAGS"
@ -144,7 +134,6 @@ RPM_OPT_FLAGS="$RPM_OPT_FLAGS"
make PROG_EXTRA:=sensord PREFIX=%{_prefix} MANDIR=%{_mandir} LIBDIR=%{_libdir} DESTDIR=$RPM_BUILD_ROOT install
cd doc/
mkdir -p $RPM_BUILD_ROOT/%{_docdir}/sensors
cp -a FAQ $RPM_BUILD_ROOT/%{_docdir}/sensors/
cp -a donations $RPM_BUILD_ROOT/%{_docdir}/sensors/
cp -a fan-divisors $RPM_BUILD_ROOT/%{_docdir}/sensors/
cp -a fancontrol.txt $RPM_BUILD_ROOT/%{_docdir}/sensors/
@ -210,6 +199,12 @@ rm -f $RPM_BUILD_ROOT/usr/src/linux/include/sensors.h
%doc /usr/share/man/man3/*.3.gz
%changelog
* Sun May 18 2008 jdelvare@suse.de
- Update to lm_sensors 3.0.2
* Support for virtual hardware monitoring devices
* Support for power and energy sensors
* Safer sensors-detect
* FAQ is gone
* Mon May 12 2008 jdelvare@suse.de
- lm_sensors-r5235-dont-probe-I2C-addr-40-47.patch: Don't probe I2C
addresses 0x40-0x47.