i want to calculate how long a wifi channel was busy. Carrier sensing is the method to get the result. Virtual carrier sensing is not giving very accurate result. Can anybody help me getting the same via physical carrier sensing method.
1 Answer
For this task I would recommend using dedicated hardware, i.e. a spectrum analyzer capable of measuring duty cycle, but since you are asking on SO, I assume that you are looking for a computer/software-based solution.
The feature you are looking for is not commonly found in WiFi chipsets. If you have a wireless NIC which is based on an Atheros (Qualcom) chipset from the 5000 or 9000 series, you are lucky. These chips have 'profile counters' which allow to estimate how often the wireless channel is busy. You can find more information in US patent 7522669 and various research papers.
In Linux, you access the information using the iw
tool as follows:
# iw wlan0 survey dump
Survey data from wlan0
frequency: 5180 MHz
noise: -95 dBm
channel active time: 57 ms
channel busy time: 9 ms
channel receive time: 2 ms
channel transmit time: 0 ms
Survey data from wlan0
frequency: 5200 MHz [in use]
noise: -95 dBm
channel active time: 3323193893 ms
channel busy time: 255819493 ms
channel receive time: 247576377 ms
channel transmit time: 231 ms
[…]
Note that the counter are only updated while the wireless NIC is on the respective channel. The example above is taken from an access point operating on channel 40.
Other chipsets/drivers may support similar features, too, but I am not aware of them.
-
Doesn't give any output for me, it just immediately exits. What worked for me was simply scanning and looking in the "BSS Load" section at "channel utilisation". To get an overview of what the APs around you are reporting on different channels, you can use:
sudo iw wlp3s0 scan | grep -e SSID: -e freq -e utilisation -e '(on'
where wlp3s0 is the device name.– LucCommented Nov 27, 2020 at 16:19