Merge lp:~phablet-team/network-manager/lp1361864 into lp:~phablet-team/network-manager/vivid-phone-overlay

Proposed by Tony Espy
Status: Rejected
Rejected by: Tony Espy
Proposed branch: lp:~phablet-team/network-manager/lp1361864
Merge into: lp:~phablet-team/network-manager/vivid-phone-overlay
Diff against target: 613 lines (+549/-36)
4 files modified
debian/changelog (+9/-0)
debian/patches/0001-wwan-add-support-for-using-oFono-as-a-modem-manager.patch (+0/-36)
debian/patches/lp1361864-add-ofono-preferred-contexts.patch (+539/-0)
debian/patches/series (+1/-0)
To merge this branch: bzr merge lp:~phablet-team/network-manager/lp1361864
Reviewer Review Type Date Requested Status
Alfonso Sanchez-Beato Needs Fixing
Review via email: mp+263855@code.launchpad.net

Description of the change

This change adds support for the new ofono gprs-context property 'Preferred'.

When a context is set to 'Preferred=true', NM should disregard all other contexts for the the same IMSI. If the a context is connected, and another context is set as 'Preferred', NM will disconnect the existing context, and attempt to activate the 'Preferred' context. If the 'Preferred' context fails, NM will not try to activate any other contexts.

When a context is set to 'Preferred=false', NM will not deactivate the context, if currently connected.

This change also removes the code in NMMOdemOfono which invoked a DBus method (ReadImsiConetexts) provided by SCPlugin-Ofono, as this only had any effect when a new context was added. and this case is already handled by the imsi_monitor.

Finally, the code in NMDeviceModem which disabled and re-enabled autoconnect based upon device and modem_state was removed, as it caused a hang on arale when a deactivate context failed, and the retry limit was hit, which causes a modem reset.

To post a comment you must log in.
Revision history for this message
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote :

See inline comments. Overall, looks good.

review: Needs Fixing
Revision history for this message
Tony Espy (awe) wrote :

Comments addressed, will re-push shortly after a quick sanity test.

969. By Tony Espy

Updates to patch based on code-review.

One big change is that most context properties are no longer
added to the context GHashtable in read_imsi_contexts, as
other then ID, IMSI, and Name, none were actually used for
anything.

Revision history for this message
Tony Espy (awe) wrote :

Re-submitted at https://code.launchpad.net/~phablet-team/network-manager/lp1361864-2/+merge/263982.

Changing the status of this merge to 'Rejected'.

Unmerged revisions

969. By Tony Espy

Updates to patch based on code-review.

One big change is that most context properties are no longer
added to the context GHashtable in read_imsi_contexts, as
other then ID, IMSI, and Name, none were actually used for
anything.

968. By Tony Espy

Update debian/changelog

967. By Tony Espy

Revised lp1361864-add-ofono-preferred-contexts.patch for multi-sim.

966. By Tony Espy

Remove NMDeviceModem's disable autoconnect code

Code was added to NMDeviceModem to fix a problem where NM took ~5m
to re-connect after a radio technology change (LP: #1418077). This
code is no longer needed after the re-factoring of NMModemOfono
that was done to fix flight-modem/modem state handling (LP: #1445080).

965. By Tony Espy

Added debian/patches/lp1361864-add-ofono-preferred-contexts.patch

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2015-06-27 20:09:08 +0000
3+++ debian/changelog 2015-07-06 17:29:08 +0000
4@@ -1,3 +1,12 @@
5+network-manager (0.9.10.0-4ubuntu15.1.5) vivid; urgency=medium
6+
7+ * debian/patches/lp1361864-add-ofono-preferred-contexts.patch: re-work
8+ the ofono settings plugin to handle the new gprs-context
9+ 'Preferred' property.
10+ * Remove NMDeviceModem's disable autoconnect code
11+
12+ -- Tony Espy <espy@canonical.com> Sun, 05 Jul 2015 19:56:03 -0400
13+
14 network-manager (0.9.10.0-4ubuntu15.1.4) vivid; urgency=medium
15
16 * debian/patches/lp1445080-fix-modem-flight-mode.patch: re-work
17
18=== modified file 'debian/patches/0001-wwan-add-support-for-using-oFono-as-a-modem-manager.patch'
19--- debian/patches/0001-wwan-add-support-for-using-oFono-as-a-modem-manager.patch 2015-04-13 04:34:55 +0000
20+++ debian/patches/0001-wwan-add-support-for-using-oFono-as-a-modem-manager.patch 2015-07-06 17:29:08 +0000
21@@ -1549,39 +1549,3 @@
22 + return name;
23 }
24
25-Index: network-manager-0.9.10.0/src/devices/wwan/nm-device-modem.c
26-===================================================================
27---- network-manager-0.9.10.0.orig/src/devices/wwan/nm-device-modem.c
28-+++ network-manager-0.9.10.0/src/devices/wwan/nm-device-modem.c
29-@@ -201,6 +201,16 @@ modem_state_cb (NMModem *modem,
30- }
31- }
32-
33-+ if (dev_state >= NM_DEVICE_STATE_DISCONNECTED &&
34-+ new_state == NM_MODEM_STATE_REGISTERED && old_state < NM_MODEM_STATE_REGISTERED) {
35-+
36-+ nm_log_info (LOGD_MB, "(%s): modem re-registered; re-checking autoconnect",
37-+ nm_device_get_iface (device));
38-+
39-+ g_object_set (G_OBJECT (device), NM_DEVICE_AUTOCONNECT, TRUE, NULL);
40-+ nm_device_emit_recheck_auto_activate (device);
41-+ }
42-+
43- if (new_state < NM_MODEM_STATE_CONNECTING &&
44- old_state >= NM_MODEM_STATE_CONNECTING &&
45- dev_state >= NM_DEVICE_STATE_NEED_AUTH &&
46-@@ -271,6 +281,14 @@ device_state_changed (NMDevice *device,
47- nm_modem_state_to_string (nm_modem_get_state (priv->modem)));
48- }
49-
50-+ /* Block autoconnect until the modem is registered again */
51-+ if (new_state == NM_DEVICE_STATE_FAILED && nm_modem_get_state (priv->modem) == NM_MODEM_STATE_SEARCHING) {
52-+ nm_log_info (LOGD_MB, "(%s): modem searching; disabling autoconnect",
53-+ nm_device_get_iface (device));
54-+
55-+ g_object_set (G_OBJECT (device), NM_DEVICE_AUTOCONNECT, FALSE, NULL);
56-+ }
57-+
58- nm_modem_device_state_changed (priv->modem, new_state, old_state, reason);
59-
60- switch (reason) {
61
62=== added file 'debian/patches/lp1361864-add-ofono-preferred-contexts.patch'
63--- debian/patches/lp1361864-add-ofono-preferred-contexts.patch 1970-01-01 00:00:00 +0000
64+++ debian/patches/lp1361864-add-ofono-preferred-contexts.patch 2015-07-06 17:29:08 +0000
65@@ -0,0 +1,539 @@
66+Index: network-manager-0.9.10.0/src/settings/plugins/ofono/plugin.c
67+===================================================================
68+--- network-manager-0.9.10.0.orig/src/settings/plugins/ofono/plugin.c
69++++ network-manager-0.9.10.0/src/settings/plugins/ofono/plugin.c
70+@@ -110,63 +110,95 @@ ignore_cb ()
71+ {
72+ }
73+
74+-static
75++static void
76+ SCPluginOfono_parse_contexts (SCPluginOfono *self, GSList *contexts)
77+ {
78+ SCPluginOfonoPrivate *priv = SC_PLUGIN_OFONO_GET_PRIVATE (self);
79+ GSList *list;
80++ GList *keys;
81+ NMOfonoConnection *exported;
82+- NMSettingConnection *setting;
83++ gboolean found = FALSE;
84++ char *uuid;
85++ const char *imsi;
86++ GHashTable *uuids = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
87+
88+- list = contexts;
89+- while (list) {
90++ for (list = contexts; list; list = list->next) {
91+ GHashTable *context = (GHashTable *) list->data;
92+- const char *id, *type, *name, *imsi;
93+- char *idstr, *uuid;
94++ const char *id, *name;
95++ char *idstr;
96+
97+ id = g_hash_table_lookup (context, "ID");
98+ imsi = g_hash_table_lookup (context, "IMSI");
99+- type = g_hash_table_lookup (context, "Type");
100+ name = g_hash_table_lookup (context, "Name");
101+
102+ idstr = g_strconcat ("/", imsi, "/", id, NULL);
103+ uuid = nm_utils_uuid_generate_from_string (idstr);
104+ g_free (idstr);
105+
106+- if(!strcmp ("internet", type)) {
107+- nm_log_info (LOGD_SETTINGS, "SCPlugin-Ofono: found %s context '%s' (%s)",
108+- type, name, id);
109++ g_hash_table_insert (uuids, g_strdup (uuid), NULL);
110++
111++ nm_log_info (LOGD_SETTINGS, "SCPlugin-Ofono: found internet context '%s' (%s)",
112++ name, id);
113++
114++ /* Ignore any connection for this block that was previously found */
115++ exported = g_hash_table_lookup (priv->connections, uuid);
116++ if (exported) {
117++ nm_log_info (LOGD_SETTINGS, "SCPlugin-Ofono: context '%s' (%s) already exported",
118++ name, id);
119++ continue;
120++ }
121++
122++ /* add the new connection */
123++ exported = nm_ofono_connection_new (context);
124++ nm_log_info (LOGD_SETTINGS, "SCPlugin-Ofono: adding %s (%s) to connections", name, uuid);
125++
126++ /* FIXME: investigate if it's possible to set directly via g_object_* method... */
127++ /* Lower disabled timer to 30s */
128++ nm_settings_connection_set_reset_retries_timeout (NM_SETTINGS_CONNECTION (exported), 30);
129++
130++ g_hash_table_insert (priv->connections, g_strdup (uuid), exported);
131++ g_signal_emit_by_name (self, NM_SYSTEM_CONFIG_INTERFACE_CONNECTION_ADDED, exported);
132++ }
133++
134++ /*
135++ * Remove any connections that have the same IMSI
136++ * as our current list of contexts *and* are not
137++ * present in our current list ( ie. the context
138++ * has been deleted ).
139++ *
140++ * TODO: note, could this be handled directly by
141++ * the imsi_monitor??? If so, it gets rid of
142++ * this loop. Doing so would require caching
143++ * the preferred contexts for each IMSI
144++ */
145++
146++ for (keys = g_hash_table_get_keys (priv->connections); keys; keys = keys->next) {
147++ char **context_id;
148++ const char *idstr;
149+
150+- /* Ignore any connection for this block that was previously found */
151++ uuid = (char *) keys->data;
152++
153++ found = g_hash_table_lookup_extended (uuids, uuid, NULL, NULL);
154++ if (!found) {
155+ exported = g_hash_table_lookup (priv->connections, uuid);
156+- if (exported) {
157+- /*
158+- PLUGIN_PRINT("SCPlugin-Ofono", "deleting %s from connections", id);
159+- nm_settings_connection_delete (NM_SETTINGS_CONNECTION (exported), ignore_cb, NULL);
160+- g_hash_table_remove (priv->connections, id);
161+- */
162+- goto next;
163+- }
164++ idstr = nm_connection_get_id (NM_CONNECTION (exported));
165++ context_id = g_strsplit (idstr, "/", 0);
166++ g_assert (context_id[2]);
167+
168+- /* add the new connection */
169+- exported = nm_ofono_connection_new (context);
170++ if (g_strcmp0(imsi, context_id[1]) == 0) {
171+
172+- /* Lower disabled timer to 30s */
173+- nm_settings_connection_set_reset_retries_timeout (NM_SETTINGS_CONNECTION (exported), 30);
174++ nm_log_info (LOGD_SETTINGS, "SCPlugin-Ofono: removing (%s) from connections", idstr);
175+
176+- setting = nm_connection_get_setting_connection (NM_CONNECTION (exported));
177+- g_object_set (setting, NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, NULL);
178+- if (exported) {
179+- nm_log_info (LOGD_SETTINGS, "SCPlugin-Ofono: adding %s (%s) to connections",
180+- name, uuid);
181+- g_hash_table_insert (priv->connections, g_strdup (uuid), exported);
182+- g_signal_emit_by_name (self, NM_SYSTEM_CONFIG_INTERFACE_CONNECTION_ADDED, exported);
183++ nm_settings_connection_signal_remove (NM_SETTINGS_CONNECTION (exported));
184++ g_hash_table_remove (priv->connections, uuid);
185+ }
186++
187++ g_strfreev(context_id);
188+ }
189+- next:
190+- list = list->next;
191+- g_free (uuid);
192+ }
193++
194++ if (uuids)
195++ g_hash_table_destroy (uuids);
196+ }
197+
198+ static gboolean
199+@@ -174,6 +206,7 @@ nm_ofono_read_imsi_contexts (SCPluginOfo
200+ {
201+ SCPluginOfonoPrivate *priv = SC_PLUGIN_OFONO_GET_PRIVATE (self);
202+ GHashTable *context;
203++ GHashTable *pref_context = NULL;
204+ GSList *contexts = NULL;
205+ GDir *imsi_dir;
206+ const char *file;
207+@@ -223,20 +256,61 @@ nm_ofono_read_imsi_contexts (SCPluginOfo
208+ continue;
209+ }
210+
211+- nm_log_info (LOGD_SETTINGS, "SCPlugin-Ofono: add context for %s", imsi);
212+ context = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_free);
213+ g_hash_table_insert (context, "ID", g_strdup (groups[i]));
214+ g_hash_table_insert (context, "IMSI", g_strdup (imsi));
215+
216+ for (j = 0; keys[j]; j++) {
217+- g_hash_table_insert (context, keys[j],
218+- g_key_file_get_string (keyfile, groups[i], keys[j], NULL));
219+- nm_log_info (LOGD_SETTINGS, "SCPlugin-Ofono: add property '%s': %s",
220+- keys[j],
221+- (char *) g_hash_table_lookup (context, keys[j]));
222++ gchar *prop_value;
223++
224++ prop_value = g_key_file_get_string (keyfile, groups[i], keys[j], NULL);
225++
226++ /*
227++ * FIXME: if file notify fires multiple times when 'pref' is updated,
228++ * need someway to cache the new 'Pref' value, so subequent file changes
229++ * are just ignored if 'Pref' hasn't changed...
230++ *
231++ * Note, when 'Preferred' gets set to 'true', this also causes the
232++ * 'Settings' and 'Active' properties to be updated, which triggers
233++ * the imsi_monitor and causes this function to be called also.
234++ */
235++
236++ if (!strcmp (keys[j], "Type") && strcmp (prop_value, "internet")) {
237++
238++ g_hash_table_destroy (context);
239++ g_free (prop_value);
240++
241++ goto next_context;
242++ }
243++
244++ /* If more than one context is 'Preferred', first one wins... */
245++ if (!strcmp (keys[j], "Preferred") && !strcmp (prop_value, "true")) {
246++ nm_log_info (LOGD_SETTINGS, "SCPlugin-Ofono: '%s' - Preferred = 'true'", groups[i]);
247++
248++ pref_context = context;
249++ }
250++
251++ if (!strcmp (keys[j], "Name")
252++ g_hash_table_insert (context, "Name", prop_value);
253+ }
254+
255+- contexts = g_slist_append (contexts, context);
256++ if (pref_context != NULL) {
257++ /*
258++ * Preferred context found, free any contexts created
259++ * before the preferred context was found.
260++ */
261++
262++ if (contexts) {
263++ g_slist_free_full (contexts, (GDestroyNotify) g_hash_table_destroy);
264++ contexts = NULL;
265++ }
266++
267++ contexts = g_slist_append (contexts, pref_context);
268++ break;
269++ } else
270++ contexts = g_slist_append (contexts, context);
271++next_context:
272++ ;
273+ }
274+
275+ g_key_file_free (keyfile);
276+@@ -282,7 +356,7 @@ SCPluginOfono_should_ignore_imsi (const
277+ return FALSE;
278+ }
279+
280+-static
281++static void
282+ ofono_imsi_changed (GFileMonitor *monitor,
283+ GFile *file,
284+ GFile *other_file,
285+@@ -298,8 +372,8 @@ ofono_imsi_changed (GFileMonitor *monito
286+ path = g_file_get_path (file);
287+
288+ /* If this isn't about a "gprs" file we don't want to know */
289+- if (g_strrstr (path, "gprs") == NULL)
290+- goto out_imsi;
291++ if (g_strrstr (path, "gprs") == NULL)
292++ goto out_imsi;
293+
294+ switch (event_type) {
295+ case G_FILE_MONITOR_EVENT_DELETED:
296+@@ -320,6 +394,7 @@ ofono_imsi_changed (GFileMonitor *monito
297+ g_free (imsi);
298+ break;
299+ default:
300++ nm_log_warn (LOGD_SETTINGS, "SCPluginOfono: unexpected event type '%d'", (int) event_type);
301+ break;
302+ }
303+
304+@@ -329,7 +404,65 @@ out_imsi:
305+ return;
306+ }
307+
308+-static
309++static gboolean
310++add_gprs_file_watch(SCPluginOfono *self,
311++ const char *imsi)
312++{
313++
314++ SCPluginOfonoPrivate *priv = SC_PLUGIN_OFONO_GET_PRIVATE (self);
315++ gchar *path;
316++ GFile *config_path;
317++ GFileMonitor *imsi_monitor;
318++ gulong id;
319++ const char *id_str;
320++ gboolean result = FALSE;
321++
322++ id_str = g_hash_table_lookup (priv->ofono_imsi_monitor_ids, imsi);
323++ if (id_str != NULL) {
324++ nm_log_warn (LOGD_SETTINGS, "SCPluginOfono: file_monitor already exists for %s", imsi);
325++ goto done;
326++ }
327++
328++ path = g_strdup_printf (OFONO_CONFIG_DIR "/%s", imsi);
329++
330++ /*
331++ * TODO: an optimiztion woudld be to add only monitor the directory
332++ * if /<IMSI>/gprs doesn't yet exist. Otherwise, a regular file
333++ * monitor could be used, cutting down the times NM gets notified
334++ * for changes to other ofono settings files...
335++ */
336++
337++ config_path = g_file_new_for_path (path);
338++ imsi_monitor = g_file_monitor_directory (config_path,
339++ G_FILE_MONITOR_NONE,
340++ NULL, NULL);
341++
342++ g_object_unref (config_path);
343++ g_free (path);
344++
345++ if (imsi_monitor) {
346++ nm_log_info (LOGD_SETTINGS, "SCPluginOfono: watching file changes for %s", imsi);
347++ id = g_signal_connect (imsi_monitor, "changed",
348++ G_CALLBACK (ofono_imsi_changed),
349++ self);
350++ g_hash_table_insert (priv->ofono_imsi_monitors,
351++ g_strdup (imsi),
352++ g_object_ref (imsi_monitor));
353++ g_hash_table_insert (priv->ofono_imsi_monitor_ids,
354++ g_strdup (imsi),
355++ (gpointer) id);
356++ g_object_unref (imsi_monitor);
357++
358++ result = TRUE;
359++ } else {
360++ nm_log_warn (LOGD_SETTINGS, "SCPluginOfono: couldn't create file monitor for %s.", imsi);
361++ }
362++
363++done:
364++ return result;
365++}
366++
367++static void
368+ ofono_dir_changed (GFileMonitor *monitor,
369+ GFile *file,
370+ GFile *other_file,
371+@@ -346,7 +479,8 @@ ofono_dir_changed (GFileMonitor *monitor
372+ GError *error = NULL;
373+
374+ imsi = g_file_get_basename (file);
375+- if (SCPluginOfono_should_ignore_imsi (imsi))
376++
377++ if (SCPluginOfono_should_ignore_imsi (imsi))
378+ goto out_ofono;
379+
380+ switch (event_type) {
381+@@ -369,38 +503,22 @@ ofono_dir_changed (GFileMonitor *monitor
382+ case G_FILE_MONITOR_EVENT_CREATED:
383+ case G_FILE_MONITOR_EVENT_CHANGED:
384+ case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
385+- /* Add watches for the IMSI directories too */
386+- if (g_strrstr (imsi, "gprs") == NULL) {
387+- path = g_strdup_printf (OFONO_CONFIG_DIR "/%s", imsi);
388+- config_path = g_file_new_for_path (path);
389+- imsi_monitor = g_file_monitor_directory (config_path,
390+- G_FILE_MONITOR_NONE,
391+- NULL, NULL);
392+- g_object_unref (config_path);
393+- g_free (path);
394+-
395+- if (imsi_monitor) {
396+- nm_log_warn (LOGD_SETTINGS, "SCPluginOfono: watching file changes for %s", imsi);
397+- id = g_signal_connect (monitor, "changed",
398+- G_CALLBACK (ofono_imsi_changed),
399+- self);
400+- g_hash_table_insert (priv->ofono_imsi_monitors,
401+- g_strdup (imsi),
402+- g_object_ref (imsi_monitor));
403+- g_hash_table_insert (priv->ofono_imsi_monitor_ids,
404+- g_strdup (imsi),
405+- (gpointer) id);
406+- g_object_unref (imsi_monitor);
407+- }
408+- }
409+
410+- res = nm_ofono_read_imsi_contexts (self, imsi, &error);
411++ /* TODO: is this a valid test? If only new dirs and/or files created in
412++ * the config dir ( /var/lib/ofono ), and not it's sub-dirs, then if
413++ * there's no trailing slash, then it's a new IMSI directory. Also
414++ * determine if writes to gprs files cause CHANGE events in the top-level
415++ * dir.... */
416+
417+- if (!res) {
418+- nm_log_warn (LOGD_SETTINGS, "SCPluginOfono: an error occured while reading "
419+- "contexts for IMSI %s", imsi);
420++ /* Add watches for the IMSI directories too */
421++ if ((g_strrstr (imsi, "gprs") == NULL) && add_gprs_file_watch (self, imsi)) {
422++
423++ res = nm_ofono_read_imsi_contexts (self, imsi, &error);
424++ if (!res)
425++ nm_log_warn (LOGD_SETTINGS, "SCPluginOfono: an error occured while reading "
426++ "contexts for IMSI %s", imsi);
427+ }
428+- break;
429++
430+ default:
431+ break;
432+ }
433+@@ -411,7 +529,7 @@ out_ofono:
434+ return;
435+ }
436+
437+-static
438++static void
439+ SCPluginOfono_read_context_files (SCPluginOfono *self)
440+ {
441+ SCPluginOfonoPrivate *priv = SC_PLUGIN_OFONO_GET_PRIVATE (self);
442+@@ -422,33 +540,46 @@ SCPluginOfono_read_context_files (SCPlug
443+ gboolean res = FALSE;
444+ GError *error = NULL;
445+
446+- config = g_dir_open (OFONO_CONFIG_DIR, 0, NULL);
447+- while ((imsi = g_dir_read_name (config)) != NULL) {
448+-
449+- if (SCPluginOfono_should_ignore_imsi (imsi))
450+- continue;
451+-
452+- res = nm_ofono_read_imsi_contexts (self, imsi, &error);
453+-
454+- if (error && error->message)
455+- nm_log_warn (LOGD_SETTINGS, "SCPlugin-Ofono: %s", error->message);
456+- }
457+-
458+ /* Hook up a GFileMonitor to watch for new context directories being created.
459+ * This is in case ofono's provisioning plugin hasn't run when NM and the
460+ * ofono settings plugin are started, and to pick up new created contexts.
461+ */
462+ config_path = g_file_new_for_path (OFONO_CONFIG_DIR);
463+ if (g_file_query_exists (config_path, NULL)) {
464++
465+ monitor = g_file_monitor_directory (config_path, G_FILE_MONITOR_NONE,
466+ NULL, NULL);
467+
468+ if (monitor) {
469+- priv->ofono_dir_monitor_id = g_signal_connect (monitor, "changed",
470+- G_CALLBACK (ofono_dir_changed), self);
471+ priv->ofono_dir_monitor = monitor;
472++ } else {
473++ nm_log_warn (LOGD_SETTINGS, "SCPlugin-Ofono: couldn't create dir monitor");
474++ goto done;
475+ }
476++ } else {
477++ nm_log_warn (LOGD_SETTINGS, "SCPlugin-Ofono: file doesn't exist: /var/lib/ofono");
478++ goto done;
479++ return;
480++ }
481++
482++ config = g_dir_open (OFONO_CONFIG_DIR, 0, NULL);
483++ while ((imsi = g_dir_read_name (config)) != NULL) {
484++
485++ if (SCPluginOfono_should_ignore_imsi (imsi))
486++ continue;
487++
488++ res = nm_ofono_read_imsi_contexts (self, imsi, &error);
489++
490++ if (error && error->message)
491++ nm_log_warn (LOGD_SETTINGS, "SCPlugin-Ofono: %s", error->message);
492++
493++ /* TODO: could go into read_imsi_contexts? */
494++ add_gprs_file_watch(self, imsi);
495+ }
496++
497++ priv->ofono_dir_monitor_id = g_signal_connect (monitor, "changed",
498++ G_CALLBACK (ofono_dir_changed), self);
499++done:
500+ g_object_unref (config_path);
501+ }
502+
503+Index: network-manager-0.9.10.0/src/devices/wwan/nm-modem-ofono.c
504+===================================================================
505+--- network-manager-0.9.10.0.orig/src/devices/wwan/nm-modem-ofono.c
506++++ network-manager-0.9.10.0/src/devices/wwan/nm-modem-ofono.c
507+@@ -88,8 +88,6 @@ ip_string_to_network_address (const gcha
508+ return TRUE;
509+ }
510+
511+-static void ofono_read_contexts (NMModemOfono *self);
512+-
513+ static void
514+ update_modem_state (NMModemOfono *self)
515+ {
516+@@ -299,7 +297,6 @@ handle_subscriber_identity(NMModemOfono
517+ nm_log_info (LOGD_MB, "GetPropsDone: 'SubscriberIdentity': %s", priv->imsi);
518+
519+ priv->imsi = g_strdup (value_str);
520+- ofono_read_contexts (self);
521+ update_modem_state (self);
522+ }
523+ }
524+@@ -351,55 +348,6 @@ ofono_sim_properties_changed (DBusGProxy
525+ }
526+
527+ static void
528+-ofono_read_imsi_contexts_done (DBusGProxy *proxy,
529+- DBusGProxyCall *call_id,
530+- gpointer user_data)
531+-{
532+- NMModemOfono *self = NM_MODEM_OFONO (user_data);
533+- NMModemOfonoPrivate *priv = NM_MODEM_OFONO_GET_PRIVATE (self);
534+- GError *error = NULL;
535+-
536+- nm_log_dbg (LOGD_MB, "in %s", __func__);
537+-
538+- if (!dbus_g_proxy_end_call (proxy, call_id, &error, G_TYPE_INVALID)) {
539+- nm_log_warn (LOGD_MB, "failed notify settings plugin of a new context: (%d) %s",
540+- error ? error->code : -1,
541+- error && error->message ? error->message : "(unknown)");
542+- return;
543+- }
544+-}
545+-
546+-static void
547+-ofono_read_contexts (NMModemOfono *self)
548+-{
549+- NMModemOfonoPrivate *priv = NM_MODEM_OFONO_GET_PRIVATE (self);
550+- DBusGConnection *bus;
551+- DBusGProxy *settings_proxy;
552+-
553+- nm_log_dbg (LOGD_MB, "in %s", __func__);
554+-
555+- if (priv->imsi == NULL) {
556+- nm_log_warn (LOGD_MB, "No 'SubscriberIdentity', so can't read ofono GPRS contexts");
557+- return;
558+- }
559+-
560+- bus = nm_dbus_manager_get_connection (priv->dbus_mgr);
561+- settings_proxy = dbus_g_proxy_new_for_name (bus,
562+- "com.canonical.NMOfono",
563+- "/com/canonical/NMOfono",
564+- "com.canonical.NMOfono");
565+-
566+- if (settings_proxy)
567+- dbus_g_proxy_begin_call_with_timeout (settings_proxy,
568+- "ReadImsiContexts", ofono_read_imsi_contexts_done,
569+- self, NULL, 20000,
570+- G_TYPE_STRING, priv->imsi,
571+- G_TYPE_INVALID);
572+- else
573+- nm_log_warn (LOGD_MB, "could not get proxy to the oFono Settings plugin.");
574+-}
575+-
576+-static void
577+ ofono_context_added (DBusGProxy *proxy,
578+ const char *path,
579+ GValue *prop,
580+@@ -408,8 +356,6 @@ ofono_context_added (DBusGProxy *proxy,
581+ NMModemOfono *self = NM_MODEM_OFONO (user_data);
582+
583+ nm_log_dbg (LOGD_MB, "context %s added", path);
584+-
585+- ofono_read_contexts (self);
586+ }
587+
588+ static void
589+Index: network-manager-0.9.10.0/src/settings/plugins/ofono/parser.c
590+===================================================================
591+--- network-manager-0.9.10.0.orig/src/settings/plugins/ofono/parser.c
592++++ network-manager-0.9.10.0/src/settings/plugins/ofono/parser.c
593+@@ -90,10 +90,9 @@ ofono_update_connection_from_context (NM
594+ g_object_set (s_gsm, NM_SETTING_GSM_NUMBER, "*99#", NULL);
595+
596+ nm_log_info (LOGD_SETTINGS, "SCPlugin-Ofono: "
597+- "update_connection_setting_from_context: name:%s, path:%s, type:%s, id:%s, uuid: %s",
598++ "update_connection_setting_from_context: name:%s, path:%s, id:%s, uuid: %s",
599+ (char *) g_hash_table_lookup (context, "Name"),
600+ (char *) g_hash_table_lookup (context, "ID"),
601+- (char *) g_hash_table_lookup (context, "Type"),
602+ idstr, nm_setting_connection_get_uuid (s_con));
603+
604+ success = nm_connection_verify (connection, error);
605
606=== modified file 'debian/patches/series'
607--- debian/patches/series 2015-06-23 19:08:22 +0000
608+++ debian/patches/series 2015-07-06 17:29:08 +0000
609@@ -72,3 +72,4 @@
610 lp1461593-add-modem-reconnect-delay.patch
611
612 lp1445080-fix-modem-flight-mode.patch
613+lp1361864-add-ofono-preferred-contexts.patch

Subscribers

People subscribed via source and target branches

to all changes: