Skip to content

support new wifi channel standards(issue #11) #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions wpa_supplicant/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,15 +697,22 @@ def to_dict(self):
# Properties
#
def get_channel(self):
"""Wi-Fi channel number (1-14)"""
"""Wi-Fi channel number(now supporting 802.11ax)"""
freq = self.get_frequency()

if freq == 2484: # Handle channel 14
if freq == 2484:
return 14
elif freq >= 2412 and freq <= 2472:
return 1 + (freq - 2412) / 5
elif freq >= 5180 and freq <= 5905:
return 36 + (freq - 5180) / 5
elif freq < 2484:
return int((freq - 2407) / 5)
elif freq >= 4910 and freq <= 4980:
return int((freq - 4000) / 5)
elif freq < 5925:
return int((freq - 5000) / 5)
elif freq == 5935:
return 2
elif freq <= 45000:
return int((freq - 5950) / 5)
elif freq >= 58320 and freq <= 70200:
return int((freq - 56160) / 2160)
else:
logger.warn('Unexpected frequency %s', freq)
raise WpaSupplicantException('Unexpected frequency in WiFi connection.')
Expand Down