Update ieee80211_frequency_to_channel from iw

Make sure the definition of `ieee80211_frequency_to_channel` matches
with the latest changes from iw. Probably not very useful since all
changes seem related to 6GHz / 60GHz / 802.11ah support, which as far
as I can tell create_ap does not yet support.

See also: https://git.kernel.org/pub/scm/linux/kernel/git/jberg/iw.git/commit/?id=43789196906376cc108ed06b4a3175d767586cd3
          https://git.kernel.org/pub/scm/linux/kernel/git/jberg/iw.git/commit/?id=b12fc8a84480d25ea791f0dff8cb92d69098c91c
          https://git.kernel.org/pub/scm/linux/kernel/git/jberg/iw.git/commit/?id=f2d9f5b52677f5414dc194be94b5916d2b080eab
This commit is contained in:
Joan Bruguera Micó 2023-12-23 21:35:36 +00:00
parent 50cf12cbb5
commit 9c0be26f1a

View File

@ -342,15 +342,21 @@ ieee80211_frequency_to_channel() {
local FREQ_MAYBE_FRACTIONAL=$1
local FREQ=${FREQ_MAYBE_FRACTIONAL%.*}
if [[ $FREQ -eq 2484 ]]; then
if [[ $FREQ -lt 1000 ]]; then
echo 0
elif [[ $FREQ -eq 2484 ]]; then
echo 14
elif [[ $FREQ -eq 5935 ]]; then
echo 2
elif [[ $FREQ -lt 2484 ]]; then
echo $(( ($FREQ - 2407) / 5 ))
elif [[ $FREQ -ge 4910 && $FREQ -le 4980 ]]; then
echo $(( ($FREQ - 4000) / 5 ))
elif [[ $FREQ -le 45000 ]]; then
elif [[ $FREQ -lt 5950 ]]; then
echo $(( ($FREQ - 5000) / 5 ))
elif [[ $FREQ -ge 58320 && $FREQ -le 64800 ]]; then
elif [[ $FREQ -le 45000 ]]; then
echo $(( ($FREQ - 5950) / 5 ))
elif [[ $FREQ -ge 58320 && $FREQ -le 70200 ]]; then
echo $(( ($FREQ - 56160) / 2160 ))
else
echo 0