2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-31 06:15:15 +00:00

sensors-detect: Fix parent class discovery when multiplexer is present

Take multiplexers into account when looking up the parent device of
each I2C adapter. We don't bother with old kernels as they didn't have
support for multiplexers anyway.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@6085 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare
2012-10-30 17:18:45 +00:00
parent e817653329
commit d1d5799d51
2 changed files with 10 additions and 8 deletions

View File

@@ -2,7 +2,7 @@
#
# sensors-detect - Detect hardware monitoring chips
# Copyright (C) 1998 - 2002 Frodo Looijaard <frodol@dds.nl>
# Copyright (C) 2004 - 2011 Jean Delvare <khali@linux-fr.org>
# Copyright (C) 2004 - 2012 Jean Delvare <khali@linux-fr.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -2696,14 +2696,15 @@ sub initialize_i2c_adapters_list
} elsif ($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 {
}
# This works for all recent kernels (with or without
# CONFIG_I2C_COMPAT)
if (!defined $entry->{path}) {
my $link = readlink("${base_dir}/i2c-$nr");
$link =~ s/\/i2c-$nr$//;
$entry->{path} = "${base_dir}/i2c-$nr";
$link =~ s/(\/i2c-[0-9]+)+$//; # Handle multiplexers too
$entry->{parent} = "${base_dir}/$link";
}