technology: Add a marker to know if a technology is rfkill driven
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Mon, 15 Oct 2012 12:35:14 +0000 (15:35 +0300)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Tue, 16 Oct 2012 12:02:52 +0000 (15:02 +0300)
Useful for coming patches: enabling/disabling technologies will be done
differently whether technology is rfkill driven or not:
- if rfkill driven -> enabled will rely on rfkill states
- if not -> enabled will rely on driver/devices states

src/technology.c

index 3f7141ad11a8e2ec4eb028807d4a462596f7bda1..11bf0c0c6f57ceb756513430073354e4be7788f5 100644 (file)
@@ -73,6 +73,7 @@ struct connman_technology {
 
        GSList *scan_pending;
 
+       connman_bool_t rfkill_driven;
        connman_bool_t hardblocked;
        connman_bool_t dbus_registered;
 };
@@ -548,7 +549,8 @@ void __connman_technology_list_struct(DBusMessageIter *array)
                struct connman_technology *technology = list->data;
 
                if (technology->path == NULL ||
-                                       technology->hardblocked == TRUE)
+                               (technology->rfkill_driven == TRUE &&
+                                technology->hardblocked == TRUE))
                        continue;
 
                dbus_message_iter_open_container(array, DBUS_TYPE_STRUCT,
@@ -644,7 +646,7 @@ static DBusMessage *set_powered(struct connman_technology *technology,
        DBusMessage *reply = NULL;
        int err = 0;
 
-       if (technology->hardblocked == TRUE) {
+       if (technology->rfkill_driven && technology->hardblocked == TRUE) {
                err = -EACCES;
                goto make_reply;
        }
@@ -925,7 +927,8 @@ static const GDBusSignalTable technology_signals[] = {
 static gboolean technology_dbus_register(struct connman_technology *technology)
 {
        if (technology->dbus_registered == TRUE ||
-                                       technology->hardblocked == TRUE)
+                               (technology->rfkill_driven &&
+                                technology->hardblocked == TRUE))
                return TRUE;
 
        if (g_dbus_register_interface(connection, technology->path,
@@ -984,6 +987,8 @@ static struct connman_technology *technology_get(enum connman_service_type type)
 
        technology->refcount = 1;
 
+       technology->rfkill_driven = FALSE;
+
        if (type == CONNMAN_SERVICE_TYPE_ETHERNET)
                technology->hardblocked = FALSE;
        else
@@ -1379,6 +1384,8 @@ done:
        if (technology == NULL)
                return -ENXIO;
 
+       technology->rfkill_driven = TRUE;
+
        technology_apply_hardblock_change(technology, hardblock);
 
        /*