Skip to content

Commit

Permalink
package: add wwan Quectel modem packages and luci
Browse files Browse the repository at this point in the history
  • Loading branch information
coolsnowwolf committed Feb 2, 2023
1 parent f143a15 commit a8b2e68
Show file tree
Hide file tree
Showing 227 changed files with 91,084 additions and 0 deletions.
20 changes: 20 additions & 0 deletions package/wwan/app/luci-app-gobinetmodem/Makefile
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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

24 changes: 24 additions & 0 deletions package/wwan/app/luci-app-gobinetmodem/po/zh_Hans/usbmodem.po
Original file line number Diff line number Diff line change
@@ -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 "拨号工具"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
config service
option tool 'quectel-CM'
option enabled '0'

Original file line number Diff line number Diff line change
@@ -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."
}

Original file line number Diff line number Diff line change
@@ -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

15 changes: 15 additions & 0 deletions package/wwan/app/luci-app-pcimodem/Makefile
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
39 changes: 39 additions & 0 deletions package/wwan/app/luci-app-pcimodem/luasrc/model/cbi/pcimodem.lua
Original file line number Diff line number Diff line change
@@ -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

24 changes: 24 additions & 0 deletions package/wwan/app/luci-app-pcimodem/po/zh_Hans/pcimodem.po
Original file line number Diff line number Diff line change
@@ -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 "拨号工具"
4 changes: 4 additions & 0 deletions package/wwan/app/luci-app-pcimodem/root/etc/config/pcimodem
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
config service
option tool 'quectel-CM'
option enabled '0'

75 changes: 75 additions & 0 deletions package/wwan/app/luci-app-pcimodem/root/etc/init.d/pcimodem
Original file line number Diff line number Diff line change
@@ -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."
}


Original file line number Diff line number Diff line change
@@ -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

15 changes: 15 additions & 0 deletions package/wwan/app/luci-app-spdmodem/Makefile
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit a8b2e68

Please sign in to comment.