How can I get a list of valid WiFi channels?

Is it possible to get a list of valid WiFi channels using some sort of CLI command so that I can ensure only these channels are displayed on the frontend? Thanks.

hello,

what do you mean by "valid" channels?

Christoph

Channels that will work if applied to the WiFi device. Some 5Ghz channels that work on other routers don't seem to work on my current router which has LEDE flashed to it, and I was wondering if it wasn't possible to get a list of the valid channels so that only these are displayed for the user to select on the front end. Thanks.

iw list

root@LEDE:~# iw list
Wiphy phy1
        max # scan SSIDs: 4
        max scan IEs length: 2261 bytes
        max # sched scan SSIDs: 0
        max # match sets: 0
...
                Frequencies:
                        * 5180 MHz [36] (17.0 dBm)
                        * 5200 MHz [40] (17.0 dBm)
                        * 5220 MHz [44] (17.0 dBm)
                        * 5240 MHz [48] (17.0 dBm)
                        * 5260 MHz [52] (20.0 dBm) (radar detection)
...

@rj-45
valid channels vary by country settings.

1 Like

That looks like what I need. I notice it says that the output isn't consistent and therefore shouldn't be screen scraped. Is there a version of this which is safe to be parsed by a script to pass these channels to the frontend. Thanks for the help.

Channels that will work if applied to the WiFi device. Some 5Ghz channels that
work on other routers don't seem to work on my current router which has LEDE
flashed to it, and I was wondering if it wasn't possible to get a list of the
valid channels so that only these are displayed for the user to select on the
front end. Thanks.

The LUCI gui should already be doing this.

There are two things that define "working" channels on the 5GHz band

first is what country code you have the device set to. This defines what's legal
to try (and is what LUCI should be showing you)

Then there is the issue of DFS channels and radar detection. channels 50-144 are
only allowed to be used if the system is setup to detect if radar is in use on
those channels. If it detects radar, it will switch you off of the channel
(probably to channel 36)

since it's not clear what channels you are having trouble with, or what you mean
by "don't seem to work", it's hard to help you.

David Lang

I think that the channels part is stable and can be parsed from the output.

You can use this to get only the channels:

iw phy phy0 channels
iw phy phy1 channels

Alternative is also

iwinfo wlan0 freqlist
iwinfo wlan1 freqlist

I did not check, which of these LuCI is using, but likely one of them.

1 Like

Ok thanks. This looks like what I need - much appreciated. Do you know what the 'radar detection' in brackets after the channel means? Are these channels used by radar and therefore can't be used.

I can't recall what the range was, but channel 100 for example didn't work. I'm writing my own frontend which is why I require this. Does the 'iw' command filter channels to show only channels legal in the country and channels which aren't being used by radar. Does 'radar detection' mean that the channel can't be used as it is being used by radar?

Thanks for the help.

<forum+reply-97defe657be7b1181b116d908460bce0@lede-project.org>
 of valid WiFi channels?

Ok thanks. This looks like what I need - much appreciated. Do you know what the 'radar detection' in brackets after the channel means? Are these channels used by radar and therefore can't be used.

that means that it's a DFS channel, which menast tht if there is radar on that
frequency, you can't use it. There are actually very few places where the radar
is used (~50 airports ,all by Vegas are in the eastern US), but the radar
detection for some chipsets is horribly bad and will detect any noise on the
channel (including an access point that's just a bit to far away) as "radar"

I can't recall what the range was, but channel 100 for example didn't work. I'm writing my own frontend which is why I require this. Does the 'iw' command filter channels to show only channels legal in the country and channels which aren't being used by radar. Does 'radar detection' mean that the channel can't be used as it is being used by radar?

if it's the radar detection for DFS that's causing this, you would be able to
select the channel, but it may switch away from that channel when you don't want
it to.

David Lang

1 Like

Thanks. From this then, I take it that it's best not to show channels that have 'radar detection' to avoid any problems? Does the output of the command also filter channels depending on country code?

Yes and yes.

The wifi driver itself adjusts the available channels based on the country code. These commands just query the driver for the channels.

Thanks. From this then, I take it that it's best not to show channels that have 'radar detection' to avoid any problems?

if you are willing to accept the tradeoff of loosing access to all those
channels. The radar detection works better on some chipsets than on others, and
people in some areas can use these channels more reliably than in others (even
with the less accurate chipsets)

David Lang

Ok, great, this is exactly what I needed. Is there a difference between '(no IR, radar detection)' and '(radar detection)'?

Also, is there a way to map between radio0/1, phy0/1 and wlan0/1?

Also, is there a way to map between radio0/1, phy0/1 and wlan0/1?

radio0 is going to be phy0 by default (but the device line in the wlan config
could change this I beleive)

wlan0/wlan1 and wlan0-1 etc are defined as you define SSIDs on the radios.

by default, all '0' things will be related.

David Lang