mirror of
https://github.com/immortalwrt/immortalwrt.git
synced 2025-08-11 06:11:53 +08:00
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@labuz.dev> Link: https://github.com/openwrt/openwrt/pull/18460 Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:

committed by
Robert Marko

parent
5d26507a73
commit
2eb7e4bf61
@ -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=""
|
||||
}
|
||||
|
Reference in New Issue
Block a user