helpers-mbim: report correct network availability from mbim bitmask
MbimProviderState is a bitset, so don't try to match exact values in a switch statement when converting to MMModem3gppNetworkAvailability. Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/524
This commit is contained in:
@@ -268,20 +268,23 @@ mm_modem_access_technology_from_mbim_data_class (MbimDataClass data_class)
|
|||||||
MMModem3gppNetworkAvailability
|
MMModem3gppNetworkAvailability
|
||||||
mm_modem_3gpp_network_availability_from_mbim_provider_state (MbimProviderState state)
|
mm_modem_3gpp_network_availability_from_mbim_provider_state (MbimProviderState state)
|
||||||
{
|
{
|
||||||
switch (state) {
|
/* MbimProviderState is a bitmask!
|
||||||
case MBIM_PROVIDER_STATE_HOME:
|
*
|
||||||
case MBIM_PROVIDER_STATE_PREFERRED:
|
* We don't explicitly process MBIM_PROVIDER_STATE_PREFERRED,
|
||||||
case MBIM_PROVIDER_STATE_VISIBLE:
|
* MBIM_PROVIDER_STATE_PREFERRED_MULTICARRIER or MBIM_PROVIDER_STATE_HOME,
|
||||||
case MBIM_PROVIDER_STATE_PREFERRED_MULTICARRIER:
|
* so we don't report at MM level the type of operator it is (home,
|
||||||
return MM_MODEM_3GPP_NETWORK_AVAILABILITY_AVAILABLE;
|
* preferred or non-preferred), just its availability.
|
||||||
case MBIM_PROVIDER_STATE_REGISTERED:
|
*/
|
||||||
|
if (state & MBIM_PROVIDER_STATE_REGISTERED)
|
||||||
return MM_MODEM_3GPP_NETWORK_AVAILABILITY_CURRENT;
|
return MM_MODEM_3GPP_NETWORK_AVAILABILITY_CURRENT;
|
||||||
case MBIM_PROVIDER_STATE_FORBIDDEN:
|
|
||||||
|
if (state & MBIM_PROVIDER_STATE_FORBIDDEN)
|
||||||
return MM_MODEM_3GPP_NETWORK_AVAILABILITY_FORBIDDEN;
|
return MM_MODEM_3GPP_NETWORK_AVAILABILITY_FORBIDDEN;
|
||||||
case MBIM_PROVIDER_STATE_UNKNOWN:
|
|
||||||
default:
|
if (state & MBIM_PROVIDER_STATE_VISIBLE)
|
||||||
return MM_MODEM_3GPP_NETWORK_AVAILABILITY_UNKNOWN;
|
return MM_MODEM_3GPP_NETWORK_AVAILABILITY_AVAILABLE;
|
||||||
}
|
|
||||||
|
return MM_MODEM_3GPP_NETWORK_AVAILABILITY_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
Reference in New Issue
Block a user