From eecb4c46cc35c43c12e84e530b3be50374baa792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= Date: Tue, 22 Sep 2015 18:42:40 +0200 Subject: [PATCH] modem-broadband: update modem's supported-ip-families (rh #1263959) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If SIM in a modem is locked, ModemManager can't initialize SupportedIpFamilies and NetworkManager will set the property to 0. ModemManager then updates the property after the modem is unlocked, but NetworkManager did not watch changes to the property. And that resulted in a connection failure: (ttyUSB1): Failed to connect 'O2 Internet': Connection requested IPv4 but IPv4 is unsuported by the modem. (ttyUSB1): device state change: prepare -> failed (reason 'modem-init-failed') [40 120 28] https://bugzilla.redhat.com/show_bug.cgi?id=1263959 Signed-off-by: Jiří Klimeš --- src/devices/wwan/nm-modem-broadband.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/devices/wwan/nm-modem-broadband.c b/src/devices/wwan/nm-modem-broadband.c index e5c77f4..7ec90c3 100644 --- a/src/devices/wwan/nm-modem-broadband.c +++ b/src/devices/wwan/nm-modem-broadband.c @@ -1153,6 +1153,19 @@ sim_changed (MMModem *modem, GParamSpec *pspec, gpointer user_data) } static void +supported_ip_families_changed (MMModem *modem, GParamSpec *pspec, gpointer user_data) +{ + NMModemBroadband *self = NM_MODEM_BROADBAND (user_data); + + g_return_if_fail (modem == self->priv->modem_iface); + + g_object_set (G_OBJECT (self), + NM_MODEM_IP_TYPES, + mm_ip_family_to_nm (mm_modem_get_supported_ip_families (modem)), + NULL); +} + +static void nm_modem_broadband_init (NMModemBroadband *self) { self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, @@ -1183,6 +1196,10 @@ set_property (GObject *object, G_CALLBACK (sim_changed), self); sim_changed (self->priv->modem_iface, NULL, self); + g_signal_connect (self->priv->modem_iface, + "notify::supported-ip-families", + G_CALLBACK (supported_ip_families_changed), + self); /* Note: don't grab the Simple iface here; the Modem interface is the * only one assumed to be always valid and available */ -- 2.1.0