From 45ceba76924f184ed9e12ba3d35e00a55ad3a197 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Wed, 29 May 2013 12:41:49 +0200 Subject: [PATCH] api,introspection: 'SupportedModes' is now a list of possible combinations Instead of just a mask of MMModemMode values, we now provide a list of the allowed and preferred mode combinations supported by the modem. E.g.: $> sudo mmcli -m 0 ------------------------- Modes | supported: 'allowed: 2g; preferred: none | allowed: 3g; preferred: none | allowed: 2g, 3g; preferred: none | allowed: 2g, 3g; preferred: 2g | allowed: 2g, 3g; preferred: 3g | allowed: 4g; preferred: none | allowed: 2g, 3g, 4g; preferred: none' --- cli/mmcli-modem.c | 16 +- .../libmm-glib/libmm-glib-sections.txt | 3 + .../org.freedesktop.ModemManager1.Modem.xml | 23 +- libmm-glib/Makefile.am | 2 + libmm-glib/libmm-glib.h | 1 + libmm-glib/mm-common-helpers.c | 122 +++++++++++ libmm-glib/mm-common-helpers.h | 12 + libmm-glib/mm-helper-types.h | 44 ++++ libmm-glib/mm-modem.c | 123 ++++++++++- libmm-glib/mm-modem.h | 8 +- .../cinterion/mm-broadband-modem-cinterion.c | 82 ++++++- plugins/huawei/mm-broadband-modem-huawei.c | 93 +++++++- plugins/icera/mm-broadband-modem-icera.c | 92 +++++++- plugins/iridium/mm-broadband-modem-iridium.c | 17 +- plugins/linktop/mm-broadband-modem-linktop.c | 88 +++++++- .../longcheer/mm-broadband-modem-longcheer.c | 106 ++++++++- plugins/mbm/mm-broadband-modem-mbm.c | 79 +++++++ plugins/nokia/mm-broadband-modem-nokia.c | 41 ---- plugins/novatel/mm-broadband-modem-novatel.c | 90 +++++++- plugins/option/mm-broadband-modem-option.c | 92 +++++++- plugins/sierra/mm-broadband-modem-sierra.c | 119 +++++++++- plugins/simtech/mm-broadband-modem-simtech.c | 109 ++++++++- plugins/wavecom/mm-broadband-modem-wavecom.c | 134 ++++++++---- plugins/x22x/mm-broadband-modem-x22x.c | 84 ++++++- plugins/zte/mm-broadband-modem-zte.c | 103 ++++++++- src/mm-broadband-modem-mbim.c | 92 ++++---- src/mm-broadband-modem-qmi.c | 143 +++++++++--- src/mm-broadband-modem.c | 25 ++- src/mm-iface-modem.c | 206 ++++++++++++------ src/mm-iface-modem.h | 19 +- src/mm-modem-helpers-qmi.c | 23 ++ src/mm-modem-helpers-qmi.h | 2 + src/mm-modem-helpers.c | 47 ++++ src/mm-modem-helpers.h | 3 + src/tests/test-modem-helpers.c | 124 +++++++++++ 35 files changed, 2060 insertions(+), 307 deletions(-) create mode 100644 libmm-glib/mm-helper-types.h diff --git a/cli/mmcli-modem.c b/cli/mmcli-modem.c index e405307b..99233217 100644 --- a/cli/mmcli-modem.c +++ b/cli/mmcli-modem.c @@ -238,6 +238,8 @@ print_modem_info (void) gchar *modem_capabilities_string; gchar *current_capabilities_string; gchar *access_technologies_string; + MMModemModeCombination *modes = NULL; + guint n_modes = 0; gchar *supported_modes_string; gchar *allowed_modes_string; gchar *preferred_mode_string; @@ -266,6 +268,9 @@ print_modem_info (void) mm_modem_get_current_capabilities (ctx->modem)); access_technologies_string = mm_modem_access_technology_build_string_from_mask ( mm_modem_get_access_technologies (ctx->modem)); + mm_modem_get_supported_modes (ctx->modem, &modes, &n_modes); + supported_modes_string = mm_common_build_mode_combinations_string (modes, n_modes); + g_free (modes); mm_modem_get_current_bands (ctx->modem, &bands, &n_bands); current_bands_string = mm_common_build_bands_string (bands, n_bands); g_free (bands); @@ -276,8 +281,6 @@ print_modem_info (void) mm_modem_get_allowed_modes (ctx->modem)); preferred_mode_string = mm_modem_mode_build_string_from_mask ( mm_modem_get_preferred_mode (ctx->modem)); - supported_modes_string = mm_modem_mode_build_string_from_mask ( - mm_modem_get_supported_modes (ctx->modem)); supported_ip_families_string = mm_bearer_ip_family_build_string_from_mask ( mm_modem_get_supported_ip_families (ctx->modem)); @@ -310,6 +313,15 @@ print_modem_info (void) else prefixed_revision = NULL; + if (supported_modes_string) { + gchar *prefixed; + + prefixed = mmcli_prefix_newlines (" | ", + supported_modes_string); + g_free (supported_modes_string); + supported_modes_string = prefixed; + } + /* Get signal quality info */ signal_quality = mm_modem_get_signal_quality (ctx->modem, &signal_quality_recent); diff --git a/docs/reference/libmm-glib/libmm-glib-sections.txt b/docs/reference/libmm-glib/libmm-glib-sections.txt index 358f613c..1d1704b4 100644 --- a/docs/reference/libmm-glib/libmm-glib-sections.txt +++ b/docs/reference/libmm-glib/libmm-glib-sections.txt @@ -73,6 +73,7 @@ mm_object_get_type mm-modem MMModem MMModem +MMModemModeCombination mm_modem_get_path mm_modem_dup_path @@ -106,6 +107,7 @@ mm_modem_get_max_bearers mm_modem_get_max_active_bearers mm_modem_get_own_numbers mm_modem_dup_own_numbers +mm_modem_peek_supported_modes mm_modem_get_supported_modes mm_modem_get_allowed_modes mm_modem_get_preferred_mode @@ -1455,6 +1457,7 @@ mm_gdbus_modem_get_supported_bands mm_gdbus_modem_dup_supported_bands mm_gdbus_modem_get_supported_ip_families mm_gdbus_modem_get_supported_modes +mm_gdbus_modem_dup_supported_modes mm_gdbus_modem_get_unlock_required mm_gdbus_modem_get_unlock_retries mm_gdbus_modem_dup_unlock_retries diff --git a/introspection/org.freedesktop.ModemManager1.Modem.xml b/introspection/org.freedesktop.ModemManager1.Modem.xml index 0f8364b7..7b43846e 100644 --- a/introspection/org.freedesktop.ModemManager1.Modem.xml +++ b/introspection/org.freedesktop.ModemManager1.Modem.xml @@ -410,14 +410,25 @@ - +