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
31 static GSList *device_list = NULL;
32 static gchar **device_filter = NULL;
33 static gchar **nodevice_filter = NULL;
35 enum connman_pending_type {
41 struct connman_device {
43 enum connman_device_type type;
44 enum connman_pending_type powered_pending; /* Indicates a pending
45 enable/disable request */
46 connman_bool_t powered;
47 connman_bool_t scanning;
48 connman_bool_t disconnected;
49 connman_bool_t reconnect;
50 connman_uint16_t scan_interval;
51 connman_uint16_t backoff_interval;
62 guint pending_timeout;
64 struct connman_device_driver *driver;
68 struct connman_network *network;
72 #define SCAN_INITIAL_DELAY 10
74 static gboolean device_scan_trigger(gpointer user_data)
76 struct connman_device *device = user_data;
78 DBG("device %p", device);
80 if (device->driver == NULL) {
81 device->scan_timeout = 0;
85 if (device->driver->scan)
86 device->driver->scan(device);
91 static void clear_scan_trigger(struct connman_device *device)
93 if (device->scan_timeout > 0) {
94 g_source_remove(device->scan_timeout);
95 device->scan_timeout = 0;
99 static void reset_scan_trigger(struct connman_device *device)
101 clear_scan_trigger(device);
103 if (device->scan_interval > 0) {
106 if (g_hash_table_size(device->networks) == 0) {
107 if (device->backoff_interval >= device->scan_interval)
108 device->backoff_interval = SCAN_INITIAL_DELAY;
109 interval = device->backoff_interval;
111 interval = device->scan_interval;
113 DBG("interval %d", interval);
115 device->scan_timeout = g_timeout_add_seconds(interval,
116 device_scan_trigger, device);
118 device->backoff_interval *= 2;
119 if (device->backoff_interval > device->scan_interval)
120 device->backoff_interval = device->scan_interval;
124 static void force_scan_trigger(struct connman_device *device)
126 clear_scan_trigger(device);
128 device->scan_timeout = g_timeout_add_seconds(5,
129 device_scan_trigger, device);
132 void connman_device_schedule_scan(struct connman_device *device)
134 reset_scan_trigger(device);
137 static const char *type2description(enum connman_device_type type)
140 case CONNMAN_DEVICE_TYPE_UNKNOWN:
141 case CONNMAN_DEVICE_TYPE_VENDOR:
143 case CONNMAN_DEVICE_TYPE_ETHERNET:
145 case CONNMAN_DEVICE_TYPE_WIFI:
147 case CONNMAN_DEVICE_TYPE_WIMAX:
149 case CONNMAN_DEVICE_TYPE_BLUETOOTH:
151 case CONNMAN_DEVICE_TYPE_GPS:
153 case CONNMAN_DEVICE_TYPE_CELLULAR:
155 case CONNMAN_DEVICE_TYPE_GADGET:
163 static const char *type2string(enum connman_device_type type)
166 case CONNMAN_DEVICE_TYPE_UNKNOWN:
167 case CONNMAN_DEVICE_TYPE_VENDOR:
169 case CONNMAN_DEVICE_TYPE_ETHERNET:
171 case CONNMAN_DEVICE_TYPE_WIFI:
173 case CONNMAN_DEVICE_TYPE_WIMAX:
175 case CONNMAN_DEVICE_TYPE_BLUETOOTH:
177 case CONNMAN_DEVICE_TYPE_GPS:
179 case CONNMAN_DEVICE_TYPE_CELLULAR:
181 case CONNMAN_DEVICE_TYPE_GADGET:
189 enum connman_service_type __connman_device_get_service_type(struct connman_device *device)
191 enum connman_device_type type = connman_device_get_type(device);
194 case CONNMAN_DEVICE_TYPE_UNKNOWN:
195 case CONNMAN_DEVICE_TYPE_VENDOR:
196 case CONNMAN_DEVICE_TYPE_GPS:
198 case CONNMAN_DEVICE_TYPE_ETHERNET:
199 return CONNMAN_SERVICE_TYPE_ETHERNET;
200 case CONNMAN_DEVICE_TYPE_WIFI:
201 return CONNMAN_SERVICE_TYPE_WIFI;
202 case CONNMAN_DEVICE_TYPE_WIMAX:
203 return CONNMAN_SERVICE_TYPE_WIMAX;
204 case CONNMAN_DEVICE_TYPE_BLUETOOTH:
205 return CONNMAN_SERVICE_TYPE_BLUETOOTH;
206 case CONNMAN_DEVICE_TYPE_CELLULAR:
207 return CONNMAN_SERVICE_TYPE_CELLULAR;
208 case CONNMAN_DEVICE_TYPE_GADGET:
209 return CONNMAN_SERVICE_TYPE_GADGET;
213 return CONNMAN_SERVICE_TYPE_UNKNOWN;
216 static gboolean device_pending_reset(gpointer user_data)
218 struct connman_device *device = user_data;
220 DBG("device %p", device);
222 /* Power request timedout, reset power pending state. */
223 device->pending_timeout = 0;
224 device->powered_pending = PENDING_NONE;
229 int __connman_device_enable(struct connman_device *device)
233 DBG("device %p", device);
235 if (!device->driver || !device->driver->enable)
238 /* There is an ongoing power disable request. */
239 if (device->powered_pending == PENDING_DISABLE)
242 if (device->powered_pending == PENDING_ENABLE)
245 if (device->powered_pending == PENDING_NONE && device->powered == TRUE)
248 device->powered_pending = PENDING_ENABLE;
250 err = device->driver->enable(device);
252 * device gets enabled right away.
253 * Invoke the callback
256 connman_device_set_powered(device, TRUE);
260 if (err == -EALREADY) {
261 /* If device is already powered, but connman is not updated */
262 connman_device_set_powered(device, TRUE);
266 * if err == -EINPROGRESS, then the DBus call to the respective daemon
267 * was successful. We set a 4 sec timeout so if the daemon never
268 * returns a reply, we would reset the pending request.
270 if (err == -EINPROGRESS)
271 device->pending_timeout = g_timeout_add_seconds(4,
272 device_pending_reset, device);
277 int __connman_device_disable(struct connman_device *device)
281 DBG("device %p", device);
283 if (!device->driver || !device->driver->disable)
286 /* Ongoing power enable request */
287 if (device->powered_pending == PENDING_ENABLE)
290 if (device->powered_pending == PENDING_DISABLE)
293 if (device->powered_pending == PENDING_NONE && device->powered == FALSE)
296 device->powered_pending = PENDING_DISABLE;
297 device->reconnect = FALSE;
299 clear_scan_trigger(device);
302 connman_network_set_connected(device->network, FALSE);
304 err = device->driver->disable(device);
306 connman_device_set_powered(device, FALSE);
310 if (err == -EALREADY) {
311 connman_device_set_powered(device, FALSE);
315 if (err == -EINPROGRESS)
316 device->pending_timeout = g_timeout_add_seconds(4,
317 device_pending_reset, device);
322 static void probe_driver(struct connman_device_driver *driver)
326 DBG("driver %p name %s", driver, driver->name);
328 for (list = device_list; list != NULL; list = list->next) {
329 struct connman_device *device = list->data;
331 if (device->driver != NULL)
334 if (driver->type != device->type)
337 if (driver->probe(device) < 0)
340 device->driver = driver;
342 __connman_technology_add_device(device);
346 static void remove_device(struct connman_device *device)
348 DBG("device %p", device);
350 __connman_device_disable(device);
352 __connman_technology_remove_device(device);
354 if (device->driver->remove)
355 device->driver->remove(device);
357 device->driver = NULL;
360 static void remove_driver(struct connman_device_driver *driver)
364 DBG("driver %p name %s", driver, driver->name);
366 for (list = device_list; list != NULL; list = list->next) {
367 struct connman_device *device = list->data;
369 if (device->driver == driver)
370 remove_device(device);
374 connman_bool_t __connman_device_has_driver(struct connman_device *device)
376 if (device == NULL || device->driver == NULL)
382 static GSList *driver_list = NULL;
384 static gint compare_priority(gconstpointer a, gconstpointer b)
386 const struct connman_device_driver *driver1 = a;
387 const struct connman_device_driver *driver2 = b;
389 return driver2->priority - driver1->priority;
393 * connman_device_driver_register:
394 * @driver: device driver definition
396 * Register a new device driver
398 * Returns: %0 on success
400 int connman_device_driver_register(struct connman_device_driver *driver)
402 DBG("driver %p name %s", driver, driver->name);
404 driver_list = g_slist_insert_sorted(driver_list, driver,
406 probe_driver(driver);
412 * connman_device_driver_unregister:
413 * @driver: device driver definition
415 * Remove a previously registered device driver
417 void connman_device_driver_unregister(struct connman_device_driver *driver)
419 DBG("driver %p name %s", driver, driver->name);
421 driver_list = g_slist_remove(driver_list, driver);
423 remove_driver(driver);
426 static void free_network(gpointer data)
428 struct connman_network *network = data;
430 DBG("network %p", network);
432 __connman_network_set_device(network, NULL);
434 connman_network_unref(network);
437 static void device_destruct(struct connman_device *device)
439 DBG("device %p name %s", device, device->name);
441 clear_scan_trigger(device);
443 g_free(device->ident);
444 g_free(device->node);
445 g_free(device->name);
446 g_free(device->address);
447 g_free(device->interface);
448 g_free(device->path);
449 g_free(device->devname);
451 g_free(device->last_network);
453 g_hash_table_destroy(device->networks);
454 device->networks = NULL;
460 * connman_device_create:
461 * @node: device node name (for example an address)
464 * Allocate a new device of given #type and assign the #node name to it.
466 * Returns: a newly-allocated #connman_device structure
468 struct connman_device *connman_device_create(const char *node,
469 enum connman_device_type type)
471 struct connman_device *device;
472 connman_bool_t bg_scan;
474 DBG("node %s type %d", node, type);
476 device = g_try_new0(struct connman_device, 1);
480 DBG("device %p", device);
482 device->refcount = 1;
484 bg_scan = connman_setting_get_bool("BackgroundScanning");
487 device->name = g_strdup(type2description(device->type));
489 device->phyindex = -1;
491 device->backoff_interval = SCAN_INITIAL_DELAY;
494 case CONNMAN_DEVICE_TYPE_UNKNOWN:
495 case CONNMAN_DEVICE_TYPE_ETHERNET:
496 case CONNMAN_DEVICE_TYPE_WIMAX:
497 case CONNMAN_DEVICE_TYPE_BLUETOOTH:
498 case CONNMAN_DEVICE_TYPE_CELLULAR:
499 case CONNMAN_DEVICE_TYPE_GPS:
500 case CONNMAN_DEVICE_TYPE_GADGET:
501 case CONNMAN_DEVICE_TYPE_VENDOR:
502 device->scan_interval = 0;
504 case CONNMAN_DEVICE_TYPE_WIFI:
506 device->scan_interval = 300;
508 device->scan_interval = 0;
512 device->networks = g_hash_table_new_full(g_str_hash, g_str_equal,
513 g_free, free_network);
515 device_list = g_slist_append(device_list, device);
521 * connman_device_ref:
522 * @device: device structure
524 * Increase reference counter of device
526 struct connman_device *connman_device_ref(struct connman_device *device)
530 g_atomic_int_inc(&device->refcount);
536 * connman_device_unref:
537 * @device: device structure
539 * Decrease reference counter of device
541 void connman_device_unref(struct connman_device *device)
543 if (g_atomic_int_dec_and_test(&device->refcount) == FALSE)
546 if (device->driver) {
547 device->driver->remove(device);
548 device->driver = NULL;
551 device_list = g_slist_remove(device_list, device);
553 device_destruct(device);
556 const char *__connman_device_get_type(struct connman_device *device)
558 return type2string(device->type);
562 * connman_device_get_type:
563 * @device: device structure
567 enum connman_device_type connman_device_get_type(struct connman_device *device)
573 * connman_device_set_index:
574 * @device: device structure
575 * @index: index number
577 * Set index number of device
579 void connman_device_set_index(struct connman_device *device, int index)
581 device->index = index;
585 * connman_device_get_index:
586 * @device: device structure
588 * Get index number of device
590 int connman_device_get_index(struct connman_device *device)
592 return device->index;
595 int __connman_device_get_phyindex(struct connman_device *device)
597 return device->phyindex;
600 void __connman_device_set_phyindex(struct connman_device *device,
603 device->phyindex = phyindex;
607 * connman_device_set_interface:
608 * @device: device structure
609 * @interface: interface name
611 * Set interface name of device
613 void connman_device_set_interface(struct connman_device *device,
614 const char *interface)
616 g_free(device->devname);
617 device->devname = g_strdup(interface);
619 g_free(device->interface);
620 device->interface = g_strdup(interface);
622 if (device->name == NULL) {
623 const char *str = type2description(device->type);
624 if (str != NULL && device->interface != NULL)
625 device->name = g_strdup_printf("%s (%s)", str,
631 * connman_device_set_ident:
632 * @device: device structure
633 * @ident: unique identifier
635 * Set unique identifier of device
637 void connman_device_set_ident(struct connman_device *device,
640 g_free(device->ident);
641 device->ident = g_strdup(ident);
644 const char *connman_device_get_ident(struct connman_device *device)
646 return device->ident;
650 * connman_device_set_powered:
651 * @device: device structure
652 * @powered: powered state
654 * Change power state of device
656 int connman_device_set_powered(struct connman_device *device,
657 connman_bool_t powered)
659 enum connman_service_type type;
661 DBG("driver %p powered %d", device, powered);
663 if (device->powered == powered)
666 if (device->pending_timeout) {
667 /* Reset pending request */
668 g_source_remove(device->pending_timeout);
669 device->pending_timeout = 0;
672 device->powered_pending = PENDING_NONE;
674 device->powered = powered;
676 type = __connman_device_get_service_type(device);
678 if (device->powered == TRUE)
679 __connman_technology_enabled(type);
681 __connman_technology_disabled(type);
683 if (powered == FALSE)
686 connman_device_set_disconnected(device, FALSE);
687 device->scanning = FALSE;
689 reset_scan_trigger(device);
691 if (device->driver && device->driver->scan_fast)
692 device->driver->scan_fast(device);
693 else if (device->driver && device->driver->scan)
694 device->driver->scan(device);
699 static int device_scan(struct connman_device *device)
701 if (!device->driver || !device->driver->scan)
704 if (device->powered == FALSE)
707 reset_scan_trigger(device);
709 return device->driver->scan(device);
712 int __connman_device_disconnect(struct connman_device *device)
717 DBG("device %p", device);
719 connman_device_set_disconnected(device, TRUE);
721 g_hash_table_iter_init(&iter, device->networks);
723 while (g_hash_table_iter_next(&iter, &key, &value) == TRUE) {
724 struct connman_network *network = value;
726 if (connman_network_get_connecting(network) == TRUE) {
728 * Skip network in the process of connecting.
729 * This is a workaround for WiFi networks serviced
730 * by the supplicant plugin that hold a reference
731 * to the network. If we disconnect the network
732 * here then the referenced object will not be
733 * registered and usage (like launching DHCP client)
734 * will fail. There is nothing to be gained by
735 * removing the network here anyway.
737 connman_warn("Skipping disconnect of %s, network is connecting.",
738 connman_network_get_identifier(network));
742 __connman_network_disconnect(network);
748 static void mark_network_available(gpointer key, gpointer value,
751 struct connman_network *network = value;
753 connman_network_set_available(network, TRUE);
756 static void mark_network_unavailable(gpointer key, gpointer value,
759 struct connman_network *network = value;
761 if (connman_network_get_connected(network) == TRUE)
764 connman_network_set_available(network, FALSE);
767 static gboolean remove_unavailable_network(gpointer key, gpointer value,
770 struct connman_network *network = value;
772 if (connman_network_get_connected(network) == TRUE)
775 if (connman_network_get_available(network) == TRUE)
781 void __connman_device_cleanup_networks(struct connman_device *device)
783 g_hash_table_foreach_remove(device->networks,
784 remove_unavailable_network, NULL);
787 connman_bool_t __connman_device_scanning(struct connman_device *device)
789 return device->scanning;
792 void connman_device_reset_scanning(struct connman_device *device)
794 device->scanning = FALSE;
796 g_hash_table_foreach(device->networks,
797 mark_network_available, NULL);
802 * connman_device_set_scanning:
803 * @device: device structure
804 * @scanning: scanning state
806 * Change scanning state of device
808 int connman_device_set_scanning(struct connman_device *device,
809 connman_bool_t scanning)
811 DBG("device %p scanning %d", device, scanning);
813 if (!device->driver || !device->driver->scan)
816 if (device->scanning == scanning)
819 device->scanning = scanning;
821 if (scanning == TRUE) {
822 reset_scan_trigger(device);
824 g_hash_table_foreach(device->networks,
825 mark_network_unavailable, NULL);
830 __connman_device_cleanup_networks(device);
832 __connman_service_auto_connect();
838 * connman_device_set_disconnected:
839 * @device: device structure
840 * @disconnected: disconnected state
842 * Change disconnected state of device (only for device with networks)
844 int connman_device_set_disconnected(struct connman_device *device,
845 connman_bool_t disconnected)
847 DBG("device %p disconnected %d", device, disconnected);
849 if (device->disconnected == disconnected)
852 device->disconnected = disconnected;
854 if (disconnected == TRUE)
856 force_scan_trigger(device);
857 device->backoff_interval = SCAN_INITIAL_DELAY;
864 * connman_device_get_disconnected:
865 * @device: device structure
867 * Get device disconnected state
869 connman_bool_t connman_device_get_disconnected(struct connman_device *device)
871 return device->disconnected;
875 * connman_device_set_string:
876 * @device: device structure
877 * @key: unique identifier
878 * @value: string value
880 * Set string value for specific key
882 int connman_device_set_string(struct connman_device *device,
883 const char *key, const char *value)
885 DBG("device %p key %s value %s", device, key, value);
887 if (g_str_equal(key, "Address") == TRUE) {
888 g_free(device->address);
889 device->address = g_strdup(value);
890 } else if (g_str_equal(key, "Name") == TRUE) {
891 g_free(device->name);
892 device->name = g_strdup(value);
893 } else if (g_str_equal(key, "Node") == TRUE) {
894 g_free(device->node);
895 device->node = g_strdup(value);
896 } else if (g_str_equal(key, "Path") == TRUE) {
897 g_free(device->path);
898 device->path = g_strdup(value);
907 * connman_device_get_string:
908 * @device: device structure
909 * @key: unique identifier
911 * Get string value for specific key
913 const char *connman_device_get_string(struct connman_device *device,
916 DBG("device %p key %s", device, key);
918 if (g_str_equal(key, "Address") == TRUE)
919 return device->address;
920 else if (g_str_equal(key, "Name") == TRUE)
922 else if (g_str_equal(key, "Node") == TRUE)
924 else if (g_str_equal(key, "Interface") == TRUE)
925 return device->interface;
926 else if (g_str_equal(key, "Path") == TRUE)
933 * connman_device_add_network:
934 * @device: device structure
935 * @network: network structure
937 * Add new network to the device
939 int connman_device_add_network(struct connman_device *device,
940 struct connman_network *network)
942 const char *identifier = connman_network_get_identifier(network);
944 DBG("device %p network %p", device, network);
946 if (identifier == NULL)
949 connman_network_ref(network);
951 __connman_network_set_device(network, device);
953 g_hash_table_insert(device->networks, g_strdup(identifier),
960 * connman_device_get_network:
961 * @device: device structure
962 * @identifier: network identifier
964 * Get network for given identifier
966 struct connman_network *connman_device_get_network(struct connman_device *device,
967 const char *identifier)
969 DBG("device %p identifier %s", device, identifier);
971 return g_hash_table_lookup(device->networks, identifier);
975 * connman_device_remove_network:
976 * @device: device structure
977 * @identifier: network identifier
979 * Remove network for given identifier
981 int connman_device_remove_network(struct connman_device *device,
982 struct connman_network *network)
984 const char *identifier;
986 DBG("device %p network %p", device, network);
991 identifier = connman_network_get_identifier(network);
992 g_hash_table_remove(device->networks, identifier);
997 void connman_device_remove_all_networks(struct connman_device *device)
999 g_hash_table_remove_all(device->networks);
1002 void __connman_device_set_network(struct connman_device *device,
1003 struct connman_network *network)
1010 if (device->network == network)
1013 if (network != NULL) {
1014 name = connman_network_get_string(network, "Name");
1015 g_free(device->last_network);
1016 device->last_network = g_strdup(name);
1018 device->network = network;
1020 g_free(device->last_network);
1021 device->last_network = NULL;
1023 device->network = NULL;
1027 void __connman_device_set_reconnect(struct connman_device *device,
1028 connman_bool_t reconnect)
1030 device->reconnect = reconnect;
1033 connman_bool_t __connman_device_get_reconnect(
1034 struct connman_device *device)
1036 return device->reconnect;
1039 static gboolean match_driver(struct connman_device *device,
1040 struct connman_device_driver *driver)
1042 if (device->type == driver->type ||
1043 driver->type == CONNMAN_DEVICE_TYPE_UNKNOWN)
1050 * connman_device_register:
1051 * @device: device structure
1053 * Register device with the system
1055 int connman_device_register(struct connman_device *device)
1059 DBG("device %p name %s", device, device->name);
1061 if (device->driver != NULL)
1064 for (list = driver_list; list; list = list->next) {
1065 struct connman_device_driver *driver = list->data;
1067 if (match_driver(device, driver) == FALSE)
1070 DBG("driver %p name %s", driver, driver->name);
1072 if (driver->probe(device) == 0) {
1073 device->driver = driver;
1078 if (device->driver == NULL)
1081 return __connman_technology_add_device(device);
1085 * connman_device_unregister:
1086 * @device: device structure
1088 * Unregister device with the system
1090 void connman_device_unregister(struct connman_device *device)
1092 DBG("device %p name %s", device, device->name);
1094 if (device->driver == NULL)
1097 remove_device(device);
1101 * connman_device_get_data:
1102 * @device: device structure
1104 * Get private device data pointer
1106 void *connman_device_get_data(struct connman_device *device)
1108 return device->driver_data;
1112 * connman_device_set_data:
1113 * @device: device structure
1114 * @data: data pointer
1116 * Set private device data pointer
1118 void connman_device_set_data(struct connman_device *device, void *data)
1120 device->driver_data = data;
1123 struct connman_device *__connman_device_find_device(
1124 enum connman_service_type type)
1128 for (list = device_list; list != NULL; list = list->next) {
1129 struct connman_device *device = list->data;
1130 enum connman_service_type service_type =
1131 __connman_device_get_service_type(device);
1133 if (service_type != type)
1142 int __connman_device_request_scan(enum connman_service_type type)
1148 case CONNMAN_SERVICE_TYPE_UNKNOWN:
1149 case CONNMAN_SERVICE_TYPE_SYSTEM:
1150 case CONNMAN_SERVICE_TYPE_ETHERNET:
1151 case CONNMAN_SERVICE_TYPE_BLUETOOTH:
1152 case CONNMAN_SERVICE_TYPE_CELLULAR:
1153 case CONNMAN_SERVICE_TYPE_GPS:
1154 case CONNMAN_SERVICE_TYPE_VPN:
1155 case CONNMAN_SERVICE_TYPE_GADGET:
1157 case CONNMAN_SERVICE_TYPE_WIFI:
1158 case CONNMAN_SERVICE_TYPE_WIMAX:
1162 for (list = device_list; list != NULL; list = list->next) {
1163 struct connman_device *device = list->data;
1164 enum connman_service_type service_type =
1165 __connman_device_get_service_type(device);
1167 if (service_type != CONNMAN_SERVICE_TYPE_UNKNOWN &&
1168 service_type != type) {
1172 err = device_scan(device);
1173 if (err < 0 && err != -EINPROGRESS) {
1175 /* XXX maybe only a continue? */
1183 connman_bool_t __connman_device_isfiltered(const char *devname)
1187 if (device_filter == NULL)
1190 for (pattern = device_filter; *pattern; pattern++) {
1191 if (g_pattern_match_simple(*pattern, devname) == FALSE) {
1192 DBG("ignoring device %s (match)", devname);
1198 if (g_pattern_match_simple("dummy*", devname) == TRUE) {
1199 DBG("ignoring dummy networking devices");
1203 if (nodevice_filter == NULL)
1206 for (pattern = nodevice_filter; *pattern; pattern++) {
1207 if (g_pattern_match_simple(*pattern, devname) == TRUE) {
1208 DBG("ignoring device %s (no match)", devname);
1216 int __connman_device_init(const char *device, const char *nodevice)
1221 device_filter = g_strsplit(device, ",", -1);
1223 if (nodevice != NULL)
1224 nodevice_filter = g_strsplit(nodevice, ",", -1);
1229 void __connman_device_cleanup(void)
1233 g_strfreev(nodevice_filter);
1234 g_strfreev(device_filter);