helpers-mbim: fix MMSignal selection based on data class

MbimDataClass is a flags bitmask, not an enumeration.

This logic was broken if the reported data class was e.g. 4G+5GNSA.
This commit is contained in:
Aleksander Morgado
2023-04-19 11:30:54 +00:00
parent 552359b57e
commit 1a133dca5e

View File

@@ -1100,32 +1100,27 @@ select_mbim_signal_with_data_class (MbimDataClass data_class,
MMSignal **lte, MMSignal **lte,
MMSignal **nr5g) MMSignal **nr5g)
{ {
switch (data_class) { if (data_class & (MBIM_DATA_CLASS_5G_NSA |
case MBIM_DATA_CLASS_5G_NSA: MBIM_DATA_CLASS_5G_SA))
case MBIM_DATA_CLASS_5G_SA:
return nr5g; return nr5g;
case MBIM_DATA_CLASS_LTE: if (data_class & (MBIM_DATA_CLASS_LTE))
return lte; return lte;
case MBIM_DATA_CLASS_UMTS: if (data_class & (MBIM_DATA_CLASS_UMTS |
case MBIM_DATA_CLASS_HSDPA: MBIM_DATA_CLASS_HSDPA |
case MBIM_DATA_CLASS_HSUPA: MBIM_DATA_CLASS_HSUPA))
return umts; return umts;
case MBIM_DATA_CLASS_GPRS: if (data_class & (MBIM_DATA_CLASS_GPRS |
case MBIM_DATA_CLASS_EDGE: MBIM_DATA_CLASS_EDGE))
return gsm; return gsm;
case MBIM_DATA_CLASS_1XEVDO: if (data_class & (MBIM_DATA_CLASS_1XEVDO |
case MBIM_DATA_CLASS_1XEVDO_REVA: MBIM_DATA_CLASS_1XEVDO_REVA |
case MBIM_DATA_CLASS_1XEVDV: MBIM_DATA_CLASS_1XEVDV |
case MBIM_DATA_CLASS_3XRTT: MBIM_DATA_CLASS_3XRTT |
case MBIM_DATA_CLASS_1XEVDO_REVB: MBIM_DATA_CLASS_1XEVDO_REVB))
return evdo; return evdo;
case MBIM_DATA_CLASS_1XRTT: if (data_class & MBIM_DATA_CLASS_1XRTT)
return cdma; return cdma;
case MBIM_DATA_CLASS_UMB: return NULL;
case MBIM_DATA_CLASS_CUSTOM:
default:
return NULL;
}
} }
gboolean gboolean