mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-11-11 16:40:16 +00:00
add i2c block read capability to i2cdump
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1244 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
c976538703
commit
8e94a4925f
2 files changed
+17
-3
No files matched your search
@@ -20,6 +20,7 @@ ask CVS about it:
|
||||
2.6.3 (2001????)
|
||||
Library: Add PCF8591 support
|
||||
Module pcf8591: new
|
||||
Program i2cdump: Add i2c block read capability
|
||||
Program sensors: Add PCF8591 support
|
||||
Program sensors-detect: Add several Nvidia chips, add PCF8591
|
||||
|
||||
|
||||
+16
-3
@@ -26,6 +26,18 @@
|
||||
#include <fcntl.h>
|
||||
#include <linux/i2c-dev.h>
|
||||
|
||||
/*
|
||||
We don't use this #define but it was put into i2c.h at the same time as
|
||||
i2c_smbus_read_i2c_block_data() was implemented (i2c 2.6.3),
|
||||
so we use it as a version check.
|
||||
*/
|
||||
#if defined(I2C_FUNC_SMBUS_READ_I2C_BLOCK_2)
|
||||
#define USE_I2C_BLOCK 1
|
||||
#else
|
||||
#define USE_I2C_BLOCK 0
|
||||
#endif
|
||||
|
||||
|
||||
void help(void)
|
||||
{
|
||||
FILE *fptr;
|
||||
@@ -256,13 +268,14 @@ int main(int argc, char *argv[])
|
||||
if(size == I2C_SMBUS_BLOCK_DATA) {
|
||||
res = i2c_smbus_read_block_data(file,0,cblock);
|
||||
} else if(size == I2C_SMBUS_I2C_BLOCK_DATA) {
|
||||
/*
|
||||
#if USE_I2C_BLOCK
|
||||
res = i2c_smbus_read_i2c_block_data(file,0,cblock);
|
||||
*/
|
||||
#else
|
||||
fprintf(stderr, "Error: I2C block read unimplemented\n");
|
||||
exit(1);
|
||||
#endif
|
||||
}
|
||||
if(res < 0) {
|
||||
if(res <= 0) {
|
||||
fprintf(stderr, "Error: Block read failed, return code %d\n", res);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user