aboutsummaryrefslogtreecommitdiff
path: root/plugins/zte
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-07-21 23:34:57 +0200
committerAleksander Morgado <aleksander@lanedo.com>2012-08-06 20:07:49 +0200
commit4cf4a98bba3a94efb49fea86636e13db017a351c (patch)
tree35e8c37990eafac47eba73509c4a21a4eddac830 /plugins/zte
parent855c0ec5143d3a48c3f8a5cba0eb58d74a45740c (diff)
zte: support Icera-based modems
We request Icera support check during port probing, and we then decide which modem object to create based on the check results.
Diffstat (limited to 'plugins/zte')
-rw-r--r--plugins/zte/mm-broadband-modem-zte-icera.c60
-rw-r--r--plugins/zte/mm-broadband-modem-zte-icera.h49
-rw-r--r--plugins/zte/mm-plugin-zte.c17
3 files changed, 126 insertions, 0 deletions
diff --git a/plugins/zte/mm-broadband-modem-zte-icera.c b/plugins/zte/mm-broadband-modem-zte-icera.c
new file mode 100644
index 00000000..56f44f47
--- /dev/null
+++ b/plugins/zte/mm-broadband-modem-zte-icera.c
@@ -0,0 +1,60 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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:
+ *
+ * Copyright (C) 2008 - 2009 Novell, Inc.
+ * Copyright (C) 2009 - 2012 Red Hat, Inc.
+ * Copyright (C) 2012 Aleksander Morgado <aleksander@gnu.org>
+ */
+
+#include <config.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <ctype.h>
+
+#include "ModemManager.h"
+#include "mm-base-modem-at.h"
+#include "mm-broadband-modem-zte-icera.h"
+#include "mm-modem-helpers.h"
+#include "mm-log.h"
+
+G_DEFINE_TYPE (MMBroadbandModemZteIcera, mm_broadband_modem_zte_icera, MM_TYPE_BROADBAND_MODEM_ICERA);
+
+/*****************************************************************************/
+
+MMBroadbandModemZteIcera *
+mm_broadband_modem_zte_icera_new (const gchar *device,
+ const gchar *driver,
+ const gchar *plugin,
+ guint16 vendor_id,
+ guint16 product_id)
+{
+ return g_object_new (MM_TYPE_BROADBAND_MODEM_ZTE_ICERA,
+ MM_BASE_MODEM_DEVICE, device,
+ MM_BASE_MODEM_DRIVER, driver,
+ MM_BASE_MODEM_PLUGIN, plugin,
+ MM_BASE_MODEM_VENDOR_ID, vendor_id,
+ MM_BASE_MODEM_PRODUCT_ID, product_id,
+ NULL);
+}
+
+static void
+mm_broadband_modem_zte_icera_init (MMBroadbandModemZteIcera *self)
+{
+}
+
+static void
+mm_broadband_modem_zte_icera_class_init (MMBroadbandModemZteIceraClass *klass)
+{
+}
diff --git a/plugins/zte/mm-broadband-modem-zte-icera.h b/plugins/zte/mm-broadband-modem-zte-icera.h
new file mode 100644
index 00000000..dd3a7381
--- /dev/null
+++ b/plugins/zte/mm-broadband-modem-zte-icera.h
@@ -0,0 +1,49 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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:
+ *
+ * Copyright (C) 2008 - 2009 Novell, Inc.
+ * Copyright (C) 2009 - 2012 Red Hat, Inc.
+ * Copyright (C) 2012 Aleksander Morgado <aleksander@gnu.org>
+ */
+
+#ifndef MM_BROADBAND_MODEM_ZTE_ICERA_H
+#define MM_BROADBAND_MODEM_ZTE_ICERA_H
+
+#include "mm-broadband-modem-icera.h"
+
+#define MM_TYPE_BROADBAND_MODEM_ZTE_ICERA (mm_broadband_modem_zte_icera_get_type ())
+#define MM_BROADBAND_MODEM_ZTE_ICERA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_BROADBAND_MODEM_ZTE_ICERA, MMBroadbandModemZteIcera))
+#define MM_BROADBAND_MODEM_ZTE_ICERA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_BROADBAND_MODEM_ZTE_ICERA_AIRLINK, MMBroadbandModemZteIceraClass))
+#define MM_IS_BROADBAND_MODEM_ZTE_ICERA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_BROADBAND_MODEM_ZTE_ICERA_AIRLINK))
+#define MM_IS_BROADBAND_MODEM_ZTE_ICERA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_BROADBAND_MODEM_ZTE_ICERA_AIRLINK))
+#define MM_BROADBAND_MODEM_ZTE_ICERA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_BROADBAND_MODEM_ZTE_ICERA_AIRLINK, MMBroadbandModemZteIceraClass))
+
+typedef struct _MMBroadbandModemZteIcera MMBroadbandModemZteIcera;
+typedef struct _MMBroadbandModemZteIceraClass MMBroadbandModemZteIceraClass;
+
+struct _MMBroadbandModemZteIcera {
+ MMBroadbandModemIcera parent;
+};
+
+struct _MMBroadbandModemZteIceraClass{
+ MMBroadbandModemIceraClass parent;
+};
+
+GType mm_broadband_modem_zte_icera_get_type (void);
+
+MMBroadbandModemZteIcera *mm_broadband_modem_zte_icera_new (const gchar *device,
+ const gchar *driver,
+ const gchar *plugin,
+ guint16 vendor_id,
+ guint16 product_id);
+
+#endif /* MM_BROADBAND_MODEM_ZTE_ICERA_H */
diff --git a/plugins/zte/mm-plugin-zte.c b/plugins/zte/mm-plugin-zte.c
index 1dd06fbc..0c331764 100644
--- a/plugins/zte/mm-plugin-zte.c
+++ b/plugins/zte/mm-plugin-zte.c
@@ -23,6 +23,7 @@
#include "mm-log.h"
#include "mm-plugin-zte.h"
#include "mm-broadband-modem-zte.h"
+#include "mm-broadband-modem-zte-icera.h"
G_DEFINE_TYPE (MMPluginZte, mm_plugin_zte, MM_TYPE_PLUGIN)
@@ -58,6 +59,21 @@ create_modem (MMPlugin *self,
GList *probes,
GError **error)
{
+ GList *l;
+ gboolean is_icera;
+
+ for (l = probes, is_icera = FALSE; l && !is_icera; l = g_list_next (l)) {
+ if (mm_port_probe_is_icera (MM_PORT_PROBE (l->data)))
+ is_icera = TRUE;
+ }
+
+ if (is_icera)
+ return MM_BASE_MODEM (mm_broadband_modem_zte_icera_new (sysfs_path,
+ driver,
+ mm_plugin_get_name (self),
+ vendor,
+ product));
+
return MM_BASE_MODEM (mm_broadband_modem_zte_new (sysfs_path,
driver,
mm_plugin_get_name (self),
@@ -108,6 +124,7 @@ mm_plugin_create (void)
MM_PLUGIN_CUSTOM_AT_PROBE, custom_at_probe,
MM_PLUGIN_ALLOWED_AT, TRUE,
MM_PLUGIN_ALLOWED_QCDM, TRUE,
+ MM_PLUGIN_ICERA_PROBE, TRUE,
NULL));
}