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
StanleyHuang Needs Fixing
Review via email: mp+416511@code.launchpad.net

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

Commit message

Add 802.11ax 6GHz band check

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

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

dcb43f8... 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
1diff --git a/bin/check_wifi6e.py b/bin/check_wifi6e.py
2new file mode 100755
3index 0000000..64aab2c
4--- /dev/null
5+++ b/bin/check_wifi6e.py
6@@ -0,0 +1,37 @@
7+#!/usr/bin/env python3
8+# -*- coding: utf-8 -*-
9+
10+import subprocess
11+import sys
12+
13+
14+def main():
15+ if len(sys.argv) < 2:
16+ print(sys.argv[0] + " [interface]")
17+ return 1
18+
19+ _6g_start = 5945
20+ _6g_end = 7125
21+
22+ data = subprocess.run(
23+ ['iw', sys.argv[1], 'info'],
24+ capture_output=True,
25+ encoding='utf-8')
26+ if data.returncode:
27+ print(sys.argv[1] + " is not valid wireless interface")
28+ return 1
29+ index = data.stdout[data.stdout.find('wiphy') + 6]
30+ data = subprocess.getoutput("iw phy" + index + " info").splitlines()
31+ for i, line in enumerate(data):
32+ if 'Frequencies' in line:
33+ while data[i + 1].startswith('\t\t\t'):
34+ if 'disabled' not in (data[i + 1]):
35+ freq = int(data[i + 1].split()[1])
36+ if freq > _6g_start and freq < _6g_end:
37+ return 0
38+ i = i + 1
39+ return 1
40+
41+
42+if __name__ == '__main__':
43+ main()
44diff --git a/jobs/resource.pxu b/jobs/resource.pxu
45index b84432e..9f29791 100644
46--- a/jobs/resource.pxu
47+++ b/jobs/resource.pxu
48@@ -276,6 +276,7 @@ command:
49 # MCS 10 and 11 if present support the ax only 1024-QAM
50 # shellcheck disable=SC2046
51 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
52+ 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
53 estimated_duration: 0.5
54 flags: preserve-locale
55

Subscribers

People subscribed via source and target branches