If harblocked and a new device is inserted and detected as not hardblocked,
then it will be possible to enable/disable it (soft rfkill) independantly to
the main hw rfkill switch. It applies also when ConnMan starts, so it gets the
right hardblocked state.
---
src/technology.c | 30 +++++++++++++++++-------------
1 file changed, 17 insertions(+), 13 deletions(-)
diff --git a/src/technology.c b/src/technology.c
index 61634e8..4ef26b3 100644
--- a/src/technology.c
+++ b/src/technology.c
@@ -1338,7 +1338,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;
@@ -1351,18 +1352,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;
@@ -1436,7 +1440,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;
/*
@@ -1483,7 +1487,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)
@@ -1522,7 +1526,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);
--
1.7.12
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman