diff options
author | Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com> | 2012-10-15 15:35:23 +0300 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2012-10-16 15:09:28 +0300 |
commit | 9e9cf7a8800d634a5e04b0396f209cdefdb34e98 (patch) | |
tree | 892d5c91369d3b001da99a5bf5fe41c2fb5ca698 /src/technology.c | |
parent | bd3fe70bd9fadaa7bda00079822a8b7b75a76050 (diff) | |
download | connman-9e9cf7a8800d634a5e04b0396f209cdefdb34e98.tar.gz connman-9e9cf7a8800d634a5e04b0396f209cdefdb34e98.tar.bz2 connman-9e9cf7a8800d634a5e04b0396f209cdefdb34e98.zip |
technology: Fix hardblocked state on non hw rfkillable switch added
If hardblock is on and a new device is inserted and detected as not
hardblocked, then it will be possible to enable/disable it (soft rfkill)
independently to the main hw rfkill switch.
Diffstat (limited to 'src/technology.c')
-rw-r--r-- | src/technology.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/technology.c b/src/technology.c index 976964a7..290ec247 100644 --- a/src/technology.c +++ b/src/technology.c @@ -1340,7 +1340,8 @@ void __connman_technology_set_connected(enum connman_service_type type, static connman_bool_t technology_apply_rfkill_change(struct connman_technology *technology, connman_bool_t softblock, - connman_bool_t hardblock) + connman_bool_t hardblock, + connman_bool_t new_rfkill) { gboolean hardblock_changed = FALSE; gboolean apply = TRUE; @@ -1353,18 +1354,21 @@ static connman_bool_t technology_apply_rfkill_change(struct connman_technology * if (technology->hardblocked == hardblock) goto softblock_change; - start = g_hash_table_get_values(rfkill_list); - for (list = start; list != NULL; list = list->next) { - struct connman_rfkill *rfkill = list->data; + if (!(new_rfkill == TRUE && hardblock == FALSE)) { + start = g_hash_table_get_values(rfkill_list); - if (rfkill->type != technology->type) - continue; + for (list = start; list != NULL; list = list->next) { + struct connman_rfkill *rfkill = list->data; - if (rfkill->hardblock != hardblock) - apply = FALSE; - } + if (rfkill->type != technology->type) + continue; - g_list_free(start); + if (rfkill->hardblock != hardblock) + apply = FALSE; + } + + g_list_free(start); + } if (apply == FALSE) goto softblock_change; @@ -1438,7 +1442,7 @@ done: /* If hardblocked, there is no need to handle softblocked state */ if (technology_apply_rfkill_change(technology, - softblock, hardblock) == TRUE) + softblock, hardblock, TRUE) == TRUE) return 0; /* @@ -1485,7 +1489,7 @@ int __connman_technology_update_rfkill(unsigned int index, /* If hardblocked, there is no need to handle softblocked state */ if (technology_apply_rfkill_change(technology, - softblock, hardblock) == TRUE) + softblock, hardblock, FALSE) == TRUE) return 0; if (global_offlinemode == TRUE) @@ -1524,7 +1528,7 @@ int __connman_technology_remove_rfkill(unsigned int index, return -ENXIO; technology_apply_rfkill_change(technology, - technology->softblocked, !technology->hardblocked); + technology->softblocked, !technology->hardblocked, FALSE); technology_put(technology); |