You can find it on github here: https://github.com/groeck/i2c-tools
I’ve tried it with the last version of Ubuntu Mate but I aim to use it with Android Nougat.
$ git clone https://github.com/groeck/i2c-tools
$ cd i2c-toools
$ make
$ cp lib/* /lib
$ cd tools
$ ./i2c-detect -y 1
You can follow below steps to use i2c-tools on Android
###Steps
1). Setup the env and lunch target
$ cd <path-of-your-project>
$ source build/envsetup.sh
$ lunch <your-target>
2). Download the i2c-tools source code
$ cd <path-of-your-project>
$ cd external
$ git clone https://github.com/terry2droid/i2c-tools -b android
3). Build the i2c-tools
$ cd i2c-tools
$ mm -j8
Notice: The list of target file
1.out/target/product/kvim/system/bin/i2cset
2.out/target/product/kvim/system/bin/i2cdetect
3.out/target/product/kvim/system/bin/i2cget
4.out/target/product/kvim/system/bin/i2cdump
4). Push the target file to your device with adb command
I’ve got this error after following what you provided.
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=7.1.1
TARGET_PRODUCT=kvim
TARGET_BUILD_VARIANT=user
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm64
TARGET_ARCH_VARIANT=armv8-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=arm
TARGET_2ND_ARCH_VARIANT=armv7-a-neon
TARGET_2ND_CPU_VARIANT=cortex-a9
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-4.4.0-75-generic-x86_64-with-Ubuntu-14.04-trusty
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=NMF26Q
OUT_DIR=out
============================================
make: Entering directory `/home/ted/Desktop/WORKING_DIRECTORY'
Running kati to generate build-kvim-mmm-external_i2c-tools_Android.mk.ninja...
device/khadas/kvim/preinstall/preinstall.mk was modified, regenerating...
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=7.1.1
TARGET_PRODUCT=kvim
TARGET_BUILD_VARIANT=user
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm64
TARGET_ARCH_VARIANT=armv8-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=arm
TARGET_2ND_ARCH_VARIANT=armv7-a-neon
TARGET_2ND_CPU_VARIANT=cortex-a9
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-4.4.0-75-generic-x86_64-with-Ubuntu-14.04-trusty
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=NMF26Q
OUT_DIR=out
============================================
No private recovery resources for TARGET_DEVICE kvim
build/core/Makefile:34: warning: overriding commands for target `out/target/product/kvim/system/usr/keylayout/Generic.kl'
build/core/Makefile:34: warning: ignoring old commands for target `out/target/product/kvim/system/usr/keylayout/Generic.kl'
Starting build with ninja
ninja: Entering directory `.'
ninja: error: 'out/target/product/kvim/obj/lib/crtbegin_dynamic.o', needed by 'out/target/product/kvim/obj/EXECUTABLES/i2cdetect_intermediates/LINKED/i2cdetect', missing and no known rule to make it
make: *** [ninja_wrapper] Error 1
make: Leaving directory `/home/ted/Desktop/WORKING_DIRECTORY'
#### make failed to build some targets (10 seconds) ####
ninja: error: ‘out/target/product/kvim/obj/lib/crtbegin_dynamic.o’, needed by ‘out/target/product/kvim/obj/EXECUTABLES/i2cdetect_intermediates/LINKED/i2cdetect’, missing and no known rule to make it make: *** [ninja_wrapper] Error 1
I have built the i2c-tools on android nougat and mmallow . That’s ok.
Have you ever make full compilation for android source code?
Also you can download the i2c-tools to use and don’t need to build it.
out/build-kvim-mmm-external_i2c-tools_Android.mk.ninja is missing, regenerating...
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=7.1.1
TARGET_PRODUCT=kvim
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm64
TARGET_ARCH_VARIANT=armv8-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=arm
TARGET_2ND_ARCH_VARIANT=armv7-a-neon
TARGET_2ND_CPU_VARIANT=cortex-a9
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-3.16.0-33-generic-x86_64-with-Ubuntu-14.04-trusty
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=NMF26Q
OUT_DIR=out
============================================
No private recovery resources for TARGET_DEVICE kvim
build/core/Makefile:34: warning: overriding commands for target `out/target/product/kvim/system/usr/keylayout/Generic.kl'
build/core/Makefile:34: warning: ignoring old commands for target `out/target/product/kvim/system/usr/keylayout/Generic.kl'
Starting build with ninja
ninja: Entering directory `.'
[100% 39/39] Install: out/target/product/kvim/system/bin/i2cdump
make: Leaving directory `/home/terry/project/vim/nougat'
#### make completed successfully (45 seconds) ####
terry@Server:~/project/vim/nougat/external/i2c-tools$ ls -l ../../out/target/product/kvim/system/bin/i2c
i2cdetect i2cdump i2cget i2cset
I might be annoying but the binary version of i2cset you’ve provided doesn’t support the MODE i (I2C block data) for writing multiple bytes within a register.
kvim:/ # i2cset
Usage: i2cset [-f] [-y] [-m MASK] I2CBUS CHIP-ADDRESS DATA-ADDRESS [VALUE [MODE]]
I2CBUS is an integer or an I2C bus name
ADDRESS is an integer (0x03 - 0x77)
MODE is one of:
b (byte, default)
w (word)
Append p for SMBus PEC
On other boards, the Usage looks like this:
$ i2cset
Usage: i2cset [-f] [-y] [-m MASK] I2CBUS CHIP-ADDRESS DATA-ADDRESS [VALUE] ... [MODE]
I2CBUS is an integer or an I2C bus name
ADDRESS is an integer (0x03 - 0x77)
MODE is one of:
c (byte, no value)
b (byte data, default)
w (word data)
i (I2C block data)
s (SMBus block data)
Append p for SMBus PEC
If you could provide the version with MODE i (I2C block data). I would be grateful.