更新配置

This commit is contained in:
ling 2023-04-03 11:17:03 +08:00
parent 5500a26278
commit 541ae6e89c
53 changed files with 896 additions and 189 deletions

View File

@ -1,8 +1,8 @@
-- Copyright 2016 David Thornley <david.thornley@touchstargroup.com>
-- Licensed to the public under the Apache License 2.0.
mp = Map("gobinetmodem")
mp.title = translate("gobinet Modem Server")
mp=Map("gobinetmodem",translate("gobinet Modem Server"))
mp.description=translate("Modem Server For OpenWrt")
s=mp:section(TypedSection,"service", "Base Setting")
@ -23,9 +23,8 @@ 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
password.rmempty=true
auth:value("",translate("-- Please choose --"))
auth:value("both","PAP/CHAP (both)")
auth:value("pap","PAP")
@ -37,3 +36,4 @@ tool:value("quectel-CM", "quectel-CM")
tool.rmempty=true
return mp

View File

@ -9,3 +9,4 @@ EOF
rm -f /tmp/luci-indexcache
exit 0

View File

@ -1,8 +1,8 @@
-- Copyright 2016 David Thornley <david.thornley@touchstargroup.com>
-- Licensed to the public under the Apache License 2.0.
mp = Map("pcimodem")
mp.title = translate("PCI Modem Server")
mp=Map("pcimodem",translate("PCI Modem Server"))
mp.description=translate("Modem Server For OpenWrt")
s=mp:section(TypedSection,"service", "Base Setting")
@ -23,9 +23,8 @@ 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
password.rmempty=true
auth:value("",translate("-- Please choose --"))
auth:value("both","PAP/CHAP (both)")
auth:value("pap","PAP")
@ -37,3 +36,4 @@ tool:value("quectel-CM", "quectel-CM")
tool.rmempty=true
return mp

View File

@ -9,3 +9,4 @@ EOF
rm -f /tmp/luci-indexcache
exit 0

View File

@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk
LUCI_TITLE:=SPD Modem Server
LUCI_DEPENDS:=+luci-compat +kmod-sprd_pcie
LUCI_DEPENDS:=
include $(TOPDIR)/feeds/luci/luci.mk

View File

@ -1,8 +1,8 @@
-- Copyright 2016 David Thornley <david.thornley@touchstargroup.com>
-- Licensed to the public under the Apache License 2.0.
mp = Map("spdmodem")
mp.title = translate("SPD Modem Server")
mp=Map("spdmodem",translate("SPD Modem Server"))
mp.description=translate("Modem Server For OpenWrt")
s=mp:section(TypedSection,"service", "Base Setting")
@ -23,9 +23,8 @@ 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
password.rmempty=true
auth:value("",translate("-- Please choose --"))
auth:value("both","PAP/CHAP (both)")
auth:value("pap","PAP")
@ -37,3 +36,4 @@ tool:value("quectel-CM", "quectel-CM")
tool.rmempty=true
return mp

View File

@ -9,3 +9,4 @@ EOF
rm -f /tmp/luci-indexcache
exit 0

View File

@ -1,8 +1,8 @@
-- 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=Map("usbmodem",translate("USB Modem Server"))
mp.description=translate("Modem Server For OpenWrt")
s=mp:section(TypedSection,"service", "Base Setting")
@ -35,9 +35,8 @@ 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
password.rmempty=true
auth:value("",translate("-- Please choose --"))
auth:value("both","PAP/CHAP (both)")
auth:value("pap","PAP")
@ -49,3 +48,4 @@ tool:value("quectel-CM", "quectel-CM")
tool.rmempty=true
return mp

View File

@ -9,3 +9,4 @@ EOF
rm -f /tmp/luci-indexcache
exit 0

View File

@ -15,7 +15,7 @@ include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk
define KernelPackage/gobinet
SUBMENU:=WWAN Support
SUBMENU:=Gobinet Support
TITLE:=Quectel Linux USB Gobinet Driver
DEPENDS:=+kmod-usb-net
FILES:=$(PKG_BUILD_DIR)/GobiNet.ko

View File

@ -15,7 +15,7 @@ include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk
define KernelPackage/pcie_mhi
SUBMENU:=WWAN Support
SUBMENU:=PCIE Support
TITLE:=Kernel pcie driver for MHI device
DEPENDS:=+pciids +pciutils +quectel-CM-5G
FILES:=$(PKG_BUILD_DIR)/pcie_mhi.ko

View File

@ -9,15 +9,15 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=qmi_wwan_q
PKG_VERSION:=3.0
PKG_RELEASE:=2
PKG_RELEASE:=1
include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk
define KernelPackage/qmi_wwan_q
SUBMENU:=WWAN Support
SUBMENU:=qmiwwan Support
TITLE:=Quectel Linux USB QMI WWAN Driver
DEPENDS:=+kmod-usb-net +kmod-usb-wdm
DEPENDS:=+kmod-usb-net kmod-usb-wdm
FILES:=$(PKG_BUILD_DIR)/qmi_wwan_q.ko
AUTOLOAD:=$(call AutoLoad,81,qmi_wwan_q)
endef

View File

@ -319,11 +319,7 @@ static int bridge_arp_reply(struct net_device *net, struct sk_buff *skb, uint br
reply->ip_summed = CHECKSUM_UNNECESSARY;
reply->pkt_type = PACKET_HOST;
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)
netif_rx_ni(reply);
#else
netif_rx(reply);
#endif
}
return 1;
}
@ -387,11 +383,7 @@ static struct sk_buff *bridge_mode_tx_fixup(struct net_device *net, struct sk_bu
__skb_pull(reply, skb_network_offset(reply));
reply->ip_summed = CHECKSUM_UNNECESSARY;
reply->pkt_type = PACKET_HOST;
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)
netif_rx_ni(reply);
#else
netif_rx(reply);
#endif
return NULL;
}
#endif
@ -761,22 +753,12 @@ static void rmnet_vnd_update_rx_stats(struct net_device *net,
struct pcpu_sw_netstats *stats64 = this_cpu_ptr(dev->stats64);
u64_stats_update_begin(&stats64->syncp);
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)
stats64->rx_packets += rx_packets;
stats64->rx_bytes += rx_bytes;
#else
u64_stats_add(&stats64->rx_packets, rx_packets);
u64_stats_add(&stats64->rx_bytes, rx_bytes);
#endif
u64_stats_update_end(&stats64->syncp);
#else
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)
net->stats.rx_packets += rx_packets;
net->stats.rx_bytes += rx_bytes;
#else
u64_stats_add(&net->stats.rx_packets, rx_packets);
u64_stats_add(&net->stats.rx_bytes, rx_bytes);
#endif
#endif
}
@ -787,22 +769,12 @@ static void rmnet_vnd_update_tx_stats(struct net_device *net,
struct pcpu_sw_netstats *stats64 = this_cpu_ptr(dev->stats64);
u64_stats_update_begin(&stats64->syncp);
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)
stats64->tx_packets += tx_packets;
stats64->tx_bytes += tx_bytes;
#else
u64_stats_add(&stats64->tx_packets, tx_packets);
u64_stats_add(&stats64->tx_bytes, tx_bytes);
#endif
u64_stats_update_end(&stats64->syncp);
#else
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)
net->stats.tx_packets += tx_packets;
net->stats.tx_bytes += tx_bytes;
#else
u64_stats_add(&net->stats.tx_packets, tx_packets);
u64_stats_add(&net->tx_bytes, tx_bytes);
#endif
#endif
}
@ -829,25 +801,16 @@ static struct rtnl_link_stats64 *_rmnet_vnd_get_stats64(struct net_device *net,
do {
start = u64_stats_fetch_begin_irq(&stats64->syncp);
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)
rx_packets = stats64->rx_packets;
rx_bytes = stats64->rx_bytes;
tx_packets = stats64->tx_packets;
tx_bytes = stats64->tx_bytes;
#else
rx_packets = u64_stats_read(&stats64->rx_packets);
rx_bytes = u64_stats_read(&stats64->rx_bytes);
tx_packets = u64_stats_read(&stats64->tx_packets);
tx_bytes = u64_stats_read(&stats64->tx_bytes);
#endif
} while (u64_stats_fetch_retry_irq(&stats64->syncp, start));
stats->rx_packets += rx_packets;
stats->rx_bytes += rx_bytes;
stats->tx_packets += tx_packets;
stats->tx_bytes += tx_bytes;
}
return stats;
@ -1295,11 +1258,7 @@ static int qmap_register_device(sQmiWwanQmap * pDev, u8 offset_id)
priv->dev = pDev->mpNetDev;
priv->qmap_version = pDev->qmap_version;
priv->mux_id = QUECTEL_QMAP_MUX_ID + offset_id;
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
memcpy (qmap_net->dev_addr, real_dev->dev_addr, ETH_ALEN);
#else
eth_hw_addr_set (real_dev, qmap_net->dev_addr);
#endif
#ifdef QUECTEL_BRIDGE_MODE
priv->bridge_mode = !!(pDev->bridge_mode & BIT(offset_id));
@ -2066,16 +2025,8 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf)
/* make MAC addr easily distinguishable from an IP header */
if (possibly_iphdr(dev->net->dev_addr)) {
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)
dev->net->dev_addr[0] |= 0x02; /* set local assignment bit */
dev->net->dev_addr[0] &= 0xbf; /* clear "IP" bit */
#else
u8 addr = dev->net->dev_addr[0];
addr |= 0x02; /* set local assignment bit */
addr &= 0xbf; /* clear "IP" bit */
dev_addr_mod(dev->net, 0, &addr, 1);
#endif
}
if (!_usbnet_get_stats64)
_usbnet_get_stats64 = dev->net->netdev_ops->ndo_get_stats64;

View File

@ -15,8 +15,9 @@ include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk
define KernelPackage/sprd_pcie
SUBMENU:=WWAN Support
SUBMENU:=PCIE Support
TITLE:=Kernel pcie driver for SPRD device
DEPENDS:=
FILES:=$(PKG_BUILD_DIR)/sprd_pcie.ko
AUTOLOAD:=$(call AutoLoad,41,sprd_pcie)
endef

View File

@ -0,0 +1,20 @@
#
# 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 +kmod-usb-net +kmod-usb-net-cdc-ether +kmod-usb-acm \
+kmod-usb-net-qmi-wwan +kmod-usb-net-rndis +kmod-usb-serial-qualcomm \
+kmod-usb-net-sierrawireless +kmod-usb-ohci +kmod-usb-serial \
+kmod-usb-serial-option \
+kmod-usb2 +kmod-usb3 \
+quectel-CM-5G +kmod-gobinet
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -0,0 +1,9 @@
module("luci.controller.gobinetmodem", package.seeall)
function index()
if not nixio.fs.access("/etc/config/gobinetmodem") then
return
end
entry({"admin", "network", "gobinetmodem"}, cbi("gobinetmodem"), _("Gobinet Modem Server"), 80).dependent=false
end

View File

@ -0,0 +1,39 @@
-- Copyright 2016 David Thornley <david.thornley@touchstargroup.com>
-- Licensed to the public under the Apache License 2.0.
mp=Map("gobinetmodem",translate("gobinet 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
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"))
password.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

View File

@ -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 "gobinet Modem Server"
msgstr "gobinet移动网络拨号服务"
msgid "Modem Server For OpenWrt"
msgstr "OpenWrt移动网络拨号服务"
msgid "Tools"
msgstr "拨号工具"

View File

@ -0,0 +1,4 @@
config service
option tool 'quectel-CM'
option enabled '0'

View File

@ -0,0 +1,80 @@
#!/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 "gobinetmodem"
}
start_service() {
config_load gobinetmodem
config_foreach run_4g service
}
stop_service()
{
echo "4G stop" >> /tmp/log4g
killall quectel-CM
echo "quectel-CM has stoped."
}

View File

@ -0,0 +1,12 @@
#!/bin/sh
uci -q batch <<-EOF >/dev/null
delete ucitrack.@gobinetmodem[-1]
add ucitrack gobinetmodem
set ucitrack.@gobinetmodem[-1].init=gobinetmodem
commit ucitrack
EOF
rm -f /tmp/luci-indexcache
exit 0

View File

@ -0,0 +1,15 @@
#
# 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:=PCI Modem Server
LUCI_DEPENDS:=+kmod-pcie_mhi +pciutils +quectel-CM-5G
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -0,0 +1,9 @@
module("luci.controller.pcimodem", package.seeall)
function index()
if not nixio.fs.access("/etc/config/pcimodem") then
return
end
entry({"admin", "network", "pcimodem"}, cbi("pcimodem"), _("PCI Modem Server"), 80).dependent=false
end

View File

@ -0,0 +1,39 @@
-- Copyright 2016 David Thornley <david.thornley@touchstargroup.com>
-- Licensed to the public under the Apache License 2.0.
mp=Map("pcimodem",translate("PCI 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
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"))
password.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

View File

@ -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 "PCI Modem Server"
msgstr "PCI移动网络拨号服务"
msgid "Modem Server For OpenWrt"
msgstr "OpenWrt移动网络拨号服务"
msgid "Tools"
msgstr "拨号工具"

View File

@ -0,0 +1,4 @@
config service
option tool 'quectel-CM'
option enabled '0'

View File

@ -0,0 +1,75 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2014 OpenWrt.org
START=99
STOP=16
USE_PROCD=1
#使用procd启动
run_5g()
{
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 tool
# echo "enable 5G" >> /tmp/log5g
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 tool $1 tool
config_get tty $1 tty
config_get atcmd $1 atcmd
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 rmnet_mhi0 -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 "pcimodem"
}
start_service() {
config_load pcimodem
config_foreach run_5g service
}
stop_service()
{
echo "5G stop" >> /tmp/log5g
killall quectel-CM
echo "quectel-CM has stoped."
}

View File

@ -0,0 +1,12 @@
#!/bin/sh
uci -q batch <<-EOF >/dev/null
delete ucitrack.@pcimodem[-1]
add ucitrack pcimodem
set ucitrack.@pcimodem[-1].init=pcimodem
commit ucitrack
EOF
rm -f /tmp/luci-indexcache
exit 0

View File

@ -0,0 +1,15 @@
#
# 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:=SPD Modem Server
LUCI_DEPENDS:=
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -0,0 +1,9 @@
module("luci.controller.spdmodem", package.seeall)
function index()
if not nixio.fs.access("/etc/config/spdmodem") then
return
end
entry({"admin", "network", "spdmodem"}, cbi("spdmodem"), _("SPD Modem Server"), 80).dependent=false
end

View File

@ -0,0 +1,39 @@
-- Copyright 2016 David Thornley <david.thornley@touchstargroup.com>
-- Licensed to the public under the Apache License 2.0.
mp=Map("spdmodem",translate("SPD 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
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"))
password.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

View File

@ -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 "SPD Modem Server"
msgstr "SPD移动网络拨号服务"
msgid "Modem Server For OpenWrt"
msgstr "OpenWrt移动网络拨号服务"
msgid "Tools"
msgstr "拨号工具"

View File

@ -0,0 +1,4 @@
config service
option tool 'quectel-CM'
option enabled '0'

View File

@ -0,0 +1,75 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2014 OpenWrt.org
START=99
STOP=16
USE_PROCD=1
#使用procd启动
run_5g()
{
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 tool
# echo "enable 5G" >> /tmp/log5g
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 tool $1 tool
config_get tty $1 tty
config_get atcmd $1 atcmd
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 -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 "spdmodem"
}
start_service() {
config_load spdmodem
config_foreach run_5g service
}
stop_service()
{
echo "5G stop" >> /tmp/log5g
killall quectel-CM
echo "quectel-CM has stoped."
}

View File

@ -0,0 +1,12 @@
#!/bin/sh
uci -q batch <<-EOF >/dev/null
delete ucitrack.@spdmodem[-1]
add ucitrack spdmodem
set ucitrack.@spdmodem[-1].init=spdmodem
commit ucitrack
EOF
rm -f /tmp/luci-indexcache
exit 0

View File

@ -0,0 +1,20 @@
#
# 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 +kmod-usb-net +kmod-usb-net-cdc-ether +kmod-usb-acm \
+kmod-usb-net-qmi-wwan +kmod-usb-net-rndis +kmod-usb-serial-qualcomm \
+kmod-usb-net-sierrawireless +kmod-usb-ohci +kmod-usb-serial \
+kmod-usb-serial-option +kmod-usb-wdm \
+kmod-usb2 +kmod-usb3 \
+quectel-CM-5G +kmod-qmi_wwan_q +kmod-usb-net-cdc-mbim
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -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

View File

@ -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",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"))
password.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

View File

@ -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 "拨号工具"

View File

@ -0,0 +1,5 @@
config service
option tool 'quectel-CM'
option device '/dev/cdc-wdm0'
option enabled '0'

View File

@ -0,0 +1,80 @@
#!/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."
}

View File

@ -0,0 +1,12 @@
#!/bin/sh
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

View File

@ -1,10 +1,10 @@
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:= quectel-CM-5G
PKG_RELEASE:=2
PKG_RELEASE:=1
PKG_VERSION:=1.0
include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk
define Package/quectel-CM-5G
@ -17,23 +17,29 @@ define Package/quectel-CM-5G/description
quectel-CM-5G app building test
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) ${TOPDIR}/package/quectel_cm_5G/src/* $(PKG_BUILD_DIR)/
endef
define Build/Compile
$(MAKE) -C "$(PKG_BUILD_DIR)" \
CROSS_COMPILE="$(TARGET_CROSS)" \
ARCH="$(LINUX_KARCH)" \
SUBDIRS="$(PKG_BUILD_DIR)" \
EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \
CC="$(TARGET_CC)"
CC="$(TARGET_CC)" \
endef
define Package/quectel-CM-5G/install
$(INSTALL_DIR) $(1)/usr/bin $(1)/lib/netifd/proto $(1)/lib/netifd
$(INSTALL_BIN) $(PKG_BUILD_DIR)/quectel-CM $(1)/usr/bin/quectel-CM
$(INSTALL_BIN) ./files/rmnet_init.sh $(1)/usr/bin
$(INSTALL_BIN) ./files/rmnet.sh $(1)/lib/netifd/proto
$(INSTALL_BIN) ./files/rmnet.script $(1)/lib/netifd
$(INSTALL_BIN) ./files/rmnet6.sh $(1)/lib/netifd/proto
$(INSTALL_BIN) ./files/rmnet6.script $(1)/lib/netifd
$(INSTALL_BIN) ./files/rmnet.script $(1)/lib/netifd
$(INSTALL_BIN) ./files/rmnet_init.sh $(1)/usr/bin
endef
$(eval $(call BuildPackage,quectel-CM-5G))