summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2019-05-06 18:07:44 +0200
committerLubomir Rintel <lkundrak@v3.sk>2019-05-07 11:18:57 +0200
commitb008ca4568fe610d38e71135f15240435af25abd (patch)
treeda6c71dca1ee301a8eece23100502e7269d99f61
parent4ed72fa658c03790700ba9084e9328fe38afdee9 (diff)
downloadNetworkManager-lr/modem-device-id.tar.gz
modem/broadband: set the gsm.device-id in complete_connection()lr/modem-device-id
This is the preferred way of associating the connection with a particualr modem.
-rw-r--r--src/devices/wwan/nm-modem-broadband.c18
1 files 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,