mirror of
https://github.com/lm-sensors/lm-sensors
synced 2025-09-03 07:45:30 +00:00
Add a "quiet" parameter to open_i2c_dev() to prevent it from
displaying error messages. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@3077 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
@@ -223,7 +223,7 @@ int main(int argc, char *argv[])
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
file = open_i2c_dev(i2cbus, filename);
|
file = open_i2c_dev(i2cbus, filename, 0);
|
||||||
if (file < 0) {
|
if (file < 0) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@@ -169,7 +169,7 @@ done:
|
|||||||
"and also modprobed your i2c bus drivers\n");
|
"and also modprobed your i2c bus drivers\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
int open_i2c_dev(const int i2cbus, char *filename)
|
int open_i2c_dev(const int i2cbus, char *filename, const int quiet)
|
||||||
{
|
{
|
||||||
int file;
|
int file;
|
||||||
|
|
||||||
@@ -181,7 +181,7 @@ int open_i2c_dev(const int i2cbus, char *filename)
|
|||||||
file = open(filename, O_RDWR);
|
file = open(filename, O_RDWR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file < 0) {
|
if (file < 0 && !quiet) {
|
||||||
if (errno == ENOENT) {
|
if (errno == ENOENT) {
|
||||||
fprintf(stderr, "Error: Could not open file "
|
fprintf(stderr, "Error: Could not open file "
|
||||||
"`/dev/i2c-%d' or `/dev/i2c/%d': %s\n",
|
"`/dev/i2c-%d' or `/dev/i2c/%d': %s\n",
|
||||||
|
@@ -23,6 +23,6 @@
|
|||||||
|
|
||||||
void print_i2c_busses(int procfmt);
|
void print_i2c_busses(int procfmt);
|
||||||
|
|
||||||
int open_i2c_dev(const int i2cbus, char *filename);
|
int open_i2c_dev(const int i2cbus, char *filename, const int quiet);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -184,7 +184,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
file = open_i2c_dev(i2cbus, filename);
|
file = open_i2c_dev(i2cbus, filename, 0);
|
||||||
if (file < 0) {
|
if (file < 0) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@@ -125,7 +125,7 @@ int main(int argc, char *argv[])
|
|||||||
help();
|
help();
|
||||||
}
|
}
|
||||||
|
|
||||||
file = open_i2c_dev(i2cbus, filename);
|
file = open_i2c_dev(i2cbus, filename, 0);
|
||||||
if (file < 0) {
|
if (file < 0) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user