Changeset 5210 for i2c-tools/trunk/tools/i2cget.c
- Timestamp:
- 04/24/08 14:43:40 (4 years ago)
- Files:
-
- 1 modified
-
i2c-tools/trunk/tools/i2cget.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
i2c-tools/trunk/tools/i2cget.c
r5207 r5210 39 39 { 40 40 fprintf(stderr, 41 "Usage: i2cget [-f] [-y] I2CBUS CHIP-ADDRESS [DATA-ADDRESS [MODE]]\n"42 " I2CBUS is an integer or an I2C bus name\n"43 " ADDRESS is an integer (0x03 - 0x77)\n"44 " MODE is one of:\n"45 " b (read byte data, default)\n"46 " w (read word data)\n"47 " c (write byte/read byte)\n"48 " Append p for SMBus PEC\n");41 "Usage: i2cget [-f] [-y] I2CBUS CHIP-ADDRESS [DATA-ADDRESS [MODE]]\n" 42 " I2CBUS is an integer or an I2C bus name\n" 43 " ADDRESS is an integer (0x03 - 0x77)\n" 44 " MODE is one of:\n" 45 " b (read byte data, default)\n" 46 " w (read word data)\n" 47 " c (write byte/read byte)\n" 48 " Append p for SMBus PEC\n"); 49 49 exit(1); 50 50 } … … 57 57 if (ioctl(file, I2C_FUNCS, &funcs) < 0) { 58 58 fprintf(stderr, "Error: Could not get the adapter " 59 "functionality matrix: %s\n", strerror(errno));59 "functionality matrix: %s\n", strerror(errno)); 60 60 return -1; 61 61 } … … 65 65 if (!(funcs & I2C_FUNC_SMBUS_READ_BYTE)) { 66 66 fprintf(stderr, "Error: Adapter for i2c bus %d does " 67 "not have read byte capability\n", i2cbus);67 "not have read byte capability\n", i2cbus); 68 68 return -1; 69 69 } … … 71 71 && !(funcs & I2C_FUNC_SMBUS_WRITE_BYTE)) { 72 72 fprintf(stderr, "Error: Adapter for i2c bus %d does " 73 "not have write byte capability\n", i2cbus);73 "not have write byte capability\n", i2cbus); 74 74 return -1; 75 75 } … … 79 79 if (!(funcs & I2C_FUNC_SMBUS_READ_BYTE_DATA)) { 80 80 fprintf(stderr, "Error: Adapter for i2c bus %d does " 81 "not have read byte data capability\n", i2cbus);81 "not have read byte data capability\n", i2cbus); 82 82 return -1; 83 83 } … … 87 87 if (!(funcs & I2C_FUNC_SMBUS_READ_WORD_DATA)) { 88 88 fprintf(stderr, "Error: Adapter for i2c bus %d does " 89 "not have read word data capability\n", i2cbus);89 "not have read word data capability\n", i2cbus); 90 90 return -1; 91 91 } … … 96 96 && !(funcs & (I2C_FUNC_SMBUS_PEC | I2C_FUNC_I2C))) { 97 97 fprintf(stderr, "Warning: Adapter for i2c bus %d does " 98 "not seem to support PEC\n", i2cbus);98 "not seem to support PEC\n", i2cbus); 99 99 } 100 100 … … 122 122 if (size == I2C_SMBUS_BYTE && daddress >= 0 && pec) { 123 123 fprintf(stderr, "WARNING! All I2C chips and some SMBus chips " 124 "will interpret a write\nbyte command with PEC as a"125 "write byte data command, effectively writing a\n"126 "value into a register!\n");124 "will interpret a write\nbyte command with PEC as a" 125 "write byte data command, effectively writing a\n" 126 "value into a register!\n"); 127 127 dont++; 128 128 } … … 224 224 225 225 if (!yes && !confirm(filename, address, size, daddress, pec)) 226 exit(0);226 exit(0); 227 227 228 228 if (pec && ioctl(file, I2C_PEC, 1) < 0) { 229 229 fprintf(stderr, "Error: Could not set PEC: %s\n", 230 strerror(errno));230 strerror(errno)); 231 231 exit(1); 232 232 }
