2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-31 14:25:39 +00:00

Avoid unwanted sensors-detect termination when /dev/port is missing

Patch from Jaromir Capik.

The device file /dev/port might be missing in some cases
and the sensors detection is terminated when the user
tries to detect sensors dependent on it's existence.
That's not correct -> it's not a reason for terminating
the detection.
This commit is contained in:
Jean Delvare
2013-01-23 09:33:59 +00:00
parent 6734fae250
commit 1b77fd669b
2 changed files with 27 additions and 19 deletions

View File

@@ -8,6 +8,7 @@ SVN HEAD
Map IT8771E, IT8772E, IT8782F and IT8783F to it87
Use /sys/module instead of /proc/modules where available
Drop legacy sysconfig configuration file syntax
Stay alive when /dev/port is missing
3.3.3 "Happy Birthday Sophie" (2012-11-06)
documentation: Update fan-divisors, fan divisors are optional

View File

@@ -2471,9 +2471,12 @@ sub overlay_hash
sub initialize_ioports
{
sysopen(IOPORTS, "/dev/port", O_RDWR)
or die "/dev/port: $!\n";
if (sysopen(IOPORTS, "/dev/port", O_RDWR)) {
binmode(IOPORTS);
return 1;
}
print STDERR "/dev/port: $!\n";
return 0;
}
sub close_ioports
@@ -3511,13 +3514,14 @@ sub find_aliases
print("Can't set I2C address for $dev\n"),
next;
initialize_ioports();
if (initialize_ioports()) {
$alias_detect = $detected->[$isa]->{alias_detect};
$is_alias = &$alias_detect($detected->[$isa]->{isa_addr},
\*FILE,
$detected->[$i2c]->{i2c_addr});
close(FILE);
close_ioports();
}
close(FILE);
next unless $is_alias;
# This is an alias: copy the I2C data into the ISA
@@ -6819,11 +6823,12 @@ sub main
"standard I/O ports to probe them. This is usually safe.\n";
print "Do you want to scan for Super I/O sensors? (YES/no): ";
unless (<STDIN> =~ /^\s*n/i) {
initialize_ioports();
if (initialize_ioports()) {
$superio_features |= scan_superio(0x2e, 0x2f);
$superio_features |= scan_superio(0x4e, 0x4f);
close_ioports();
}
}
print "\n";
unless (is_laptop()) {
@@ -6835,11 +6840,12 @@ sub main
"interfaces? (YES/no): ";
unless (<STDIN> =~ /^\s*n/i) {
if (!ipmi_from_smbios()) {
initialize_ioports();
if (initialize_ioports()) {
scan_isa_bus(\@ipmi_ifs);
close_ioports();
}
}
}
print "\n";
}
@@ -6851,10 +6857,11 @@ sub main
$input = <STDIN>;
unless ($input =~ /^\s*n/i
|| ($superio_features && $input !~ /^\s*y/i)) {
initialize_ioports();
if (initialize_ioports()) {
scan_isa_bus(\@chip_ids);
close_ioports();
}
}
print "\n";
}