mirror of
https://github.com/lm-sensors/lm-sensors
synced 2025-08-31 22:35:23 +00:00
1st cut at smart battery driver. untested.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1564 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
@@ -687,7 +687,7 @@ use subs qw(mtp008_detect lm78_detect lm78_isa_detect lm78_alias_detect
|
||||
lm87_detect ite_detect ite_isa_detect ite_alias_detect
|
||||
ddcmonitor_detect ds1621_detect adm1024_detect fscpos_detect
|
||||
fscscy_detect pcf8591_detect arp_detect ipmi_kcs_detect
|
||||
ipmi_smic_detect via8231_isa_detect lm85_detect);
|
||||
ipmi_smic_detect via8231_isa_detect lm85_detect smartbatt_detect);
|
||||
|
||||
# This is a list of all recognized chips.
|
||||
# Each entry must have the following fields:
|
||||
@@ -1015,6 +1015,12 @@ use subs qw(mtp008_detect lm78_detect lm78_isa_detect lm78_alias_detect
|
||||
isa_addrs => [ 0x0ca8 ],
|
||||
isa_detect => sub { ipmi_smic_detect @_ },
|
||||
},
|
||||
{
|
||||
name => "SMart Battery",
|
||||
driver => "smartbatt",
|
||||
i2c_addrs => [0x0b],
|
||||
i2c_detect => sub { smartbatt_detect @_},
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -2619,6 +2625,26 @@ sub arp_detect
|
||||
return (1);
|
||||
}
|
||||
|
||||
# $_[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: 1
|
||||
sub smartbatt_detect
|
||||
{
|
||||
my ($file,$addr) = @_;
|
||||
# check some registers
|
||||
if (i2c_smbus_read_byte_data($file,0x08) == 0xff) {
|
||||
return;
|
||||
}
|
||||
if (i2c_smbus_read_byte_data($file,0x09) != 0xff) {
|
||||
return;
|
||||
}
|
||||
if (i2c_smbus_read_byte_data($file,0x0a) != 0xff) {
|
||||
return;
|
||||
}
|
||||
return (3);
|
||||
}
|
||||
|
||||
# Returns: 4
|
||||
# These are simple detectors that only look for a register at the
|
||||
# standard location. No writes are performed.
|
||||
|
Reference in New Issue
Block a user