From 04c3fc4ec50287e3c9232aec9606ae91b46bd543 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Wabik?= <4rafal@gmail.com> Date: Fri, 19 Mar 2021 02:21:19 -0700 Subject: [PATCH] Up to 1.3.2 --- .../root/etc/uci-defaults/set_3ginfo_port.sh | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 luci-app-3ginfo/root/etc/uci-defaults/set_3ginfo_port.sh diff --git a/luci-app-3ginfo/root/etc/uci-defaults/set_3ginfo_port.sh b/luci-app-3ginfo/root/etc/uci-defaults/set_3ginfo_port.sh new file mode 100644 index 0000000..3fb8bfc --- /dev/null +++ b/luci-app-3ginfo/root/etc/uci-defaults/set_3ginfo_port.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# Copyright 2020-2021 RafaƂ Wabik (IceG) - From eko.one.pl forum +# Licensed to the GNU General Public License v3.0. + +work=false +for port in /dev/ttyUSB* +do + [[ -e $port ]] || continue + gcom -d $port info &> /tmp/testusb + testUSB=`cat /tmp/testusb | grep "Error\|Can't"` + if [ -z "$testUSB" ]; then + work=$port + break + fi +done +rm -rf /tmp/testusb + +if [ $work != false ]; then +uci set 3ginfo.device=$work +uci commit 3ginfo +fi