Skip to content

Commit

Permalink
Handling different version of linux/i2c-dev.h
Browse files Browse the repository at this point in the history
  • Loading branch information
giuliomoro committed Aug 10, 2017
1 parent 5b45458 commit 3359a5b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion include/I2c.h
Expand Up @@ -15,8 +15,16 @@
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <linux/i2c.h>
#include <linux/i2c-dev.h>
// heuristic to guess what version of i2c-dev.h we have:
// the one installed with `apt-get install libi2c-dev`
// would conflict with linux/i2c.h, while the stock
// one requires linus/i2c.h
#ifndef I2C_SMBUS_BLOCK_MAX
// If this is not defined, we have the "stock" i2c-dev.h
// so we include linux/i2c.h
#include <linux/i2c.h>
#endif
#include <sys/ioctl.h>
#include <stropts.h>

Expand Down

0 comments on commit 3359a5b

Please sign in to comment.