diff --git a/luci-app-hypermodem/luasrc/model/cbi/hypermodem.lua b/luci-app-hypermodem/luasrc/model/cbi/hypermodem.lua index a8935c0..51e5459 100644 --- a/luci-app-hypermodem/luasrc/model/cbi/hypermodem.lua +++ b/luci-app-hypermodem/luasrc/model/cbi/hypermodem.lua @@ -33,7 +33,7 @@ if device_suggestions then end end -apn = s:taboption(Value, "apn", translate("APN")) +apn = s:option(Value, "apn", translate("APN")) apn.default = "" apn.rmempty = true apn:value("", translate("Auto Choose")) @@ -43,7 +43,7 @@ apn:value("ctnet", translate("China Telecom")) apn:value("cbnet", translate("China Broadcast")) apn:value("5gscuiot", translate("Skytone")) -auth = s:taboption("advanced", ListValue, "auth", translate("Authentication Type")) +auth = s:option(ListValue, "auth", translate("Authentication Type")) auth.default = "none" auth.rmempty = false auth:value("none", translate("NONE")) @@ -51,13 +51,13 @@ auth:value("both", translate("PAP/CHAP (both)")) auth:value("pap", "PAP") auth:value("chap", "CHAP") -username = s:taboption("advanced", Value, "username", translate("PAP/CHAP Username")) +username = s:option(Value, "username", translate("PAP/CHAP Username")) username.rmempty = true username:depends("auth", "both") username:depends("auth", "pap") username:depends("auth", "chap") -password = s:taboption("advanced", Value, "password", translate("PAP/CHAP Password")) +password = s:option(Value, "password", translate("PAP/CHAP Password")) password.rmempty = true password.password = true password:depends("auth", "both") diff --git a/luci-app-modem/root/etc/hotplug.d/net/20-modem-net b/luci-app-modem/root/etc/hotplug.d/net/20-modem-net index 6d3c4fa..62499e7 100644 --- a/luci-app-modem/root/etc/hotplug.d/net/20-modem-net +++ b/luci-app-modem/root/etc/hotplug.d/net/20-modem-net @@ -12,10 +12,10 @@ source "/usr/share/modem/modem_util.sh" #始终确保存在运行目录 mkdir -m 0755 -p "${MODEM_RUNDIR}" -初始化模组配置 -[[ "${INTERFACE}" = *"ip6tnl0"* ]] && { - sh "${SCRIPT_DIR}/modem_init.sh" -} +#初始化模组配置 +# [[ "${INTERFACE}" = *"ip6tnl0"* ]] && { +# sh "${SCRIPT_DIR}/modem_init.sh" +# } if [[ "${INTERFACE}" = *"usb"* ]] || [[ "${INTERFACE}" = *"wwan"* ]] || [[ "${INTERFACE}" = *"eth"* ]]; then #配置网络设备 diff --git a/luci-app-modem/root/usr/share/modem/modem_util.sh b/luci-app-modem/root/usr/share/modem/modem_util.sh index dd7f089..6eb757c 100755 --- a/luci-app-modem/root/usr/share/modem/modem_util.sh +++ b/luci-app-modem/root/usr/share/modem/modem_util.sh @@ -241,10 +241,14 @@ m_set_modem_hardware_config() # fi # } - #判断路径是否带有usb(排除其他eth网络设备) - if [ "$data_interface" != "pcie" ] && [[ "$device_physical_path" != *"usb"* ]]; then - return - fi + #是否是第一次添加(初始化模组) + local count=$(grep -o "processed" ${MODEM_PHYSICAL_DEVICE_CACHE} | wc -l) + [ "$count" -le "0" ] && { + sh "${SCRIPT_DIR}/modem_init.sh" + } + + #设置物理路径状态 + m_set_physical_path_status "${physical_path}" "processed" #获取模组序号 local modem_no=$(uci -q get modem.@global[0].modem_number) @@ -258,9 +262,6 @@ m_set_modem_hardware_config() uci set modem.modem${modem_no}.path="${physical_path}" uci commit modem - - #设置物理路径状态 - m_set_physical_path_status "${physical_path}" "processed" } #删除模组配置 @@ -781,6 +782,11 @@ m_set_network_device() local count=$(echo "${network_path}" | grep -o "/net" | wc -l) [ "$count" -ge "2" ] && return + #判断路径是否带有usb(排除其他eth网络设备) + if [[ "$network" = *"eth"* ]] && [[ "$network_path" != *"usb"* ]]; then + return + fi + #上报事件 m_report_event "${action}" "net" "${network}" "${network_path}"