Changeset 4120

Show
Ignore:
Timestamp:
08/29/06 11:17:56 (7 years ago)
Author:
khali
Message:

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.

Location:
lm-sensors/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/CHANGES

    r4119 r4120  
    7676                           ADT7466, ADT7470, ADT7473 and ADT7475 detection 
    7777                          Check for root user at startup 
     78                          Attempt to be slighly more user-friendly 
    7879 
    7980 
  • lm-sensors/trunk/prog/detect/sensors-detect

    r4119 r4120  
    52605260  initialize_kernel_version; 
    52615261 
    5262   print "# sensors-detect revision $revision\n"; 
    5263   print "\nThis program will help you determine which I2C/SMBus modules you need to\n", 
    5264         "load to use lm_sensors most effectively. You need to have i2c and\n", 
    5265         "lm_sensors installed before running this program.\n"; 
    5266   print "If you have patched your kernel and have some drivers built in, you can\n", 
    5267         "safely answer NO if asked to load some modules. In this case, things may\n", 
    5268         "seem a bit confusing, but they will still work.\n\n"; 
    5269   print "It is generally safe and recommended to accept the default answers to all\n", 
    5270         "questions, unless you know what you're doing.\n\n"; 
    5271  
    5272   print " We can start with probing for (PCI) I2C or SMBus adapters.\n"; 
    5273   print " Do you want to probe now? (YES/no): "; 
     5262  print "# sensors-detect revision $revision\n\n"; 
     5263 
     5264  print "This program will help you determine which kernel modules you need\n", 
     5265        "to load to use lm_sensors most effectively. It is generally safe\n", 
     5266        "and recommended to accept the default answers to all questions,\n", 
     5267        "unless you know what you're doing.\n"; 
     5268  print "You need to have i2c and lm_sensors installed before running this\n", 
     5269        "program.\n" 
     5270    unless kernel_version_at_least(2, 6, 0); 
     5271  print "\n"; 
     5272 
     5273  print "We can start with probing for (PCI) I2C or SMBus adapters.\n"; 
     5274  print "Do you want to probe now? (YES/no): "; 
    52745275  @adapters = adapter_pci_detection  
    52755276                        if ($did_adapter_detection = not <STDIN> =~ /\s*[Nn]/); 
    5276  
    52775277  print "\n"; 
    52785278 
     
    53065306        "scanned by manually loading the modules before running this script.\n\n"; 
    53075307 
    5308   print " To continue, we need module `i2c-dev' to be loaded.\n"; 
    5309   print " If it is built-in into your kernel, you can safely skip this.\n"; 
    5310   if (exists($modules_list{"i2c-dev"})) { 
    5311     print "i2c-dev is already loaded.\n"; 
    5312   } else { 
    5313     print "i2c-dev is not loaded. Do you want to load it now? (YES/no): "; 
     5308  if (!exists($modules_list{"i2c-dev"}) && ! -e "/sys/class/i2c-dev") { 
     5309    print "To continue, we need module `i2c-dev' to be loaded.\n"; 
     5310    print "If it is built-in into your kernel, you can safely skip this.\n" 
     5311      unless kernel_version_at_least(2, 6, 0); 
     5312    print "Do you want to load `i2c-dev' now? (YES/no): "; 
    53145313    if (<STDIN> =~ /^\s*n/i) { 
    53155314      print "Well, you will know best.\n"; 
     
    53195318      print "Module loaded successfully.\n"; 
    53205319    } 
     5320    print "\n"; 
    53215321  } 
    53225322 
     
    53255325  chip_special_cases(); 
    53265326 
    5327   print "\n We are now going to do the adapter probings. Some adapters may ", 
    5328         "hang halfway\n", 
    5329         " through; we can't really help that. Also, some chips will be double ", 
    5330         "detected;\n", 
    5331         " we choose the one with the highest confidence value in that case.\n", 
    5332         " If you found that the adapter hung after probing a certain address, ", 
    5333         "you can\n", 
    5334         " specify that address to remain unprobed. That ", 
    5335         "often\n", 
    5336         " includes address 0x69 (clock chip).\n"; 
     5327  print "We are now going to do the I2C/SMBus adapter probings. Some chips may\n", 
     5328        "be double detected; we choose the one with the highest confidence value\n", 
     5329        "in that case.\n", 
     5330        "If you found that the adapter hung after probing a certain address, you\n", 
     5331        "can specify that address to remain unprobed.\n"; 
    53375332 
    53385333  my ($inp,@not_to_scan,$inp2); 
     
    53625357                 \@not_to_scan   unless $inp =~ /^\s*[Nn]/; 
    53635358  } 
    5364  
    5365   print "\nSome chips are also accessible through the ISA I/O ports. ISA probes are\n". 
    5366         "typically a bit more dangerous, as we have to write to I/O ports to do\n". 
    5367         "this. This is usually safe though.\n". 
    5368         "Yes, you do have ISA I/O ports even if you do not have any ISA slots!\n\n"; 
     5359  print "\n"; 
     5360 
     5361  print "Some chips are also accessible through the ISA I/O ports. We have to\n". 
     5362        "write to arbitrary I/O ports to do this. This is usually safe though.\n". 
     5363        "Yes, you do have ISA I/O ports even if you do not have any ISA slots!\n"; 
    53695364  print "Do you want to scan the ISA I/O ports? (YES/no): "; 
    53705365  unless (<STDIN> =~ /^\s*n/i) { 
     
    53735368    close_ioports(); 
    53745369  } 
    5375  
    5376   print "\nSome Super I/O chips may also contain sensors. Super I/O probes are\n". 
    5377         "typically a bit more dangerous, as we have to write to I/O ports to do\n". 
    5378         "this. This is usually safe though.\n\n"; 
     5370  print "\n"; 
     5371 
     5372  print "Some Super I/O chips may also contain sensors. We have to write to\n". 
     5373        "standard I/O ports to do this. This is usually safe.\n"; 
    53795374  print "Do you want to scan for Super I/O sensors? (YES/no): "; 
    53805375  unless (<STDIN> =~ /^\s*n/i) { 
     
    53875382    close_ioports(); 
    53885383  } 
     5384  print "\n"; 
    53895385 
    53905386  if(! @chips_detected) { 
    5391     print "\n Sorry, no chips were detected.\n", 
    5392         " Either your sensors are not supported, or they are\n", 
    5393         " connected to an I2C bus adapter that we do not support.\n", 
    5394         " See doc/FAQ, doc/lm_sensors-FAQ.html, and\n", 
    5395         " http://www.lm-sensors.org/wiki/FAQ\n", 
    5396         " (FAQ #4.24.3) for further information.\n", 
    5397         " If you find out what chips are on your board, see\n", 
    5398         " http://www.lm-sensors.org/wiki/NewDrivers for driver status.\n"; 
     5387    print "Sorry, no sensors were detected.\n", 
     5388          "Either your sensors are not supported, or they are connected to an\n", 
     5389          "I2C or SMBus adapter that is not supported. See doc/FAQ,\n", 
     5390          "doc/lm_sensors-FAQ.html or http://www.lm-sensors.org/wiki/FAQ\n", 
     5391          "(FAQ #4.24.3) for further information.\n", 
     5392          "If you find out what chips are on your board, see\n", 
     5393          "http://www.lm-sensors.org/wiki/NewDrivers for driver status.\n"; 
    53995394    exit; 
    54005395  } 
    54015396 
    5402   print "\n Now follows a summary of the probes I have just done.\n"; 
    5403   print " Just press ENTER to continue: "; 
     5397  print "Now follows a summary of the probes I have just done.\n". 
     5398        "Just press ENTER to continue: "; 
    54045399  <STDIN>; 
    54055400 
     
    54365431    } 
    54375432  } 
    5438  
    5439   print "\n\n", 
    5440         "I will now generate the commands needed to load the required modules.\n"; 
     5433  print "\n"; 
     5434 
     5435  print "I will now generate the commands needed to load the required modules.\n". 
     5436        "Just press ENTER to continue: "; 
     5437  <STDIN>; 
    54415438      
     5439  print "\n"; 
    54425440  my ($modprobes, $configfile) = generate_modprobes 1;  # 1 == prefer ISA 
    5443   print "\nTo make the sensors modules behave correctly, add these lines to\n", 
     5441  print "To make the sensors modules behave correctly, add these lines to\n". 
    54445442        "$modules_conf:\n\n"; 
    5445   print "#----cut here----\n"; 
    5446   print $configfile; 
    5447   print "#----cut here----\n"; 
    5448   print "\nTo load everything that is needed, add this to some /etc/rc* ", 
    5449         "file:\n\n"; 
    5450   print "#----cut here----\n"; 
    5451   print $modprobes; 
    5452   print "# sleep 2 # optional\n", 
    5453         "/usr/local/bin/sensors -s # recommended\n"; 
    5454   print "#----cut here----\n"; 
    5455   print "\nWARNING! If you have some things built into your kernel, the list above\n", 
    5456         "will contain too many modules. Skip the appropriate ones! You really should\n", 
    5457         "try these commands right now to make sure everything is working properly.\n", 
    5458         "Monitoring programs won't work until it's done.\n"; 
     5443  print "#----cut here----\n". 
     5444        $configfile. 
     5445        "#----cut here----\n\n"; 
     5446 
     5447  print "To load everything that is needed, add this to some /etc/rc* file:\n\n"; 
     5448  print "#----cut here----\n". 
     5449        $modprobes. 
     5450        "# sleep 2 # optional\n". 
     5451        "/usr/local/bin/sensors -s # recommended\n". 
     5452        "#----cut here----\n\n"; 
     5453 
     5454  print "If you have some drivers built into your kernel, the list above will\n". 
     5455        "contain too many modules. Skip the appropriate ones! You really\n". 
     5456        "should try these commands right now to make sure everything is\n". 
     5457        "working properly. Monitoring programs won't work until the needed\n". 
     5458        "modules are loaded.\n\n"; 
    54595459   
    54605460  my $have_sysconfig = -d '/etc/sysconfig'; 
    5461   print "\nDo you want to generate /etc/sysconfig/lm_sensors? (". 
     5461  print "Do you want to generate /etc/sysconfig/lm_sensors? (". 
    54625462    ($have_sysconfig?"YES/no":"yes/NO")."): "; 
    54635463  $_ = <STDIN>;