Changeset 1126

Show
Ignore:
Timestamp:
06/09/01 01:57:26 (14 years ago)
Author:
mds
Message:

fix broken /proc error message from long ago and add improved one

for when 'sensors -s' is not run as root.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/prog/sensors/main.c

    r1112 r1126  
    208208 
    209209  if ((res = sensors_init(config_file))) { 
    210     if (res == SENSORS_ERR_PROC) 
     210    fprintf(stderr,"%s\n",sensors_strerror(res)); 
     211    if (res == -SENSORS_ERR_PROC) 
    211212      fprintf(stderr, 
    212               "/proc/sys/dev/sensors/chips or /proc/bus/i2c unreadable:\n" 
    213               "Make sure you have inserted modules sensors.o and i2c-proc.o!"); 
    214     else 
    215       fprintf(stderr,"%s\n",sensors_strerror(res)); 
     213              "/proc/sys/dev/sensors/chips or /proc/bus/i2c unreadable;\n" 
     214              "Make sure you have done 'modprobe i2c-proc'!\n"); 
    216215    exit(1); 
    217216  } 
     
    251250{ 
    252251  int res; 
    253   if ((res = sensors_do_chip_sets(name)))  
    254     fprintf(stderr,"%s: %s\n",sprintf_chip_name(name),sensors_strerror(res)); 
     252  if ((res = sensors_do_chip_sets(name))) { 
     253    if (res == -SENSORS_ERR_PROC) { 
     254      fprintf(stderr,"%s: %s for writing;\n",sprintf_chip_name(name), 
     255              sensors_strerror(res)); 
     256      fprintf(stderr,"Run as root?\n"); 
     257    } else { 
     258      fprintf(stderr,"%s: %s\n",sprintf_chip_name(name), 
     259              sensors_strerror(res)); 
     260    } 
     261  } 
    255262} 
    256263 
     
    321328  else if (!strncmp(name.prefix,"maxilife-", 9)) 
    322329    print_maxilife(&name); 
     330  else if (!strcmp(name.prefix,"it87")) 
     331    print_it87(&name); 
    323332  else if (!strcmp(name.prefix,"ddcmon")) 
    324333    print_ddcmon(&name); 
    325334  else if (!strcmp(name.prefix,"eeprom")) 
    326335    print_eeprom(&name); 
    327   else if (!strcmp(name.prefix,"it87")) 
    328     print_it87(&name); 
    329336  else 
    330337    print_unknown_chip(&name);