technology: Do not send any rfkill to kernel after receiving one 78/8278/3 tizen_ivi_genivi tizen_ivi_release accepted/tizen/20130912.082351 accepted/tizen/20130912.085336 accepted/tizen/20130912.093500 accepted/tizen/ivi/genivi/20140131.020206 accepted/tizen_ivi_release/20131120.050253 ivi_oct_m2 submit/tizen/20130815.011956 submit/tizen/20130912.075641 submit/tizen_ivi_genivi/20140131.015912 submit/tizen_ivi_release/20131120.032027
authorJukka Rissanen <jukka.rissanen@linux.intel.com>
Thu, 25 Jul 2013 13:31:29 +0000 (16:31 +0300)
committerZhang zhengguang <zhengguang.zhang@intel.com>
Thu, 15 Aug 2013 01:15:53 +0000 (09:15 +0800)
If we receive rfkill event from kernel, we must not send it
back blindly. This could cause a ping-pong effect where the
technology is switched on/off constantly.

Upstream commit id:7a2d00e0bfe99cc327f78b9841bd8aca9efa2877

src/technology.c

index 77601b4..7dcc000 100644 (file)
@@ -1724,45 +1724,14 @@ int __connman_technology_update_rfkill(unsigned int index,
        if (technology == NULL)
                return -ENXIO;
 
-       /* If hardblocked, there is no need to handle softblocked state */
-       if (technology_apply_rfkill_change(technology,
-                               softblock, hardblock, FALSE) == TRUE)
-               return 0;
+       technology_apply_rfkill_change(technology, softblock, hardblock,
+                                                               FALSE);
 
-       if (global_offlinemode == TRUE)
-               return 0;
-
-       /*
-        * State diagram how to set the block status from individual
-        * technology status fields:
-        *
-        *   enabled  |  softblocked  |  offline  |    is
-        *            |               |           |  blocked
-        * -----------+---------------+-----------+----------
-        *     no     |      no       |    no     |   yes
-        *     yes    |      no       |    no     |   no
-        *     no     |      yes      |    no     |   yes
-        *     yes    |      yes      |    no     |   yes
-        *     no     |      no       |    yes    |   yes
-        *     yes    |      no       |    yes    |   no
-        *     no     |      yes      |    yes    |   yes
-        *     yes    |      yes      |    yes    |   yes
-        *
-        * The enabled is controlled by dbus API (typically
-        * from UI). softblocked is set either by dbus API or by
-        * external event. Offline (flight mode) is set via dbus
-        * API.
-        */
-
-       DBG("type %d enabled %d soft %d hard %d blocked %d",
-               type, technology->enabled,
-               technology->softblocked, technology->hardblocked,
-               !(technology->enabled && !technology->softblocked));
-
-       if (technology->enabled && !technology->softblocked)
-               return __connman_rfkill_block(type, FALSE);
+       if (technology->hardblocked)
+               DBG("%s hardblocked", get_name(technology->type));
        else
-               return __connman_rfkill_block(type, TRUE);
+               DBG("%s is%s softblocked", get_name(technology->type),
+                       technology->softblocked ? "" : " not");
 
        return 0;
 }