#!/bin/sh
if [ -f "/var/run/RazorL" ] || [ -f "/var/run/RazorS" ] || [ -f "/var/run/RazorM" ] ; then
echo I2C transaction
echo ------------------------------------------------------------------

i=0
while [ $i -lt 6 ]
do
#	echo "$i"
	if ! [ -e /usr/local/bin/i2c-test ]
	then
	        echo " Unable to find i2c-test file. Cannot scan and create device files files"
                exit 1
	 fi 
	cat /sys/kernel/i2c/$i/status
	i=`expr $i + 1`
done

if [ -f "/var/run/RazorL" ] ; then
	cat /sys/kernel/i2c/2/seg_0
	cat /sys/kernel/i2c/2/seg_1
	cat /sys/kernel/i2c/2/seg_2
	cat /sys/kernel/i2c/2/seg_3
	cat /sys/kernel/i2c/2/seg_4
	cat /sys/kernel/i2c/2/seg_5
	cat /sys/kernel/i2c/2/seg_6
	cat /sys/kernel/i2c/2/seg_7
fi

i=0
while [ $i -lt 6 ]
do
	cd /sys/kernel/i2c/$i
	touch  /tmp/i2c_statistics_file
	
	ls |grep dev > /tmp/i2c_statistics_file
#	ls |grep dev > /mnt/nfsxfer/i2c_statistics_file
	while read line
	do
		cat /sys/kernel/i2c/$i/$line
	done < /tmp/i2c_statistics_file 
#	done < /mnt/nfsxfer/i2c_statistics_file 
	i=`expr $i + 1`
		
done	
fi


