aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/Makefile.am20
-rw-r--r--plugins/mm-modem-moto-c-gsm.c133
-rw-r--r--plugins/mm-modem-moto-c-gsm.h45
-rw-r--r--plugins/mm-plugin-moto-c.c172
-rw-r--r--plugins/mm-plugin-moto-c.h43
-rw-r--r--plugins/motorola/mm-broadband-modem-motorola.c87
-rw-r--r--plugins/motorola/mm-broadband-modem-motorola.h49
-rw-r--r--plugins/motorola/mm-plugin-motorola.c119
-rw-r--r--plugins/motorola/mm-plugin-motorola.h42
9 files changed, 307 insertions, 403 deletions
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index de085652..708d7d03 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -36,7 +36,8 @@ pkglib_LTLIBRARIES = \
libmm-plugin-cinterion.la \
libmm-plugin-iridium.la \
libmm-plugin-nokia.la \
- libmm-plugin-gobi.la
+ libmm-plugin-gobi.la \
+ libmm-plugin-motorola.la
#pkglib_LTLIBRARIES = \
# libmm-plugin-generic.la \
@@ -65,15 +66,14 @@ libmm_plugin_generic_la_SOURCES = \
libmm_plugin_generic_la_CPPFLAGS = $(PLUGIN_COMMON_COMPILER_FLAGS)
libmm_plugin_generic_la_LDFLAGS = $(PLUGIN_COMMON_LINKER_FLAGS)
-## Motorola C-series phones
-#libmm_plugin_moto_c_la_SOURCES = \
-# mm-plugin-moto-c.c \
-# mm-plugin-moto-c.h \
-# mm-modem-moto-c-gsm.c \
-# mm-modem-moto-c-gsm.h
-#libmm_plugin_moto_c_la_CPPFLAGS = $(PLUGIN_COMMON_COMPILER_FLAGS)
-#libmm_plugin_moto_c_la_LDFLAGS = $(PLUGIN_COMMON_LINKER_FLAGS)
-#
+## Motorola
+libmm_plugin_motorola_la_SOURCES = \
+ motorola/mm-plugin-motorola.c \
+ motorola/mm-plugin-motorola.h \
+ motorola/mm-broadband-modem-motorola.c \
+ motorola/mm-broadband-modem-motorola.h
+libmm_plugin_motorola_la_CPPFLAGS = $(PLUGIN_COMMON_COMPILER_FLAGS)
+libmm_plugin_motorola_la_LDFLAGS = $(PLUGIN_COMMON_LINKER_FLAGS)
# Gobi
libmm_plugin_gobi_la_SOURCES = \
diff --git a/plugins/mm-modem-moto-c-gsm.c b/plugins/mm-modem-moto-c-gsm.c
deleted file mode 100644
index cd7b4ed0..00000000
--- a/plugins/mm-modem-moto-c-gsm.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/* -*- 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 Red Hat, Inc.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "mm-modem-moto-c-gsm.h"
-#include "mm-errors.h"
-#include "mm-callback-info.h"
-#include "mm-modem-gsm-card.h"
-
-static void modem_init (MMModem *modem_class);
-static void modem_gsm_card_init (MMModemGsmCard *gsm_card_class);
-
-G_DEFINE_TYPE_EXTENDED (MMModemMotoCGsm, mm_modem_moto_c_gsm, MM_TYPE_GENERIC_GSM, 0,
- G_IMPLEMENT_INTERFACE (MM_TYPE_MODEM, modem_init)
- G_IMPLEMENT_INTERFACE (MM_TYPE_MODEM_GSM_CARD, modem_gsm_card_init))
-
-
-MMModem *
-mm_modem_moto_c_gsm_new (const char *device,
- const char *driver,
- const char *plugin,
- guint32 vendor,
- guint32 product)
-{
- g_return_val_if_fail (device != NULL, NULL);
- g_return_val_if_fail (driver != NULL, NULL);
- g_return_val_if_fail (plugin != NULL, NULL);
-
- return MM_MODEM (g_object_new (MM_TYPE_MODEM_MOTO_C_GSM,
- MM_MODEM_MASTER_DEVICE, device,
- MM_MODEM_DRIVER, driver,
- MM_MODEM_PLUGIN, plugin,
- MM_MODEM_HW_VID, vendor,
- MM_MODEM_HW_PID, product,
- NULL));
-}
-
-/*****************************************************************************/
-
-static void
-modem_init (MMModem *modem_class)
-{
-}
-
-/*****************************************************************************/
-
-static void
-get_imei (MMModemGsmCard *modem,
- MMModemStringFn callback,
- gpointer user_data)
-{
- MMCallbackInfo *info;
-
- info = mm_callback_info_string_new (MM_MODEM (modem), callback, user_data);
- info->error = g_error_new_literal (MM_MODEM_ERROR, MM_MODEM_ERROR_OPERATION_NOT_SUPPORTED,
- "Operation not supported");
- mm_callback_info_schedule (info);
-}
-
-static void
-modem_gsm_card_init (MMModemGsmCard *class)
-{
- class->get_imei = get_imei;
-}
-
-/*****************************************************************************/
-
-static void
-mm_modem_moto_c_gsm_init (MMModemMotoCGsm *self)
-{
-}
-
-static void
-get_property (GObject *object, guint prop_id,
- GValue *value, GParamSpec *pspec)
-{
-
- /* These devices just don't implement AT+CFUN */
-
- switch (prop_id) {
- case MM_GENERIC_GSM_PROP_POWER_UP_CMD:
- g_value_set_string (value, "");
- break;
- case MM_GENERIC_GSM_PROP_POWER_DOWN_CMD:
- g_value_set_string (value, "");
- break;
- default:
- break;
- }
-}
-
-static void
-set_property (GObject *object, guint prop_id,
- const GValue *value, GParamSpec *pspec)
-{
-}
-
-static void
-mm_modem_moto_c_gsm_class_init (MMModemMotoCGsmClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- mm_modem_moto_c_gsm_parent_class = g_type_class_peek_parent (klass);
-
- object_class->get_property = get_property;
- object_class->set_property = set_property;
-
- g_object_class_override_property (object_class,
- MM_GENERIC_GSM_PROP_POWER_UP_CMD,
- MM_GENERIC_GSM_POWER_UP_CMD);
-
- g_object_class_override_property (object_class,
- MM_GENERIC_GSM_PROP_POWER_DOWN_CMD,
- MM_GENERIC_GSM_POWER_DOWN_CMD);
-}
-
diff --git a/plugins/mm-modem-moto-c-gsm.h b/plugins/mm-modem-moto-c-gsm.h
deleted file mode 100644
index a8ddd6df..00000000
--- a/plugins/mm-modem-moto-c-gsm.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- 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 Red Hat, Inc.
- */
-
-#ifndef MM_MODEM_MOTO_C_GSM_H
-#define MM_MODEM_MOTO_C_GSM_H
-
-#include "mm-generic-gsm.h"
-
-#define MM_TYPE_MODEM_MOTO_C_GSM (mm_modem_moto_c_gsm_get_type ())
-#define MM_MODEM_MOTO_C_GSM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_MODEM_MOTO_C_GSM, MMModemMotoCGsm))
-#define MM_MODEM_MOTO_C_GSM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_MODEM_MOTO_C_GSM, MMModemMotoCGsmClass))
-#define MM_IS_MODEM_MOTO_C_GSM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_MODEM_MOTO_C_GSM))
-#define MM_IS_MODEM_MOTO_C_GSM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_MODEM_MOTO_C_GSM))
-#define MM_MODEM_MOTO_C_GSM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_MODEM_MOTO_C_GSM, MMModemMotoCGsmClass))
-
-typedef struct {
- MMGenericGsm parent;
-} MMModemMotoCGsm;
-
-typedef struct {
- MMGenericGsmClass parent;
-} MMModemMotoCGsmClass;
-
-GType mm_modem_moto_c_gsm_get_type (void);
-
-MMModem *mm_modem_moto_c_gsm_new (const char *device,
- const char *driver,
- const char *plugin_name,
- guint32 vendor,
- guint32 product);
-
-#endif /* MM_MODEM_MOTO_C_GSM_H */
diff --git a/plugins/mm-plugin-moto-c.c b/plugins/mm-plugin-moto-c.c
deleted file mode 100644
index e8cfe0e3..00000000
--- a/plugins/mm-plugin-moto-c.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/* -*- 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 Red Hat, Inc.
- */
-
-#include <string.h>
-#include <gmodule.h>
-#define G_UDEV_API_IS_SUBJECT_TO_CHANGE
-#include <gudev/gudev.h>
-
-#include "mm-plugin-moto-c.h"
-#include "mm-modem-moto-c-gsm.h"
-
-G_DEFINE_TYPE (MMPluginMotoC, mm_plugin_moto_c, MM_TYPE_PLUGIN_BASE)
-
-int mm_plugin_major_version = MM_PLUGIN_MAJOR_VERSION;
-int mm_plugin_minor_version = MM_PLUGIN_MINOR_VERSION;
-
-G_MODULE_EXPORT MMPlugin *
-mm_plugin_create (void)
-{
- return MM_PLUGIN (g_object_new (MM_TYPE_PLUGIN_MOTO_C,
- MM_PLUGIN_BASE_NAME, "MotoC",
- NULL));
-}
-
-/*****************************************************************************/
-
-static guint32
-get_level_for_capabilities (guint32 capabilities)
-{
- if (capabilities & MM_PLUGIN_BASE_PORT_CAP_GSM)
- return 10;
- return 0;
-}
-
-static void
-probe_result (MMPluginBase *base,
- MMPluginBaseSupportsTask *task,
- guint32 capabilities,
- gpointer user_data)
-{
- mm_plugin_base_supports_task_complete (task, get_level_for_capabilities (capabilities));
-}
-
-static MMPluginSupportsResult
-supports_port (MMPluginBase *base,
- MMModem *existing,
- MMPluginBaseSupportsTask *task)
-{
- GUdevDevice *port;
- const char *tmp;
-
- /* Can't do anything with non-serial ports */
- port = mm_plugin_base_supports_task_get_port (task);
- if (strcmp (g_udev_device_get_subsystem (port), "tty"))
- return MM_PLUGIN_SUPPORTS_PORT_UNSUPPORTED;
-
- tmp = g_udev_device_get_property (port, "ID_BUS");
- if (!tmp || strcmp (tmp, "usb"))
- return MM_PLUGIN_SUPPORTS_PORT_UNSUPPORTED;
-
- tmp = g_udev_device_get_property (port, "ID_VENDOR_ID");
- if (!tmp || strcmp (tmp, "22b8"))
- return MM_PLUGIN_SUPPORTS_PORT_UNSUPPORTED;
-
- tmp = g_udev_device_get_property (port, "ID_MODEL_ID");
- if (!tmp || (strcmp (tmp, "3802") && strcmp (tmp, "4902")))
- return MM_PLUGIN_SUPPORTS_PORT_UNSUPPORTED;
-
- /* Check if a previous probing was already launched in this port */
- if (mm_plugin_base_supports_task_propagate_cached (task)) {
- guint32 level;
-
- /* A previous probing was already done, use its results */
- level = get_level_for_capabilities (mm_plugin_base_supports_task_get_probed_capabilities (task));
- if (level) {
- mm_plugin_base_supports_task_complete (task, level);
- return MM_PLUGIN_SUPPORTS_PORT_IN_PROGRESS;
- }
- return MM_PLUGIN_SUPPORTS_PORT_UNSUPPORTED;
- }
-
- /* Otherwise kick off a probe */
- if (mm_plugin_base_probe_port (base, task, 100000, NULL))
- return MM_PLUGIN_SUPPORTS_PORT_IN_PROGRESS;
-
- return MM_PLUGIN_SUPPORTS_PORT_UNSUPPORTED;
-}
-
-static MMModem *
-grab_port (MMPluginBase *base,
- MMModem *existing,
- MMPluginBaseSupportsTask *task,
- GError **error)
-{
- GUdevDevice *port = NULL;
- MMModem *modem = NULL;
- const char *name, *subsys, *devfile, *sysfs_path;
- guint16 vendor = 0, product = 0;
- guint32 caps;
- MMPortType ptype;
-
- port = mm_plugin_base_supports_task_get_port (task);
- g_assert (port);
-
- devfile = g_udev_device_get_device_file (port);
- if (!devfile) {
- g_set_error (error, 0, 0, "Could not get port's sysfs file.");
- return NULL;
- }
-
- subsys = g_udev_device_get_subsystem (port);
- name = g_udev_device_get_name (port);
-
- if (!mm_plugin_base_get_device_ids (base, subsys, name, &vendor, &product)) {
- g_set_error (error, 0, 0, "Could not get modem product ID.");
- return NULL;
- }
-
- caps = mm_plugin_base_supports_task_get_probed_capabilities (task);
- ptype = mm_plugin_base_probed_capabilities_to_port_type (caps);
- sysfs_path = mm_plugin_base_supports_task_get_physdev_path (task);
- if (!existing) {
- modem = mm_modem_moto_c_gsm_new (sysfs_path,
- mm_plugin_base_supports_task_get_driver (task),
- mm_plugin_get_name (MM_PLUGIN (base)),
- vendor,
- product);
-
- if (modem) {
- if (!mm_modem_grab_port (modem, subsys, name, ptype, MM_AT_PORT_FLAG_NONE, NULL, error)) {
- g_object_unref (modem);
- return NULL;
- }
- }
- } else {
- modem = existing;
- if (!mm_modem_grab_port (modem, subsys, name, ptype, MM_AT_PORT_FLAG_NONE, NULL, error))
- return NULL;
- }
-
- return modem;
-}
-
-/*****************************************************************************/
-
-static void
-mm_plugin_moto_c_init (MMPluginMotoC *self)
-{
- g_signal_connect (self, "probe-result", G_CALLBACK (probe_result), NULL);
-}
-
-static void
-mm_plugin_moto_c_class_init (MMPluginMotoCClass *klass)
-{
- MMPluginBaseClass *pb_class = MM_PLUGIN_BASE_CLASS (klass);
-
- pb_class->supports_port = supports_port;
- pb_class->grab_port = grab_port;
-}
diff --git a/plugins/mm-plugin-moto-c.h b/plugins/mm-plugin-moto-c.h
deleted file mode 100644
index 8583607b..00000000
--- a/plugins/mm-plugin-moto-c.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* -*- 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 Red Hat, Inc.
- */
-
-#ifndef MM_PLUGIN_MOTO_C_H
-#define MM_PLUGIN_MOTO_C_H
-
-#include "mm-plugin.h"
-#include "mm-plugin-base.h"
-#include "mm-generic-gsm.h"
-
-#define MM_TYPE_PLUGIN_MOTO_C (mm_plugin_moto_c_get_type ())
-#define MM_PLUGIN_MOTO_C(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_PLUGIN_MOTO_C, MMPluginMotoC))
-#define MM_PLUGIN_MOTO_C_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_PLUGIN_MOTO_C, MMPluginMotoCClass))
-#define MM_IS_PLUGIN_MOTO_C(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_PLUGIN_MOTO_C))
-#define MM_IS_PLUGIN_MOTO_C_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_PLUGIN_MOTO_C))
-#define MM_PLUGIN_MOTO_C_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_PLUGIN_MOTO_C, MMPluginMotoCClass))
-
-typedef struct {
- MMPluginBase parent;
-} MMPluginMotoC;
-
-typedef struct {
- MMPluginBaseClass parent;
-} MMPluginMotoCClass;
-
-GType mm_plugin_moto_c_get_type (void);
-
-G_MODULE_EXPORT MMPlugin *mm_plugin_create (void);
-
-#endif /* MM_PLUGIN_MOTO_C_H */
diff --git a/plugins/motorola/mm-broadband-modem-motorola.c b/plugins/motorola/mm-broadband-modem-motorola.c
new file mode 100644
index 00000000..78aebc1b
--- /dev/null
+++ b/plugins/motorola/mm-broadband-modem-motorola.c
@@ -0,0 +1,87 @@
+/* -*- 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 - 2011 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-iface-modem.h"
+#include "mm-iface-modem-3gpp.h"
+#include "mm-broadband-modem-motorola.h"
+
+static void iface_modem_init (MMIfaceModem *iface);
+static void iface_modem_3gpp_init (MMIfaceModem3gpp *iface);
+
+G_DEFINE_TYPE_EXTENDED (MMBroadbandModemMotorola, mm_broadband_modem_motorola, MM_TYPE_BROADBAND_MODEM, 0,
+ G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM, iface_modem_init)
+ G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_3GPP, iface_modem_3gpp_init));
+
+/*****************************************************************************/
+
+MMBroadbandModemMotorola *
+mm_broadband_modem_motorola_new (const gchar *device,
+ const gchar *driver,
+ const gchar *plugin,
+ guint16 vendor_id,
+ guint16 product_id)
+{
+ return g_object_new (MM_TYPE_BROADBAND_MODEM_MOTOROLA,
+ 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_motorola_init (MMBroadbandModemMotorola *self)
+{
+}
+
+static void
+iface_modem_3gpp_init (MMIfaceModem3gpp *iface)
+{
+ /* Loading IMEI not supported */
+ iface->load_imei = NULL;
+ iface->load_imei_finish = NULL;
+}
+
+static void
+iface_modem_init (MMIfaceModem *iface)
+{
+ /* Loading IMEI with +CGSN is not supported, just assume we cannot load
+ * equipment ID */
+ iface->load_equipment_identifier = NULL;
+ iface->load_equipment_identifier_finish = NULL;
+
+ /* These devices just don't implement AT+CFUN */
+ iface->modem_power_up = NULL;
+ iface->modem_power_up_finish = NULL;
+ iface->modem_power_down = NULL;
+ iface->modem_power_down_finish = NULL;
+}
+
+static void
+mm_broadband_modem_motorola_class_init (MMBroadbandModemMotorolaClass *klass)
+{
+}
diff --git a/plugins/motorola/mm-broadband-modem-motorola.h b/plugins/motorola/mm-broadband-modem-motorola.h
new file mode 100644
index 00000000..fb8d3249
--- /dev/null
+++ b/plugins/motorola/mm-broadband-modem-motorola.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_MOTOROLA_H
+#define MM_BROADBAND_MODEM_MOTOROLA_H
+
+#include "mm-broadband-modem.h"
+
+#define MM_TYPE_BROADBAND_MODEM_MOTOROLA (mm_broadband_modem_motorola_get_type ())
+#define MM_BROADBAND_MODEM_MOTOROLA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_BROADBAND_MODEM_MOTOROLA, MMBroadbandModemMotorola))
+#define MM_BROADBAND_MODEM_MOTOROLA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_BROADBAND_MODEM_MOTOROLA, MMBroadbandModemMotorolaClass))
+#define MM_IS_BROADBAND_MODEM_MOTOROLA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_BROADBAND_MODEM_MOTOROLA))
+#define MM_IS_BROADBAND_MODEM_MOTOROLA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_BROADBAND_MODEM_MOTOROLA))
+#define MM_BROADBAND_MODEM_MOTOROLA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_BROADBAND_MODEM_MOTOROLA, MMBroadbandModemMotorolaClass))
+
+typedef struct _MMBroadbandModemMotorola MMBroadbandModemMotorola;
+typedef struct _MMBroadbandModemMotorolaClass MMBroadbandModemMotorolaClass;
+
+struct _MMBroadbandModemMotorola {
+ MMBroadbandModem parent;
+};
+
+struct _MMBroadbandModemMotorolaClass{
+ MMBroadbandModemClass parent;
+};
+
+GType mm_broadband_modem_motorola_get_type (void);
+
+MMBroadbandModemMotorola *mm_broadband_modem_motorola_new (const gchar *device,
+ const gchar *driver,
+ const gchar *plugin,
+ guint16 vendor_id,
+ guint16 product_id);
+
+#endif /* MM_BROADBAND_MODEM_MOTOROLA_H */
diff --git a/plugins/motorola/mm-plugin-motorola.c b/plugins/motorola/mm-plugin-motorola.c
new file mode 100644
index 00000000..4a35d34c
--- /dev/null
+++ b/plugins/motorola/mm-plugin-motorola.c
@@ -0,0 +1,119 @@
+/* -*- 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 <string.h>
+#include <gmodule.h>
+
+#include <mm-errors-types.h>
+
+#include "mm-private-boxed-types.h"
+#include "mm-plugin-motorola.h"
+#include "mm-broadband-modem-motorola.h"
+
+G_DEFINE_TYPE (MMPluginMotorola, mm_plugin_motorola, MM_TYPE_PLUGIN_BASE)
+
+int mm_plugin_major_version = MM_PLUGIN_MAJOR_VERSION;
+int mm_plugin_minor_version = MM_PLUGIN_MINOR_VERSION;
+
+/*****************************************************************************/
+
+static MMBaseModem *
+grab_port (MMPluginBase *base,
+ MMBaseModem *existing,
+ MMPortProbe *probe,
+ GError **error)
+{
+ MMBaseModem *modem = NULL;
+ const gchar *name, *subsys;
+ guint16 vendor = 0, product = 0;
+
+ /* The Motorola plugin cannot do anything with non-AT ports */
+ if (!mm_port_probe_is_at (probe)) {
+ g_set_error_literal (error,
+ MM_CORE_ERROR,
+ MM_CORE_ERROR_UNSUPPORTED,
+ "Ignoring non-AT port");
+ return NULL;
+ }
+
+ subsys = mm_port_probe_get_port_subsys (probe);
+ name = mm_port_probe_get_port_name (probe);
+
+ if (!mm_plugin_base_get_device_ids (base, subsys, name, &vendor, &product)) {
+ g_set_error_literal (error,
+ MM_CORE_ERROR,
+ MM_CORE_ERROR_FAILED,
+ "Could not get modem product ID");
+ return NULL;
+ }
+
+ /* If this is the first port being grabbed, create a new modem object */
+ if (!existing)
+ modem = MM_BASE_MODEM (mm_broadband_modem_motorola_new (
+ mm_port_probe_get_port_physdev (probe),
+ mm_port_probe_get_port_driver (probe),
+ mm_plugin_get_name (MM_PLUGIN (base)),
+ vendor,
+ product));
+
+ if (!mm_base_modem_grab_port (existing ? existing : modem,
+ subsys,
+ name,
+ MM_PORT_TYPE_AT, /* we only allow AT ports here */
+ MM_AT_PORT_FLAG_NONE,
+ error)) {
+ if (modem)
+ g_object_unref (modem);
+ return NULL;
+ }
+
+ return existing ? existing : modem;
+}
+
+/*****************************************************************************/
+
+G_MODULE_EXPORT MMPlugin *
+mm_plugin_create (void)
+{
+ static const gchar *subsystems[] = { "tty", NULL };
+ static const mm_uint16_pair product_ids[] = {
+ { 0x22b8, 0x3802 }, /* C330/C350L/C450/EZX GSM Phone */
+ { 0x22b8, 0x4902 }, /* Triplet GSM Phone */
+ { 0, 0 }
+ };
+
+ return MM_PLUGIN (
+ g_object_new (MM_TYPE_PLUGIN_MOTOROLA,
+ MM_PLUGIN_BASE_NAME, "Motorola",
+ MM_PLUGIN_BASE_ALLOWED_SUBSYSTEMS, subsystems,
+ MM_PLUGIN_BASE_ALLOWED_PRODUCT_IDS, product_ids,
+ MM_PLUGIN_BASE_ALLOWED_AT, TRUE,
+ NULL));
+}
+
+static void
+mm_plugin_motorola_init (MMPluginMotorola *self)
+{
+}
+
+static void
+mm_plugin_motorola_class_init (MMPluginMotorolaClass *klass)
+{
+ MMPluginBaseClass *pb_class = MM_PLUGIN_BASE_CLASS (klass);
+
+ pb_class->grab_port = grab_port;
+}
diff --git a/plugins/motorola/mm-plugin-motorola.h b/plugins/motorola/mm-plugin-motorola.h
new file mode 100644
index 00000000..432a0c4d
--- /dev/null
+++ b/plugins/motorola/mm-plugin-motorola.h
@@ -0,0 +1,42 @@
+/* -*- 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_PLUGIN_MOTOROLA_H
+#define MM_PLUGIN_MOTOROLA_H
+
+#include "mm-plugin-base.h"
+
+#define MM_TYPE_PLUGIN_MOTOROLA (mm_plugin_motorola_get_type ())
+#define MM_PLUGIN_MOTOROLA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_PLUGIN_MOTOROLA, MMPluginMotorola))
+#define MM_PLUGIN_MOTOROLA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_PLUGIN_MOTOROLA, MMPluginMotorolaClass))
+#define MM_IS_PLUGIN_MOTOROLA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_PLUGIN_MOTOROLA))
+#define MM_IS_PLUGIN_MOTOROLA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_PLUGIN_MOTOROLA))
+#define MM_PLUGIN_MOTOROLA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_PLUGIN_MOTOROLA, MMPluginMotorolaClass))
+
+typedef struct {
+ MMPluginBase parent;
+} MMPluginMotorola;
+
+typedef struct {
+ MMPluginBaseClass parent;
+} MMPluginMotorolaClass;
+
+GType mm_plugin_motorola_get_type (void);
+
+G_MODULE_EXPORT MMPlugin *mm_plugin_create (void);
+
+#endif /* MM_PLUGIN_MOTOROLA_H */