Add plugin skeleton for HUAWEI devices
authorMarcel Holtmann <marcel@holtmann.org>
Fri, 2 Jan 2009 21:17:14 +0000 (22:17 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 2 Jan 2009 21:17:14 +0000 (22:17 +0100)
plugins/Makefile.am
plugins/huawei.c [new file with mode: 0644]

index 4d8815b..a7db873 100644 (file)
@@ -23,6 +23,12 @@ endif
 bluetooth_la_SOURCES = bluetooth.c inet.h inet.c
 bluetooth_la_LIBADD = @GDBUS_LIBS@
 
+if HUAWEI
+plugin_LTLIBRARIES += huawei.la
+
+huawei_la_SOURCES = huawei.c modem.h modem.
+endif
+
 if HSO
 plugin_LTLIBRARIES += hso.la
 
diff --git a/plugins/huawei.c b/plugins/huawei.c
new file mode 100644 (file)
index 0000000..d0dbe49
--- /dev/null
@@ -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, "Option HUAWEI device plugin", VERSION,
+                                               huawei_init, huawei_exit)