#!/bin/bash

. /tmp/cmdline
. /usr/bin/i2csetup

if [ ${1} ]; then
    I2CCONFIGBUS=${1}
fi

if [ ${2} ]; then
    I2CCONFIGADDRESS=${2}
fi

if [ -z "$(which i2cutil)" ] ; then
    logger i2crdrevision "i2cutil not found"
    exit 1
else
    #read only first card found
    for BUS in ${I2CCONFIGBUS};do 
        revision=$(i2cutil -y -r ${BUS} ${I2CCONFIGADDRESS} 7 b)
        printf "%01x\n" ${revision}
        exit 0
    done
fi

