Changeset 5240
- Timestamp:
- 05/05/08 16:54:18 (4 months ago)
- Files:
-
- i2c-tools/trunk/tools/i2cdump.c (modified) (8 diffs)
- i2c-tools/trunk/tools/i2cget.c (modified) (6 diffs)
- i2c-tools/trunk/tools/i2cset.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
i2c-tools/trunk/tools/i2cdump.c
r5239 r5240 47 47 } 48 48 49 static int check_funcs(int file, int i2cbus, intsize, int pec)49 static int check_funcs(int file, int size, int pec) 50 50 { 51 51 unsigned long funcs; … … 61 61 case I2C_SMBUS_BYTE: 62 62 if (!((funcs & I2C_FUNC_SMBUS_BYTE) == I2C_FUNC_SMBUS_BYTE)) { 63 fprintf(stderr, "Error: Adapter for i2c bus %ddoes "64 "not have byte capability\n" , i2cbus);63 fprintf(stderr, "Error: Adapter does " 64 "not have byte capability\n"); 65 65 return -1; 66 66 } … … 69 69 case I2C_SMBUS_BYTE_DATA: 70 70 if (!(funcs & I2C_FUNC_SMBUS_READ_BYTE_DATA)) { 71 fprintf(stderr, "Error: Adapter for i2c bus %ddoes "72 "not have byte read capability\n" , i2cbus);71 fprintf(stderr, "Error: Adapter does " 72 "not have byte read capability\n"); 73 73 return -1; 74 74 } … … 77 77 case I2C_SMBUS_WORD_DATA: 78 78 if (!(funcs & I2C_FUNC_SMBUS_READ_WORD_DATA)) { 79 fprintf(stderr, "Error: Adapter for i2c bus %ddoes "80 "not have word read capability\n" , i2cbus);79 fprintf(stderr, "Error: Adapter does " 80 "not have word read capability\n"); 81 81 return -1; 82 82 } … … 85 85 case I2C_SMBUS_BLOCK_DATA: 86 86 if (!(funcs & I2C_FUNC_SMBUS_READ_BLOCK_DATA)) { 87 fprintf(stderr, "Error: Adapter for i2c bus %d does " 88 "not have smbus block read capability\n", 89 i2cbus); 87 fprintf(stderr, "Error: Adapter does " 88 "not have smbus block read capability\n"); 90 89 return -1; 91 90 } … … 94 93 case I2C_SMBUS_I2C_BLOCK_DATA: 95 94 if (!(funcs & I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { 96 fprintf(stderr, "Error: Adapter for i2c bus %d does " 97 "not have i2c block read capability\n", 98 i2cbus); 95 fprintf(stderr, "Error: Adapter does " 96 "not have i2c block read capability\n"); 99 97 return -1; 100 98 } … … 104 102 if (pec 105 103 && !(funcs & (I2C_FUNC_SMBUS_PEC | I2C_FUNC_I2C))) { 106 fprintf(stderr, "Warning: Adapter for i2c bus %ddoes "107 "not seem to support PEC\n" , i2cbus);104 fprintf(stderr, "Warning: Adapter does " 105 "not seem to support PEC\n"); 108 106 } 109 107 … … 265 263 file = open_i2c_dev(i2cbus, filename, 0); 266 264 if (file < 0 267 || check_funcs(file, i2cbus,size, pec)265 || check_funcs(file, size, pec) 268 266 || set_slave_addr(file, address, force)) 269 267 exit(1); i2c-tools/trunk/tools/i2cget.c
r5238 r5240 50 50 } 51 51 52 static int check_funcs(int file, int i2cbus, intsize, int daddress, int pec)52 static int check_funcs(int file, int size, int daddress, int pec) 53 53 { 54 54 unsigned long funcs; … … 64 64 case I2C_SMBUS_BYTE: 65 65 if (!(funcs & I2C_FUNC_SMBUS_READ_BYTE)) { 66 fprintf(stderr, "Error: Adapter for i2c bus %ddoes "67 "not have read byte capability\n" , i2cbus);66 fprintf(stderr, "Error: Adapter does " 67 "not have read byte capability\n"); 68 68 return -1; 69 69 } 70 70 if (daddress >= 0 71 71 && !(funcs & I2C_FUNC_SMBUS_WRITE_BYTE)) { 72 fprintf(stderr, "Error: Adapter for i2c bus %ddoes "73 "not have write byte capability\n" , i2cbus);72 fprintf(stderr, "Error: Adapter does " 73 "not have write byte capability\n"); 74 74 return -1; 75 75 } … … 78 78 case I2C_SMBUS_BYTE_DATA: 79 79 if (!(funcs & I2C_FUNC_SMBUS_READ_BYTE_DATA)) { 80 fprintf(stderr, "Error: Adapter for i2c bus %ddoes "81 "not have read byte data capability\n" , i2cbus);80 fprintf(stderr, "Error: Adapter does " 81 "not have read byte data capability\n"); 82 82 return -1; 83 83 } … … 86 86 case I2C_SMBUS_WORD_DATA: 87 87 if (!(funcs & I2C_FUNC_SMBUS_READ_WORD_DATA)) { 88 fprintf(stderr, "Error: Adapter for i2c bus %ddoes "89 "not have read word data capability\n" , i2cbus);88 fprintf(stderr, "Error: Adapter does " 89 "not have read word data capability\n"); 90 90 return -1; 91 91 } … … 95 95 if (pec 96 96 && !(funcs & (I2C_FUNC_SMBUS_PEC | I2C_FUNC_I2C))) { 97 fprintf(stderr, "Warning: Adapter for i2c bus %ddoes "98 "not seem to support PEC\n" , i2cbus);97 fprintf(stderr, "Warning: Adapter does " 98 "not seem to support PEC\n"); 99 99 } 100 100 … … 219 219 file = open_i2c_dev(i2cbus, filename, 0); 220 220 if (file < 0 221 || check_funcs(file, i2cbus,size, daddress, pec)221 || check_funcs(file, size, daddress, pec) 222 222 || set_slave_addr(file, address, force)) 223 223 exit(1); i2c-tools/trunk/tools/i2cset.c
r5237 r5240 46 46 } 47 47 48 static int check_funcs(int file, int i2cbus, intsize, int pec)48 static int check_funcs(int file, int size, int pec) 49 49 { 50 50 unsigned long funcs; … … 60 60 case I2C_SMBUS_BYTE: 61 61 if (!(funcs & I2C_FUNC_SMBUS_WRITE_BYTE)) { 62 fprintf(stderr, "Error: Adapter for i2c bus %ddoes "63 "not have byte send capability\n" , i2cbus);62 fprintf(stderr, "Error: Adapter does " 63 "not have byte send capability\n"); 64 64 return -1; 65 65 } … … 68 68 case I2C_SMBUS_BYTE_DATA: 69 69 if (!(funcs & I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) { 70 fprintf(stderr, "Error: Adapter for i2c bus %ddoes "71 "not have byte write capability\n" , i2cbus);70 fprintf(stderr, "Error: Adapter does " 71 "not have byte write capability\n"); 72 72 return -1; 73 73 } … … 76 76 case I2C_SMBUS_WORD_DATA: 77 77 if (!(funcs & I2C_FUNC_SMBUS_WRITE_WORD_DATA)) { 78 fprintf(stderr, "Error: Adapter for i2c bus %ddoes "79 "not have word write capability\n" , i2cbus);78 fprintf(stderr, "Error: Adapter does " 79 "not have word write capability\n"); 80 80 return -1; 81 81 } … … 85 85 if (pec 86 86 && !(funcs & (I2C_FUNC_SMBUS_PEC | I2C_FUNC_I2C))) { 87 fprintf(stderr, "Warning: Adapter for i2c bus %ddoes "88 "not seem to support PEC\n" , i2cbus);87 fprintf(stderr, "Warning: Adapter does " 88 "not seem to support PEC\n"); 89 89 } 90 90 … … 215 215 file = open_i2c_dev(i2cbus, filename, 0); 216 216 if (file < 0 217 || check_funcs(file, i2cbus,size, pec)217 || check_funcs(file, size, pec) 218 218 || set_slave_addr(file, address, force)) 219 219 exit(1);
