Merge ~jocave/plainbox-provider-checkbox:bluez-controller-detect into plainbox-provider-checkbox:master

Proposed by Jonathan Cave
Status: Merged
Approved by: Chris Wayne
Approved revision: b8d8c2a9418eb75fa4362c743881502e5b252fd5
Merged at revision: a9ca90808e0313bf2bb906ccd67a85116780b48b
Proposed branch: ~jocave/plainbox-provider-checkbox:bluez-controller-detect
Merge into: plainbox-provider-checkbox:master
Diff against target: 70 lines (+53/-0)
2 files modified
bin/bluez_list_adapters.py (+37/-0)
units/bluetooth/jobs.pxu (+16/-0)
Reviewer Review Type Date Requested Status
Checkbox Developers Pending
Review via email: mp+361576@code.launchpad.net

Description of the change

Add a follow on detect job so that if rfkill identifies a bluetooth adapter a simple test is carried out to see if Bluez is able to detect it.

This should give a better picture of whether basic bluez setup is correct before attempting to connect with another device (e.g. by the eddystone test)

Tested on a Pi3 B+ in the lab running remote.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/bin/bluez_list_adapters.py b/bin/bluez_list_adapters.py
0new file mode 1007550new file mode 100755
index 0000000..87c68c2
--- /dev/null
+++ b/bin/bluez_list_adapters.py
@@ -0,0 +1,37 @@
1#!/usr/bin/env python3
2#
3# This file is part of Checkbox.
4#
5# Copyright 2018 Canonical Ltd.
6#
7# Authors:
8# Jonathan Cave <jonathan.cave@canonical.com>
9#
10# Checkbox is free software: you can redistribute it and/or modify
11# it under the terms of the GNU General Public License version 3,
12# as published by the Free Software Foundation.
13#
14# Checkbox is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with Checkbox. If not, see <http://www.gnu.org/licenses/>.
21
22import checkbox_support.bt_helper as bt_helper
23
24import sys
25
26
27def main():
28 manager = bt_helper.BtManager()
29 bt_adapter_not_found = True
30 for dev in manager.get_bt_adapters():
31 bt_adapter_not_found = False
32 print(dev._if.object_path.split('/')[-1])
33 return bt_adapter_not_found
34
35
36if __name__ == "__main__":
37 sys.exit(main())
diff --git a/units/bluetooth/jobs.pxu b/units/bluetooth/jobs.pxu
index 3b71e70..f40a6e0 100644
--- a/units/bluetooth/jobs.pxu
+++ b/units/bluetooth/jobs.pxu
@@ -10,6 +10,22 @@ flags: preserve-locale
10requires: manifest.has_bt_adapter10requires: manifest.has_bt_adapter
11imports: from com.canonical.plainbox import manifest11imports: from com.canonical.plainbox import manifest
1212
13id: bluetooth/bluez-controller-detect
14category_id: com.canonical.plainbox::bluetooth
15_summary: Check bluez lists a controller if rfkill detects one
16plugin: shell
17user: root
18depends: bluetooth/detect
19template-engine: jinja2
20requires:
21 package.name == 'bluez' or snap.name == 'bluez'
22 {%- if __on_ubuntucore__ %}
23 connections.slot == 'bluez:service' and connections.plug == '{{ __system_env__["SNAP_NAME"] }}:bluez'
24 {% endif -%}
25command:
26 bluez_list_adapters.py
27estimated_duration: 2s
28flags: preserve-locale
1329
14plugin: shell30plugin: shell
15category_id: com.canonical.plainbox::bluetooth31category_id: com.canonical.plainbox::bluetooth

Subscribers

People subscribed via source and target branches