From 572723411f8463eafe9e6735078b64d99ac0dc74 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 17 Mar 2007 21:07:54 +0000 Subject: [PATCH] sensors-detect: Make the LM78 and W83781D detection safer. If we find that the register at offset 5 doesn't behave as it would for an LM78 or W83781D chip, attempt to restore its 8 original bits rather than just the 7 LSB. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4347 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/detect/sensors-detect | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index 642c9feb..4f54a117 100644 --- a/CHANGES +++ b/CHANGES @@ -43,6 +43,7 @@ SVN HEAD Fix ADM1028 detection Add Nat. Semi. PC8347L Super-I/O detection Add SMSC SCH5504 Super-I/O detection (no sensors) + Make the LM78 and W83781D detection safer 2.10.2 (20070115) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 66a1091e..577ae0e9 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -3286,8 +3286,8 @@ sub lm78_isa_detect return if inb ($addr + 2) != $val or inb ($addr + 3) != $val or inb ($addr + 7) != $val; - $val = inb($addr + 5) & 0x7f; - outb($addr + 5, ~$val & 0xff); + $val = inb($addr + 5); + outb($addr + 5, ~$val & 0x7f); if ((inb ($addr+5) & 0x7f) != (~ $val & 0x7f)) { outb($addr+5,$val); return; @@ -4250,8 +4250,8 @@ sub w83781d_isa_detect return if inb ($addr + 2) != $val or inb ($addr + 3) != $val or inb ($addr + 7) != $val; - $val = inb($addr + 5) & 0x7f; - outb($addr+5, ~$val & 0xff); + $val = inb($addr + 5); + outb($addr+5, ~$val & 0x7f); if ((inb ($addr+5) & 0x7f) != (~ $val & 0x7f)) { outb($addr+5,$val); return;