aboutsummaryrefslogtreecommitdiff
path: root/plugins/pantech
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pantech')
-rw-r--r--plugins/pantech/mm-broadband-modem-pantech.c187
-rw-r--r--plugins/pantech/mm-broadband-modem-pantech.h47
-rw-r--r--plugins/pantech/mm-plugin-pantech.c161
-rw-r--r--plugins/pantech/mm-plugin-pantech.h40
-rw-r--r--plugins/pantech/mm-sim-pantech.c87
-rw-r--r--plugins/pantech/mm-sim-pantech.h51
6 files changed, 0 insertions, 573 deletions
diff --git a/plugins/pantech/mm-broadband-modem-pantech.c b/plugins/pantech/mm-broadband-modem-pantech.c
deleted file mode 100644
index 4e8b58e0..00000000
--- a/plugins/pantech/mm-broadband-modem-pantech.c
+++ /dev/null
@@ -1,187 +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) 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-messaging.h"
-#include "mm-errors-types.h"
-#include "mm-broadband-modem-pantech.h"
-#include "mm-sim-pantech.h"
-
-static void iface_modem_init (MMIfaceModem *iface);
-static void iface_modem_messaging_init (MMIfaceModemMessaging *iface);
-
-static MMIfaceModemMessaging *iface_modem_messaging_parent;
-
-G_DEFINE_TYPE_EXTENDED (MMBroadbandModemPantech, mm_broadband_modem_pantech, MM_TYPE_BROADBAND_MODEM, 0,
- G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM, iface_modem_init)
- G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_MESSAGING, iface_modem_messaging_init))
-
-/*****************************************************************************/
-/* Load supported SMS storages (Messaging interface) */
-
-static void
-skip_sm_sr_storage (GArray *mem)
-{
- guint i = mem->len;
-
- if (!mem)
- return;
-
- /* Remove SM and SR from the list of supported storages */
- while (i-- > 0) {
- if (g_array_index (mem, MMSmsStorage, i) == MM_SMS_STORAGE_SR ||
- g_array_index (mem, MMSmsStorage, i) == MM_SMS_STORAGE_SM)
- g_array_remove_index (mem, i);
- }
-}
-
-static gboolean
-load_supported_storages_finish (MMIfaceModemMessaging *self,
- GAsyncResult *res,
- GArray **mem1,
- GArray **mem2,
- GArray **mem3,
- GError **error)
-{
- if (!iface_modem_messaging_parent->load_supported_storages_finish (self, res, mem1, mem2, mem3, error))
- return FALSE;
-
- skip_sm_sr_storage (*mem1);
- skip_sm_sr_storage (*mem2);
- skip_sm_sr_storage (*mem3);
- return TRUE;
-}
-
-static void
-load_supported_storages (MMIfaceModemMessaging *self,
- GAsyncReadyCallback callback,
- gpointer user_data)
-{
- /* Chain up parent's loading */
- iface_modem_messaging_parent->load_supported_storages (self, callback, user_data);
-}
-
-/*****************************************************************************/
-/* Create SIM (Modem interface) */
-
-static MMBaseSim *
-create_sim_finish (MMIfaceModem *self,
- GAsyncResult *res,
- GError **error)
-{
- return mm_sim_pantech_new_finish (res, error);
-}
-
-static void
-create_sim (MMIfaceModem *self,
- GAsyncReadyCallback callback,
- gpointer user_data)
-{
- /* New Pantech SIM */
- mm_sim_pantech_new (MM_BASE_MODEM (self),
- NULL, /* cancellable */
- callback,
- user_data);
-}
-
-/*****************************************************************************/
-/* After SIM unlock (Modem interface) */
-
-static gboolean
-modem_after_sim_unlock_finish (MMIfaceModem *self,
- GAsyncResult *res,
- GError **error)
-{
- return g_task_propagate_boolean (G_TASK (res), error);
-}
-
-static gboolean
-after_sim_unlock_wait_cb (GTask *task)
-{
- g_task_return_boolean (task, TRUE);
- g_object_unref (task);
- return G_SOURCE_REMOVE;
-}
-
-static void
-modem_after_sim_unlock (MMIfaceModem *self,
- GAsyncReadyCallback callback,
- gpointer user_data)
-{
- /* wait so sim pin is done */
- g_timeout_add_seconds (5,
- (GSourceFunc)after_sim_unlock_wait_cb,
- g_task_new (self, NULL, callback, user_data));
-}
-
-/*****************************************************************************/
-
-MMBroadbandModemPantech *
-mm_broadband_modem_pantech_new (const gchar *device,
- const gchar **drivers,
- const gchar *plugin,
- guint16 vendor_id,
- guint16 product_id)
-{
- return g_object_new (MM_TYPE_BROADBAND_MODEM_PANTECH,
- MM_BASE_MODEM_DEVICE, device,
- MM_BASE_MODEM_DRIVERS, drivers,
- MM_BASE_MODEM_PLUGIN, plugin,
- MM_BASE_MODEM_VENDOR_ID, vendor_id,
- MM_BASE_MODEM_PRODUCT_ID, product_id,
- /* Generic bearer supports TTY only */
- MM_BASE_MODEM_DATA_NET_SUPPORTED, FALSE,
- MM_BASE_MODEM_DATA_TTY_SUPPORTED, TRUE,
- NULL);
-}
-
-static void
-mm_broadband_modem_pantech_init (MMBroadbandModemPantech *self)
-{
-}
-
-static void
-iface_modem_init (MMIfaceModem *iface)
-{
- /* Create Pantech-specific SIM */
- iface->create_sim = create_sim;
- iface->create_sim_finish = create_sim_finish;
-
- iface->modem_after_sim_unlock = modem_after_sim_unlock;
- iface->modem_after_sim_unlock_finish = modem_after_sim_unlock_finish;
-}
-
-static void
-iface_modem_messaging_init (MMIfaceModemMessaging *iface)
-{
- iface_modem_messaging_parent = g_type_interface_peek_parent (iface);
-
- iface->load_supported_storages = load_supported_storages;
- iface->load_supported_storages_finish = load_supported_storages_finish;
-}
-
-static void
-mm_broadband_modem_pantech_class_init (MMBroadbandModemPantechClass *klass)
-{
-}
diff --git a/plugins/pantech/mm-broadband-modem-pantech.h b/plugins/pantech/mm-broadband-modem-pantech.h
deleted file mode 100644
index 4a0a3a27..00000000
--- a/plugins/pantech/mm-broadband-modem-pantech.h
+++ /dev/null
@@ -1,47 +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) 2012 Aleksander Morgado <aleksander@gnu.org>
- */
-
-#ifndef MM_BROADBAND_MODEM_PANTECH_H
-#define MM_BROADBAND_MODEM_PANTECH_H
-
-#include "mm-broadband-modem.h"
-
-#define MM_TYPE_BROADBAND_MODEM_PANTECH (mm_broadband_modem_pantech_get_type ())
-#define MM_BROADBAND_MODEM_PANTECH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_BROADBAND_MODEM_PANTECH, MMBroadbandModemPantech))
-#define MM_BROADBAND_MODEM_PANTECH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_BROADBAND_MODEM_PANTECH, MMBroadbandModemPantechClass))
-#define MM_IS_BROADBAND_MODEM_PANTECH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_BROADBAND_MODEM_PANTECH))
-#define MM_IS_BROADBAND_MODEM_PANTECH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_BROADBAND_MODEM_PANTECH))
-#define MM_BROADBAND_MODEM_PANTECH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_BROADBAND_MODEM_PANTECH, MMBroadbandModemPantechClass))
-
-typedef struct _MMBroadbandModemPantech MMBroadbandModemPantech;
-typedef struct _MMBroadbandModemPantechClass MMBroadbandModemPantechClass;
-
-struct _MMBroadbandModemPantech {
- MMBroadbandModem parent;
-};
-
-struct _MMBroadbandModemPantechClass{
- MMBroadbandModemClass parent;
-};
-
-GType mm_broadband_modem_pantech_get_type (void);
-
-MMBroadbandModemPantech *mm_broadband_modem_pantech_new (const gchar *device,
- const gchar **drivers,
- const gchar *plugin,
- guint16 vendor_id,
- guint16 product_id);
-
-#endif /* MM_BROADBAND_MODEM_PANTECH_H */
diff --git a/plugins/pantech/mm-plugin-pantech.c b/plugins/pantech/mm-plugin-pantech.c
deleted file mode 100644
index 4af1955b..00000000
--- a/plugins/pantech/mm-plugin-pantech.c
+++ /dev/null
@@ -1,161 +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) 2012 Aleksander Morgado <aleksander@gnu.org>
- */
-
-#include <string.h>
-#include <gmodule.h>
-
-#define _LIBMM_INSIDE_MM
-#include <libmm-glib.h>
-
-#include "mm-log-object.h"
-#include "mm-plugin-pantech.h"
-#include "mm-broadband-modem-pantech.h"
-
-#if defined WITH_QMI
-#include "mm-broadband-modem-qmi.h"
-#endif
-
-G_DEFINE_TYPE (MMPluginPantech, mm_plugin_pantech, MM_TYPE_PLUGIN)
-
-MM_PLUGIN_DEFINE_MAJOR_VERSION
-MM_PLUGIN_DEFINE_MINOR_VERSION
-
-/*****************************************************************************/
-/* Custom commands for AT probing
- * There's currently no WMC probing plugged in the logic, so We need to detect
- * WMC ports ourselves somehow. Just assume that the WMC port will reply "ERROR"
- * to the "ATE0" command.
- */
-static gboolean
-port_probe_response_processor_is_pantech_at (const gchar *command,
- const gchar *response,
- gboolean last_command,
- const GError *error,
- GVariant **result,
- GError **result_error)
-{
- if (error) {
- /* Timeout errors are the only ones not fatal;
- * they will just go on to the next command. */
- if (g_error_matches (error,
- MM_SERIAL_ERROR,
- MM_SERIAL_ERROR_RESPONSE_TIMEOUT)) {
- return FALSE;
- }
-
- /* All other errors indicate NOT an AT port */
- *result = g_variant_new_boolean (FALSE);
- return TRUE;
- }
-
- /* No error reported, valid AT port! */
- *result = g_variant_new_boolean (TRUE);
- return TRUE;
-}
-
-static const MMPortProbeAtCommand custom_at_probe[] = {
- { "ATE0", 3, port_probe_response_processor_is_pantech_at },
- { "ATE0", 3, port_probe_response_processor_is_pantech_at },
- { "ATE0", 3, port_probe_response_processor_is_pantech_at },
- { NULL }
-};
-
-/*****************************************************************************/
-
-static MMBaseModem *
-create_modem (MMPlugin *self,
- const gchar *uid,
- const gchar **drivers,
- guint16 vendor,
- guint16 product,
- guint16 subsystem_vendor,
- GList *probes,
- GError **error)
-{
-#if defined WITH_QMI
- if (mm_port_probe_list_has_qmi_port (probes)) {
- mm_obj_dbg (self, "QMI-powered Pantech modem found...");
- return MM_BASE_MODEM (mm_broadband_modem_qmi_new (uid,
- drivers,
- mm_plugin_get_name (self),
- vendor,
- product));
- }
-#endif
-
- return MM_BASE_MODEM (mm_broadband_modem_pantech_new (uid,
- drivers,
- mm_plugin_get_name (self),
- vendor,
- product));
-}
-
-static gboolean
-grab_port (MMPlugin *self,
- MMBaseModem *modem,
- MMPortProbe *probe,
- GError **error)
-{
- MMPortType ptype;
- MMPortSerialAtFlag pflags = MM_PORT_SERIAL_AT_FLAG_NONE;
-
- ptype = mm_port_probe_get_port_type (probe);
-
- /* Always prefer the ttyACM port as PRIMARY AT port */
- if (ptype == MM_PORT_TYPE_AT &&
- g_str_has_prefix (mm_port_probe_get_port_name (probe), "ttyACM")) {
- pflags = MM_PORT_SERIAL_AT_FLAG_PRIMARY;
- }
-
- return mm_base_modem_grab_port (modem,
- mm_port_probe_peek_port (probe),
- ptype,
- pflags,
- error);
-}
-
-/*****************************************************************************/
-
-G_MODULE_EXPORT MMPlugin *
-mm_plugin_create (void)
-{
- static const gchar *subsystems[] = { "tty", "net", "usbmisc", NULL };
- static const guint16 vendor_ids[] = { 0x106c, 0 };
-
- return MM_PLUGIN (
- g_object_new (MM_TYPE_PLUGIN_PANTECH,
- MM_PLUGIN_NAME, MM_MODULE_NAME,
- MM_PLUGIN_ALLOWED_SUBSYSTEMS, subsystems,
- MM_PLUGIN_ALLOWED_VENDOR_IDS, vendor_ids,
- MM_PLUGIN_ALLOWED_AT, TRUE,
- MM_PLUGIN_ALLOWED_QCDM, TRUE,
- MM_PLUGIN_ALLOWED_QMI, TRUE,
- MM_PLUGIN_CUSTOM_AT_PROBE, custom_at_probe,
- NULL));
-}
-
-static void
-mm_plugin_pantech_init (MMPluginPantech *self)
-{
-}
-
-static void
-mm_plugin_pantech_class_init (MMPluginPantechClass *klass)
-{
- MMPluginClass *plugin_class = MM_PLUGIN_CLASS (klass);
-
- plugin_class->create_modem = create_modem;
- plugin_class->grab_port = grab_port;
-}
diff --git a/plugins/pantech/mm-plugin-pantech.h b/plugins/pantech/mm-plugin-pantech.h
deleted file mode 100644
index fdbdd9ea..00000000
--- a/plugins/pantech/mm-plugin-pantech.h
+++ /dev/null
@@ -1,40 +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) 2012 Aleksander Morgado <aleksander@gnu.org>
- */
-
-#ifndef MM_PLUGIN_PANTECH_H
-#define MM_PLUGIN_PANTECH_H
-
-#include "mm-plugin.h"
-
-#define MM_TYPE_PLUGIN_PANTECH (mm_plugin_pantech_get_type ())
-#define MM_PLUGIN_PANTECH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_PLUGIN_PANTECH, MMPluginPantech))
-#define MM_PLUGIN_PANTECH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_PLUGIN_PANTECH, MMPluginPantechClass))
-#define MM_IS_PLUGIN_PANTECH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_PLUGIN_PANTECH))
-#define MM_IS_PLUGIN_PANTECH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_PLUGIN_PANTECH))
-#define MM_PLUGIN_PANTECH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_PLUGIN_PANTECH, MMPluginPantechClass))
-
-typedef struct {
- MMPlugin parent;
-} MMPluginPantech;
-
-typedef struct {
- MMPluginClass parent;
-} MMPluginPantechClass;
-
-GType mm_plugin_pantech_get_type (void);
-
-G_MODULE_EXPORT MMPlugin *mm_plugin_create (void);
-
-#endif /* MM_PLUGIN_PANTECH_H */
diff --git a/plugins/pantech/mm-sim-pantech.c b/plugins/pantech/mm-sim-pantech.c
deleted file mode 100644
index 33414572..00000000
--- a/plugins/pantech/mm-sim-pantech.c
+++ /dev/null
@@ -1,87 +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) 2012 Aleksander Morgado <aleksander@gnu.org>
- */
-
-#include <config.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <ctype.h>
-
-#include <ModemManager.h>
-#define _LIBMM_INSIDE_MM
-#include <libmm-glib.h>
-
-#include "mm-sim-pantech.h"
-
-G_DEFINE_TYPE (MMSimPantech, mm_sim_pantech, MM_TYPE_BASE_SIM)
-
-/*****************************************************************************/
-
-MMBaseSim *
-mm_sim_pantech_new_finish (GAsyncResult *res,
- GError **error)
-{
- GObject *source;
- GObject *sim;
-
- source = g_async_result_get_source_object (res);
- sim = g_async_initable_new_finish (G_ASYNC_INITABLE (source), res, error);
- g_object_unref (source);
-
- if (!sim)
- return NULL;
-
- /* Only export valid SIMs */
- mm_base_sim_export (MM_BASE_SIM (sim));
-
- return MM_BASE_SIM (sim);
-}
-
-void
-mm_sim_pantech_new (MMBaseModem *modem,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
-{
- g_async_initable_new_async (MM_TYPE_SIM_PANTECH,
- G_PRIORITY_DEFAULT,
- cancellable,
- callback,
- user_data,
- MM_BASE_SIM_MODEM, modem,
- "active", TRUE, /* by default always active */
- NULL);
-}
-
-static void
-mm_sim_pantech_init (MMSimPantech *self)
-{
-}
-
-static void
-mm_sim_pantech_class_init (MMSimPantechClass *klass)
-{
- MMBaseSimClass *base_sim_class = MM_BASE_SIM_CLASS (klass);
-
- /* Skip querying most SIM card info, +CRSM just shoots the Pantech modems
- * (at least the UMW190) in the head */
- base_sim_class->load_sim_identifier = NULL;
- base_sim_class->load_sim_identifier_finish = NULL;
- base_sim_class->load_operator_identifier = NULL;
- base_sim_class->load_operator_identifier_finish = NULL;
- base_sim_class->load_operator_name = NULL;
- base_sim_class->load_operator_name_finish = NULL;
-}
diff --git a/plugins/pantech/mm-sim-pantech.h b/plugins/pantech/mm-sim-pantech.h
deleted file mode 100644
index 8d227645..00000000
--- a/plugins/pantech/mm-sim-pantech.h
+++ /dev/null
@@ -1,51 +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) 2012 Aleksander Morgado <aleksander@gnu.org>
- */
-
-#ifndef MM_SIM_PANTECH_H
-#define MM_SIM_PANTECH_H
-
-#include <glib.h>
-#include <glib-object.h>
-
-#include "mm-base-sim.h"
-
-#define MM_TYPE_SIM_PANTECH (mm_sim_pantech_get_type ())
-#define MM_SIM_PANTECH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_SIM_PANTECH, MMSimPantech))
-#define MM_SIM_PANTECH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_SIM_PANTECH, MMSimPantechClass))
-#define MM_IS_SIM_PANTECH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_SIM_PANTECH))
-#define MM_IS_SIM_PANTECH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_SIM_PANTECH))
-#define MM_SIM_PANTECH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_SIM_PANTECH, MMSimPantechClass))
-
-typedef struct _MMSimPantech MMSimPantech;
-typedef struct _MMSimPantechClass MMSimPantechClass;
-
-struct _MMSimPantech {
- MMBaseSim parent;
-};
-
-struct _MMSimPantechClass {
- MMBaseSimClass parent;
-};
-
-GType mm_sim_pantech_get_type (void);
-
-void mm_sim_pantech_new (MMBaseModem *modem,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-MMBaseSim *mm_sim_pantech_new_finish (GAsyncResult *res,
- GError **error);
-
-#endif /* MM_SIM_PANTECH_H */