From 160deeac50a951e5cb169bbbbe6ce181b94baf0d3c75e373b440079020d4c8cd Mon Sep 17 00:00:00 2001 From: OBS User unknown Date: Tue, 13 May 2008 10:23:02 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/sensors?expand=0&rev=36 --- baselibs.conf | 3 +- ...sors-r5235-dont-probe-I2C-addr-40-47.patch | 15 +++++ ...nsors-r5245-skip-1-reg-only-I2C-devs.patch | 59 +++++++++++++++++++ sensors.changes | 13 ++++ sensors.spec | 13 +++- 5 files changed, 101 insertions(+), 2 deletions(-) create mode 100644 lm_sensors-r5235-dont-probe-I2C-addr-40-47.patch create mode 100644 lm_sensors-r5245-skip-1-reg-only-I2C-devs.patch diff --git a/baselibs.conf b/baselibs.conf index a0daeb0..6842a47 100644 --- a/baselibs.conf +++ b/baselibs.conf @@ -1,2 +1,3 @@ libsensors4 - obsoletes "sensors-" + obsoletes "sensors- <= " + provides "sensors- = " diff --git a/lm_sensors-r5235-dont-probe-I2C-addr-40-47.patch b/lm_sensors-r5235-dont-probe-I2C-addr-40-47.patch new file mode 100644 index 0000000..96208cd --- /dev/null +++ b/lm_sensors-r5235-dont-probe-I2C-addr-40-47.patch @@ -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, @_); }, + }, + { diff --git a/lm_sensors-r5245-skip-1-reg-only-I2C-devs.patch b/lm_sensors-r5245-skip-1-reg-only-I2C-devs.patch new file mode 100644 index 0000000..029365c --- /dev/null +++ b/lm_sensors-r5245-skip-1-reg-only-I2C-devs.patch @@ -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) { diff --git a/sensors.changes b/sensors.changes index 517bdec..558a540 100644 --- a/sensors.changes +++ b/sensors.changes @@ -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 diff --git a/sensors.spec b/sensors.spec index 20dae18..76e2094 100644 --- a/sensors.spec +++ b/sensors.spec @@ -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- via baselibs.conf