From b008ca4568fe610d38e71135f15240435af25abd Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Mon, 6 May 2019 18:07:44 +0200 Subject: modem/broadband: set the gsm.device-id in complete_connection() This is the preferred way of associating the connection with a particualr modem. --- src/devices/wwan/nm-modem-broadband.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/devices/wwan/nm-modem-broadband.c b/src/devices/wwan/nm-modem-broadband.c index ffdc61a6b7..b63440c2e8 100644 --- a/src/devices/wwan/nm-modem-broadband.c +++ b/src/devices/wwan/nm-modem-broadband.c @@ -656,12 +656,12 @@ check_connection_compatible_with_modem (NMModem *_self, NMConnection *connection /*****************************************************************************/ static gboolean -complete_connection (NMModem *_self, +complete_connection (NMModem *modem, NMConnection *connection, NMConnection *const*existing_connections, GError **error) { - NMModemBroadband *self = NM_MODEM_BROADBAND (_self); + NMModemBroadband *self = NM_MODEM_BROADBAND (modem); MMModemCapability modem_caps; NMSettingPpp *s_ppp; @@ -679,6 +679,20 @@ complete_connection (NMModem *_self, } if (MODEM_CAPS_3GPP (modem_caps)) { + NMSettingGsm *s_gsm; + + s_gsm = nm_connection_get_setting_gsm (connection); + if (!s_gsm) { + s_gsm = (NMSettingGsm *) nm_setting_gsm_new (); + nm_connection_add_setting (connection, NM_SETTING (s_gsm)); + } + + if (!nm_setting_gsm_get_device_id (s_gsm)) { + g_object_set (G_OBJECT (s_gsm), + NM_SETTING_GSM_DEVICE_ID, nm_modem_get_device_id (modem), + NULL); + } + nm_utils_complete_generic (NM_PLATFORM_GET, connection, NM_SETTING_GSM_SETTING_NAME, -- cgit v1.2.1