Skip to content
This repository has been archived by the owner on Jun 23, 2023. It is now read-only.

Commit

Permalink
add support 22.03
Browse files Browse the repository at this point in the history
changed the algorithm for applying settings ("reload", "Save & Apply")
and other small changes
  • Loading branch information
Azexios committed Sep 4, 2022
1 parent cccc8b9 commit e15bc2e
Show file tree
Hide file tree
Showing 15 changed files with 89 additions and 63 deletions.
8 changes: 2 additions & 6 deletions README_RU.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Для сборки прошивки я использую **Ubuntu 22.04 LTS** (на других OS не проверял).
Для сборки прошивки я использую **Ubuntu 22.04 LTS** (на других OS не проверял).
*Инструкция только о том как заменить драйвер, Вы должны уметь собирать OpenWrt из исходников.*

1. Клонировать исходный код и перенести в каталог openwrt (вместо /home/alex/openwrt указать свой путь до openwrt):

Expand Down Expand Up @@ -37,8 +38,3 @@ cd openwrt-r3p-mtk
git pull
rsync -av target/ /home/alex/openwrt/target && rsync -av --delete package/mt/ /home/alex/openwrt/package/mt
```
---
### При сборке OpenWrt 22.03
Заменить "time_t" на "time64_t":
https://github.com/Azexios/openwrt-r3p-mtk/blob/1a6e953fda106788b4862c6a0317afd0dfdd6272/package/mt/drivers/mt7603e/src/mt7603_wifi/common/bn_lib.c#L6400
https://github.com/Azexios/openwrt-r3p-mtk/blob/1a6e953fda106788b4862c6a0317afd0dfdd6272/package/mt/drivers/mt7615d/src/mt_wifi/embedded/security/bn_lib.c#L6429
2 changes: 1 addition & 1 deletion package/mt/drivers/mt7603e/src/mt7603_wifi/common/bn_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -6397,7 +6397,7 @@ static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom)
{
unsigned char *buf = NULL;
int ret = 0, bit, bytes, mask;
time_t tim;
time64_t tim;
UINT32 i;

if (bits == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6426,7 +6426,7 @@ static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom)
{
unsigned char *buf = NULL;
int ret = 0, bit, bytes, mask;
time_t tim;
time64_t tim;
UINT32 i;

if (bits == 0) {
Expand Down
2 changes: 1 addition & 1 deletion package/mt/drivers/mt_wifi/files/mt7603.dat
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ NoForwarding=0
NoForwardingBTNBSSID=0
PERCENTAGEenable=0
PktAggregate=0
PMFMFPC=1
PMFMFPC=0
PMFMFPR=0
PMFSHA256=0
PMKCachePeriod=720
Expand Down
2 changes: 1 addition & 1 deletion package/mt/drivers/mt_wifi/files/mt7615.2G.dat
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ NoForwarding=0
NoForwardingBTNBSSID=0
PERCENTAGEenable=0
PktAggregate=0
PMFMFPC=1
PMFMFPC=0
PMFMFPR=0
PMFSHA256=0
PMKCachePeriod=720
Expand Down
2 changes: 1 addition & 1 deletion package/mt/drivers/mt_wifi/files/mt7615.5G.dat
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ NoForwarding=0
NoForwardingBTNBSSID=0
PERCENTAGEenable=0
PktAggregate=0
PMFMFPC=1
PMFMFPC=0
PMFMFPR=0
PMFSHA256=0
PMKCachePeriod=720
Expand Down
6 changes: 3 additions & 3 deletions package/mt/luci-app-mtwifi/luasrc/controller/mtkwifi.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ function __mtkwifi_reload(devname)
local diff = mtkwifi.diff_profile(profile)
-- Adding or deleting a vif will need to reinstall the wifi ko,
-- so we call "mtkwifi restart" here.
os.execute("cp -f "..profile.." "..mtkwifi.__profile_bak_path(profile))
if diff.BssidNum then
os.execute("/sbin/mtkwifi restart "..devname)
else
os.execute("/sbin/mtkwifi reload "..devname)
end
-- keep a backup for this commit
-- it will be used in mtkwifi.diff_profile()
os.execute("cp -f "..profile.." "..mtkwifi.__profile_bak_path(profile))
end
end
end
Expand Down Expand Up @@ -323,7 +323,7 @@ function dev_cfg_reset(devname)
end

function vif_del(dev, vif)
nixio.syslog("debug", "MTK-Wi-Fi - vif_del("..dev..vif..")")
nixio.syslog("debug", "MTK-Wi-Fi - vif_del ("..dev.." - "..vif..")")
local devname,vifname = dev, vif
-- mtkwifi.debug("devname="..devname)
-- mtkwifi.debug("vifname="..vifname)
Expand Down Expand Up @@ -666,7 +666,7 @@ function vif_cfg(dev, vif)

for k,v in pairs(http.formvalue()) do
if type(v) == type("") or type(v) == type(0) then
nixio.syslog("debug", "post."..k.."="..tostring(v))
-- nixio.syslog("debug", "post."..k.."="..tostring(v))
else
nixio.syslog("debug", "post."..k.." invalid, type="..type(v))
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
<form method="post" name="cbi" action="<%=luci.dispatcher.build_url("admin", "network", "wifi", "apcli_cfg", devname, vifname)%>" enctype="multipart/form-data" onreset="return cbi_validate_reset(this)" onsubmit="return cbi_validate_form(this, 'Some fields are invalid, cannot save values!')" autocomplete="off">

<fieldset class="cbi-section" id="vif-cfg-apcli">
<legend> <a class="ren" name="apcli_scan_section">Wireless Repeater - <%=devname.."@"..vifname%> </a></legend>
<legend> <a class="ren" name="apcli_scan_section">AP-Client - <%=devname.."@"..vifname%> </a></legend>
<br />
<% if cfgs.WirelessMode == "10" then %>
<p class="left">
Expand Down Expand Up @@ -382,7 +382,7 @@
}

window.onload = function() {
rgi()
rgi();
ApCliAuthMode_onchange(document.getElementById("ApCliAuthMode").options[document.getElementById("ApCliAuthMode").selectedIndex].value);
setTimeout(
function(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
local diff = mtkwifi.diff_profile(dev.profile)
if next(diff) ~= nil then
%>
<span style="color:red;">(<a href="#" onclick='wifi_reload("<%=luci.dispatcher.build_url("admin", "network", "wifi", "reload", devname)%>");return false;'>reload</a> to apply changes)</span>
<span id="reload" style="color:red; display:none;">(<a href="#" onclick='wifi_reload("<%=luci.dispatcher.build_url("admin", "network", "wifi", "reload", devname)%>");return false;'>reload</a> to apply changes)</span>
<%
end
%>
Expand Down Expand Up @@ -620,7 +620,7 @@
<div class="cbi-page-actions">
<input class="cbi-button cbi-button-link" value="Back" type="button" onclick="location.href='<%=luci.dispatcher.build_url("admin", "network", "wifi")%>'" />
<input class="cbi-button cbi-button-positive" value="Save" type="submit" />
<input class="cbi-button cbi-button-apply" name="__apply" value="Save & Apply" type="submit" onclick='save_apply()' />
<input class="cbi-button cbi-button-apply" value="Save & Apply" type="submit" onclick='save_apply()' />
<input class="cbi-button cbi-button-reset" value="Reset" type="reset" />
</div>
</form>
Expand Down Expand Up @@ -651,6 +651,7 @@
function wifi_reload(url) {
window.scrollTo(0, 0);
document.getElementById('loading').style.display="";
reload();
XHR.get(url, null,
function(x)
{
Expand All @@ -661,9 +662,16 @@
);
}

function reload() {
setInterval(function() {
if (navigator.onLine) {
window.location.reload();
}
}, 20000);
}

function save_apply() {
window.scrollTo(0, 0);
document.getElementById('loading').style.display="";
sessionStorage.setItem("save_apply", "true");
}

function WirelessMode_onchange(mode) {
Expand Down Expand Up @@ -1031,14 +1039,6 @@
return selv;
}

<% if mt1 == "" then %>
window.onload = function() {
CountryRegion_onchange(document.getElementById("Region").options[document.getElementById("Region").selectedIndex].value);
if ($('.ETxBfEnCond').length > 0) {
beam_onchange(document.querySelector('input[name=ETxBfEnCond]:checked').value);
}
}
<% else %>
function rgi() {
$(".ren").each(function() {
$(this).text($(this).text().replace('mt7615.1', 'mt7603'));
Expand All @@ -1051,17 +1051,27 @@
}

window.onload = function() {
rgi()
CountryRegion_onchange(document.getElementById("Region").options[document.getElementById("Region").selectedIndex].value);
if ($('.ETxBfEnCond').length > 0) {
beam_onchange(document.querySelector('input[name=ETxBfEnCond]:checked').value);
}
var reloading = sessionStorage.getItem("save_apply");
if ($("#reload").length > 0) {
if (reloading) {
sessionStorage.removeItem("save_apply");
wifi_reload("<%=luci.dispatcher.build_url("admin", "network", "wifi", "reload", devname)%>");
} else {
document.getElementById('reload').style.display="";
}
}
<% if mt1 ~= "" then %>
rgi();
setTimeout(
function(){
document.getElementById("container").style.visibility = "visible";
}, 100);
<% end %>
}
<% end %>
</script>

<%+footer%>
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
<style type="text/css">
#container {visibility: hidden;}
.a1 {
margin-left:25px;
margin-left:21px;
white-space:pre;
}
.b1 {
margin-left:25px;
margin-left:21px;
white-space:pre;
}
.m1 {
Expand Down Expand Up @@ -147,7 +147,7 @@ <h2><a>Wireless Overview</a></h2>
<input class="cbi-button cbi-button-apply" style="width:100px" title="Enable this Wi-Fi network" value="Enable" type="button" onclick='wifi_reload("<%=luci.dispatcher.build_url("admin", "network", "wifi", "vif_enable", vif.vifname)%>")' />
<% end %>
<input class="cbi-button cbi-button-edit" style="width:100px" title="Edit this Wi-Fi network" value="Config" type="button" onclick="location.href='<%=luci.dispatcher.build_url("admin", "network", "wifi", "vif_cfg_view", dev.devname, vif.vifname)%>'" />
<input class="cbi-button cbi-button-remove" style="width:100px" title="Delete this Wi-Fi network" value="Remove" type="button" onclick="location.href='<%=luci.dispatcher.build_url("admin", "network", "wifi", "vif_del", dev.devname, vif.vifname)%>'" />
<input class="cbi-button cbi-button-remove" style="width:100px" title="Delete this Wi-Fi network" value="Remove" type="button" onclick="if (confirm('You are going to delete the interface <%=vif.vifname%>, are you sure?')) location.href='<%=luci.dispatcher.build_url("admin", "network", "wifi", "vif_del", dev.devname, vif.vifname)%>'" />
</td>
</tr>
<% end %>
Expand Down Expand Up @@ -341,6 +341,7 @@ <h2>
Stop();
window.scrollTo(0, 0);
document.getElementById('loading').style.display="";
reload();
XHR.get(url, null,
function(x)
{
Expand All @@ -351,6 +352,14 @@ <h2>
);
}

function reload() {
setInterval(function() {
if (navigator.onLine) {
window.location.reload();
}
}, 20000);
}

$('link[rel=stylesheet][href*="mobile.css"]').remove();

function resizeTables(sharedSize) {
Expand Down Expand Up @@ -415,7 +424,7 @@ <h2>
}

window.onload = function() {
<% if mt1 ~= "" then %>rgi()<% end %>
<% if mt1 ~= "" then %>rgi();<% end %>
resizeTables('1');
setTimeout(
function(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
local diff = mtkwifi.diff_profile(dev.profile)
if next(diff) ~= nil then
%>
<span style="color:red;">(<a href="#" onclick='wifi_reload("<%=luci.dispatcher.build_url("admin", "network", "wifi", "reload", devname)%>");return false;'>reload</a> to apply changes)</span>
<span id="reload" style="color:red; display:none;">(<a href="#" onclick='wifi_reload("<%=luci.dispatcher.build_url("admin", "network", "wifi", "reload", devname)%>");return false;'>reload</a> to apply changes)</span>
<%
end
%>
Expand Down Expand Up @@ -452,10 +452,10 @@
<div class="cbi-page-actions">
<input class="cbi-button cbi-button-link" value="Back" type="button" onclick="location.href='<%=luci.dispatcher.build_url("admin", "network", "wifi")%>'" />
<input class="cbi-button cbi-button-positive" value="Save" type="submit" />
<input class="cbi-button cbi-button-apply" name="__apply" value="Save & Apply" type="submit" onclick='save_apply()' />
<input class="cbi-button cbi-button-apply" value="Save & Apply" type="submit" onclick='save_apply()' />
<input class="cbi-button cbi-button-reset" value="Reset" type="reset" />
</div>
<% end %>
<% end %>
</form>
</div>

Expand All @@ -465,6 +465,7 @@
function wifi_reload(url) {
window.scrollTo(0, 0);
document.getElementById('loading').style.display="";
reload();
XHR.get(url, null,
function(x)
{
Expand All @@ -475,9 +476,16 @@
);
}

function reload() {
setInterval(function() {
if (navigator.onLine) {
window.location.reload();
}
}, 20000);
}

function save_apply() {
window.scrollTo(0, 0);
document.getElementById('loading').style.display="";
sessionStorage.setItem("save_apply", "true");
}

function AuthMode_onchange(to) {
Expand Down Expand Up @@ -560,9 +568,6 @@
}
}

<% if mt1 == "" then %>
window.onload = AuthMode_onchange(document.getElementById("AuthMode").options[document.getElementById("AuthMode").selectedIndex].value)
<% else %>
function rgi() {
$(".ren").each(function() {
$(this).text($(this).text().replace('mt7615.1', 'mt7603'));
Expand All @@ -575,14 +580,24 @@
}

window.onload = function() {
rgi()
AuthMode_onchange(document.getElementById("AuthMode").options[document.getElementById("AuthMode").selectedIndex].value);
var reloading = sessionStorage.getItem("save_apply");
if ($("#reload").length > 0) {
if (reloading) {
sessionStorage.removeItem("save_apply");
wifi_reload("<%=luci.dispatcher.build_url("admin", "network", "wifi", "reload", devname)%>");
} else {
document.getElementById('reload').style.display="";
}
}
<% if mt1 ~= "" then %>
rgi();
setTimeout(
function(){
document.getElementById("container").style.visibility = "visible";
}, 100);
<% end %>
}
<% end %>
</script>

<%+footer%>
Loading

0 comments on commit e15bc2e

Please sign in to comment.