Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4495

Networking and servers • Scan WiFi networks only on 2.4 G band?

$
0
0
I have a script that is intended to select which access point to connect an RPi to based on its strength.
To figure out which is the strongest I use these constructs in a script, which I got help to write in this old thread.:

Code:

sudo wpa_cli -i wlan0 scansudo wpa_cli -i wlan0 scan_results | awk '{ print $5 }' | tail -n +2 | head -1
The result gives me the ssid of the network with the strongest level, however I found out today that it actually uses the 5G band which I don't want...
If I just list the output of the scan I get this:

Code:

sudo wpa_cli -i wlan0 scan_resultsbssid / frequency / signal level / flags / ssid7c:10:c9:af:4c:8c       5500    -53     [WPA2-PSK-CCMP][WPS][ESS]       bossefiber2c:4d:54:6b:ab:20       2412    -63     [WPA2-PSK-CCMP][WPS][ESS]       guesthousefiber7c:10:c9:af:4c:88       2462    -53     [WPA2-PSK-CCMP][WPS][ESS]       bossefiber2c:4d:54:6b:ab:24       5180    -85     [WPA2-PSK-CCMP][ESS]    bossefiber5g
As you can see all the AP:s with 5G are also listed, which is not what I want.

Questions:
How can I limit the scan to only the 2G band?
or
How can I extract only the items where the frequency column is below 5000?

I am extremely bad at using sed and awk so I need some helping hand here....

Statistics: Posted by Bosse_B — Sun Aug 11, 2024 9:54 am — Replies 0 — Views 7



Viewing all articles
Browse latest Browse all 4495

Trending Articles