From: Jaromir Capik <jcapik@redhat.com>
To: lm-sensors@vger.kernel.org
Subject: [lm-sensors] [PATCH] avoid unwanted sensors-detect termination when the /dev/port is missing
Date: Thu, 17 Jan 2013 15:12:41 +0000 [thread overview]
Message-ID: <1978493810.11074933.1358435561516.JavaMail.root@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 680 bytes --]
Hello guys.
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.
The attached patch solves the issue, so that a warning
is displayed and the detection continues.
The patch can be applied on the current trunk version.
Please, check the patch and merge it if possible.
Thank you.
Regards,
Jaromir.
--
Jaromir Capik
Red Hat Czech, s.r.o.
Software Engineer / BaseOS
Email: jcapik@redhat.com
Web: www.cz.redhat.com
Red Hat Czech s.r.o., Purkynova 99/71, 612 45, Brno, Czech Republic
IC: 27690016
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: sensors-detect-no-dev-port.patch --]
[-- Type: text/x-patch; name=sensors-detect-no-dev-port.patch, Size: 2243 bytes --]
--- sensors-detect.orig 2013-01-17 16:04:10.000000000 +0100
+++ sensors-detect 2013-01-17 16:05:32.209400430 +0100
@@ -2471,9 +2471,12 @@
sub initialize_ioports
{
- sysopen(IOPORTS, "/dev/port", O_RDWR)
- or die "/dev/port: $!\n";
- binmode(IOPORTS);
+ if (sysopen(IOPORTS, "/dev/port", O_RDWR)) {
+ binmode(IOPORTS);
+ return 1;
+ }
+ print "/dev/port: $!\n";
+ return 0;
}
sub close_ioports
@@ -3511,13 +3514,14 @@
print("Can't set I2C address for $dev\n"),
next;
- initialize_ioports();
- $alias_detect = $detected->[$isa]->{alias_detect};
- $is_alias = &$alias_detect($detected->[$isa]->{isa_addr},
- \*FILE,
- $detected->[$i2c]->{i2c_addr});
+ if (initialize_ioports()) {
+ $alias_detect = $detected->[$isa]->{alias_detect};
+ $is_alias = &$alias_detect($detected->[$isa]->{isa_addr},
+ \*FILE,
+ $detected->[$i2c]->{i2c_addr});
+ close_ioports();
+ }
close(FILE);
- close_ioports();
next unless $is_alias;
# This is an alias: copy the I2C data into the ISA
@@ -6819,10 +6823,11 @@
"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();
- $superio_features |= scan_superio(0x2e, 0x2f);
- $superio_features |= scan_superio(0x4e, 0x4f);
- close_ioports();
+ if (initialize_ioports()) {
+ $superio_features |= scan_superio(0x2e, 0x2f);
+ $superio_features |= scan_superio(0x4e, 0x4f);
+ close_ioports();
+ }
}
print "\n";
@@ -6835,9 +6840,10 @@
"interfaces? (YES/no): ";
unless (<STDIN> =~ /^\s*n/i) {
if (!ipmi_from_smbios()) {
- initialize_ioports();
- scan_isa_bus(\@ipmi_ifs);
- close_ioports();
+ if (initialize_ioports()) {
+ scan_isa_bus(\@ipmi_ifs);
+ close_ioports();
+ }
}
}
print "\n";
@@ -6851,9 +6857,10 @@
$input = <STDIN>;
unless ($input =~ /^\s*n/i
|| ($superio_features && $input !~ /^\s*y/i)) {
- initialize_ioports();
- scan_isa_bus(\@chip_ids);
- close_ioports();
+ if (initialize_ioports()) {
+ scan_isa_bus(\@chip_ids);
+ close_ioports();
+ }
}
print "\n";
}
[-- Attachment #3: Type: text/plain, Size: 153 bytes --]
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
next reply other threads:[~2013-01-17 15:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-17 15:12 Jaromir Capik [this message]
2013-01-23 9:35 ` [lm-sensors] [PATCH] avoid unwanted sensors-detect termination when the /dev/port is missing Jean Delvare
2013-01-23 12:17 ` Jaromir Capik
2013-01-23 13:23 ` Jean Delvare
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1978493810.11074933.1358435561516.JavaMail.root@redhat.com \
--to=jcapik@redhat.com \
--cc=lm-sensors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.