
if [ $# -lt 2 ]; then
    echo "Usage: $0 <dev> <filename>"
    echo "        dev = 0 = Carnegie motherboard"
    echo "        dev = 1 = IOXM"
    exit 1
fi

destination=$1
filename=$2

endnum=0
i=0
addr=1
end=0
for val in `cat $filename`; do
    if [ $addr -eq 1 ]; then
	if [ $val == FFFF ]; then
	    echo "end found"
	    end=1
	    break
	fi
#	echo -n "address: "
#	echo $val
	/usr/local/bin/mp_controller $destination write_eeprom $endnum $val
	addr=0
	endnum=`expr $endnum + 1`
    else
#	echo -n "data: "
#	echo $val
	/usr/local/bin/mp_controller $destination write_eeprom $endnum $val
	addr=1
	endnum=`expr $endnum + 1`
    fi
done

# string info

i=0
for val in `cat $filename`; do
    if [ $i -gt $endnum ]; then
	if [ $val != FFFF ]; then
	# print chars here
	/usr/local/bin/mp_controller $destination write_eeprom $i $val
#	echo $val
        fi
    fi
    i=`expr $i + 1`
done
