qmodem: fix probe modem from preset slot

This commit is contained in:
fujr 2024-10-20 13:35:37 +08:00
parent dcca10e02f
commit b7f2eb21b9
4 changed files with 11 additions and 10 deletions

View File

@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-qmodem
LUCI_TITLE:=LuCI support for QWRT Modem
LUCI_PKGARCH:=all
PKG_VERSION:=2.3
PKG_VERSION:=2.3.1
PKG_LICENSE:=GPLv3
PKG_LINCESE_FILES:=LICENSE
PKG_MAINTAINER:=Tom <fjrcn@outlook.com>

View File

@ -35,6 +35,7 @@ if avalible_ports == nil then
avalible_ports = {}
end
for i1,v1 in ipairs(avalible_ports) do
valid=false
for i2,v2 in ipairs(valid_at_ports) do
if v1 == v2 then
valid=true

View File

@ -49,13 +49,13 @@ _try_vendor_preset_pcie()
_try_pcie_slot()
{
config_get type "$1" type
[ "$1" == "pcie" ] && _try_slot
[ "$type" == "pcie" ] && _try_slot $1
}
_try_usb_slot()
{
config_get type "$1" type
[ "$1" == "usb" ] && _try_slot
[ "$type" == "usb" ] && _try_slot $1
}
_try_usb_device()
@ -74,7 +74,7 @@ _scan_usb()
{
procd_open_instance "scan_usb"
#delay 15 second ,scan all usb device
procd_set_param command "ash" "/usr/share/modem/modem_scan.sh" "scan" "15" "usb"
procd_set_param command "ash" "/usr/share/qmodem/modem_scan.sh" "scan" "15" "usb"
procd_close_instance
}
@ -82,7 +82,7 @@ _scan_pcie()
{
procd_open_instance "scan_pcie"
#delay 3 second ,scan all pcie device
procd_set_param command "ash" "/usr/share/modem/modem_scan.sh" "scan" "3" "pcie"
procd_set_param command "ash" "/usr/share/qmodem/modem_scan.sh" "scan" "3" "pcie"
procd_close_instance
}
@ -111,7 +111,7 @@ _try_slot()
procd_set_param command "ash" "/usr/share/modem/modem_scan.sh" "add" "$slot" "$type"
procd_close_instance
else
/usr/share/modem/modem_scan.sh disable "$slot"
/usr/share/qmodem/modem_scan.sh disable "$slot"
fi
}

View File

@ -259,7 +259,7 @@ add()
{
local slot=$1
lock -n /tmp/lock/modem_add_$slot
[ $? -eq 1 ] && return
[ $? -eq 0 ] || return
#slot_type is usb or pcie
#section name is replace slot .:- with _
section_name=$(echo $slot | sed 's/[\.:-]/_/g')
@ -275,7 +275,7 @@ add()
modem_path="/sys/bus/pci/devices/$slot/"
;;
esac
[ -z "$net_devices" ] && return
[ -z "$net_devices" ] && lock -u /tmp/lock/modem_add_$slot && return
for at_port in $valid_at_ports; do
get_modem_model "/dev/$at_port"
echo "modem_name:$modem_name"
@ -330,7 +330,7 @@ EOF
uci add_list qmodem.$section_name.valid_at_ports="/dev/$at_port"
uci set qmodem.$section_name.at_port="/dev/$at_port"
done
for at_port in $tty_devices; do
for at_port in $at_ports; do
uci add_list qmodem.$section_name.ports="/dev/$at_port"
done
uci commit qmodem
@ -380,7 +380,7 @@ disable()
case $action in
"add")
debug_subject="modem_scan_add"
add $config
add $config $slot_type
;;
"remove")
debug_subject="modem_scan_remove"