aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2019-11-12 10:55:06 +0100
committerAleksander Morgado <aleksander@aleksander.es>2019-11-13 12:31:58 +0100
commitd7d2b9108e12f86f50f82f124066fab46792bd44 (patch)
treee5a599f1155f2e5ec14e2374c608d47601c69ea9
parent5ab5593edbf86a268f9b6d196f30e303c1e1b879 (diff)
foxconn: new plugin to support the T77W968
The Dell DW5821e is really a re-branded Foxconn T77W968.
-rw-r--r--configure.ac2
-rw-r--r--plugins/Makefile.am51
-rw-r--r--plugins/dell/mm-broadband-modem-dell-dw5821e.h49
-rw-r--r--plugins/dell/mm-plugin-dell.c16
-rw-r--r--plugins/foxconn/77-mm-foxconn-port-types.rules26
-rw-r--r--plugins/foxconn/mm-broadband-modem-foxconn-t77w968.c (renamed from plugins/dell/mm-broadband-modem-dell-dw5821e.c)104
-rw-r--r--plugins/foxconn/mm-broadband-modem-foxconn-t77w968.h49
-rw-r--r--plugins/foxconn/mm-foxconn-t77w968-carrier-mapping.conf (renamed from plugins/dell/mm-dell-dw5821e-carrier-mapping.conf)4
-rw-r--r--plugins/foxconn/mm-plugin-foxconn.c127
-rw-r--r--plugins/foxconn/mm-plugin-foxconn.h46
-rw-r--r--plugins/tests/test-keyfiles.c6
11 files changed, 355 insertions, 125 deletions
diff --git a/configure.ac b/configure.ac
index 551a0229..07fb86d7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -362,7 +362,7 @@ dnl-----------------------------------------------------------------------------
dnl QMI support (enabled by default)
dnl
-LIBQMI_VERSION=1.24.0
+LIBQMI_VERSION=1.25.1
AC_ARG_WITH(qmi, AS_HELP_STRING([--without-qmi], [Build without QMI support]), [], [with_qmi=yes])
AM_CONDITIONAL(WITH_QMI, test "x$with_qmi" = "xyes")
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index ffc0c0ec..358e4717 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -299,6 +299,21 @@ XMM_COMMON_COMPILER_FLAGS = -I$(top_srcdir)/plugins/xmm
XMM_COMMON_LIBADD_FLAGS = $(builddir)/libmm-utils-xmm.la
################################################################################
+# common foxconn support
+################################################################################
+
+# Common Foxconn modem support library (MBIM only)
+if WITH_MBIM
+noinst_LTLIBRARIES += libmm-utils-foxconn.la
+libmm_utils_foxconn_la_SOURCES = \
+ foxconn/mm-broadband-modem-foxconn-t77w968.c \
+ foxconn/mm-broadband-modem-foxconn-t77w968.h \
+ $(NULL)
+FOXCONN_COMMON_COMPILER_FLAGS = -I$(top_srcdir)/plugins/foxconn
+FOXCONN_COMMON_LIBADD_FLAGS = $(builddir)/libmm-utils-foxconn.la
+endif
+
+################################################################################
# plugin: generic
################################################################################
@@ -814,6 +829,28 @@ libmm_plugin_novatel_la_LDFLAGS = $(PLUGIN_COMMON_LINKER_FLAGS)
libmm_plugin_novatel_la_LIBADD = $(NOVATEL_COMMON_LIBADD_FLAGS)
################################################################################
+# plugin: foxconn
+################################################################################
+
+pkglib_LTLIBRARIES += libmm-plugin-foxconn.la
+libmm_plugin_foxconn_la_SOURCES = \
+ foxconn/mm-plugin-foxconn.c \
+ foxconn/mm-plugin-foxconn.h \
+ $(NULL)
+libmm_plugin_foxconn_la_CPPFLAGS = $(PLUGIN_COMMON_COMPILER_FLAGS) $(FOXCONN_COMMON_COMPILER_FLAGS)
+libmm_plugin_foxconn_la_LDFLAGS = $(PLUGIN_COMMON_LINKER_FLAGS)
+libmm_plugin_foxconn_la_LIBADD = $(FOXCONN_COMMON_LIBADD_FLAGS)
+
+dist_udevrules_DATA += foxconn/77-mm-foxconn-port-types.rules
+
+dist_pkgdata_DATA += foxconn/mm-foxconn-t77w968-carrier-mapping.conf
+
+AM_CFLAGS += \
+ -DTESTUDEVRULESDIR_FOXCONN=\"${srcdir}/foxconn\" \
+ -DTESTKEYFILE_FOXCONN_T77W968=\"${srcdir}/foxconn/mm-foxconn-t77w968-carrier-mapping.conf\" \
+ $(NULL)
+
+################################################################################
# plugin: altair lte
################################################################################
@@ -1081,7 +1118,7 @@ libmm_plugin_ublox_la_LDFLAGS = $(PLUGIN_COMMON_LINKER_FLAGS)
libmm_plugin_ublox_la_LIBADD = $(builddir)/libhelpers-ublox.la
################################################################################
-# plugin: dell (novatel, sierra or telit)
+# plugin: dell (novatel, sierra, telit or foxconn)
################################################################################
pkglib_LTLIBRARIES += libmm-plugin-dell.la
@@ -1090,13 +1127,6 @@ libmm_plugin_dell_la_SOURCES = \
dell/mm-plugin-dell.h \
$(NULL)
-if WITH_MBIM
-libmm_plugin_dell_la_SOURCES += \
- dell/mm-broadband-modem-dell-dw5821e.h \
- dell/mm-broadband-modem-dell-dw5821e.c \
- $(NULL)
-endif
-
libmm_plugin_dell_la_CPPFLAGS = \
$(PLUGIN_COMMON_COMPILER_FLAGS) \
$(NOVATEL_COMMON_COMPILER_FLAGS) \
@@ -1104,6 +1134,7 @@ libmm_plugin_dell_la_CPPFLAGS = \
$(TELIT_COMMON_COMPILER_FLAGS) \
$(XMM_COMMON_COMPILER_FLAGS) \
$(MBM_COMMON_COMPILER_FLAGS) \
+ $(FOXCONN_COMMON_COMPILER_FLAGS) \
$(NULL)
libmm_plugin_dell_la_LDFLAGS = $(PLUGIN_COMMON_LINKER_FLAGS)
libmm_plugin_dell_la_LIBADD = \
@@ -1112,15 +1143,13 @@ libmm_plugin_dell_la_LIBADD = \
$(TELIT_COMMON_LIBADD_FLAGS) \
$(XMM_COMMON_LIBADD_FLAGS) \
$(MBM_COMMON_LIBADD_FLAGS) \
+ $(FOXCONN_COMMON_LIBADD_FLAGS) \
$(NULL)
dist_udevrules_DATA += dell/77-mm-dell-port-types.rules
-dist_pkgdata_DATA += dell/mm-dell-dw5821e-carrier-mapping.conf
-
AM_CFLAGS += \
-DTESTUDEVRULESDIR_DELL=\"${srcdir}/dell\" \
- -DTESTKEYFILE_DELL_DW5821E=\"${srcdir}/dell/mm-dell-dw5821e-carrier-mapping.conf\" \
$(NULL)
################################################################################
diff --git a/plugins/dell/mm-broadband-modem-dell-dw5821e.h b/plugins/dell/mm-broadband-modem-dell-dw5821e.h
deleted file mode 100644
index 6903a4eb..00000000
--- a/plugins/dell/mm-broadband-modem-dell-dw5821e.h
+++ /dev/null
@@ -1,49 +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) 2018 Aleksander Morgado <aleksander@aleksander.es>
- */
-
-#ifndef MM_BROADBAND_MODEM_DELL_DW5821E_H
-#define MM_BROADBAND_MODEM_DELL_DW5821E_H
-
-#include "mm-broadband-modem-mbim.h"
-
-#define MM_TYPE_BROADBAND_MODEM_DELL_DW5821E (mm_broadband_modem_dell_dw5821e_get_type ())
-#define MM_BROADBAND_MODEM_DELL_DW5821E(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_BROADBAND_MODEM_DELL_DW5821E, MMBroadbandModemDellDw5821e))
-#define MM_BROADBAND_MODEM_DELL_DW5821E_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_BROADBAND_MODEM_DELL_DW5821E, MMBroadbandModemDellDw5821eClass))
-#define MM_IS_BROADBAND_MODEM_DELL_DW5821E(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_BROADBAND_MODEM_DELL_DW5821E))
-#define MM_IS_BROADBAND_MODEM_DELL_DW5821E_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_BROADBAND_MODEM_DELL_DW5821E))
-#define MM_BROADBAND_MODEM_DELL_DW5821E_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_BROADBAND_MODEM_DELL_DW5821E, MMBroadbandModemDellDw5821eClass))
-
-typedef struct _MMBroadbandModemDellDw5821e MMBroadbandModemDellDw5821e;
-typedef struct _MMBroadbandModemDellDw5821eClass MMBroadbandModemDellDw5821eClass;
-typedef struct _MMBroadbandModemDellDw5821ePrivate MMBroadbandModemDellDw5821ePrivate;
-
-struct _MMBroadbandModemDellDw5821e {
- MMBroadbandModemMbim parent;
- MMBroadbandModemDellDw5821ePrivate *priv;
-};
-
-struct _MMBroadbandModemDellDw5821eClass{
- MMBroadbandModemMbimClass parent;
-};
-
-GType mm_broadband_modem_dell_dw5821e_get_type (void);
-
-MMBroadbandModemDellDw5821e *mm_broadband_modem_dell_dw5821e_new (const gchar *device,
- const gchar **driver,
- const gchar *plugin,
- guint16 vendor_id,
- guint16 product_id);
-
-#endif /* MM_BROADBAND_MODEM_DELL_DW5821E_H */
diff --git a/plugins/dell/mm-plugin-dell.c b/plugins/dell/mm-plugin-dell.c
index 8f26b4ff..e9f8a0bd 100644
--- a/plugins/dell/mm-plugin-dell.c
+++ b/plugins/dell/mm-plugin-dell.c
@@ -16,7 +16,7 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
- * Copyright (C) 2015 Aleksander Morgado <aleksander@aleksander.es>
+ * Copyright (C) 2015-2019 Aleksander Morgado <aleksander@aleksander.es>
*/
#include <string.h>
@@ -45,7 +45,7 @@
#if defined WITH_MBIM
#include "mm-broadband-modem-mbim.h"
#include "mm-broadband-modem-mbim-xmm.h"
-#include "mm-broadband-modem-dell-dw5821e.h"
+#include "mm-broadband-modem-foxconn-t77w968.h"
#endif
#define MAX_PORT_PROBE_TIMEOUTS 3
@@ -400,12 +400,12 @@ create_modem (MMPlugin *self,
if (mm_port_probe_list_has_mbim_port (probes)) {
/* Specific implementation for the DW5821e */
if (vendor == 0x413c && (product == 0x81d7 || product == 0x81e0)) {
- mm_dbg ("MBIM-powered DW5821e modem found...");
- return MM_BASE_MODEM (mm_broadband_modem_dell_dw5821e_new (uid,
- drivers,
- mm_plugin_get_name (self),
- vendor,
- product));
+ mm_dbg ("MBIM-powered DW5821e (T77W968) modem found...");
+ return MM_BASE_MODEM (mm_broadband_modem_foxconn_t77w968_new (uid,
+ drivers,
+ mm_plugin_get_name (self),
+ vendor,
+ product));
}
if (mm_port_probe_list_is_xmm (probes)) {
diff --git a/plugins/foxconn/77-mm-foxconn-port-types.rules b/plugins/foxconn/77-mm-foxconn-port-types.rules
new file mode 100644
index 00000000..6b501ba2
--- /dev/null
+++ b/plugins/foxconn/77-mm-foxconn-port-types.rules
@@ -0,0 +1,26 @@
+# do not edit this file, it will be overwritten on update
+
+ACTION!="add|change|move|bind", GOTO="mm_foxconn_port_types_end"
+
+SUBSYSTEMS=="usb", ATTRS{idVendor}=="0489", GOTO="mm_foxconn_vendorcheck"
+GOTO="mm_foxconn_port_types_end"
+
+LABEL="mm_foxconn_vendorcheck"
+SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}=="?*", ENV{.MM_USBIFNUM}="$attr{bInterfaceNumber}"
+
+# Foxconn T77w968 (default 0xe0b4, with esim support 0xe0b5)
+# if 02: primary port
+# if 03: secondary port
+# if 04: raw NMEA port
+# if 05: diag/qcdm port
+ATTRS{idVendor}=="0489", ATTRS{idProduct}=="e0b4", ENV{.MM_USBIFNUM}=="02", ENV{ID_MM_PORT_TYPE_AT_PRIMARY}="1"
+ATTRS{idVendor}=="0489", ATTRS{idProduct}=="e0b4", ENV{.MM_USBIFNUM}=="03", ENV{ID_MM_PORT_TYPE_AT_SECONDARY}="1"
+ATTRS{idVendor}=="0489", ATTRS{idProduct}=="e0b4", ENV{.MM_USBIFNUM}=="04", ENV{ID_MM_PORT_TYPE_GPS}="1"
+ATTRS{idVendor}=="0489", ATTRS{idProduct}=="e0b4", ENV{.MM_USBIFNUM}=="05", ENV{ID_MM_PORT_TYPE_QCDM}="1"
+ATTRS{idVendor}=="0489", ATTRS{idProduct}=="e0b5", ENV{.MM_USBIFNUM}=="02", ENV{ID_MM_PORT_TYPE_AT_PRIMARY}="1"
+ATTRS{idVendor}=="0489", ATTRS{idProduct}=="e0b5", ENV{.MM_USBIFNUM}=="03", ENV{ID_MM_PORT_TYPE_AT_SECONDARY}="1"
+ATTRS{idVendor}=="0489", ATTRS{idProduct}=="e0b5", ENV{.MM_USBIFNUM}=="04", ENV{ID_MM_PORT_TYPE_GPS}="1"
+ATTRS{idVendor}=="0489", ATTRS{idProduct}=="e0b5", ENV{.MM_USBIFNUM}=="05", ENV{ID_MM_PORT_TYPE_QCDM}="1"
+
+GOTO="mm_foxconn_port_types_end"
+LABEL="mm_foxconn_port_types_end"
diff --git a/plugins/dell/mm-broadband-modem-dell-dw5821e.c b/plugins/foxconn/mm-broadband-modem-foxconn-t77w968.c
index 7622cf1d..c5940194 100644
--- a/plugins/dell/mm-broadband-modem-dell-dw5821e.c
+++ b/plugins/foxconn/mm-broadband-modem-foxconn-t77w968.c
@@ -10,7 +10,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details:
*
- * Copyright (C) 2018 Aleksander Morgado <aleksander@aleksander.es>
+ * Copyright (C) 2018-2019 Aleksander Morgado <aleksander@aleksander.es>
*/
#include <config.h>
@@ -32,7 +32,7 @@
#include "mm-base-modem-at.h"
#include "mm-iface-modem.h"
#include "mm-iface-modem-location.h"
-#include "mm-broadband-modem-dell-dw5821e.h"
+#include "mm-broadband-modem-foxconn-t77w968.h"
#if defined WITH_QMI
# include "mm-iface-modem-firmware.h"
@@ -47,7 +47,7 @@ static void iface_modem_firmware_init (MMIfaceModemFirmware *iface);
static MMIfaceModemLocation *iface_modem_location_parent;
-G_DEFINE_TYPE_EXTENDED (MMBroadbandModemDellDw5821e, mm_broadband_modem_dell_dw5821e, MM_TYPE_BROADBAND_MODEM_MBIM, 0,
+G_DEFINE_TYPE_EXTENDED (MMBroadbandModemFoxconnT77w968, mm_broadband_modem_foxconn_t77w968, MM_TYPE_BROADBAND_MODEM_MBIM, 0,
#if defined WITH_QMI
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_FIRMWARE, iface_modem_firmware_init)
#endif
@@ -59,7 +59,7 @@ typedef enum {
FEATURE_SUPPORTED
} FeatureSupport;
-struct _MMBroadbandModemDellDw5821ePrivate {
+struct _MMBroadbandModemFoxconnT77w968Private {
FeatureSupport unmanaged_gps_support;
};
@@ -82,17 +82,17 @@ firmware_load_update_settings_finish (MMIfaceModemFirmware *self,
}
static void
-dell_get_firmware_version_ready (QmiClientDms *client,
- GAsyncResult *res,
- GTask *task)
+foxconn_get_firmware_version_ready (QmiClientDms *client,
+ GAsyncResult *res,
+ GTask *task)
{
- QmiMessageDmsDellGetFirmwareVersionOutput *output;
- GError *error = NULL;
- MMFirmwareUpdateSettings *update_settings = NULL;
- const gchar *str;
+ QmiMessageDmsFoxconnGetFirmwareVersionOutput *output;
+ GError *error = NULL;
+ MMFirmwareUpdateSettings *update_settings = NULL;
+ const gchar *str;
- output = qmi_client_dms_dell_get_firmware_version_finish (client, res, &error);
- if (!output || !qmi_message_dms_dell_get_firmware_version_output_get_result (output, &error))
+ output = qmi_client_dms_foxconn_get_firmware_version_finish (client, res, &error);
+ if (!output || !qmi_message_dms_foxconn_get_firmware_version_output_get_result (output, &error))
goto out;
/* Create update settings now */
@@ -100,7 +100,7 @@ dell_get_firmware_version_ready (QmiClientDms *client,
MM_MODEM_FIRMWARE_UPDATE_METHOD_QMI_PDC);
mm_firmware_update_settings_set_fastboot_at (update_settings, "AT^FASTBOOT");
- qmi_message_dms_dell_get_firmware_version_output_get_version (output, &str, NULL);
+ qmi_message_dms_foxconn_get_firmware_version_output_get_version (output, &str, NULL);
mm_firmware_update_settings_set_version (update_settings, str);
out:
@@ -112,7 +112,7 @@ dell_get_firmware_version_ready (QmiClientDms *client,
}
g_object_unref (task);
if (output)
- qmi_message_dms_dell_get_firmware_version_output_unref (output);
+ qmi_message_dms_foxconn_get_firmware_version_output_unref (output);
}
static void
@@ -120,9 +120,9 @@ firmware_load_update_settings (MMIfaceModemFirmware *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
- GTask *task;
- QmiMessageDmsDellGetFirmwareVersionInput *input = NULL;
- QmiClient *client = NULL;
+ GTask *task;
+ QmiMessageDmsFoxconnGetFirmwareVersionInput *input = NULL;
+ QmiClient *client = NULL;
task = g_task_new (self, NULL, callback, user_data);
@@ -132,22 +132,24 @@ firmware_load_update_settings (MMIfaceModemFirmware *self,
NULL);
if (!client) {
g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
- "Unable to load DW5821e version info: no QMI DMS client available");
+ "Unable to load T77w968 version info: no QMI DMS client available");
g_object_unref (task);
return;
}
- input = qmi_message_dms_dell_get_firmware_version_input_new ();
- qmi_message_dms_dell_get_firmware_version_input_set_version_type (input,
- QMI_DMS_DELL_FIRMWARE_VERSION_TYPE_FIRMWARE_MCFG,
- NULL);
- qmi_client_dms_dell_get_firmware_version (QMI_CLIENT_DMS (client),
- input,
- 10,
- NULL,
- (GAsyncReadyCallback)dell_get_firmware_version_ready,
- task);
- qmi_message_dms_dell_get_firmware_version_input_unref (input);
+ input = qmi_message_dms_foxconn_get_firmware_version_input_new ();
+ qmi_message_dms_foxconn_get_firmware_version_input_set_version_type (
+ input,
+ QMI_DMS_FOXCONN_FIRMWARE_VERSION_TYPE_FIRMWARE_MCFG,
+ NULL);
+ qmi_client_dms_foxconn_get_firmware_version (
+ QMI_CLIENT_DMS (client),
+ input,
+ 10,
+ NULL,
+ (GAsyncReadyCallback)foxconn_get_firmware_version_ready,
+ task);
+ qmi_message_dms_foxconn_get_firmware_version_input_unref (input);
}
#endif
@@ -189,7 +191,7 @@ parent_load_capabilities_ready (MMIfaceModemLocation *self,
/* If we have a GPS port and an AT port, enable unmanaged GPS support */
if (mm_base_modem_peek_port_primary (MM_BASE_MODEM (self)) &&
mm_base_modem_peek_port_gps (MM_BASE_MODEM (self))) {
- MM_BROADBAND_MODEM_DELL_DW5821E (self)->priv->unmanaged_gps_support = FEATURE_SUPPORTED;
+ MM_BROADBAND_MODEM_FOXCONN_T77W968 (self)->priv->unmanaged_gps_support = FEATURE_SUPPORTED;
sources |= MM_MODEM_LOCATION_SOURCE_GPS_UNMANAGED;
}
@@ -248,9 +250,9 @@ parent_disable_location_gathering (GTask *task)
source = GPOINTER_TO_UINT (g_task_get_task_data (task));
iface_modem_location_parent->disable_location_gathering (self,
- source,
- (GAsyncReadyCallback)parent_disable_location_gathering_ready,
- task);
+ source,
+ (GAsyncReadyCallback)parent_disable_location_gathering_ready,
+ task);
}
static void
@@ -275,8 +277,8 @@ disable_location_gathering (MMIfaceModemLocation *_self,
GAsyncReadyCallback callback,
gpointer user_data)
{
- MMBroadbandModemDellDw5821e *self = MM_BROADBAND_MODEM_DELL_DW5821E (_self);
- GTask *task;
+ MMBroadbandModemFoxconnT77w968 *self = MM_BROADBAND_MODEM_FOXCONN_T77W968 (_self);
+ GTask *task;
task = g_task_new (self, NULL, callback, user_data);
g_task_set_task_data (task, GUINT_TO_POINTER (source), NULL);
@@ -326,9 +328,9 @@ parent_enable_location_gathering_ready (MMIfaceModemLocation *_self,
GAsyncResult *res,
GTask *task)
{
- MMBroadbandModemDellDw5821e *self = MM_BROADBAND_MODEM_DELL_DW5821E (_self);
- GError *error = NULL;
- MMModemLocationSource source;
+ MMBroadbandModemFoxconnT77w968 *self = MM_BROADBAND_MODEM_FOXCONN_T77W968 (_self);
+ GError *error = NULL;
+ MMModemLocationSource source;
if (!iface_modem_location_parent->enable_location_gathering_finish (_self, res, &error)) {
g_task_return_error (task, error);
@@ -373,14 +375,14 @@ enable_location_gathering (MMIfaceModemLocation *self,
/*****************************************************************************/
-MMBroadbandModemDellDw5821e *
-mm_broadband_modem_dell_dw5821e_new (const gchar *device,
- const gchar **drivers,
- const gchar *plugin,
- guint16 vendor_id,
- guint16 product_id)
+MMBroadbandModemFoxconnT77w968 *
+mm_broadband_modem_foxconn_t77w968_new (const gchar *device,
+ const gchar **drivers,
+ const gchar *plugin,
+ guint16 vendor_id,
+ guint16 product_id)
{
- return g_object_new (MM_TYPE_BROADBAND_MODEM_DELL_DW5821E,
+ return g_object_new (MM_TYPE_BROADBAND_MODEM_FOXCONN_T77W968,
MM_BASE_MODEM_DEVICE, device,
MM_BASE_MODEM_DRIVERS, drivers,
MM_BASE_MODEM_PLUGIN, plugin,
@@ -390,15 +392,15 @@ mm_broadband_modem_dell_dw5821e_new (const gchar *device,
MM_IFACE_MODEM_SIM_HOT_SWAP_CONFIGURED, FALSE,
MM_IFACE_MODEM_PERIODIC_SIGNAL_CHECK_DISABLED, TRUE,
MM_IFACE_MODEM_LOCATION_ALLOW_GPS_UNMANAGED_ALWAYS, TRUE,
- MM_IFACE_MODEM_CARRIER_CONFIG_MAPPING, PKGDATADIR "/mm-dell-dw5821e-carrier-mapping.conf",
+ MM_IFACE_MODEM_CARRIER_CONFIG_MAPPING, PKGDATADIR "/mm-foxconn-t77w968-carrier-mapping.conf",
NULL);
}
static void
-mm_broadband_modem_dell_dw5821e_init (MMBroadbandModemDellDw5821e *self)
+mm_broadband_modem_foxconn_t77w968_init (MMBroadbandModemFoxconnT77w968 *self)
{
/* Initialize private data */
- self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, MM_TYPE_BROADBAND_MODEM_DELL_DW5821E, MMBroadbandModemDellDw5821ePrivate);
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, MM_TYPE_BROADBAND_MODEM_FOXCONN_T77W968, MMBroadbandModemFoxconnT77w968Private);
self->priv->unmanaged_gps_support = FEATURE_SUPPORT_UNKNOWN;
}
@@ -427,9 +429,9 @@ iface_modem_firmware_init (MMIfaceModemFirmware *iface)
#endif
static void
-mm_broadband_modem_dell_dw5821e_class_init (MMBroadbandModemDellDw5821eClass *klass)
+mm_broadband_modem_foxconn_t77w968_class_init (MMBroadbandModemFoxconnT77w968Class *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (object_class, sizeof (MMBroadbandModemDellDw5821ePrivate));
+ g_type_class_add_private (object_class, sizeof (MMBroadbandModemFoxconnT77w968Private));
}
diff --git a/plugins/foxconn/mm-broadband-modem-foxconn-t77w968.h b/plugins/foxconn/mm-broadband-modem-foxconn-t77w968.h
new file mode 100644
index 00000000..9d145033
--- /dev/null
+++ b/plugins/foxconn/mm-broadband-modem-foxconn-t77w968.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) 2018-2019 Aleksander Morgado <aleksander@aleksander.es>
+ */
+
+#ifndef MM_BROADBAND_MODEM_FOXCONN_T77W968_H
+#define MM_BROADBAND_MODEM_FOXCONN_T77W968_H
+
+#include "mm-broadband-modem-mbim.h"
+
+#define MM_TYPE_BROADBAND_MODEM_FOXCONN_T77W968 (mm_broadband_modem_foxconn_t77w968_get_type ())
+#define MM_BROADBAND_MODEM_FOXCONN_T77W968(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_BROADBAND_MODEM_FOXCONN_T77W968, MMBroadbandModemFoxconnT77w968))
+#define MM_BROADBAND_MODEM_FOXCONN_T77W968_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_BROADBAND_MODEM_FOXCONN_T77W968, MMBroadbandModemFoxconnT77w968Class))
+#define MM_IS_BROADBAND_MODEM_FOXCONN_T77W968(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_BROADBAND_MODEM_FOXCONN_T77W968))
+#define MM_IS_BROADBAND_MODEM_FOXCONN_T77W968_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_BROADBAND_MODEM_FOXCONN_T77W968))
+#define MM_BROADBAND_MODEM_FOXCONN_T77W968_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_BROADBAND_MODEM_FOXCONN_T77W968, MMBroadbandModemFoxconnT77w968Class))
+
+typedef struct _MMBroadbandModemFoxconnT77w968 MMBroadbandModemFoxconnT77w968;
+typedef struct _MMBroadbandModemFoxconnT77w968Class MMBroadbandModemFoxconnT77w968Class;
+typedef struct _MMBroadbandModemFoxconnT77w968Private MMBroadbandModemFoxconnT77w968Private;
+
+struct _MMBroadbandModemFoxconnT77w968 {
+ MMBroadbandModemMbim parent;
+ MMBroadbandModemFoxconnT77w968Private *priv;
+};
+
+struct _MMBroadbandModemFoxconnT77w968Class{
+ MMBroadbandModemMbimClass parent;
+};
+
+GType mm_broadband_modem_foxconn_t77w968_get_type (void);
+
+MMBroadbandModemFoxconnT77w968 *mm_broadband_modem_foxconn_t77w968_new (const gchar *device,
+ const gchar **driver,
+ const gchar *plugin,
+ guint16 vendor_id,
+ guint16 product_id);
+
+#endif /* MM_BROADBAND_MODEM_FOXCONN_T77W968_H */
diff --git a/plugins/dell/mm-dell-dw5821e-carrier-mapping.conf b/plugins/foxconn/mm-foxconn-t77w968-carrier-mapping.conf
index ec14553c..20639f73 100644
--- a/plugins/dell/mm-dell-dw5821e-carrier-mapping.conf
+++ b/plugins/foxconn/mm-foxconn-t77w968-carrier-mapping.conf
@@ -1,13 +1,13 @@
#
-# DW5821e carrier mapping table
+# T77W968 carrier mapping table
#
# This table maps the MCCMNC of the SIM card with the corresponding
# configuration description as reported by the QMI PDC service in
# this module.
#
-[dell dw5821e]
+[foxconn t77w968]
# AT&T
302220=ATT
diff --git a/plugins/foxconn/mm-plugin-foxconn.c b/plugins/foxconn/mm-plugin-foxconn.c
new file mode 100644
index 00000000..5bd2f886
--- /dev/null
+++ b/plugins/foxconn/mm-plugin-foxconn.c
@@ -0,0 +1,127 @@
+/* -*- 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) 2019 Aleksander Morgado <aleksander@aleksander.es>
+ */
+
+#include <string.h>
+#include <gmodule.h>
+
+#define _LIBMM_INSIDE_MM
+#include <libmm-glib.h>
+
+#include "mm-plugin-foxconn.h"
+#include "mm-log.h"
+#include "mm-broadband-modem.h"
+
+#if defined WITH_QMI
+#include "mm-broadband-modem-qmi.h"
+#endif
+
+#if defined WITH_MBIM
+#include "mm-broadband-modem-foxconn-t77w968.h"
+#endif
+
+G_DEFINE_TYPE (MMPluginFoxconn, mm_plugin_foxconn, MM_TYPE_PLUGIN)
+
+MM_PLUGIN_DEFINE_MAJOR_VERSION
+MM_PLUGIN_DEFINE_MINOR_VERSION
+
+/*****************************************************************************/
+
+static MMBaseModem *
+create_modem (MMPlugin *self,
+ const gchar *uid,
+ 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 Foxconn-branded modem found...");
+ return MM_BASE_MODEM (mm_broadband_modem_qmi_new (uid,
+ drivers,
+ mm_plugin_get_name (self),
+ vendor,
+ product));
+ }
+#endif
+
+#if defined WITH_MBIM
+ if (mm_port_probe_list_has_mbim_port (probes)) {
+ /* Specific implementation for the T77W968 */
+ if (product == 0xe0b4 || product == 0xe0b5) {
+ mm_dbg ("MBIM-powered T77W968 modem found...");
+ return MM_BASE_MODEM (mm_broadband_modem_foxconn_t77w968_new (uid,
+ drivers,
+ mm_plugin_get_name (self),
+ vendor,
+ product));
+ }
+
+ mm_dbg ("MBIM-powered Foxconn-branded modem found...");
+ return MM_BASE_MODEM (mm_broadband_modem_mbim_new (uid,
+ drivers,
+ mm_plugin_get_name (self),
+ vendor,
+ product));
+ }
+#endif
+
+ mm_dbg ("Foxconn-branded generic modem found...");
+ return MM_BASE_MODEM (mm_broadband_modem_new (uid,
+ 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 guint16 vendors[] = { 0x0489, 0 };
+
+ return MM_PLUGIN (
+ g_object_new (MM_TYPE_PLUGIN_FOXCONN,
+ MM_PLUGIN_NAME, "Foxconn",
+ MM_PLUGIN_ALLOWED_SUBSYSTEMS, subsystems,
+ MM_PLUGIN_ALLOWED_VENDOR_IDS, vendors,
+ MM_PLUGIN_ALLOWED_AT, TRUE,
+ MM_PLUGIN_ALLOWED_QCDM, TRUE,
+ MM_PLUGIN_ALLOWED_QMI, TRUE,
+ MM_PLUGIN_ALLOWED_MBIM, TRUE,
+ NULL));
+}
+
+static void
+mm_plugin_foxconn_init (MMPluginFoxconn *self)
+{
+}
+
+static void
+mm_plugin_foxconn_class_init (MMPluginFoxconnClass *klass)
+{
+ MMPluginClass *plugin_class = MM_PLUGIN_CLASS (klass);
+
+ plugin_class->create_modem = create_modem;
+}
diff --git a/plugins/foxconn/mm-plugin-foxconn.h b/plugins/foxconn/mm-plugin-foxconn.h
new file mode 100644
index 00000000..4a22ceeb
--- /dev/null
+++ b/plugins/foxconn/mm-plugin-foxconn.h
@@ -0,0 +1,46 @@
+/* -*- 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) 2019 Aleksander Morgado <aleksander@aleksander.es>
+ */
+
+#ifndef MM_PLUGIN_FOXCONN_H
+#define MM_PLUGIN_FOXCONN_H
+
+#include "mm-plugin.h"
+
+#define MM_TYPE_PLUGIN_FOXCONN (mm_plugin_foxconn_get_type ())
+#define MM_PLUGIN_FOXCONN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_PLUGIN_FOXCONN, MMPluginFoxconn))
+#define MM_PLUGIN_FOXCONN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_PLUGIN_FOXCONN, MMPluginFoxconnClass))
+#define MM_IS_PLUGIN_FOXCONN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_PLUGIN_FOXCONN))
+#define MM_IS_PLUGIN_FOXCONN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_PLUGIN_FOXCONN))
+#define MM_PLUGIN_FOXCONN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_PLUGIN_FOXCONN, MMPluginFoxconnClass))
+
+typedef struct {
+ MMPlugin parent;
+} MMPluginFoxconn;
+
+typedef struct {
+ MMPluginClass parent;
+} MMPluginFoxconnClass;
+
+GType mm_plugin_foxconn_get_type (void);
+
+G_MODULE_EXPORT MMPlugin *mm_plugin_create (void);
+
+#endif /* MM_PLUGIN_FOXCONN_H */
diff --git a/plugins/tests/test-keyfiles.c b/plugins/tests/test-keyfiles.c
index c1c740cb..18037f1f 100644
--- a/plugins/tests/test-keyfiles.c
+++ b/plugins/tests/test-keyfiles.c
@@ -43,9 +43,9 @@ common_test (const gchar *keyfile_path)
/************************************************************/
static void
-test_dell_dw5821e (void)
+test_foxconn_t77w968 (void)
{
- common_test (TESTKEYFILE_DELL_DW5821E);
+ common_test (TESTKEYFILE_FOXCONN_T77W968);
}
/************************************************************/
@@ -76,7 +76,7 @@ int main (int argc, char **argv)
g_test_init (&argc, &argv, NULL);
- g_test_add_func ("/MM/test-keyfiles/dell/dw5821e", test_dell_dw5821e);
+ g_test_add_func ("/MM/test-keyfiles/foxconn/t77w968", test_foxconn_t77w968);
return g_test_run ();
}