static int technology_enable(struct connman_technology *technology) { int err = 0; int err_dev; DBG("technology %p enable", technology); __sync_synchronize(); if (technology->enabled == TRUE) return -EALREADY; if (technology->pending_reply != NULL) return -EBUSY; if (connman_setting_get_bool("PersistentTetheringMode") == TRUE && technology->tethering == TRUE) set_tethering(technology, TRUE); if (technology->rfkill_driven == TRUE) err = __connman_rfkill_block(technology->type, FALSE); err_dev = technology_affect_devices(technology, TRUE); if (technology->rfkill_driven == FALSE) err = err_dev; return err; }
static int technology_enable(struct connman_technology *technology) { DBG("technology %p enable", technology); __sync_synchronize(); if (technology->enabled == TRUE) return -EALREADY; if (technology->pending_reply != NULL) return -EBUSY; if (technology->rfkill_driven == TRUE) return __connman_rfkill_block(technology->type, FALSE); return technology_affect_devices(technology, TRUE); }
static int technology_disable(struct connman_technology *technology) { int err; DBG("technology %p disable", technology); __sync_synchronize(); if (technology->enabled == FALSE) return -EALREADY; if (technology->pending_reply != NULL) return -EBUSY; if (technology->tethering == TRUE) set_tethering(technology, FALSE); err = technology_affect_devices(technology, FALSE); if (technology->rfkill_driven == TRUE) err = __connman_rfkill_block(technology->type, TRUE); return err; }
static connman_bool_t technology_apply_rfkill_change(struct connman_technology *technology, connman_bool_t softblock, connman_bool_t hardblock, connman_bool_t new_rfkill) { gboolean hardblock_changed = FALSE; gboolean apply = TRUE; GList *start, *list; DBG("technology %p --> %d/%d vs %d/%d", technology, softblock, hardblock, technology->softblocked, technology->hardblocked); if (technology->hardblocked == hardblock) goto softblock_change; if (!(new_rfkill == TRUE && hardblock == FALSE)) { 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) goto softblock_change; technology->hardblocked = hardblock; hardblock_changed = TRUE; softblock_change: if (apply == FALSE && technology->softblocked != softblock) apply = TRUE; if (apply == FALSE) return technology->hardblocked; technology->softblocked = softblock; if (technology->hardblocked == TRUE || technology->softblocked == TRUE) { if (technology_disabled(technology) != -EALREADY) technology_affect_devices(technology, FALSE); } else if (technology->hardblocked == FALSE && technology->softblocked == FALSE) { if (technology_enabled(technology) != -EALREADY) technology_affect_devices(technology, TRUE); } if (hardblock_changed == TRUE) { if (technology->hardblocked == TRUE) { DBG("%s is switched off.", get_name(technology->type)); technology_dbus_unregister(technology); } else technology_dbus_register(technology); } return technology->hardblocked; }