From b68190b426c2582505ea7fcedf525a9ba6a985b3 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 24 Apr 2008 12:08:02 +0000 Subject: [PATCH] Don't print the list of i2c buses as part of the help. git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5200 7894878c-1315-0410-8ee3-d5d059ff63e0 --- tools/i2cbusses.c | 33 +++++++-------------------------- tools/i2cbusses.h | 2 +- tools/i2cdetect.c | 3 +-- tools/i2cdump.c | 1 - tools/i2cget.c | 1 - tools/i2cset.c | 1 - 6 files changed, 9 insertions(+), 32 deletions(-) diff --git a/tools/i2cbusses.c b/tools/i2cbusses.c index 6a40298..d379247 100644 --- a/tools/i2cbusses.c +++ b/tools/i2cbusses.c @@ -295,13 +295,10 @@ done: } /* - this just prints out the installed i2c busses in a consistent format, whether - on a 2.4 kernel using /proc or a 2.6 kernel using /sys. - If procfmt == 1, print out exactly /proc/bus/i2c format on stdout. - This allows this to be used in a program to emulate /proc/bus/i2c on a - sysfs system. -*/ -void print_i2c_busses(int procfmt) + * Print the installed i2c busses. The format is those of Linux 2.4's + * /proc/bus/i2c for historical compatibility reasons. + */ +void print_i2c_busses(void) { struct i2c_adap *adapters; int count; @@ -313,27 +310,11 @@ void print_i2c_busses(int procfmt) } for (count = 0; adapters[count].name; count++) { - if (count == 0 && !procfmt) - fprintf(stderr," Installed I2C busses:\n"); - if (procfmt) - /* match 2.4 /proc/bus/i2c format as closely as possible */ - printf("i2c-%d\t%-10s\t%-32s\t%s\n", - adapters[count].nr, - adapters[count].funcs, - adapters[count].name, - adapters[count].algo); - else - fprintf(stderr, " i2c-%d\t%-10s\t%s\n", - adapters[count].nr, - adapters[count].funcs, - adapters[count].name); + printf("i2c-%d\t%-10s\t%-32s\t%s\n", + adapters[count].nr, adapters[count].funcs, + adapters[count].name, adapters[count].algo); } - if(count == 0 && !procfmt) - fprintf(stderr,"Error: No I2C busses found!\n" - "Be sure you have done 'modprobe i2c-dev'\n" - "and also modprobed your i2c bus drivers\n"); - free_adapters(adapters); } diff --git a/tools/i2cbusses.h b/tools/i2cbusses.h index 625f930..464b1f2 100644 --- a/tools/i2cbusses.h +++ b/tools/i2cbusses.h @@ -22,7 +22,7 @@ #ifndef _I2CBUSSES_H #define _I2CBUSSES_H -void print_i2c_busses(int procfmt); +void print_i2c_busses(void); int lookup_i2c_bus(const char *i2cbus_arg); int open_i2c_dev(const int i2cbus, char *filename, const int quiet); diff --git a/tools/i2cdetect.c b/tools/i2cdetect.c index 0cedc0b..d884c27 100644 --- a/tools/i2cdetect.c +++ b/tools/i2cdetect.c @@ -49,7 +49,6 @@ static void help(void) "RECOMMENDED)\n" " If provided, FIRST and LAST limit the probing range.\n" " With -l, lists installed busses only\n"); - print_i2c_busses(0); } static int scan_i2c_bus(int file, int mode, int first, int last) @@ -226,7 +225,7 @@ int main(int argc, char *argv[]) } if (list) { - print_i2c_busses(1); + print_i2c_busses(); exit(0); } diff --git a/tools/i2cdump.c b/tools/i2cdump.c index 8207c8c..91e271b 100644 --- a/tools/i2cdump.c +++ b/tools/i2cdump.c @@ -48,7 +48,6 @@ static void help(void) " BANK and BANKREG are for byte and word accesses (default " "bank 0, reg 0x4e)\n" " BANK is the command for smbusblock accesses (default 0)\n"); - print_i2c_busses(0); } int main(int argc, char *argv[]) diff --git a/tools/i2cget.c b/tools/i2cget.c index d21796f..a019a5d 100644 --- a/tools/i2cget.c +++ b/tools/i2cget.c @@ -47,7 +47,6 @@ static void help(void) "issued\n" " Append 'p' to MODE for PEC checking\n" " I2CBUS is an integer\n"); - print_i2c_busses(0); exit(1); } diff --git a/tools/i2cset.c b/tools/i2cset.c index 4880fe4..42b5ff8 100644 --- a/tools/i2cset.c +++ b/tools/i2cset.c @@ -40,7 +40,6 @@ static void help(void) " MODE is 'b[yte]' or 'w[ord]' (default b)\n" " Append 'p' to MODE for PEC checking\n" " I2CBUS is an integer\n"); - print_i2c_busses(0); exit(1); }