diff --git a/prog/detect/i2cdetect.c b/prog/detect/i2cdetect.c index b5b8c974..a612d6ef 100644 --- a/prog/detect/i2cdetect.c +++ b/prog/detect/i2cdetect.c @@ -36,6 +36,7 @@ int main(int argc, char *argv[]) char *end; int i,j,res,i2cbus,file; char filename[20]; + long funcs; if (argc < 2) { @@ -61,6 +62,19 @@ int main(int argc, char *argv[]) strerror(errno)); exit(1); } + + if (ioctl(file,I2C_FUNCS,&funcs) < 0) { + fprintf(stderr, + "Error: Could not get the adapter functionality maxtrix: %s\n", + strerror(errno)); + exit(1); + } + if (! (funcs & I2C_FUNC_SMBUS_QUICK)) { + fprintf(stderr, + "Error: Can't use SMBus Quick Write command " + "on this bus (ISA bus?)\n"); + exit(1); + } fprintf(stderr," WARNING! This program can confuse your I2C bus, " "cause data loss and worse!\n");