pantech: create a Pantech-specific SIM object
We'll just skip most SIM info retrieval commands based on AT+CRSM, as they seem to be unsupported.
This commit is contained in:
@@ -250,7 +250,11 @@ udevrules_DATA += x22x/77-mm-x22x-port-types.rules
|
||||
# Pantech
|
||||
libmm_plugin_pantech_la_SOURCES = \
|
||||
pantech/mm-plugin-pantech.c \
|
||||
pantech/mm-plugin-pantech.h
|
||||
pantech/mm-plugin-pantech.h \
|
||||
pantech/mm-sim-pantech.c \
|
||||
pantech/mm-sim-pantech.h \
|
||||
pantech/mm-broadband-modem-pantech.c \
|
||||
pantech/mm-broadband-modem-pantech.h
|
||||
libmm_plugin_pantech_la_CPPFLAGS = $(PLUGIN_COMMON_COMPILER_FLAGS)
|
||||
libmm_plugin_pantech_la_LDFLAGS = $(PLUGIN_COMMON_LINKER_FLAGS)
|
||||
|
||||
|
92
plugins/pantech/mm-broadband-modem-pantech.c
Normal file
92
plugins/pantech/mm-broadband-modem-pantech.c
Normal file
@@ -0,0 +1,92 @@
|
||||
/* -*- 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-log.h"
|
||||
#include "mm-errors-types.h"
|
||||
#include "mm-broadband-modem-pantech.h"
|
||||
#include "mm-sim-pantech.h"
|
||||
|
||||
static void iface_modem_init (MMIfaceModem *iface);
|
||||
|
||||
G_DEFINE_TYPE_EXTENDED (MMBroadbandModemPantech, mm_broadband_modem_pantech, MM_TYPE_BROADBAND_MODEM, 0,
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM, iface_modem_init))
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Create SIM (Modem interface) */
|
||||
|
||||
static MMSim *
|
||||
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);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
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,
|
||||
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;
|
||||
}
|
||||
|
||||
static void
|
||||
mm_broadband_modem_pantech_class_init (MMBroadbandModemPantechClass *klass)
|
||||
{
|
||||
}
|
47
plugins/pantech/mm-broadband-modem-pantech.h
Normal file
47
plugins/pantech/mm-broadband-modem-pantech.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/* -*- 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 */
|
@@ -21,7 +21,7 @@
|
||||
|
||||
#include "mm-log.h"
|
||||
#include "mm-plugin-pantech.h"
|
||||
#include "mm-broadband-modem.h"
|
||||
#include "mm-broadband-modem-pantech.h"
|
||||
|
||||
#if defined WITH_QMI
|
||||
#include "mm-broadband-modem-qmi.h"
|
||||
@@ -54,11 +54,11 @@ create_modem (MMPlugin *self,
|
||||
}
|
||||
#endif
|
||||
|
||||
return MM_BASE_MODEM (mm_broadband_modem_new (sysfs_path,
|
||||
drivers,
|
||||
mm_plugin_get_name (self),
|
||||
vendor,
|
||||
product));
|
||||
return MM_BASE_MODEM (mm_broadband_modem_pantech_new (sysfs_path,
|
||||
drivers,
|
||||
mm_plugin_get_name (self),
|
||||
vendor,
|
||||
product));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
86
plugins/pantech/mm-sim-pantech.c
Normal file
86
plugins/pantech/mm-sim-pantech.c
Normal file
@@ -0,0 +1,86 @@
|
||||
/* -*- 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_SIM);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
MMSim *
|
||||
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_sim_export (MM_SIM (sim));
|
||||
|
||||
return MM_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_SIM_MODEM, modem,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
mm_sim_pantech_init (MMSimPantech *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
mm_sim_pantech_class_init (MMSimPantechClass *klass)
|
||||
{
|
||||
MMSimClass *sim_class = MM_SIM_CLASS (klass);
|
||||
|
||||
/* Skip querying most SIM card info, +CRSM just shoots the Pantech modems
|
||||
* (at least the UMW190) in the head */
|
||||
sim_class->load_sim_identifier = NULL;
|
||||
sim_class->load_sim_identifier_finish = NULL;
|
||||
sim_class->load_operator_identifier = NULL;
|
||||
sim_class->load_operator_identifier_finish = NULL;
|
||||
sim_class->load_operator_name = NULL;
|
||||
sim_class->load_operator_name_finish = NULL;
|
||||
}
|
51
plugins/pantech/mm-sim-pantech.h
Normal file
51
plugins/pantech/mm-sim-pantech.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* -*- 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-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 {
|
||||
MMSim parent;
|
||||
};
|
||||
|
||||
struct _MMSimPantechClass {
|
||||
MMSimClass parent;
|
||||
};
|
||||
|
||||
GType mm_sim_pantech_get_type (void);
|
||||
|
||||
void mm_sim_pantech_new (MMBaseModem *modem,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
MMSim *mm_sim_pantech_new_finish (GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
#endif /* MM_SIM_PANTECH_H */
|
Reference in New Issue
Block a user