[openwrt/openwrt] comgt-ncm: fix modem manufacturer detection

LEDE Commits lede-commits at lists.infradead.org
Thu Apr 17 16:37:54 PDT 2025


robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/2eb7e4bf61bda231220c46f96696fe5c98c5858f

commit 2eb7e4bf61bda231220c46f96696fe5c98c5858f
Author: Jakub Łabuz <jakub at labuz.dev>
AuthorDate: Fri Apr 11 18:33:49 2025 +0200

    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 <jakub at labuz.dev>
    Link: https://github.com/openwrt/openwrt/pull/18460
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 package/network/utils/comgt/files/ncm.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/network/utils/comgt/files/ncm.sh b/package/network/utils/comgt/files/ncm.sh
index 761dafb24e..a986973838 100644
--- a/package/network/utils/comgt/files/ncm.sh
+++ b/package/network/utils/comgt/files/ncm.sh
@@ -91,7 +91,7 @@ proto_ncm_setup() {
 
 	start=$(date +%s)
 	while true; do
-		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; }')
 		[ "$manufacturer" = "error" ] && {
 			manufacturer=""
 		}




More information about the lede-commits mailing list