qmodem: fix probe modem from preset slot
This commit is contained in:
parent
dcca10e02f
commit
b7f2eb21b9
@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
|
|||||||
PKG_NAME:=luci-app-qmodem
|
PKG_NAME:=luci-app-qmodem
|
||||||
LUCI_TITLE:=LuCI support for QWRT Modem
|
LUCI_TITLE:=LuCI support for QWRT Modem
|
||||||
LUCI_PKGARCH:=all
|
LUCI_PKGARCH:=all
|
||||||
PKG_VERSION:=2.3
|
PKG_VERSION:=2.3.1
|
||||||
PKG_LICENSE:=GPLv3
|
PKG_LICENSE:=GPLv3
|
||||||
PKG_LINCESE_FILES:=LICENSE
|
PKG_LINCESE_FILES:=LICENSE
|
||||||
PKG_MAINTAINER:=Tom <fjrcn@outlook.com>
|
PKG_MAINTAINER:=Tom <fjrcn@outlook.com>
|
||||||
|
@ -35,6 +35,7 @@ if avalible_ports == nil then
|
|||||||
avalible_ports = {}
|
avalible_ports = {}
|
||||||
end
|
end
|
||||||
for i1,v1 in ipairs(avalible_ports) do
|
for i1,v1 in ipairs(avalible_ports) do
|
||||||
|
valid=false
|
||||||
for i2,v2 in ipairs(valid_at_ports) do
|
for i2,v2 in ipairs(valid_at_ports) do
|
||||||
if v1 == v2 then
|
if v1 == v2 then
|
||||||
valid=true
|
valid=true
|
||||||
|
@ -49,13 +49,13 @@ _try_vendor_preset_pcie()
|
|||||||
_try_pcie_slot()
|
_try_pcie_slot()
|
||||||
{
|
{
|
||||||
config_get type "$1" type
|
config_get type "$1" type
|
||||||
[ "$1" == "pcie" ] && _try_slot
|
[ "$type" == "pcie" ] && _try_slot $1
|
||||||
}
|
}
|
||||||
|
|
||||||
_try_usb_slot()
|
_try_usb_slot()
|
||||||
{
|
{
|
||||||
config_get type "$1" type
|
config_get type "$1" type
|
||||||
[ "$1" == "usb" ] && _try_slot
|
[ "$type" == "usb" ] && _try_slot $1
|
||||||
}
|
}
|
||||||
|
|
||||||
_try_usb_device()
|
_try_usb_device()
|
||||||
@ -74,7 +74,7 @@ _scan_usb()
|
|||||||
{
|
{
|
||||||
procd_open_instance "scan_usb"
|
procd_open_instance "scan_usb"
|
||||||
#delay 15 second ,scan all usb device
|
#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
|
procd_close_instance
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ _scan_pcie()
|
|||||||
{
|
{
|
||||||
procd_open_instance "scan_pcie"
|
procd_open_instance "scan_pcie"
|
||||||
#delay 3 second ,scan all pcie device
|
#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
|
procd_close_instance
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ _try_slot()
|
|||||||
procd_set_param command "ash" "/usr/share/modem/modem_scan.sh" "add" "$slot" "$type"
|
procd_set_param command "ash" "/usr/share/modem/modem_scan.sh" "add" "$slot" "$type"
|
||||||
procd_close_instance
|
procd_close_instance
|
||||||
else
|
else
|
||||||
/usr/share/modem/modem_scan.sh disable "$slot"
|
/usr/share/qmodem/modem_scan.sh disable "$slot"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ add()
|
|||||||
{
|
{
|
||||||
local slot=$1
|
local slot=$1
|
||||||
lock -n /tmp/lock/modem_add_$slot
|
lock -n /tmp/lock/modem_add_$slot
|
||||||
[ $? -eq 1 ] && return
|
[ $? -eq 0 ] || return
|
||||||
#slot_type is usb or pcie
|
#slot_type is usb or pcie
|
||||||
#section name is replace slot .:- with _
|
#section name is replace slot .:- with _
|
||||||
section_name=$(echo $slot | sed 's/[\.:-]/_/g')
|
section_name=$(echo $slot | sed 's/[\.:-]/_/g')
|
||||||
@ -275,7 +275,7 @@ add()
|
|||||||
modem_path="/sys/bus/pci/devices/$slot/"
|
modem_path="/sys/bus/pci/devices/$slot/"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
[ -z "$net_devices" ] && return
|
[ -z "$net_devices" ] && lock -u /tmp/lock/modem_add_$slot && return
|
||||||
for at_port in $valid_at_ports; do
|
for at_port in $valid_at_ports; do
|
||||||
get_modem_model "/dev/$at_port"
|
get_modem_model "/dev/$at_port"
|
||||||
echo "modem_name:$modem_name"
|
echo "modem_name:$modem_name"
|
||||||
@ -330,7 +330,7 @@ EOF
|
|||||||
uci add_list qmodem.$section_name.valid_at_ports="/dev/$at_port"
|
uci add_list qmodem.$section_name.valid_at_ports="/dev/$at_port"
|
||||||
uci set qmodem.$section_name.at_port="/dev/$at_port"
|
uci set qmodem.$section_name.at_port="/dev/$at_port"
|
||||||
done
|
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"
|
uci add_list qmodem.$section_name.ports="/dev/$at_port"
|
||||||
done
|
done
|
||||||
uci commit qmodem
|
uci commit qmodem
|
||||||
@ -380,7 +380,7 @@ disable()
|
|||||||
case $action in
|
case $action in
|
||||||
"add")
|
"add")
|
||||||
debug_subject="modem_scan_add"
|
debug_subject="modem_scan_add"
|
||||||
add $config
|
add $config $slot_type
|
||||||
;;
|
;;
|
||||||
"remove")
|
"remove")
|
||||||
debug_subject="modem_scan_remove"
|
debug_subject="modem_scan_remove"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user