iface-modem: fix checking for single capabilities

The mm_iface_modem_is_*_only() checks were validating that all the other
capabilities except for the ones being queried were unset, but the check wasn't
explicitly checking that the actual capabilities being queried were set.

This was making the check fail when capabilities == MM_MODEM_CAPABILITY_NONE.

Reported-by: Matthew Stanger <stangerm2@gmail.com>
This commit is contained in:
Aleksander Morgado
2016-07-20 07:51:54 +02:00
parent ddbc219568
commit f137268ce1

View File

@@ -5035,7 +5035,7 @@ mm_iface_modem_is_3gpp_only (MMIfaceModem *self)
MMModemCapability capabilities; MMModemCapability capabilities;
capabilities = mm_iface_modem_get_current_capabilities (self); capabilities = mm_iface_modem_get_current_capabilities (self);
return !((MM_MODEM_CAPABILITY_3GPP ^ capabilities) & capabilities); return (capabilities & MM_MODEM_CAPABILITY_3GPP) && !((MM_MODEM_CAPABILITY_3GPP ^ capabilities) & capabilities);
} }
gboolean gboolean
@@ -5044,7 +5044,7 @@ mm_iface_modem_is_3gpp_lte_only (MMIfaceModem *self)
MMModemCapability capabilities; MMModemCapability capabilities;
capabilities = mm_iface_modem_get_current_capabilities (self); capabilities = mm_iface_modem_get_current_capabilities (self);
return !((MM_MODEM_CAPABILITY_3GPP_LTE ^ capabilities) & capabilities); return (capabilities & MM_MODEM_CAPABILITY_3GPP_LTE) && !((MM_MODEM_CAPABILITY_3GPP_LTE ^ capabilities) & capabilities);
} }
gboolean gboolean
@@ -5053,7 +5053,7 @@ mm_iface_modem_is_cdma_only (MMIfaceModem *self)
MMModemCapability capabilities; MMModemCapability capabilities;
capabilities = mm_iface_modem_get_current_capabilities (self); capabilities = mm_iface_modem_get_current_capabilities (self);
return !((MM_MODEM_CAPABILITY_CDMA_EVDO ^ capabilities) & capabilities); return (capabilities & MM_MODEM_CAPABILITY_CDMA_EVDO) && !((MM_MODEM_CAPABILITY_CDMA_EVDO ^ capabilities) & capabilities);
} }
/*****************************************************************************/ /*****************************************************************************/