Public bug reported:

When the blueman-applet starts it changes turn the bluetooth hardware on
This makes the AutoEnable option in /etc/bluetooth/main.conf pointless

The applet should not change the state of bluetooth on startup

Line 76 of 
/usr/lib/python3/dist-packages/blueman/plugins/applet/PowerManager.py turns the 
applet on
furthermore line 75 does not respect the value set on line 28

The applet should check the AutoEnable variable defined in 
/etc/bluetooth/main.conf
in the event it is not defined it should check for the for it under the old 
name of InitiallyPowered


On another note we have this:
    def on_manager_state_changed(self, state):
        if state:
            def timeout():
                self.adapter_state = self.get_adapter_state()
                if self.get_option("auto-power-on"):
                    self.RequestPowerState(True, force=True)
                else:
                    self.RequestPowerState(self.adapter_state)
            GObject.timeout_add(1000, timeout)
it would be better to do this:
    def on_manager_state_changed(self, state):
        if state:
            def timeout():
                if self.get_option("auto-power-on"):
                    self.RequestPowerState(True, force=True)
                else:
                    self.RequestPowerState(self.get_adapter_state())
            GObject.timeout_add(1000, timeout)
as there is no need to make a variable for something are are using only once 
especically when we do not know that we even need to check the adapter state yet

but the real question is why we need a auto-power-on option anyway
we could just drop lines 25-32 and do this
    def on_manager_state_changed(self, state):
        if state:
            def timeout():
                self.RequestPowerState(self.get_adapter_state())
            GObject.timeout_add(1000, timeout)


The only reason I can imaging we would want to turn bluetooth on when the 
applet starts is if the user manually started it as that would mean they have a 
bluetooth device they want to it

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: blueman 2.0.5-1ubuntu1
ProcVersionSignature: Ubuntu 4.15.0-13.14-generic 4.15.10
Uname: Linux 4.15.0-13-generic x86_64
ApportVersion: 2.20.9-0ubuntu4
Architecture: amd64
CasperVersion: 1.393
CurrentDesktop: XFCE
Date: Wed Apr 11 23:00:25 2018
LiveMediaBuild: Xubuntu 18.04 LTS "Bionic Beaver" - Alpha amd64 (20180411)
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=C.UTF-8
 SHELL=/bin/bash
SourcePackage: blueman
UpgradeStatus: No upgrade log present (probably fresh install)

** Affects: blueman (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug bionic

** Patch added: 
"/usr/lib/python3/dist-packages/blueman/plugins/applet/PowerManager.py.patch"
   
https://bugs.launchpad.net/bugs/1763221/+attachment/5111442/+files/PowerManager.py.patch

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1763221

Title:
  blueman-applet enables bluethooth when it starts

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/blueman/+bug/1763221/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to