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

Proposed by Dirk Su
Status: Superseded
Proposed branch: ~dirksu/plainbox-provider-checkbox:check_wifi6e
Merge into: plainbox-provider-checkbox:master
Diff against target: 77 lines (+63/-0)
2 files modified
bin/check_wifi6e.py (+44/-0)
units/wireless/jobs.pxu (+19/-0)
Reviewer Review Type Date Requested Status
Sylvain Pineau (community) Needs Fixing
Kai-Chuan Hsieh Pending
Review via email: mp+416175@code.launchpad.net

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

Commit message

Check if wifi6e 6GHz band enabled with Kernel less then 5.15 or Ubuntu older then 20.xx

To post a comment you must log in.
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

The way you're parsing iw output should be added to the existing https://git.launchpad.net/plainbox-provider-resource/tree/jobs/resource.pxu#n268 resource job wireless_sta_protocol (Station supported protocols as opposed to AP mode).

I've already added some logic to guess from iw output if ax is supported via MCS 0-11.

I think you can add a new property to this resource to add info about the 6GHz support

review: Needs Fixing

Unmerged commits

903a32c... by Dirk Su

Check wifi 6GHz band status

CHeck if wifi 6GHz band enabed with Kernel less then 5.15 or
Ubuntu older then 20.xx

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..424a412
4--- /dev/null
5+++ b/bin/check_wifi6e.py
6@@ -0,0 +1,44 @@
7+#!/usr/bin/env python3
8+# -*- coding: utf-8 -*-
9+
10+import subprocess
11+import sys
12+import lsb_release
13+
14+
15+def main():
16+ if len(sys.argv) < 2:
17+ print(sys.argv[0] + " [interface]")
18+ return 0
19+
20+ ubuntu_version = lsb_release.get_distro_information()['RELEASE'].split('.')
21+ kernel_version = subprocess.getoutput('uname -r').split('.')
22+ # kernel > 5.15 and ubuntu > 20.xx
23+ if int(ubuntu_version[0]) > 20 and int(kernel_version[1]) > 15:
24+ return 0
25+
26+ _6g_start = 5945
27+ _6g_end = 7125
28+
29+ data = subprocess.run(
30+ ['iw', sys.argv[1], 'info'],
31+ capture_output=True,
32+ encoding='utf-8')
33+ if data.returncode:
34+ print(sys.argv[1] + " is not valid wireless interface")
35+ return 0
36+ index = data.stdout[data.stdout.find('wiphy') + 6]
37+ data = subprocess.getoutput("iw phy" + index + " info").splitlines()
38+ for i, line in enumerate(data):
39+ if 'Frequencies' in line:
40+ while data[i + 1].startswith('\t\t\t'):
41+ if 'disabled' not in (data[i + 1]):
42+ freq = int(data[i + 1].split()[1])
43+ if freq > _6g_start and freq < _6g_end:
44+ raise SystemExit("Contain 6Ghz band and Kernel not over 5.15") # noqa: E501
45+ i = i + 1
46+ return 0
47+
48+
49+if __name__ == '__main__':
50+ main()
51diff --git a/units/wireless/jobs.pxu b/units/wireless/jobs.pxu
52index 05349b8..a917213 100644
53--- a/units/wireless/jobs.pxu
54+++ b/units/wireless/jobs.pxu
55@@ -551,3 +551,22 @@ command:
56 estimated_duration: 2.0
57 depends: wireless/nm_connection_save_{interface}
58 flags: preserve-locale also-after-suspend
59+
60+unit: template
61+template-resource: device
62+template-filter: device.category == 'WIRELESS' and device.interface != 'UNKNOWN'
63+template-unit: job
64+id: wireless/check_{interface}_wifi6e_enabled
65+category_id: com.canonical.plainbox::wireless
66+_summary: Check the status of Wifi6e
67+plugin: shell
68+requires:
69+ package.name == 'coreutils'
70+ package.name == 'iw'
71+ package.name == 'lsb-release'
72+command:
73+ check_wifi6e.py {interface}
74+estimated_duration: 2.0
75+_description:
76+ Check if the system enable Wifi6e 6GHz band with Kernel less then 5.15 or
77+ Ubuntu older then 20.xx

Subscribers

People subscribed via source and target branches