foxconn: change modem-foxconn-t77w968 to modem-mbim-foxconn

Named the object in a more generic way.
This commit is contained in:
Freedom Liu
2021-04-26 15:19:37 +08:00
parent 7b7bbdd999
commit c31488608a
8 changed files with 91 additions and 91 deletions

View File

@@ -429,8 +429,8 @@ if WITH_MBIM
pkglib_LTLIBRARIES += libmm-shared-foxconn.la pkglib_LTLIBRARIES += libmm-shared-foxconn.la
libmm_shared_foxconn_la_SOURCES = \ libmm_shared_foxconn_la_SOURCES = \
foxconn/mm-shared.c \ foxconn/mm-shared.c \
foxconn/mm-broadband-modem-foxconn-t77w968.c \ foxconn/mm-broadband-modem-mbim-foxconn.c \
foxconn/mm-broadband-modem-foxconn-t77w968.h \ foxconn/mm-broadband-modem-mbim-foxconn.h \
$(NULL) $(NULL)
libmm_shared_foxconn_la_CPPFLAGS = \ libmm_shared_foxconn_la_CPPFLAGS = \
$(SHARED_COMMON_COMPILER_FLAGS) \ $(SHARED_COMMON_COMPILER_FLAGS) \
@@ -716,11 +716,11 @@ libmm_plugin_foxconn_la_LDFLAGS = $(PLUGIN_COMMON_LINKER_FLAGS)
dist_udevrules_DATA += foxconn/77-mm-foxconn-port-types.rules dist_udevrules_DATA += foxconn/77-mm-foxconn-port-types.rules
dist_pkgdata_DATA += foxconn/mm-foxconn-t77w968-carrier-mapping.conf dist_pkgdata_DATA += foxconn/mm-foxconn-carrier-mapping.conf
AM_CFLAGS += \ AM_CFLAGS += \
-DTESTUDEVRULESDIR_FOXCONN=\"${srcdir}/foxconn\" \ -DTESTUDEVRULESDIR_FOXCONN=\"${srcdir}/foxconn\" \
-DTESTKEYFILE_FOXCONN_T77W968=\"${srcdir}/foxconn/mm-foxconn-t77w968-carrier-mapping.conf\" \ -DTESTKEYFILE_FOXCONN=\"${srcdir}/foxconn/mm-foxconn-carrier-mapping.conf\" \
$(NULL) $(NULL)
endif endif

View File

@@ -45,7 +45,7 @@
#if defined WITH_MBIM #if defined WITH_MBIM
#include "mm-broadband-modem-mbim.h" #include "mm-broadband-modem-mbim.h"
#include "mm-broadband-modem-mbim-xmm.h" #include "mm-broadband-modem-mbim-xmm.h"
#include "mm-broadband-modem-foxconn-t77w968.h" #include "mm-broadband-modem-mbim-foxconn.h"
#endif #endif
#define MAX_PORT_PROBE_TIMEOUTS 3 #define MAX_PORT_PROBE_TIMEOUTS 3
@@ -396,11 +396,11 @@ create_modem (MMPlugin *self,
/* Specific implementation for the DW5821e */ /* Specific implementation for the DW5821e */
if (vendor == 0x413c && (product == 0x81d7 || product == 0x81e0)) { if (vendor == 0x413c && (product == 0x81d7 || product == 0x81e0)) {
mm_obj_dbg (self, "MBIM-powered DW5821e (T77W968) modem found..."); mm_obj_dbg (self, "MBIM-powered DW5821e (T77W968) modem found...");
return MM_BASE_MODEM (mm_broadband_modem_foxconn_t77w968_new (uid, return MM_BASE_MODEM (mm_broadband_modem_mbim_foxconn_new (uid,
drivers, drivers,
mm_plugin_get_name (self), mm_plugin_get_name (self),
vendor, vendor,
product)); product));
} }
if (mm_port_probe_list_is_xmm (probes)) { if (mm_port_probe_list_is_xmm (probes)) {

View File

@@ -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-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 */

View File

@@ -31,7 +31,7 @@
#include "mm-base-modem-at.h" #include "mm-base-modem-at.h"
#include "mm-iface-modem.h" #include "mm-iface-modem.h"
#include "mm-iface-modem-location.h" #include "mm-iface-modem-location.h"
#include "mm-broadband-modem-foxconn-t77w968.h" #include "mm-broadband-modem-mbim-foxconn.h"
#if defined WITH_QMI #if defined WITH_QMI
# include "mm-iface-modem-firmware.h" # include "mm-iface-modem-firmware.h"
@@ -46,7 +46,7 @@ static void iface_modem_firmware_init (MMIfaceModemFirmware *iface);
static MMIfaceModemLocation *iface_modem_location_parent; static MMIfaceModemLocation *iface_modem_location_parent;
G_DEFINE_TYPE_EXTENDED (MMBroadbandModemFoxconnT77w968, mm_broadband_modem_foxconn_t77w968, MM_TYPE_BROADBAND_MODEM_MBIM, 0, G_DEFINE_TYPE_EXTENDED (MMBroadbandModemMbimFoxconn, mm_broadband_modem_mbim_foxconn, MM_TYPE_BROADBAND_MODEM_MBIM, 0,
#if defined WITH_QMI #if defined WITH_QMI
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_FIRMWARE, iface_modem_firmware_init) G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_FIRMWARE, iface_modem_firmware_init)
#endif #endif
@@ -58,7 +58,7 @@ typedef enum {
FEATURE_SUPPORTED FEATURE_SUPPORTED
} FeatureSupport; } FeatureSupport;
struct _MMBroadbandModemFoxconnT77w968Private { struct _MMBroadbandModemMbimFoxconnPrivate {
FeatureSupport unmanaged_gps_support; FeatureSupport unmanaged_gps_support;
}; };
@@ -131,7 +131,7 @@ firmware_load_update_settings (MMIfaceModemFirmware *self,
NULL); NULL);
if (!client) { if (!client) {
g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_FAILED, g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
"Unable to load T77w968 version info: no QMI DMS client available"); "Unable to load version info: no QMI DMS client available");
g_object_unref (task); g_object_unref (task);
return; return;
} }
@@ -159,7 +159,7 @@ firmware_load_update_settings (MMIfaceModemFirmware *self,
static MMModemLocationSource static MMModemLocationSource
location_load_capabilities_finish (MMIfaceModemLocation *self, location_load_capabilities_finish (MMIfaceModemLocation *self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
GError *inner_error = NULL; GError *inner_error = NULL;
gssize value; gssize value;
@@ -190,7 +190,7 @@ parent_load_capabilities_ready (MMIfaceModemLocation *self,
/* If we have a GPS port and an AT port, enable unmanaged GPS support */ /* 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)) && if (mm_base_modem_peek_port_primary (MM_BASE_MODEM (self)) &&
mm_base_modem_peek_port_gps (MM_BASE_MODEM (self))) { mm_base_modem_peek_port_gps (MM_BASE_MODEM (self))) {
MM_BROADBAND_MODEM_FOXCONN_T77W968 (self)->priv->unmanaged_gps_support = FEATURE_SUPPORTED; MM_BROADBAND_MODEM_MBIM_FOXCONN (self)->priv->unmanaged_gps_support = FEATURE_SUPPORTED;
sources |= MM_MODEM_LOCATION_SOURCE_GPS_UNMANAGED; sources |= MM_MODEM_LOCATION_SOURCE_GPS_UNMANAGED;
} }
@@ -276,8 +276,8 @@ disable_location_gathering (MMIfaceModemLocation *_self,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
MMBroadbandModemFoxconnT77w968 *self = MM_BROADBAND_MODEM_FOXCONN_T77W968 (_self); MMBroadbandModemMbimFoxconn *self = MM_BROADBAND_MODEM_MBIM_FOXCONN (_self);
GTask *task; GTask *task;
task = g_task_new (self, NULL, callback, user_data); task = g_task_new (self, NULL, callback, user_data);
g_task_set_task_data (task, GUINT_TO_POINTER (source), NULL); g_task_set_task_data (task, GUINT_TO_POINTER (source), NULL);
@@ -327,9 +327,9 @@ parent_enable_location_gathering_ready (MMIfaceModemLocation *_self,
GAsyncResult *res, GAsyncResult *res,
GTask *task) GTask *task)
{ {
MMBroadbandModemFoxconnT77w968 *self = MM_BROADBAND_MODEM_FOXCONN_T77W968 (_self); MMBroadbandModemMbimFoxconn *self = MM_BROADBAND_MODEM_MBIM_FOXCONN (_self);
GError *error = NULL; GError *error = NULL;
MMModemLocationSource source; MMModemLocationSource source;
if (!iface_modem_location_parent->enable_location_gathering_finish (_self, res, &error)) { if (!iface_modem_location_parent->enable_location_gathering_finish (_self, res, &error)) {
g_task_return_error (task, error); g_task_return_error (task, error);
@@ -374,14 +374,14 @@ enable_location_gathering (MMIfaceModemLocation *self,
/*****************************************************************************/ /*****************************************************************************/
MMBroadbandModemFoxconnT77w968 * MMBroadbandModemMbimFoxconn *
mm_broadband_modem_foxconn_t77w968_new (const gchar *device, mm_broadband_modem_mbim_foxconn_new (const gchar *device,
const gchar **drivers, const gchar **drivers,
const gchar *plugin, const gchar *plugin,
guint16 vendor_id, guint16 vendor_id,
guint16 product_id) guint16 product_id)
{ {
return g_object_new (MM_TYPE_BROADBAND_MODEM_FOXCONN_T77W968, return g_object_new (MM_TYPE_BROADBAND_MODEM_MBIM_FOXCONN,
MM_BASE_MODEM_DEVICE, device, MM_BASE_MODEM_DEVICE, device,
MM_BASE_MODEM_DRIVERS, drivers, MM_BASE_MODEM_DRIVERS, drivers,
MM_BASE_MODEM_PLUGIN, plugin, MM_BASE_MODEM_PLUGIN, plugin,
@@ -394,15 +394,15 @@ mm_broadband_modem_foxconn_t77w968_new (const gchar *device,
MM_IFACE_MODEM_SIM_HOT_SWAP_CONFIGURED, FALSE, MM_IFACE_MODEM_SIM_HOT_SWAP_CONFIGURED, FALSE,
MM_IFACE_MODEM_PERIODIC_SIGNAL_CHECK_DISABLED, TRUE, MM_IFACE_MODEM_PERIODIC_SIGNAL_CHECK_DISABLED, TRUE,
MM_IFACE_MODEM_LOCATION_ALLOW_GPS_UNMANAGED_ALWAYS, TRUE, MM_IFACE_MODEM_LOCATION_ALLOW_GPS_UNMANAGED_ALWAYS, TRUE,
MM_IFACE_MODEM_CARRIER_CONFIG_MAPPING, PKGDATADIR "/mm-foxconn-t77w968-carrier-mapping.conf", MM_IFACE_MODEM_CARRIER_CONFIG_MAPPING, PKGDATADIR "/mm-foxconn-carrier-mapping.conf",
NULL); NULL);
} }
static void static void
mm_broadband_modem_foxconn_t77w968_init (MMBroadbandModemFoxconnT77w968 *self) mm_broadband_modem_mbim_foxconn_init (MMBroadbandModemMbimFoxconn *self)
{ {
/* Initialize private data */ /* Initialize private data */
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, MM_TYPE_BROADBAND_MODEM_FOXCONN_T77W968, MMBroadbandModemFoxconnT77w968Private); self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, MM_TYPE_BROADBAND_MODEM_MBIM_FOXCONN, MMBroadbandModemMbimFoxconnPrivate);
self->priv->unmanaged_gps_support = FEATURE_SUPPORT_UNKNOWN; self->priv->unmanaged_gps_support = FEATURE_SUPPORT_UNKNOWN;
} }
@@ -431,9 +431,9 @@ iface_modem_firmware_init (MMIfaceModemFirmware *iface)
#endif #endif
static void static void
mm_broadband_modem_foxconn_t77w968_class_init (MMBroadbandModemFoxconnT77w968Class *klass) mm_broadband_modem_mbim_foxconn_class_init (MMBroadbandModemMbimFoxconnClass *klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (object_class, sizeof (MMBroadbandModemFoxconnT77w968Private)); g_type_class_add_private (object_class, sizeof (MMBroadbandModemMbimFoxconnPrivate));
} }

View File

@@ -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_MBIM_FOXCONN_H
#define MM_BROADBAND_MODEM_MBIM_FOXCONN_H
#include "mm-broadband-modem-mbim.h"
#define MM_TYPE_BROADBAND_MODEM_MBIM_FOXCONN (mm_broadband_modem_mbim_foxconn_get_type ())
#define MM_BROADBAND_MODEM_MBIM_FOXCONN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_BROADBAND_MODEM_MBIM_FOXCONN, MMBroadbandModemMbimFoxconn))
#define MM_BROADBAND_MODEM_MBIM_FOXCONN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_BROADBAND_MODEM_MBIM_FOXCONN, MMBroadbandModemMbimFoxconnClass))
#define MM_IS_BROADBAND_MODEM_MBIM_FOXCONN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_BROADBAND_MODEM_MBIM_FOXCONN))
#define MM_IS_BROADBAND_MODEM_MBIM_FOXCONN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_BROADBAND_MODEM_MBIM_FOXCONN))
#define MM_BROADBAND_MODEM_MBIM_FOXCONN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_BROADBAND_MODEM_MBIM_FOXCONN, MMBroadbandModemMbimFoxconnClass))
typedef struct _MMBroadbandModemMbimFoxconn MMBroadbandModemMbimFoxconn;
typedef struct _MMBroadbandModemMbimFoxconnClass MMBroadbandModemMbimFoxconnClass;
typedef struct _MMBroadbandModemMbimFoxconnPrivate MMBroadbandModemMbimFoxconnPrivate;
struct _MMBroadbandModemMbimFoxconn {
MMBroadbandModemMbim parent;
MMBroadbandModemMbimFoxconnPrivate *priv;
};
struct _MMBroadbandModemMbimFoxconnClass{
MMBroadbandModemMbimClass parent;
};
GType mm_broadband_modem_mbim_foxconn_get_type (void);
MMBroadbandModemMbimFoxconn *mm_broadband_modem_mbim_foxconn_new (const gchar *device,
const gchar **driver,
const gchar *plugin,
guint16 vendor_id,
guint16 product_id);
#endif /* MM_BROADBAND_MODEM_MBIM_FOXCONN_H */

View File

@@ -34,7 +34,7 @@
#endif #endif
#if defined WITH_MBIM #if defined WITH_MBIM
#include "mm-broadband-modem-foxconn-t77w968.h" #include "mm-broadband-modem-mbim-foxconn.h"
#endif #endif
G_DEFINE_TYPE (MMPluginFoxconn, mm_plugin_foxconn, MM_TYPE_PLUGIN) G_DEFINE_TYPE (MMPluginFoxconn, mm_plugin_foxconn, MM_TYPE_PLUGIN)
@@ -69,11 +69,11 @@ create_modem (MMPlugin *self,
/* Specific implementation for the T77W968 */ /* Specific implementation for the T77W968 */
if (product == 0xe0b4 || product == 0xe0b5) { if (product == 0xe0b4 || product == 0xe0b5) {
mm_obj_dbg (self, "MBIM-powered T77W968 modem found..."); mm_obj_dbg (self, "MBIM-powered T77W968 modem found...");
return MM_BASE_MODEM (mm_broadband_modem_foxconn_t77w968_new (uid, return MM_BASE_MODEM (mm_broadband_modem_mbim_foxconn_new (uid,
drivers, drivers,
mm_plugin_get_name (self), mm_plugin_get_name (self),
vendor, vendor,
product)); product));
} }
mm_obj_dbg (self, "MBIM-powered Foxconn-branded modem found..."); mm_obj_dbg (self, "MBIM-powered Foxconn-branded modem found...");

View File

@@ -56,9 +56,9 @@ test_dummy (void)
#if defined ENABLE_PLUGIN_FOXCONN #if defined ENABLE_PLUGIN_FOXCONN
static void static void
test_foxconn_t77w968 (void) test_foxconn (void)
{ {
common_test (TESTKEYFILE_FOXCONN_T77W968); common_test (TESTKEYFILE_FOXCONN);
} }
#endif #endif
@@ -72,7 +72,7 @@ int main (int argc, char **argv)
g_test_add_func ("/MM/test-keyfiles/dummy", test_dummy); g_test_add_func ("/MM/test-keyfiles/dummy", test_dummy);
#if defined ENABLE_PLUGIN_FOXCONN #if defined ENABLE_PLUGIN_FOXCONN
g_test_add_func ("/MM/test-keyfiles/foxconn/t77w968", test_foxconn_t77w968); g_test_add_func ("/MM/test-keyfiles/foxconn", test_foxconn);
#endif #endif
return g_test_run (); return g_test_run ();