fibocom: Subclass broadband modem

This is required in order to be able to use a custom bearer which in
turn is necessary for establishing ECM connections.
This commit is contained in:
Sven Schwermer
2022-01-04 13:13:55 +01:00
committed by Aleksander Morgado
parent 07d7f596d3
commit 6ad17fb22e
5 changed files with 121 additions and 6 deletions

View File

@@ -690,6 +690,8 @@ if ENABLE_PLUGIN_FIBOCOM
pkglib_LTLIBRARIES += libmm-plugin-fibocom.la
libmm_plugin_fibocom_la_SOURCES = \
fibocom/mm-broadband-modem-fibocom.c \
fibocom/mm-broadband-modem-fibocom.h \
fibocom/mm-plugin-fibocom.c \
fibocom/mm-plugin-fibocom.h \
$(NULL)

View File

@@ -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) 2022 Disruptive Technologies Research AS
*/
#include <config.h>
#include "mm-broadband-modem-fibocom.h"
#include "mm-broadband-modem.h"
#include "mm-iface-modem.h"
static void iface_modem_init (MMIfaceModem *iface);
G_DEFINE_TYPE_EXTENDED (MMBroadbandModemFibocom, mm_broadband_modem_fibocom, MM_TYPE_BROADBAND_MODEM, 0,
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM, iface_modem_init))
/*****************************************************************************/
MMBroadbandModemFibocom *
mm_broadband_modem_fibocom_new (const gchar *device,
const gchar **drivers,
const gchar *plugin,
guint16 vendor_id,
guint16 product_id)
{
return g_object_new (MM_TYPE_BROADBAND_MODEM_FIBOCOM,
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,
MM_BASE_MODEM_DATA_NET_SUPPORTED, FALSE,
MM_BASE_MODEM_DATA_TTY_SUPPORTED, TRUE,
NULL);
}
static void
mm_broadband_modem_fibocom_init (MMBroadbandModemFibocom *self)
{
}
static void
iface_modem_init (MMIfaceModem *iface)
{
}
static void
mm_broadband_modem_fibocom_class_init (MMBroadbandModemFibocomClass *klass)
{
}

View 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) 2022 Disruptive Technologies Research AS
*/
#ifndef MM_BROADBAND_MODEM_FIBOCOM_H
#define MM_BROADBAND_MODEM_FIBOCOM_H
#include "mm-broadband-modem.h"
#define MM_TYPE_BROADBAND_MODEM_FIBOCOM (mm_broadband_modem_fibocom_get_type ())
#define MM_BROADBAND_MODEM_FIBOCOM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_BROADBAND_MODEM_FIBOCOM, MMBroadbandModemFibocom))
#define MM_BROADBAND_MODEM_FIBOCOM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_BROADBAND_MODEM_FIBOCOM, MMBroadbandModemFibocomClass))
#define MM_IS_BROADBAND_MODEM_FIBOCOM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_BROADBAND_MODEM_FIBOCOM))
#define MM_IS_BROADBAND_MODEM_FIBOCOM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_BROADBAND_MODEM_FIBOCOM))
#define MM_BROADBAND_MODEM_FIBOCOM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_BROADBAND_MODEM_FIBOCOM, MMBroadbandModemFibocomClass))
typedef struct _MMBroadbandModemFibocom MMBroadbandModemFibocom;
typedef struct _MMBroadbandModemFibocomClass MMBroadbandModemFibocomClass;
struct _MMBroadbandModemFibocom {
MMBroadbandModem parent;
};
struct _MMBroadbandModemFibocomClass{
MMBroadbandModemClass parent;
};
GType mm_broadband_modem_fibocom_get_type (void);
MMBroadbandModemFibocom *mm_broadband_modem_fibocom_new (const gchar *device,
const gchar **drivers,
const gchar *plugin,
guint16 vendor_id,
guint16 product_id);
#endif /* MM_BROADBAND_MODEM_FIBOCOM_H */

View File

@@ -23,6 +23,7 @@
#include "mm-plugin-fibocom.h"
#include "mm-broadband-modem.h"
#include "mm-broadband-modem-xmm.h"
#include "mm-broadband-modem-fibocom.h"
#if defined WITH_MBIM
#include "mm-broadband-modem-mbim.h"
@@ -89,11 +90,11 @@ create_modem (MMPlugin *self,
}
mm_obj_dbg (self, "Fibocom modem found...");
return MM_BASE_MODEM (mm_broadband_modem_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
product));
return MM_BASE_MODEM (mm_broadband_modem_fibocom_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
product));
}
/*****************************************************************************/

View File

@@ -337,9 +337,14 @@ if plugins_options['fibocom']
'-DTESTUDEVRULESDIR_FIBOCOM="@0@"'.format(plugins_dir / 'fibocom'),
]
sources = files(
'fibocom/mm-broadband-modem-fibocom.c',
'fibocom/mm-plugin-fibocom.c',
)
plugins += {'plugin-fibocom': {
'plugin': true,
'module': {'sources': files('fibocom/mm-plugin-fibocom.c'), 'include_directories': plugins_incs + [xmm_inc], 'c_args': c_args},
'module': {'sources': sources, 'include_directories': plugins_incs + [xmm_inc], 'c_args': c_args},
}}
plugins_udev_rules += files('fibocom/77-mm-fibocom-port-types.rules')