broadband-modem-mbim: add supported modes from CustomDataClass
Some modems (e.g. Telit FN990) reports 5G capabilities in CustomDataClass field of device-caps cid: take this into account when building the modes according to the data caps.
This commit is contained in:

committed by
Aleksander Morgado

parent
24fd0026ec
commit
ea275d05e6
@@ -954,7 +954,7 @@ load_supported_modes_mbim (GTask *task,
|
||||
}
|
||||
|
||||
/* Build all */
|
||||
mask_all = mm_modem_mode_from_mbim_data_class (self->priv->caps_data_class);
|
||||
mask_all = mm_modem_mode_from_mbim_data_class (self->priv->caps_data_class, self->priv->caps_custom_data_class);
|
||||
mode.allowed = mask_all;
|
||||
mode.preferred = MM_MODEM_MODE_NONE;
|
||||
all = g_array_sized_new (FALSE, FALSE, sizeof (MMModemModeCombination), 1);
|
||||
@@ -1102,7 +1102,7 @@ register_state_current_modes_query_ready (MbimDevice *device,
|
||||
}
|
||||
|
||||
mode = g_new0 (MMModemModeCombination, 1);
|
||||
mode->allowed = mm_modem_mode_from_mbim_data_class (preferred_data_classes);
|
||||
mode->allowed = mm_modem_mode_from_mbim_data_class (preferred_data_classes, NULL);
|
||||
mode->preferred = MM_MODEM_MODE_NONE;
|
||||
g_task_return_pointer (task, mode, (GDestroyNotify)g_free);
|
||||
g_object_unref (task);
|
||||
@@ -1189,8 +1189,8 @@ complete_pending_allowed_modes_action (MMBroadbandModemMbim *self,
|
||||
return;
|
||||
|
||||
requested_data_classes = (MbimDataClass) GPOINTER_TO_UINT (g_task_get_task_data (self->priv->pending_allowed_modes_action));
|
||||
requested_modes = mm_modem_mode_from_mbim_data_class (requested_data_classes);
|
||||
preferred_modes = mm_modem_mode_from_mbim_data_class (preferred_data_classes);
|
||||
requested_modes = mm_modem_mode_from_mbim_data_class (requested_data_classes, NULL);
|
||||
preferred_modes = mm_modem_mode_from_mbim_data_class (preferred_data_classes, NULL);
|
||||
|
||||
/* only early complete on success, as we don't know if they're going to be
|
||||
* intermediate indications emitted before the preference change is valid */
|
||||
@@ -1254,8 +1254,8 @@ register_state_current_modes_set_ready (MbimDevice *device,
|
||||
return;
|
||||
}
|
||||
|
||||
requested_modes = mm_modem_mode_from_mbim_data_class (requested_data_classes);
|
||||
preferred_modes = mm_modem_mode_from_mbim_data_class (preferred_data_classes);
|
||||
requested_modes = mm_modem_mode_from_mbim_data_class (requested_data_classes, NULL);
|
||||
preferred_modes = mm_modem_mode_from_mbim_data_class (preferred_data_classes, NULL);
|
||||
|
||||
if (requested_modes != preferred_modes) {
|
||||
g_autofree gchar *requested_modes_str = NULL;
|
||||
@@ -1332,7 +1332,7 @@ modem_set_current_modes (MMIfaceModem *_self,
|
||||
|
||||
/* Limit ANY to the currently supported modes */
|
||||
if (allowed == MM_MODEM_MODE_ANY)
|
||||
allowed = mm_modem_mode_from_mbim_data_class (self->priv->caps_data_class);
|
||||
allowed = mm_modem_mode_from_mbim_data_class (self->priv->caps_data_class, self->priv->caps_custom_data_class);
|
||||
|
||||
self->priv->requested_data_class = mm_mbim_data_class_from_modem_mode (allowed,
|
||||
mm_iface_modem_is_3gpp (_self),
|
||||
|
@@ -129,7 +129,8 @@ mm_modem_3gpp_registration_state_from_mbim_register_state (MbimRegisterState sta
|
||||
/*****************************************************************************/
|
||||
|
||||
MMModemMode
|
||||
mm_modem_mode_from_mbim_data_class (MbimDataClass data_class)
|
||||
mm_modem_mode_from_mbim_data_class (MbimDataClass data_class,
|
||||
const gchar *caps_custom_data_class)
|
||||
{
|
||||
MMModemMode mask = MM_MODEM_MODE_NONE;
|
||||
|
||||
@@ -146,6 +147,11 @@ mm_modem_mode_from_mbim_data_class (MbimDataClass data_class)
|
||||
if (data_class & (MBIM_DATA_CLASS_5G_NSA |
|
||||
MBIM_DATA_CLASS_5G_SA))
|
||||
mask |= MM_MODEM_MODE_5G;
|
||||
/* Some modems (e.g. Telit FN990) reports MBIM custom data class "5G/TDS" */
|
||||
if ((data_class & MBIM_DATA_CLASS_CUSTOM) && caps_custom_data_class) {
|
||||
if (strstr (caps_custom_data_class, "5G"))
|
||||
mask |= MM_MODEM_MODE_5G;
|
||||
}
|
||||
|
||||
/* 3GPP2... */
|
||||
if (data_class & MBIM_DATA_CLASS_1XRTT)
|
||||
|
@@ -38,7 +38,8 @@ MMModem3gppRegistrationState mm_modem_3gpp_registration_state_from_mbim_register
|
||||
MbimDataClass mm_mbim_data_class_from_mbim_data_class_v3_and_subclass (MbimDataClassV3 data_class_v3,
|
||||
MbimDataSubclass data_subclass);
|
||||
|
||||
MMModemMode mm_modem_mode_from_mbim_data_class (MbimDataClass data_class);
|
||||
MMModemMode mm_modem_mode_from_mbim_data_class (MbimDataClass data_class,
|
||||
const gchar *caps_custom_data_class);
|
||||
|
||||
MbimDataClass mm_mbim_data_class_from_modem_mode (MMModemMode modem_mode,
|
||||
gboolean is_3gpp,
|
||||
|
Reference in New Issue
Block a user