#!/system/bin/sh

prop="drd.vision.knx.lastactivity"

last_value=""

while true
do
	sleep 900
	vision_pid="$(busybox pidof vision)"
	if [ -z "$vision_pid" ] ; then
		continue
	fi
	knxusb="$(ls -d /sys/devices/*/usb*/*/*/*0E77:0104* 2> /dev/null)"
	if [ -z "$knxusb" ] ; then
		continue
	fi
	cur_value="$(getprop $prop)"	
	if [ "$cur_value" = "$last_value" ] ; then
		drd-reset-knx-usb
	else
		last_value="$cur_value"
	fi
done

exit 0
