Fixed network setup scripts
[mtetherd] / net.c
diff --git a/net.c b/net.c
index 43d49f9..a727605 100644 (file)
--- a/net.c
+++ b/net.c
@@ -246,6 +246,7 @@ gboolean mtetherd_device_list_add(gpointer list, MTetherDDevice *device) {
                for (i = 0; i < MAX_DEVICES; i++) {
                        if (!array[i]) {
                                array[i] = (gpointer) device;
+                               mtetherd_device_set_index(device, i);
                                return TRUE;
                        }
                }
@@ -268,12 +269,15 @@ gboolean mtetherd_device_list_remove(gpointer list, const gchar *udi) {
 }
 
 gboolean mtetherd_device_ok(const gchar *interface) {
-       if (strncmp("usb", interface, sizeof("usb")) == 0) {
+       if (g_str_has_prefix(interface, "usb")) {
+               g_log(MTETHERD_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s has prefix %s", interface, "usb");
                return TRUE;
        }
-       if (strncmp("bnep", interface, sizeof("bnep")) == 0) {
+       if (g_str_has_prefix(interface, "bnep")) {
+               g_log(MTETHERD_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s has prefix %s", interface, "bnep");
                return TRUE;
        }
+       g_log(MTETHERD_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s has unknown prefix :(", interface);
        return FALSE;
 }