~ubuntu-branches/ubuntu/oneiric/network-manager/oneiric

« back to all changes in this revision

Viewing changes to debian/patches/git_wwan_state_detection_d0a1b23.patch

  • Committer: Bazaar Package Importer
  • Author(s): Mathieu Trudel-Lapierre
  • Date: 2011-05-06 12:59:53 UTC
  • mfrom: (1.1.45 upstream)
  • Revision ID: james.westby@ubuntu.com-20110506125953-r4ka8fnwirdjd2g8
Tags: 0.8.4-0ubuntu1
* Upstream release 0.8.4.
* debian/source/format: migrate to package format 3.0 (quilt)
* debian/patches/99_printf_formatting_fixes.patch: dropped, applied upstream.
* debian/patches/git_disconn_secrets_reqs_b613a17.patch,
  debian/patches/git_wwan_state_detection_d0a1b23.patch, 
  debian/patches/git_wired_ap_scan_value_a262dc4.patch: dropped,
  applied upstream.
* debian/patches/lp120363_smartcard_pkcs11.patch: refreshed, for reordering
  the new symbols in the symbols list file.
* debian/patches/02-dbus_access_network_manager.patch: dropped, no longer
  required (hal is deprecated).
* debian/control: merge Debian changes and migrate to DH instead of CDBS:
  - bump debhelper Build-Depends to >= 8.
  - add Build-Depends on dh-autoreconf.
  - sync Build-Depends with Debian's; this drops automake1.9, cdbs, quilt,
    gnome-common, libgnome-keyring-dev, libgnomeui-dev, libpanel-applet2-dev,
    libglade2-dev, libgconf2-dev, iproute.
  - add new package network-manager-dbg for debug symbols.
  - bump Standards-Version to 3.9.2.
* debian/control: merge binary packages dependencies with Debian, important
  changes:
  - network-manager: Depends adds udev and isc-dhcp-client (>= 4.1.1-P1-4)
  - network-manager: Recommends: adds policykit-1
  - network-manager: Suggests: adds avahi-autoipd
* debian/compat: bump to compat level 8.
* debian/rules:
  - migrate to use dh instead of CDBS.
  - add override for dh_strip to correctly strip NM to the new
    package network-manager-dbg. 
  - cleanup more extra files left behind by the build.
* debian/libnm-glib-dev.install,
  debian/libnm-glib-vpn-dev.install: clean up and sync with Debian.
* debian/libnm-glib-dev.links: drop links to legacy names for .pc files,
  introduced in Karmic for a transition: they're not required anymore.
* debian/libnm-util-dev.install: sync with Debian.
* debian/network-manager.install:
  - don't ship .a and .la files.
  - explicitly install /usr/bin/nm-online.
  - install dispatchers from upstream in /etc/NetworkManager/dispatcher.d.
  - install extra udev rules from upstream.
* debian/network-manager.dirs: sync with Debian.
* debian/network-manager.docs: define additional upstream files to ship as
  documentation.
  - drop ifblacklist_migrate.sh and /usr/share/NetworkManager/gdb-cmd
* debian/network-manager.postrm: drop old code migrating /etc/dbus-1/event.d.
* debian/network-manager.postinst: drop code migrating /etc/dbus-1/event.d.
* debian/copyright: sync with Debian.
* debian/README.Debian: add information about using System-level settings and
  connections.
* debian/watch: because I can.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
From d0a1b23ea1803fc46567af4bb38d0078c873c357 Mon Sep 17 00:00:00 2001
2
 
From: Dan Williams <dcbw@redhat.com>
3
 
Date: Thu, 14 Apr 2011 02:58:25 +0000
4
 
Subject: wwan: fix enabled state detection (bgo #647216)
5
 
 
6
 
Since the user state stuff got committed in 0.8.2, WWAN enable
7
 
state has been somewhat broken.  The problem is that we want two
8
 
things: (1) that the current modem enabled state is reflected
9
 
in the WwanEnabled property, and (2) that enabled state should not
10
 
affect the user's ability to enable the modem via the UI.
11
 
 
12
 
The code did not properly separate these two.  For all automatic
13
 
decisions and properties (ie the WwanEnabled property, setting the
14
 
initial enabled state on startup or hotplug, etc) the ModemManager
15
 
enabled state should be respected.  But the user should be able
16
 
to override that state by turn WWAN on.
17
 
 
18
 
This calls for a fourth enabled check that modems have, the 'daemon'
19
 
state, distinct from the hardware and software kernel rfkill states
20
 
and from the user's chosen enabled/disabled state.  Add that new
21
 
check.
22
 
 
23
 
The actual problem was in manager_radio_user_toggled() where after
24
 
updating the user enabled state, new_enabled still equaled
25
 
old_enabled, because the kernel rfkill state was a combination of
26
 
both the kernel rfkill state *and* the ModemManager enabled state,
27
 
so the manager_update_radio_enabled() call would never happen and
28
 
the modem would never become enabled as a result of a user request.
29
 
---
30
 
diff --git a/src/nm-manager.c b/src/nm-manager.c
31
 
index 093585e..b0b12f8 100644
32
 
--- a/src/nm-manager.c
33
 
+++ b/src/nm-manager.c
34
 
@@ -188,6 +188,7 @@ struct PendingActivation {
35
 
 
36
 
 typedef struct {
37
 
        gboolean user_enabled;
38
 
+       gboolean daemon_enabled;
39
 
        gboolean sw_enabled;
40
 
        gboolean hw_enabled;
41
 
        RfKillType rtype;
42
 
@@ -196,6 +197,7 @@ typedef struct {
43
 
        const char *prop;
44
 
        const char *hw_prop;
45
 
        RfKillState (*other_enabled_func) (NMManager *);
46
 
+       RfKillState (*daemon_enabled_func) (NMManager *);
47
 
 } RadioState;
48
 
 
49
 
 typedef struct {
50
 
@@ -1648,21 +1650,28 @@ write_value_to_state_file (const char *filename,
51
 
 }
52
 
 
53
 
 static gboolean
54
 
-radio_enabled_for_rstate (RadioState *rstate)
55
 
+radio_enabled_for_rstate (RadioState *rstate, gboolean check_daemon_enabled)
56
 
 {
57
 
-       return rstate->user_enabled && rstate->sw_enabled && rstate->hw_enabled;
58
 
+       gboolean enabled;
59
 
+
60
 
+       enabled = rstate->user_enabled && rstate->sw_enabled && rstate->hw_enabled;
61
 
+       if (rstate->daemon_enabled_func && check_daemon_enabled)
62
 
+               enabled &= rstate->daemon_enabled;
63
 
+       return enabled;
64
 
 }
65
 
 
66
 
 static gboolean
67
 
-radio_enabled_for_type (NMManager *self, RfKillType rtype)
68
 
+radio_enabled_for_type (NMManager *self, RfKillType rtype, gboolean check_daemon_enabled)
69
 
 {
70
 
        NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
71
 
 
72
 
-       return radio_enabled_for_rstate (&priv->radio_states[rtype]);
73
 
+       return radio_enabled_for_rstate (&priv->radio_states[rtype], check_daemon_enabled);
74
 
 }
75
 
 
76
 
 static void
77
 
-manager_update_radio_enabled (NMManager *self, RadioState *rstate)
78
 
+manager_update_radio_enabled (NMManager *self,
79
 
+                              RadioState *rstate,
80
 
+                              gboolean enabled)
81
 
 {
82
 
        NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
83
 
        GSList *iter;
84
 
@@ -1680,7 +1689,6 @@ manager_update_radio_enabled (NMManager *self, RadioState *rstate)
85
 
        /* enable/disable wireless devices as required */
86
 
        for (iter = priv->devices; iter; iter = iter->next) {
87
 
                RfKillType devtype = RFKILL_TYPE_UNKNOWN;
88
 
-               gboolean enabled = radio_enabled_for_rstate (rstate);
89
 
 
90
 
                g_object_get (G_OBJECT (iter->data), NM_DEVICE_INTERFACE_RFKILL_TYPE, &devtype, NULL);
91
 
                if (devtype == rstate->rtype) {
92
 
@@ -1827,9 +1835,9 @@ manager_rfkill_update_one_type (NMManager *self,
93
 
        RfKillState other_state = RFKILL_UNBLOCKED;
94
 
        RfKillState composite;
95
 
        gboolean old_enabled, new_enabled, old_rfkilled, new_rfkilled;
96
 
-       gboolean old_hwe;
97
 
+       gboolean old_hwe, old_daemon_enabled = FALSE;
98
 
 
99
 
-       old_enabled = radio_enabled_for_rstate (rstate);
100
 
+       old_enabled = radio_enabled_for_rstate (rstate, TRUE);
101
 
        old_rfkilled = rstate->hw_enabled && rstate->sw_enabled;
102
 
        old_hwe = rstate->hw_enabled;
103
 
 
104
 
@@ -1848,9 +1856,26 @@ manager_rfkill_update_one_type (NMManager *self,
105
 
 
106
 
        update_rstate_from_rfkill (rstate, composite);
107
 
 
108
 
+       /* If the device has a management daemon that can affect enabled state, check that now */
109
 
+       if (rstate->daemon_enabled_func) {
110
 
+               old_daemon_enabled = rstate->daemon_enabled;
111
 
+               rstate->daemon_enabled = (rstate->daemon_enabled_func (self) == RFKILL_UNBLOCKED);
112
 
+               if (old_daemon_enabled != rstate->daemon_enabled) {
113
 
+                       nm_log_info (LOGD_RFKILL, "%s now %s by management service",
114
 
+                                        rstate->desc,
115
 
+                                        rstate->daemon_enabled ? "enabled" : "disabled");
116
 
+               }
117
 
+       }
118
 
+
119
 
+       /* Print out all states affecting device enablement */
120
 
        if (rstate->desc) {
121
 
-               nm_log_dbg (LOGD_RFKILL, "%s hw-enabled %d sw-enabled %d",
122
 
-                           rstate->desc, rstate->hw_enabled, rstate->sw_enabled);
123
 
+               if (rstate->daemon_enabled_func) {
124
 
+                       nm_log_dbg (LOGD_RFKILL, "%s hw-enabled %d sw-enabled %d daemon-enabled %d",
125
 
+                                   rstate->desc, rstate->hw_enabled, rstate->sw_enabled, rstate->daemon_enabled);
126
 
+               } else {
127
 
+                       nm_log_dbg (LOGD_RFKILL, "%s hw-enabled %d sw-enabled %d",
128
 
+                                   rstate->desc, rstate->hw_enabled, rstate->sw_enabled);
129
 
+               }
130
 
        }
131
 
 
132
 
        /* Log new killswitch state */
133
 
@@ -1867,10 +1892,14 @@ manager_rfkill_update_one_type (NMManager *self,
134
 
                        g_object_notify (G_OBJECT (self), rstate->hw_prop);
135
 
        }
136
 
 
137
 
-       /* And finally update the actual device radio state itself */
138
 
-       new_enabled = radio_enabled_for_rstate (rstate);
139
 
+       /* And finally update the actual device radio state itself; respect the
140
 
+        * daemon state here because this is never called from user-triggered
141
 
+        * radio changes and we only want to ignore the daemon enabled state when
142
 
+        * handling user radio change requests.
143
 
+        */
144
 
+       new_enabled = radio_enabled_for_rstate (rstate, TRUE);
145
 
        if (new_enabled != old_enabled)
146
 
-               manager_update_radio_enabled (self, rstate);
147
 
+               manager_update_radio_enabled (self, rstate, new_enabled);
148
 
 }
149
 
 
150
 
 static void
151
 
@@ -1879,14 +1908,13 @@ nm_manager_rfkill_update (NMManager *self, RfKillType rtype)
152
 
        NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
153
 
        guint i;
154
 
 
155
 
-       if (rtype != RFKILL_TYPE_UNKNOWN) {
156
 
+       if (rtype != RFKILL_TYPE_UNKNOWN)
157
 
                manager_rfkill_update_one_type (self, &priv->radio_states[rtype], rtype);
158
 
-               return;
159
 
+       else {
160
 
+               /* Otherwise sync all radio types */
161
 
+               for (i = 0; i < RFKILL_TYPE_MAX; i++)
162
 
+                       manager_rfkill_update_one_type (self, &priv->radio_states[i], i);
163
 
        }
164
 
-
165
 
-       /* Otherwise sync all radio types */
166
 
-       for (i = 0; i < RFKILL_TYPE_MAX; i++)
167
 
-               manager_rfkill_update_one_type (self, &priv->radio_states[i], i);
168
 
 }
169
 
 
170
 
 static void
171
 
@@ -2081,6 +2109,7 @@ add_device (NMManager *self, NMDevice *device)
172
 
        GHashTableIter iter;
173
 
        gpointer value;
174
 
        gboolean managed = FALSE, enabled = FALSE;
175
 
+       RfKillType rtype = RFKILL_TYPE_UNKNOWN;
176
 
 
177
 
        iface = nm_device_get_ip_iface (device);
178
 
        g_assert (iface);
179
 
@@ -2114,26 +2143,21 @@ add_device (NMManager *self, NMDevice *device)
180
 
                g_signal_connect (device, "notify::" NM_DEVICE_WIFI_IPW_RFKILL_STATE,
181
 
                                  G_CALLBACK (manager_ipw_rfkill_state_changed),
182
 
                                  self);
183
 
-
184
 
-               /* Update global rfkill state with this device's rfkill state, and
185
 
-                * then set this device's rfkill state based on the global state.
186
 
-                */
187
 
-               nm_manager_rfkill_update (self, RFKILL_TYPE_WLAN);
188
 
-               enabled = radio_enabled_for_type (self, RFKILL_TYPE_WLAN);
189
 
-               nm_device_interface_set_enabled (NM_DEVICE_INTERFACE (device), enabled);
190
 
+               rtype = RFKILL_TYPE_WLAN;
191
 
        } else if (NM_IS_DEVICE_MODEM (device)) {
192
 
                g_signal_connect (device, NM_DEVICE_MODEM_ENABLE_CHANGED,
193
 
                                  G_CALLBACK (manager_modem_enabled_changed),
194
 
                                  self);
195
 
+               rtype = RFKILL_TYPE_WWAN;
196
 
+       }
197
 
 
198
 
-               nm_manager_rfkill_update (self, RFKILL_TYPE_WWAN);
199
 
-               enabled = radio_enabled_for_type (self, RFKILL_TYPE_WWAN);
200
 
-               /* Until we start respecting WWAN rfkill switches the modem itself
201
 
-                * is the source of the enabled/disabled state, so the manager shouldn't
202
 
-                * touch it here.
203
 
-               nm_device_interface_set_enabled (NM_DEVICE_INTERFACE (device),
204
 
-                                                priv->radio_states[RFKILL_TYPE_WWAN].enabled);
205
 
-               */
206
 
+       if (rtype != RFKILL_TYPE_UNKNOWN) {
207
 
+               /* Update global rfkill state with this device's rfkill state, and
208
 
+                * then set this device's rfkill state based on the global state.
209
 
+                */
210
 
+               nm_manager_rfkill_update (self, rtype);
211
 
+               enabled = radio_enabled_for_type (self, rtype, TRUE);
212
 
+               nm_device_interface_set_enabled (NM_DEVICE_INTERFACE (device), enabled);
213
 
        }
214
 
 
215
 
        type_desc = nm_device_get_type_desc (device);
216
 
@@ -3372,7 +3396,7 @@ do_sleep_wake (NMManager *self)
217
 
                         */
218
 
                        for (i = 0; i < RFKILL_TYPE_MAX; i++) {
219
 
                                RadioState *rstate = &priv->radio_states[i];
220
 
-                               gboolean enabled = radio_enabled_for_rstate (rstate);
221
 
+                               gboolean enabled = radio_enabled_for_rstate (rstate, TRUE);
222
 
                                RfKillType devtype = RFKILL_TYPE_UNKNOWN;
223
 
 
224
 
                                if (rstate->desc) {
225
 
@@ -3986,6 +4010,7 @@ nm_manager_start (NMManager *self)
226
 
        for (i = 0; i < RFKILL_TYPE_MAX; i++) {
227
 
                RadioState *rstate = &priv->radio_states[i];
228
 
                RfKillState udev_state;
229
 
+               gboolean enabled;
230
 
 
231
 
                if (!rstate->desc)
232
 
                        continue;
233
 
@@ -3999,7 +4024,8 @@ nm_manager_start (NMManager *self)
234
 
                                         (rstate->hw_enabled && rstate->sw_enabled) ? "enabled" : "disabled",
235
 
                                         rstate->user_enabled ? "enabled" : "disabled");
236
 
                }
237
 
-               manager_update_radio_enabled (self, rstate);
238
 
+               enabled = radio_enabled_for_rstate (rstate, TRUE);
239
 
+               manager_update_radio_enabled (self, rstate, enabled);
240
 
        }
241
 
 
242
 
        /* Log overall networking status - enabled/disabled */
243
 
@@ -4475,11 +4501,20 @@ manager_radio_user_toggled (NMManager *self,
244
 
                }
245
 
        }
246
 
 
247
 
-       old_enabled = radio_enabled_for_rstate (rstate);
248
 
+       /* When the user toggles the radio, their request should override any
249
 
+        * daemon (like ModemManager) enabled state that can be changed.  For WWAN
250
 
+        * for example, we want the WwanEnabled property to reflect the daemon state
251
 
+        * too so that users can toggle the modem powered, but we don't want that
252
 
+        * daemon state to affect whether or not the user *can* turn it on, which is
253
 
+        * what the kernel rfkill state does.  So we ignore daemon enabled state
254
 
+        * when determining what the new state should be since it shouldn't block
255
 
+        * the user's request.
256
 
+        */
257
 
+       old_enabled = radio_enabled_for_rstate (rstate, TRUE);
258
 
        rstate->user_enabled = enabled;
259
 
-       new_enabled = radio_enabled_for_rstate (rstate);
260
 
+       new_enabled = radio_enabled_for_rstate (rstate, FALSE);
261
 
        if (new_enabled != old_enabled)
262
 
-               manager_update_radio_enabled (self, rstate);
263
 
+               manager_update_radio_enabled (self, rstate, new_enabled);
264
 
 }
265
 
 
266
 
 static void
267
 
@@ -4529,13 +4564,13 @@ get_property (GObject *object, guint prop_id,
268
 
                g_value_set_boolean (value, priv->net_enabled);
269
 
                break;
270
 
        case PROP_WIRELESS_ENABLED:
271
 
-               g_value_set_boolean (value, radio_enabled_for_type (self, RFKILL_TYPE_WLAN));
272
 
+               g_value_set_boolean (value, radio_enabled_for_type (self, RFKILL_TYPE_WLAN, TRUE));
273
 
                break;
274
 
        case PROP_WIRELESS_HARDWARE_ENABLED:
275
 
                g_value_set_boolean (value, priv->radio_states[RFKILL_TYPE_WLAN].hw_enabled);
276
 
                break;
277
 
        case PROP_WWAN_ENABLED:
278
 
-               g_value_set_boolean (value, radio_enabled_for_type (self, RFKILL_TYPE_WWAN));
279
 
+               g_value_set_boolean (value, radio_enabled_for_type (self, RFKILL_TYPE_WWAN, TRUE));
280
 
                break;
281
 
        case PROP_WWAN_HARDWARE_ENABLED:
282
 
                g_value_set_boolean (value, priv->radio_states[RFKILL_TYPE_WWAN].hw_enabled);
283
 
@@ -4602,7 +4637,7 @@ nm_manager_init (NMManager *manager)
284
 
        priv->radio_states[RFKILL_TYPE_WWAN].prop = NM_MANAGER_WWAN_ENABLED;
285
 
        priv->radio_states[RFKILL_TYPE_WWAN].hw_prop = NM_MANAGER_WWAN_HARDWARE_ENABLED;
286
 
        priv->radio_states[RFKILL_TYPE_WWAN].desc = "WWAN";
287
 
-       priv->radio_states[RFKILL_TYPE_WWAN].other_enabled_func = nm_manager_get_modem_enabled_state;
288
 
+       priv->radio_states[RFKILL_TYPE_WWAN].daemon_enabled_func = nm_manager_get_modem_enabled_state;
289
 
        priv->radio_states[RFKILL_TYPE_WWAN].rtype = RFKILL_TYPE_WWAN;
290
 
 
291
 
        priv->radio_states[RFKILL_TYPE_WIMAX].user_enabled = TRUE;
292
 
--
293
 
cgit v0.8.3-6-g21f6