#!/bin/sh
#
# Copyright (C) 2015-2016 devolo AG
#

if [ -f /lib/ar71xx.sh ]; then
	PLATFORM=ar71xx
	. /lib/ar71xx.sh
elif [ -f /lib/ipq806x.sh ]; then
	PLATFORM=ipq806x
	. /lib/ipq806x.sh
fi

. /lib/functions.sh

board=$(${PLATFORM}_board_name)


set_son_config() {
	# set default configuration for hyd
	case "$board" in
		dlan-pro-1200-ac|\
		dlan-pro-1200-n)
			uci set hyd.@Vlanid[0].ifname='eth0.1'
			uci set hyd.@Vlanid[1].ifname='eth0.2'
			uci set hyd.PathChPlc.HostPLCInterfaceSpeed='1000'
			;;
		dlan-550-wifi|\
		dlan-1000-ac)
			uci set hyd.@Vlanid[0].ifname='eth0'
			uci set hyd.@Vlanid[1].ifname='eth1'
			uci set hyd.PathChPlc.HostPLCInterfaceSpeed='100'
			;;
	esac
	uci set hyd.PathChWlan.MaxMediumUtilization_W2=0
	uci set hyd.PathChWlan.MaxMediumUtilizationForLC_W2=0
	uci set hyd.PathChWlan.MaxMediumUtilization_W5=99
	uci set hyd.PathChWlan.MaxMediumUtilizationForLC_W5=99
	uci set hyd.Topology.PERIODIC_QUERY_INTERVAL=15
	uci set hyd.Topology.ENABLE_NOTIFICATION_UNICAST=1
	uci delete hyd.IEEE1905Settings.AvoidDupRenew
	uci delete hyd.IEEE1905Settings.AvoidDupTopologyNotification
	uci commit hyd

	uci set repacd.WiFiLink.DaisyChain=1
	uci set repacd.repacd.DefaultREMode=son
	uci commit repacd
}

set_son_config

exit 0