After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 646706 - network: Mobile broadband switch shows "OFF" after connecting
network: Mobile broadband switch shows "OFF" after connecting
Status: RESOLVED DUPLICATE of bug 647216
Product: gnome-shell
Classification: Core
Component: network-indicator
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2011-04-04 12:31 UTC by Dan Winship
Modified: 2011-05-23 15:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
network: Mobile broadband switch shows "OFF" after connecting (1.03 KB, patch)
2011-04-04 12:31 UTC, Dan Winship
none Details | Review
network: Mobile broadband switch shows "OFF" after connecting (1.40 KB, patch)
2011-04-04 13:29 UTC, Dan Winship
none Details | Review

Description Dan Winship 2011-04-04 12:31:06 UTC
obvious 1-line patch attached
Comment 1 Dan Winship 2011-04-04 12:31:09 UTC
Created attachment 185103 [details] [review]
network: Mobile broadband switch shows "OFF" after connecting

The Mobile broadband switch was not getting set to "ON" after a
connection completed, meaning that in order to disconnect it, you had
to select it twice (once to force it to correctly sync to "ON", and
then again to turn it off).
Comment 2 Giovanni Campagna 2011-04-04 12:36:41 UTC
(In reply to comment #1)
> Created an attachment (id=185103) [details] [review]
> network: Mobile broadband switch shows "OFF" after connecting
> 
> The Mobile broadband switch was not getting set to "ON" after a
> connection completed, meaning that in order to disconnect it, you had
> to select it twice (once to force it to correctly sync to "ON", and
> then again to turn it off).

The patch is wrong. connected is not a NMClient.Device property, is an accessor property in NMDevice, and it should return true when the associated device is connected.

Is this happening with more than one mobile broadband device connected? Otherwise, it maybe a problem with tracking "wwan-enabled" on NMClient.Client.
Comment 3 Dan Winship 2011-04-04 13:29:36 UTC
Created attachment 185107 [details] [review]
network: Mobile broadband switch shows "OFF" after connecting

wacky. could have sworn I'd tested that.

Ok, multiple problems here. First, this._enabled is only true after the
toggle has been turned on, but we're using it here to decide whether or not
to turn the toggle on, which is no good.

Second, the enum value was wrong.

Even with these fixes though, it still doesn't work. Adding some log
statements shows that it's enabling the toggle switch on some different,
non-visible, nameless menu item. Not sure what's happening.
Comment 4 Giovanni Campagna 2011-04-04 15:00:55 UTC
(In reply to comment #3)
> Created an attachment (id=185107) [details] [review]
> network: Mobile broadband switch shows "OFF" after connecting
> 
> wacky. could have sworn I'd tested that.
> 
> Ok, multiple problems here. First, this._enabled is only true after the
> toggle has been turned on, but we're using it here to decide whether or not
> to turn the toggle on, which is no good.
> 
> Second, the enum value was wrong.

Ok with the enum value, not with the _enabled stuff. Nothing connects to that "enabled-changed" (NMApplet connects to the more generic "state-changed"), so changing its signature has no effect.
_enabled means NMClient.wwan_enabled && NMClient.wwan_hardware_enabled, which is a prerequisite for a mobile broadband device reporting "connected", so the second fix should be ok.
Under no occasions NMDevice._enabled should be different to (NMClient.wwan_enabled && NMClient.wwan_hardware_enabled), and under no occasions it should happen that we get a NMDevice::state-changed without first a NMClient::notify::wwan-enabled.

> 
> Even with these fixes though, it still doesn't work. Adding some log
> statements shows that it's enabling the toggle switch on some different,
> non-visible, nameless menu item. Not sure what's happening.

There are two menu items involved here.
One is the "Mobile Broadband" subtitle item, which is NMApplet._devices.wwan.item, a NMWirelessSectionTitleMenuItem, whose toggle (if visible) tracks the properties on NMClient, and nothing else. The .connected property, as well as invoking .updateForDevice, has no effect on it, only on the status text.
The other is the device specific subtitle, which is NMDevice.statusItem, a NMDeviceTitleMenuItem, whose toggle, if operated, acts on NMDevice.activate / NMDevice.deactivate, and is updated by NMDevice._deviceStateChanged (with the additional constraint that Switch always changes its value, and expects the controller to revert). Because of bug 646074, the device specific subtitle has no text in it, but should be visible and with a switch anyway.
This means that there are two modes of operation, controlled by NMApplet._syncSectionTitle: if there are two or more wwan devices, the section subtitle item is set to track no device (which therefore shows the switch) and all the device subtitles are show, otherwise the device subtitles are hidden and the section subtitle shows the status text from the only device, or the switch.

It is a bit messy indeed, with three kind of switches all having slightly different semantics...

(Small update after testing... indeed, clicking on a connection has no effect on wwan_enabled, so the bug lies in NetworkManager...)
Comment 5 Dan Williams 2011-05-03 19:42:30 UTC
The WWAN enabled thing has been fixed in NM since:

commit 9152c304ff0f88308ae6176b8c2dddfb1988c434
Author: Dan Williams <dcbw@redhat.com>
Date:   Wed Apr 13 21:58:25 2011 -0500

    wwan: fix enabled state detection (bgo #647216)
Comment 6 Dan Winship 2011-05-23 15:17:09 UTC

*** This bug has been marked as a duplicate of bug 647216 ***