Browse Source

Use consistent transaction names (based on the SMBus specification)

when complaining about a missing adapter functionality.


git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5242 7894878c-1315-0410-8ee3-d5d059ff63e0
tags/v3.0.2
Jean Delvare 17 years ago
parent
commit
54cee12770
  1. 3
      CHANGES
  2. 16
      tools/i2cdump.c
  3. 8
      tools/i2cget.c
  4. 6
      tools/i2cset.c

3
CHANGES

@ -9,13 +9,16 @@ SVN
Shorten the usage message Shorten the usage message
Restrict the chip address to 0x03-0x77 Restrict the chip address to 0x03-0x77
Split the functionality checking code into a separate function Split the functionality checking code into a separate function
Better error message on missing adapter functionality
i2cget: Support i2c bus passed by name i2cget: Support i2c bus passed by name
Shorten the usage message Shorten the usage message
Better error message on missing adapter functionality
i2cset: Support i2c bus passed by name i2cset: Support i2c bus passed by name
Shorten the usage message Shorten the usage message
Restrict the chip address to 0x03-0x77 Restrict the chip address to 0x03-0x77
Split the code into several functions for clarity Split the code into several functions for clarity
Add support for short writes (SMBus send byte) Add support for short writes (SMBus send byte)
Better error message on missing adapter functionality
3.0.1 (2008-04-04) 3.0.1 (2008-04-04)
Drop the trailing .pl from all perl script names Drop the trailing .pl from all perl script names

16
tools/i2cdump.c

@ -59,36 +59,40 @@ static int check_funcs(int file, int size, int pec)
switch(size) { switch(size) {
case I2C_SMBUS_BYTE: case I2C_SMBUS_BYTE:
if (!((funcs & I2C_FUNC_SMBUS_BYTE) == I2C_FUNC_SMBUS_BYTE)) {
fprintf(stderr, MISSING_FUNC_FMT, "byte");
if (!(funcs & I2C_FUNC_SMBUS_READ_BYTE)) {
fprintf(stderr, MISSING_FUNC_FMT, "SMBus receive byte");
return -1;
}
if (!(funcs & I2C_FUNC_SMBUS_WRITE_BYTE)) {
fprintf(stderr, MISSING_FUNC_FMT, "SMBus send byte");
return -1; return -1;
} }
break; break;
case I2C_SMBUS_BYTE_DATA: case I2C_SMBUS_BYTE_DATA:
if (!(funcs & I2C_FUNC_SMBUS_READ_BYTE_DATA)) { if (!(funcs & I2C_FUNC_SMBUS_READ_BYTE_DATA)) {
fprintf(stderr, MISSING_FUNC_FMT, "byte read");
fprintf(stderr, MISSING_FUNC_FMT, "SMBus read byte");
return -1; return -1;
} }
break; break;
case I2C_SMBUS_WORD_DATA: case I2C_SMBUS_WORD_DATA:
if (!(funcs & I2C_FUNC_SMBUS_READ_WORD_DATA)) { if (!(funcs & I2C_FUNC_SMBUS_READ_WORD_DATA)) {
fprintf(stderr, MISSING_FUNC_FMT, "word read");
fprintf(stderr, MISSING_FUNC_FMT, "SMBus read word");
return -1; return -1;
} }
break; break;
case I2C_SMBUS_BLOCK_DATA: case I2C_SMBUS_BLOCK_DATA:
if (!(funcs & I2C_FUNC_SMBUS_READ_BLOCK_DATA)) { if (!(funcs & I2C_FUNC_SMBUS_READ_BLOCK_DATA)) {
fprintf(stderr, MISSING_FUNC_FMT, "smbus block read");
fprintf(stderr, MISSING_FUNC_FMT, "SMBus block read");
return -1; return -1;
} }
break; break;
case I2C_SMBUS_I2C_BLOCK_DATA: case I2C_SMBUS_I2C_BLOCK_DATA:
if (!(funcs & I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { if (!(funcs & I2C_FUNC_SMBUS_READ_I2C_BLOCK)) {
fprintf(stderr, MISSING_FUNC_FMT, "i2c block read");
fprintf(stderr, MISSING_FUNC_FMT, "I2C block read");
return -1; return -1;
} }
break; break;

8
tools/i2cget.c

@ -63,26 +63,26 @@ static int check_funcs(int file, int size, int daddress, int pec)
switch (size) { switch (size) {
case I2C_SMBUS_BYTE: case I2C_SMBUS_BYTE:
if (!(funcs & I2C_FUNC_SMBUS_READ_BYTE)) { if (!(funcs & I2C_FUNC_SMBUS_READ_BYTE)) {
fprintf(stderr, MISSING_FUNC_FMT, "read byte");
fprintf(stderr, MISSING_FUNC_FMT, "SMBus receive byte");
return -1; return -1;
} }
if (daddress >= 0 if (daddress >= 0
&& !(funcs & I2C_FUNC_SMBUS_WRITE_BYTE)) { && !(funcs & I2C_FUNC_SMBUS_WRITE_BYTE)) {
fprintf(stderr, MISSING_FUNC_FMT, "write byte");
fprintf(stderr, MISSING_FUNC_FMT, "SMBus send byte");
return -1; return -1;
} }
break; break;
case I2C_SMBUS_BYTE_DATA: case I2C_SMBUS_BYTE_DATA:
if (!(funcs & I2C_FUNC_SMBUS_READ_BYTE_DATA)) { if (!(funcs & I2C_FUNC_SMBUS_READ_BYTE_DATA)) {
fprintf(stderr, MISSING_FUNC_FMT, "read byte");
fprintf(stderr, MISSING_FUNC_FMT, "SMBus read byte");
return -1; return -1;
} }
break; break;
case I2C_SMBUS_WORD_DATA: case I2C_SMBUS_WORD_DATA:
if (!(funcs & I2C_FUNC_SMBUS_READ_WORD_DATA)) { if (!(funcs & I2C_FUNC_SMBUS_READ_WORD_DATA)) {
fprintf(stderr, MISSING_FUNC_FMT, "read word");
fprintf(stderr, MISSING_FUNC_FMT, "SMBus read word");
return -1; return -1;
} }
break; break;

6
tools/i2cset.c

@ -59,21 +59,21 @@ static int check_funcs(int file, int size, int pec)
switch (size) { switch (size) {
case I2C_SMBUS_BYTE: case I2C_SMBUS_BYTE:
if (!(funcs & I2C_FUNC_SMBUS_WRITE_BYTE)) { if (!(funcs & I2C_FUNC_SMBUS_WRITE_BYTE)) {
fprintf(stderr, MISSING_FUNC_FMT, "byte send");
fprintf(stderr, MISSING_FUNC_FMT, "SMBus send byte");
return -1; return -1;
} }
break; break;
case I2C_SMBUS_BYTE_DATA: case I2C_SMBUS_BYTE_DATA:
if (!(funcs & I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) { if (!(funcs & I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) {
fprintf(stderr, MISSING_FUNC_FMT, "byte write");
fprintf(stderr, MISSING_FUNC_FMT, "SMBus write byte");
return -1; return -1;
} }
break; break;
case I2C_SMBUS_WORD_DATA: case I2C_SMBUS_WORD_DATA:
if (!(funcs & I2C_FUNC_SMBUS_WRITE_WORD_DATA)) { if (!(funcs & I2C_FUNC_SMBUS_WRITE_WORD_DATA)) {
fprintf(stderr, MISSING_FUNC_FMT, "word write");
fprintf(stderr, MISSING_FUNC_FMT, "SMBus write word");
return -1; return -1;
} }
break; break;

Loading…
Cancel
Save