OBS User unknown 2008-05-13 10:23:02 +00:00 committed by Git OBS Bridge
parent cb505e29d4
commit 160deeac50
5 changed files with 101 additions and 2 deletions

View File

@ -1,2 +1,3 @@
libsensors4
obsoletes "sensors-<targettype>"
obsoletes "sensors-<targettype> <= <version>"
provides "sensors-<targettype> = <version>"

View File

@ -0,0 +1,15 @@
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

@ -0,0 +1,59 @@
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,16 @@
-------------------------------------------------------------------
Mon May 12 09:59:21 CEST 2008 - jdelvare@suse.de
- lm_sensors-r5235-dont-probe-I2C-addr-40-47.patch: Don't probe I2C
addresses 0x40-0x47.
- lm_sensors-r5245-skip-1-reg-only-I2C-devs.patch: Detect and skip
1-register-only I2C devices.
-------------------------------------------------------------------
Sun May 11 12:21:32 CEST 2008 - coolo@suse.de
- fix rename of xxbit packages
-------------------------------------------------------------------
Tue Apr 29 16:55:11 CEST 2008 - cthiel@suse.de

View File

@ -15,7 +15,7 @@ Name: sensors
BuildRequires: bison flex rrdtool-devel
Url: http://www.lm-sensors.org/
Version: 3.0.1
Release: 27
Release: 33
Summary: Hardware health monitoring for Linux
License: GPL v2 or later
Group: System/Monitoring
@ -28,6 +28,8 @@ 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
@ -131,6 +133,8 @@ Authors:
%patch3
%patch4
%patch5
%patch6
%patch7
%build
RPM_OPT_FLAGS="$RPM_OPT_FLAGS"
@ -206,6 +210,13 @@ rm -f $RPM_BUILD_ROOT/usr/src/linux/include/sensors.h
%doc /usr/share/man/man3/*.3.gz
%changelog
* Mon May 12 2008 jdelvare@suse.de
- lm_sensors-r5235-dont-probe-I2C-addr-40-47.patch: Don't probe I2C
addresses 0x40-0x47.
- lm_sensors-r5245-skip-1-reg-only-I2C-devs.patch: Detect and skip
1-register-only I2C devices.
* Sun May 11 2008 coolo@suse.de
- fix rename of xxbit packages
* Tue Apr 29 2008 cthiel@suse.de
- fix baselibs.conf
- obsolete sensors-<arch> via baselibs.conf