On some crappy hardware, there exist 2 rfkill entities for the same type, with
cascading issue: if one is soft blocked, the other one is hardblocked. But if
the hardblock switch is set, all are hardblocked. So this patch figures out that
a technology is hardblock if only all related rkill event gets the same 
hardblock
value
---
 src/technology.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/technology.c b/src/technology.c
index 45ddfe3..b56a9ae 100644
--- a/src/technology.c
+++ b/src/technology.c
@@ -1300,9 +1300,27 @@ void __connman_technology_set_connected(enum 
connman_service_type type,
 static void technology_apply_hardblock_change(struct connman_technology 
*technology,
                                                connman_bool_t hardblock)
 {
+       gboolean apply = TRUE;
+       GList *start, *list;
+
        if (technology->hardblocked == hardblock)
                return;
 
+       start = g_hash_table_get_values(rfkill_list);
+       for (list = start; list != NULL; list = list->next) {
+               struct connman_rfkill *rfkill = list->data;
+
+               if (rfkill->type != technology->type)
+                       continue;
+
+               if (rfkill->hardblock != hardblock)
+                       apply = FALSE;
+       }
+       g_list_free(start);
+
+       if (apply == FALSE)
+               return;
+
        technology->hardblocked = hardblock;
 
        if (hardblock == TRUE) {
-- 
1.7.12

_______________________________________________
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman

Reply via email to