broadband-modem-mbim: detect 5G support in custom data class
Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/301
This commit is contained in:
@@ -98,6 +98,7 @@ struct _MMBroadbandModemMbimPrivate {
|
||||
/* Queried and cached capabilities */
|
||||
MbimCellularClass caps_cellular_class;
|
||||
MbimDataClass caps_data_class;
|
||||
gchar *caps_custom_data_class;
|
||||
MbimSmsCaps caps_sms;
|
||||
guint caps_max_sessions;
|
||||
gchar *caps_device_id;
|
||||
@@ -447,7 +448,7 @@ device_caps_query_ready (MbimDevice *device,
|
||||
&self->priv->caps_sms,
|
||||
NULL, /* ctrl_caps */
|
||||
&self->priv->caps_max_sessions,
|
||||
NULL, /* custom_data_class */
|
||||
&self->priv->caps_custom_data_class,
|
||||
&self->priv->caps_device_id,
|
||||
&self->priv->caps_firmware_info,
|
||||
&self->priv->caps_hardware_info,
|
||||
@@ -458,7 +459,8 @@ device_caps_query_ready (MbimDevice *device,
|
||||
}
|
||||
|
||||
ctx->current_mbim = mm_modem_capability_from_mbim_device_caps (self->priv->caps_cellular_class,
|
||||
self->priv->caps_data_class);
|
||||
self->priv->caps_data_class,
|
||||
self->priv->caps_custom_data_class);
|
||||
complete_current_capabilities (task);
|
||||
|
||||
out:
|
||||
@@ -561,7 +563,9 @@ load_supported_capabilities_mbim (GTask *task)
|
||||
self = g_task_get_source_object (task);
|
||||
|
||||
/* Current capabilities should have been cached already, just assume them */
|
||||
current = mm_modem_capability_from_mbim_device_caps (self->priv->caps_cellular_class, self->priv->caps_data_class);
|
||||
current = mm_modem_capability_from_mbim_device_caps (self->priv->caps_cellular_class,
|
||||
self->priv->caps_data_class,
|
||||
self->priv->caps_custom_data_class);
|
||||
if (current != 0) {
|
||||
supported = g_array_sized_new (FALSE, FALSE, sizeof (MMModemCapability), 1);
|
||||
g_array_append_val (supported, current);
|
||||
@@ -5622,6 +5626,7 @@ finalize (GObject *object)
|
||||
{
|
||||
MMBroadbandModemMbim *self = MM_BROADBAND_MODEM_MBIM (object);
|
||||
|
||||
g_free (self->priv->caps_custom_data_class);
|
||||
g_free (self->priv->caps_device_id);
|
||||
g_free (self->priv->caps_firmware_info);
|
||||
g_free (self->priv->caps_hardware_info);
|
||||
|
||||
@@ -22,8 +22,9 @@
|
||||
/*****************************************************************************/
|
||||
|
||||
MMModemCapability
|
||||
mm_modem_capability_from_mbim_device_caps (MbimCellularClass caps_cellular_class,
|
||||
MbimDataClass caps_data_class)
|
||||
mm_modem_capability_from_mbim_device_caps (MbimCellularClass caps_cellular_class,
|
||||
MbimDataClass caps_data_class,
|
||||
const gchar *caps_custom_data_class)
|
||||
{
|
||||
MMModemCapability mask = 0;
|
||||
|
||||
@@ -38,6 +39,12 @@ mm_modem_capability_from_mbim_device_caps (MbimCellularClass caps_cellular_class
|
||||
if (caps_data_class & MBIM_DATA_CLASS_LTE)
|
||||
mask |= MM_MODEM_CAPABILITY_LTE;
|
||||
|
||||
if ((caps_data_class & MBIM_DATA_CLASS_CUSTOM) && caps_custom_data_class) {
|
||||
/* e.g. Gosuncn GM800 reports MBIM custom data class "5G/TDS" */
|
||||
if (strstr (caps_custom_data_class, "5G"))
|
||||
mask |= MM_MODEM_CAPABILITY_5GNR;
|
||||
}
|
||||
|
||||
return mask;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,9 @@
|
||||
/*****************************************************************************/
|
||||
/* MBIM/BasicConnect to MM translations */
|
||||
|
||||
MMModemCapability mm_modem_capability_from_mbim_device_caps (MbimCellularClass caps_cellular_class,
|
||||
MbimDataClass caps_data_class);
|
||||
MMModemCapability mm_modem_capability_from_mbim_device_caps (MbimCellularClass caps_cellular_class,
|
||||
MbimDataClass caps_data_class,
|
||||
const gchar *caps_custom_data_class);
|
||||
|
||||
MMModemLock mm_modem_lock_from_mbim_pin_type (MbimPinType pin_type);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user