#!/bin/sh if I2C_ADAPTERS=$(i2cdetect -l | wc -l); then echo "PASS: found $I2C_ADAPTERS i2c adapters" else echo "SKIP: No I2C adapters found on the system." exit 1 fi I2C_MAX=$(($I2C_ADAPTERS - 1)) for adapter in `seq 0 $I2C_MAX` ; do i2cdetect -y $adapter > /dev/null 2>&1 if [ $? -ne 0 ]; then echo "FAIL: detect i2c adapter $adapter failed" else echo "PASS: detect i2c adapter $adapter success" fi done