#!/bin/sh

check_ec200a() {
	sleep 11
	[ -z "$(lsusb | grep -e 2c7c:6005)" ] && return 0

	echo '2c7c 6005 ff' > /sys/bus/usb-serial/drivers/option1/new_id
	sleep 5

	tty_rw /dev/ttyUSB2 "$(echo -e -n '\rAT+CFUN=4\r\n')"
	sleep 3
	tty_rw /dev/ttyUSB2 "$(echo -e -n '\rAT+CFUN=1\r\n')"
}

check_ec200a
