From fc7841e059c41517f27378d1472cbb9b4d9e6f98 Mon Sep 17 00:00:00 2001 From: JamesWP Date: Thu, 28 May 2020 23:36:17 +0100 Subject: [PATCH] fixed example to work on a raspberry pi the linux api to talk to i2c devices requires that the device id be specified by ioctl, otherwise how would it know which device to talk to?! --- examples/linux_userspace.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/examples/linux_userspace.c b/examples/linux_userspace.c index 62c8eb5..1e62b24 100644 --- a/examples/linux_userspace.c +++ b/examples/linux_userspace.c @@ -15,10 +15,8 @@ * \include linux_userspace.c */ -#ifdef __KERNEL__ #include #include -#endif /******************************************************************************/ /*! System header files */ @@ -143,13 +141,11 @@ int main(int argc, char* argv[]) exit(1); } -#ifdef __KERNEL__ if (ioctl(fd, I2C_SLAVE, dev.dev_id) < 0) { fprintf(stderr, "Failed to acquire bus access and/or talk to slave.\n"); exit(1); } -#endif /* Initialize the bme280 */ rslt = bme280_init(&dev);