#!/bin/sh
uptime

# Check the platform and link the correspomding 12c-map based on platform
PLATFORM=$(cat /var/run/platform)

if [ $PLATFORM == "RazorL" ] || [ $PLATFORM == "RazorM" ] || [ $PLATFORM == "RazorS" ]
then
	ln -sf /conf/$PLATFORM-i2c-map  /conf/i2c-map
else
	echo "***  NO VALID  PLATFORM ID DETECTED ***"
	exit 0
fi

# Scan /conf/<platform>-i2c-map and stores data into i2c_bus_status_t in i2c driver
if ! [ -e /usr/local/bin/i2cmap_parser ]
then
	echo " Unable to find i2cmap_parser file. Cannot scan I2C  device  files"
	exit 1
fi

# Parse platform i2c map layout and create device statistic files (sysfs)
/usr/local/bin/i2cmap_parser

uptime
