libmm-common: handle exact mask matches when building capabilities string
This commit is contained in:
@@ -23,25 +23,33 @@ mm_common_get_capabilities_string (MMModemCapability caps)
|
|||||||
{
|
{
|
||||||
GFlagsClass *flags_class;
|
GFlagsClass *flags_class;
|
||||||
GString *str;
|
GString *str;
|
||||||
MMModemCapability it;
|
|
||||||
gboolean first = TRUE;
|
|
||||||
|
|
||||||
str = g_string_new ("");
|
str = g_string_new ("");
|
||||||
flags_class = G_FLAGS_CLASS (g_type_class_ref (MM_TYPE_MODEM_CAPABILITY));
|
flags_class = G_FLAGS_CLASS (g_type_class_ref (MM_TYPE_MODEM_CAPABILITY));
|
||||||
|
|
||||||
for (it = MM_MODEM_CAPABILITY_POTS; /* first */
|
if (caps == MM_MODEM_CAPABILITY_NONE) {
|
||||||
it <= MM_MODEM_CAPABILITY_LTE_ADVANCED; /* last */
|
GFlagsValue *value;
|
||||||
it = it << 1) {
|
|
||||||
if (caps & it) {
|
|
||||||
GFlagsValue *value;
|
|
||||||
|
|
||||||
value = g_flags_get_first_value (flags_class, it);
|
value = g_flags_get_first_value (flags_class, caps);
|
||||||
g_string_append_printf (str, "%s%s",
|
g_string_append (str, value->value_nick);
|
||||||
first ? "" : ", ",
|
} else {
|
||||||
value->value_nick);
|
MMModemCapability it;
|
||||||
|
gboolean first = TRUE;
|
||||||
|
|
||||||
if (first)
|
for (it = MM_MODEM_CAPABILITY_POTS; /* first */
|
||||||
first = FALSE;
|
it <= MM_MODEM_CAPABILITY_LTE_ADVANCED; /* last */
|
||||||
|
it = it << 1) {
|
||||||
|
if (caps & it) {
|
||||||
|
GFlagsValue *value;
|
||||||
|
|
||||||
|
value = g_flags_get_first_value (flags_class, it);
|
||||||
|
g_string_append_printf (str, "%s%s",
|
||||||
|
first ? "" : ", ",
|
||||||
|
value->value_nick);
|
||||||
|
|
||||||
|
if (first)
|
||||||
|
first = FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_type_class_unref (flags_class);
|
g_type_class_unref (flags_class);
|
||||||
|
Reference in New Issue
Block a user