mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-11-01 13:20:30 +00:00
sensors-detect: Use modules.builtin instead of /sys/module
/sys/module doesn't actually contain all built-in modules, only the ones which have a version or at least one parameter. Better use file modules.builtin which is generated since kernel 2.6.33, it is complete and this will let us handle built-in modules properly.
This commit is contained in:
1 parent
b0e1a6333e
commit
256811bc9e
2 files changed
+13
-12
No files matched your search
@@ -4,6 +4,7 @@ lm-sensors CHANGES file
|
||||
SVN HEAD
|
||||
init: Fix EnvironmentFile in service files
|
||||
sensors-detect: Report built-in drivers as such
|
||||
Use modules.builtin instead of /sys/module
|
||||
|
||||
3.3.4 (2013-05-27)
|
||||
sensors.conf.5: Mention "sensors -u" to get the raw feature names
|
||||
|
||||
+12
-12
@@ -2616,11 +2616,12 @@ sub initialize_conf
|
||||
# [2] -> SUBLEVEL
|
||||
# [3] -> EXTRAVERSION
|
||||
#
|
||||
use vars qw(@kernel_version $kernel_arch);
|
||||
use vars qw($kernel_version @kernel_version $kernel_arch);
|
||||
|
||||
sub initialize_kernel_version
|
||||
{
|
||||
`uname -r` =~ /(\d+)\.(\d+)\.(\d+)(.*)/;
|
||||
chomp($kernel_version = `uname -r`);
|
||||
$kernel_version =~ /(\d+)\.(\d+)\.(\d+)(.*)/;
|
||||
@kernel_version = ($1, $2, $3, $4);
|
||||
chomp($kernel_arch = `uname -m`);
|
||||
|
||||
@@ -2792,20 +2793,19 @@ use vars qw(%modules_list %modules_supported @modules_we_loaded);
|
||||
|
||||
sub initialize_modules_list
|
||||
{
|
||||
local $_;
|
||||
local ($_, *INPUTFILE);
|
||||
|
||||
# /sys/module contains built-in drivers too, but doesn't exist on
|
||||
# older kernels (added in kernel 2.6.7)
|
||||
if (opendir(local *MODULES, "$sysfs_root/module")) {
|
||||
while (defined($_ = readdir(MODULES))) {
|
||||
next if m/^\./;
|
||||
$modules_list{$1} = 1 if m/^(\S*)/;
|
||||
# Starting with kernel 2.6.33, a list of built-in modules is available
|
||||
if (open(*INPUTFILE, "/lib/modules/$kernel_version/modules.builtin")) {
|
||||
while (<INPUTFILE>) {
|
||||
tr/-/_/;
|
||||
$modules_list{$1} = 1 if m/\/([^\/]+)\.ko$/;
|
||||
}
|
||||
return;
|
||||
close(INPUTFILE);
|
||||
}
|
||||
|
||||
# Fall back to /proc/modules as it is always available
|
||||
open(local *INPUTFILE, "/proc/modules") or return;
|
||||
# List all loaded modules
|
||||
open(*INPUTFILE, "/proc/modules") or return;
|
||||
while (<INPUTFILE>) {
|
||||
$modules_list{$1} = 1 if m/^(\S*)/;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user