Add technology driver callback for setting Tethering
authorMarcel Holtmann <marcel@holtmann.org>
Thu, 15 Jul 2010 15:52:58 +0000 (17:52 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 15 Jul 2010 15:52:58 +0000 (17:52 +0200)
include/technology.h
src/technology.c

index 5635040..7638454 100644 (file)
@@ -42,6 +42,8 @@ struct connman_technology_driver {
        int priority;
        int (*probe) (struct connman_technology *technology);
        void (*remove) (struct connman_technology *technology);
+       int (*set_tethering) (struct connman_technology *technology,
+                                               connman_bool_t enabled);
 };
 
 int connman_technology_driver_register(struct connman_technology_driver *driver);
index 23f46cf..0ee91a3 100644 (file)
@@ -100,7 +100,7 @@ void connman_technology_driver_unregister(struct connman_technology_driver *driv
        driver_list = g_slist_remove(driver_list, driver);
 }
 
-int __connman_technology_enable_tethering(void)
+static int set_tethering(connman_bool_t enabled)
 {
        GSList *list;
 
@@ -109,23 +109,22 @@ int __connman_technology_enable_tethering(void)
 
                if (technology->driver == NULL)
                        continue;
+
+               if (technology->driver->set_tethering)
+                       technology->driver->set_tethering(technology, enabled);
        }
 
        return 0;
 }
 
-int __connman_technology_disable_tethering(void)
+int __connman_technology_enable_tethering(void)
 {
-       GSList *list;
-
-       for (list = technology_list; list; list = list->next) {
-               struct connman_technology *technology = list->data;
-
-               if (technology->driver == NULL)
-                       continue;
-       }
+       return set_tethering(TRUE);
+}
 
-       return 0;
+int __connman_technology_disable_tethering(void)
+{
+       return set_tethering(FALSE);
 }
 
 static void free_rfkill(gpointer data)