#! /bin/sh
#
# For Charging Boot

do_charging_ani() {
	echo "charging animation ..."

#export HW-dependent ENV variables which are read by charging-animation
	HW_REVISION=`cat /proc/cpuinfo | grep Revision | awk -F ':' '{print $2}' | tr -d ' '`
	if [ "${HW_REVISION}" = "0001" ]; then
		source /usr/share/charging-animation/config/tizen.cfg
	else
		source /usr/share/charging-animation/config/tizen.cfg
	fi

	source /usr/share/charging-animation/config/common.cfg

	if [ "${CHG_ENV_SUPPORT_DRM}" = "1" ]; then
		/sbin/udevd --daemon
		/sbin/udevadm trigger --subsystem-match=drm
	fi

	echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
	/usr/bin/charging-animation &
}


charging_boot=`grep charger_detect_boot /proc/cmdline`
if [ "z$charging_boot" != "z" ]; then
	do_charging_ani
# for logs
	mount -a
	syslogd -O /opt/var/log/messages-chrg
	klogd
fi
