mirror of
https://github.com/openwrt/openwrt.git
synced 2026-10-14 06:38:29 +04:00
comgt: ncm: strip CR when detecting the modem on teardown
proto_ncm_setup() parses the AT+CGMI reply with RS='\r?\n', proto_ncm_teardown() does not. The manufacturer ends up as "quectel\r", json_select fails with "Unsupported modem" and teardown returns before sending the disconnect command, leaving the data call up on the modem. A blank CRLF line hits the same path: \r is not whitespace for the default FS, so a record holding only \r still has NF == 1 and is taken as the manufacturer. This affects every vendor whose reply is a single token. "zte" comes out the same either way, its reply is "ZTE INCORPORATED" so the CR sits past $1. Note that teardown now reaches the disconnect command on modems where it silently never did, so those commands actually get sent on ifdown. Signed-off-by: Carlo Szelinsky <github@szelinsky.de> Link: https://github.com/openwrt/openwrt/pull/24689 Signed-off-by: Jonas Jelonek <jonas@jonasjelonek.de>
This commit is contained in:
1 parent
daa2ded383
commit
d0df2ab604
2 files changed
+2
-2
No files matched your search
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=comgt
|
||||
PKG_VERSION:=0.32
|
||||
PKG_RELEASE:=36
|
||||
PKG_RELEASE:=37
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME).$(PKG_VERSION).tgz
|
||||
PKG_SOURCE_URL:=@SF/comgt
|
||||
|
||||
@@ -263,7 +263,7 @@ proto_ncm_teardown() {
|
||||
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; }')
|
||||
manufacturer=$(gcom -d "$device" -s /etc/gcom/getcardinfo.gcom | awk -v RS='\r?\n' '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
|
||||
|
||||
Reference in new issue
Block a user