From c3706810ef5af2f06769cfc3f75b44eccf0c948b Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Wed, 5 Jun 2013 16:34:10 +0200 Subject: [PATCH] modem-manager: read 'SupportedCapabilities' instead of 'ModemCapabilities' (bgo #701668) There is no longer a 'ModemCapabilities' uint32 property; instead we have 'SupportedCapabilities' giving a list of uint32 values. Just read the list and merge the values into a single mask; NM doesn't care about the exact combinations supported. https://bugzilla.gnome.org/show_bug.cgi?id=701668 --- configure.ac | 3 +-- src/modem-manager/nm-modem-broadband.c | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 84c76e02a5..4f1649fa38 100644 --- a/configure.ac +++ b/configure.ac @@ -463,7 +463,7 @@ AC_SUBST(PPPD_PLUGIN_DIR) AC_ARG_WITH(modem-manager-1, AS_HELP_STRING([--with-modem-manager-1], [Enable new ModemManager1 interface support]),,[with_modem_manager_1=auto]) if (test "${with_modem_manager_1}" != "no"); then PKG_CHECK_MODULES(MM_GLIB, - [mm-glib], + [mm-glib >= 0.7.991], [have_libmm_glib=yes], [have_libmm_glib=no]) AC_SUBST(MM_GLIB_CFLAGS) @@ -775,4 +775,3 @@ echo " tests: $enable_tests" echo " valgrind: $with_valgrind" echo " code coverage: $enable_code_coverage" echo - diff --git a/src/modem-manager/nm-modem-broadband.c b/src/modem-manager/nm-modem-broadband.c index d6fbac9f90..5e13d7010f 100644 --- a/src/modem-manager/nm-modem-broadband.c +++ b/src/modem-manager/nm-modem-broadband.c @@ -106,9 +106,23 @@ get_capabilities (NMModem *_self, NMDeviceModemCapabilities *current_caps) { NMModemBroadband *self = NM_MODEM_BROADBAND (_self); + MMModemCapability all_supported = MM_MODEM_CAPABILITY_NONE; + MMModemCapability *supported; + guint n_supported; - *modem_caps = (NMDeviceModemCapabilities)mm_modem_get_modem_capabilities (self->priv->modem_iface); - *current_caps = (NMDeviceModemCapabilities)mm_modem_get_current_capabilities (self->priv->modem_iface); + /* For now, we don't care about the capability combinations, just merge all + * combinations in a single mask */ + if (mm_modem_get_supported_capabilities (self->priv->modem_iface, &supported, &n_supported)) { + guint i; + + for (i = 0; i < n_supported; i++) + all_supported |= supported[i]; + + g_free (supported); + } + + *modem_caps = (NMDeviceModemCapabilities) all_supported; + *current_caps = (NMDeviceModemCapabilities) mm_modem_get_current_capabilities (self->priv->modem_iface); } /*****************************************************************************/