2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-30 13:57:41 +00:00

Attempt to make sensors-detect slightly more user-friendly, part one.

* Kill the annoying blank space in front of half of the messages.
* Stop frightening the user with problems which might have happened some
  years ago, but are very rare nowadays.
* Skip some messages on 2.6 kernels where they do not apply.
* Don't even mention i2c-dev if it is already loaded or build into the
  kernel.
* Reword some messages.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4120 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare
2006-08-29 09:17:56 +00:00
parent 2e795e09dc
commit fd1ed9de03
2 changed files with 64 additions and 63 deletions

View File

@@ -75,6 +75,7 @@ lm_sensors CHANGES file
Add Analog Devices ADM1033, ADM1034, ADT7462, Add Analog Devices ADM1033, ADM1034, ADT7462,
ADT7466, ADT7470, ADT7473 and ADT7475 detection ADT7466, ADT7470, ADT7473 and ADT7475 detection
Check for root user at startup Check for root user at startup
Attempt to be slighly more user-friendly
2.10.0 (20060214) 2.10.0 (20060214)

View File

@@ -5259,21 +5259,21 @@ sub main
initialize_modules_supported; initialize_modules_supported;
initialize_kernel_version; initialize_kernel_version;
print "# sensors-detect revision $revision\n"; print "# sensors-detect revision $revision\n\n";
print "\nThis program will help you determine which I2C/SMBus modules you need to\n",
"load to use lm_sensors most effectively. You need to have i2c and\n",
"lm_sensors installed before running this program.\n";
print "If you have patched your kernel and have some drivers built in, you can\n",
"safely answer NO if asked to load some modules. In this case, things may\n",
"seem a bit confusing, but they will still work.\n\n";
print "It is generally safe and recommended to accept the default answers to all\n",
"questions, unless you know what you're doing.\n\n";
print " We can start with probing for (PCI) I2C or SMBus adapters.\n"; print "This program will help you determine which kernel modules you need\n",
print " Do you want to probe now? (YES/no): "; "to load to use lm_sensors most effectively. It is generally safe\n",
"and recommended to accept the default answers to all questions,\n",
"unless you know what you're doing.\n";
print "You need to have i2c and lm_sensors installed before running this\n",
"program.\n"
unless kernel_version_at_least(2, 6, 0);
print "\n";
print "We can start with probing for (PCI) I2C or SMBus adapters.\n";
print "Do you want to probe now? (YES/no): ";
@adapters = adapter_pci_detection @adapters = adapter_pci_detection
if ($did_adapter_detection = not <STDIN> =~ /\s*[Nn]/); if ($did_adapter_detection = not <STDIN> =~ /\s*[Nn]/);
print "\n"; print "\n";
if (not $did_adapter_detection) { if (not $did_adapter_detection) {
@@ -5305,12 +5305,11 @@ sub main
print "If you have undetectable or unsupported adapters, you can have them\n". print "If you have undetectable or unsupported adapters, you can have them\n".
"scanned by manually loading the modules before running this script.\n\n"; "scanned by manually loading the modules before running this script.\n\n";
print " To continue, we need module `i2c-dev' to be loaded.\n"; if (!exists($modules_list{"i2c-dev"}) && ! -e "/sys/class/i2c-dev") {
print " If it is built-in into your kernel, you can safely skip this.\n"; print "To continue, we need module `i2c-dev' to be loaded.\n";
if (exists($modules_list{"i2c-dev"})) { print "If it is built-in into your kernel, you can safely skip this.\n"
print "i2c-dev is already loaded.\n"; unless kernel_version_at_least(2, 6, 0);
} else { print "Do you want to load `i2c-dev' now? (YES/no): ";
print "i2c-dev is not loaded. Do you want to load it now? (YES/no): ";
if (<STDIN> =~ /^\s*n/i) { if (<STDIN> =~ /^\s*n/i) {
print "Well, you will know best.\n"; print "Well, you will know best.\n";
} elsif (system "modprobe", "i2c-dev") { } elsif (system "modprobe", "i2c-dev") {
@@ -5318,22 +5317,18 @@ sub main
} else { } else {
print "Module loaded successfully.\n"; print "Module loaded successfully.\n";
} }
print "\n";
} }
# Before looking for chips, make sure any special case chips are # Before looking for chips, make sure any special case chips are
# added to the chip_ids list # added to the chip_ids list
chip_special_cases(); chip_special_cases();
print "\n We are now going to do the adapter probings. Some adapters may ", print "We are now going to do the I2C/SMBus adapter probings. Some chips may\n",
"hang halfway\n", "be double detected; we choose the one with the highest confidence value\n",
" through; we can't really help that. Also, some chips will be double ", "in that case.\n",
"detected;\n", "If you found that the adapter hung after probing a certain address, you\n",
" we choose the one with the highest confidence value in that case.\n", "can specify that address to remain unprobed.\n";
" If you found that the adapter hung after probing a certain address, ",
"you can\n",
" specify that address to remain unprobed. That ",
"often\n",
" includes address 0x69 (clock chip).\n";
my ($inp,@not_to_scan,$inp2); my ($inp,@not_to_scan,$inp2);
# i2cdetect -l either cats /proc/bus/i2c or scans sysfs for the same information # i2cdetect -l either cats /proc/bus/i2c or scans sysfs for the same information
@@ -5361,21 +5356,21 @@ sub main
scan_adapter $dev_nr, $adap, find_adapter_driver($adap), scan_adapter $dev_nr, $adap, find_adapter_driver($adap),
\@not_to_scan unless $inp =~ /^\s*[Nn]/; \@not_to_scan unless $inp =~ /^\s*[Nn]/;
} }
print "\n";
print "\nSome chips are also accessible through the ISA I/O ports. ISA probes are\n". print "Some chips are also accessible through the ISA I/O ports. We have to\n".
"typically a bit more dangerous, as we have to write to I/O ports to do\n". "write to arbitrary I/O ports to do this. This is usually safe though.\n".
"this. This is usually safe though.\n". "Yes, you do have ISA I/O ports even if you do not have any ISA slots!\n";
"Yes, you do have ISA I/O ports even if you do not have any ISA slots!\n\n";
print "Do you want to scan the ISA I/O ports? (YES/no): "; print "Do you want to scan the ISA I/O ports? (YES/no): ";
unless (<STDIN> =~ /^\s*n/i) { unless (<STDIN> =~ /^\s*n/i) {
initialize_ioports(); initialize_ioports();
scan_isa_bus(); scan_isa_bus();
close_ioports(); close_ioports();
} }
print "\n";
print "\nSome Super I/O chips may also contain sensors. Super I/O probes are\n". print "Some Super I/O chips may also contain sensors. We have to write to\n".
"typically a bit more dangerous, as we have to write to I/O ports to do\n". "standard I/O ports to do this. This is usually safe.\n";
"this. This is usually safe though.\n\n";
print "Do you want to scan for Super I/O sensors? (YES/no): "; print "Do you want to scan for Super I/O sensors? (YES/no): ";
unless (<STDIN> =~ /^\s*n/i) { unless (<STDIN> =~ /^\s*n/i) {
initialize_ioports(); initialize_ioports();
@@ -5386,21 +5381,21 @@ sub main
} }
close_ioports(); close_ioports();
} }
print "\n";
if(! @chips_detected) { if(! @chips_detected) {
print "\n Sorry, no chips were detected.\n", print "Sorry, no sensors were detected.\n",
" Either your sensors are not supported, or they are\n", "Either your sensors are not supported, or they are connected to an\n",
" connected to an I2C bus adapter that we do not support.\n", "I2C or SMBus adapter that is not supported. See doc/FAQ,\n",
" See doc/FAQ, doc/lm_sensors-FAQ.html, and\n", "doc/lm_sensors-FAQ.html or http://www.lm-sensors.org/wiki/FAQ\n",
" http://www.lm-sensors.org/wiki/FAQ\n", "(FAQ #4.24.3) for further information.\n",
" (FAQ #4.24.3) for further information.\n", "If you find out what chips are on your board, see\n",
" If you find out what chips are on your board, see\n", "http://www.lm-sensors.org/wiki/NewDrivers for driver status.\n";
" http://www.lm-sensors.org/wiki/NewDrivers for driver status.\n";
exit; exit;
} }
print "\n Now follows a summary of the probes I have just done.\n"; print "Now follows a summary of the probes I have just done.\n".
print " Just press ENTER to continue: "; "Just press ENTER to continue: ";
<STDIN>; <STDIN>;
my ($chip,$data); my ($chip,$data);
@@ -5435,30 +5430,35 @@ sub main
" laptops, for example.\n"; " laptops, for example.\n";
} }
} }
print "\n";
print "\n\n", print "I will now generate the commands needed to load the required modules.\n".
"I will now generate the commands needed to load the required modules.\n"; "Just press ENTER to continue: ";
<STDIN>;
print "\n";
my ($modprobes, $configfile) = generate_modprobes 1; # 1 == prefer ISA my ($modprobes, $configfile) = generate_modprobes 1; # 1 == prefer ISA
print "\nTo make the sensors modules behave correctly, add these lines to\n", print "To make the sensors modules behave correctly, add these lines to\n".
"$modules_conf:\n\n"; "$modules_conf:\n\n";
print "#----cut here----\n"; print "#----cut here----\n".
print $configfile; $configfile.
print "#----cut here----\n"; "#----cut here----\n\n";
print "\nTo load everything that is needed, add this to some /etc/rc* ",
"file:\n\n"; print "To load everything that is needed, add this to some /etc/rc* file:\n\n";
print "#----cut here----\n"; print "#----cut here----\n".
print $modprobes; $modprobes.
print "# sleep 2 # optional\n", "# sleep 2 # optional\n".
"/usr/local/bin/sensors -s # recommended\n"; "/usr/local/bin/sensors -s # recommended\n".
print "#----cut here----\n"; "#----cut here----\n\n";
print "\nWARNING! If you have some things built into your kernel, the list above\n",
"will contain too many modules. Skip the appropriate ones! You really should\n", print "If you have some drivers built into your kernel, the list above will\n".
"try these commands right now to make sure everything is working properly.\n", "contain too many modules. Skip the appropriate ones! You really\n".
"Monitoring programs won't work until it's done.\n"; "should try these commands right now to make sure everything is\n".
"working properly. Monitoring programs won't work until the needed\n".
"modules are loaded.\n\n";
my $have_sysconfig = -d '/etc/sysconfig'; my $have_sysconfig = -d '/etc/sysconfig';
print "\nDo you want to generate /etc/sysconfig/lm_sensors? (". print "Do you want to generate /etc/sysconfig/lm_sensors? (".
($have_sysconfig?"YES/no":"yes/NO")."): "; ($have_sysconfig?"YES/no":"yes/NO")."): ";
$_ = <STDIN>; $_ = <STDIN>;
if (($have_sysconfig and not m/^\s*n/i) or m/^\s*y/i) { if (($have_sysconfig and not m/^\s*n/i) or m/^\s*y/i) {