@@ -100,6 +100,15 @@ get_vendor_info() {
100100 platform=$( uci get qmodem.$section .platform 2> /dev/null)
101101}
102102
103+ check_is_disabled (){
104+ is_disabled=$( uci -q get qmodem.${config_section} .state 2> /dev/null)
105+ if [ " $is_disabled " = " disabled" ]; then
106+ json_add_string status " disabled"
107+ json_dump
108+ exit 0
109+ fi
110+ }
111+
103112# Helper function for AT configuration
104113get_at_cfg () {
105114 json_add_object at_cfg
@@ -314,11 +323,14 @@ EOF
314323 case " $2 " in
315324 base_info)
316325 json_init
326+ check_is_disabled
317327 cache_file=" /tmp/cache_base_info_$config_section "
328+
318329 try_cache 10 " $cache_file " base_info
319330 ;;
320331 cell_info)
321332 json_init
333+ check_is_disabled
322334 cache_file=" /tmp/cache_cell_info_$config_section "
323335 try_cache 10 " $cache_file " cell_info
324336 ;;
338350 dial_status)
339351 status_output=$( /etc/init.d/qmodem_network modem_status " $config_section " 2> /dev/null)
340352 json_init
353+ check_is_disabled
341354 if [[ " $status_output " != * " Not Running" * ]]; then
342355 json_add_string running true
343356 else
367380 ;;
368381 get_disabled_features)
369382 json_init
383+ check_is_disabled
370384 json_add_array disabled_features
371385 vendor_get_disabled_features
372386 get_modem_disabled_features
@@ -376,31 +390,37 @@ EOF
376390 ;;
377391 get_dns)
378392 json_init
393+ check_is_disabled
379394 get_dns
380395 json_dump
381396 ;;
382397 get_imei)
383398 json_init
399+ check_is_disabled
384400 get_imei
385401 json_dump
386402 ;;
387403 get_lockband)
388404 json_init
405+ check_is_disabled
389406 get_lockband
390407 json_dump
391408 ;;
392409 get_mode)
393410 json_init
411+ check_is_disabled
394412 get_mode
395413 json_dump
396414 ;;
397415 get_neighborcell)
398416 json_init
417+ check_is_disabled
399418 get_neighborcell
400419 json_dump
401420 ;;
402421 get_network_prefer)
403422 json_init
423+ check_is_disabled
404424 get_network_prefer
405425 json_dump
406426 ;;
@@ -414,21 +434,25 @@ EOF
414434 ;;
415435 info)
416436 json_init
437+ check_is_disabled
417438 cache_file=" /tmp/cache_info_$config_section "
418439 try_cache 10 " $cache_file " get_info
419440 ;;
420441 network_info)
421442 json_init
443+ check_is_disabled
422444 cache_file=" /tmp/cache_network_info_$config_section "
423445 try_cache 10 " $cache_file " network_info
424446 ;;
425447 sim_info)
426448 json_init
449+ check_is_disabled
427450 cache_file=" /tmp/cache_sim_info_$config_section "
428451 try_cache 10 " $cache_file " sim_info
429452 ;;
430453 get_connect_status)
431454 json_init
455+ check_is_disabled
432456 get_connect_status
433457 json_add_string connection_status " $connect_status "
434458 json_dump
451475 get_at_port_config " $config_section " 1
452476
453477 json_init
478+ check_is_disabled
454479 json_add_object result
455480 for i in $index ; do
456481 tom_modem $use_ubus_flag -d " $at_port " -o d -i " $i "
488513 ;;
489514
490515 send_at)
491-
492516 params=$( echo " $input " | jsonfilter -e ' @.params' )
493517 cmd=$( echo " $params " | jq -r ' .at' )
494518 port=$( echo " $params " | jq -r ' .port' )
567591 set_imei)
568592 imei=$( echo " $input " | jsonfilter -e ' @.imei' )
569593 json_init
594+ check_is_disabled
570595 json_add_string imei " $imei "
571596 set_imei " $imei "
572597 json_dump
584609 load_vendor_script " $vendor "
585610
586611 json_init
612+ check_is_disabled
587613 case " $2 " in
588614 set_lockband)
589615 set_lockband " $params "
601627 set_mode)
602628 mode=$( echo " $input " | jsonfilter -e ' @.mode' )
603629 json_init
630+ check_is_disabled
604631 set_mode " $mode "
605632 json_add_string result " $mode "
606633 json_dump
609636 set_sms_storage)
610637 storage=$( echo " $input " | jsonfilter -e ' @.storage' )
611638 json_init
639+ check_is_disabled
612640 set_sms_storage " $storage "
613641 json_dump
614642 ;;
0 commit comments