Skip to content

Commit b430f92

Browse files
committed
feat: implement get_model_name_by_id function
1 parent 99ebdc3 commit b430f92

File tree

2 files changed

+34
-8
lines changed

2 files changed

+34
-8
lines changed

application/qmodem/files/usr/share/qmodem/modem_scan.sh

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,13 @@ match_config()
376376
sa_available_band=$(echo $modem_config | jq -r ".sa_band")
377377
}
378378

379+
get_model_name_by_id()
380+
{
381+
local id=$1
382+
local name=$(echo $modem_support | jq -r '.modem_support."'$slot_type'" | to_entries[] | select(.value.id=="'$id'") | .key')
383+
echo $name
384+
}
385+
379386
get_modem_model()
380387
{
381388
local at_port=$1
@@ -434,15 +441,18 @@ add()
434441
esac
435442
#if no netdev return
436443
[ -z "$net_devices" ] && lock -u /tmp/lock/modem_add_$slot && return
437-
for trys in $(seq 1 3);do
438-
for at_port in $valid_at_ports; do
439-
m_debug "try at port $at_port;time $trys"
440-
get_modem_model "/dev/$at_port"
441-
[ $? -eq 0 ] && break || modem_name=""
444+
modem_name=$(get_model_name_by_id $id)
445+
if [ -z "$modem_name" ];then
446+
for trys in $(seq 1 3);do
447+
for at_port in $valid_at_ports; do
448+
m_debug "try at port $at_port;time $trys"
449+
get_modem_model "/dev/$at_port"
450+
[ $? -eq 0 ] && break || modem_name=""
451+
done
452+
[ -n "$modem_name" ] && break
453+
sleep 1
442454
done
443-
[ -n "$modem_name" ] && break
444-
sleep 1
445-
done
455+
fi
446456
[ -z "$modem_name" ] && lock -u /tmp/lock/modem_add_$slot && return
447457
m_debug "add modem $modem_name slot $slot slot_type $slot_type"
448458
if [ -n "$is_exist" ]; then

application/qmodem/files/usr/share/qmodem/modem_support.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,6 +1089,22 @@
10891089
"ecm"
10901090
]
10911091
},
1092+
"simcom_a8200_serias": {
1093+
"manufacturer_id": "1a0e",
1094+
"id": "1e0e:9011",
1095+
"manufacturer": "simcom",
1096+
"platform": "asrmicro",
1097+
"data_interface": "usb",
1098+
"pdp_index": "1",
1099+
"wcdma_band": "1/2/3/4/5/8",
1100+
"lte_band": "1/2/3/4/5/7/8/12/13/14/17/18/19/20/25/26/28/29/30/32/34/38/39/40/41/42/43/46/48/66/71",
1101+
"nsa_band": "1/2/3/5/7/8/12/20/28/38/40/41/48/66/71/77/78/79",
1102+
"sa_band": "1/2/3/5/7/8/12/20/28/38/40/41/48/66/71/77/78/79",
1103+
"modes": [
1104+
"ecm",
1105+
"rndis"
1106+
]
1107+
},
10921108
"simcom_d8200g": {
10931109
"manufacturer_id": "1a0e",
10941110
"manufacturer": "simcom",

0 commit comments

Comments
 (0)