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:
Daniele Palmas
2022-09-06 15:07:04 +02:00
committed by Aleksander Morgado
parent 24fd0026ec
commit ea275d05e6
3 changed files with 16 additions and 9 deletions

View File

@@ -954,7 +954,7 @@ load_supported_modes_mbim (GTask *task,
} }
/* Build all */ /* 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.allowed = mask_all;
mode.preferred = MM_MODEM_MODE_NONE; mode.preferred = MM_MODEM_MODE_NONE;
all = g_array_sized_new (FALSE, FALSE, sizeof (MMModemModeCombination), 1); 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 = 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; mode->preferred = MM_MODEM_MODE_NONE;
g_task_return_pointer (task, mode, (GDestroyNotify)g_free); g_task_return_pointer (task, mode, (GDestroyNotify)g_free);
g_object_unref (task); g_object_unref (task);
@@ -1189,8 +1189,8 @@ complete_pending_allowed_modes_action (MMBroadbandModemMbim *self,
return; return;
requested_data_classes = (MbimDataClass) GPOINTER_TO_UINT (g_task_get_task_data (self->priv->pending_allowed_modes_action)); 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); 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); 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 /* 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 */ * intermediate indications emitted before the preference change is valid */
@@ -1254,8 +1254,8 @@ register_state_current_modes_set_ready (MbimDevice *device,
return; return;
} }
requested_modes = mm_modem_mode_from_mbim_data_class (requested_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); preferred_modes = mm_modem_mode_from_mbim_data_class (preferred_data_classes, NULL);
if (requested_modes != preferred_modes) { if (requested_modes != preferred_modes) {
g_autofree gchar *requested_modes_str = NULL; g_autofree gchar *requested_modes_str = NULL;
@@ -1332,7 +1332,7 @@ modem_set_current_modes (MMIfaceModem *_self,
/* Limit ANY to the currently supported modes */ /* Limit ANY to the currently supported modes */
if (allowed == MM_MODEM_MODE_ANY) 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, self->priv->requested_data_class = mm_mbim_data_class_from_modem_mode (allowed,
mm_iface_modem_is_3gpp (_self), mm_iface_modem_is_3gpp (_self),

View File

@@ -129,7 +129,8 @@ mm_modem_3gpp_registration_state_from_mbim_register_state (MbimRegisterState sta
/*****************************************************************************/ /*****************************************************************************/
MMModemMode 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; 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 | if (data_class & (MBIM_DATA_CLASS_5G_NSA |
MBIM_DATA_CLASS_5G_SA)) MBIM_DATA_CLASS_5G_SA))
mask |= MM_MODEM_MODE_5G; 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... */ /* 3GPP2... */
if (data_class & MBIM_DATA_CLASS_1XRTT) if (data_class & MBIM_DATA_CLASS_1XRTT)

View File

@@ -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, MbimDataClass mm_mbim_data_class_from_mbim_data_class_v3_and_subclass (MbimDataClassV3 data_class_v3,
MbimDataSubclass data_subclass); 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, MbimDataClass mm_mbim_data_class_from_modem_mode (MMModemMode modem_mode,
gboolean is_3gpp, gboolean is_3gpp,