[PATCH] comgt: Move to community packages repo

Arjun AK arjunak234 at gmail.com
Mon Jun 28 09:52:38 PDT 2021


Signed-off-by: Arjun AK <arjunak234 at gmail.com>
---
 package/network/utils/comgt/Makefile          | 106 --------
 package/network/utils/comgt/files/3g.chat     |  12 -
 package/network/utils/comgt/files/3g.sh       | 116 --------
 package/network/utils/comgt/files/3g.usb      |  33 ---
 .../utils/comgt/files/directip-stop.gcom      |  16 --
 .../network/utils/comgt/files/directip.gcom   |  55 ----
 package/network/utils/comgt/files/directip.sh | 114 --------
 package/network/utils/comgt/files/evdo.chat   |  17 --
 .../utils/comgt/files/getcardinfo.gcom        |  14 -
 .../network/utils/comgt/files/getcarrier.gcom |  20 --
 .../network/utils/comgt/files/getcnum.gcom    |  20 --
 .../network/utils/comgt/files/getimsi.gcom    |  17 --
 .../utils/comgt/files/getstrength.gcom        |  14 -
 package/network/utils/comgt/files/ncm.json    |  78 ------
 package/network/utils/comgt/files/ncm.sh      | 255 ------------------
 .../network/utils/comgt/files/runcommand.gcom |  31 ---
 .../network/utils/comgt/files/setmode.gcom    |  26 --
 package/network/utils/comgt/files/setpin.gcom |  56 ----
 package/network/utils/comgt/files/ussd.gcom   |  21 --
 .../utils/comgt/patches/001-compile_fix.patch |  23 --
 .../utils/comgt/patches/002-termios.patch     | 105 --------
 .../utils/comgt/patches/003-no_XCASE.patch    |  20 --
 .../utils/comgt/patches/004-check_tty.patch   |  68 -----
 23 files changed, 1237 deletions(-)
 delete mode 100644 package/network/utils/comgt/Makefile
 delete mode 100644 package/network/utils/comgt/files/3g.chat
 delete mode 100644 package/network/utils/comgt/files/3g.sh
 delete mode 100644 package/network/utils/comgt/files/3g.usb
 delete mode 100644 package/network/utils/comgt/files/directip-stop.gcom
 delete mode 100644 package/network/utils/comgt/files/directip.gcom
 delete mode 100644 package/network/utils/comgt/files/directip.sh
 delete mode 100644 package/network/utils/comgt/files/evdo.chat
 delete mode 100644 package/network/utils/comgt/files/getcardinfo.gcom
 delete mode 100644 package/network/utils/comgt/files/getcarrier.gcom
 delete mode 100644 package/network/utils/comgt/files/getcnum.gcom
 delete mode 100644 package/network/utils/comgt/files/getimsi.gcom
 delete mode 100644 package/network/utils/comgt/files/getstrength.gcom
 delete mode 100644 package/network/utils/comgt/files/ncm.json
 delete mode 100644 package/network/utils/comgt/files/ncm.sh
 delete mode 100644 package/network/utils/comgt/files/runcommand.gcom
 delete mode 100644 package/network/utils/comgt/files/setmode.gcom
 delete mode 100644 package/network/utils/comgt/files/setpin.gcom
 delete mode 100644 package/network/utils/comgt/files/ussd.gcom
 delete mode 100644 package/network/utils/comgt/patches/001-compile_fix.patch
 delete mode 100644 package/network/utils/comgt/patches/002-termios.patch
 delete mode 100644 package/network/utils/comgt/patches/003-no_XCASE.patch
 delete mode 100644 package/network/utils/comgt/patches/004-check_tty.patch

diff --git a/package/network/utils/comgt/Makefile b/package/network/utils/comgt/Makefile
deleted file mode 100644
index db5ea57473..0000000000
--- a/package/network/utils/comgt/Makefile
+++ /dev/null
@@ -1,106 +0,0 @@
-#
-# Copyright (C) 2006-2014 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=comgt
-PKG_VERSION:=0.32
-PKG_RELEASE:=33
-
-PKG_SOURCE:=$(PKG_NAME).$(PKG_VERSION).tgz
-PKG_SOURCE_URL:=@SF/comgt
-PKG_HASH:=0cedb2a5aa608510da66a99aab74df3db363df495032e57e791a2ff55f1d7913
-
-PKG_MAINTAINER:=Felix Fietkau <nbd at nbd.name>
-PKG_LICENSE:=GPL-2.0+
-
-PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME).$(PKG_VERSION)
-PKG_CHECK_FORMAT_SECURITY:=0
-
-PKG_FLAGS:=nonshared
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/comgt/Default
-  SECTION:=net
-  CATEGORY:=Network
-  SUBMENU:=WWAN
-endef
-
-define Package/comgt
-$(call Package/comgt/Default)
-  TITLE:=Option/Vodafone 3G/GPRS control tool
-  DEPENDS:=+chat
-  URL:=http://manpages.ubuntu.com/manpages/trusty/man1/comgt.1.html
-endef
-
-define Package/comgt-directip
-$(call Package/comgt/Default)
-  TITLE:=Sierra Wireless Direct-IP support
-  DEPENDS:=+comgt +kmod-usb-serial +kmod-usb-serial-sierrawireless +kmod-usb-net +kmod-usb-net-sierrawireless
-endef
-
-define Package/comgt-ncm
-$(call Package/comgt/Default)
-  TITLE+=NCM 3G/4G Support
-  DEPENDS:=+comgt +wwan +kmod-usb-serial-option +kmod-usb-net-huawei-cdc-ncm
-endef
-
-define Package/comgt/description
- comgt is a scripting language interpreter useful for establishing 
- communications on serial lines and through PCMCIA modems as well as GPRS 
- and 3G datacards.
-endef
-
-define Build/Compile
-	$(MAKE) -C $(PKG_BUILD_DIR) \
-		$(TARGET_CONFIGURE_OPTS) \
-		CFLAGS="$(TARGET_CFLAGS)" \
-		LDFLAGS="" \
-		comgt
-endef
-
-define Package/comgt/install
-	$(INSTALL_DIR) $(1)/usr/bin
-	$(INSTALL_BIN) $(PKG_BUILD_DIR)/comgt $(1)/usr/bin/
-	$(LN) comgt $(1)/usr/bin/gcom
-	$(INSTALL_DIR) $(1)/etc/chatscripts
-	$(INSTALL_DATA) ./files/3g.chat $(1)/etc/chatscripts/3g.chat
-	$(INSTALL_DATA) ./files/evdo.chat $(1)/etc/chatscripts/evdo.chat
-	$(INSTALL_DIR) $(1)/etc/gcom
-	$(INSTALL_DATA) ./files/setpin.gcom $(1)/etc/gcom/setpin.gcom
-	$(INSTALL_DATA) ./files/setmode.gcom $(1)/etc/gcom/setmode.gcom
-	$(INSTALL_DATA) ./files/getcardinfo.gcom $(1)/etc/gcom/getcardinfo.gcom
-	$(INSTALL_DATA) ./files/getstrength.gcom $(1)/etc/gcom/getstrength.gcom
-	$(INSTALL_DATA) ./files/getcarrier.gcom $(1)/etc/gcom/getcarrier.gcom
-	$(INSTALL_DATA) ./files/getcnum.gcom $(1)/etc/gcom/getcnum.gcom
-	$(INSTALL_DATA) ./files/getimsi.gcom $(1)/etc/gcom/getimsi.gcom
-	$(INSTALL_DIR) $(1)/etc/hotplug.d/tty
-	$(INSTALL_CONF) ./files/3g.usb $(1)/etc/hotplug.d/tty/30-3g
-	$(INSTALL_DIR) $(1)/lib/netifd/proto
-	$(INSTALL_BIN) ./files/3g.sh $(1)/lib/netifd/proto/3g.sh
-endef
-
-define Package/comgt-directip/install
-	$(INSTALL_DIR) $(1)/etc/gcom
-	$(INSTALL_DATA) ./files/directip.gcom $(1)/etc/gcom/directip.gcom
-	$(INSTALL_DATA) ./files/directip-stop.gcom $(1)/etc/gcom/directip-stop.gcom
-	$(INSTALL_DIR) $(1)/lib/netifd/proto
-	$(INSTALL_BIN) ./files/directip.sh $(1)/lib/netifd/proto/directip.sh
-endef
-
-define Package/comgt-ncm/install
-	$(INSTALL_DIR) $(1)/etc/gcom
-	$(INSTALL_DATA) ./files/ncm.json $(1)/etc/gcom/ncm.json
-	$(INSTALL_DATA) ./files/runcommand.gcom $(1)/etc/gcom/runcommand.gcom
-	$(INSTALL_DIR) $(1)/lib/netifd/proto
-	$(INSTALL_BIN) ./files/ncm.sh $(1)/lib/netifd/proto/ncm.sh
-endef
-
-$(eval $(call BuildPackage,comgt))
-$(eval $(call BuildPackage,comgt-directip))
-$(eval $(call BuildPackage,comgt-ncm))
diff --git a/package/network/utils/comgt/files/3g.chat b/package/network/utils/comgt/files/3g.chat
deleted file mode 100644
index 66562400f0..0000000000
--- a/package/network/utils/comgt/files/3g.chat
+++ /dev/null
@@ -1,12 +0,0 @@
-ABORT   BUSY
-ABORT   'NO CARRIER'
-ABORT   ERROR
-REPORT  CONNECT
-TIMEOUT 10
-""      "AT&F"
-OK      "ATE1"
-OK      'AT+CGDCONT=1,"IP","$USE_APN"'
-SAY     "Calling UMTS/GPRS"
-TIMEOUT 30
-OK      "ATD$DIALNUMBER"
-CONNECT ' '
diff --git a/package/network/utils/comgt/files/3g.sh b/package/network/utils/comgt/files/3g.sh
deleted file mode 100644
index 9220cbf5a0..0000000000
--- a/package/network/utils/comgt/files/3g.sh
+++ /dev/null
@@ -1,116 +0,0 @@
-#!/bin/sh
-
-[ -n "$INCLUDE_ONLY" ] || {
-	NOT_INCLUDED=1
-	INCLUDE_ONLY=1
-
-	. ../netifd-proto.sh
-	. ./ppp.sh
-	init_proto "$@"
-}
-
-proto_3g_init_config() {
-	no_device=1
-	available=1
-	ppp_generic_init_config
-	proto_config_add_string "device:device"
-	proto_config_add_string "apn"
-	proto_config_add_string "service"
-	proto_config_add_string "pincode"
-	proto_config_add_string "delay"
-	proto_config_add_string "dialnumber"
-}
-
-proto_3g_setup() {
-	local interface="$1"
-	local chat
-
-	json_get_var device device
-	json_get_var apn apn
-	json_get_var service service
-	json_get_var pincode pincode
-	json_get_var dialnumber dialnumber
-	json_get_var delay delay
-
-	[ -n "$dat_device" ] && device=$dat_device
-
-	device="$(readlink -f $device)"
-	[ -e "$device" ] || {
-		proto_set_available "$interface" 0
-		return 1
-	}
-
-	[ -n "$delay" ] && sleep "$delay"
-
-	case "$service" in
-		cdma|evdo)
-			chat="/etc/chatscripts/evdo.chat"
-		;;
-		*)
-			chat="/etc/chatscripts/3g.chat"
-			cardinfo=$(gcom -d "$device" -s /etc/gcom/getcardinfo.gcom)
-			if echo "$cardinfo" | grep -q Novatel; then
-				case "$service" in
-					umts_only) CODE=2;;
-					gprs_only) CODE=1;;
-					*) CODE=0;;
-				esac
-				export MODE="AT\$NWRAT=${CODE},2"
-			elif echo "$cardinfo" | grep -q Option; then
-				case "$service" in
-					umts_only) CODE=1;;
-					gprs_only) CODE=0;;
-					*) CODE=3;;
-				esac
-				export MODE="AT_OPSYS=${CODE}"
-			elif echo "$cardinfo" | grep -q "Sierra Wireless"; then
-				SIERRA=1
-			elif echo "$cardinfo" | grep -qi huawei; then
-				case "$service" in
-					umts_only) CODE="14,2";;
-					gprs_only) CODE="13,1";;
-					*) CODE="2,2";;
-				esac
-				export MODE="AT^SYSCFG=${CODE},3FFFFFFF,2,4"
-			fi
-
-			if [ -n "$pincode" ]; then
-				PINCODE="$pincode" gcom -d "$device" -s /etc/gcom/setpin.gcom || {
-					proto_notify_error "$interface" PIN_FAILED
-					proto_block_restart "$interface"
-					return 1
-				}
-			fi
-			[ -n "$MODE" ] && gcom -d "$device" -s /etc/gcom/setmode.gcom
-
-			# wait for carrier to avoid firmware stability bugs
-			[ -n "$SIERRA" ] && {
-				gcom -d "$device" -s /etc/gcom/getcarrier.gcom || return 1
-			}
-
-			if [ -z "$dialnumber" ]; then
-				dialnumber="*99***1#"
-			fi
-
-		;;
-	esac
-
-	connect="${apn:+USE_APN=$apn }DIALNUMBER=$dialnumber /usr/sbin/chat -t5 -v -E -f $chat"
-	ppp_generic_setup "$interface" \
-		noaccomp \
-		nopcomp \
-		novj \
-		nobsdcomp \
-		noauth \
-		set EXTENDPREFIX=1 \
-		lock \
-		crtscts \
-		115200 "$device"
-	return 0
-}
-
-proto_3g_teardown() {
-	proto_kill_command "$interface"
-}
-
-[ -z "$NOT_INCLUDED" ] || add_protocol 3g
diff --git a/package/network/utils/comgt/files/3g.usb b/package/network/utils/comgt/files/3g.usb
deleted file mode 100644
index 8f0d62ca83..0000000000
--- a/package/network/utils/comgt/files/3g.usb
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/sh
-. /lib/functions.sh
-. /lib/netifd/netifd-proto.sh
-
-find_3g_iface() {
-	local cfg="$1"
-	local tty="$2"
-
-	local proto
-	config_get proto "$cfg" proto
-	[ "$proto" = 3g ] || [ "$proto" = ncm ] || return 0
-
-	# bypass state vars here because 00-netstate could clobber .device
-	local dev=$(uci_get network "$cfg" device)
-
-	if [ "${dev##*/}" = "${tty##*/}" ]; then
-		if [ "$ACTION" = add ]; then
-			proto_set_available "$cfg" 1
-		fi
-		if [ "$ACTION" = remove ]; then
-			proto_set_available "$cfg" 0
-		fi
-	fi
-}
-
-case "$DEVICENAME" in
-	tty*)
-		[ -e "/dev/$DEVICENAME" ] || [ "$ACTION" = remove ] || exit 0
-		config_load network
-		config_foreach find_3g_iface interface "/dev/$DEVICENAME"
-	;;
-esac
-
diff --git a/package/network/utils/comgt/files/directip-stop.gcom b/package/network/utils/comgt/files/directip-stop.gcom
deleted file mode 100644
index 1c14863734..0000000000
--- a/package/network/utils/comgt/files/directip-stop.gcom
+++ /dev/null
@@ -1,16 +0,0 @@
-opengt
-set com 115200n81
-set comecho off
-set senddelay 0.05
-waitquiet 1 0.2
-
-:start
- send "AT!SCACT=0,3^m"
- waitfor 5 "OK"
- if % = 0 goto hangupok
- print "WWAN error. Hangup failed.\r\n"
- exit 1
-
-:hangupok
- print "WWAN connection established.\r\n"
- exit 0
diff --git a/package/network/utils/comgt/files/directip.gcom b/package/network/utils/comgt/files/directip.gcom
deleted file mode 100644
index 9a772a90f7..0000000000
--- a/package/network/utils/comgt/files/directip.gcom
+++ /dev/null
@@ -1,55 +0,0 @@
-opengt
-set com 115200n81
-set comecho off
-set senddelay 0.05
-waitquiet 1 0.2
-
-:start
- if $env("USE_AUTH") = "0" goto connect
- send "AT$QCPDPP=3,"
- send $env("USE_AUTH")
- send ",\""
- if $env("USE_USER") <> "" send $env("USE_USER")
- send "\",\""
- if $env("USE_PASS") <> "" send $env("USE_PASS")
- send "\"^m"
- waitfor 5 "OK"
- if % = 0 goto connect
- print "WWAN error. Auth failed.\r\n"
- exit 1
-
-:connect
- send "AT+CFUN=1^m"
- send "AT+CGDCONT=3,\"IP\",\""
- send $env("USE_APN")
- send "\"^m"
- waitfor 5 "OK"
- if % = 0 goto connok
- print "WWAN error. Connection failed.\r\n"
- exit 1
-
-:connok
- let c=1
-:loop
- sleep 2
- send "AT+CGATT?^m"
- waitfor 5 "+CGATT: 1"
- if % = 0 goto carrierok
- if c > 10 goto carriererr
- inc c
- goto loop
-
-:carriererr
- print "WWAN error. No carrier.\r\n"
- exit 1
-
-:carrierok
- send "AT!SCACT=1,3^m"
- waitfor 5 "OK"
- if % = 0 goto dialok
- print "WWAN error. Dialing failed.\r\n"
- exit 1
-
-:dialok
- print "WWAN connection established.\r\n"
- exit 0
diff --git a/package/network/utils/comgt/files/directip.sh b/package/network/utils/comgt/files/directip.sh
deleted file mode 100644
index 3452fa5db7..0000000000
--- a/package/network/utils/comgt/files/directip.sh
+++ /dev/null
@@ -1,114 +0,0 @@
-#!/bin/sh
-
-[ -n "$INCLUDE_ONLY" ] || {
-	. /lib/functions.sh
-	. ../netifd-proto.sh
-	init_proto "$@"
-}
-
-proto_directip_init_config() {
-	available=1
-	no_device=1
-	proto_config_add_string "device:device"
-	proto_config_add_string "apn"
-	proto_config_add_string "pincode"
-	proto_config_add_string "auth"
-	proto_config_add_string "username"
-	proto_config_add_string "password"
-	proto_config_add_defaults
-}
-
-proto_directip_setup() {
-	local interface="$1"
-	local chat devpath devname
-
-	local device apn pincode ifname auth username password $PROTO_DEFAULT_OPTIONS
-	json_get_vars device apn pincode auth username password $PROTO_DEFAULT_OPTIONS
-
-	[ -n "$ctl_device" ] && device=$ctl_device
-
-	device="$(readlink -f $device)"
-	[ -e "$device" ] || {
-		proto_notify_error "$interface" NO_DEVICE
-		proto_set_available "$interface" 0
-		return 1
-	}
-
-	devname="$(basename "$device")"
-	devpath="$(readlink -f /sys/class/tty/$devname/device)"
-	ifname="$( ls "$devpath"/../../*/net )"
-
-	[ -n "$ifname" ] || {
-		proto_notify_error "$interface" NO_IFNAME
-		proto_set_available "$interface" 0
-		return 1
-	}
-
-	gcom -d "$device" -s /etc/gcom/getcardinfo.gcom | grep -q "Sierra Wireless" || {
-		proto_notify_error "$interface" BAD_DEVICE
-		proto_block_restart "$interface"
-		return 1
-	}
-
-	if [ -n "$pincode" ]; then
-		PINCODE="$pincode" gcom -d "$device" -s /etc/gcom/setpin.gcom || {
-			proto_notify_error "$interface" PIN_FAILED
-			proto_block_restart "$interface"
-			return 1
-		}
-	fi
-	# wait for carrier to avoid firmware stability bugs
-	gcom -d "$device" -s /etc/gcom/getcarrier.gcom || return 1
-
-	local auth_type=0
-	case $auth in
-	pap) auth_type=1;;
-	chap) auth_type=2;;
-	esac
-
-	USE_APN="$apn" USE_USER="$username" USE_PASS="$password" USE_AUTH="$auth_type" \
-			gcom -d "$device" -s /etc/gcom/directip.gcom || {
-		proto_notify_error "$interface" CONNECT_FAILED
-		proto_block_restart "$interface"
-		return 1
-	}
-
-	logger -p daemon.info -t "directip[$$]" "Connected, starting DHCP"
-	proto_init_update "$ifname" 1
-	proto_send_update "$interface"
-
-	json_init
-	json_add_string name "${interface}_4"
-	json_add_string ifname "@$interface"
-	json_add_string proto "dhcp"
-	proto_add_dynamic_defaults
-	ubus call network add_dynamic "$(json_dump)"
-
-	json_init
-	json_add_string name "${interface}_6"
-	json_add_string ifname "@$interface"
-	json_add_string proto "dhcpv6"
-	json_add_string extendprefix 1
-	proto_add_dynamic_defaults
-	ubus call network add_dynamic "$(json_dump)"
-
-	return 0
-}
-
-proto_directip_teardown() {
-	local interface="$1"
-
-	local device
-	json_get_vars device
-
-	[ -n "$ctl_device" ] && device=$ctl_device
-
-	gcom -d "$device" -s /etc/gcom/directip-stop.gcom || proto_notify_error "$interface" CONNECT_FAILED
-
-	proto_init_update "*" 0
-	proto_send_update "$interface"
-}
-
-[ -n "$INCLUDE_ONLY" ] || {
-	add_protocol directip
-}
diff --git a/package/network/utils/comgt/files/evdo.chat b/package/network/utils/comgt/files/evdo.chat
deleted file mode 100644
index de49e41a1b..0000000000
--- a/package/network/utils/comgt/files/evdo.chat
+++ /dev/null
@@ -1,17 +0,0 @@
-# This is a simple chat script based off of the one provided by Sierra Wireless
-# for CDMA connections.  It should work for both Sprint and Verizon networks.
-
-ABORT	BUSY
-ABORT 	'NO CARRIER'
-ABORT	ERROR
-ABORT 	'NO DIAL TONE'
-ABORT 	'NO ANSWER'
-ABORT 	DELAYED
-REPORT	CONNECT
-TIMEOUT	10
-'' 		AT
-OK 		ATZ
-SAY     'Calling CDMA/EVDO'
-TIMEOUT	30
-OK		ATDT#777
-CONNECT	''
diff --git a/package/network/utils/comgt/files/getcardinfo.gcom b/package/network/utils/comgt/files/getcardinfo.gcom
deleted file mode 100644
index f91665f72e..0000000000
--- a/package/network/utils/comgt/files/getcardinfo.gcom
+++ /dev/null
@@ -1,14 +0,0 @@
-opengt
- set com 115200n81
- set comecho off
- set senddelay 0.02
- waitquiet 0.2 0.2
- flash 0.1
-
-:start
- send "AT+CGMI^m"
- get 1 "" $s
- print $s
-
-:continue
- exit 0
diff --git a/package/network/utils/comgt/files/getcarrier.gcom b/package/network/utils/comgt/files/getcarrier.gcom
deleted file mode 100644
index 1e0216d46a..0000000000
--- a/package/network/utils/comgt/files/getcarrier.gcom
+++ /dev/null
@@ -1,20 +0,0 @@
-opengt
-  set senddelay 0.05
-  waitquiet 1 0.2
-  let c=1
- :loop
-    inc c
-    send "AT+CGATT?^m"
-    waitfor 5 "+CGATT: 1","+CGATT: 0"
-    print "\n."
-    if % = -1 goto error
-    if c > 10 goto toolong
-    if % = 0 goto out
-    sleep 2
-    if % = 1 goto loop
-  :toolong
-  exit 1
-  :error
-  exit 0
-  :out
- exit 0
diff --git a/package/network/utils/comgt/files/getcnum.gcom b/package/network/utils/comgt/files/getcnum.gcom
deleted file mode 100644
index 450cf8c413..0000000000
--- a/package/network/utils/comgt/files/getcnum.gcom
+++ /dev/null
@@ -1,20 +0,0 @@
-opengt
- set com 115200n81
- set comecho off
- set senddelay 0.02
- waitquiet 0.2 0.2
- flash 0.1
-
-:start
- send "AT+CNUM^m"
- get 1 "^m" $n
- get 1 ":" $n
- get 1 "\"" $n
- get 1 "\"" $n
- get 1 "\"" $n
- get 1 "\"" $n
- let n = len($n)
- if n<1 goto continue
- print $n
-:continue
- exit 0
diff --git a/package/network/utils/comgt/files/getimsi.gcom b/package/network/utils/comgt/files/getimsi.gcom
deleted file mode 100644
index 04854561b1..0000000000
--- a/package/network/utils/comgt/files/getimsi.gcom
+++ /dev/null
@@ -1,17 +0,0 @@
-opengt
- set com 115200n81
- set comecho off
- set senddelay 0.02
- waitquiet 0.2 0.2
- flash 0.1
-
-:start
- send "AT+CIMI^m"
- get 1 "^m" $s
- get 1 "^m" $s
- let x = len($s)
- if x<2 goto continue
- let $s = $right($s, x-1)
- print $s
-:continue
- exit 0
diff --git a/package/network/utils/comgt/files/getstrength.gcom b/package/network/utils/comgt/files/getstrength.gcom
deleted file mode 100644
index 2886285971..0000000000
--- a/package/network/utils/comgt/files/getstrength.gcom
+++ /dev/null
@@ -1,14 +0,0 @@
-opengt
- set com 115200n81
- set comecho off
- set senddelay 0.02
- waitquiet 0.2 0.2
- flash 0.1
-
-:start
- send "AT+CSQ^m"
- get 1 "" $s
- print $s
-
-:continue
- exit 0
diff --git a/package/network/utils/comgt/files/ncm.json b/package/network/utils/comgt/files/ncm.json
deleted file mode 100644
index bbdb30c5ee..0000000000
--- a/package/network/utils/comgt/files/ncm.json
+++ /dev/null
@@ -1,78 +0,0 @@
-{
-	"huawei": {
-		"initialize": [
-			"AT",
-			"ATZ",
-			"ATQ0",
-			"ATV1",
-			"ATE1",
-			"ATS0=0",
-			"AT+CGDCONT=${profile},\\\"${pdptype}\\\"${apn:+,\\\"$apn\\\"}"
-		],
-		"modes": {
-			"preferlte": "AT^SYSCFGEX=\\\"030201\\\",3fffffff,2,4,7fffffffffffffff,,",
-			"preferumts": "AT^SYSCFGEX=\\\"0201\\\",3fffffff,2,4,7fffffffffffffff,,",
-			"lte": "AT^SYSCFGEX=\\\"03\\\",3fffffff,2,4,7fffffffffffffff,,",
-			"umts": "AT^SYSCFGEX=\\\"02\\\",3fffffff,2,4,7fffffffffffffff,,",
-			"gsm": "AT^SYSCFGEX=\\\"01\\\",3fffffff,2,4,7fffffffffffffff,,",
-			"auto": "AT^SYSCFGEX=\\\"00\\\",3fffffff,2,4,7fffffffffffffff,,"
-		},
-		"connect": "AT^NDISDUP=${profile},1${apn:+,\\\"$apn\\\"}${username:+,\\\"$username\\\"}${password:+,\\\"$password\\\"}${auth:+,$auth}",
-		"disconnect": "AT^NDISDUP=${profile},0"
-	},
-	"samsung": {
-		"initialize": [
-			"AT",
-			"AT+CGREG=2",
-			"AT+CFUN=5",
-			"AT+MODESELECT=3",
-			"AT+CGDCONT=${profile},\\\"${pdptype}\\\"${apn:+,\\\"$apn\\\"}"
-		],
-		"modes": {
-			"umts": "AT+CHANGEALLPATH=1"
-		},
-		"connect": "AT+CGATT=1",
-		"disconnect": "AT+CGATT=0"
-	},
-	"sierra": {
-		"initialize": [
-			"AT+CFUN=1",
-			"AT+CGDCONT=${profile},\\\"${pdptype}\\\"${apn:+,\\\"$apn\\\"}",
-			"AT$QCPDPP=${profile},${auth:-0}${password:+,\\\"$password\\\"}${username:+,\\\"$username\\\"}"
-		],
-		"modes": {
-			"preferlte": "AT!SELRAT=07",
-			"preferumts": "AT!SELRAT=05",
-			"lte": "AT!SELRAT=06",
-			"umts": "AT!SELRAT=01",
-			"gsm": "AT!SELRAT=02",
-			"auto": "AT!SELRAT=00"
-		},
-		"connect": "AT!SCACT=1,${profile}",
-		"disconnect": "AT!SCACT=0,${profile}"
-	},
-	"sony": {
-		"initialize": [
-			"AT+CFUN=1",
-			"AT+CGDCONT=${profile},\\\"${pdptype}\\\"${apn:+,\\\"$apn\\\"}",
-			"AT*EIAAUW=${profile},1,\\\"${username}\\\",\\\"${password}\\\",${auth:-00111}"
-		],
-		"modes": {
-			"umts": "AT+CFUN=6",
-			"gsm": "AT+CFUN=5"
-		},
-		"connect": "AT*ENAP=1,${profile}",
-		"disconnect": "AT*ENAP=0"
-	},
-	"mtk1": {
-		"initialize": [
-			"AT+CFUN=1"
-		],
-		"configure": [
-			"AT+CGDCONT=${profile},\\\"${pdptype}\\\",\\\"${apn}\\\",0,0"
-		],
-		"connect": "AT+CGACT=1,${profile}",
-		"finalize": "AT+CGDATA=\\\"M-MBIM\\\",${profile},1",
-		"disconnect": "AT+CGACT=0,${profile}"
-	}
-}
diff --git a/package/network/utils/comgt/files/ncm.sh b/package/network/utils/comgt/files/ncm.sh
deleted file mode 100644
index 6545091c82..0000000000
--- a/package/network/utils/comgt/files/ncm.sh
+++ /dev/null
@@ -1,255 +0,0 @@
-#!/bin/sh
-
-[ -n "$INCLUDE_ONLY" ] || {
-	. /lib/functions.sh
-	. ../netifd-proto.sh
-	init_proto "$@"
-}
-
-proto_ncm_init_config() {
-	no_device=1
-	available=1
-	proto_config_add_string "device:device"
-	proto_config_add_string apn
-	proto_config_add_string auth
-	proto_config_add_string username
-	proto_config_add_string password
-	proto_config_add_string pincode
-	proto_config_add_string delay
-	proto_config_add_string mode
-	proto_config_add_string pdptype
-	proto_config_add_int profile
-	proto_config_add_defaults
-}
-
-proto_ncm_setup() {
-	local interface="$1"
-
-	local manufacturer initialize setmode connect finalize ifname devname devpath
-
-	local device apn auth username password pincode delay mode pdptype profile $PROTO_DEFAULT_OPTIONS
-	json_get_vars device apn auth username password pincode delay mode pdptype profile $PROTO_DEFAULT_OPTIONS
-
-	[ "$metric" = "" ] && metric="0"
-
-	[ -n "$profile" ] || profile=1
-
-	pdptype=$(echo "$pdptype" | awk '{print toupper($0)}')
-	[ "$pdptype" = "IP" -o "$pdptype" = "IPV6" -o "$pdptype" = "IPV4V6" ] || pdptype="IP"
-
-	[ -n "$ctl_device" ] && device=$ctl_device
-
-	[ -n "$device" ] || {
-		echo "No control device specified"
-		proto_notify_error "$interface" NO_DEVICE
-		proto_set_available "$interface" 0
-		return 1
-	}
-
-	device="$(readlink -f $device)"
-	[ -e "$device" ] || {
-		echo "Control device not valid"
-		proto_set_available "$interface" 0
-		return 1
-	}
-
-	devname="$(basename "$device")"
-	case "$devname" in
-	'tty'*)
-		devpath="$(readlink -f /sys/class/tty/$devname/device)"
-		ifname="$( ls "$devpath"/../../*/net )"
-		;;
-	*)
-		devpath="$(readlink -f /sys/class/usbmisc/$devname/device/)"
-		ifname="$( ls "$devpath"/net )"
-		;;
-	esac
-	[ -n "$ifname" ] || {
-		echo "The interface could not be found."
-		proto_notify_error "$interface" NO_IFACE
-		proto_set_available "$interface" 0
-		return 1
-	}
-
-	[ -n "$delay" ] && sleep "$delay"
-
-	manufacturer=$(gcom -d "$device" -s /etc/gcom/getcardinfo.gcom | awk 'NF && $0 !~ /AT\+CGMI/ { sub(/\+CGMI: /,""); print tolower($1); exit; }')
-	[ $? -ne 0 -o -z "$manufacturer" ] && {
-		echo "Failed to get modem information"
-		proto_notify_error "$interface" GETINFO_FAILED
-		return 1
-	}
-
-	json_load "$(cat /etc/gcom/ncm.json)"
-	json_select "$manufacturer"
-	[ $? -ne 0 ] && {
-		echo "Unsupported modem"
-		proto_notify_error "$interface" UNSUPPORTED_MODEM
-		proto_set_available "$interface" 0
-		return 1
-	}
-
-	json_get_values initialize initialize
-	for i in $initialize; do
-		eval COMMAND="$i" gcom -d "$device" -s /etc/gcom/runcommand.gcom || {
-			echo "Failed to initialize modem"
-			proto_notify_error "$interface" INITIALIZE_FAILED
-			return 1
-		}
-	done
-
-	[ -n "$pincode" ] && {
-		PINCODE="$pincode" gcom -d "$device" -s /etc/gcom/setpin.gcom || {
-			echo "Unable to verify PIN"
-			proto_notify_error "$interface" PIN_FAILED
-			proto_block_restart "$interface"
-			return 1
-		}
-	}
-
-	json_get_values configure configure
-	echo "Configuring modem"
-	for i in $configure; do
-		eval COMMAND="$i" gcom -d "$device" -s /etc/gcom/runcommand.gcom || {
-			echo "Failed to configure modem"
-			proto_notify_error "$interface" CONFIGURE_FAILED
-			return 1
-		}
-	done
-
-	[ -n "$mode" ] && {
-		json_select modes
-		json_get_var setmode "$mode"
-		[ -n "$setmode" ] && {
-			echo "Setting mode"
-			eval COMMAND="$setmode" gcom -d "$device" -s /etc/gcom/runcommand.gcom || {
-				echo "Failed to set operating mode"
-				proto_notify_error "$interface" SETMODE_FAILED
-				return 1
-			}
-		}
-		json_select ..
-	}
-
-	echo "Starting network $interface"
-	json_get_vars connect
-	[ -n "$connect" ] && {
-		echo "Connecting modem"
-		eval COMMAND="$connect" gcom -d "$device" -s /etc/gcom/runcommand.gcom || {
-			echo "Failed to connect"
-			proto_notify_error "$interface" CONNECT_FAILED
-			return 1
-		}
-	}
-
-	json_get_vars finalize
-
-	echo "Setting up $ifname"
-	proto_init_update "$ifname" 1
-	proto_add_data
-	json_add_string "manufacturer" "$manufacturer"
-	proto_close_data
-	proto_send_update "$interface"
-
-	local zone="$(fw3 -q network "$interface" 2>/dev/null)"
-
-	[ "$pdptype" = "IP" -o "$pdptype" = "IPV4V6" ] && {
-		json_init
-		json_add_string name "${interface}_4"
-		json_add_string ifname "@$interface"
-		json_add_string proto "dhcp"
-		proto_add_dynamic_defaults
-		[ -n "$zone" ] && {
-			json_add_string zone "$zone"
-		}
-		json_close_object
-		ubus call network add_dynamic "$(json_dump)"
-	}
-
-	[ "$pdptype" = "IPV6" -o "$pdptype" = "IPV4V6" ] && {
-		json_init
-		json_add_string name "${interface}_6"
-		json_add_string ifname "@$interface"
-		json_add_string proto "dhcpv6"
-		json_add_string extendprefix 1
-		proto_add_dynamic_defaults
-		[ -n "$zone" ] && {
-			json_add_string zone "$zone"
-		}
-		json_close_object
-		ubus call network add_dynamic "$(json_dump)"
-	}
-
-	[ -n "$finalize" ] && {
-		eval COMMAND="$finalize" gcom -d "$device" -s /etc/gcom/runcommand.gcom || {
-			echo "Failed to configure modem"
-			proto_notify_error "$interface" FINALIZE_FAILED
-			return 1
-		}
-	}
-}
-
-proto_ncm_teardown() {
-	local interface="$1"
-
-	local manufacturer disconnect
-
-	local device profile
-	json_get_vars device profile
-
-	[ -n "$ctl_device" ] && device=$ctl_device
-
-	[ -n "$device" ] || {
-		echo "No control device specified"
-		proto_notify_error "$interface" NO_DEVICE
-		proto_set_available "$interface" 0
-		return 1
-	}
-
-	device="$(readlink -f $device)"
-	[ -e "$device" ] || {
-		echo "Control device not valid"
-		proto_set_available "$interface" 0
-		return 1
-	}
-
-	[ -n "$profile" ] || profile=1
-
-	echo "Stopping network $interface"
-
-	json_load "$(ubus call network.interface.$interface status)"
-	json_select data
-	json_get_vars manufacturer
-	[ $? -ne 0 -o -z "$manufacturer" ] && {
-		# Fallback to direct detect, for proper handle device replug.
-		manufacturer=$(gcom -d "$device" -s /etc/gcom/getcardinfo.gcom | awk 'NF && $0 !~ /AT\+CGMI/ { sub(/\+CGMI: /,""); print tolower($1); exit; }')
-		[ $? -ne 0 -o -z "$manufacturer" ] && {
-			echo "Failed to get modem information"
-			proto_notify_error "$interface" GETINFO_FAILED
-			return 1
-		}
-		json_add_string "manufacturer" "$manufacturer"
-	}
-
-	json_load "$(cat /etc/gcom/ncm.json)"
-	json_select "$manufacturer" || {
-		echo "Unsupported modem"
-		proto_notify_error "$interface" UNSUPPORTED_MODEM
-		return 1
-	}
-
-	json_get_vars disconnect
-	[ -n "$disconnect" ] && {
-		eval COMMAND="$disconnect" gcom -d "$device" -s /etc/gcom/runcommand.gcom || {
-			echo "Failed to disconnect"
-			proto_notify_error "$interface" DISCONNECT_FAILED
-			return 1
-		}
-	}
-
-	proto_init_update "*" 0
-	proto_send_update "$interface"
-}
-[ -n "$INCLUDE_ONLY" ] || {
-	add_protocol ncm
-}
diff --git a/package/network/utils/comgt/files/runcommand.gcom b/package/network/utils/comgt/files/runcommand.gcom
deleted file mode 100644
index 88a9d29dc1..0000000000
--- a/package/network/utils/comgt/files/runcommand.gcom
+++ /dev/null
@@ -1,31 +0,0 @@
-# run AT-command from environment
-opengt
- set com 115200n81
- set senddelay 0.02
- waitquiet 1 0.2
- flash 0.1
-
-:start
- print "sending -> ",$env("COMMAND"),"\n"
- send $env("COMMAND")
- send "^m"
-
- waitfor 25 "OK","ERR","ERROR","COMMAND NOT SUPPORT"
- if % = 0 goto continue
- if % = 1 goto error
- if % = 2 goto error
- if % = 3 goto notsupported
-
- print "Timeout running AT-command\n"
- exit 1
-
-:error
- print "Error running AT-command\n"
- exit 1
-
-:notsupported
- print "AT-command not supported\n"
- exit 1
-
-:continue
- exit 0
diff --git a/package/network/utils/comgt/files/setmode.gcom b/package/network/utils/comgt/files/setmode.gcom
deleted file mode 100644
index 4ce0b5fa78..0000000000
--- a/package/network/utils/comgt/files/setmode.gcom
+++ /dev/null
@@ -1,26 +0,0 @@
-# set wwan mode from environment
-opengt
- set com 115200n81
- set senddelay 0.02
- waitquiet 1 0.2
- flash 0.1
-
-:start
- print "Trying to set mode\n"
- send $env("MODE")
- send "^m"
-
- waitfor 15 "OK","ERR","ERROR"
- if % = 0 goto continue
- if % = 1 goto modeerror
- if % = 2 goto modeerror
-
- print "Timeout setting WWAN mode!\n"
- exit 1
-
-:modeerror
- print "Error setting WWAN mode!\n"
- exit 1
-
-:continue
- exit 0
diff --git a/package/network/utils/comgt/files/setpin.gcom b/package/network/utils/comgt/files/setpin.gcom
deleted file mode 100644
index a3f3402797..0000000000
--- a/package/network/utils/comgt/files/setpin.gcom
+++ /dev/null
@@ -1,56 +0,0 @@
-# set pin code from evnironment "$PINCODE"
-opengt
- set com 115200n81
- set senddelay 0.05
- waitquiet 3 0.5
- flash 0.1
-
- let c=0
-:start
- send "AT+CFUN=1^m"
- send "AT+CPIN?^m"
- waitfor 15 "SIM PUK","SIM PIN","READY","ERROR","ERR"
- if % = -1 goto timeout
- if % = 0 goto ready
- if % = 1 goto setpin
- if % = 2 goto ready
- if % = 3 goto checkrepeat
- if % = 4 goto checkrepeat
-
-:checkrepeat
- inc c
- if c>3 goto pinerror
- waitquiet 12 0.5
- goto start
-
-:timeout
- print "timeout checking for PIN."
- exit 1
-
-:ready
- print "SIM ready\n"
- goto continue
- exit 0
-
-:setpin
- # check if output was "SIM PIN2", that's ok.
- waitfor 1 "2"
- if % = 0 goto ready
-
- print "Trying to set PIN\n"
- send "AT+CPIN=\""
- send $env("PINCODE")
- send "\"^m"
-
- waitfor 20 "OK","ERR"
- if % = -1 goto pinerror
- if % = 0 goto continue
- if % = 1 goto pinerror
-
-:pinerror
- print "Error setting PIN, check card manually\n"
- exit 1
-
-:continue
- print "PIN set successfully\n"
- exit 0
diff --git a/package/network/utils/comgt/files/ussd.gcom b/package/network/utils/comgt/files/ussd.gcom
deleted file mode 100644
index c5be80b2d7..0000000000
--- a/package/network/utils/comgt/files/ussd.gcom
+++ /dev/null
@@ -1,21 +0,0 @@
-opengt
- set com 115200n81
- set comecho off
- set senddelay 0.02
- waitquiet 0.2 0.2
- flash 0.1
-
-:start
- send "AT+CUSD=1,"
- send $env("ussd")
- send ",15"
- send "^m"
- waitfor 120 "+CUSD:"
- if % = -1 goto timeout
- get 1 "^m" $s
- print $s
- exit 0
-
-:timeout
- print "ERROR: no USSD response, timeout.\n"
- exit 1
diff --git a/package/network/utils/comgt/patches/001-compile_fix.patch b/package/network/utils/comgt/patches/001-compile_fix.patch
deleted file mode 100644
index 15de850b73..0000000000
--- a/package/network/utils/comgt/patches/001-compile_fix.patch
+++ /dev/null
@@ -1,23 +0,0 @@
---- a/Makefile
-+++ b/Makefile
-@@ -32,6 +32,7 @@ SCRIPTPATH = /etc/comgt/
- SCRIPTSRC = ./scripts/
- BIN     = $(CPROG) 
- MANP	= comgt.1 sigmon.1
-+CC	= cc
- 
- CFLAGS  = -c
- LDFLAGS =
-@@ -70,10 +71,5 @@ clean:
- 	-rm *~
- 	-rm $(SCRIPTSRC)*~
- 
--
--comgt: comgt.o
--	cc comgt.o $(LDFLAGS) -o comgt
--
--comgt.o: comgt.c comgt.h
--	cc comgt.c $(CFLAGS) 
--
-+comgt:  comgt.c comgt.h
-+	$(CC) $(CFLAGS) -o comgt $< $(LDFLAGS)
diff --git a/package/network/utils/comgt/patches/002-termios.patch b/package/network/utils/comgt/patches/002-termios.patch
deleted file mode 100644
index 08f22d15d9..0000000000
--- a/package/network/utils/comgt/patches/002-termios.patch
+++ /dev/null
@@ -1,105 +0,0 @@
---- a/comgt.c
-+++ b/comgt.c
-@@ -30,7 +30,7 @@
- #include <stdio.h>
- #include <stdlib.h>
- #include <signal.h>
--#include <termio.h>
-+#include <termios.h>
- #include <fcntl.h>
- #include <unistd.h>
- #include <string.h>
-@@ -81,7 +81,7 @@ char token[MAXTOKEN];   /* For gettoken(
- char scriptfile[MAXPATH]; /* Script file name */
- char scriptfilepath[MAXPATH]; /* temp storage for full path */
- BOOL verbose=0; /* Log actions */
--struct termio cons, stbuf, svbuf;  /* termios: svbuf=before, stbuf=while */
-+struct termios cons, stbuf, svbuf;  /* termios: svbuf=before, stbuf=while */
- int comfd=0; /* Communication file descriptor.  Defaults to stdin. */
- char msg[STRINGL]; /* Massage messages here */
- int preturn,returns[MAXGOSUBS];
-@@ -172,7 +172,7 @@ void dotestkey(void) {
- 
- /* Exit after resetting terminal settings */
- void ext(long xtc) {
--  ioctl(1, TCSETA, &cons);
-+  ioctl(1, TCSETS, &cons);
-   exit(xtc);
- }
- 
-@@ -920,24 +920,24 @@ BOOL getonoroff(void) {
- void setcom(void) {
-   stbuf.c_cflag &= ~(CBAUD | CSIZE | CSTOPB | CLOCAL | PARENB);
-   stbuf.c_cflag |= (speed | bits | CREAD | clocal | parity | stopbits );
--  if (ioctl(comfd, TCSETA, &stbuf) < 0) {
-+  if (ioctl(comfd, TCSETS, &stbuf) < 0) {
-     serror("Can't ioctl set device",1);
-   }
- }
- 
- void doset(void) {
--  struct termio console;
-+  struct termios console;
-   int a,b;
-   gettoken();
-   if(strcmp(token,"echo")==0) {
-     a=0;
-     if(getonoroff()) a=ECHO|ECHOE;
--    if(ioctl(0, TCGETA, &console)<0) {
-+    if(ioctl(0, TCGETS, &console)<0) {
-       serror("Can't ioctl FD zero!\n",2);
-     }
-     console.c_lflag &= ~(ECHO | ECHOE);
-     console.c_lflag |= a;
--    ioctl(0, TCSETA, &console);
-+    ioctl(0, TCSETS, &console);
-   }
-   else if(strcmp(token,"senddelay")==0) {
-     senddelay=10000L*getdvalue();
-@@ -1224,7 +1224,7 @@ void doclose(void) {
-   if(strcmp(token,"hardcom")==0) {
-     if(comfd== -1) serror("Com device not open",1);
-     vmsg("Closing device");
--    if (ioctl(comfd, TCSETA, &svbuf) < 0) {
-+    if (ioctl(comfd, TCSETS, &svbuf) < 0) {
-       sprintf(msg,"Can't ioctl set device %s.\n",device);
-       serror(msg,1);
-     }
-@@ -1266,12 +1266,12 @@ void opengt(void) {
-       ext(1);
-     }
-   }
--  if (ioctl (comfd, TCGETA, &svbuf) < 0) {
-+  if (ioctl (comfd, TCGETS, &svbuf) < 0) {
-     sprintf(msg,"Can't control %s, please try again.\n",device);
-     serror(msg,1);
-   }
-   setenv("COMGTDEVICE",device,1);
--  ioctl(comfd, TCGETA, &stbuf);
-+  ioctl(comfd, TCGETS, &stbuf);
-   speed=stbuf.c_cflag & CBAUD;
-   if (high_speed == 0)  strcpy(cspeed,"115200");
-   else strcpy(cspeed,"57600");
-@@ -1303,11 +1303,11 @@ void opendevice(void) {
-   }
-   else comfd=0;
- 
--  if (ioctl (comfd, TCGETA, &svbuf) < 0) {
-+  if (ioctl (comfd, TCGETS, &svbuf) < 0) {
-     sprintf(msg,"Can't ioctl get device %s.\n",device);
-     serror(msg,1);
-   }
--  ioctl(comfd, TCGETA, &stbuf);
-+  ioctl(comfd, TCGETS, &stbuf);
-   speed=stbuf.c_cflag & CBAUD;
-   switch(speed) {
-     case B0: strcpy(cspeed,"0");break;
-@@ -1553,7 +1553,7 @@ int main(int argc,char **argv) {
-   skip_default=0;
-   filep=NULL;
-   scriptspace=4096;
--  ioctl(1, TCGETA, &cons);
-+  ioctl(1, TCGETS, &cons);
-   if((script=( char *)malloc(scriptspace))==NULL) {
-     serror("Could not malloc()",3);
-   }
diff --git a/package/network/utils/comgt/patches/003-no_XCASE.patch b/package/network/utils/comgt/patches/003-no_XCASE.patch
deleted file mode 100644
index f2060a8288..0000000000
--- a/package/network/utils/comgt/patches/003-no_XCASE.patch
+++ /dev/null
@@ -1,20 +0,0 @@
---- a/comgt.c
-+++ b/comgt.c
-@@ -1281,7 +1281,7 @@ void opengt(void) {
-   parity=stbuf.c_cflag & (PARENB | PARODD);
-   stbuf.c_iflag &= ~(IGNCR | ICRNL | IUCLC | INPCK | IXON | IXANY | IGNPAR );
-   stbuf.c_oflag &= ~(OPOST | OLCUC | OCRNL | ONLCR | ONLRET);
--  stbuf.c_lflag &= ~(ICANON | XCASE | ECHO | ECHOE | ECHONL);
-+  stbuf.c_lflag &= ~(ICANON | ECHO | ECHOE | ECHONL);
-   stbuf.c_lflag &= ~(ECHO | ECHOE);
-   stbuf.c_cc[VMIN] = 1;
-   stbuf.c_cc[VTIME] = 0;
-@@ -1336,7 +1336,7 @@ void opendevice(void) {
-   parity=stbuf.c_cflag & (PARENB | PARODD);
-   stbuf.c_iflag &= ~(IGNCR | ICRNL | IUCLC | INPCK | IXON | IXANY | IGNPAR );
-   stbuf.c_oflag &= ~(OPOST | OLCUC | OCRNL | ONLCR | ONLRET);
--  stbuf.c_lflag &= ~(ICANON | XCASE | ECHO | ECHOE | ECHONL);
-+  stbuf.c_lflag &= ~(ICANON | ECHO | ECHOE | ECHONL);
-   stbuf.c_lflag &= ~(ECHO | ECHOE);
-   stbuf.c_cc[VMIN] = 1;
-   stbuf.c_cc[VTIME] = 0;
diff --git a/package/network/utils/comgt/patches/004-check_tty.patch b/package/network/utils/comgt/patches/004-check_tty.patch
deleted file mode 100644
index fb1d9af4bb..0000000000
--- a/package/network/utils/comgt/patches/004-check_tty.patch
+++ /dev/null
@@ -1,68 +0,0 @@
---- a/comgt.c
-+++ b/comgt.c
-@@ -91,6 +91,7 @@ unsigned long hstart,hset;
- char NullString[]={ "" };
- BOOL lastcharnl=1; /* Indicate that last char printed from getonebyte
-                                was a nl, so no new one is needed */
-+BOOL tty=1;
- 
- 
- //"open com \"/dev/modem\"\nset com 38400n81\nset senddelay 0.05\nsend \"ATi^m\"\nget 2 \" ^m\" $s\nprint \"Response : \",$s,\"\\n\"\nget 2 \" ^m\" $s\nprint \"Response :\",$s,\"\\n\"\nget 2 \" ^m\" $s\nprint \"Response : \",$s,\"\\n\"\n\n";
-@@ -920,7 +921,7 @@ BOOL getonoroff(void) {
- void setcom(void) {
-   stbuf.c_cflag &= ~(CBAUD | CSIZE | CSTOPB | CLOCAL | PARENB);
-   stbuf.c_cflag |= (speed | bits | CREAD | clocal | parity | stopbits );
--  if (ioctl(comfd, TCSETS, &stbuf) < 0) {
-+  if (tty && ioctl(comfd, TCSETS, &stbuf) < 0) {
-     serror("Can't ioctl set device",1);
-   }
- }
-@@ -1224,7 +1225,7 @@ void doclose(void) {
-   if(strcmp(token,"hardcom")==0) {
-     if(comfd== -1) serror("Com device not open",1);
-     vmsg("Closing device");
--    if (ioctl(comfd, TCSETS, &svbuf) < 0) {
-+    if (tty && ioctl(comfd, TCSETS, &svbuf) < 0) {
-       sprintf(msg,"Can't ioctl set device %s.\n",device);
-       serror(msg,1);
-     }
-@@ -1266,12 +1267,17 @@ void opengt(void) {
-       ext(1);
-     }
-   }
--  if (ioctl (comfd, TCGETS, &svbuf) < 0) {
-+  if (isatty (comfd))
-+    tty=1;
-+  else
-+    tty=0;
-+  if (tty && ioctl (comfd, TCGETS, &svbuf) < 0) {
-     sprintf(msg,"Can't control %s, please try again.\n",device);
-     serror(msg,1);
-   }
-   setenv("COMGTDEVICE",device,1);
--  ioctl(comfd, TCGETS, &stbuf);
-+  if (tty)
-+    ioctl(comfd, TCGETS, &stbuf);
-   speed=stbuf.c_cflag & CBAUD;
-   if (high_speed == 0)  strcpy(cspeed,"115200");
-   else strcpy(cspeed,"57600");
-@@ -1302,12 +1308,16 @@ void opendevice(void) {
-     }
-   }
-   else comfd=0;
--
--  if (ioctl (comfd, TCGETS, &svbuf) < 0) {
-+  if (isatty (comfd))
-+    tty=1;
-+  else
-+    tty=0;
-+  if (tty && ioctl (comfd, TCGETS, &svbuf) < 0) {
-     sprintf(msg,"Can't ioctl get device %s.\n",device);
-     serror(msg,1);
-   }
--  ioctl(comfd, TCGETS, &stbuf);
-+  if (tty)
-+    ioctl(comfd, TCGETS, &stbuf);
-   speed=stbuf.c_cflag & CBAUD;
-   switch(speed) {
-     case B0: strcpy(cspeed,"0");break;
-- 
2.20.1




More information about the openwrt-devel mailing list