2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-29 13:28:01 +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:
Mark D. Studebaker 2001-06-08 23:57:26 +00:00
parent cb685da1b3
commit 99698b4bfa

View File

@ -207,12 +207,11 @@ int main (int argc, char *argv[])
open_config_file(); open_config_file();
if ((res = sensors_init(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, fprintf(stderr,
"/proc/sys/dev/sensors/chips or /proc/bus/i2c unreadable:\n" "/proc/sys/dev/sensors/chips or /proc/bus/i2c unreadable;\n"
"Make sure you have inserted modules sensors.o and i2c-proc.o!"); "Make sure you have done 'modprobe i2c-proc'!\n");
else
fprintf(stderr,"%s\n",sensors_strerror(res));
exit(1); exit(1);
} }
@ -250,8 +249,16 @@ int do_the_real_work(void)
void do_a_set(sensors_chip_name name) void do_a_set(sensors_chip_name name)
{ {
int res; int res;
if ((res = sensors_do_chip_sets(name))) if ((res = sensors_do_chip_sets(name))) {
fprintf(stderr,"%s: %s\n",sprintf_chip_name(name),sensors_strerror(res)); 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) const char *sprintf_chip_name(sensors_chip_name name)
@ -320,12 +327,12 @@ void do_a_print(sensors_chip_name name)
print_w83781d(&name); print_w83781d(&name);
else if (!strncmp(name.prefix,"maxilife-", 9)) else if (!strncmp(name.prefix,"maxilife-", 9))
print_maxilife(&name); print_maxilife(&name);
else if (!strcmp(name.prefix,"it87"))
print_it87(&name);
else if (!strcmp(name.prefix,"ddcmon")) else if (!strcmp(name.prefix,"ddcmon"))
print_ddcmon(&name); print_ddcmon(&name);
else if (!strcmp(name.prefix,"eeprom")) else if (!strcmp(name.prefix,"eeprom"))
print_eeprom(&name); print_eeprom(&name);
else if (!strcmp(name.prefix,"it87"))
print_it87(&name);
else else
print_unknown_chip(&name); print_unknown_chip(&name);
printf("\n"); printf("\n");