From f67174055a673b811c96fdb304c4a9f875d61885 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 5 May 2008 14:54:18 +0000 Subject: [PATCH] No need to print the i2c bus number in functionality error message. git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5240 7894878c-1315-0410-8ee3-d5d059ff63e0 --- tools/i2cdump.c | 30 ++++++++++++++---------------- tools/i2cget.c | 24 ++++++++++++------------ tools/i2cset.c | 20 ++++++++++---------- 3 files changed, 36 insertions(+), 38 deletions(-) diff --git a/tools/i2cdump.c b/tools/i2cdump.c index 9a79d14..9138832 100644 --- a/tools/i2cdump.c +++ b/tools/i2cdump.c @@ -46,7 +46,7 @@ static void help(void) " Append p for SMBus PEC\n"); } -static int check_funcs(int file, int i2cbus, int size, int pec) +static int check_funcs(int file, int size, int pec) { unsigned long funcs; @@ -60,42 +60,40 @@ static int check_funcs(int file, int i2cbus, int size, int pec) switch(size) { case I2C_SMBUS_BYTE: if (!((funcs & I2C_FUNC_SMBUS_BYTE) == I2C_FUNC_SMBUS_BYTE)) { - fprintf(stderr, "Error: Adapter for i2c bus %d does " - "not have byte capability\n", i2cbus); + fprintf(stderr, "Error: Adapter does " + "not have byte capability\n"); return -1; } break; case I2C_SMBUS_BYTE_DATA: if (!(funcs & I2C_FUNC_SMBUS_READ_BYTE_DATA)) { - fprintf(stderr, "Error: Adapter for i2c bus %d does " - "not have byte read capability\n", i2cbus); + fprintf(stderr, "Error: Adapter does " + "not have byte read capability\n"); return -1; } break; case I2C_SMBUS_WORD_DATA: if (!(funcs & I2C_FUNC_SMBUS_READ_WORD_DATA)) { - fprintf(stderr, "Error: Adapter for i2c bus %d does " - "not have word read capability\n", i2cbus); + fprintf(stderr, "Error: Adapter does " + "not have word read capability\n"); return -1; } break; case I2C_SMBUS_BLOCK_DATA: if (!(funcs & I2C_FUNC_SMBUS_READ_BLOCK_DATA)) { - fprintf(stderr, "Error: Adapter for i2c bus %d does " - "not have smbus block read capability\n", - i2cbus); + fprintf(stderr, "Error: Adapter does " + "not have smbus block read capability\n"); return -1; } break; case I2C_SMBUS_I2C_BLOCK_DATA: if (!(funcs & I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { - fprintf(stderr, "Error: Adapter for i2c bus %d does " - "not have i2c block read capability\n", - i2cbus); + fprintf(stderr, "Error: Adapter does " + "not have i2c block read capability\n"); return -1; } break; @@ -103,8 +101,8 @@ static int check_funcs(int file, int i2cbus, int size, int pec) if (pec && !(funcs & (I2C_FUNC_SMBUS_PEC | I2C_FUNC_I2C))) { - fprintf(stderr, "Warning: Adapter for i2c bus %d does " - "not seem to support PEC\n", i2cbus); + fprintf(stderr, "Warning: Adapter does " + "not seem to support PEC\n"); } return 0; @@ -264,7 +262,7 @@ int main(int argc, char *argv[]) file = open_i2c_dev(i2cbus, filename, 0); if (file < 0 - || check_funcs(file, i2cbus, size, pec) + || check_funcs(file, size, pec) || set_slave_addr(file, address, force)) exit(1); diff --git a/tools/i2cget.c b/tools/i2cget.c index 1631fa8..3bf3eb7 100644 --- a/tools/i2cget.c +++ b/tools/i2cget.c @@ -49,7 +49,7 @@ static void help(void) exit(1); } -static int check_funcs(int file, int i2cbus, int size, int daddress, int pec) +static int check_funcs(int file, int size, int daddress, int pec) { unsigned long funcs; @@ -63,30 +63,30 @@ static int check_funcs(int file, int i2cbus, int size, int daddress, int pec) switch (size) { case I2C_SMBUS_BYTE: if (!(funcs & I2C_FUNC_SMBUS_READ_BYTE)) { - fprintf(stderr, "Error: Adapter for i2c bus %d does " - "not have read byte capability\n", i2cbus); + fprintf(stderr, "Error: Adapter does " + "not have read byte capability\n"); return -1; } if (daddress >= 0 && !(funcs & I2C_FUNC_SMBUS_WRITE_BYTE)) { - fprintf(stderr, "Error: Adapter for i2c bus %d does " - "not have write byte capability\n", i2cbus); + fprintf(stderr, "Error: Adapter does " + "not have write byte capability\n"); return -1; } break; case I2C_SMBUS_BYTE_DATA: if (!(funcs & I2C_FUNC_SMBUS_READ_BYTE_DATA)) { - fprintf(stderr, "Error: Adapter for i2c bus %d does " - "not have read byte data capability\n", i2cbus); + fprintf(stderr, "Error: Adapter does " + "not have read byte data capability\n"); return -1; } break; case I2C_SMBUS_WORD_DATA: if (!(funcs & I2C_FUNC_SMBUS_READ_WORD_DATA)) { - fprintf(stderr, "Error: Adapter for i2c bus %d does " - "not have read word data capability\n", i2cbus); + fprintf(stderr, "Error: Adapter does " + "not have read word data capability\n"); return -1; } break; @@ -94,8 +94,8 @@ static int check_funcs(int file, int i2cbus, int size, int daddress, int pec) if (pec && !(funcs & (I2C_FUNC_SMBUS_PEC | I2C_FUNC_I2C))) { - fprintf(stderr, "Warning: Adapter for i2c bus %d does " - "not seem to support PEC\n", i2cbus); + fprintf(stderr, "Warning: Adapter does " + "not seem to support PEC\n"); } return 0; @@ -218,7 +218,7 @@ int main(int argc, char *argv[]) file = open_i2c_dev(i2cbus, filename, 0); if (file < 0 - || check_funcs(file, i2cbus, size, daddress, pec) + || check_funcs(file, size, daddress, pec) || set_slave_addr(file, address, force)) exit(1); diff --git a/tools/i2cset.c b/tools/i2cset.c index c7a3923..abba5a4 100644 --- a/tools/i2cset.c +++ b/tools/i2cset.c @@ -45,7 +45,7 @@ static void help(void) exit(1); } -static int check_funcs(int file, int i2cbus, int size, int pec) +static int check_funcs(int file, int size, int pec) { unsigned long funcs; @@ -59,24 +59,24 @@ static int check_funcs(int file, int i2cbus, int size, int pec) switch (size) { case I2C_SMBUS_BYTE: if (!(funcs & I2C_FUNC_SMBUS_WRITE_BYTE)) { - fprintf(stderr, "Error: Adapter for i2c bus %d does " - "not have byte send capability\n", i2cbus); + fprintf(stderr, "Error: Adapter does " + "not have byte send capability\n"); return -1; } break; case I2C_SMBUS_BYTE_DATA: if (!(funcs & I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) { - fprintf(stderr, "Error: Adapter for i2c bus %d does " - "not have byte write capability\n", i2cbus); + fprintf(stderr, "Error: Adapter does " + "not have byte write capability\n"); return -1; } break; case I2C_SMBUS_WORD_DATA: if (!(funcs & I2C_FUNC_SMBUS_WRITE_WORD_DATA)) { - fprintf(stderr, "Error: Adapter for i2c bus %d does " - "not have word write capability\n", i2cbus); + fprintf(stderr, "Error: Adapter does " + "not have word write capability\n"); return -1; } break; @@ -84,8 +84,8 @@ static int check_funcs(int file, int i2cbus, int size, int pec) if (pec && !(funcs & (I2C_FUNC_SMBUS_PEC | I2C_FUNC_I2C))) { - fprintf(stderr, "Warning: Adapter for i2c bus %d does " - "not seem to support PEC\n", i2cbus); + fprintf(stderr, "Warning: Adapter does " + "not seem to support PEC\n"); } return 0; @@ -214,7 +214,7 @@ int main(int argc, char *argv[]) file = open_i2c_dev(i2cbus, filename, 0); if (file < 0 - || check_funcs(file, i2cbus, size, pec) + || check_funcs(file, size, pec) || set_slave_addr(file, address, force)) exit(1);