mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-31 08:55:13 +08:00
🌴 Sync 2026-03-05 23:51:42
This commit is contained in:
1 parent
97c049ed0a
commit
0acff03804
14253 files changed
+3893239
No files matched your search
@@ -0,0 +1,19 @@
|
||||
#
|
||||
# Copyright (C) 2015 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=Modem Server
|
||||
LUCI_DEPENDS:=+luci-compat +quectel-cm +kmod-usb-acm \
|
||||
+kmod-usb-net-cdc-ether +kmod-usb-net-cdc-mbim \
|
||||
+kmod-usb-net-qmi-wwan +kmod-usb-net-rndis \
|
||||
+kmod-usb-serial-option +kmod-usb-wdm \
|
||||
+kmod-qmi_wwan_f +kmod-qmi_wwan_q +usbutils
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
@@ -0,0 +1,9 @@
|
||||
module("luci.controller.usbmodem", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/usbmodem") then
|
||||
return
|
||||
end
|
||||
|
||||
entry({"admin", "network", "usbmodem"}, cbi("usbmodem"), _("USB Modem Server"), 80).dependent = false
|
||||
end
|
||||
@@ -0,0 +1,51 @@
|
||||
-- Copyright 2016 David Thornley <david.thornley@touchstargroup.com>
|
||||
-- Licensed to the public under the Apache License 2.0.
|
||||
|
||||
mp = Map("usbmodem")
|
||||
mp.title = translate("USB Modem Server")
|
||||
mp.description = translate("Modem Server For OpenWrt")
|
||||
|
||||
s = mp:section(TypedSection, "service", "Base Setting")
|
||||
s.anonymous = true
|
||||
|
||||
enabled = s:option(Flag, "enabled", translate("Enable"))
|
||||
enabled.default = 0
|
||||
enabled.rmempty = false
|
||||
|
||||
device = s:option(Value, "device", translate("Modem device"))
|
||||
device.rmempty = false
|
||||
|
||||
local device_suggestions = nixio.fs.glob("/dev/cdc-wdm*")
|
||||
|
||||
if device_suggestions then
|
||||
local node
|
||||
for node in device_suggestions do
|
||||
device:value(node)
|
||||
end
|
||||
end
|
||||
|
||||
apn = s:option(Value, "apn", translate("APN"))
|
||||
apn.rmempty = true
|
||||
|
||||
pincode = s:option(Value, "pincode", translate("PIN"))
|
||||
pincode.rmempty = true
|
||||
|
||||
username = s:option(Value, "username", translate("PAP/CHAP username"))
|
||||
username.rmempty = true
|
||||
|
||||
password = s:option(Value, "password", translate("PAP/CHAP password"))
|
||||
password.rmempty = true
|
||||
|
||||
auth = s:option(Value, "auth", translate("Authentication Type"))
|
||||
auth.rmempty = true
|
||||
auth:value("", translate("-- Please choose --"))
|
||||
auth:value("both", "PAP/CHAP (both)")
|
||||
auth:value("pap", "PAP")
|
||||
auth:value("chap", "CHAP")
|
||||
auth:value("none", "NONE")
|
||||
|
||||
tool = s:option(Value, "tool", translate("Tools"))
|
||||
tool:value("quectel-CM", "quectel-CM")
|
||||
tool.rmempty = true
|
||||
|
||||
return mp
|
||||
@@ -0,0 +1,24 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"POT-Creation-Date: \n"
|
||||
"PO-Revision-Date: \n"
|
||||
"Last-Translator: dingpengyu <dingpengyu06@gmail.com>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Language: zh_CN\n"
|
||||
"X-Generator: Poedit 2.3.1\n"
|
||||
|
||||
msgid "Base Setting"
|
||||
msgstr "基本设置"
|
||||
|
||||
msgid "USB Modem Server"
|
||||
msgstr "USB移动网络拨号服务"
|
||||
|
||||
msgid "Modem Server For OpenWrt"
|
||||
msgstr "OpenWrt移动网络拨号服务"
|
||||
|
||||
msgid "Tools"
|
||||
msgstr "拨号工具"
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
zh-cn
|
||||
@@ -0,0 +1,5 @@
|
||||
config service
|
||||
option tool 'quectel-CM'
|
||||
option device '/dev/cdc-wdm0'
|
||||
option enabled '0'
|
||||
|
||||
Executable
+84
@@ -0,0 +1,84 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2006-2014 OpenWrt.org
|
||||
|
||||
START=99
|
||||
STOP=16
|
||||
USE_PROCD=1
|
||||
#使用procd启动
|
||||
|
||||
run_4g()
|
||||
{
|
||||
local enabled
|
||||
config_get_bool enabled $1 enabled
|
||||
|
||||
echo "run 4G" >> /tmp/log4g
|
||||
|
||||
if [ "$enabled" = "1" ]; then
|
||||
local user
|
||||
local password
|
||||
local apn
|
||||
local auth
|
||||
local pincode
|
||||
local device
|
||||
local tool
|
||||
|
||||
# echo "enable 4G" >> /tmp/log4g
|
||||
config_get user $1 user
|
||||
config_get password $1 password
|
||||
config_get apn $1 apn
|
||||
config_get auth $1 auth
|
||||
config_get pincode $1 pincode
|
||||
config_get device $1 device
|
||||
config_get tool $1 tool
|
||||
config_get tty $1 tty
|
||||
config_get atcmd $1 atcmd
|
||||
|
||||
devname="$(basename "$device")"
|
||||
devpath="$(readlink -f /sys/class/usbmisc/$devname/device/)"
|
||||
ifname="$( ls "$devpath"/net )"
|
||||
|
||||
if [ "$tool" = "at" ];then
|
||||
at_tool "$atcmd" -d $tty
|
||||
else
|
||||
procd_open_instance
|
||||
#创建一个实例, 在procd看来一个应用程序可以多个实\E4\BE?
|
||||
#ubus call service list 可以查看实例
|
||||
procd_set_param command $tool -i $ifname -s $apn
|
||||
if [ "$password" != "" ];then
|
||||
procd_append_param command $user $password $auth
|
||||
fi
|
||||
if [ "$pincode" != "" ]; then
|
||||
procd_append_param command -p $pincode
|
||||
fi
|
||||
# procd_append_param command -f /tmp/4g.log
|
||||
procd_set_param respawn
|
||||
echo "quectel-CM has started."
|
||||
procd_close_instance
|
||||
#关闭实例
|
||||
fi
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger "usbmodem"
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_load usbmodem
|
||||
config_foreach run_4g service
|
||||
}
|
||||
|
||||
stop_service()
|
||||
{
|
||||
echo "4G stop" >> /tmp/log4g
|
||||
killall quectel-CM
|
||||
echo "quectel-CM has stoped."
|
||||
}
|
||||
|
||||
|
||||
reload_service() {
|
||||
restart
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
[ ! -f "/usr/share/ucitrack/luci-app-usbmodem.json" ] && {
|
||||
cat > /usr/share/ucitrack/luci-app-usbmodem.json << EEOF
|
||||
{
|
||||
"config": "usbmodem",
|
||||
"init": "usbmodem"
|
||||
}
|
||||
EEOF
|
||||
}
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@usbmodem[-1]
|
||||
add ucitrack usbmodem
|
||||
set ucitrack.@usbmodem[-1].init=usbmodem
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"luci-app-usbmodem": {
|
||||
"description": "Grant UCI access for luci-app-usbmodem",
|
||||
"read": {
|
||||
"uci": [ "usbmodem" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "usbmodem" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user