This commit is contained in:
DHDAXCW 2024-12-14 16:09:18 +08:00
parent 5b3da73bba
commit c5aff168d9
47 changed files with 713 additions and 52 deletions

View File

@ -1,5 +1,5 @@
src-git packages https://github.com/DHDAXCW/packages
src-git luci https://github.com/DHDAXCW/luci
src-git routing https://github.com/coolsnowwolf/routing
src-git telephony https://git.openwrt.org/feed/telephony.git
src-git telephony https://github.com/coolsnowwolf/telephony.git
src-git istore https://github.com/linkease/istore;main

View File

@ -0,0 +1,40 @@
#
# Download realtek r8152 linux driver from official site:
# [https://www.realtek.com/Download/List?cate_id=585]
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=r8152
PKG_VERSION:=2.19.2
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/wget/realtek-r8152-linux/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=03f9a558ebf90d7cd121150f942395be4b96a5d11059fd0d0517db2574731189
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/realtek-$(PKG_NAME)-linux-$(PKG_VERSION)
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
include $(INCLUDE_DIR)/package.mk
define KernelPackage/usb-net-rtl8152-vendor
VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE)
TITLE:=Realtek RTL8152/RTL8153/RTL8154/RTL8156/RTL8157 driver
SUBMENU:=USB Support
DEPENDS:=+kmod-usb-net +LINUX_6_12:kmod-libphy
FILES:=$(PKG_BUILD_DIR)/r8152.ko
AUTOLOAD:=$(call AutoProbe,r8152)
CONFLICTS:=kmod-usb-net-rtl8152
endef
define KernelPackage/usb-net-rtl8152-vendor/description
Kernel module for Realtek RTL8152 USB Ethernet chipsets
endef
define Build/Compile
+$(KERNEL_MAKE) M=$(PKG_BUILD_DIR) modules
endef
$(eval $(call KernelPackage,usb-net-rtl8152-vendor))

View File

@ -0,0 +1,60 @@
# SPDX-License-Identifier: GPL-2.0+
#
# Copyright (c) 2023-2024 AnYun
#
include $(TOPDIR)/rules.mk
PKG_NAME:=aic8800
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2024-03-04
PKG_SOURCE_URL:=https://github.com/radxa-pkg/aic8800.git
PKG_SOURCE_VERSION:=6a7ec8536a1688a785740d98ca96a4d00b274c56
PKG_MIRROR_HASH:=75bbd6f410089d8301663aebdeeb79027420ec45dd054b5851c408dfeef23776
MAKE_PATH:=src/SDIO/driver_fw/driver/aic8800
PKG_EXTMOD_SUBDIRS:=$(MAKE_PATH)
include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk
define KernelPackage/aic8800
SUBMENU:=Wireless Drivers
TITLE:=SKI WB800D80S wireless support
DEPENDS:=+kmod-mac80211 +kmod-mmc \
+@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT
FILES:= \
$(PKG_BUILD_DIR)/$(MAKE_PATH)/aic8800_bsp/aic8800_bsp.ko \
$(PKG_BUILD_DIR)/$(MAKE_PATH)/aic8800_fdrv/aic8800_fdrv.ko
AUTOLOAD:=$(call AutoProbe,aic8800_bsp aic8800_fdrv)
MODPARAMS.aic8800_fdrv:=he_on=n
endef
NOSTDINC_FLAGS := \
$(KERNEL_NOSTDINC_FLAGS) \
-I$(PKG_BUILD_DIR) \
-I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \
-I$(STAGING_DIR)/usr/include/mac80211-backport \
-I$(STAGING_DIR)/usr/include/mac80211/uapi \
-I$(STAGING_DIR)/usr/include/mac80211 \
-include backport/backport.h
EXTRA_CFLAGS:= -DBUILD_OPENWRT
define Build/Compile
+$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \
NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \
$(KERNEL_MAKE_FLAGS) \
M="$(PKG_BUILD_DIR)/$(MAKE_PATH)/" \
modules
endef
define KernelPackage/aic8800/install
$(INSTALL_DIR) $(1)/lib/firmware/aic8800
$(CP) $(PKG_BUILD_DIR)/src/SDIO/driver_fw/fw/aic8800D80/* $(1)/lib/firmware/aic8800
endef
$(eval $(call KernelPackage,aic8800))

View File

@ -0,0 +1,114 @@
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_main.c
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_main.c
@@ -2932,7 +2932,7 @@ static struct rwnx_vif *rwnx_interface_a
vif->ap.generation = 0;
vif->ap.mesh_pm = NL80211_MESH_POWER_ACTIVE;
vif->ap.next_mesh_pm = NL80211_MESH_POWER_ACTIVE;
- // no break
+ fallthrough;
case NL80211_IFTYPE_AP:
INIT_LIST_HEAD(&vif->ap.sta_list);
memset(&vif->ap.bcn, 0, sizeof(vif->ap.bcn));
@@ -3349,7 +3349,7 @@ static int rwnx_cfg80211_change_iface(st
INIT_LIST_HEAD(&vif->ap.proxy_list);
vif->ap.create_path = false;
vif->ap.generation = 0;
- // no break
+ fallthrough;
case NL80211_IFTYPE_AP:
case NL80211_IFTYPE_P2P_GO:
INIT_LIST_HEAD(&vif->ap.sta_list);
@@ -5257,6 +5257,7 @@ static int rwnx_cfg80211_mgmt_tx(struct
switch (RWNX_VIF_TYPE(rwnx_vif)) {
case NL80211_IFTYPE_AP_VLAN:
rwnx_vif = rwnx_vif->ap_vlan.master;
+ fallthrough;
case NL80211_IFTYPE_AP:
case NL80211_IFTYPE_P2P_GO:
case NL80211_IFTYPE_MESH_POINT:
@@ -5569,7 +5570,7 @@ rwnx_cfg80211_tdls_mgmt(struct wiphy *wi
printk("%s: only one TDLS link is supported!\n", __func__);
status_code = WLAN_STATUS_REQUEST_DECLINED;
}
- /* fall-through */
+ fallthrough;
case WLAN_TDLS_SETUP_REQUEST:
case WLAN_TDLS_TEARDOWN:
case WLAN_TDLS_DISCOVERY_REQUEST:
@@ -5889,6 +5890,7 @@ static int rwnx_fill_station_info(struct
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)
case FORMATMOD_HE_MU:
sinfo->rxrate.he_ru_alloc = rx_vect1->he.ru_size;
+ fallthrough;
case FORMATMOD_HE_SU:
case FORMATMOD_HE_ER:
sinfo->rxrate.flags = RATE_INFO_FLAGS_HE_MCS;
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_msg_tx.c
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_msg_tx.c
@@ -524,7 +524,7 @@ int rwnx_send_add_if (struct rwnx_hw *rw
//case NL80211_IFTYPE_P2P_DEVICE:
case NL80211_IFTYPE_P2P_CLIENT:
add_if_req_param->p2p = true;
- // no break
+ fallthrough;
#endif /* CONFIG_RWNX_FULLMAC */
case NL80211_IFTYPE_STATION:
add_if_req_param->type = MM_STA;
@@ -537,7 +537,7 @@ int rwnx_send_add_if (struct rwnx_hw *rw
#ifdef CONFIG_RWNX_FULLMAC
case NL80211_IFTYPE_P2P_GO:
add_if_req_param->p2p = true;
- // no break
+ fallthrough;
#endif /* CONFIG_RWNX_FULLMAC */
case NL80211_IFTYPE_AP:
add_if_req_param->type = MM_AP;
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_tdls.c
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_tdls.c
@@ -255,17 +255,24 @@ rwnx_add_wmm_info_ie(struct sk_buff *skb
static u8 rwnx_ac_from_wmm(int ac)
{
switch (ac) {
- default:
- WARN_ON_ONCE(1);
case 0:
return AC_BE;
+ break;
case 1:
return AC_BK;
+ break;
case 2:
return AC_VI;
+ break;
case 3:
return AC_VO;
+ break;
+ default:
+ WARN_ON_ONCE(1);
+ break;
}
+
+ return 0;
}
static void
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_tx.c
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_tx.c
@@ -325,6 +325,7 @@ u16 rwnx_select_txq(struct rwnx_vif *rwn
/* AP_VLAN interface is not used for a 4A STA,
fallback searching sta amongs all AP's clients */
rwnx_vif = rwnx_vif->ap_vlan.master;
+ fallthrough;
case NL80211_IFTYPE_AP:
case NL80211_IFTYPE_P2P_GO:
{
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_txq.c
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_txq.c
@@ -635,6 +635,7 @@ static inline void rwnx_txq_vif_for_each
}
case NL80211_IFTYPE_AP_VLAN:
rwnx_vif = rwnx_vif->ap_vlan.master;
+ fallthrough;
case NL80211_IFTYPE_AP:
case NL80211_IFTYPE_MESH_POINT:
case NL80211_IFTYPE_P2P_GO:

View File

@ -0,0 +1,12 @@
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_bsp/Makefile
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_bsp/Makefile
@@ -1,7 +1,7 @@
CONFIG_SDIO_SUPPORT := y
CONFIG_SDIO_PWRCTRL := y
-CONFIG_AIC_FW_PATH = "/vendor/etc/firmware"
-#CONFIG_AIC_FW_PATH = "/lib/firmware/aic8800"
+#CONFIG_AIC_FW_PATH = "/vendor/etc/firmware"
+CONFIG_AIC_FW_PATH = "/lib/firmware/aic8800"
export CONFIG_AIC_FW_PATH
ccflags-y += -DCONFIG_AIC_FW_PATH=\"$(CONFIG_AIC_FW_PATH)\"

View File

@ -0,0 +1,92 @@
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_compat.h
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_compat.h
@@ -52,7 +52,7 @@
#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 60)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 60) || defined(BUILD_OPENWRT)
#define IEEE80211_MAX_AMPDU_BUF IEEE80211_MAX_AMPDU_BUF_HE
#define IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMER_FB IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMING_PARTIAL_BW_FB
#define IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMER_FB IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMING_FB
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_main.c
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_main.c
@@ -2998,7 +2998,7 @@ static struct rwnx_vif *rwnx_interface_a
} else
vif->use_4addr = false;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0) || defined(BUILD_OPENWRT)
if (cfg80211_register_netdevice(ndev))
#else
if (register_netdevice(ndev))
@@ -3271,7 +3271,7 @@ static int rwnx_cfg80211_del_iface(struc
if (dev->reg_state == NETREG_REGISTERED) {
/* Will call rwnx_close if interface is UP */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0) || defined(BUILD_OPENWRT)
cfg80211_unregister_netdevice(dev);
#else
unregister_netdevice(dev);
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_mod_params.c
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_mod_params.c
@@ -1312,7 +1312,7 @@ static void rwnx_set_he_capa(struct rwnx
if (rwnx_hw->mod_params->stbc_on)
he_cap->he_cap_elem.phy_cap_info[2] |= IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ;
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0)
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0) || defined(BUILD_OPENWRT)
he_cap->he_cap_elem.phy_cap_info[3] |= IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_16_QAM |
IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_1 |
IEEE80211_HE_PHY_CAP3_RX_PARTIAL_BW_SU_IN_20MHZ_MU;
@@ -1330,7 +1330,7 @@ static void rwnx_set_he_capa(struct rwnx
}
he_cap->he_cap_elem.phy_cap_info[5] |= IEEE80211_HE_PHY_CAP5_NG16_SU_FEEDBACK |
IEEE80211_HE_PHY_CAP5_NG16_MU_FEEDBACK;
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0)
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0) || defined(BUILD_OPENWRT)
he_cap->he_cap_elem.phy_cap_info[6] |= IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_42_SU |
IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_75_MU |
IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMING_FB |
@@ -1429,7 +1429,7 @@ static void rwnx_set_he_capa(struct rwnx
#endif
if (rwnx_hw->mod_params->stbc_on)
he_cap->he_cap_elem.phy_cap_info[2] |= IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ;
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0)
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0) || defined(BUILD_OPENWRT)
he_cap->he_cap_elem.phy_cap_info[3] |= IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_16_QAM |
IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_1 |
IEEE80211_HE_PHY_CAP3_RX_PARTIAL_BW_SU_IN_20MHZ_MU;
@@ -1446,7 +1446,7 @@ static void rwnx_set_he_capa(struct rwnx
}
he_cap->he_cap_elem.phy_cap_info[5] |= IEEE80211_HE_PHY_CAP5_NG16_SU_FEEDBACK |
IEEE80211_HE_PHY_CAP5_NG16_MU_FEEDBACK;
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0)
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0) || defined(BUILD_OPENWRT)
he_cap->he_cap_elem.phy_cap_info[6] |= IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_42_SU |
IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_75_MU |
IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMING_FB |
@@ -1732,7 +1732,7 @@ void rwnx_custregd(struct rwnx_hw *rwnx_
wiphy->regulatory_flags |= REGULATORY_WIPHY_SELF_MANAGED;
rtnl_lock();
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0)
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0) || defined(BUILD_OPENWRT)
if (regulatory_set_wiphy_regd_sync(wiphy, getRegdomainFromRwnxDB(wiphy, default_ccode))){
wiphy_err(wiphy, "Failed to set custom regdomain\n");
}
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_radar.c
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_radar.c
@@ -1282,7 +1282,11 @@ static void rwnx_radar_detected(struct r
chan_def = rwnx_hw->chanctx_table[rwnx_hw->cur_chanctx].chan_def;
rwnx_radar_cancel_cac(&rwnx_hw->radar);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0) || defined(BUILD_OPENWRT)
+ __cfg80211_radar_event(rwnx_hw->wiphy, &chan_def, true, GFP_KERNEL);
+#else
cfg80211_radar_event(rwnx_hw->wiphy, &chan_def, GFP_KERNEL);
+#endif
#endif /* CONFIG_RWNX_FULLMAC */
}

View File

@ -0,0 +1,159 @@
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_main.c
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_main.c
@@ -776,7 +776,7 @@ static void rwnx_csa_finish(struct work_
spin_unlock_bh(&rwnx_hw->cb_lock);
#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION3)
cfg80211_ch_switch_notify(vif->ndev, &csa->chandef, 0, 0);
-#elif (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION)
+#elif (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION) || defined(BUILD_OPENWRT)
cfg80211_ch_switch_notify(vif->ndev, &csa->chandef, 0);
#else
cfg80211_ch_switch_notify(vif->ndev, &csa->chandef);
@@ -3540,7 +3540,7 @@ bool key_flag = false;
* when adding a group key.
*/
static int rwnx_cfg80211_add_key(struct wiphy *wiphy, struct net_device *netdev,
-#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2)
+#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2) || defined(BUILD_OPENWRT)
int link_id,
#endif
u8 key_index, bool pairwise, const u8 *mac_addr,
@@ -3637,7 +3637,7 @@ bool key_flag = false;
*
*/
static int rwnx_cfg80211_get_key(struct wiphy *wiphy, struct net_device *netdev,
-#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2)
+#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2) || defined(BUILD_OPENWRT)
int link_id,
#endif
u8 key_index, bool pairwise, const u8 *mac_addr,
@@ -3655,7 +3655,7 @@ static int rwnx_cfg80211_get_key(struct
* and @key_index, return -ENOENT if the key doesn't exist.
*/
static int rwnx_cfg80211_del_key(struct wiphy *wiphy, struct net_device *netdev,
-#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2)
+#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2) || defined(BUILD_OPENWRT)
int link_id,
#endif
u8 key_index, bool pairwise, const u8 *mac_addr)
@@ -3694,7 +3694,7 @@ static int rwnx_cfg80211_del_key(struct
*/
static int rwnx_cfg80211_set_default_key(struct wiphy *wiphy,
struct net_device *netdev,
-#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2)
+#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2) || defined(BUILD_OPENWRT)
int link_id,
#endif
u8 key_index, bool unicast, bool multicast)
@@ -3709,7 +3709,7 @@ static int rwnx_cfg80211_set_default_key
*/
static int rwnx_cfg80211_set_default_mgmt_key(struct wiphy *wiphy,
struct net_device *netdev,
-#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2)
+#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2) || defined(BUILD_OPENWRT)
int link_id,
#endif
u8 key_index)
@@ -3796,7 +3796,7 @@ static int rwnx_cfg80211_connect(struct
key_params.seq_len = 0;
key_params.cipher = sme->crypto.cipher_group;
rwnx_cfg80211_add_key(wiphy, dev,
-#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2)
+#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2) || defined(BUILD_OPENWRT)
0,
#endif
sme->key_idx, false, NULL, &key_params);
@@ -4063,7 +4063,7 @@ static int rwnx_cfg80211_add_station(str
sta->vif_idx = rwnx_vif->vif_index;
sta->vlan_idx = sta->vif_idx;
sta->qos = (params->sta_flags_set & BIT(NL80211_STA_FLAG_WME)) != 0;
-#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION
+#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION || defined(BUILD_OPENWRT)
sta->ht = params->link_sta_params.ht_capa ? 1 : 0;
sta->vht = params->link_sta_params.vht_capa ? 1 : 0;
#else
@@ -4469,7 +4469,7 @@ static int rwnx_cfg80211_change_station(
sta->vif_idx = rwnx_vif->vif_index;
sta->vlan_idx = sta->vif_idx;
sta->qos = (params->sta_flags_set & BIT(NL80211_STA_FLAG_WME)) != 0;
-#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION
+#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION || defined(BUILD_OPENWRT)
sta->ht = params->link_sta_params.ht_capa ? 1 : 0;
sta->vht = params->link_sta_params.vht_capa ? 1 : 0;
#else
@@ -4716,7 +4716,7 @@ static int rwnx_cfg80211_change_beacon(s
/**
* * @stop_ap: Stop being an AP, including stopping beaconing.
*/
-#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION)
+#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION) || defined(BUILD_OPENWRT)
static int rwnx_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *dev, unsigned int link_id)
#else
static int rwnx_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *dev)
@@ -5190,7 +5190,7 @@ static int rwnx_cfg80211_dump_survey(str
*/
static int rwnx_cfg80211_get_channel(struct wiphy *wiphy,
struct wireless_dev *wdev,
-#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION
+#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION || defined(BUILD_OPENWRT)
unsigned int link_id,
#endif
struct cfg80211_chan_def *chandef)
@@ -5487,7 +5487,7 @@ int rwnx_cfg80211_channel_switch (struct
INIT_WORK(&csa->work, rwnx_csa_finish);
#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION4
cfg80211_ch_switch_started_notify(dev, &csa->chandef, 0, params->count, false, 0);
-#elif LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2
+#elif LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2 || defined(BUILD_OPENWRT)
cfg80211_ch_switch_started_notify(dev, &csa->chandef, 0, params->count, false);
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0)
cfg80211_ch_switch_started_notify(dev, &csa->chandef, params->count, params->block_tx);
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_msg_rx.c
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_msg_rx.c
@@ -836,7 +836,7 @@ static inline int rwnx_rx_sm_connect_ind
do {
bss = cfg80211_get_bss(wdev->wiphy, NULL, rwnx_vif->sta.bssid,
-#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION
+#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION || defined(BUILD_OPENWRT)
wdev->u.client.ssid, wdev->u.client.ssid_len,
#else
wdev->ssid, wdev->ssid_len,
@@ -866,7 +866,7 @@ static inline int rwnx_rx_sm_connect_ind
#else
WLAN_CAPABILITY_ESS,
#endif
-#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION
+#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION || defined(BUILD_OPENWRT)
(int)wdev->u.client.ssid_len,
wdev->u.client.ssid,
#else
@@ -887,7 +887,7 @@ static inline int rwnx_rx_sm_connect_ind
rwnx_vif->sta.bssid[0], rwnx_vif->sta.bssid[1], rwnx_vif->sta.bssid[2],
rwnx_vif->sta.bssid[3], rwnx_vif->sta.bssid[4], rwnx_vif->sta.bssid[5]);
-#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION
+#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION || defined(BUILD_OPENWRT)
wdev->u.client.ssid_len = (int)rwnx_vif->sta.ssid_len;
memcpy(wdev->u.client.ssid, rwnx_vif->sta.ssid, wdev->u.client.ssid_len);
#else
@@ -927,7 +927,7 @@ static inline int rwnx_rx_sm_connect_ind
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
struct cfg80211_roam_info info;
memset(&info, 0, sizeof(info));
-#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION
+#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION || defined(BUILD_OPENWRT)
if (rwnx_vif->ch_index < NX_CHAN_CTXT_CNT)
info.links[0].channel = rwnx_hw->chanctx_table[rwnx_vif->ch_index].chan_def.chan;
info.links[0].bssid = (const u8 *)ind->bssid.array;
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_msg_tx.c
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_msg_tx.c
@@ -1941,7 +1941,7 @@ int rwnx_send_me_sta_add(struct rwnx_hw
{
struct me_sta_add_req *req;
-#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION
+#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION || defined(BUILD_OPENWRT)
struct link_station_parameters *link_sta_params = &params->link_sta_params;
#else
struct station_parameters *link_sta_params = params;

View File

@ -0,0 +1,13 @@
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_compat.h
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_compat.h
@@ -47,8 +47,8 @@
#else
#define HIGH_KERNEL_VERSION KERNEL_VERSION(6, 0, 0)
#define HIGH_KERNEL_VERSION2 KERNEL_VERSION(6, 1, 0)
-#define HIGH_KERNEL_VERSION3 KERNEL_VERSION(6, 3, 0)
-#define HIGH_KERNEL_VERSION4 KERNEL_VERSION(6, 3, 0)
+#define HIGH_KERNEL_VERSION3 KERNEL_VERSION(6, 9, 0)
+#define HIGH_KERNEL_VERSION4 KERNEL_VERSION(6, 9, 0)
#endif

View File

@ -0,0 +1,32 @@
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_bsp/aic_bsp_main.c
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_bsp/aic_bsp_main.c
@@ -15,7 +15,7 @@
#define DRV_AUTHOR "AICSemi"
#define DRV_VERS_MOD "1.0"
-int aicwf_dbg_level_bsp = LOGERROR|LOGINFO|LOGDEBUG|LOGTRACE;
+int aicwf_dbg_level_bsp = LOGDATA;
static struct platform_device *aicbsp_pdev;
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_main.c
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_main.c
@@ -503,7 +503,7 @@ static const int rwnx_hwq2uapsd[NL80211_
extern uint8_t scanning;
-int aicwf_dbg_level = LOGERROR|LOGINFO|LOGDEBUG|LOGTRACE;
+int aicwf_dbg_level = LOGWAKELOCK;
module_param(aicwf_dbg_level, int, 0660);
int testmode = 0;
char aic_fw_path[200];
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_tx.c
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_tx.c
@@ -169,7 +169,6 @@ void rwnx_ps_bh_traffic_req(struct rwnx_
// sta->mac_addr))
// return;
if (!sta->ps.active) {
- printk("sta %pM is not in Power Save mode", sta->mac_addr);
return;
}
#ifdef CREATE_TRACE_POINTS

View File

@ -43,11 +43,15 @@ define Package/autocore-arm/install
$(INSTALL_DIR) $(1)/etc
$(INSTALL_DATA) ./files/arm/index.htm $(1)/etc/index.htm
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) ./files/60-autocore-reload-rpcd $(1)/etc/uci-defaults/
$(INSTALL_BIN) ./files/arm/090-cover-index_htm $(1)/etc/uci-defaults/
$(INSTALL_DIR) $(1)/sbin
$(INSTALL_BIN) ./files/arm/sbin/cpuinfo $(1)/sbin/cpuinfo
$(INSTALL_BIN) ./files/arm/sbin/ethinfo $(1)/sbin/ethinfo
$(INSTALL_BIN) ./files/arm/sbin/usage $(1)/sbin/usage
$(INSTALL_BIN) ./files/arm/sbin/tempinfo $(1)/sbin/tempinfo
$(INSTALL_DIR) $(1)/usr/share/rpcd/acl.d
$(CP) ./files/luci-mod-status-autocore.json $(1)/usr/share/rpcd/acl.d/
endef
define Package/autocore-x86/install
@ -55,8 +59,12 @@ define Package/autocore-x86/install
$(INSTALL_BIN) ./files/x86/autocore $(1)/etc/init.d/autocore
$(INSTALL_DIR) $(1)/etc
$(INSTALL_DATA) ./files/x86/index.htm $(1)/etc/index.htm
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) ./files/60-autocore-reload-rpcd $(1)/etc/uci-defaults/
$(INSTALL_DIR) $(1)/sbin
$(CP) ./files/x86/sbin/* $(1)/sbin
$(INSTALL_DIR) $(1)/usr/share/rpcd/acl.d
$(CP) ./files/luci-mod-status-autocore.json $(1)/usr/share/rpcd/acl.d/
endef
$(eval $(call BuildPackage,autocore-arm))

View File

@ -0,0 +1,5 @@
#!/bin/sh
/etc/init.d/rpcd restart
exit 0

View File

@ -0,0 +1,40 @@
#!/bin/sh
. /etc/openwrt_release
IEEE_PATH="/sys/class/ieee80211"
THERMAL_PATH="/sys/class/thermal"
case "$DISTRIB_TARGET" in
ipq40xx/*|ipq806x/*)
wifi_temp="$(awk '{printf("%.1f°C ", $0 / 1000)}' "$IEEE_PATH"/phy*/device/hwmon/hwmon*/temp1_input 2>"/dev/null" | awk '$1=$1')"
;;
mediatek/mt7622)
wifi_temp="$(awk '{printf("%.1f°C ", $0 / 1000)}' "$IEEE_PATH"/wl*/hwmon*/temp1_input 2>"/dev/null" | awk '$1=$1')"
;;
*)
wifi_temp="$(awk '{printf("%.1f°C ", $0 / 1000)}' "$IEEE_PATH"/phy*/hwmon*/temp1_input 2>"/dev/null" | awk '$1=$1')"
;;
esac
case "$DISTRIB_TARGET" in
ipq40xx/*)
if [ -e "$IEEE_PATH/phy0/hwmon0/temp1_input" ]; then
mt76_temp="$(awk -F ': ' '{print $2}' "$IEEE_PATH/phy0/hwmon0/temp1_input" 2>"/dev/null")°C"
fi
[ -z "$mt76_temp" ] || wifi_temp="${wifi_temp:+$wifi_temp }$mt76_temp"
;;
*)
cpu_temp="$(awk '{printf("%.1f°C", $0 / 1000)}' "$THERMAL_PATH/thermal_zone0/temp" 2>"/dev/null")"
;;
esac
if [ -n "$cpu_temp" ] && [ -z "$wifi_temp" ]; then
echo -n "CPU: $cpu_temp"
elif [ -z "$cpu_temp" ] && [ -n "$wifi_temp" ]; then
echo -n "WiFi: $wifi_temp"
elif [ -n "$cpu_temp" ] && [ -n "$wifi_temp" ]; then
echo -n "CPU: $cpu_temp, WiFi: $wifi_temp"
else
echo -n "No temperature info"
fi

View File

@ -2,7 +2,7 @@
NSS_PATH="/sys/kernel/debug/qca-nss-drv/stats"
cpu_usage="$(top -n1 | awk '/^CPU/ {printf("%d%", 100 - $8)}')"
cpu_usage="$(busybox top -n1 | awk '/^CPU/ {printf("%d%", 100 - $8)}')"
[ ! -d "$NSS_PATH" ] || \
npu_usage="$(grep '%' "$NSS_PATH"/cpu_load_ubi | awk -F ' ' '{print $2}')"

View File

@ -0,0 +1,10 @@
{
"luci-mod-status-autocore": {
"description": "Grant access to autocore",
"read": {
"ubus": {
"luci": [ "getCPUInfo", "getCPUUsage", "getTempInfo" ]
}
}
}
}

View File

@ -28,7 +28,7 @@ start()
d=$(echo -n 'C')
e=$(cat /proc/cpuinfo | grep 'processor' | wc -l)
f=$(echo -n 'T ')
g=$(dmesg | grep 'DMI:' | awk -F ',' '{print $1 }' | awk -F ':' '{print $2 }')
g=$(dmesg | grep 'DMI:' | awk -F ',' '{print $1 }' | awk -F ':' '{print $2 }' | head -n 1)
if [ -d /sys/devices/cpu_atom/ ]; then
pcore=$(cat /sys/devices/cpu_core/cpus | awk -F- '{print $2}')

View File

@ -9,21 +9,43 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=autosamba
PKG_VERSION:=1
PKG_RELEASE:=13
PKG_RELEASE:=15
PKG_ARCH:=all
PKG_CONFIG_DEPENDS:= \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_KSMBD \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_SAMBA3 \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_SAMBA4 \
include $(INCLUDE_DIR)/package.mk
define Package/autosamba
TITLE:=Samba autoconfig hotplug script.
MAINTAINER:=Lean
DEPENDS:=+luci-app-samba4 +wsdd2
DEPENDS:=+wsdd2 +PACKAGE_$(PKG_NAME)_INCLUDE_KSMBD:luci-app-ksmbd +PACKAGE_$(PKG_NAME)_INCLUDE_SAMBA3:luci-app-samba +PACKAGE_$(PKG_NAME)_INCLUDE_SAMBA4:luci-app-samba4
endef
define Package/autosamba/description
A hotplug script to config Samba share automatically.
endef
define Package/$(PKG_NAME)/config
choice
prompt "Samba Server Selection"
default PACKAGE_$(PKG_NAME)_INCLUDE_KSMBD
config PACKAGE_$(PKG_NAME)_INCLUDE_KSMBD
bool "KSMBD"
config PACKAGE_$(PKG_NAME)_INCLUDE_SAMBA3
bool "SAMBA 3"
config PACKAGE_$(PKG_NAME)_INCLUDE_SAMBA4
bool "SAMBA 4"
endchoice
endef
define Build/Compile
endef

View File

@ -39,8 +39,9 @@ define Package/ddns-scripts_aliyun/preinst
endef
define Package/ddns-scripts_aliyun/install
$(INSTALL_DIR) $(1)/usr/lib/ddns
$(INSTALL_BIN) $(PKG_BUILD_DIR)/update_aliyun_com.sh $(1)/usr/lib/ddns
$(INSTALL_DIR) $(1)/usr/lib/ddns $(1)/usr/share/ddns/default
$(INSTALL_BIN) $(CURDIR)/update_aliyun_com.sh $(1)/usr/lib/ddns
$(INSTALL_DATA) $(CURDIR)/aliyun.com.json $(1)/usr/share/ddns/default
endef
define Package/ddns-scripts_aliyun/postinst

View File

@ -0,0 +1,9 @@
{
"name": "aliyun.com",
"ipv4": {
"url": "update_aliyun_com.sh"
},
"ipv6": {
"url": "update_aliyun_com.sh"
}
}

View File

@ -28,7 +28,6 @@ define Build/Configure
endef
define Build/Compile
$(CP) ./*.sh $(PKG_BUILD_DIR)
endef
define Package/ddns-scripts_dnspod/preinst
@ -39,8 +38,9 @@ define Package/ddns-scripts_dnspod/preinst
endef
define Package/ddns-scripts_dnspod/install
$(INSTALL_DIR) $(1)/usr/lib/ddns
$(INSTALL_BIN) $(PKG_BUILD_DIR)/*.sh $(1)/usr/lib/ddns
$(INSTALL_DIR) $(1)/usr/lib/ddns $(1)/usr/share/ddns/default
$(INSTALL_BIN) $(CURDIR)/*.sh $(1)/usr/lib/ddns
$(INSTALL_DATA) $(CURDIR)/*.json $(1)/usr/share/ddns/default
endef
define Package/ddns-scripts_dnspod/postinst

View File

@ -0,0 +1,9 @@
{
"name": "dnspod.com",
"ipv4": {
"url": "update_dnspod_cn.sh"
},
"ipv6": {
"url": "update_dnspod_cn.sh"
}
}

View File

@ -0,0 +1,9 @@
{
"name": "dnspod.com",
"ipv4": {
"url": "update_dnspod_com.sh"
},
"ipv6": {
"url": "update_dnspod_com.sh"
}
}

View File

@ -1,8 +1,5 @@
#!/bin/sh
uci set luci.main.lang=zh_cn
uci commit luci
uci -q batch <<-EOF
set system.@system[0].timezone='CST-8'
set system.@system[0].zonename='Asia/Shanghai'
@ -11,13 +8,10 @@ uci -q batch <<-EOF
add_list system.ntp.server='ntp1.aliyun.com'
add_list system.ntp.server='ntp.tencent.com'
add_list system.ntp.server='ntp.ntsc.ac.cn'
add_list system.ntp.server='time.ustc.edu.cn'
add_list system.ntp.server='time.apple.com'
EOF
uci commit system
uci set fstab.@global[0].anon_mount=1
uci commit fstab
rm -f /usr/lib/lua/luci/view/admin_status/index/mwan.htm
rm -f /usr/lib/lua/luci/view/admin_status/index/upnp.htm
rm -f /usr/lib/lua/luci/view/admin_status/index/ddns.htm
@ -36,6 +30,8 @@ sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/usb_printer.lua
sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/xunlei.lua
sed -i 's/services/nas/g' /usr/lib/lua/luci/view/minidlna_status.htm
sed -i 's/\"services\"/\"nas\"/g' /usr/share/luci/menu.d/luci-app-samba4.json
sed -i 's#downloads.openwrt.org#mirrors.tencent.com/lede#g' /etc/opkg/distfeeds.conf
sed -i 's/root::0:0:99999:7:::/root:$1$V4UetPzk$CYXluq4wUazHjmCDBCqXF.:0:0:99999:7:::/g' /etc/shadow
sed -i 's/root:::0:99999:7:::/root:$1$V4UetPzk$CYXluq4wUazHjmCDBCqXF.:0:0:99999:7:::/g' /etc/shadow
@ -51,15 +47,13 @@ sed -i '/option disabled/d' /etc/config/wireless
sed -i '/set wireless.radio${devidx}.disabled/d' /lib/wifi/mac80211.sh
sed -i '/DISTRIB_REVISION/d' /etc/openwrt_release
echo "DISTRIB_REVISION='R24.8.1'" >> /etc/openwrt_release
echo "DISTRIB_REVISION='R24.12.12'" >> /etc/openwrt_release
sed -i '/DISTRIB_DESCRIPTION/d' /etc/openwrt_release
echo "DISTRIB_DESCRIPTION='OpenWrt '" >> /etc/openwrt_release
echo "DISTRIB_DESCRIPTION='LEDE '" >> /etc/openwrt_release
sed -i '/log-facility/d' /etc/dnsmasq.conf
echo "log-facility=/dev/null" >> /etc/dnsmasq.conf
#ln -sf /sbin/ip /usr/bin/ip
rm -rf /tmp/luci-modulecache/
rm -f /tmp/luci-indexcache

View File

@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=leigod-acc
PKG_VERSION:=1.3.0.30
PKG_RELEASE:=1
PKG_RELEASE:=2
include $(INCLUDE_DIR)/package.mk
@ -26,18 +26,32 @@ endef
ifeq ($(ARCH),x86_64)
acc-arch:=amd64
endif
ifeq ($(ARCH),mipsel)
acc-arch:=mipsle
endif
ifeq ($(ARCH),arm)
acc-arch:=arm
endif
ifeq ($(ARCH),aarch64)
acc-arch:=arm64
PKG_HASH:=c26e2cde79ef21991834a94232520d1e5ac2df88a6382cb436a61865a8d9c15e
endif
ifeq ($(ARCH),mipsel)
acc-arch:=mipsle
PKG_HASH:=ac35cf6e19fc5028ac1da9921456726a14e0726339e89fe3e14c01a713140e57
endif
ifeq ($(ARCH),arm)
acc-arch:=arm
PKG_HASH:=c904bb3f41910d50ae6e8abc1e2a0b73eed6d74fb5c3b55274b82e9d4662a426
endif
ifeq ($(ARCH),aarch64)
acc-arch:=arm64
PKG_HASH:=316a604645f4216276dc5642d5f638a005b342771fb436a3c63826d85c5b5c1b
endif
PKG_SOURCE_URL:=http://119.3.40.126/router_plugin/
PKG_SOURCE:=acc-gw.linux.$(acc-arch)
define Build/Prepare
$(call Build/Prepare/Default)
mkdir -p $(PKG_BUILD_DIR)/bin
wget -O $(PKG_BUILD_DIR)/bin/acc-gw.linux.$(acc-arch) $(PKG_SOURCE_URL)$(PKG_SOURCE)
chmod +x $(PKG_BUILD_DIR)/bin/acc-gw.linux.$(acc-arch)
endef
define Build/Configure
@ -48,9 +62,10 @@ endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/sbin/leigod
$(INSTALL_BIN) ./files/acc-gw.linux.$(acc-arch) $(1)/usr/sbin/leigod/acc-gw.linux.$(acc-arch)
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/acc-gw.linux.$(acc-arch) $(1)/usr/sbin/leigod/acc-gw.linux.$(acc-arch)
$(INSTALL_BIN) ./files/leigod_uninstall.sh $(1)/usr/sbin/leigod/leigod_uninstall.sh
$(INSTALL_BIN) ./files/plugin_common.sh $(1)/usr/sbin/leigod/plugin_common.sh
$(INSTALL_BIN) ./files/leigod-helper.sh $(1)/usr/sbin/leigod/leigod-helper.sh
$(INSTALL_BIN) ./files/update_plugin $(1)/usr/sbin/leigod/update_plugin
$(INSTALL_DATA) ./files/version $(1)/usr/sbin/leigod/version
endef

View File

@ -8,9 +8,9 @@ include $(TOPDIR)/rules.mk
LUCI_TITLE:=Luci for Leigod Game Accelerater
LUCI_PKGARCH:=all
LUCI_DEPENDS:=+libpcap +iptables +kmod-ipt-nat +iptables-mod-tproxy +kmod-ipt-tproxy +kmod-tun +kmod-netem +tc-full +kmod-ipt-ipset +ipset +curl +miniupnpd +conntrack +conntrackd +leigod-acc
LUCI_DEPENDS:=+libpcap +iptables +kmod-ipt-nat +iptables-mod-tproxy +kmod-ipt-tproxy +kmod-tun +kmod-netem +tc-full +kmod-ipt-ipset +ipset +curl +miniupnpd +conntrack +conntrackd +leigod-acc +jq
PKG_VERSION:=1
PKG_RELEASE:=3
PKG_RELEASE:=5
include $(TOPDIR)/feeds/luci/luci.mk

View File

@ -10,6 +10,7 @@ function index()
entry({ "admin", "services", "acc", "status" }, call("get_acc_status")).leaf = true
entry({ "admin", "services", "acc", "start_acc_service" }, call("start_acc_service"))
entry({ "admin", "services", "acc", "stop_acc_service" }, call("stop_acc_service"))
entry({ "admin", "services", "acc", "schedule_pause" }, call("schedule_pause"))
end
-- get_acc_status get acc status
@ -78,24 +79,26 @@ end
function schedule_pause()
local util = require "luci.util"
local uci = require "luci.model.uci".cursor()
local schedule_enabled = uci:get("accelerator", "system", "schedule_enabled") or "0"
local pause_time = uci:get("accelerator", "system", "pause_time") or "01:00"
local username = uci:get("accelerator", "system", "username") or ""
local password = uci:get("accelerator", "system", "password") or ""
-- Remove existing cron jobs related to leigod_helper.sh
util.exec("sed -i '/usr/sbin/leigod/leigod_helper.sh/d' /etc/crontabs/root")
-- Remove existing cron jobs related to leigod-helper.sh
util.exec("sed -i '/\\/usr\\/sbin\\/leigod\\/leigod-helper.sh/d' /etc/crontabs/root")
if schedule_enabled == "1" then
-- Set the new cron job
local hour, minute = pause_time:match("(%d+):(%d+)")
local cron_time = string.format("%d %d * * * USERNAME=%s PASSWORD=%s /usr/sbin/leigod/leigod_helper.sh", tonumber(minute), tonumber(hour), username, password)
util.exec(string.format('echo "%s" >> /etc/crontabs/root', cron_time))
util.exec("/etc/init.d/cron restart")
local hour, minute = pause_time:match("(%d+):(%d+)")
local cron_time = string.format("%s %s * * * USERNAME='%s' PASSWORD='%s' /usr/sbin/leigod/leigod-helper.sh", tonumber(minute), tonumber(hour), username, password)
-- Add new cron job
local cron_command = string.format('echo "%s" >> /etc/crontabs/root', cron_time)
util.exec(cron_command)
util.exec("/etc/init.d/cron restart")
end
local resp = {}
resp.result = "OK"
local resp = { result = "OK" }
luci.http.prepare_content("application/json")
luci.http.write_json(resp)
end
end

View File

@ -21,26 +21,24 @@ tun.description = translate("Turning Leigod into Tunnel mode can make some proxy
schedule_enabled = s:option(Flag, "schedule_enabled", translate("Scheduled Pause"))
schedule_enabled.rmempty = false
schedule_enabled.default = 0
schedule_enabled.description = translate("夜猫子选项")
schedule_enabled.description = translate("Enable scheduled pause for Leigod Accelerator")
pause_time = s:option(ListValue, "pause_time", translate("Pause Time"))
pause_time:depends("schedule_enabled", 1)
for i = 0, 23 do
pause_time:value(string.format("%02d:00", i), string.format("%02d:00", i))
end
pause_time.rmempty = false
pause_time.description = translate("选择好时间雷神加速器会定时暂停,请避开你的游戏时间以免影响游戏体验")
pause_time.rmempty = true
username = s:option(Value, "username", translate("Phone Number"))
username:depends("schedule_enabled", 1)
username.rmempty = false
username.rmempty = true
password = s:option(Value, "password", translate("Leigod Password"))
password:depends("schedule_enabled", 1)
password.password = true
password.rmempty = false
password.rmempty = true
m:section(SimpleSection).template = "leigod/service"
return m
return m

View File

@ -0,0 +1 @@
zh_Hans

View File

@ -86,11 +86,26 @@ msgstr "未分类设备"
msgid "Tunnel Mode"
msgstr "TUN 模式"
msgid "Turning Leigod into Tunnel mode can make some proxy plugins available"
msgstr "将雷神加速器设为 TUN 模式可以使一些 proxy 插件可用"
msgid "Enable scheduled pause for Leigod Accelerator"
msgstr "启用后将在预设时间执行暂停时长操作"
msgid "Pause Time"
msgstr "设置计划定时暂停的时间"
msgid "Phone Number"
msgstr "手机号码"
msgid "Leigod Password"
msgstr "雷神密码"
msgid "PC_Catalog"
msgstr "PC 设备"
msgid "Game_Catalog"
msgstr "游戏机"
msgstr "游戏机"
msgid "VR_Catalog"
msgstr "VR 设备"