diff options
author | Kai Kang <kai.kang@windriver.com> | 2019-10-25 12:56:48 +0800 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2019-10-25 10:32:45 -0700 |
commit | 863f9023bceffc419ad43efb39800fd4af7400f9 (patch) | |
tree | d6cee693a77c6d3daecd0c37ab2d1d6f2105a67b /meta-networking | |
parent | 95d95dcb1048a0ee4263ff1c48af962f31fb809f (diff) | |
download | meta-openembedded-863f9023bceffc419ad43efb39800fd4af7400f9.tar.gz |
blueman: fix fail to enable bluetooth issue
When launch blueman-manager while bluetooth is disable, it may fails
with error:
Failed to enable bluetooth
Because when get bluetooth status right after change its status, the
status may not be updated that plugin applet/KillSwitch.py sets the
bluetooth status via method of another dbus service which doesn't return
immediately.
Provides a new dbus method for PowerManager which checks whether dbus
method SetBluetoothStatus() has finished. Then it makes sure to get
right bluetooth status.
Signed-off-by: Kai Kang <kai.kang@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-networking')
-rw-r--r-- | meta-networking/recipes-connectivity/blueman/blueman/0002-fix-fail-to-enable-bluetooth.patch | 81 | ||||
-rw-r--r-- | meta-networking/recipes-connectivity/blueman/blueman_2.1.1.bb | 1 |
2 files changed, 82 insertions, 0 deletions
diff --git a/meta-networking/recipes-connectivity/blueman/blueman/0002-fix-fail-to-enable-bluetooth.patch b/meta-networking/recipes-connectivity/blueman/blueman/0002-fix-fail-to-enable-bluetooth.patch new file mode 100644 index 000000000..00115cfca --- /dev/null +++ b/meta-networking/recipes-connectivity/blueman/blueman/0002-fix-fail-to-enable-bluetooth.patch | |||
@@ -0,0 +1,81 @@ | |||
1 | Fix fail to enable bluetooth issue | ||
2 | |||
3 | When launch blueman-manager while bluetooth is disable, it may fails | ||
4 | with error: | ||
5 | |||
6 | Failed to enable bluetooth | ||
7 | |||
8 | Because when get bluetooth status right after change its status, the | ||
9 | status may not be updated that plugin applet/KillSwitch.py sets the | ||
10 | bluetooth status via method of another dbus service which doesn't return | ||
11 | immediately. | ||
12 | |||
13 | Provides a new dbus method for PowerManager which checks whether dbus | ||
14 | method SetBluetoothStatus() has finished. Then it makes sure to get | ||
15 | right bluetooth status. | ||
16 | |||
17 | Upstream-Status: Inappropriate | ||
18 | Send to upstream but not accepted: | ||
19 | https://github.com/blueman-project/blueman/pull/1121 | ||
20 | |||
21 | Signed-off-by: Kai Kang <kai.kang@windriver.com> | ||
22 | --- | ||
23 | blueman/Functions.py | 12 +++++++++++- | ||
24 | blueman/plugins/applet/PowerManager.py | 4 ++++ | ||
25 | 2 files changed, 15 insertions(+), 1 deletion(-) | ||
26 | |||
27 | diff --git a/blueman/Functions.py b/blueman/Functions.py | ||
28 | index 3b76271..c5eeb27 100644 | ||
29 | --- a/blueman/Functions.py | ||
30 | +++ b/blueman/Functions.py | ||
31 | @@ -17,7 +17,7 @@ | ||
32 | # You should have received a copy of the GNU General Public License | ||
33 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
34 | # | ||
35 | -from time import sleep | ||
36 | +from time import sleep, time | ||
37 | import re | ||
38 | import os | ||
39 | import signal | ||
40 | @@ -86,6 +86,16 @@ def check_bluetooth_status(message, exitfunc): | ||
41 | return | ||
42 | |||
43 | applet.SetBluetoothStatus('(b)', True) | ||
44 | + | ||
45 | + timeout = time() + 10 | ||
46 | + while applet.GetRequestStatus(): | ||
47 | + sleep(0.1) | ||
48 | + if time() > timeout: | ||
49 | + # timeout 5s has been set in applet/PowerManager.py | ||
50 | + # so it should NOT reach timeout here | ||
51 | + logging.warning('Should NOT reach timeout.') | ||
52 | + break | ||
53 | + | ||
54 | if not applet.GetBluetoothStatus(): | ||
55 | print('Failed to enable bluetooth') | ||
56 | exitfunc() | ||
57 | diff --git a/blueman/plugins/applet/PowerManager.py b/blueman/plugins/applet/PowerManager.py | ||
58 | index 8ec9fc4..29a0fb0 100644 | ||
59 | --- a/blueman/plugins/applet/PowerManager.py | ||
60 | +++ b/blueman/plugins/applet/PowerManager.py | ||
61 | @@ -48,6 +48,7 @@ class PowerManager(AppletPlugin): | ||
62 | self._add_dbus_signal("BluetoothStatusChanged", "b") | ||
63 | self._add_dbus_method("SetBluetoothStatus", ("b",), "", self.request_power_state) | ||
64 | self._add_dbus_method("GetBluetoothStatus", (), "b", self.get_bluetooth_status) | ||
65 | + self._add_dbus_method("GetRequestStatus", (), "b", self.get_request_status) | ||
66 | |||
67 | def on_unload(self): | ||
68 | self.parent.Plugins.Menu.unregister(self) | ||
69 | @@ -182,6 +183,9 @@ class PowerManager(AppletPlugin): | ||
70 | def get_bluetooth_status(self): | ||
71 | return self.current_state | ||
72 | |||
73 | + def get_request_status(self): | ||
74 | + return self.request_in_progress | ||
75 | + | ||
76 | def on_adapter_property_changed(self, _path, key, value): | ||
77 | if key == "Powered": | ||
78 | if value and not self.current_state: | ||
79 | -- | ||
80 | 2.20.1 | ||
81 | |||
diff --git a/meta-networking/recipes-connectivity/blueman/blueman_2.1.1.bb b/meta-networking/recipes-connectivity/blueman/blueman_2.1.1.bb index 36de2af1d..96c8bb26c 100644 --- a/meta-networking/recipes-connectivity/blueman/blueman_2.1.1.bb +++ b/meta-networking/recipes-connectivity/blueman/blueman_2.1.1.bb | |||
@@ -9,6 +9,7 @@ inherit autotools systemd gsettings python3native gtk-icon-cache | |||
9 | SRC_URI = " \ | 9 | SRC_URI = " \ |
10 | https://github.com/blueman-project/blueman/releases/download/${PV}/blueman-${PV}.tar.xz \ | 10 | https://github.com/blueman-project/blueman/releases/download/${PV}/blueman-${PV}.tar.xz \ |
11 | file://0001-Search-for-cython3.patch \ | 11 | file://0001-Search-for-cython3.patch \ |
12 | file://0002-fix-fail-to-enable-bluetooth.patch \ | ||
12 | " | 13 | " |
13 | SRC_URI[md5sum] = "9de89abb31be45bdbf11f7884764a2dc" | 14 | SRC_URI[md5sum] = "9de89abb31be45bdbf11f7884764a2dc" |
14 | SRC_URI[sha256sum] = "f1eab2334e5a1587defa80900901048d14c2e8ffa8c0cff7240bc9937a61dbc3" | 15 | SRC_URI[sha256sum] = "f1eab2334e5a1587defa80900901048d14c2e8ffa8c0cff7240bc9937a61dbc3" |