fibocom: remove custom logic to power down modem before initial EPS bearer settings update
This is now done for all modems unconditionally.
This commit is contained in:
@@ -8,9 +8,6 @@ LABEL="mm_fibocom_port_types"
|
||||
|
||||
SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}=="?*", ENV{.MM_USBIFNUM}="$attr{bInterfaceNumber}"
|
||||
|
||||
# Fibocom L850-GL attach APN with toggle modem power
|
||||
ATTRS{idVendor}=="2cb7", ATTRS{idProduct}=="0007", ENV{ID_MM_FIBOCOM_INITIAL_EPS_OFF_ON}="1"
|
||||
|
||||
# Fibocom L850-GL
|
||||
# ttyACM0 (if #2): AT port
|
||||
# ttyACM1 (if #4): debug port (ignore)
|
||||
@@ -70,8 +67,6 @@ ATTRS{idVendor}=="2cb7", ATTRS{idProduct}=="0115", ENV{.MM_USBIFNUM}=="03", SUBS
|
||||
ATTRS{idVendor}=="2cb7", ATTRS{idProduct}=="0115", ENV{.MM_USBIFNUM}=="02", ENV{ID_MM_PORT_IGNORE}="1"
|
||||
ATTRS{idVendor}=="2cb7", ATTRS{idProduct}=="0115", ENV{.MM_USBIFNUM}=="04", ENV{ID_MM_PORT_IGNORE}="1"
|
||||
ATTRS{idVendor}=="2cb7", ATTRS{idProduct}=="0115", ENV{.MM_USBIFNUM}=="05", ENV{ID_MM_PORT_IGNORE}="1"
|
||||
# Fibocom FM135 attach APN with toggle modem power
|
||||
#ATTRS{idVendor}=="2cb7", ATTRS{idProduct}=="0115", ENV{ID_MM_FIBOCOM_INITIAL_EPS_OFF_ON}="1"
|
||||
|
||||
# Fibocom MA510-GL (GTUSBMODE=31)
|
||||
# ttyUSB0 (if #0): debug port (ignore)
|
||||
|
||||
@@ -31,7 +31,6 @@ static void iface_modem_3gpp_profile_manager_init (MMIfaceModem3gppProfileManage
|
||||
static void iface_modem_firmware_init (MMIfaceModemFirmwareInterface *iface);
|
||||
static void shared_fibocom_init (MMSharedFibocomInterface *iface);
|
||||
|
||||
static MMIfaceModem3gppInterface *iface_modem_3gpp_parent;
|
||||
static MMIfaceModem3gppProfileManagerInterface *iface_modem_3gpp_profile_manager_parent;
|
||||
|
||||
G_DEFINE_TYPE_EXTENDED (MMBroadbandModemFibocom, mm_broadband_modem_fibocom, MM_TYPE_BROADBAND_MODEM, 0,
|
||||
@@ -380,28 +379,7 @@ modem_3gpp_load_initial_eps_bearer_settings (MMIfaceModem3gpp *_self,
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Set initial EPS bearer settings */
|
||||
|
||||
typedef enum {
|
||||
SET_INITIAL_EPS_BEARER_SETTINGS_STEP_LOAD_POWER_STATE = 0,
|
||||
SET_INITIAL_EPS_BEARER_SETTINGS_STEP_POWER_DOWN,
|
||||
SET_INITIAL_EPS_BEARER_SETTINGS_STEP_MODIFY_PROFILE,
|
||||
SET_INITIAL_EPS_BEARER_SETTINGS_STEP_POWER_UP,
|
||||
SET_INITIAL_EPS_BEARER_SETTINGS_STEP_FINISH,
|
||||
} SetInitialEpsStep;
|
||||
|
||||
typedef struct {
|
||||
MM3gppProfile *profile;
|
||||
SetInitialEpsStep step;
|
||||
MMModemPowerState power_state;
|
||||
} SetInitialEpsContext;
|
||||
|
||||
static void
|
||||
set_initial_eps_context_free (SetInitialEpsContext *ctx)
|
||||
{
|
||||
g_object_unref (ctx->profile);
|
||||
g_slice_free (SetInitialEpsContext, ctx);
|
||||
}
|
||||
/* Set initial EPS bearer settings */
|
||||
|
||||
static gboolean
|
||||
modem_3gpp_set_initial_eps_bearer_settings_finish (MMIfaceModem3gpp *self,
|
||||
@@ -411,160 +389,20 @@ modem_3gpp_set_initial_eps_bearer_settings_finish (MMIfaceModem3gpp *self,
|
||||
return g_task_propagate_boolean (G_TASK (res), error);
|
||||
}
|
||||
|
||||
static void set_initial_eps_step (GTask *task);
|
||||
|
||||
static void
|
||||
set_initial_eps_bearer_power_up_ready (MMBaseModem *_self,
|
||||
GAsyncResult *res,
|
||||
GTask *task)
|
||||
{
|
||||
MMBroadbandModemFibocom *self = MM_BROADBAND_MODEM_FIBOCOM (_self);
|
||||
SetInitialEpsContext *ctx;
|
||||
GError *error = NULL;
|
||||
|
||||
ctx = g_task_get_task_data (task);
|
||||
|
||||
if (!MM_IFACE_MODEM_GET_IFACE (self)->modem_power_up_finish (MM_IFACE_MODEM (self), res, &error)) {
|
||||
g_prefix_error (&error, "Couldn't power up modem: ");
|
||||
g_task_return_error (task, error);
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
|
||||
ctx->step++;
|
||||
set_initial_eps_step (task);
|
||||
}
|
||||
|
||||
static void
|
||||
set_initial_eps_bearer_modify_profile_ready (MMIfaceModem3gppProfileManager *self,
|
||||
GAsyncResult *res,
|
||||
GTask *task)
|
||||
{
|
||||
GError *error = NULL;
|
||||
SetInitialEpsContext *ctx;
|
||||
g_autoptr(MM3gppProfile) stored = NULL;
|
||||
|
||||
ctx = g_task_get_task_data (task);
|
||||
|
||||
stored = mm_iface_modem_3gpp_profile_manager_set_profile_finish (self, res, &error);
|
||||
if (!stored) {
|
||||
if (!stored)
|
||||
g_task_return_error (task, error);
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
|
||||
ctx->step++;
|
||||
set_initial_eps_step (task);
|
||||
}
|
||||
|
||||
static void
|
||||
set_initial_eps_bearer_power_down_ready (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
GTask *task)
|
||||
{
|
||||
SetInitialEpsContext *ctx;
|
||||
GError *error = NULL;
|
||||
|
||||
ctx = g_task_get_task_data (task);
|
||||
|
||||
if (!MM_IFACE_MODEM_GET_IFACE (self)->modem_power_down_finish (MM_IFACE_MODEM (self), res, &error)) {
|
||||
g_prefix_error (&error, "Couldn't power down modem: ");
|
||||
g_task_return_error (task, error);
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
|
||||
ctx->step++;
|
||||
set_initial_eps_step (task);
|
||||
}
|
||||
|
||||
static void
|
||||
set_initial_eps_bearer_load_power_state_ready (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
GTask *task)
|
||||
{
|
||||
SetInitialEpsContext *ctx;
|
||||
GError *error = NULL;
|
||||
|
||||
ctx = g_task_get_task_data (task);
|
||||
|
||||
ctx->power_state = MM_IFACE_MODEM_GET_IFACE (self)->load_power_state_finish (MM_IFACE_MODEM (self), res, &error);
|
||||
if (error) {
|
||||
g_task_return_error (task, error);
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
|
||||
ctx->step++;
|
||||
set_initial_eps_step (task);
|
||||
}
|
||||
|
||||
static void
|
||||
set_initial_eps_step (GTask *task)
|
||||
{
|
||||
MMBroadbandModemFibocom *self;
|
||||
SetInitialEpsContext *ctx;
|
||||
|
||||
self = g_task_get_source_object (task);
|
||||
ctx = g_task_get_task_data (task);
|
||||
|
||||
switch (ctx->step) {
|
||||
case SET_INITIAL_EPS_BEARER_SETTINGS_STEP_LOAD_POWER_STATE:
|
||||
mm_obj_dbg (self, "querying current power state...");
|
||||
g_assert (MM_IFACE_MODEM_GET_IFACE (self)->load_power_state);
|
||||
g_assert (MM_IFACE_MODEM_GET_IFACE (self)->load_power_state_finish);
|
||||
MM_IFACE_MODEM_GET_IFACE (self)->load_power_state (
|
||||
MM_IFACE_MODEM (self),
|
||||
(GAsyncReadyCallback) set_initial_eps_bearer_load_power_state_ready,
|
||||
task);
|
||||
return;
|
||||
|
||||
case SET_INITIAL_EPS_BEARER_SETTINGS_STEP_POWER_DOWN:
|
||||
if (ctx->power_state == MM_MODEM_POWER_STATE_ON) {
|
||||
mm_obj_dbg (self, "powering down before changing initial EPS bearer settings...");
|
||||
g_assert (MM_IFACE_MODEM_GET_IFACE (self)->modem_power_down);
|
||||
g_assert (MM_IFACE_MODEM_GET_IFACE (self)->modem_power_down_finish);
|
||||
MM_IFACE_MODEM_GET_IFACE (self)->modem_power_down (
|
||||
MM_IFACE_MODEM (self),
|
||||
(GAsyncReadyCallback) set_initial_eps_bearer_power_down_ready,
|
||||
task);
|
||||
return;
|
||||
}
|
||||
ctx->step++;
|
||||
/* fall through */
|
||||
|
||||
case SET_INITIAL_EPS_BEARER_SETTINGS_STEP_MODIFY_PROFILE:
|
||||
mm_obj_dbg (self, "modifying initial EPS bearer settings profile...");
|
||||
mm_iface_modem_3gpp_profile_manager_set_profile (MM_IFACE_MODEM_3GPP_PROFILE_MANAGER (self),
|
||||
ctx->profile,
|
||||
"profile-id",
|
||||
TRUE,
|
||||
(GAsyncReadyCallback) set_initial_eps_bearer_modify_profile_ready,
|
||||
task);
|
||||
return;
|
||||
|
||||
case SET_INITIAL_EPS_BEARER_SETTINGS_STEP_POWER_UP:
|
||||
if (ctx->power_state == MM_MODEM_POWER_STATE_ON) {
|
||||
mm_obj_dbg (self, "powering up after changing initial EPS bearer settings...");
|
||||
g_assert (MM_IFACE_MODEM_GET_IFACE (self)->modem_power_up);
|
||||
g_assert (MM_IFACE_MODEM_GET_IFACE (self)->modem_power_up_finish);
|
||||
MM_IFACE_MODEM_GET_IFACE (self)->modem_power_up (
|
||||
MM_IFACE_MODEM (self),
|
||||
(GAsyncReadyCallback) set_initial_eps_bearer_power_up_ready,
|
||||
task);
|
||||
return;
|
||||
}
|
||||
ctx->step++;
|
||||
/* fall through */
|
||||
|
||||
case SET_INITIAL_EPS_BEARER_SETTINGS_STEP_FINISH:
|
||||
else
|
||||
g_task_return_boolean (task, TRUE);
|
||||
g_object_unref (task);
|
||||
return;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -575,16 +413,13 @@ modem_3gpp_set_initial_eps_bearer_settings (MMIfaceModem3gpp *_self,
|
||||
{
|
||||
MMBroadbandModemFibocom *self = MM_BROADBAND_MODEM_FIBOCOM (_self);
|
||||
GTask *task;
|
||||
MM3gppProfile *profile;
|
||||
MMBearerIpFamily ip_family;
|
||||
SetInitialEpsContext *ctx;
|
||||
MM3gppProfile *profile;
|
||||
|
||||
task = g_task_new (self, NULL, callback, user_data);
|
||||
|
||||
if (self->priv->initial_eps_bearer_support != FEATURE_SUPPORTED) {
|
||||
g_task_return_new_error (task,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_UNSUPPORTED,
|
||||
g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
|
||||
"Initial EPS bearer context ID unknown");
|
||||
g_object_unref (task);
|
||||
return;
|
||||
@@ -597,13 +432,12 @@ modem_3gpp_set_initial_eps_bearer_settings (MMIfaceModem3gpp *_self,
|
||||
if (ip_family == MM_BEARER_IP_FAMILY_NONE || ip_family == MM_BEARER_IP_FAMILY_ANY)
|
||||
mm_3gpp_profile_set_ip_type (profile, MM_BEARER_IP_FAMILY_IPV4);
|
||||
|
||||
/* Setup context */
|
||||
ctx = g_slice_new0 (SetInitialEpsContext);
|
||||
ctx->profile = g_object_ref (profile);
|
||||
ctx->step = SET_INITIAL_EPS_BEARER_SETTINGS_STEP_LOAD_POWER_STATE;
|
||||
g_task_set_task_data (task, ctx, (GDestroyNotify) set_initial_eps_context_free);
|
||||
|
||||
set_initial_eps_step (task);
|
||||
mm_iface_modem_3gpp_profile_manager_set_profile (MM_IFACE_MODEM_3GPP_PROFILE_MANAGER (self),
|
||||
profile,
|
||||
"profile-id",
|
||||
TRUE,
|
||||
(GAsyncReadyCallback) set_initial_eps_bearer_modify_profile_ready,
|
||||
task);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -709,8 +543,6 @@ iface_modem_init (MMIfaceModemInterface *iface)
|
||||
static void
|
||||
iface_modem_3gpp_init (MMIfaceModem3gppInterface *iface)
|
||||
{
|
||||
iface_modem_3gpp_parent = g_type_interface_peek_parent (iface);
|
||||
|
||||
iface->load_initial_eps_bearer = modem_3gpp_load_initial_eps_bearer;
|
||||
iface->load_initial_eps_bearer_finish = modem_3gpp_load_initial_eps_bearer_finish;
|
||||
iface->load_initial_eps_bearer_settings = modem_3gpp_load_initial_eps_bearer_settings;
|
||||
@@ -741,17 +573,10 @@ peek_parent_class (MMSharedFibocom *self)
|
||||
return MM_BASE_MODEM_CLASS (mm_broadband_modem_fibocom_parent_class);
|
||||
}
|
||||
|
||||
static MMIfaceModem3gppInterface *
|
||||
peek_parent_3gpp_interface (MMSharedFibocom *self)
|
||||
{
|
||||
return iface_modem_3gpp_parent;
|
||||
}
|
||||
|
||||
static void
|
||||
shared_fibocom_init (MMSharedFibocomInterface *iface)
|
||||
{
|
||||
iface->peek_parent_class = peek_parent_class;
|
||||
iface->peek_parent_3gpp_interface = peek_parent_3gpp_interface;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -24,18 +24,13 @@
|
||||
#include "ModemManager.h"
|
||||
#include "mm-log-object.h"
|
||||
#include "mm-iface-modem.h"
|
||||
#include "mm-iface-modem-3gpp.h"
|
||||
#include "mm-broadband-modem-mbim-fibocom.h"
|
||||
#include "mm-shared-fibocom.h"
|
||||
|
||||
static void iface_modem_3gpp_init (MMIfaceModem3gppInterface *iface);
|
||||
static void shared_fibocom_init (MMSharedFibocomInterface *iface);
|
||||
static void iface_modem_firmware_init (MMIfaceModemFirmwareInterface *iface);
|
||||
|
||||
static MMIfaceModem3gppInterface *iface_modem_3gpp_parent;
|
||||
|
||||
G_DEFINE_TYPE_EXTENDED (MMBroadbandModemMbimFibocom, mm_broadband_modem_mbim_fibocom, MM_TYPE_BROADBAND_MODEM_MBIM, 0,
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_3GPP, iface_modem_3gpp_init)
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_SHARED_FIBOCOM, shared_fibocom_init)
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_FIRMWARE, iface_modem_firmware_init))
|
||||
|
||||
@@ -69,15 +64,6 @@ mm_broadband_modem_mbim_fibocom_init (MMBroadbandModemMbimFibocom *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
iface_modem_3gpp_init (MMIfaceModem3gppInterface *iface)
|
||||
{
|
||||
iface_modem_3gpp_parent = g_type_interface_peek_parent (iface);
|
||||
|
||||
iface->set_initial_eps_bearer_settings = mm_shared_fibocom_set_initial_eps_bearer_settings;
|
||||
iface->set_initial_eps_bearer_settings_finish = mm_shared_fibocom_set_initial_eps_bearer_settings_finish;
|
||||
}
|
||||
|
||||
static void
|
||||
iface_modem_firmware_init (MMIfaceModemFirmwareInterface *iface)
|
||||
{
|
||||
@@ -91,17 +77,10 @@ peek_parent_class (MMSharedFibocom *self)
|
||||
return MM_BASE_MODEM_CLASS (mm_broadband_modem_mbim_fibocom_parent_class);
|
||||
}
|
||||
|
||||
static MMIfaceModem3gppInterface *
|
||||
peek_parent_3gpp_interface (MMSharedFibocom *self)
|
||||
{
|
||||
return iface_modem_3gpp_parent;
|
||||
}
|
||||
|
||||
static void
|
||||
shared_fibocom_init (MMSharedFibocomInterface *iface)
|
||||
{
|
||||
iface->peek_parent_class = peek_parent_class;
|
||||
iface->peek_parent_3gpp_interface = peek_parent_3gpp_interface;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -24,18 +24,13 @@
|
||||
#include "ModemManager.h"
|
||||
#include "mm-log-object.h"
|
||||
#include "mm-iface-modem.h"
|
||||
#include "mm-iface-modem-3gpp.h"
|
||||
#include "mm-broadband-modem-mbim-xmm-fibocom.h"
|
||||
#include "mm-shared-fibocom.h"
|
||||
|
||||
static void iface_modem_3gpp_init (MMIfaceModem3gppInterface *iface);
|
||||
static void shared_fibocom_init (MMSharedFibocomInterface *iface);
|
||||
static void iface_modem_firmware_init (MMIfaceModemFirmwareInterface *iface);
|
||||
|
||||
static MMIfaceModem3gppInterface *iface_modem_3gpp_parent;
|
||||
|
||||
G_DEFINE_TYPE_EXTENDED (MMBroadbandModemMbimXmmFibocom, mm_broadband_modem_mbim_xmm_fibocom, MM_TYPE_BROADBAND_MODEM_MBIM_XMM, 0,
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_3GPP, iface_modem_3gpp_init)
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_SHARED_FIBOCOM, shared_fibocom_init)
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_FIRMWARE, iface_modem_firmware_init))
|
||||
|
||||
@@ -72,15 +67,6 @@ mm_broadband_modem_mbim_xmm_fibocom_init (MMBroadbandModemMbimXmmFibocom *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
iface_modem_3gpp_init (MMIfaceModem3gppInterface *iface)
|
||||
{
|
||||
iface_modem_3gpp_parent = g_type_interface_peek_parent (iface);
|
||||
|
||||
iface->set_initial_eps_bearer_settings = mm_shared_fibocom_set_initial_eps_bearer_settings;
|
||||
iface->set_initial_eps_bearer_settings_finish = mm_shared_fibocom_set_initial_eps_bearer_settings_finish;
|
||||
}
|
||||
|
||||
static void
|
||||
iface_modem_firmware_init (MMIfaceModemFirmwareInterface *iface)
|
||||
{
|
||||
@@ -94,17 +80,10 @@ peek_parent_class (MMSharedFibocom *self)
|
||||
return MM_BASE_MODEM_CLASS (mm_broadband_modem_mbim_xmm_fibocom_parent_class);
|
||||
}
|
||||
|
||||
static MMIfaceModem3gppInterface *
|
||||
peek_parent_3gpp_interface (MMSharedFibocom *self)
|
||||
{
|
||||
return iface_modem_3gpp_parent;
|
||||
}
|
||||
|
||||
static void
|
||||
shared_fibocom_init (MMSharedFibocomInterface *iface)
|
||||
{
|
||||
iface->peek_parent_class = peek_parent_class;
|
||||
iface->peek_parent_3gpp_interface = peek_parent_3gpp_interface;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include "mm-broadband-modem.h"
|
||||
#include "mm-broadband-modem-mbim.h"
|
||||
#include "mm-iface-modem.h"
|
||||
#include "mm-iface-modem-3gpp.h"
|
||||
#include "mm-shared-fibocom.h"
|
||||
#include "mm-port-mbim-fibocom.h"
|
||||
#include "mm-base-modem-at.h"
|
||||
@@ -42,8 +41,6 @@ static GQuark private_quark;
|
||||
typedef struct {
|
||||
/* Parent class */
|
||||
MMBaseModemClass *class_parent;
|
||||
/* 3GPP interface support */
|
||||
MMIfaceModem3gppInterface *iface_modem_3gpp_parent;
|
||||
/* URCs to ignore */
|
||||
GRegex *sim_ready_regex;
|
||||
} Private;
|
||||
@@ -74,10 +71,6 @@ get_private (MMSharedFibocom *self)
|
||||
g_assert (MM_SHARED_FIBOCOM_GET_IFACE (self)->peek_parent_class);
|
||||
priv->class_parent = MM_SHARED_FIBOCOM_GET_IFACE (self)->peek_parent_class (self);
|
||||
|
||||
/* Setup parent class' MMIfaceModem3gpp */
|
||||
g_assert (MM_SHARED_FIBOCOM_GET_IFACE (self)->peek_parent_3gpp_interface);
|
||||
priv->iface_modem_3gpp_parent = MM_SHARED_FIBOCOM_GET_IFACE (self)->peek_parent_3gpp_interface (self);
|
||||
|
||||
g_object_set_qdata_full (G_OBJECT (self), private_quark, priv, (GDestroyNotify)private_free);
|
||||
}
|
||||
|
||||
@@ -151,167 +144,6 @@ mm_shared_fibocom_setup_ports (MMBroadbandModem *self)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
MMBearerProperties *config;
|
||||
gboolean initial_eps_off_on;
|
||||
GError *saved_error;
|
||||
} SetInitialEpsBearerSettingsContext;
|
||||
|
||||
static void
|
||||
set_initial_eps_bearer_settings_context_free (SetInitialEpsBearerSettingsContext *ctx)
|
||||
{
|
||||
g_clear_error (&ctx->saved_error);
|
||||
g_clear_object (&ctx->config);
|
||||
g_slice_free (SetInitialEpsBearerSettingsContext, ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
set_initial_eps_bearer_settings_complete (GTask *task)
|
||||
{
|
||||
SetInitialEpsBearerSettingsContext *ctx;
|
||||
|
||||
ctx = g_task_get_task_data (task);
|
||||
if (ctx->saved_error)
|
||||
g_task_return_error (task, g_steal_pointer (&ctx->saved_error));
|
||||
else
|
||||
g_task_return_boolean (task, TRUE);
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
gboolean
|
||||
mm_shared_fibocom_set_initial_eps_bearer_settings_finish (MMIfaceModem3gpp *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
return g_task_propagate_boolean (G_TASK (res), error);
|
||||
}
|
||||
|
||||
static void
|
||||
after_attach_apn_modem_power_up_ready (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GTask *task)
|
||||
{
|
||||
SetInitialEpsBearerSettingsContext *ctx;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
ctx = g_task_get_task_data (task);
|
||||
|
||||
if (!mm_iface_modem_set_power_state_finish (self, res, NULL, &error)) {
|
||||
mm_obj_warn (self, "failed to power up modem after attach APN settings update: %s", error->message);
|
||||
if (!ctx->saved_error)
|
||||
ctx->saved_error = g_steal_pointer (&error);
|
||||
} else
|
||||
mm_obj_dbg (self, "success toggling modem power up after attach APN");
|
||||
|
||||
set_initial_eps_bearer_settings_complete (task);
|
||||
}
|
||||
|
||||
static void
|
||||
parent_set_initial_eps_bearer_settings_ready (MMIfaceModem3gpp *self,
|
||||
GAsyncResult *res,
|
||||
GTask *task)
|
||||
{
|
||||
SetInitialEpsBearerSettingsContext *ctx;
|
||||
Private *priv;
|
||||
|
||||
ctx = g_task_get_task_data (task);
|
||||
priv = get_private (MM_SHARED_FIBOCOM (self));
|
||||
|
||||
if (!priv->iface_modem_3gpp_parent->set_initial_eps_bearer_settings_finish (self, res, &ctx->saved_error))
|
||||
mm_obj_warn (self, "failed to update APN settings: %s", ctx->saved_error->message);
|
||||
|
||||
if (ctx->initial_eps_off_on) {
|
||||
mm_obj_dbg (self, "toggle modem power up after attach APN");
|
||||
mm_iface_modem_set_power_state (MM_IFACE_MODEM (self),
|
||||
MM_MODEM_POWER_STATE_ON,
|
||||
(GAsyncReadyCallback) after_attach_apn_modem_power_up_ready,
|
||||
task);
|
||||
return;
|
||||
}
|
||||
|
||||
set_initial_eps_bearer_settings_complete (task);
|
||||
}
|
||||
|
||||
static void
|
||||
parent_set_initial_eps_bearer_settings (GTask *task)
|
||||
{
|
||||
MMSharedFibocom *self;
|
||||
SetInitialEpsBearerSettingsContext *ctx;
|
||||
Private *priv;
|
||||
|
||||
self = g_task_get_source_object (task);
|
||||
ctx = g_task_get_task_data (task);
|
||||
priv = get_private (self);
|
||||
|
||||
g_assert (priv->iface_modem_3gpp_parent);
|
||||
g_assert (priv->iface_modem_3gpp_parent->set_initial_eps_bearer_settings);
|
||||
g_assert (priv->iface_modem_3gpp_parent->set_initial_eps_bearer_settings_finish);
|
||||
|
||||
priv->iface_modem_3gpp_parent->set_initial_eps_bearer_settings (MM_IFACE_MODEM_3GPP (self),
|
||||
ctx->config,
|
||||
(GAsyncReadyCallback)parent_set_initial_eps_bearer_settings_ready,
|
||||
task);
|
||||
}
|
||||
|
||||
static void
|
||||
before_attach_apn_modem_power_down_ready (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GTask *task)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_iface_modem_set_power_state_finish (self, res, NULL, &error)) {
|
||||
mm_obj_warn (self, "failed to power down modem before attach APN settings update: %s", error->message);
|
||||
g_task_return_error (task, error);
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
mm_obj_dbg (self, "success toggling modem power down before attach APN");
|
||||
|
||||
parent_set_initial_eps_bearer_settings (task);
|
||||
}
|
||||
|
||||
void
|
||||
mm_shared_fibocom_set_initial_eps_bearer_settings (MMIfaceModem3gpp *self,
|
||||
MMBearerProperties *config,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
SetInitialEpsBearerSettingsContext *ctx;
|
||||
GTask *task;
|
||||
MMPortMbim *port;
|
||||
|
||||
task = g_task_new (self, NULL, callback, user_data);
|
||||
|
||||
/* This shared logic is only expected in MBIM capable devices */
|
||||
g_assert (MM_IS_BROADBAND_MODEM_MBIM (self));
|
||||
port = mm_broadband_modem_mbim_peek_port_mbim (MM_BROADBAND_MODEM_MBIM (self));
|
||||
if (!port) {
|
||||
g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
|
||||
"No valid MBIM port found");
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
|
||||
ctx = g_slice_new0 (SetInitialEpsBearerSettingsContext);
|
||||
ctx->config = g_object_ref (config);
|
||||
ctx->initial_eps_off_on = mm_kernel_device_get_property_as_boolean (mm_port_peek_kernel_device (MM_PORT (port)), "ID_MM_FIBOCOM_INITIAL_EPS_OFF_ON");
|
||||
g_task_set_task_data (task, ctx, (GDestroyNotify)set_initial_eps_bearer_settings_context_free);
|
||||
|
||||
if (ctx->initial_eps_off_on) {
|
||||
mm_obj_dbg (self, "toggle modem power down before attach APN");
|
||||
mm_iface_modem_set_power_state (MM_IFACE_MODEM (self),
|
||||
MM_MODEM_POWER_STATE_LOW,
|
||||
(GAsyncReadyCallback) before_attach_apn_modem_power_down_ready,
|
||||
task);
|
||||
return;
|
||||
}
|
||||
|
||||
parent_set_initial_eps_bearer_settings (task);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
MMFirmwareUpdateSettings *
|
||||
mm_shared_fibocom_firmware_load_update_settings_finish (MMIfaceModemFirmware *self,
|
||||
GAsyncResult *res,
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <libmm-glib.h>
|
||||
|
||||
#include "mm-broadband-modem.h"
|
||||
#include "mm-iface-modem-3gpp.h"
|
||||
#include "mm-iface-modem.h"
|
||||
#include "mm-iface-modem-firmware.h"
|
||||
|
||||
@@ -35,9 +34,6 @@ struct _MMSharedFibocomInterface {
|
||||
|
||||
/* Peek parent class of the object */
|
||||
MMBaseModemClass * (* peek_parent_class) (MMSharedFibocom *self);
|
||||
|
||||
/* Peek 3GPP interface of the parent class of the object */
|
||||
MMIfaceModem3gppInterface * (* peek_parent_3gpp_interface) (MMSharedFibocom *self);
|
||||
};
|
||||
|
||||
void mm_shared_fibocom_setup_ports (MMBroadbandModem *self);
|
||||
@@ -49,14 +45,6 @@ MMPort *mm_shared_fibocom_create_wwan_port (MMBaseModem *self,
|
||||
const gchar *name,
|
||||
MMPortType ptype);
|
||||
|
||||
void mm_shared_fibocom_set_initial_eps_bearer_settings (MMIfaceModem3gpp *self,
|
||||
MMBearerProperties *config,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean mm_shared_fibocom_set_initial_eps_bearer_settings_finish (MMIfaceModem3gpp *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
void mm_shared_fibocom_firmware_load_update_settings (MMIfaceModemFirmware *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
@@ -661,10 +661,8 @@ if plugins_options['mtk']
|
||||
|
||||
plugins += {'plugin-mtk': {
|
||||
'plugin': true,
|
||||
'module': {'sources': sources, 'include_directories': incs, 'c_args': test_udev_rules_dir_c_args + ['-DMM_MODULE_NAME="mtk"']},
|
||||
'module': {'sources': sources, 'include_directories': incs, 'c_args': '-DMM_MODULE_NAME="mtk"'},
|
||||
}}
|
||||
|
||||
plugins_udev_rules += files('mtk/77-mm-mtk-port-types.rules')
|
||||
endif
|
||||
|
||||
# plugin: nokia
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
# do not edit this file, it will be overwritten on update
|
||||
ACTION!="add|change|move|bind", GOTO="mm_mtk_port_types_end"
|
||||
SUBSYSTEMS=="pci", SUBSYSTEM=="wwan", ATTRS{vendor}=="0x14c3", GOTO="mm_mtk_port_types"
|
||||
GOTO="mm_mtk_port_types_end"
|
||||
|
||||
LABEL="mm_mtk_port_types"
|
||||
|
||||
# Fibocom FM350 attach APN with toggle modem power
|
||||
ATTRS{vendor}=="0x14c3", ATTRS{device}=="0x4d75", ENV{ID_MM_FIBOCOM_INITIAL_EPS_OFF_ON}="1"
|
||||
|
||||
LABEL="mm_mtk_port_types_end"
|
||||
@@ -24,21 +24,17 @@
|
||||
#include "ModemManager.h"
|
||||
#include "mm-log-object.h"
|
||||
#include "mm-iface-modem.h"
|
||||
#include "mm-iface-modem-3gpp.h"
|
||||
#include "mm-bearer-mbim-mtk-fibocom.h"
|
||||
#include "mm-broadband-modem-mbim-mtk-fibocom.h"
|
||||
#include "mm-shared-fibocom.h"
|
||||
|
||||
static void iface_modem_init (MMIfaceModemInterface *iface);
|
||||
static void iface_modem_3gpp_init (MMIfaceModem3gppInterface *iface);
|
||||
static void shared_fibocom_init (MMSharedFibocomInterface *iface);
|
||||
static void iface_modem_init (MMIfaceModemInterface *iface);
|
||||
static void shared_fibocom_init (MMSharedFibocomInterface *iface);
|
||||
|
||||
static MMIfaceModemInterface *iface_modem_parent;
|
||||
static MMIfaceModem3gppInterface *iface_modem_3gpp_parent;
|
||||
static MMIfaceModemInterface *iface_modem_parent;
|
||||
|
||||
G_DEFINE_TYPE_EXTENDED (MMBroadbandModemMbimMtkFibocom, mm_broadband_modem_mbim_mtk_fibocom, MM_TYPE_BROADBAND_MODEM_MBIM_MTK, 0,
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM, iface_modem_init)
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_3GPP, iface_modem_3gpp_init)
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_SHARED_FIBOCOM, shared_fibocom_init))
|
||||
|
||||
struct _MMBroadbandModemMbimMtkFibocomPrivate {
|
||||
@@ -284,32 +280,16 @@ iface_modem_init (MMIfaceModemInterface *iface)
|
||||
iface->create_bearer_list = create_bearer_list;
|
||||
}
|
||||
|
||||
static void
|
||||
iface_modem_3gpp_init (MMIfaceModem3gppInterface *iface)
|
||||
{
|
||||
iface_modem_3gpp_parent = g_type_interface_peek_parent (iface);
|
||||
|
||||
iface->set_initial_eps_bearer_settings = mm_shared_fibocom_set_initial_eps_bearer_settings;
|
||||
iface->set_initial_eps_bearer_settings_finish = mm_shared_fibocom_set_initial_eps_bearer_settings_finish;
|
||||
}
|
||||
|
||||
static MMBaseModemClass *
|
||||
peek_parent_class (MMSharedFibocom *self)
|
||||
{
|
||||
return MM_BASE_MODEM_CLASS (mm_broadband_modem_mbim_mtk_fibocom_parent_class);
|
||||
}
|
||||
|
||||
static MMIfaceModem3gppInterface *
|
||||
peek_parent_3gpp_interface (MMSharedFibocom *self)
|
||||
{
|
||||
return iface_modem_3gpp_parent;
|
||||
}
|
||||
|
||||
static void
|
||||
shared_fibocom_init (MMSharedFibocomInterface *iface)
|
||||
{
|
||||
iface->peek_parent_class = peek_parent_class;
|
||||
iface->peek_parent_3gpp_interface = peek_parent_3gpp_interface;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user