From 9c0be26f1a29eaec7fa8b65742edb73862481891 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20Bruguera=20Mic=C3=B3?= Date: Sat, 23 Dec 2023 21:35:36 +0000 Subject: [PATCH] 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 --- src/scripts/create_ap | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/scripts/create_ap b/src/scripts/create_ap index 20efc7b..d9d8fd6 100755 --- a/src/scripts/create_ap +++ b/src/scripts/create_ap @@ -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