guint pending_timeout;
GSList *scan_pending;
+
+ connman_bool_t hardblocked;
};
static GSList *driver_list = NULL;
technology->refcount = 1;
+ if (type == CONNMAN_SERVICE_TYPE_ETHERNET)
+ technology->hardblocked = FALSE;
+ else
+ technology->hardblocked = TRUE;
+
technology->type = type;
technology->path = g_strdup_printf("%s/technology/%s",
CONNMAN_PATH, str);
return -ENXIO;
}
- if (technology->enable_persistent && !global_offlinemode) {
+ if (technology->enable_persistent &&
+ global_offlinemode == FALSE &&
+ technology->hardblocked == FALSE) {
int err = __connman_device_enable(device);
/*
* connman_technology_add_device() calls __connman_device_enable()
if (err == -EALREADY)
__connman_technology_enabled(type);
}
- /* if technology persistent state is offline */
- if (!technology->enable_persistent)
+ /* if technology persistent state is offline or hardblocked */
+ if (technology->enable_persistent == FALSE ||
+ technology->hardblocked == TRUE)
__connman_device_disable(device);
technology->device_list = g_slist_prepend(technology->device_list,
DBUS_TYPE_BOOLEAN, &connected);
}
+static void technology_apply_hardblock_change(struct connman_technology *technology,
+ connman_bool_t hardblock)
+{
+ if (technology->hardblocked == hardblock)
+ return;
+
+ technology->hardblocked = hardblock;
+
+ if (hardblock == TRUE)
+ DBG("%s is switched off.", get_name(technology->type));
+}
+
int __connman_technology_add_rfkill(unsigned int index,
enum connman_service_type type,
connman_bool_t softblock,
if (technology == NULL)
return -ENXIO;
- if (hardblock) {
- DBG("%s is switched off.", get_name(type));
- return 0;
- }
+ technology_apply_hardblock_change(technology, hardblock);
/*
* If Offline mode is on, we softblock the device if it isnt already.
rfkill->softblock = softblock;
rfkill->hardblock = hardblock;
- if (hardblock) {
- DBG("%s is switched off.", get_name(type));
- return 0;
- }
-
technology = technology_find(type);
/* If there is no driver for this type, ignore it. */
if (technology == NULL)
return -ENXIO;
+ technology_apply_hardblock_change(technology, hardblock);
+
if (!global_offlinemode) {
if (technology->enable_persistent && softblock)
return __connman_rfkill_block(type, FALSE);