This email list is read-only.  Emails sent to this list will be discarded
----------------------------------
 Makefile.am         |    3 +
 bootstrap-configure |    2 +
 configure.ac        |   11 ++++-
 include/device.h    |    2 +
 plugins/Makefile.am |   12 +++++
 plugins/huawei.c    |   83 +++++++++++++++++++++++++++++++++
 plugins/novatel.c   |   83 +++++++++++++++++++++++++++++++++
 src/connman.h       |    6 +++
 src/connman.rules   |    3 +
 src/detect.c        |    4 ++
 src/device.c        |   91 ++++++++++++++++++++++++-------------
 src/element.c       |   47 +++++++++++++++++++
 src/udev.c          |  126 +++++++++++++++++++++++++++++++++++++++++++++++++++
 13 files changed, 441 insertions(+), 32 deletions(-)

New commits:
commit 788f462b1eab20aaa15929f6a6d0f404084ee3b8
Author: Marcel Holtmann <[email protected]>
Date:   Fri Jan 2 22:45:15 2009 +0100

    Enable 3G plugins for distcheck building

commit 6d9bc499e72dd2505e1cf8310e5d58a091118ace
Author: Marcel Holtmann <[email protected]>
Date:   Fri Jan 2 22:43:55 2009 +0100

    Fix plugin name spelling mistake

commit bc97df35e6b11b4044fe827d859276deaade4a53
Author: Marcel Holtmann <[email protected]>
Date:   Fri Jan 2 22:43:18 2009 +0100

    Add plugin skeleton for Novatel devices

commit d56ce7071953aaccaa56a3e3effbd5d59838be11
Author: Marcel Holtmann <[email protected]>
Date:   Fri Jan 2 22:33:21 2009 +0100

    Add detection support for Novatel devices

commit ce65c266ed92290f8e8b7ccafe1d55a12fc3e22e
Author: Marcel Holtmann <[email protected]>
Date:   Fri Jan 2 22:32:43 2009 +0100

    Add device type for Novatel Wireless

commit fd27ef7eefdb003c1f1967020d6e6ddab9426c30
Author: Marcel Holtmann <[email protected]>
Date:   Fri Jan 2 22:20:36 2009 +0100

    Fix typo in sources list

commit 2304b24632178e1ca33d99ec7687fab58425969b
Author: Marcel Holtmann <[email protected]>
Date:   Fri Jan 2 22:18:20 2009 +0100

    Add detection support for HUAWEI devices

commit e8a00fbb2a7cd2d85d67774b2bda11641e8586b7
Author: Marcel Holtmann <[email protected]>
Date:   Fri Jan 2 22:17:14 2009 +0100

    Add plugin skeleton for HUAWEI devices

commit 5bbbce97de441f908dfdb738f8816b31153b75b4
Author: Marcel Holtmann <[email protected]>
Date:   Fri Jan 2 22:16:44 2009 +0100

    Add configure switch for HUAWEI support

commit 0a23309f85839e8cd1c65b53e8e5ff07bf588d4c
Author: Marcel Holtmann <[email protected]>
Date:   Fri Jan 2 22:15:46 2009 +0100

    Call disable and remove callbacks when unregistering a driver

commit 058b97a987c51323282c2f4f6aeebcf5a2576d83
Author: Marcel Holtmann <[email protected]>
Date:   Fri Jan 2 22:14:56 2009 +0100

    Use correct type for user data

commit 109c78bb7a0e8dd9decf1ee234d76b56a4a062d3
Author: Marcel Holtmann <[email protected]>
Date:   Fri Jan 2 22:07:17 2009 +0100

    Add generic element iteration function

commit 384763cf5951681441c1828ca20d3fc21d8553b3
Author: Marcel Holtmann <[email protected]>
Date:   Fri Jan 2 21:26:39 2009 +0100

    Add device type for HUAWEI Mobile


Diff in this email is a maximum of 400 lines.
diff --git a/Makefile.am b/Makefile.am
index 7f61d2b..12669d6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -8,6 +8,9 @@ pkgconfig_DATA = connman.pc
 DISTCHECK_CONFIGURE_FLAGS = --disable-gtk-doc \
                                --enable-loopback \
                                --enable-wifi \
+                               --enable-novatel \
+                               --enable-huawei \
+                               --enable-hso \
                                --enable-client
 
 DISTCLEANFILES = $(pkgconfig_DATA)
diff --git a/bootstrap-configure b/bootstrap-configure
index 54926b4..63bdf08 100755
--- a/bootstrap-configure
+++ b/bootstrap-configure
@@ -18,6 +18,8 @@ fi
                --sysconfdir=/etc \
                --enable-loopback \
                --enable-wifi \
+               --enable-novatel \
+               --enable-huawei \
                --enable-hso \
                --enable-ppp \
                --enable-udev \
diff --git a/configure.ac b/configure.ac
index 77197de..e6028d7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -62,13 +62,22 @@ if (test "${enable_wifi}" = "yes"); then
 fi
 AM_CONDITIONAL(WIFI, test "${enable_wifi}" = "yes")
 
+AC_ARG_ENABLE(novatel, AC_HELP_STRING([--enable-novatel],
+               [enable Novatel support]), [enable_novatel=${enableval}])
+AM_CONDITIONAL(NOVATEL, test "${enable_novatel}" = "yes")
+
+AC_ARG_ENABLE(huawei, AC_HELP_STRING([--enable-huawei],
+               [enable HUAWEI support]), [enable_huawei=${enableval}])
+AM_CONDITIONAL(HUAWEI, test "${enable_huawei}" = "yes")
+
 AC_ARG_ENABLE(hso, AC_HELP_STRING([--enable-hso],
                [enable HSO support]), [enable_hso=${enableval}])
 AM_CONDITIONAL(HSO, test "${enable_hso}" = "yes")
 
 AC_ARG_ENABLE(ppp, AC_HELP_STRING([--enable-ppp],
                [enable PPP support]), [enable_ppp=${enableval}])
-if (test "${enable_ppp}" = "yes"); then
+if (test "${enable_ppp}" = "yes" || test "${enable_novatel}" = "yes" ||
+                                       test "${enable_huawei}" = "yes"); then
        AC_PATH_PROG(PPPD, [pppd], [], $PATH:/sbin:/usr/sbin)
        AC_CHECK_HEADERS(pppd/pppd.h, enable_ppp=yes,
                        AC_MSG_ERROR(PPP development files are required))
diff --git a/include/device.h b/include/device.h
index 9487b70..fcd8cc0 100644
--- a/include/device.h
+++ b/include/device.h
@@ -42,6 +42,8 @@ enum connman_device_type {
        CONNMAN_DEVICE_TYPE_WIMAX     = 3,
        CONNMAN_DEVICE_TYPE_BLUETOOTH = 4,
        CONNMAN_DEVICE_TYPE_HSO       = 11,
+       CONNMAN_DEVICE_TYPE_HUAWEI    = 12,
+       CONNMAN_DEVICE_TYPE_NOVATEL   = 13,
        CONNMAN_DEVICE_TYPE_VENDOR    = 42,
 };
 
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 4d8815b..e737625 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -23,6 +23,18 @@ endif
 bluetooth_la_SOURCES = bluetooth.c inet.h inet.c
 bluetooth_la_LIBADD = @GDBUS_LIBS@
 
+if NOVATEL
+plugin_LTLIBRARIES += novatel.la
+
+novatel_la_SOURCES = novatel.c modem.h modem.c
+endif
+
+if HUAWEI
+plugin_LTLIBRARIES += huawei.la
+
+huawei_la_SOURCES = huawei.c modem.h modem.c
+endif
+
 if HSO
 plugin_LTLIBRARIES += hso.la
 
diff --git a/plugins/huawei.c b/plugins/huawei.c
new file mode 100644
index 0000000..2249048
--- /dev/null
+++ b/plugins/huawei.c
@@ -0,0 +1,83 @@
+/*
+ *
+ *  Connection Manager
+ *
+ *  Copyright (C) 2007-2009  Intel Corporation. All rights reserved.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#define CONNMAN_API_SUBJECT_TO_CHANGE
+#include <connman/plugin.h>
+#include <connman/device.h>
+#include <connman/log.h>
+
+#include "modem.h"
+
+static int huawei_probe(struct connman_device *device)
+{
+       DBG("device %p", device);
+
+       return 0;
+}
+
+static void huawei_remove(struct connman_device *device)
+{
+       DBG("device %p", device);
+}
+
+static int huawei_enable(struct connman_device *device)
+{
+       DBG("device %p", device);
+
+       connman_device_set_powered(device, TRUE);
+
+       return 0;
+}
+
+static int huawei_disable(struct connman_device *device)
+{
+       DBG("device %p", device);
+
+       connman_device_set_powered(device, FALSE);
+
+       return 0;
+}
+
+static struct connman_device_driver huawei_driver = {
+       .name           = "huawei-device",
+       .type           = CONNMAN_DEVICE_TYPE_HUAWEI,
+       .probe          = huawei_probe,
+       .remove         = huawei_remove,
+       .enable         = huawei_enable,
+       .disable        = huawei_disable,
+};
+
+static int huawei_init(void)
+{
+       return connman_device_driver_register(&huawei_driver);
+}
+
+static void huawei_exit(void)
+{
+       connman_device_driver_unregister(&huawei_driver);
+}
+
+CONNMAN_PLUGIN_DEFINE(huawei, "HUAWEI Mobile device plugin", VERSION,
+                                               huawei_init, huawei_exit)
diff --git a/plugins/novatel.c b/plugins/novatel.c
new file mode 100644
index 0000000..f43c5eb
--- /dev/null
+++ b/plugins/novatel.c
@@ -0,0 +1,83 @@
+/*
+ *
+ *  Connection Manager
+ *
+ *  Copyright (C) 2007-2009  Intel Corporation. All rights reserved.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#define CONNMAN_API_SUBJECT_TO_CHANGE
+#include <connman/plugin.h>
+#include <connman/device.h>
+#include <connman/log.h>
+
+#include "modem.h"
+
+static int novatel_probe(struct connman_device *device)
+{
+       DBG("device %p", device);
+
+       return 0;
+}
+
+static void novatel_remove(struct connman_device *device)
+{
+       DBG("device %p", device);
+}
+
+static int novatel_enable(struct connman_device *device)
+{
+       DBG("device %p", device);
+
+       connman_device_set_powered(device, TRUE);
+
+       return 0;
+}
+
+static int novatel_disable(struct connman_device *device)
+{
+       DBG("device %p", device);
+
+       connman_device_set_powered(device, FALSE);
+
+       return 0;
+}
+
+static struct connman_device_driver novatel_driver = {
+       .name           = "novatel-device",
+       .type           = CONNMAN_DEVICE_TYPE_NOVATEL,
+       .probe          = novatel_probe,
+       .remove         = novatel_remove,
+       .enable         = novatel_enable,
+       .disable        = novatel_disable,
+};
+
+static int novatel_init(void)
+{
+       return connman_device_driver_register(&novatel_driver);
+}
+
+static void novatel_exit(void)
+{
+       connman_device_driver_unregister(&novatel_driver);
+}
+
+CONNMAN_PLUGIN_DEFINE(novatel, "Novatel Wireless device plugin", VERSION,
+                                               novatel_init, novatel_exit)
diff --git a/src/connman.h b/src/connman.h
index 25f5085..e410ac1 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -90,6 +90,12 @@ void __connman_element_start(void);
 void __connman_element_stop(void);
 void __connman_element_cleanup(void);
 
+typedef void (* element_cb_t) (struct connman_element *element,
+                                                       gpointer user_data);
+
+void __connman_element_foreach(struct connman_element *element,
+                               enum connman_element_type type,
+                               element_cb_t callback, gpointer user_data);
 void __connman_element_list(struct connman_element *element,
                                        enum connman_element_type type,
                                                        DBusMessageIter *iter);
diff --git a/src/connman.rules b/src/connman.rules
index 3cf20e1..8a935ce 100644
--- a/src/connman.rules
+++ b/src/connman.rules
@@ -4,5 +4,8 @@ SUBSYSTEM=="net", DRIVERS=="hso", ENV{CONNMAN_TYPE}="hso"
 SUBSYSTEM=="tty", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1003", \
                                                ENV{CONNMAN_TYPE}="huawei"
 
+SUBSYSTEM=="tty", ATTRS{idVendor}=="1410", ATTRS{idProduct}=="4400", \
+                                               ENV{CONNMAN_TYPE}="novatel"
+
 ENV{CONNMAN_TYPE}=="?*", ENV{CONNMAN_INTERFACE}="$kernel", \
                                RUN+="socket:@/org/moblin/connman/udev"
diff --git a/src/detect.c b/src/detect.c
index e5f0db1..5ae9083 100644
--- a/src/detect.c
+++ b/src/detect.c
@@ -188,6 +188,8 @@ static void detect_newlink(unsigned short type, int index,
                break;
        case CONNMAN_DEVICE_TYPE_BLUETOOTH:
        case CONNMAN_DEVICE_TYPE_HSO:
+       case CONNMAN_DEVICE_TYPE_HUAWEI:
+       case CONNMAN_DEVICE_TYPE_NOVATEL:
        case CONNMAN_DEVICE_TYPE_VENDOR:
                name = strdup(devname);
                break;
@@ -203,6 +205,8 @@ static void detect_newlink(unsigned short type, int index,
        switch (devtype) {
        case CONNMAN_DEVICE_TYPE_UNKNOWN:
        case CONNMAN_DEVICE_TYPE_VENDOR:
+       case CONNMAN_DEVICE_TYPE_HUAWEI:
+       case CONNMAN_DEVICE_TYPE_NOVATEL:
                mode = CONNMAN_DEVICE_MODE_UNKNOWN;
                break;
        case CONNMAN_DEVICE_TYPE_ETHERNET:
diff --git a/src/device.c b/src/device.c
index ee4d91c..2851cb4 100644
--- a/src/device.c
+++ b/src/device.c
@@ -60,6 +60,8 @@ static const char *type2description(enum connman_device_type 
type)
        case CONNMAN_DEVICE_TYPE_BLUETOOTH:
                return "Bluetooth";
        case CONNMAN_DEVICE_TYPE_HSO:
+       case CONNMAN_DEVICE_TYPE_HUAWEI:
+       case CONNMAN_DEVICE_TYPE_NOVATEL:
                return "Cellular";
        }
 
@@ -81,6 +83,8 @@ static const char *type2string(enum connman_device_type type)
        case CONNMAN_DEVICE_TYPE_BLUETOOTH:
                return "bluetooth";
        case CONNMAN_DEVICE_TYPE_HSO:
+       case CONNMAN_DEVICE_TYPE_HUAWEI:
+       case CONNMAN_DEVICE_TYPE_NOVATEL:
                return "cellular";
        }
 
@@ -473,6 +477,37 @@ static void unregister_interface(struct connman_element 
*element)
                                                CONNMAN_DEVICE_INTERFACE);
 }
 
+static void device_enable(struct connman_device *device)
+{
+       DBG("device %p", device);
+
+       if (device->policy == CONNMAN_DEVICE_POLICY_IGNORE ||
+                               device->policy == CONNMAN_DEVICE_POLICY_OFF)
+               return;
+
+       if (device->powered == TRUE)
+               return;
+
+       if (device->driver->enable)
+               device->driver->enable(device);
+}
+
+static void device_disable(struct connman_device *device)
+{
+       DBG("device %p", device);
+
+       if (device->policy == CONNMAN_DEVICE_POLICY_IGNORE)
+               return;
+
+       if (device->powered == FALSE)
+               return;
+
+       g_hash_table_remove_all(device->networks);
+
+       if (device->driver->disable)
+               device->driver->disable(device);
+}
+
 static GSList *driver_list = NULL;
 
 static gint compare_priority(gconstpointer a, gconstpointer b)
@@ -503,6 +538,25 @@ int connman_device_driver_register(struct 
connman_device_driver *driver)
        return 0;
 }
 
+static void remove_driver(struct connman_element *element, gpointer user_data)
+{
+       struct connman_device_driver *driver = user_data;
+
+       DBG("element %p name %s", element, element->name);
+
+       if (element->device == NULL)
+               return;
+
+       if (element->device->driver == driver) {
+               device_disable(element->device);
+
+               if (driver->remove)
+                       driver->remove(element->device);
+
_______________________________________________
Commits mailing list
[email protected]
https://lists.moblin.org/mailman/listinfo/commits

Reply via email to