fix broken smart battery detection

git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2383 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Mark D. Studebaker committed 2004-03-21 16:40:46 +00:00
1 parent 67a0c882aa
commit 0b1c5d4a03
2 files changed
+13 -7

No files matched your search

+3
View File
@@ -22,6 +22,8 @@ ask CVS about it:
Library: Switch to new sysfs naming standard
Fix gcc 3.3 warnings (Philipp Thomas)
Support 2.6 ds1621
Makefile: Install shared library 755
Man pages i2cdump.8, i2cset.8, isadump.8: New
Modules ds1621, pcf8591: Check for capabilities before using them
(Aurelien Jarno)
Module pcf8574: Cleanups
@@ -34,6 +36,7 @@ ask CVS about it:
Improved SiS chips support
Add a white list of IBM systems
Drop support of undetectable adapters
Fix smart battery detection
Program sensors-detect-stat.pl: New
+10 -7
View File
@@ -777,8 +777,8 @@ use subs qw(mtp008_detect lm78_detect lm78_isa_detect lm78_alias_detect
ipmi_smic_detect via8231_isa_detect lm85_detect smartbatt_detect
adm1026_detect w83l785ts_detect lm83_detect lm90_detect
saa1064_detect w83l784r_detect mozart_detect max6650_detect
fscher_detect adm1029_detect adm1031_detect max6900_detect
m5879_detect pca9540_detect);
fscher_detect adm1029_detect adm1031_detect max6900_detect
m5879_detect pca9540_detect);
# This is a list of all recognized chips.
# Each entry must have the following fields:
@@ -3908,24 +3908,27 @@ sub arp_detect
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.
# $_[0]: A reference to the file descriptor to access this chip.
# We may assume an i2c_set_slave_addr was already done.
# $_[1]: Address
# Returns: 3
# Returns: 5
sub smartbatt_detect
{
my ($file,$addr) = @_;
# check some registers
if (i2c_smbus_read_byte_data($file,0x08) == 0xff) {
if (i2c_smbus_read_word_data($file,0x08) == 0xffff) {
return;
}
if (i2c_smbus_read_byte_data($file,0x09) != 0xff) {
if (i2c_smbus_read_word_data($file,0x09) == 0xffff) {
return;
}
if (i2c_smbus_read_byte_data($file,0x0a) != 0xff) {
if (i2c_smbus_read_word_data($file,0x0a) == 0xffff) {
return;
}
return (3);
return (5);
}
# Returns: 4