Skip to content

Commit 2eb7e4b

Browse files
jlabuzrobimarko
authored andcommitted
comgt-ncm: fix modem manufacturer detection
Fix an issue where NCM interface initialization fails because of wrong modem manufacturer detection. gcom call returns an output with Windows-style line breaks (containing \r) what makes awk call return empty or malformed manufacturer name. Changing awk RS variable to handle both \n and \r\n as line break fixes this issue. Fixes #17448 and #17998 GitHub issues. Signed-off-by: Jakub Łabuz <[email protected]> Link: openwrt/openwrt#18460 Signed-off-by: Robert Marko <[email protected]>
1 parent 5d26507 commit 2eb7e4b

File tree

1 file changed

+1
-1
lines changed
  • package/network/utils/comgt/files

1 file changed

+1
-1
lines changed

package/network/utils/comgt/files/ncm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ proto_ncm_setup() {
9191

9292
start=$(date +%s)
9393
while true; do
94-
manufacturer=$(gcom -d "$device" -s /etc/gcom/getcardinfo.gcom | awk 'NF && $0 !~ /AT\+CGMI/ { sub(/\+CGMI: /,""); print tolower($1); exit; }')
94+
manufacturer=$(gcom -d "$device" -s /etc/gcom/getcardinfo.gcom | awk -v RS='\r?\n' 'NF && $0 !~ /AT\+CGMI/ { sub(/\+CGMI: /,""); print tolower($1); exit; }')
9595
[ "$manufacturer" = "error" ] && {
9696
manufacturer=""
9797
}

0 commit comments

Comments
 (0)