mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-30 13:25:13 +08:00
🦄 Sync 2026-07-26 23:49:39
This commit is contained in:
1 parent
942acacd07
commit
f8206979a2
20 files changed
+482
-145
No files matched your search
@@ -42,6 +42,10 @@ let cachedIwinfoResolver = null;
|
||||
let cachedIwinfoResolverPromise = null;
|
||||
let cachedAssocLists = Object.create(null);
|
||||
let pendingAssocLists = Object.create(null);
|
||||
let qcaRuntimeProbeHoldoffUntil = 0;
|
||||
|
||||
const qcaRuntimeProbeHoldoffKey = 'luci-qca-wireless-runtime-holdoff';
|
||||
const qcaRuntimeProbeHoldoff = 30000;
|
||||
|
||||
function pushUnique(list, value) {
|
||||
if (value && list.indexOf(value) < 0)
|
||||
@@ -286,6 +290,9 @@ function refreshIwinfoInfoMap() {
|
||||
}
|
||||
|
||||
function startIwinfoInfoRefresh() {
|
||||
if (areQcaRuntimeProbesSuspended())
|
||||
return;
|
||||
|
||||
refreshIwinfoInfoMap().catch(() => {});
|
||||
}
|
||||
|
||||
@@ -300,6 +307,29 @@ function isQcaWifiHwtype(hwtype) {
|
||||
return (hwtype == 'qcawifi' || hwtype == 'qcawificfg80211');
|
||||
}
|
||||
|
||||
function suspendQcaRuntimeProbes() {
|
||||
qcaRuntimeProbeHoldoffUntil = Date.now() + qcaRuntimeProbeHoldoff;
|
||||
|
||||
try {
|
||||
window.sessionStorage.setItem(qcaRuntimeProbeHoldoffKey, String(qcaRuntimeProbeHoldoffUntil));
|
||||
}
|
||||
catch (e) {}
|
||||
}
|
||||
|
||||
function areQcaRuntimeProbesSuspended() {
|
||||
let deadline = qcaRuntimeProbeHoldoffUntil;
|
||||
|
||||
try {
|
||||
deadline = Math.max(deadline, +window.sessionStorage.getItem(qcaRuntimeProbeHoldoffKey) || 0);
|
||||
|
||||
if (deadline <= Date.now())
|
||||
window.sessionStorage.removeItem(qcaRuntimeProbeHoldoffKey);
|
||||
}
|
||||
catch (e) {}
|
||||
|
||||
return (deadline > Date.now());
|
||||
}
|
||||
|
||||
function isConfigWifiDeviceDisabled(deviceName) {
|
||||
return (uci.get('wireless', deviceName, 'disabled') == '1');
|
||||
}
|
||||
@@ -1146,6 +1176,10 @@ function getAssocListForNetwork(radioNet) {
|
||||
return Promise.resolve([]);
|
||||
|
||||
const hwtype = uci.get('wireless', radioNet.getWifiDeviceName(), 'type');
|
||||
|
||||
if (isQcaWifiHwtype(hwtype) && areQcaRuntimeProbesSuspended())
|
||||
return Promise.resolve([]);
|
||||
|
||||
const candidates = getAssocListCandidates(radioNet);
|
||||
const resolvedIfname = candidates[0];
|
||||
|
||||
@@ -1464,9 +1498,13 @@ function radio_restart(id, ev) {
|
||||
|
||||
function network_updown(id, map, ev) {
|
||||
const radio = uci.get('wireless', id, 'device');
|
||||
const hwtype = uci.get('wireless', radio, 'type');
|
||||
const disabled = (uci.get('wireless', id, 'disabled') == '1') ||
|
||||
(uci.get('wireless', radio, 'disabled') == '1');
|
||||
|
||||
if (isQcaWifiHwtype(hwtype))
|
||||
suspendQcaRuntimeProbes();
|
||||
|
||||
if (disabled) {
|
||||
uci.unset('wireless', id, 'disabled');
|
||||
uci.unset('wireless', radio, 'disabled');
|
||||
@@ -1548,14 +1586,19 @@ var CBIWifiFrequencyValue = form.Value.extend({
|
||||
const chval = +cfg_channel;
|
||||
const allow_auto = (hwtype == 'mt_dbdc' || isQcaWifiHwtype(hwtype) ||
|
||||
cfg_channel == 'auto' || L.hasSystemFeature('hostapd', 'acs'));
|
||||
const configOnly = isConfigWifiDeviceDisabled(device_section) ||
|
||||
(isQcaWifiHwtype(hwtype) && areQcaRuntimeProbesSuspended());
|
||||
const configDevice = configOnly
|
||||
? network.getWifiDevicesFromConfig().find((device) => device.getName() == device_section)
|
||||
: null;
|
||||
|
||||
return Promise.all([
|
||||
network.getWifiDevice(device_section),
|
||||
this.callFrequencyList(device_section),
|
||||
this.callDeviceInfo(device_section),
|
||||
L.resolveDefault(this.callWirelessStatus(), {}),
|
||||
isQcaWifiHwtype(hwtype) ? L.resolveDefault(fs.exec_direct('/usr/sbin/iw', [ 'dev' ]), '') : '',
|
||||
isQcaWifiHwtype(hwtype) ? L.resolveDefault(fs.exec_direct('/usr/sbin/iw', [ 'phy' ]), '') : ''
|
||||
configOnly ? configDevice : network.getWifiDevice(device_section),
|
||||
configOnly ? [] : this.callFrequencyList(device_section),
|
||||
configOnly ? {} : this.callDeviceInfo(device_section),
|
||||
configOnly ? {} : L.resolveDefault(this.callWirelessStatus(), {}),
|
||||
!configOnly && isQcaWifiHwtype(hwtype) ? L.resolveDefault(fs.exec_direct('/usr/sbin/iw', [ 'dev' ]), '') : '',
|
||||
!configOnly && isQcaWifiHwtype(hwtype) ? L.resolveDefault(fs.exec_direct('/usr/sbin/iw', [ 'phy' ]), '') : ''
|
||||
]).then(L.bind(function(data) {
|
||||
const wifidevs = data[0];
|
||||
const freqlist = data[1];
|
||||
@@ -1613,6 +1656,10 @@ var CBIWifiFrequencyValue = form.Value.extend({
|
||||
}
|
||||
|
||||
const configured_band = getConfiguredBand(hwtype, statuscfg.hwmode ?? hwval, devcfg.channel ?? cfg_channel, devcfg.band ?? bandval, statuscfg.htmode ?? htval);
|
||||
|
||||
if (configOnly && cfg_channel && cfg_channel != 'auto' && Array.isArray(this.channels[configured_band]))
|
||||
this.channels[configured_band].push(cfg_channel, String(cfg_channel), { available: true });
|
||||
|
||||
const has_band_channels = (band) => {
|
||||
const channels = this.channels[band];
|
||||
const offset = (channels?.[0] == 'auto') ? 3 : 0;
|
||||
@@ -2228,8 +2275,10 @@ var CBIWifiTxPowerValue = form.ListValue.extend({
|
||||
|
||||
load: function(section_id) {
|
||||
const device_section = this.getDeviceSection ? this.getDeviceSection(section_id) : section_id;
|
||||
const hwtype = uci.get('wireless', device_section, 'type');
|
||||
|
||||
if (isConfigWifiDeviceDisabled(device_section)) {
|
||||
if (isConfigWifiDeviceDisabled(device_section) ||
|
||||
(isQcaWifiHwtype(hwtype) && areQcaRuntimeProbesSuspended())) {
|
||||
this.powerval = this.wifiNetwork ? getDisplayTxPower(this.wifiNetwork) : null;
|
||||
this.poweroff = this.wifiNetwork ? this.wifiNetwork.getTXPowerOffset() : null;
|
||||
this.value('', _('driver default'));
|
||||
|
||||
Reference in new issue
Block a user