Files
ModemManager/plugins/cinterion/mm-plugin-cinterion.c
Aleksander Morgado 2a611c3856 cinterion: support QMI-based Cinterion PLXX and PHXX modules
E.g. with a Cinterion PLS8 LTE modem:

  $ sudo mmcli -m 0

  /org/freedesktop/ModemManager1/Modem/0 (device id '0042872f6597b3d772a3d9d3cd6f14f152af8a0b')
    -------------------------
    Hardware |   manufacturer: 'QUALCOMM INCORPORATED'
             |          model: '0'
             |       revision: 'M9615A-CETWMAZM-2.0.19015  1  [Jan 31 2013 00:00:00]'
             |      supported: 'gsm-umts
             |                  lte
             |                  gsm-umts, lte'
             |        current: 'gsm-umts, lte'
             |   equipment id: 'unknown'
    -------------------------
    System   |         device: '/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.7'
             |        drivers: 'option1, qmi_wwan'
             |         plugin: 'Cinterion'
             |   primary port: 'cdc-wdm0'
             |          ports: 'ttyUSB2 (at), cdc-wdm0 (qmi), wwp0s29u1u7i4 (net)'
    -------------------------
    Numbers  |           own : 'unknown'
    -------------------------
    Status   |           lock: 'sim-pin'
             | unlock retries: 'sim-pin (3), sim-pin2 (2), sim-puk (10), sim-puk2 (10)'
             |          state: 'locked'
             |    power state: 'on'
             |    access tech: 'unknown'
             | signal quality: '0' (cached)
    -------------------------
    Modes    |      supported: 'allowed: 2g, 3g, 4g; preferred: none'
             |        current: 'allowed: 2g, 3g, 4g; preferred: none'
    -------------------------
    Bands    |      supported: 'cdma-bc15-aws, dcs, egsm, u2100, u1800, u900, eutran-i, eutran-iii, eutran-vii, eutran-viii, eutran-xx'
             |        current: 'cdma-bc15-aws, dcs, egsm, u2100, u1800, u900, eutran-i, eutran-iii, eutran-vii, eutran-viii, eutran-xx'
    -------------------------
    IP       |      supported: 'ipv4, ipv6, ipv4v6'
    -------------------------
    SIM      |           path: '/org/freedesktop/ModemManager1/SIM/0'
2013-09-25 17:46:31 +02:00

102 lines
3.5 KiB
C

/* -*- 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.
*
* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Copyright (C) 2011 Ammonit Measurement GmbH
* Copyright (C) 2011 - 2012 Google Inc.
* Author: Aleksander Morgado <aleksander@lanedo.com>
*/
#include <string.h>
#include <gmodule.h>
#define _LIBMM_INSIDE_MM
#include <libmm-glib.h>
#include "mm-plugin-cinterion.h"
#include "mm-broadband-modem-cinterion.h"
#include "mm-log.h"
#if defined WITH_QMI
#include "mm-broadband-modem-qmi.h"
#endif
G_DEFINE_TYPE (MMPluginCinterion, mm_plugin_cinterion, MM_TYPE_PLUGIN)
int mm_plugin_major_version = MM_PLUGIN_MAJOR_VERSION;
int mm_plugin_minor_version = MM_PLUGIN_MINOR_VERSION;
static MMBaseModem *
create_modem (MMPlugin *self,
const gchar *sysfs_path,
const gchar **drivers,
guint16 vendor,
guint16 product,
GList *probes,
GError **error)
{
#if defined WITH_QMI
if (mm_port_probe_list_has_qmi_port (probes)) {
mm_dbg ("QMI-powered Cinterion modem found...");
return MM_BASE_MODEM (mm_broadband_modem_qmi_new (sysfs_path,
drivers,
mm_plugin_get_name (self),
vendor,
product));
}
#endif
return MM_BASE_MODEM (mm_broadband_modem_cinterion_new (sysfs_path,
drivers,
mm_plugin_get_name (self),
vendor,
product));
}
/*****************************************************************************/
G_MODULE_EXPORT MMPlugin *
mm_plugin_create (void)
{
static const gchar *subsystems[] = { "tty", "net", "usb", NULL };
static const gchar *vendor_strings[] = { "cinterion", "siemens", NULL };
static const guint16 vendor_ids[] = { 0x1e2d, 0x0681, 0 };
return MM_PLUGIN (
g_object_new (MM_TYPE_PLUGIN_CINTERION,
MM_PLUGIN_NAME, "Cinterion",
MM_PLUGIN_ALLOWED_SUBSYSTEMS, subsystems,
MM_PLUGIN_ALLOWED_VENDOR_STRINGS, vendor_strings,
MM_PLUGIN_ALLOWED_VENDOR_IDS, vendor_ids,
MM_PLUGIN_ALLOWED_AT, TRUE,
MM_PLUGIN_ALLOWED_QMI, TRUE,
NULL));
}
static void
mm_plugin_cinterion_init (MMPluginCinterion *self)
{
}
static void
mm_plugin_cinterion_class_init (MMPluginCinterionClass *klass)
{
MMPluginClass *plugin_class = MM_PLUGIN_CLASS (klass);
plugin_class->create_modem = create_modem;
}