From 240f47c892b4e935a3e92fc09eb15163d1fa28d8 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Wed, 6 Feb 2013 12:59:50 -0600 Subject: [PATCH] rfkill: set kernel WiFi rfkill state to cached state on startup Like we do when the user sets the Wireless Enabled property at runtime, ensure the kernel's softblock state is synced with the user's WiFi enable preference at startup. This helps compensate for BIOSes that don't save rfkill state over reboots and ensures consistency of between startup and runtime Wireless Enabled property behavior. Suggested by John G. --- src/nm-manager.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/nm-manager.c b/src/nm-manager.c index 81e65790eb..3dc60d858e 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -165,6 +165,8 @@ static GSList * remove_one_device (NMManager *manager, NMDevice *device, gboolean quitting); +static void rfkill_change_wifi (const char *desc, gboolean enabled); + #define SSD_POKE_INTERVAL 120 #define ORIGDEV_TAG "originating-device" @@ -4156,6 +4158,12 @@ nm_manager_new (NMSettings *settings, G_CALLBACK (bluez_manager_bdaddr_removed_cb), singleton); + /* Force kernel WiFi rfkill state to follow NM saved wifi state in case + * the BIOS doesn't save rfkill state, and to be consistent with user + * changes to the WirelessEnabled property which toggles kernel rfkill. + */ + rfkill_change_wifi (priv->radio_states[RFKILL_TYPE_WLAN].desc, initial_wifi_enabled); + return singleton; }