beautypg.com

IBASE MRS-801-RE User Manual

Page 75

background image

Copyright © 2013 IBASE Technology Inc. All Rights Reserved.

67

IBASE Technology Inc.

printf("Warning - readback failed\n");

} else

if (res != value) {

printf("Warning - data mismatch - wrote "

"0x%0*x, read back 0x%0*x\n",

size == I2C_SMBUS_WORD_DATA ? 4 : 2, value,

size == I2C_SMBUS_WORD_DATA ? 4 : 2, res);

} else {

printf("Value 0x%0*x written, readback matched\n",

size == I2C_SMBUS_WORD_DATA ? 4 : 2, value);

}

exit(0);

}

Utils/headers

/*

i2cbusses: Print the installed i2c busses for both 2.4 and 2.6 kernels.

Part of user-space programs to access for I2C

devices.

*/

/* For strdup and snprintf */

#define _BSD_SOURCE 1

#include

#include

#include /* for NAME_MAX */

#include

#include

#include /* for strcasecmp() */

#include

#include

#include

#include

#include

#include

#include