mirror of
https://github.com/lm-sensors/lm-sensors
synced 2025-08-29 05:17:50 +00:00
fix broken /proc error message from long ago and add improved one
for when 'sensors -s' is not run as root. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1126 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
parent
cb685da1b3
commit
99698b4bfa
@ -207,12 +207,11 @@ int main (int argc, char *argv[])
|
||||
open_config_file();
|
||||
|
||||
if ((res = sensors_init(config_file))) {
|
||||
if (res == SENSORS_ERR_PROC)
|
||||
fprintf(stderr,"%s\n",sensors_strerror(res));
|
||||
if (res == -SENSORS_ERR_PROC)
|
||||
fprintf(stderr,
|
||||
"/proc/sys/dev/sensors/chips or /proc/bus/i2c unreadable:\n"
|
||||
"Make sure you have inserted modules sensors.o and i2c-proc.o!");
|
||||
else
|
||||
fprintf(stderr,"%s\n",sensors_strerror(res));
|
||||
"/proc/sys/dev/sensors/chips or /proc/bus/i2c unreadable;\n"
|
||||
"Make sure you have done 'modprobe i2c-proc'!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -250,8 +249,16 @@ int do_the_real_work(void)
|
||||
void do_a_set(sensors_chip_name name)
|
||||
{
|
||||
int res;
|
||||
if ((res = sensors_do_chip_sets(name)))
|
||||
fprintf(stderr,"%s: %s\n",sprintf_chip_name(name),sensors_strerror(res));
|
||||
if ((res = sensors_do_chip_sets(name))) {
|
||||
if (res == -SENSORS_ERR_PROC) {
|
||||
fprintf(stderr,"%s: %s for writing;\n",sprintf_chip_name(name),
|
||||
sensors_strerror(res));
|
||||
fprintf(stderr,"Run as root?\n");
|
||||
} else {
|
||||
fprintf(stderr,"%s: %s\n",sprintf_chip_name(name),
|
||||
sensors_strerror(res));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const char *sprintf_chip_name(sensors_chip_name name)
|
||||
@ -320,12 +327,12 @@ void do_a_print(sensors_chip_name name)
|
||||
print_w83781d(&name);
|
||||
else if (!strncmp(name.prefix,"maxilife-", 9))
|
||||
print_maxilife(&name);
|
||||
else if (!strcmp(name.prefix,"it87"))
|
||||
print_it87(&name);
|
||||
else if (!strcmp(name.prefix,"ddcmon"))
|
||||
print_ddcmon(&name);
|
||||
else if (!strcmp(name.prefix,"eeprom"))
|
||||
print_eeprom(&name);
|
||||
else if (!strcmp(name.prefix,"it87"))
|
||||
print_it87(&name);
|
||||
else
|
||||
print_unknown_chip(&name);
|
||||
printf("\n");
|
||||
|
Loading…
x
Reference in New Issue
Block a user