Add devname attribute for device filtering
authorMarcel Holtmann <marcel@holtmann.org>
Thu, 11 Dec 2008 15:56:43 +0000 (16:56 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 11 Dec 2008 15:56:43 +0000 (16:56 +0100)
include/element.h
src/element.c

index aaf389d..e56f669 100644 (file)
@@ -95,6 +95,7 @@ struct connman_element {
        gboolean available;
        gboolean remember;
        guint16 priority;
+       gchar *devname;
 
        struct connman_element *parent;
 
index a8eee21..7361eb2 100644 (file)
@@ -1154,6 +1154,7 @@ void connman_element_unref(struct connman_element *element)
                g_free(element->ipv4.network);
                g_free(element->ipv4.broadcast);
                g_free(element->ipv4.nameserver);
+               g_free(element->devname);
                g_free(element->path);
                g_free(element->name);
                g_free(element);
@@ -1846,10 +1847,14 @@ int connman_element_register(struct connman_element *element,
 {
        DBG("element %p name %s parent %p", element, element->name, parent);
 
+       if (element->devname == NULL)
+               element->devname = g_strdup(element->name);
+
        if (device_filter && element->type == CONNMAN_ELEMENT_TYPE_DEVICE) {
                if (g_pattern_match_simple(device_filter,
-                                               element->name) == FALSE) {
-                       DBG("ignoring %s device", element->name);
+                                               element->devname) == FALSE) {
+                       DBG("ignoring %s [%s] device", element->name,
+                                                       element->devname);
                        return -EPERM;
                }
        }