5 * Copyright (C) 2007-2010 Intel Corporation. All rights reserved.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
33 static DBusConnection *connection;
35 static GSList *technology_list = NULL;
37 struct connman_rfkill {
39 enum connman_service_type type;
40 connman_bool_t softblock;
41 connman_bool_t hardblock;
44 enum connman_technology_state {
45 CONNMAN_TECHNOLOGY_STATE_UNKNOWN = 0,
46 CONNMAN_TECHNOLOGY_STATE_OFFLINE = 1,
47 CONNMAN_TECHNOLOGY_STATE_ENABLED = 2,
48 CONNMAN_TECHNOLOGY_STATE_CONNECTED = 3,
51 struct connman_technology {
53 enum connman_service_type type;
54 enum connman_technology_state state;
56 GHashTable *rfkill_list;
61 connman_bool_t tethering;
62 char *tethering_ident;
63 char *tethering_passphrase;
65 connman_bool_t enable_persistent; /* Save the tech state */
67 struct connman_technology_driver *driver;
70 DBusMessage *pending_reply;
71 guint pending_timeout;
74 static GSList *driver_list = NULL;
76 static gint compare_priority(gconstpointer a, gconstpointer b)
78 const struct connman_technology_driver *driver1 = a;
79 const struct connman_technology_driver *driver2 = b;
81 return driver2->priority - driver1->priority;
85 * connman_technology_driver_register:
86 * @driver: Technology driver definition
88 * Register a new technology driver
90 * Returns: %0 on success
92 int connman_technology_driver_register(struct connman_technology_driver *driver)
95 struct connman_technology *technology;
97 DBG("driver %p name %s", driver, driver->name);
99 driver_list = g_slist_insert_sorted(driver_list, driver,
102 for (list = technology_list; list; list = list->next) {
103 technology = list->data;
105 if (technology->driver != NULL)
108 if (technology->type == driver->type)
109 technology->driver = driver;
116 * connman_technology_driver_unregister:
117 * @driver: Technology driver definition
119 * Remove a previously registered technology driver
121 void connman_technology_driver_unregister(struct connman_technology_driver *driver)
124 struct connman_technology *technology;
126 DBG("driver %p name %s", driver, driver->name);
128 for (list = technology_list; list; list = list->next) {
129 technology = list->data;
131 if (technology->driver == NULL)
134 if (technology->type == driver->type) {
135 technology->driver->remove(technology);
136 technology->driver = NULL;
140 driver_list = g_slist_remove(driver_list, driver);
143 static void tethering_changed(struct connman_technology *technology)
145 connman_bool_t tethering = technology->tethering;
147 connman_dbus_property_changed_basic(technology->path,
148 CONNMAN_TECHNOLOGY_INTERFACE, "Tethering",
149 DBUS_TYPE_BOOLEAN, &tethering);
152 void connman_technology_tethering_notify(struct connman_technology *technology,
153 connman_bool_t enabled)
155 DBG("technology %p enabled %u", technology, enabled);
157 if (technology->tethering == enabled)
160 technology->tethering = enabled;
162 tethering_changed(technology);
165 __connman_tethering_set_enabled();
167 __connman_tethering_set_disabled();
170 static int set_tethering(struct connman_technology *technology,
171 const char *bridge, connman_bool_t enabled)
173 const char *ident, *passphrase;
175 ident = technology->tethering_ident;
176 passphrase = technology->tethering_passphrase;
178 if (technology->driver == NULL ||
179 technology->driver->set_tethering == NULL)
182 if (technology->type == CONNMAN_SERVICE_TYPE_WIFI &&
183 (ident == NULL || passphrase == NULL))
186 return technology->driver->set_tethering(technology, ident, passphrase,
190 void connman_technology_regdom_notify(struct connman_technology *technology,
196 connman_error("Failed to set regulatory domain");
198 DBG("Regulatory domain set to %s", alpha2);
200 g_free(technology->regdom);
201 technology->regdom = g_strdup(alpha2);
204 int connman_technology_set_regdom(const char *alpha2)
208 for (list = technology_list; list; list = list->next) {
209 struct connman_technology *technology = list->data;
211 if (technology->driver == NULL)
214 if (technology->driver->set_regdom)
215 technology->driver->set_regdom(technology, alpha2);
221 static void free_rfkill(gpointer data)
223 struct connman_rfkill *rfkill = data;
228 void __connman_technology_list(DBusMessageIter *iter, void *user_data)
232 for (list = technology_list; list; list = list->next) {
233 struct connman_technology *technology = list->data;
235 if (technology->path == NULL)
238 dbus_message_iter_append_basic(iter, DBUS_TYPE_OBJECT_PATH,
243 static void technologies_changed(void)
245 connman_dbus_property_changed_array(CONNMAN_MANAGER_PATH,
246 CONNMAN_MANAGER_INTERFACE, "Technologies",
247 DBUS_TYPE_OBJECT_PATH, __connman_technology_list, NULL);
250 static const char *state2string(enum connman_technology_state state)
253 case CONNMAN_TECHNOLOGY_STATE_UNKNOWN:
255 case CONNMAN_TECHNOLOGY_STATE_OFFLINE:
257 case CONNMAN_TECHNOLOGY_STATE_ENABLED:
259 case CONNMAN_TECHNOLOGY_STATE_CONNECTED:
266 static void state_changed(struct connman_technology *technology)
270 str = state2string(technology->state);
274 connman_dbus_property_changed_basic(technology->path,
275 CONNMAN_TECHNOLOGY_INTERFACE, "State",
276 DBUS_TYPE_STRING, &str);
279 static const char *get_name(enum connman_service_type type)
282 case CONNMAN_SERVICE_TYPE_UNKNOWN:
283 case CONNMAN_SERVICE_TYPE_SYSTEM:
284 case CONNMAN_SERVICE_TYPE_GPS:
285 case CONNMAN_SERVICE_TYPE_VPN:
286 case CONNMAN_SERVICE_TYPE_GADGET:
288 case CONNMAN_SERVICE_TYPE_ETHERNET:
290 case CONNMAN_SERVICE_TYPE_WIFI:
292 case CONNMAN_SERVICE_TYPE_WIMAX:
294 case CONNMAN_SERVICE_TYPE_BLUETOOTH:
296 case CONNMAN_SERVICE_TYPE_CELLULAR:
303 static DBusMessage *get_properties(DBusConnection *conn,
304 DBusMessage *message, void *user_data)
306 struct connman_technology *technology = user_data;
308 DBusMessageIter array, dict;
311 reply = dbus_message_new_method_return(message);
315 dbus_message_iter_init_append(reply, &array);
317 connman_dbus_dict_open(&array, &dict);
319 str = state2string(technology->state);
321 connman_dbus_dict_append_basic(&dict, "State",
322 DBUS_TYPE_STRING, &str);
324 str = get_name(technology->type);
326 connman_dbus_dict_append_basic(&dict, "Name",
327 DBUS_TYPE_STRING, &str);
329 str = __connman_service_type2string(technology->type);
331 connman_dbus_dict_append_basic(&dict, "Type",
332 DBUS_TYPE_STRING, &str);
334 connman_dbus_dict_append_basic(&dict, "Tethering",
336 &technology->tethering);
338 if (technology->tethering_ident != NULL)
339 connman_dbus_dict_append_basic(&dict, "TetheringIdentifier",
341 &technology->tethering_ident);
343 if (technology->tethering_passphrase != NULL)
344 connman_dbus_dict_append_basic(&dict, "TetheringPassphrase",
346 &technology->tethering_passphrase);
348 connman_dbus_dict_close(&array, &dict);
353 static DBusMessage *set_property(DBusConnection *conn,
354 DBusMessage *msg, void *data)
356 struct connman_technology *technology = data;
357 DBusMessageIter iter, value;
361 DBG("conn %p", conn);
363 if (dbus_message_iter_init(msg, &iter) == FALSE)
364 return __connman_error_invalid_arguments(msg);
366 dbus_message_iter_get_basic(&iter, &name);
367 dbus_message_iter_next(&iter);
368 dbus_message_iter_recurse(&iter, &value);
370 type = dbus_message_iter_get_arg_type(&value);
372 DBG("property %s", name);
374 if (g_str_equal(name, "Tethering") == TRUE) {
376 connman_bool_t tethering;
379 if (type != DBUS_TYPE_BOOLEAN)
380 return __connman_error_invalid_arguments(msg);
382 dbus_message_iter_get_basic(&value, &tethering);
384 if (technology->tethering == tethering)
385 return __connman_error_in_progress(msg);
387 bridge = __connman_tethering_get_bridge();
389 return __connman_error_not_supported(msg);
391 err = set_tethering(technology, bridge, tethering);
393 return __connman_error_failed(msg, -err);
395 } else if (g_str_equal(name, "TetheringIdentifier") == TRUE) {
398 dbus_message_iter_get_basic(&value, &str);
400 if (technology->type != CONNMAN_SERVICE_TYPE_WIFI)
401 return __connman_error_not_supported(msg);
403 technology->tethering_ident = g_strdup(str);
404 } else if (g_str_equal(name, "TetheringPassphrase") == TRUE) {
407 dbus_message_iter_get_basic(&value, &str);
409 if (technology->type != CONNMAN_SERVICE_TYPE_WIFI)
410 return __connman_error_not_supported(msg);
413 return __connman_error_invalid_arguments(msg);
415 technology->tethering_passphrase = g_strdup(str);
417 return __connman_error_invalid_property(msg);
419 return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
422 static GDBusMethodTable technology_methods[] = {
423 { "GetProperties", "", "a{sv}", get_properties },
424 { "SetProperty", "sv", "", set_property },
428 static GDBusSignalTable technology_signals[] = {
429 { "PropertyChanged", "sv" },
433 static struct connman_technology *technology_find(enum connman_service_type type)
437 DBG("type %d", type);
439 for (list = technology_list; list; list = list->next) {
440 struct connman_technology *technology = list->data;
442 if (technology->type == type)
449 static struct connman_technology *technology_get(enum connman_service_type type)
451 struct connman_technology *technology;
455 DBG("type %d", type);
457 technology = technology_find(type);
458 if (technology != NULL) {
459 g_atomic_int_inc(&technology->refcount);
463 str = __connman_service_type2string(type);
467 technology = g_try_new0(struct connman_technology, 1);
468 if (technology == NULL)
471 technology->refcount = 1;
473 technology->type = type;
474 technology->path = g_strdup_printf("%s/technology/%s",
477 technology->rfkill_list = g_hash_table_new_full(g_int_hash, g_int_equal,
479 technology->device_list = NULL;
481 technology->pending_reply = NULL;
482 technology->state = CONNMAN_TECHNOLOGY_STATE_OFFLINE;
484 __connman_storage_load_technology(technology);
486 if (g_dbus_register_interface(connection, technology->path,
487 CONNMAN_TECHNOLOGY_INTERFACE,
488 technology_methods, technology_signals,
489 NULL, technology, NULL) == FALSE) {
490 connman_error("Failed to register %s", technology->path);
495 technology_list = g_slist_append(technology_list, technology);
497 technologies_changed();
499 if (technology->driver != NULL)
502 for (list = driver_list; list; list = list->next) {
503 struct connman_technology_driver *driver = list->data;
505 DBG("driver %p name %s", driver, driver->name);
507 if (driver->type != technology->type)
510 if (driver->probe(technology) == 0) {
511 technology->driver = driver;
517 DBG("technology %p", technology);
522 static void technology_put(struct connman_technology *technology)
524 DBG("technology %p", technology);
526 if (g_atomic_int_dec_and_test(&technology->refcount) == FALSE)
529 if (technology->driver) {
530 technology->driver->remove(technology);
531 technology->driver = NULL;
534 technology_list = g_slist_remove(technology_list, technology);
536 technologies_changed();
538 g_dbus_unregister_interface(connection, technology->path,
539 CONNMAN_TECHNOLOGY_INTERFACE);
541 g_slist_free(technology->device_list);
542 g_hash_table_destroy(technology->rfkill_list);
544 g_free(technology->path);
545 g_free(technology->regdom);
549 void __connman_technology_add_interface(enum connman_service_type type,
550 int index, const char *name, const char *ident)
552 struct connman_technology *technology;
555 case CONNMAN_SERVICE_TYPE_UNKNOWN:
556 case CONNMAN_SERVICE_TYPE_SYSTEM:
558 case CONNMAN_SERVICE_TYPE_ETHERNET:
559 case CONNMAN_SERVICE_TYPE_WIFI:
560 case CONNMAN_SERVICE_TYPE_WIMAX:
561 case CONNMAN_SERVICE_TYPE_BLUETOOTH:
562 case CONNMAN_SERVICE_TYPE_CELLULAR:
563 case CONNMAN_SERVICE_TYPE_GPS:
564 case CONNMAN_SERVICE_TYPE_VPN:
565 case CONNMAN_SERVICE_TYPE_GADGET:
569 connman_info("Create interface %s [ %s ]", name,
570 __connman_service_type2string(type));
572 technology = technology_get(type);
574 if (technology == NULL || technology->driver == NULL
575 || technology->driver->add_interface == NULL)
578 technology->driver->add_interface(technology,
582 void __connman_technology_remove_interface(enum connman_service_type type,
583 int index, const char *name, const char *ident)
585 struct connman_technology *technology;
588 case CONNMAN_SERVICE_TYPE_UNKNOWN:
589 case CONNMAN_SERVICE_TYPE_SYSTEM:
591 case CONNMAN_SERVICE_TYPE_ETHERNET:
592 case CONNMAN_SERVICE_TYPE_WIFI:
593 case CONNMAN_SERVICE_TYPE_WIMAX:
594 case CONNMAN_SERVICE_TYPE_BLUETOOTH:
595 case CONNMAN_SERVICE_TYPE_CELLULAR:
596 case CONNMAN_SERVICE_TYPE_GPS:
597 case CONNMAN_SERVICE_TYPE_VPN:
598 case CONNMAN_SERVICE_TYPE_GADGET:
602 connman_info("Remove interface %s [ %s ]", name,
603 __connman_service_type2string(type));
605 technology = technology_find(type);
607 if (technology == NULL || technology->driver == NULL)
610 if (technology->driver->remove_interface)
611 technology->driver->remove_interface(technology, index);
613 technology_put(technology);
616 int __connman_technology_add_device(struct connman_device *device)
618 struct connman_technology *technology;
619 enum connman_service_type type;
620 connman_bool_t offlinemode = __connman_profile_get_offlinemode();
622 DBG("device %p", device);
624 type = __connman_device_get_service_type(device);
625 __connman_notifier_register(type);
627 technology = technology_get(type);
628 if (technology == NULL)
631 if (technology->enable_persistent && !offlinemode)
632 __connman_device_enable(device);
633 /* if technology persistent state is offline */
634 if (!technology->enable_persistent)
635 __connman_device_disable(device);
637 technology->device_list = g_slist_append(technology->device_list,
643 int __connman_technology_remove_device(struct connman_device *device)
645 struct connman_technology *technology;
646 enum connman_service_type type;
648 DBG("device %p", device);
650 type = __connman_device_get_service_type(device);
651 __connman_notifier_unregister(type);
653 technology = technology_find(type);
654 if (technology == NULL)
657 technology->device_list = g_slist_remove(technology->device_list,
659 if (technology->device_list == NULL) {
660 technology->state = CONNMAN_TECHNOLOGY_STATE_OFFLINE;
661 state_changed(technology);
667 static gboolean technology_pending_reply(gpointer user_data)
669 struct connman_technology *technology = user_data;
672 /* Power request timedout, send ETIMEDOUT. */
673 if (technology->pending_reply != NULL) {
674 reply = __connman_error_failed(technology->pending_reply, ETIMEDOUT);
676 g_dbus_send_message(connection, reply);
678 dbus_message_unref(technology->pending_reply);
679 technology->pending_reply = NULL;
680 technology->pending_timeout = 0;
686 int __connman_technology_enabled(enum connman_service_type type)
688 struct connman_technology *technology;
690 technology = technology_find(type);
691 if (technology == NULL)
694 if (g_atomic_int_exchange_and_add(&technology->enabled, 1) == 0) {
695 __connman_notifier_enable(type);
696 technology->state = CONNMAN_TECHNOLOGY_STATE_ENABLED;
697 state_changed(technology);
700 if (technology->pending_reply != NULL) {
701 g_dbus_send_reply(connection, technology->pending_reply, DBUS_TYPE_INVALID);
702 dbus_message_unref(technology->pending_reply);
703 technology->pending_reply = NULL;
704 technology->pending_timeout = 0;
710 int __connman_technology_enable(enum connman_service_type type, DBusMessage *msg)
712 struct connman_technology *technology;
718 DBG("type %d enable", type);
720 technology = technology_find(type);
721 if (technology == NULL) {
726 if (technology->pending_reply != NULL) {
732 technology->pending_reply = dbus_message_ref(msg);
734 * This is a bit of a trick. When msg is not NULL it means
735 * thats technology_enable was invoked from the manager API. Hence we save
738 technology->enable_persistent = TRUE;
739 __connman_storage_save_technology(technology);
742 __connman_rfkill_block(technology->type, FALSE);
744 for (list = technology->device_list; list; list = list->next) {
745 struct connman_device *device = list->data;
747 err = __connman_device_enable(device);
749 * err = 0 : Device was enabled right away.
750 * If atleast one device gets enabled, we consider
751 * the technology to be enabled.
762 if (err == -EINPROGRESS)
763 technology->pending_timeout = g_timeout_add_seconds(10,
764 technology_pending_reply, technology);
766 reply = __connman_error_failed(msg, -err);
768 g_dbus_send_message(connection, reply);
775 int __connman_technology_disabled(enum connman_service_type type)
777 struct connman_technology *technology;
779 technology = technology_find(type);
780 if (technology == NULL)
783 if (technology->pending_reply != NULL) {
784 g_dbus_send_reply(connection, technology->pending_reply, DBUS_TYPE_INVALID);
785 dbus_message_unref(technology->pending_reply);
786 technology->pending_reply = NULL;
789 if (g_atomic_int_dec_and_test(&technology->enabled) == TRUE) {
790 __connman_notifier_disable(type);
791 technology->state = CONNMAN_TECHNOLOGY_STATE_OFFLINE;
792 state_changed(technology);
798 int __connman_technology_disable(enum connman_service_type type, DBusMessage *msg)
800 struct connman_technology *technology;
806 DBG("type %d disable", type);
808 technology = technology_find(type);
809 if (technology == NULL) {
814 if (technology->pending_reply != NULL) {
820 technology->pending_reply = dbus_message_ref(msg);
821 technology->enable_persistent = FALSE;
822 __connman_storage_save_technology(technology);
825 __connman_rfkill_block(technology->type, TRUE);
827 for (list = technology->device_list; list; list = list->next) {
828 struct connman_device *device = list->data;
830 err = __connman_device_disable(device);
840 if (err == -EINPROGRESS)
841 technology->pending_timeout = g_timeout_add_seconds(10,
842 technology_pending_reply, technology);
844 reply = __connman_error_failed(msg, -err);
846 g_dbus_send_message(connection, reply);
853 int __connman_technology_set_offlinemode(connman_bool_t offlinemode)
858 DBG("offlinemode %s", offlinemode ? "On" : "Off");
860 * This is a bit tricky. When you set offlinemode, there is no
861 * way to differentiate between attempting offline mode and
862 * resuming offlinemode from last saved profile. We need that
863 * information in rfkill_update, otherwise it falls back on the
864 * technology's persistent state. Hence we set the offline mode here
865 * but save it & call the notifier only if its successful.
867 __connman_profile_set_offlinemode(offlinemode);
869 /* Traverse technology list, enable/disable each technology. */
870 for (list = technology_list; list; list = list->next) {
871 struct connman_technology *technology = list->data;
874 err = __connman_technology_disable(technology->type, NULL);
876 if (!offlinemode && technology->enable_persistent)
877 err = __connman_technology_enable(technology->type, NULL);
880 if (err == 0 || err == -EINPROGRESS || err == -EALREADY) {
881 __connman_profile_save_default();
882 __connman_notifier_offlinemode(offlinemode);
888 int __connman_technology_add_rfkill(unsigned int index,
889 enum connman_service_type type,
890 connman_bool_t softblock,
891 connman_bool_t hardblock)
893 struct connman_technology *technology;
894 struct connman_rfkill *rfkill;
895 connman_bool_t offlinemode = __connman_profile_get_offlinemode();
897 DBG("index %u type %d soft %u hard %u", index, type,
898 softblock, hardblock);
900 technology = technology_get(type);
901 if (technology == NULL)
904 rfkill = g_try_new0(struct connman_rfkill, 1);
908 rfkill->index = index;
910 rfkill->softblock = softblock;
911 rfkill->hardblock = hardblock;
913 g_hash_table_replace(technology->rfkill_list, &rfkill->index, rfkill);
916 DBG("%s is switched off.", get_name(type));
921 * If Offline mode is on, we softblock the device if it isnt already.
922 * If Offline mode is off, we rely on the persistent state of tech.
926 return __connman_rfkill_block(type, TRUE);
928 if (technology->enable_persistent && softblock)
929 return __connman_rfkill_block(type, FALSE);
930 /* if technology persistent state is offline */
931 if (!technology->enable_persistent && !softblock)
932 return __connman_rfkill_block(type, TRUE);
938 int __connman_technology_update_rfkill(unsigned int index,
939 enum connman_service_type type,
940 connman_bool_t softblock,
941 connman_bool_t hardblock)
943 struct connman_technology *technology;
944 struct connman_rfkill *rfkill;
945 connman_bool_t offlinemode = __connman_profile_get_offlinemode();
947 DBG("index %u soft %u hard %u", index, softblock, hardblock);
949 technology = technology_find(type);
950 if (technology == NULL)
953 rfkill = g_hash_table_lookup(technology->rfkill_list, &index);
957 if (rfkill->softblock == softblock &&
958 rfkill->hardblock == hardblock)
961 rfkill->softblock = softblock;
962 rfkill->hardblock = hardblock;
965 DBG("%s is switched off.", get_name(type));
970 if (technology->enable_persistent && softblock)
971 return __connman_rfkill_block(type, FALSE);
972 if (!technology->enable_persistent && !softblock)
973 return __connman_rfkill_block(type, TRUE);
979 int __connman_technology_remove_rfkill(unsigned int index,
980 enum connman_service_type type)
982 struct connman_technology *technology;
983 struct connman_rfkill *rfkill;
985 DBG("index %u", index);
987 technology = technology_find(type);
988 if (technology == NULL)
991 rfkill = g_hash_table_lookup(technology->rfkill_list, &index);
995 g_hash_table_remove(technology->rfkill_list, &index);
997 technology_put(technology);
1002 static int technology_load(struct connman_technology *technology)
1004 const char *ident = __connman_profile_active_ident();
1007 GError *error = NULL;
1008 connman_bool_t enable;
1010 DBG("technology %p", technology);
1012 keyfile = __connman_storage_open_profile(ident);
1013 if (keyfile == NULL)
1016 identifier = g_strdup_printf("%s", get_name(technology->type));
1017 if (identifier == NULL)
1020 enable = g_key_file_get_boolean(keyfile, identifier, "Enable", &error);
1022 technology->enable_persistent = enable;
1024 technology->enable_persistent = FALSE;
1026 g_clear_error(&error);
1030 __connman_storage_close_profile(ident, keyfile, FALSE);
1035 static int technology_save(struct connman_technology *technology)
1037 const char *ident = __connman_profile_active_ident();
1041 DBG("technology %p", technology);
1043 keyfile = __connman_storage_open_profile(ident);
1044 if (keyfile == NULL)
1047 identifier = g_strdup_printf("%s", get_name(technology->type));
1048 if (identifier == NULL)
1051 g_key_file_set_boolean(keyfile, identifier, "Enable",
1052 technology->enable_persistent);
1057 __connman_storage_close_profile(ident, keyfile, TRUE);
1062 static struct connman_storage tech_storage = {
1063 .name = "technology",
1064 .priority = CONNMAN_STORAGE_PRIORITY_LOW,
1065 .tech_load = technology_load,
1066 .tech_save = technology_save,
1069 int __connman_technology_init(void)
1073 connection = connman_dbus_get_connection();
1075 return connman_storage_register(&tech_storage);
1078 void __connman_technology_cleanup(void)
1082 dbus_connection_unref(connection);
1084 connman_storage_unregister(&tech_storage);