#!/bin/sh

motorPropFile="/mnt/mtd/Log/motor"
MOTOR_MIRROR=""
MOTOR_FLIP=""
script_path=`echo $0 | awk -F '/' '{for(i=2;i<NF;i++) printf"/"$i}'`
echo $script_path
#cd $script_path/
MOTOR_MIRROR=`cat $script_path/motorMirrorFlip.ini | ./busybox grep "motorMirrorCtl:" | sed 's/motorMirrorCtl://g' | sed 's/\r//g' | sed 's/\n//g' | sed "s/$(echo -e '\015')//g"`
MOTOR_FLIP=`cat $script_path/motorMirrorFlip.ini | ./busybox grep "motorFlipCtl:" | sed  's/motorFlipCtl://g' | sed 's/\r//g' | sed 's/\n//g' | sed  "s/$(echo -e '\015')//g"`

./simple_adec_bind_ao -r 8000 -t g711a -i audio/setMotorConfig.pcm
rm -f $motorPropFile
if [ "$MOTOR_MIRROR" = "yes" -o "$MOTOR_MIRROR" = "no" ];then
	echo "motor_mirror:$MOTOR_MIRROR" >> $motorPropFile
	./simple_adec_bind_ao -r 8000 -t g711a -i audio/motorMirror_$MOTOR_MIRROR.pcm
fi
if [ "$MOTOR_FLIP" = "yes" -o "$MOTOR_FLIP" = "no" ];then
	echo "motor_flip:$MOTOR_FLIP" >> $motorPropFile
	./simple_adec_bind_ao -r 8000 -t g711a -i audio/motorFlip_$MOTOR_FLIP.pcm
fi

#./motor/motor -m &
#TMP=$?
#if [ "$TMP" == "1" ]; then
#	$script_path/simple_adec_bind_ao -r 8000 -t g711a -i audio/music_didi.pcm
#fi


