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 789110 - bluetooth: inconsistent state sometimes when coming back from suspend
bluetooth: inconsistent state sometimes when coming back from suspend
Status: RESOLVED INCOMPLETE
Product: gnome-shell
Classification: Core
Component: system-status
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2017-10-17 16:50 UTC by Mario Sánchez Prada
Modified: 2020-01-17 03:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Inconsistency in the bluetooth menu (112.45 KB, image/png)
2017-10-17 16:50 UTC, Mario Sánchez Prada
  Details
1. bluetooth: Add missing 'BluetoothHardwareAirplaneMode' to D-Bus interface (1.30 KB, patch)
2017-10-17 17:01 UTC, Mario Sánchez Prada
committed Details | Review
2. bluetooth: Be consistent when determining whether Bluetooth is off (1.76 KB, patch)
2017-10-17 17:01 UTC, Mario Sánchez Prada
reviewed Details | Review

Description Mario Sánchez Prada 2017-10-17 16:50:14 UTC
Created attachment 361759 [details]
Inconsistency in the bluetooth menu

In Endless's fork of GNOME Shell 3.24, we sometimes get an inconsistent state in the system menu for the Bluetooth, that leads to weird situations where you see the menu item as "Off" even if bluetooth is active (and we know that because we can use the BT mouse), with a submenu item showing "Turn Off".

See the attached picture for a better visual description of the problem.

As far as I can see, this is a problem in master too, patch will be coming soon..
Comment 1 Mario Sánchez Prada 2017-10-17 17:01:17 UTC
Created attachment 361760 [details] [review]
1. bluetooth: Add missing 'BluetoothHardwareAirplaneMode' to D-Bus interface
Comment 2 Mario Sánchez Prada 2017-10-17 17:01:34 UTC
Created attachment 361761 [details] [review]
2. bluetooth: Be consistent when determining whether Bluetooth is off
Comment 3 Florian Müllner 2017-10-17 17:13:36 UTC
Review of attachment 361760 [details] [review]:

Whoops
Comment 4 Florian Müllner 2017-10-17 17:39:40 UTC
Review of attachment 361761 [details] [review]:

> otherwise we risk showing inconsistent states in each place if.

I'd be interested in how that sentence continues :-p

Joking aside, I don't think this is correct. As far as I can see, "nConnectedDevices == -1" means there is no Bluetooth adapter that is powered on - we can toggle the AirplaneMode property as much as we want (that's what "Turn On/Off" does after all), that's not going to change. So a better option may be to do

  this._toggleItem.actor.visible = nConnectedDevices > -1;

instead ...

::: js/ui/status/bluetooth.js
@@ +134,3 @@
 
+        // Bluetooth will be considered 'Off' if either the adapter
+        // is not available or it's set in irplane mode.

*airplane
Comment 5 Mario Sánchez Prada 2017-10-17 19:20:09 UTC
Comment on attachment 361760 [details] [review]
1. bluetooth: Add missing 'BluetoothHardwareAirplaneMode' to D-Bus interface

(In reply to Florian Müllner from comment #3)
> Review of attachment 361760 [details] [review] [review]:
> 
> Whoops

Thanks for the review. Commmitted:
https://git.gnome.org/browse/gnome-shell/commit/?id=fb3070981c549ad9812d62f8ab868c323ed2ccf5
Comment 6 Mario Sánchez Prada 2017-10-17 19:27:40 UTC
(In reply to Florian Müllner from comment #4)
> Review of attachment 361761 [details] [review] [review]:
> 
> > otherwise we risk showing inconsistent states in each place if.
> 
> I'd be interested in how that sentence continues :-p

I'd be too, but I can't remember what I had in there :). I suppose it' was something along the lines of "...if the adapter is available but it's set in airplane mode".

> Joking aside, I don't think this is correct. As far as I can see,
> "nConnectedDevices == -1" means there is no Bluetooth adapter that is
> powered on - we can toggle the AirplaneMode property as much as we want
> (that's what "Turn On/Off" does after all), that's not going to change. So a
> better option may be to do
> 
>   this._toggleItem.actor.visible = nConnectedDevices > -1;
> 
> instead ...
> 
> ::: js/ui/status/bluetooth.js
> @@ +134,3 @@
>  
> +        // Bluetooth will be considered 'Off' if either the adapter
> +        // is not available or it's set in irplane mode.
> 
> *airplane

I thought the same thing, but I'm not 100% sure on whether it's possible to have a BT adapter that would be "powered on"/"available" and would still report to be in airplane mode (either soft or hard), so I thought the sane thing to do was to check both things, just in case.

What looks more clear to me, is that the same condition should be used in both places, since what you want to show in both labels depend on exactly the same thing.

I'm adding Bastien to CC, since he added the original code and might have extra info to decide what's best to do here.
Comment 7 Bastien Nocera 2018-11-21 20:10:32 UTC
Was moved to https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/118, closing.
Comment 8 Daniel van Vugt 2020-01-17 03:47:59 UTC
Please reopen this bug. The above link is not a bug.