mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-10-28 12:40:42 +00:00
Support upcoming sysfs path to i2c adapters.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5758 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
9153ce2240
commit
09d912a45f
2 files changed
+23
-9
No files matched your search
@@ -9,6 +9,7 @@ SVN-HEAD
|
||||
Report unsupported Access Bus adapters
|
||||
Add detection for TI's TMP421, TMP422 and TMP423 chips
|
||||
The SMSC LPC47M233 isn't currently supported
|
||||
Support upcoming sysfs path to i2c adapters
|
||||
sysconfig-lm_sensors-convert: Fix exit code
|
||||
|
||||
3.1.1 (2009-06-21)
|
||||
|
||||
@@ -2150,11 +2150,17 @@ sub device_driver_autoloads
|
||||
|
||||
sub initialize_i2c_adapters_list
|
||||
{
|
||||
my $entry;
|
||||
my ($entry, $base_dir, $have_i2c_adapter_class);
|
||||
local $_;
|
||||
|
||||
my $class_dir = "${sysfs_root}/class/i2c-adapter";
|
||||
opendir(local *ADAPTERS, $class_dir) or return;
|
||||
if (-d "${sysfs_root}/class/i2c-adapter") {
|
||||
$base_dir = "${sysfs_root}/class/i2c-adapter";
|
||||
$have_i2c_adapter_class = 1;
|
||||
} else {
|
||||
$base_dir = "${sysfs_root}/bus/i2c/devices";
|
||||
$have_i2c_adapter_class = 0;
|
||||
}
|
||||
opendir(local *ADAPTERS, $base_dir) or return;
|
||||
|
||||
while (defined($_ = readdir(ADAPTERS))) {
|
||||
next unless m/^i2c-(\d+)$/;
|
||||
@@ -2162,13 +2168,20 @@ sub initialize_i2c_adapters_list
|
||||
$entry = {}; # New entry
|
||||
|
||||
# The layout in sysfs has changed over the years
|
||||
my $link = readlink("${class_dir}/i2c-$nr/device");
|
||||
if ($link =~ m/^(.*)\/i2c-$nr$/) {
|
||||
$entry->{path} = "${class_dir}/i2c-$nr/device";
|
||||
$entry->{parent} = "${class_dir}/i2c-$nr/$1";
|
||||
if ($have_i2c_adapter_class) {
|
||||
my $link = readlink("${base_dir}/i2c-$nr/device");
|
||||
if ($link =~ m/^(.*)\/i2c-$nr$/) {
|
||||
$entry->{path} = "${base_dir}/i2c-$nr/device";
|
||||
$entry->{parent} = "${base_dir}/i2c-$nr/$1";
|
||||
} else {
|
||||
$entry->{path} = "${base_dir}/i2c-$nr";
|
||||
$entry->{parent} = "$entry->{path}/device";
|
||||
}
|
||||
} else {
|
||||
$entry->{path} = "${class_dir}/i2c-$nr";
|
||||
$entry->{parent} = "$entry->{path}/device";
|
||||
my $link = readlink("${base_dir}/i2c-$nr");
|
||||
$link =~ s/\/i2c-$nr$//;
|
||||
$entry->{path} = "${base_dir}/i2c-$nr";
|
||||
$entry->{parent} = "${base_dir}/$link";
|
||||
}
|
||||
|
||||
$entry->{name} = sysfs_device_attribute($entry->{path}, "name");
|
||||
|
||||
Reference in new issue
Block a user