WP76XX SDK 18.1.0 Missing linux/i2c-dev-user.h

the file is missing in
legato.sdk.18.1.0.wp76xx-native-x86_64-201803051402

copied the one from
legato.sdk.16.10.4.wp85-wp75-native-x86_64-201712131538

i2c-dev.h and i2c-dev-user.h

Not sure if this is deliberate or oversight

Hi,

I find i2c-dev.h inside the WP76 toolchain legato.toolchain.2.2.2.SWI9X07Y_02140400-wp76xx-native-x86-201803051138.

1 Like

There 2 files i2c-dev.h and i2c-dev-user.h both are available when compiling the toolchain but not in the devstudio package WP85XX does include them the -user.h file includes the SMB interface

ls ciis4-legato-yocto/yocto-wp76/build_bin/tmp/sysroots/swi-mdm9x28/usr/include/linux/i2c-dev*

ciis4-legato-yocto/yocto-wp76/build_bin/tmp/sysroots/swi-mdm9x28/usr/include/linux/i2c-dev-user.h
ciis4-legato-yocto/yocto-wp76/build_bin/tmp/sysroots/swi-mdm9x28/usr/include/linux/i2c-dev.h

I guess maybe you can directly use the one in the toolchain.

There are a few different issues in play here.

For some reason, the upstream i2c-tools package overwrites the include/linux/i2c-dev.h with its own version which adds some header only functions for smbus. I’m not sure why they didn’t just create a separate header called i2c-dev-smbus.h or something, but they didn’t.

Yocto (or openembedded?) does something sort of non-standard in that they don’t overwrite the default i2c-dev.h file provided by the Linux kernel. Instead they rename the one from i2c-tools to i2c-dev-user.h. If you look at poky/meta/recipes-devtools/i2c-tools/i2c-tools_3.1.2.bb in the yocto folder for WP76, you will see these lines:

install -m 0644 include/linux/i2c-dev.h ${D}${includedir}/linux/i2c-dev-user.h
rm -f ${D}${includedir}/linux/i2c-dev.h

In December 2017, a commit was made to meta-swi which removed the i2c-tools package from the list of package dependencies for the mdm9x28 image. So as a result, you no longer have i2c-dev-user.h

1 Like

if so, where it should be added ?

the easiest and laziest way is just add it to your code and include it …