Changeset 1244

Show
Ignore:
Timestamp:
11/19/01 22:14:43 (12 years ago)
Author:
mds
Message:

add i2c block read capability to i2cdump

Location:
lm-sensors/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/CHANGES

    r1243 r1244  
    2121  Library: Add PCF8591 support 
    2222  Module pcf8591: new 
     23  Program i2cdump: Add i2c block read capability 
    2324  Program sensors: Add PCF8591 support 
    2425  Program sensors-detect: Add several Nvidia chips, add PCF8591 
  • lm-sensors/trunk/prog/dump/i2cdump.c

    r1053 r1244  
    2626#include <fcntl.h> 
    2727#include <linux/i2c-dev.h> 
     28 
     29/* 
     30   We don't use this #define but it was put into i2c.h at the same time as 
     31   i2c_smbus_read_i2c_block_data() was implemented (i2c 2.6.3), 
     32   so we use it as a version check. 
     33*/ 
     34#if defined(I2C_FUNC_SMBUS_READ_I2C_BLOCK_2) 
     35#define USE_I2C_BLOCK 1 
     36#else 
     37#define USE_I2C_BLOCK 0 
     38#endif 
     39 
    2840 
    2941void help(void) 
     
    257269        res = i2c_smbus_read_block_data(file,0,cblock); 
    258270      } else if(size == I2C_SMBUS_I2C_BLOCK_DATA) { 
    259 /* 
     271#if USE_I2C_BLOCK 
    260272        res = i2c_smbus_read_i2c_block_data(file,0,cblock); 
    261 */ 
     273#else 
    262274        fprintf(stderr, "Error: I2C block read unimplemented\n"); 
    263275        exit(1); 
    264       } 
    265       if(res < 0) { 
     276#endif 
     277      } 
     278      if(res <= 0) { 
    266279        fprintf(stderr, "Error: Block read failed, return code %d\n", res); 
    267280        exit(1);