From 1c9de93a998bd0b2a92b8118182f2a18f8020ac2 Mon Sep 17 00:00:00 2001 From: dengbo Date: Tue, 21 Nov 2023 14:37:46 +0800 Subject: [PATCH] fix: wifi device not enable when rfkill block, after system reboot,wifi device not enable when rfkill unblock again Log: --- system/airplane_mode1/rfkill.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/system/airplane_mode1/rfkill.go b/system/airplane_mode1/rfkill.go index 8268eb030..695e0aa74 100644 --- a/system/airplane_mode1/rfkill.go +++ b/system/airplane_mode1/rfkill.go @@ -76,6 +76,20 @@ func (mgr *Manager) listenRfkill() { } mgr.handleBTRfkillEvent(event) + mgr.handleWifIRfkillEvent(event) + } +} + +func (mgr *Manager) handleWifIRfkillEvent(event *RfkillEvent) { + if event.Typ != rfkillTypeWifi { + return + } + + if mgr.hasNmWirelessDevices { + // 当飞行模式的wifi设备状态为禁用而rfkill 状态为unblock状态时,以rfkill状态为准 + if mgr.WifiEnabled && event.Soft == rfkillStateUnblock { + mgr.block(rfkillTypeWifi, false) + } } }