Merge ~dirksu/plainbox-provider-resource:check_wifi6e into plainbox-provider-resource:master

Proposed by Dirk Su
Status: Superseded
Proposed branch: ~dirksu/plainbox-provider-resource:check_wifi6e
Merge into: plainbox-provider-resource:master
Diff against target: 54 lines (+38/-0)
2 files modified
bin/check_wifi6e.py (+37/-0)
jobs/resource.pxu (+1/-0)
Reviewer Review Type Date Requested Status
Sylvain Pineau Pending
Checkbox Developers Pending
Review via email: mp+416568@code.launchpad.net

This proposal supersedes a proposal from 2022-03-08.

This proposal has been superseded by a proposal from 2022-03-10.

Commit message

Add 802.11ax 6GHz band check

To post a comment you must log in.
Revision history for this message
StanleyHuang (stanley31) wrote : Posted in a previous version of this proposal

You have to call system.exit or raise SystemExit in python script, or this job would always return ax_6g is supported

https://docs.python.org/3/library/sys.html#sys.exit

review: Needs Fixing

Unmerged commits

ce3896b... by Dirk Su

Add 802.11ax 6GHz band check

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/bin/check_wifi6e.py b/bin/check_wifi6e.py
0new file mode 1007550new file mode 100755
index 0000000..c488575
--- /dev/null
+++ b/bin/check_wifi6e.py
@@ -0,0 +1,37 @@
1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3
4import subprocess
5import sys
6
7
8def main():
9 if len(sys.argv) < 2:
10 print(sys.argv[0] + " [interface]")
11 sys.exit(1)
12
13 _6g_start = 5945
14 _6g_end = 7125
15
16 data = subprocess.run(
17 ['iw', sys.argv[1], 'info'],
18 capture_output=True,
19 encoding='utf-8')
20 if data.returncode:
21 print(sys.argv[1] + " is not valid wireless interface")
22 sys.exit(1)
23 index = data.stdout[data.stdout.find('wiphy') + 6]
24 data = subprocess.getoutput("iw phy" + index + " info").splitlines()
25 for i, line in enumerate(data):
26 if 'Frequencies' in line:
27 while data[i + 1].startswith('\t\t\t'):
28 if 'disabled' not in (data[i + 1]):
29 freq = int(data[i + 1].split()[1])
30 if freq > _6g_start and freq < _6g_end:
31 sys.exit(0)
32 i = i + 1
33 sys.exit(1)
34
35
36if __name__ == '__main__':
37 main()
diff --git a/jobs/resource.pxu b/jobs/resource.pxu
index b84432e..9f29791 100644
--- a/jobs/resource.pxu
+++ b/jobs/resource.pxu
@@ -276,6 +276,7 @@ command:
276 # MCS 10 and 11 if present support the ax only 1024-QAM 276 # MCS 10 and 11 if present support the ax only 1024-QAM
277 # shellcheck disable=SC2046277 # shellcheck disable=SC2046
278 for i in $(iw dev | grep -oP 'Interface\s+\K\w+'); do iw phy phy$(iw dev "$i" info | grep -oP 'wiphy\s+\K\d+') info | grep -q 'MCS 0-11' && echo "$i""_ax: supported" || echo "$i""_ax: unsupported"; done278 for i in $(iw dev | grep -oP 'Interface\s+\K\w+'); do iw phy phy$(iw dev "$i" info | grep -oP 'wiphy\s+\K\d+') info | grep -q 'MCS 0-11' && echo "$i""_ax: supported" || echo "$i""_ax: unsupported"; done
279 for i in $(iw dev | grep -oP 'Interface\s+\K\w+'); do check_wifi6e.py $i && echo "$i""_ax_6g: supported" || echo "$i""_ax_6g: unsupported"; done
279estimated_duration: 0.5280estimated_duration: 0.5
280flags: preserve-locale281flags: preserve-locale
281282

Subscribers

People subscribed via source and target branches